Commit 48533f15293e3184586d77e51a350c01b87a84e8

Authored by Conrad Vermeulen
1 parent ea6d6b5c

KTS-673

"The search algorithm needs some work"
Updated.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7190 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/templating/kt3template.inc.php
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 * License Version 1.1.2 ("License"); You may not use this file except in 6 * License Version 1.1.2 ("License"); You may not use this file except in
7 * compliance with the License. You may obtain a copy of the License at 7 * compliance with the License. You may obtain a copy of the License at
8 * http://www.knowledgetree.com/KPL 8 * http://www.knowledgetree.com/KPL
9 - * 9 + *
10 * Software distributed under the License is distributed on an "AS IS" 10 * Software distributed under the License is distributed on an "AS IS"
11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
12 * See the License for the specific language governing rights and 12 * See the License for the specific language governing rights and
@@ -17,9 +17,9 @@ @@ -17,9 +17,9 @@
17 * (ii) the KnowledgeTree copyright notice 17 * (ii) the KnowledgeTree copyright notice
18 * in the same form as they appear in the distribution. See the License for 18 * in the same form as they appear in the distribution. See the License for
19 * requirements. 19 * requirements.
20 - * 20 + *
21 * The Original Code is: KnowledgeTree Open Source 21 * The Original Code is: KnowledgeTree Open Source
22 - * 22 + *
23 * The Initial Developer of the Original Code is The Jam Warehouse Software 23 * The Initial Developer of the Original Code is The Jam Warehouse Software
24 * (Pty) Ltd, trading as KnowledgeTree. 24 * (Pty) Ltd, trading as KnowledgeTree.
25 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 25 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -33,15 +33,16 @@ @@ -33,15 +33,16 @@
33 * KT3 Template Base 33 * KT3 Template Base
34 * 34 *
35 * Represents core UI logic, including how sub-components interact with 35 * Represents core UI logic, including how sub-components interact with
36 - * the overall page. 36 + * the overall page.
37 * 37 *
38 * For the meaning of each of the variables and functions, see inline. 38 * For the meaning of each of the variables and functions, see inline.
39 * 39 *
40 */ 40 */
41 - 41 +
42 require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php"); 42 require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
43 require_once(KT_LIB_DIR . "/templating/templating.inc.php"); 43 require_once(KT_LIB_DIR . "/templating/templating.inc.php");
44 require_once(KT_LIB_DIR . "/session/control.inc"); 44 require_once(KT_LIB_DIR . "/session/control.inc");
  45 +require_once(KT_DIR . '/search2/search/search.inc.php');
