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 <?php 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 class PatternMainPage { 19 class PatternMainPage {
18 20
@@ -53,6 +55,8 @@ class PatternMainPage { @@ -53,6 +55,8 @@ class PatternMainPage {
53 55
54 var $sHelpContext = "browse"; 56 var $sHelpContext = "browse";
55 57
  58 + var $onLoadJavaScript;
  59 +
56 function setNorthWestPayload($oNewVal) { 60 function setNorthWestPayload($oNewVal) {
57 $this->oNorthWestPayload = & $oNewVal; 61 $this->oNorthWestPayload = & $oNewVal;
58 } 62 }
@@ -85,6 +89,10 @@ class PatternMainPage { @@ -85,6 +89,10 @@ class PatternMainPage {
85 $this->sWestPayloadBackGroundColour = $sColour; 89 $this->sWestPayloadBackGroundColour = $sColour;
86 } 90 }
87 91
  92 + function getFormAction() {
  93 + return $this->sFormAction;
  94 + }
  95 +
88 function setFormAction($sNewVal) { 96 function setFormAction($sNewVal) {
89 $this->sFormAction = & $sNewVal; 97 $this->sFormAction = & $sNewVal;
90 } 98 }
@@ -105,6 +113,11 @@ class PatternMainPage { @@ -105,6 +113,11 @@ class PatternMainPage {
105 $this->sHelpContext = $sNewValue; 113 $this->sHelpContext = $sNewValue;
106 } 114 }
107 115
  116 + function setOnLoadJavaScript($sJavaScript) {
  117 + $this->onLoadJavaScript = $sJavaScript;
  118 + }
  119 +
  120 +
108 121
109 /** 122 /**
110 * Render the page in HTML 123 * Render the page in HTML
@@ -113,12 +126,12 @@ class PatternMainPage { @@ -113,12 +126,12 @@ class PatternMainPage {
113 global $default; 126 global $default;
114 $sToRender = "<html>\n" . 127 $sToRender = "<html>\n" .
115 "<head>\n" . 128 "<head>\n" .
116 - "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . "\">\n" . 129 + "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . ";\">\n" .
117 "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n" . 130 "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n" .
118 "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n". 131 "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n".
119 PatternMainPage::getJavaScript() . "\n" . 132 PatternMainPage::getJavaScript() . "\n" .
120 "</head>\n" . 133 "</head>\n" .
121 - "<body marginleft=\"0\" marginheight=\"0\">\n"; 134 + "<body marginleft=\"0\" marginheight=\"0\"" . (isset($this->onLoadJavaScript) ? "onload=\"$this->onLoadJavaScript\"" : "") . ">\n";
122 // hack to circumvent the crapness of ns 4.79 135 // hack to circumvent the crapness of ns 4.79
123 if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) { 136 if (! (($default->phpSniff->property("browser") == "moz") && ($default->phpSniff->property("version") <= "4.79")) ) {
124 $sToRender .= "<div id=\"divUp\">" . 137 $sToRender .= "<div id=\"divUp\">" .
@@ -129,7 +142,7 @@ class PatternMainPage { @@ -129,7 +142,7 @@ class PatternMainPage {
129 "</div>"; 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 "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"700\" height=\"600\">\n " . 146 "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"700\" height=\"600\">\n " .
134 "<tr>\n". 147 "<tr>\n".
135 "<td height=\"0\" valign=\"top\" " . (isset($this->sNorthWestPayloadBackGroundColour) ? " bgcolor=\"" . $this->sNorthWestPayloadBackGroundColour . "\"" : "") . ">\n"; 148 "<td height=\"0\" valign=\"top\" " . (isset($this->sNorthWestPayloadBackGroundColour) ? " bgcolor=\"" . $this->sNorthWestPayloadBackGroundColour . "\"" : "") . ">\n";
@@ -184,12 +197,12 @@ class PatternMainPage { @@ -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 function getJavaScript() { 206 function getJavaScript() {
194 global $default; 207 global $default;
195 $sUrl = $default->uiUrl; 208 $sUrl = $default->uiUrl;