Commit 6e5b135076c49f246cfd7db6c8e926b66ea4c833

Authored by Conrad Vermeulen
1 parent a5ee7212

KTS-673

"The search algorithm needs some work"
Updated. Persistence of quick search from session

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7267 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/templating/smartytemplate.inc.php
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 * License Version 1.1.2 ("License"); You may not use this file except in 8 * License Version 1.1.2 ("License"); You may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at 9 * compliance with the License. You may obtain a copy of the License at
10 * http://www.knowledgetree.com/KPL 10 * http://www.knowledgetree.com/KPL
11 - * 11 + *
12 * Software distributed under the License is distributed on an "AS IS" 12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 * See the License for the specific language governing rights and 14 * See the License for the specific language governing rights and
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * (ii) the KnowledgeTree copyright notice 19 * (ii) the KnowledgeTree copyright notice
20 * in the same form as they appear in the distribution. See the License for 20 * in the same form as they appear in the distribution. See the License for
21 * requirements. 21 * requirements.
22 - * 22 + *
23 * The Original Code is: KnowledgeTree Open Source 23 * The Original Code is: KnowledgeTree Open Source
24 - * 24 + *
25 * The Initial Developer of the Original Code is The Jam Warehouse Software 25 * The Initial Developer of the Original Code is The Jam Warehouse Software
26 * (Pty) Ltd, trading as KnowledgeTree. 26 * (Pty) Ltd, trading as KnowledgeTree.
27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -65,10 +65,10 @@ class KTSmartyTemplate extends KTTemplate { @@ -65,10 +65,10 @@ class KTSmartyTemplate extends KTTemplate {
65 for ($i = 0; $i < $iLen; $i++) { 65 for ($i = 0; $i < $iLen; $i++) {
66 $sKey = $aKeys[$i]; 66 $sKey = $aKeys[$i];
67 $smarty->assign_by_ref($sKey, $this->aDict[$sKey]); 67 $smarty->assign_by_ref($sKey, $this->aDict[$sKey]);
68 - } 68 + }
69 } 69 }
70 $KTConfig =& KTConfig::getSingleton(); 70 $KTConfig =& KTConfig::getSingleton();
71 - 71 +
72 // needed for a very, very few places. 72 // needed for a very, very few places.
73 $isSSL = $KTConfig->get("KnowledgeTree/sslEnabled"); 73 $isSSL = $KTConfig->get("KnowledgeTree/sslEnabled");
74 $hostname = $KTConfig->get("KnowledgeTree/serverName"); 74 $hostname = $KTConfig->get("KnowledgeTree/serverName");
@@ -76,7 +76,27 @@ class KTSmartyTemplate extends KTTemplate { @@ -76,7 +76,27 @@ class KTSmartyTemplate extends KTTemplate {
76 $absroot .= ($isSSL) ? 's://' : '://'; 76 $absroot .= ($isSSL) ? 's://' : '://';
77 $absroot .= $hostname; 77 $absroot .= $hostname;
78 $absroot .= $KTConfig->get("KnowledgeTree/rootUrl"); 78 $absroot .= $KTConfig->get("KnowledgeTree/rootUrl");
79 - 79 +
  80 + if (isset($_SESSION['search2_quick']))
  81 + {
  82 + $search2_quick = $_SESSION['search2_quick'];
  83 + $search2_general = $_SESSION['search2_general'];
  84 + $search2_quickQuery = trim($_SESSION['search2_quickQuery']);
  85 + if ($search2_quickQuery == '')
  86 + {
  87 + $search2_quickQuery = _kt('Enter search criteria');
  88 + }
  89 + }
  90 + else
  91 + {
  92 + $search2_quick=1;
  93 + $search2_general=1;
  94 + $search2_quickQuery = _kt('Enter search criteria');
  95 + }
  96 +
  97 + $smarty->assign('search2_quick', $search2_quick);
  98 + $smarty->assign('search2_general', $search2_general);
  99 + $smarty->assign('search2_quickQuery', $search2_quickQuery);
80 $smarty->assign("config", $KTConfig); 100 $smarty->assign("config", $KTConfig);
81 $smarty->assign("appname", $KTConfig->get("ui/appName", "KnowledgeTree")); 101 $smarty->assign("appname", $KTConfig->get("ui/appName", "KnowledgeTree"));
82 $smarty->assign("rootUrl", $KTConfig->get("KnowledgeTree/rootUrl")); 102 $smarty->assign("rootUrl", $KTConfig->get("KnowledgeTree/rootUrl"));
@@ -141,7 +161,7 @@ class KTSmartyTemplate extends KTTemplate { @@ -141,7 +161,7 @@ class KTSmartyTemplate extends KTTemplate {
141 $context = KTUtil::arrayGet($params, 'context'); 161 $context = KTUtil::arrayGet($params, 'context');
142 if (!is_null($context)) { 162 if (!is_null($context)) {
143 $content = $context->meldPersistQuery($content); 163 $content = $context->meldPersistQuery($content);
144 - } 164 + }
145 if (empty($content)) { 165 if (empty($content)) {
146 return; 166 return;
147 } 167 }
@@ -260,13 +280,13 @@ class KTSmartyTemplate extends KTTemplate { @@ -260,13 +280,13 @@ class KTSmartyTemplate extends KTTemplate {
260 } 280 }
261 281
262 // $context is a dispatcher or null 282 // $context is a dispatcher or null
263 - // if non-null, it will try persist that dispatcher's persist-vars. 283 + // if non-null, it will try persist that dispatcher's persist-vars.
264 function addQueryString($url, $qs) { 284 function addQueryString($url, $qs) {
265 return KTUtil::addQueryString($url, $qs); 285 return KTUtil::addQueryString($url, $qs);
266 } 286 }
267 287
268 -  
269 - /* 288 +
  289 + /*
270 * ktLink generates a fully prepared link for KT. 290 * ktLink generates a fully prepared link for KT.
271 * 291 *
272 * It takes into account kt_path_info requirements, 292 * It takes into account kt_path_info requirements,
@@ -306,9 +326,9 @@ class KTSmartyTemplate extends KTTemplate { @@ -306,9 +326,9 @@ class KTSmartyTemplate extends KTTemplate {
306 return implode('/', $aCrumbs); 326 return implode('/', $aCrumbs);
307 } 327 }
308 328
309 -  
310 -  
311 - 329 +
  330 +
  331 +
312 } 332 }
313 333
314 ?> 334 ?>