Commit 986f85deb99a5ad4462d81f8df65a6f375170bc3

Authored by Michael Joseph
1 parent ae1ddeb1

refactored input text box netscape 4.x disabling javascript


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2345 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/createDependantDocumentBL.php
... ... @@ -58,8 +58,9 @@ if (checkSession()) {
58 58 $oPatternCustom = & new PatternCustom();
59 59 $oPatternCustom->setHtml(getPage($oDocument->getFolderID(), $fDocumentID, $fUnitID, $fUserID, $fDocumentTitle, $fTemplateDocument));
60 60 $main->setCentralPayload($oPatternCustom);
  61 + $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
61 62 $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1");
62   - $main->setErrorMessage("An error occured whilst trying to create the dependant document");
  63 + $main->setErrorMessage("An error occurred whilst trying to create the dependant document");
63 64 $main->render();
64 65  
65 66 }
... ... @@ -70,6 +71,7 @@ if (checkSession()) {
70 71  
71 72 $oPatternCustom = & new PatternCustom();
72 73 $oPatternCustom->setHtml(getPage($oDocument->getFolderID(), $fDocumentID, $fUnitID, $fUserID, $fDocumentTitle, $fTemplateDocument));
  74 + $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
73 75 $main->setCentralPayload($oPatternCustom);
74 76 $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1");
75 77 $main->render();
... ...
presentation/lookAndFeel/knowledgeTree/documentmanagement/createDependantDocumentUI.inc
... ... @@ -27,14 +27,12 @@ function getPage($iFolderID, $iDocumentID, $iUnitID, $iUserID, $sDocumentTitle,
27 27  
28 28 //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use
29 29 //javascript to set the onFocus attribute to blur
30   - $bAddNetscapeScript = false;
31   - if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) {
  30 + if (!$default->bNN4) {
32 31 //for any other browser but netscape 4.7 do this
33 32 $sToRender .= "<td>Template document</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocument\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
34   - }else {
  33 + } else {
35 34 //for netscape 4.7 do this
36 35 $sToRender .= "<td>Template document</td><td><input type=\"text\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
37   - $bAddNetscapeScript = true;
38 36 }
39 37 $sToRender .= "</tr>\n";
40 38 $sToRender .= "<tr>\n";
... ... @@ -43,7 +41,7 @@ function getPage($iFolderID, $iDocumentID, $iUnitID, $iUserID, $sDocumentTitle,
43 41 $sToRender .= "</table>\n";
44 42 $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";
45 43  
46   - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript() . ($bAddNetscapeScript ? getNetscapeDisableScript() : "");
  44 + return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
47 45 }
48 46  
49 47 function getUserDropDown($iUnitID, $iUserID) {
... ... @@ -96,18 +94,4 @@ function getBrowseJavaScript() {
96 94 $sToRender .= "//--></script>\n";
97 95 return $sToRender;
98 96 }
99   -
100   -function getNetscapeDisableScript() {
101   - $sToRender = "<script language=\"JavaScript\"><!--\n ";
102   - $sToRender .= "function disable(elem) {\n";
103   - $sToRender .= "\telem.onfocus=elem.blur;\n";
104   - $sToRender .= "}\n";
105   - $sToRender .= "//--></script>\n\n";
106   - return $sToRender;
107   -
108   -}
109   -
110   -
111   -
112   -
113 97 ?>
114 98 \ No newline at end of file
... ...
presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsBL.php
... ... @@ -70,6 +70,7 @@ if (checkSession()) {
70 70  
71 71 $oPatternCustom = & new PatternCustom();
72 72 $oPatternCustom->setHtml(getAddPage($fFolderCollaborationID, $fFolderID, (isset($fUnitID) ? $fUnitID : -1), (isset($fDocumentTitle) ? $fDocumentTitle : ""), (isset($fDocument) ? $fDocument : ""), (isset($fTargetDocumentID) ? $fTargetDocumentID : "") ));
  73 + $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
73 74 $main->setCentralPayload($oPatternCustom);
74 75 $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForStore=1");
75 76 $main->setHasRequiredFields(true);
... ... @@ -98,6 +99,7 @@ if (checkSession()) {
98 99  
99 100 $oPatternCustom = & new PatternCustom();
100 101 $oPatternCustom->setHtml(getEditPage($fFolderID, $fDependantDocumentTemplateID, $fFolderCollaborationID, $oDependantDocumentTemplate->getDocumentTitle(), (isset($oDocument) ? $oDocument->getName() : ""), (isset($oDocument) ? $oDependantDocumentTemplate->getTemplateDocumentID() : null), $oDependantDocumentTemplate->getDefaultUserID()));
  102 + $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
101 103 $main->setCentralPayload($oPatternCustom);
102 104 $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fDependantDocumentTemplateID=$fDependantDocumentTemplateID&fForUpdate=1");
103 105 $main->setHasRequiredFields(true);
... ...
presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsUI.inc
... ... @@ -73,14 +73,12 @@ function getEditPage($iFolderID, $iDependantDocumentID, $iFolderCollaborationID,
73 73  
74 74 //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use
75 75 //javascript to set the onFocus attribute to blur
76   - $bAddNetscapeScript = false;
77   - if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) {
  76 + if (!$default->bNN4) {
78 77 //for any other browser but netscape 4.7 do this
79 78 $sToRender .= "<td>Template document</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocumentName\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('" . generateControllerLink("templateBrowse", "") . "','window2')\"></td>\n";
80   - }else {
  79 + } else {
81 80 //for netscape 4.7 do this
82 81 $sToRender .= "<td>Template document</td><td><input type=\"text\" value=\"$sTemplateDocumentName\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('http://ktdev/control.php?action=templateBrowse','window2')\"></td>\n";
83   - $bAddNetscapeScript = true;
84 82 }
85 83 $sToRender .= "</tr>\n";
86 84 $sToRender .= "<tr>\n";
... ... @@ -89,7 +87,7 @@ function getEditPage($iFolderID, $iDependantDocumentID, $iFolderCollaborationID,
89 87 $sToRender .= "</table>\n";
90 88 $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";
91 89  
92   - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript() . ($bAddNetscapeScript ? getNetscapeDisableScript() : "");
  90 + return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
93 91 }
94 92  
95 93  
... ... @@ -111,16 +109,12 @@ function getAddPage($iFolderCollaborationID, $iFolderID, $iUnitID, $sDocumentTit
111 109  
112 110 //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use
113 111 //javascript to set the onFocus attribute to blur
114   - $bAddNetscapeScript = false;
115   - if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) {
  112 + if (!$default->bNN4) {
116 113 //for any other browser but netscape 4.7 do this
117   - //$sToRender .= "<td>Template document</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocument\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('http://ktdev/control.php?action=templateBrowse','window2')\"></td>\n";
118 114 $sToRender .= "<td>Template document</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocument\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
119   - }else {
  115 + } else {
120 116 //for netscape 4.7 do this
121   - //$sToRender .= "<td>Template document</td><td><input type=\"text\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('http://ktdev/control.php?action=templateBrowse','window2')\"></td>\n";
122 117 $sToRender .= "<td>Template document</td><td><input type=\"text\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
123   - $bAddNetscapeScript = true;
124 118 }
125 119 $sToRender .= "</tr>\n";
126 120 $sToRender .= "<tr>\n";
... ... @@ -129,7 +123,7 @@ function getAddPage($iFolderCollaborationID, $iFolderID, $iUnitID, $sDocumentTit
129 123 $sToRender .= "</table>\n";
130 124 $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";
131 125  
132   - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript() . ($bAddNetscapeScript ? getNetscapeDisableScript() : "");
  126 + return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
133 127 }
134 128  
135 129 function getUserDropDown($iUnitID, $iUserID = null) {
... ... @@ -176,18 +170,4 @@ function getBrowseJavaScript() {
176 170 $sToRender .= "//--></script>\n";
177 171 return $sToRender;
178 172 }
179   -
180   -function getNetscapeDisableScript() {
181   - $sToRender = "<script language=\"JavaScript\"><!--\n ";
182   - $sToRender .= "function disable(elem) {\n";
183   - $sToRender .= "\telem.onfocus=elem.blur;\n";
184   - $sToRender .= "}\n";
185   - $sToRender .= "//--></script>\n\n";
186   - return $sToRender;
187   -
188   -}
189   -
190   -
191   -
192   -
193 173 ?>
194 174 \ No newline at end of file
... ...
presentation/lookAndFeel/knowledgeTree/js/misc.js
  1 +<!-- Original: desypfa@hotmail.com -->
  2 +<!-- Modified: Benjamin Wright, Editor -->
  3 +<!-- This script and many more are available free online at -->
  4 +<!-- The JavaScript Source!! http://javascript.internet.com -->
  5 +
  6 +function redirTimer(redirTime, redirURL) {
  7 + self.setTimeout("self.location.href = redirURL;",redirTime);
  8 + alert("set redirect time=" + redirTime + ", url=" + redirURL);
  9 +}
  10 +
  11 +function disable(elem) {
  12 + elem.onfocus=elem.blur;
  13 +}
  14 +
1 15 function setActionAndSubmit(newAction) {
2 16 document.MainForm.action = newAction;
3 17 document.MainForm.submit();
... ...