Commit 2b9d0b6fb679ea0d61ba3e29442df0ca02189894

Authored by Michael Joseph
1 parent f8611213

added onLoadJavascript attribute

fixed session timeout for ns 4.7
added getFormAction method


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2122 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/visualpatterns/PatternMainPage.inc
1 1 <?php
2 2  
3 3 /**
4   -*
5   -* Main page of the document management system. Consists of a 2 x 2 HTML table.
6   -* Custom defined payloads can be placed in each of the table cells, giving a reasonable
7   -* amount of layout/design flexibility
8   -*
9   -* JavaScript to validate numbers and strings is included by default
10   -*
11   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
12   -* @date 12 December 2002
13   -* @package lib.visualpatterns
14   -*
15   -*/
  4 + * $Id$
  5 + *
  6 + * Main page of the document management system. Consists of a 2 x 2 HTML table.
  7 + * Custom defined payloads can be placed in each of the table cells, giving a reasonable
  8 + * amount of layout/design flexibility
  9 + *
  10 + * JavaScript to validate numbers and strings is included by default
  11 + *
  12 + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  13 + *
  14 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  15 + * @date 12 December 2002
  16 + * @package lib.visualpatterns
  17 + */
16 18  
17 19 class PatternMainPage {
18 20  
... ... @@ -53,6 +55,8 @@ class PatternMainPage {
53 55  
54 56 var $sHelpContext = "browse";
55 57  
  58 + var $onLoadJavaScript;
  59 +
56 60 function setNorthWestPayload($oNewVal) {
57 61 $this->oNorthWestPayload = & $oNewVal;
58 62 }
... ... @@ -85,6 +89,10 @@ class PatternMainPage {
85 89 $this->sWestPayloadBackGroundColour = $sColour;
86 90 }
87 91  
  92 + function getFormAction() {
  93 + return $this->sFormAction;
  94 + }
  95 +
88 96 function setFormAction($sNewVal) {
89 97 $this->sFormAction = & $sNewVal;
90 98 }
... ... @@ -105,6 +113,11 @@ class PatternMainPage {
105 113 $this->sHelpContext = $sNewValue;
106 114 }
107 115  
  116 + function setOnLoadJavaScript($sJavaScript) {
  117 + $this->onLoadJavaScript = $sJavaScript;
  118 + }
  119 +
  120 +
108 121  
109 122 /**
110 123 * Render the page in HTML
... ... @@ -113,12 +126,12 @@ class PatternMainPage {
113 126 global $default;
114 127 $sToRender = "<html>\n" .
115 128 "<head>\n" .
116   - "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . "\">\n" .
  129 + "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . ";\">\n" .
117 130 "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n" .
118 131 "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n".
119 132 PatternMainPage::getJavaScript() . "\n" .
120 133 "</head>\n" .
121   - "<body marginleft=\"0\" marginheight=\"0\">\n";
  134 + "<body marginleft=\"0\" marginheight=\"0\"" . (isset($this->onLoadJavaScript) ? "onload=\"$this->onLoadJavaScript\"" : "") . ">\n";
122 135 // hack to circumvent the crapness of ns 4.79
123 136 if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) {
124 137 $sToRender .= "<div id=\"divUp\">" .
... ... @@ -129,7 +142,7 @@ class PatternMainPage {
129 142 "</div>";
130 143 }
131 144  
132   - $sToRender .= "<form name=\"MainForm\" " . (isset($this->sFormEncType) ? "enctype=\"$this->sFormEncType\" " : " ") . " action=\"".$this->sFormAction."\" method=POST " . (($this->bHasRequiredFields) ? "onsubmit=\"return validateForm(this)\" " : " ") . ">\n" .
  145 + $sToRender .= "<form name=\"MainForm\" " . (isset($this->sFormEncType) ? "enctype=\"$this->sFormEncType\" " : " ") . " action=\"".$this->sFormAction."\" method=\"POST\" " . (($this->bHasRequiredFields) ? "onsubmit=\"return validateForm(this)\" " : " ") . ">\n" .
133 146 "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"700\" height=\"600\">\n " .
134 147 "<tr>\n".
135 148 "<td height=\"0\" valign=\"top\" " . (isset($this->sNorthWestPayloadBackGroundColour) ? " bgcolor=\"" . $this->sNorthWestPayloadBackGroundColour . "\"" : "") . ">\n";
... ... @@ -184,12 +197,12 @@ class PatternMainPage {
184 197 }
185 198  
186 199 /**
187   - * Returns links to javascript that has 3 functions:
188   - * o validateString - validates a string
189   - * o validateNumber - validates a number
190   - * o setActionAndSubmit - sets the MainForm action to newAction and submits
191   - * And includes the dhtml text scrolling routine
192   - */
  200 + * Returns links to javascript that has 3 functions:
  201 + * o validateString - validates a string
  202 + * o validateNumber - validates a number
  203 + * o setActionAndSubmit - sets the MainForm action to newAction and submits
  204 + * And includes the dhtml text scrolling routine
  205 + */
193 206 function getJavaScript() {
194 207 global $default;
195 208 $sUrl = $default->uiUrl;
... ...