45 46
46 class KTPage { 47 class KTPage {
47 var $hide_section = false; 48 var $hide_section = false;
@@ -55,13 +56,13 @@ class KTPage { @@ -55,13 +56,13 @@ class KTPage {
55 var $theme_ie_only_css = Array(); 56 var $theme_ie_only_css = Array();
56 var $js_standalone = Array(); 57 var $js_standalone = Array();
57 var $css_standalone = Array(); 58 var $css_standalone = Array();
58 - 59 +
59 /** context-relevant information */ 60 /** context-relevant information */
60 var $errStack = Array(); 61 var $errStack = Array();
61 var $infoStack = Array(); 62 var $infoStack = Array();
62 var $portlets = Array(); 63 var $portlets = Array();
63 var $show_portlets = true; 64 var $show_portlets = true;
64 - 65 +
65 /** miscellaneous items */ 66 /** miscellaneous items */
66 var $title = ''; 67 var $title = '';
67 var $systemName = APP_NAME; 68 var $systemName = APP_NAME;
@@ -72,11 +73,11 @@ class KTPage { @@ -72,11 +73,11 @@ class KTPage {
72 var $menu = null; 73 var $menu = null;
73 var $userMenu = null; 74 var $userMenu = null;
74 var $helpPage = null; 75 var $helpPage = null;
75 - 76 +
76 /** the "component". Used to set the page header (see documentation for explanation). */ 77 /** the "component". Used to set the page header (see documentation for explanation). */
77 var $componentLabel = 'Browse Documents'; 78 var $componentLabel = 'Browse Documents';
78 var $componentClass = 'browse_collections'; 79 var $componentClass = 'browse_collections';
79 - 80 +
80 /** $contents is the center of the page. In KT < 3, this was CentralPayload. */ 81 /** $contents is the center of the page. In KT < 3, this was CentralPayload. */
81 var $contents = ''; 82 var $contents = '';
82 83
@@ -84,14 +85,14 @@ class KTPage { @@ -84,14 +85,14 @@ class KTPage {
84 85
85 var $contentType = 'text/html'; 86 var $contentType = 'text/html';
86 var $charset = 'UTF-8'; 87 var $charset = 'UTF-8';
87 - 88 +
88 var $content_class; 89 var $content_class;
89 - 90 +
90 /* further initialisation */ 91 /* further initialisation */
91 function KTPage() { 92 function KTPage() {
92 - global $default; 93 + global $default;
93 $oConfig = KTConfig::getSingleton(); 94 $oConfig = KTConfig::getSingleton();
94 - 95 +
95 /* default css files initialisation */ 96 /* default css files initialisation */
96 $aCSS = Array( 97 $aCSS = Array(
97 "resources/css/kt-framing.css", 98 "resources/css/kt-framing.css",
@@ -99,7 +100,7 @@ class KTPage { @@ -99,7 +100,7 @@ class KTPage {
99 "resources/css/kt-headings.css" 100 "resources/css/kt-headings.css"
100 ); 101 );
101 $this->requireCSSResources($aCSS); 102 $this->requireCSSResources($aCSS);
102 - 103 +
103 if($oConfig->get('ui/morphEnabled') == '1'){ 104 if($oConfig->get('ui/morphEnabled') == '1'){
104 $morphTheme = $oConfig->get('ui/morphTo'); 105 $morphTheme = $oConfig->get('ui/morphTo');
105 $this->requireThemeCSSResource('skins/kts_'.$oConfig->get('ui/morphTo').'/kt-morph.css'); 106 $this->requireThemeCSSResource('skins/kts_'.$oConfig->get('ui/morphTo').'/kt-morph.css');
@@ -107,13 +108,13 @@ class KTPage { @@ -107,13 +108,13 @@ class KTPage {
107 } 108 }
108 // IE only 109 // IE only
109 $this->requireCSSResource("resources/css/kt-ie-icons.css", true); 110 $this->requireCSSResource("resources/css/kt-ie-icons.css", true);
110 - 111 +
111 /* default js files initialisation */ 112 /* default js files initialisation */
112 $aJS = Array(); 113 $aJS = Array();
113 114
114 $aJS[] = 'thirdpartyjs/yui/yahoo/yahoo.js'; 115 $aJS[] = 'thirdpartyjs/yui/yahoo/yahoo.js';
115 $aJS[] = 'thirdpartyjs/yui/utilities/utilities.js'; 116 $aJS[] = 'thirdpartyjs/yui/utilities/utilities.js';
116 - /* 117 + /*
117 $aJS[] = 'thirdpartyjs/MochiKit/MochiKit.js'; 118 $aJS[] = 'thirdpartyjs/MochiKit/MochiKit.js';
118 $aJS[] = 'thirdpartyjs/MochiKit/New.js'; 119 $aJS[] = 'thirdpartyjs/MochiKit/New.js';
119 $aJS[] = 'thirdpartyjs/MochiKit/DragAndDrop.js'; 120 $aJS[] = 'thirdpartyjs/MochiKit/DragAndDrop.js';
@@ -127,31 +128,32 @@ class KTPage { @@ -127,31 +128,32 @@ class KTPage {
127 $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners.inc.js'; 128 $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners.inc.js';
128 $aJS[] = 'resources/js/loader.js'; 129 $aJS[] = 'resources/js/loader.js';
129 $aJS[] = 'thirdpartyjs/yui/tools/tools.js'; 130 $aJS[] = 'thirdpartyjs/yui/tools/tools.js';
130 - 131 + $aJS[] = 'thirdpartyjs/yui/connection/connection.js';
  132 +
  133 +
131 134
132 -  
133 //$aJS[] = 'thirdpartyjs/MochiKit/Iter.js'; 135 //$aJS[] = 'thirdpartyjs/MochiKit/Iter.js';
134 //$aJS[] = 'thirdpartyjs/MochiKit/DOM.js'; 136 //$aJS[] = 'thirdpartyjs/MochiKit/DOM.js';
135 //$aJS[] = 'thirdpartyjs/MochiKit/Logging.js'; 137 //$aJS[] = 'thirdpartyjs/MochiKit/Logging.js';
136 //$aJS[] = 'thirdpartyjs/MochiKit/Async.js'; 138 //$aJS[] = 'thirdpartyjs/MochiKit/Async.js';
137 - //$aJS[] = 'thirdpartyjs/MochiKit/Signal.js'; 139 + //$aJS[] = 'thirdpartyjs/MochiKit/Signal.js';
138 //$aJS[] = 'thirdpartyjs/MochiKit/.js'; 140 //$aJS[] = 'thirdpartyjs/MochiKit/.js';
139 //$aJS[] = 'resources/js/translate.js'; 141 //$aJS[] = 'resources/js/translate.js';
140 142
141 $this->requireJSResources($aJS); 143 $this->requireJSResources($aJS);
142 - 144 +
143 // this is horrid, but necessary. 145 // this is horrid, but necessary.
144 $this->requireJSStandalone('addLoadEvent(partial(initDeleteProtection, "' . _kt('Are you sure you wish to delete this item?') . '"));'); 146 $this->requireJSStandalone('addLoadEvent(partial(initDeleteProtection, "' . _kt('Are you sure you wish to delete this item?') . '"));');
145 - 147 +
146 /* menu initialisation*/ 148 /* menu initialisation*/
147 // FIXME: how do we want to handle the menu? 149 // FIXME: how do we want to handle the menu?
148 $this->initMenu(); 150 $this->initMenu();
149 - 151 +
150 /* portlet initialisation */ 152 /* portlet initialisation */
151 $this->show_portlets = true; 153 $this->show_portlets = true;
152 /* breadcrumbs */ 154 /* breadcrumbs */
153 } 155 }
154 - 156 +
155 // initiliase the menu. 157 // initiliase the menu.
156 function initMenu() { 158 function initMenu() {
157 // FIXME: we lost the getDefaultAction stuff - do we care? 159 // FIXME: we lost the getDefaultAction stuff - do we care?
@@ -160,25 +162,25 @@ class KTPage { @@ -160,25 +162,25 @@ class KTPage {
160 "browse" => $this->_actionHelper(array("name" => _kt("Browse Documents"), "action" => "browse", "active" => 0)), 162 "browse" => $this->_actionHelper(array("name" => _kt("Browse Documents"), "action" => "browse", "active" => 0)),
161 "administration" => $this->_actionHelper(array("name" => _kt("DMS Administration"), "action" => "administration", "active" => 0)),); 163 "administration" => $this->_actionHelper(array("name" => _kt("DMS Administration"), "action" => "administration", "active" => 0)),);
162 } 164 }
163 -  
164 -  
165 - function setTitle($sTitle) {  
166 - $this->title = $sTitle; 165 +
  166 +
  167 + function setTitle($sTitle) {
  168 + $this->title = $sTitle;
167 } 169 }
168 -  
169 - /* javascript handling */ 170 +
  171 + /* javascript handling */
170 // require that the specified JS file is referenced. 172 // require that the specified JS file is referenced.
171 function requireJSResource($sResourceURL) { 173 function requireJSResource($sResourceURL) {
172 - $this->js_resources[$sResourceURL] = 1; // use the keys to prevent multiple copies. 174 + $this->js_resources[$sResourceURL] = 1; // use the keys to prevent multiple copies.
173 } 175 }
174 - 176 +
175 // require that the specified JS files are referenced. 177 // require that the specified JS files are referenced.
176 function requireJSResources($aResourceURLs) { 178 function requireJSResources($aResourceURLs) {
177 foreach ($aResourceURLs as $sResourceURL) { 179 foreach ($aResourceURLs as $sResourceURL) {
178 $this->js_resources[$sResourceURL] = 1; 180 $this->js_resources[$sResourceURL] = 1;
179 } 181 }
180 } 182 }
181 - 183 +
182 // list the distinct js resources. 184 // list the distinct js resources.
183 function getJSResources() { 185 function getJSResources() {
184 return array_keys($this->js_resources); 186 return array_keys($this->js_resources);
@@ -191,7 +193,7 @@ class KTPage { @@ -191,7 +193,7 @@ class KTPage {
191 function getJSStandalone() { 193 function getJSStandalone() {
192 return array_keys($this->js_standalone); 194 return array_keys($this->js_standalone);
193 } 195 }
194 - 196 +
195 /* css handling */ 197 /* css handling */
196 // require that the specified CSS file is referenced. 198 // require that the specified CSS file is referenced.
197 function requireCSSResource($sResourceURL, $ieOnly = false) { 199 function requireCSSResource($sResourceURL, $ieOnly = false) {
@@ -201,7 +203,7 @@ class KTPage { @@ -201,7 +203,7 @@ class KTPage {
201 $this->ie_only_css[$sResourceURL] = 1; 203 $this->ie_only_css[$sResourceURL] = 1;
202 } 204 }
203 } 205 }
204 - 206 +
205 // require that the specified CSS file is referenced. 207 // require that the specified CSS file is referenced.
206 function requireThemeCSSResource($sResourceURL, $ieOnly = false) { 208 function requireThemeCSSResource($sResourceURL, $ieOnly = false) {
207 if ($ieOnly !== true) { 209 if ($ieOnly !== true) {
@@ -210,28 +212,28 @@ class KTPage { @@ -210,28 +212,28 @@ class KTPage {
210 $this->theme_ie_only_css[$sResourceURL] = 1; 212 $this->theme_ie_only_css[$sResourceURL] = 1;
211 } 213 }
212 } 214 }
213 - 215 +
214 // require that the specified CSS files are referenced. 216 // require that the specified CSS files are referenced.
215 function requireCSSResources($aResourceURLs) { 217 function requireCSSResources($aResourceURLs) {
216 foreach ($aResourceURLs as $sResourceURL) { 218 foreach ($aResourceURLs as $sResourceURL) {
217 $this->css_resources[$sResourceURL] = 1; 219 $this->css_resources[$sResourceURL] = 1;
218 } 220 }
219 } 221 }
220 - 222 +
221 // list the distinct CSS resources. 223 // list the distinct CSS resources.
222 function getCSSResources() { 224 function getCSSResources() {
223 return array_keys($this->css_resources); 225 return array_keys($this->css_resources);
224 } 226 }
225 - 227 +
226 // list the distinct CSS resources. 228 // list the distinct CSS resources.
227 function getThemeCSSResources() { 229 function getThemeCSSResources() {
228 return array_keys($this->theme_css_resources); 230 return array_keys($this->theme_css_resources);
229 } 231 }
230 - 232 +
231 function getCSSResourcesForIE() { 233 function getCSSResourcesForIE() {
232 return array_keys($this->ie_only_css); 234 return array_keys($this->ie_only_css);
233 } 235 }
234 - 236 +
235 function getThemeCSSResourcesForIE() { 237 function getThemeCSSResourcesForIE() {
236 return array_keys($this->theme_ie_only_css); 238 return array_keys($this->theme_ie_only_css);
237 } 239 }
@@ -243,13 +245,13 @@ class KTPage { @@ -243,13 +245,13 @@ class KTPage {
243 function getCSSStandalone() { 245 function getCSSStandalone() {
244 return array_keys($this->css_standalone); 246 return array_keys($this->css_standalone);
245 } 247 }
246 - 248 +
247 function setPageContents($contents) { $this->contents = $contents; } 249 function setPageContents($contents) { $this->contents = $contents; }
248 function setShowPortlets($bShow) { $this->show_portlets = $bShow; } 250 function setShowPortlets($bShow) { $this->show_portlets = $bShow; }
249 - 251 +
250 /* set the breadcrumbs. the first item is the area name. 252 /* set the breadcrumbs. the first item is the area name.
251 the rest are breadcrumbs. */ 253 the rest are breadcrumbs. */
252 - function setBreadcrumbs($aBreadcrumbs) { 254 + function setBreadcrumbs($aBreadcrumbs) {
253 $breadLength = count($aBreadcrumbs); 255 $breadLength = count($aBreadcrumbs);
254 if ($breadLength != 0) { 256 if ($breadLength != 0) {
255 $this->breadcrumbSection = $this->_actionhelper($aBreadcrumbs[0]); 257 $this->breadcrumbSection = $this->_actionhelper($aBreadcrumbs[0]);
@@ -262,12 +264,12 @@ class KTPage { @@ -262,12 +264,12 @@ class KTPage {
262 $this->breadcrumbs = array_map(array(&$this, "_actionhelper"), array_slice($aBreadcrumbs, 1)); 264 $this->breadcrumbs = array_map(array(&$this, "_actionhelper"), array_slice($aBreadcrumbs, 1));
263 } 265 }
264 } 266 }
265 - 267 +
266 function setBreadcrumbDetails($sBreadcrumbDetails) { $this->breadcrumbDetails = $sBreadcrumbDetails; } 268 function setBreadcrumbDetails($sBreadcrumbDetails) { $this->breadcrumbDetails = $sBreadcrumbDetails; }
267 function setUser($oUser) { $this->user = $oUser; } 269 function setUser($oUser) { $this->user = $oUser; }
268 -  
269 - function setContentClass($sClass) { $this->content_class = $sClass; }  
270 - 270 +
  271 + function setContentClass($sClass) { $this->content_class = $sClass; }
  272 +
271 // FIXME refactor setSection to be generic, not an if-else. 273 // FIXME refactor setSection to be generic, not an if-else.
272 // assume this is admin for now. 274 // assume this is admin for now.
273 function setSection($sSection) { 275 function setSection($sSection) {
@@ -277,54 +279,54 @@ class KTPage { @@ -277,54 +279,54 @@ class KTPage {
277 $this->menu['administration']['active'] = 1; 279 $this->menu['administration']['active'] = 1;
278 } else if ($sSection == 'dashboard') { 280 } else if ($sSection == 'dashboard') {
279 $this->componentLabel = _kt('Dashboard'); 281 $this->componentLabel = _kt('Dashboard');
280 - $this->componentClass = 'dashboard'; 282 + $this->componentClass = 'dashboard';
281 } else if ($sSection == 'browse') { 283 } else if ($sSection == 'browse') {
282 $this->componentLabel = _kt('Browse Documents'); 284 $this->componentLabel = _kt('Browse Documents');
283 - $this->componentClass = 'browse_collections'; 285 + $this->componentClass = 'browse_collections';
284 } else if ($sSection == 'view_details') { 286 } else if ($sSection == 'view_details') {
285 $this->componentLabel = _kt('Document Details'); 287 $this->componentLabel = _kt('Document Details');
286 - $this->componentClass = 'document_details'; 288 + $this->componentClass = 'document_details';
287 } else if ($sSection == 'search') { 289 } else if ($sSection == 'search') {
288 $this->componentLabel = _kt('Search'); 290 $this->componentLabel = _kt('Search');
289 - $this->componentClass = 'search'; 291 + $this->componentClass = 'search';
290 } else if ($sSection == 'preferences') { 292 } else if ($sSection == 'preferences') {
291 $this->componentLabel = _kt('Preferences'); 293 $this->componentLabel = _kt('Preferences');
292 - $this->componentClass = 'preferences'; 294 + $this->componentClass = 'preferences';
293 } else { 295 } else {
294 $this->componentLabel = _kt('Dashboard'); 296 $this->componentLabel = _kt('Dashboard');
295 - $this->componentClass = 'dashboard'; 297 + $this->componentClass = 'dashboard';
296 } 298 }
297 299
298 } 300 }
299 301
300 function addError($sError) { array_push($this->errStack, $sError); } 302 function addError($sError) { array_push($this->errStack, $sError); }
301 function addInfo($sInfo) { array_push($this->infoStack, $sInfo); } 303 function addInfo($sInfo) { array_push($this->infoStack, $sInfo); }
302 - 304 +
303 /** no-one cares what a portlet is, but it should be renderable, and have its ->title member set. */ 305 /** no-one cares what a portlet is, but it should be renderable, and have its ->title member set. */
304 function addPortlet($oPortlet) { 306 function addPortlet($oPortlet) {
305 array_push($this->portlets, $oPortlet); 307 array_push($this->portlets, $oPortlet);
306 } 308 }
307 - 309 +
308 /* LEGACY */ 310 /* LEGACY */
309 var $deprecationWarning = "Legacy UI API: "; 311 var $deprecationWarning = "Legacy UI API: ";
310 function setCentralPayload($sCentral) { 312 function setCentralPayload($sCentral) {
311 $this->contents = $sCentral; 313 $this->contents = $sCentral;
312 $this->addError($this->deprecationWarning . "called <strong>setCentralPayload</strong>"); 314 $this->addError($this->deprecationWarning . "called <strong>setCentralPayload</strong>");
313 } 315 }
314 - 316 +
315 function setOnloadJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setOnloadJavascript (no-act)</strong>"); } 317 function setOnloadJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setOnloadJavascript (no-act)</strong>"); }
316 function setDHtmlScrolling($appendix) { $this->addError($this->deprecationWarning . "called <strong>setDHTMLScrolling (no-act)</strong>"); } 318 function setDHtmlScrolling($appendix) { $this->addError($this->deprecationWarning . "called <strong>setDHTMLScrolling (no-act)</strong>"); }
317 function setFormAction($appendix) { $this->addError($this->deprecationWarning . "called <strong>setFormAction (no-act)</strong>"); } 319 function setFormAction($appendix) { $this->addError($this->deprecationWarning . "called <strong>setFormAction (no-act)</strong>"); }
318 function setSubmitMethod($appendix) { $this->addError($this->deprecationWarning . "called <strong>setSubmitMethod (no-act)</strong>"); } 320 function setSubmitMethod($appendix) { $this->addError($this->deprecationWarning . "called <strong>setSubmitMethod (no-act)</strong>"); }
319 function setHasRequiredFields($appendix) { $this->addError($this->deprecationWarning . "called <strong>setHasRequiredFields (no-act)</strong>"); } 321 function setHasRequiredFields($appendix) { $this->addError($this->deprecationWarning . "called <strong>setHasRequiredFields (no-act)</strong>"); }
320 function setAdditionalJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setAdditionalJavascript (no-act)</strong>"); } 322 function setAdditionalJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setAdditionalJavascript (no-act)</strong>"); }
321 - 323 +
322 function hideSection() { $this->hide_section = true; } 324 function hideSection() { $this->hide_section = true; }
323 function setSecondaryTitle($sSecondary) { $this->secondary_title = $sSecondary; } 325 function setSecondaryTitle($sSecondary) { $this->secondary_title = $sSecondary; }
324 - 326 +
325 /* final render call. */ 327 /* final render call. */
326 function render() { 328 function render() {
327 - global $default; 329 + global $default;
328 $oConfig = KTConfig::getSingleton(); 330 $oConfig = KTConfig::getSingleton();
329 331
330 if (empty($this->contents)) { 332 if (empty($this->contents)) {
@@ -335,16 +337,16 @@ class KTPage { @@ -335,16 +337,16 @@ class KTPage {
335 $this->addError(_kt("This page did not produce any content")); 337 $this->addError(_kt("This page did not produce any content"));
336 $this->contents = ""; 338 $this->contents = "";
337 } 339 }
338 - 340 +
339 if (!is_string($this->contents)) { 341 if (!is_string($this->contents)) {
340 $this->contents = $this->contents->render(); 342 $this->contents = $this->contents->render();
341 } 343 }
342 - 344 +
343 // if we have no portlets, make the ui a tad nicer. 345 // if we have no portlets, make the ui a tad nicer.
344 if (empty($this->portlets)) { 346 if (empty($this->portlets)) {
345 $this->show_portlets = false; 347 $this->show_portlets = false;
346 } 348 }
347 - 349 +
348 if (empty($this->title)) { 350 if (empty($this->title)) {
349 if (!empty($this->breadcrumbDetails)) { 351 if (!empty($this->breadcrumbDetails)) {
350 $this->title = $this->breadcrumbDetails; 352 $this->title = $this->breadcrumbDetails;
@@ -357,9 +359,9 @@ class KTPage { @@ -357,9 +359,9 @@ class KTPage {
357 $this->title = $this->componentLabel; 359 $this->title = $this->componentLabel;
358 } 360 }
359 } 361 }
360 - 362 +
361 $this->userMenu = array(); 363 $this->userMenu = array();
362 - if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) { 364 + if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
363 if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) { 365 if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) {
364 $this->userMenu = array("logout" => $this->_actionHelper(array("name" => _kt("Logout"), "action" => "logout", "active" => 0)),); 366 $this->userMenu = array("logout" => $this->_actionHelper(array("name" => _kt("Logout"), "action" => "logout", "active" => 0)),);
365 } else { 367 } else {
@@ -369,42 +371,46 @@ class KTPage { @@ -369,42 +371,46 @@ class KTPage {
369 } 371 }
370 } else { 372 } else {
371 $this->userMenu = array("login" => $this->_actionHelper(array("name" => _kt("Login"), "action" => "login")),); 373 $this->userMenu = array("login" => $this->_actionHelper(array("name" => _kt("Login"), "action" => "login")),);
372 - }  
373 - 374 + }
  375 +
374 // FIXME we need a more complete solution to navigation restriction 376 // FIXME we need a more complete solution to navigation restriction
375 if (!is_null($this->menu['administration']) && !is_null($this->user)) { 377 if (!is_null($this->menu['administration']) && !is_null($this->user)) {
376 if (!Permission::userIsSystemAdministrator($this->user->getId())) { 378 if (!Permission::userIsSystemAdministrator($this->user->getId())) {
377 unset($this->menu['administration']); 379 unset($this->menu['administration']);
378 } 380 }
379 } 381 }
380 - 382 +
381 $sContentType = 'Content-type: ' . $this->contentType; 383 $sContentType = 'Content-type: ' . $this->contentType;
382 if(!empty($this->charset)) { 384 if(!empty($this->charset)) {
383 $sContentType .= '; charset=' . $this->charset; 385 $sContentType .= '; charset=' . $this->charset;
384 }; 386 };
385 - 387 +
386 388
387 header($sContentType); 389 header($sContentType);
388 -  
389 - $oTemplating =& KTTemplating::getSingleton(); 390 +
  391 + $savedSearches = SearchHelper::getSavedSearches($_SESSION['userID']);
  392 +
  393 + $oTemplating =& KTTemplating::getSingleton();
390 $oTemplate = $oTemplating->loadTemplate($this->template); 394 $oTemplate = $oTemplating->loadTemplate($this->template);
391 - $aTemplateData = array("page" => $this,  
392 - "systemversion" => $default->systemVersion,  
393 - "versionname" => $default->versionName,); 395 + $aTemplateData = array(
  396 + "page" => $this,
  397 + "systemversion" => $default->systemVersion,
  398 + "versionname" => $default->versionName,
  399 + 'savedSearches'=> $savedSearches);
394 if ($oConfig->get("ui/automaticRefresh", false)) { 400 if ($oConfig->get("ui/automaticRefresh", false)) {
395 $aTemplateData['refreshTimeout'] = (int)$oConfig->get("session/sessionTimeout") + 3; 401 $aTemplateData['refreshTimeout'] = (int)$oConfig->get("session/sessionTimeout") + 3;
396 } 402 }
397 - 403 +
398 // unlike the rest of KT, we use echo here. 404 // unlike the rest of KT, we use echo here.
399 echo $oTemplate->render($aTemplateData); 405 echo $oTemplate->render($aTemplateData);
400 } 406 }
401 - 407 +
402 408
403 /** heler functions */ 409 /** heler functions */
404 // returns an array ("url", "label") 410 // returns an array ("url", "label")
405 function _actionhelper($aActionTuple) { 411 function _actionhelper($aActionTuple) {
406 $aTuple = Array("label" => $aActionTuple["name"]); 412 $aTuple = Array("label" => $aActionTuple["name"]);
407 - if ($aActionTuple["action"]) { 413 + if ($aActionTuple["action"]) {
408 $aTuple["url"] = generateControllerLink($aActionTuple["action"], $aActionTuple["query"]); 414 $aTuple["url"] = generateControllerLink($aActionTuple["action"], $aActionTuple["query"]);
409 } else if ($aActionTuple["url"]) { 415 } else if ($aActionTuple["url"]) {
410 $sUrl = $aActionTuple["url"]; 416 $sUrl = $aActionTuple["url"];
@@ -418,22 +424,22 @@ class KTPage { @@ -418,22 +424,22 @@ class KTPage {
418 } else { 424 } else {
419 $aTuple["url"] = false; 425 $aTuple["url"] = false;
420 } 426 }
421 - 427 +
422 return $aTuple; 428 return $aTuple;
423 } 429 }
424 - 430 +
425 function setHelp($sHelpPage) { 431 function setHelp($sHelpPage) {
426 $this->helpPage = $sHelpPage; 432 $this->helpPage = $sHelpPage;
427 } 433 }
428 - 434 +
429 function getHelpURL() { 435 function getHelpURL() {
430 - if (empty($this->helpPage)) { 436 + if (empty($this->helpPage)) {
431 return null; 437 return null;
432 } 438 }
433 -  
434 - return KTUtil::ktLink('help.php',$this->helpPage); 439 +
  440 + return KTUtil::ktLink('help.php',$this->helpPage);
435 } 441 }
436 - 442 +
437 function getReqTime() { 443 function getReqTime() {
438 $microtime_simple = explode(' ', microtime()); 444 $microtime_simple = explode(' ', microtime());
439 $finaltime = (float) $microtime_simple[1] + (float) $microtime_simple[0]; 445 $finaltime = (float) $microtime_simple[1] + (float) $microtime_simple[0];
@@ -449,7 +455,7 @@ class KTPage { @@ -449,7 +455,7 @@ class KTPage {
449 return; 455 return;
450 } 456 }
451 } 457 }
452 - 458 +
453 } 459 }
454 460
455 ?> 461 ?>