Commit ab6b3416d9938933ef7139b7b51d767e0456dcde
1 parent
f5fb63d7
refactored input text box netscape 4.x disabling javascript
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2347 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
11 additions
and
19 deletions
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/addUserBL.php
| @@ -58,6 +58,7 @@ if (checkSession()) { | @@ -58,6 +58,7 @@ if (checkSession()) { | ||
| 58 | } else { | 58 | } else { |
| 59 | if($bLdap) { | 59 | if($bLdap) { |
| 60 | $oPatternCustom->setHtml(getDetailsLDAPPage($sSearch,$aResults, $oAuth->oLdap->getUserIdentifier())); | 60 | $oPatternCustom->setHtml(getDetailsLDAPPage($sSearch,$aResults, $oAuth->oLdap->getUserIdentifier())); |
| 61 | + $main->setOnLoadJavaScript("disable(document.MainForm.fLdap)"); | ||
| 61 | $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); | 62 | $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); |
| 62 | } else { | 63 | } else { |
| 63 | $oPatternCustom->setHtml(getDetailsDBPage($sSearch,$aResults)); | 64 | $oPatternCustom->setHtml(getDetailsDBPage($sSearch,$aResults)); |
| @@ -77,6 +78,7 @@ if (checkSession()) { | @@ -77,6 +78,7 @@ if (checkSession()) { | ||
| 77 | // display details page | 78 | // display details page |
| 78 | if ($bLdap) { | 79 | if ($bLdap) { |
| 79 | $oPatternCustom->setHtml(getDetailsLDAPPage($fName,$aResult, $oAuth->oLdap->getUserIdentifier())); | 80 | $oPatternCustom->setHtml(getDetailsLDAPPage($fName,$aResult, $oAuth->oLdap->getUserIdentifier())); |
| 81 | + $main->setOnLoadJavaScript("disable(document.MainForm.fLdap)"); | ||
| 80 | $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); | 82 | $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); |
| 81 | } else { | 83 | } else { |
| 82 | $oPatternCustom->setHtml(getDetailsDBPage($fName,$aResult)); | 84 | $oPatternCustom->setHtml(getDetailsDBPage($fName,$aResult)); |
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/addUserUI.inc
| @@ -86,14 +86,15 @@ function getDetailsDBPage($suserName, $aAttributes) { | @@ -86,14 +86,15 @@ function getDetailsDBPage($suserName, $aAttributes) { | ||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | function getDetailsLDAPPage($suserName, $aAttributes, $sUserIdentifier) { | 88 | function getDetailsLDAPPage($suserName, $aAttributes, $sUserIdentifier) { |
| 89 | - | ||
| 90 | - $sToRender .= renderHeading("Add User To System"); | ||
| 91 | global $default; | 89 | global $default; |
| 90 | + | ||
| 91 | + $sToRender .= renderHeading("Add User To System"); | ||
| 92 | + | ||
| 92 | foreach ($aAttributes as $sUserName => $aUserAttributes) { | 93 | foreach ($aAttributes as $sUserName => $aUserAttributes) { |
| 93 | $sToRender .= "<table>\n"; | 94 | $sToRender .= "<table>\n"; |
| 94 | $sToRender .= "<tr><td><b>User Details: </b></td></tr>\n"; | 95 | $sToRender .= "<tr><td><b>User Details: </b></td></tr>\n"; |
| 95 | $sToRender .= "<tr>\n"; | 96 | $sToRender .= "<tr>\n"; |
| 96 | - $sToRender .= "<td>LDAP DN: </td><td><input disabled size = \"40\" type=\"text\" name=\"fLdap\" value = \"". $aUserAttributes["dn"]. "\"> </td>\n"; | 97 | + $sToRender .= "<td>LDAP DN: </td><td><input " . ($default->bNN4 ? "onblur=\"disable(document.MainForm.fLdap)" : "DISABLED") . " size = \"40\" type=\"text\" name=\"fLdap\" value = \"". $aUserAttributes["dn"]. "\"> </td>\n"; |
| 97 | $sToRender .= "<input type=\"hidden\" name=\"fLdap\" value = \"". $aUserAttributes["dn"]. "\">\n"; | 98 | $sToRender .= "<input type=\"hidden\" name=\"fLdap\" value = \"". $aUserAttributes["dn"]. "\">\n"; |
| 98 | $sToRender .= "</tr>\n"; | 99 | $sToRender .= "</tr>\n"; |
| 99 | $sToRender .= "<tr>\n"; | 100 | $sToRender .= "<tr>\n"; |
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkBL.php
| @@ -37,7 +37,7 @@ if (checkSession()) { | @@ -37,7 +37,7 @@ if (checkSession()) { | ||
| 37 | //an error occured while trying to create the document link | 37 | //an error occured while trying to create the document link |
| 38 | $oPatternCustom = & new PatternCustom(); | 38 | $oPatternCustom = & new PatternCustom(); |
| 39 | $oPatternCustom->setHtml(getPage($fDocumentID)); | 39 | $oPatternCustom->setHtml(getPage($fDocumentID)); |
| 40 | - | 40 | + $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)"); |
| 41 | $main->setCentralPayload($oPatternCustom); | 41 | $main->setCentralPayload($oPatternCustom); |
| 42 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1"); | 42 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1"); |
| 43 | $main->setHasRequiredFields(true); | 43 | $main->setHasRequiredFields(true); |
| @@ -50,6 +50,7 @@ if (checkSession()) { | @@ -50,6 +50,7 @@ if (checkSession()) { | ||
| 50 | 50 | ||
| 51 | $oPatternCustom = & new PatternCustom(); | 51 | $oPatternCustom = & new PatternCustom(); |
| 52 | $oPatternCustom->setHtml(getPage($fDocumentID)); | 52 | $oPatternCustom->setHtml(getPage($fDocumentID)); |
| 53 | + $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)"); | ||
| 53 | $main->setCentralPayload($oPatternCustom); | 54 | $main->setCentralPayload($oPatternCustom); |
| 54 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1"); | 55 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1"); |
| 55 | $main->setHasRequiredFields(true); | 56 | $main->setHasRequiredFields(true); |
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkUI.inc
| @@ -19,24 +19,21 @@ function getPage($iDocumentID) { | @@ -19,24 +19,21 @@ function getPage($iDocumentID) { | ||
| 19 | $sToRender .= "<tr>"; | 19 | $sToRender .= "<tr>"; |
| 20 | //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use | 20 | //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use |
| 21 | //javascript to set the onFocus attribute to blur | 21 | //javascript to set the onFocus attribute to blur |
| 22 | - $bAddNetscapeScript = false; | ||
| 23 | - if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) { | 22 | + if (!$default->bNN4) { |
| 24 | //for any other browser but netscape 4.7 do this | 23 | //for any other browser but netscape 4.7 do this |
| 25 | $sToRender .= "<td>Document to link</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('" . generateControllerUrl("templateBrowse") . "','window2')\"></td>\n"; | 24 | $sToRender .= "<td>Document to link</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('" . generateControllerUrl("templateBrowse") . "','window2')\"></td>\n"; |
| 26 | - }else { | 25 | + } else { |
| 27 | //for netscape 4.7 do this | 26 | //for netscape 4.7 do this |
| 28 | $sToRender .= "<td>Document to link</td><td><input type=\"text\" value=\"\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('" . generateControllerUrl("templateBrowse") . "','window2')\"></td>\n"; | 27 | $sToRender .= "<td>Document to link</td><td><input type=\"text\" value=\"\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('" . generateControllerUrl("templateBrowse") . "','window2')\"></td>\n"; |
| 29 | - $bAddNetscapeScript = true; | ||
| 30 | } | 28 | } |
| 31 | $sToRender .= "</tr>\n"; | 29 | $sToRender .= "</tr>\n"; |
| 32 | $sToRender .= "<tr>\n"; | 30 | $sToRender .= "<tr>\n"; |
| 33 | $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDocument&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/></a></td></tr></table>\n"; | 31 | $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDocument&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/></a></td></tr></table>\n"; |
| 34 | - //$sToRender .= "<td><table><tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\"/></td><td><a href=\"" . $_SERVER["PHP_SELF"] . "?fDocumentID=$iDocumentID&fForStore=1\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/></a></td></tr></table>\n"; | ||
| 35 | $sToRender .= "</tr>\n"; | 32 | $sToRender .= "</tr>\n"; |
| 36 | $sToRender .= "</table>\n"; | 33 | $sToRender .= "</table>\n"; |
| 37 | $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n"; | 34 | $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n"; |
| 38 | 35 | ||
| 39 | - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript() . ($bAddNetscapeScript ? getNetscapeDisableScript() : ""); | 36 | + return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript(); |
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | function getValidationJavaScript() { | 39 | function getValidationJavaScript() { |
| @@ -58,13 +55,4 @@ function getBrowseJavaScript() { | @@ -58,13 +55,4 @@ function getBrowseJavaScript() { | ||
| 58 | $sToRender .= "//--></script>\n"; | 55 | $sToRender .= "//--></script>\n"; |
| 59 | return $sToRender; | 56 | return $sToRender; |
| 60 | } | 57 | } |
| 61 | - | ||
| 62 | -function getNetscapeDisableScript() { | ||
| 63 | - $sToRender = "<script language=\"JavaScript\"><!--\n "; | ||
| 64 | - $sToRender .= "function disable(elem) {\n"; | ||
| 65 | - $sToRender .= "\telem.onfocus=elem.blur;\n"; | ||
| 66 | - $sToRender .= "}\n"; | ||
| 67 | - $sToRender .= "//--></script>\n\n"; | ||
| 68 | - return $sToRender; | ||
| 69 | -} | ||
| 70 | ?> | 58 | ?> |
| 71 | \ No newline at end of file | 59 | \ No newline at end of file |