Commit 01a08cab7d859d6fe1289a86335f8877c02799fd

Authored by kevin_fourie
1 parent 533f9f97

Merged in from DEV trunk...

KTS-3168
"Searching integer field types results in SQL error"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3164
"Removed Title from being part of GeneralText criteria for search as it is catered for by the FullPath"
Fixed. 

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTC-433
"Full Path Search Broken - says field not found: Full"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3163
"Wildcard search on metadata inconsistent with full text content search"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3165
"Remove background task permissions problems by making web server user deal with background tasks"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

WSA-116
"Update unit tests to be compatible with 3.5.2"
Updated. Made sure unit tests ran as expected.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-3169
"Provide some actions for portlets that allow javascript to be called rather than requiring the action framework"
Implemented.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-3171
"Add extra validation for Permission::userIsSystemAdministrator()"
Updated.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8265 c91229c3-7414-0410-bfa2-8a42b809f60b
ktwebservice/nunit/document_contents.cs
... ... @@ -57,7 +57,7 @@ namespace MonoTests.KnowledgeTree
57 57 Assert.AreEqual("Administrator", response.items[1].owned_by);
58 58 Assert.AreEqual("0.1", response.items[1].version);
59 59 Assert.AreEqual("false", response.items[1].is_immutable);
60   - Assert.AreEqual("n/a", response.items[1].permissions);
  60 + Assert.AreEqual("RW", response.items[1].permissions);
61 61 Assert.AreEqual("n/a", response.items[1].workflow);
62 62 Assert.AreEqual("n/a", response.items[1].workflow_state);
63 63 Assert.AreEqual("text/plain", response.items[1].mime_type);
... ... @@ -79,7 +79,7 @@ namespace MonoTests.KnowledgeTree
79 79 Assert.AreEqual("n/a", response.items[0].owned_by);
80 80 Assert.AreEqual("n/a", response.items[0].version);
81 81 Assert.AreEqual("n/a", response.items[0].is_immutable);
82   - Assert.AreEqual("n/a", response.items[0].permissions);
  82 + Assert.AreEqual("RW", response.items[0].permissions);
83 83 Assert.AreEqual("n/a", response.items[0].workflow);
84 84 Assert.AreEqual("n/a", response.items[0].workflow_state);
85 85 Assert.AreEqual("folder", response.items[0].mime_type);
... ...
ktwebservice/nunit/document_detail.cs
... ... @@ -81,14 +81,14 @@ namespace MonoTests.KnowledgeTree
81 81 Assert.AreEqual("Administrator", response.owned_by);
82 82 Assert.AreEqual(0.1, response.version);
83 83 Assert.AreEqual(false, response.is_immutable);
84   - Assert.AreEqual("n/a", response.permissions);
  84 + Assert.AreEqual("RW", response.permissions);
85 85 Assert.AreEqual("n/a", response.workflow);
86 86 Assert.AreEqual("n/a", response.workflow_state);
87 87 Assert.AreEqual("text/plain", response.mime_type);
88 88 Assert.AreEqual("text", response.mime_icon_path);
89 89 Assert.AreEqual("Plain Text", response.mime_display);
90 90 Assert.IsTrue("" != response.storage_path);
91   - Assert.AreEqual(2, response.metadata.Length);
  91 + Assert.AreEqual(3, response.metadata.Length);
92 92 Assert.AreEqual(null, response.links);
93 93  
94 94 Assert.AreEqual(1, response.transaction_history.Length);
... ...
ktwebservice/nunit/document_metadata.cs
... ... @@ -81,11 +81,11 @@ namespace MonoTests.KnowledgeTree
81 81 fs[0].fieldset = "General information";
82 82 fs[0].fields = new kt_metadata_field[3];
83 83 fs[0].fields[0] = new kt_metadata_field();
84   - fs[0].fields[0].name = "Document Author";
85   - fs[0].fields[0].value = "Joe Soap";
  84 + fs[0].fields[0].name = "Category";
  85 + fs[0].fields[0].value = "Technical";
86 86 fs[0].fields[1] = new kt_metadata_field();
87   - fs[0].fields[1].name = "Category";
88   - fs[0].fields[1].value = "Technical";
  87 + fs[0].fields[1].name = "Document Author";
  88 + fs[0].fields[1].value = "Joe Soap";
89 89 fs[0].fields[2] = new kt_metadata_field();
90 90 fs[0].fields[2].name = "Media Type";
91 91 fs[0].fields[2].value = "Text";
... ... @@ -96,11 +96,11 @@ namespace MonoTests.KnowledgeTree
96 96 Assert.AreEqual(0, update_resp.status_code);
97 97 Assert.AreEqual("General information", update_resp.metadata[1].fieldset);
98 98  
99   - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
100   - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);
  99 + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name);
  100 + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value);
101 101  
102   - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
103   - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);
  102 + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name);
  103 + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value);
104 104  
105 105 Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
106 106 Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);
... ... @@ -131,11 +131,13 @@ namespace MonoTests.KnowledgeTree
131 131 Assert.AreEqual(0, update_resp.status_code);
132 132 Assert.AreEqual("General information", update_resp.metadata[1].fieldset);
133 133  
134   - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
135   - Assert.AreEqual("Joe \\Soap", update_resp.metadata[1].fields[0].value);
  134 + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name);
  135 + Assert.AreEqual("Tec/hn\\ical/", update_resp.metadata[1].fields[0].value);
  136 +
  137 +
  138 + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name);
  139 + Assert.AreEqual("Joe \\Soap", update_resp.metadata[1].fields[1].value);
136 140  
137   - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
138   - Assert.AreEqual("Tec/hn\\ical/", update_resp.metadata[1].fields[1].value);
139 141  
140 142 Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
141 143 Assert.AreEqual("Text'", update_resp.metadata[1].fields[2].value);
... ...
ktwebservice/nunit/document_system_metadata.cs
... ... @@ -66,11 +66,11 @@ namespace MonoTests.KnowledgeTree
66 66 Assert.AreEqual(0, update_resp.status_code);
67 67 Assert.AreEqual("General information", update_resp.metadata[1].fieldset);
68 68  
69   - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
70   - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);
  69 + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name);
  70 + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value);
71 71  
72   - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
73   - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);
  72 + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name);
  73 + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value);
74 74  
75 75 Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
76 76 Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);
... ... @@ -112,11 +112,11 @@ namespace MonoTests.KnowledgeTree
112 112 Assert.AreEqual(0, update_resp.status_code);
113 113 Assert.AreEqual("General information", update_resp.metadata[1].fieldset);
114 114  
115   - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
116   - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);
  115 + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name);
  116 + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value);
117 117  
118   - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
119   - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);
  118 + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name);
  119 + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value);
120 120  
121 121 Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
122 122 Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);
... ... @@ -167,11 +167,11 @@ namespace MonoTests.KnowledgeTree
167 167 Assert.AreEqual(0, update_resp.status_code);
168 168 Assert.AreEqual("General information", update_resp.metadata[1].fieldset);
169 169  
170   - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
171   - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);
  170 + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name);
  171 + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value);
172 172  
173   - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
174   - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);
  173 + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name);
  174 + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value);
175 175  
176 176 Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
177 177 Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);
... ...
ktwebservice/nunit/makefile
1   -RESULTS=folder.result document_metadata.result authentication.result document_contents.result document_detail.result document_history.result document_add.result document_checkout.result document_links.result document_owner.result document_rename.result document_workflow.result document_copy.result document_move.result document_system_metadata.result query.result document_download.result document_type.result document_oem_no.result
  1 +RESULTS=folder.result document_metadata.result authentication.result document_contents.result document_detail.result document_history.result document_add.result document_checkout.result document_links.result document_owner.result document_rename.result document_copy.result document_move.result document_system_metadata.result query.result document_download.result document_type.result document_oem_no.result document_workflow.result
2 2 PROXY=KTproxy.cs
3 3 WSDL=ktdms.wsdl
4 4 ROOT_URL=http://ktdms.trunk
... ...
lib/actions/documentaction.inc.php
... ... @@ -5,32 +5,32 @@
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8   - *
  8 + *
9 9 * This program is free software; you can redistribute it and/or modify it under
10 10 * the terms of the GNU General Public License version 3 as published by the
11 11 * Free Software Foundation.
12   - *
  12 + *
13 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 16 * details.
17   - *
  17 + *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
  20 + *
21 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23   - *
  23 + *
24 24 * The interactive user interfaces in modified source and object code versions
25 25 * of this program must display Appropriate Legal Notices, as required under
26 26 * Section 5 of the GNU General Public License version 3.
27   - *
  27 + *
28 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 34 * Contributor( s): ______________________________________
35 35 *
36 36 */
... ... @@ -203,6 +203,121 @@ class KTDocumentAction extends KTStandardDispatcher {
203 203 }
204 204 }
205 205  
  206 +class JavascriptDocumentAction extends KTDocumentAction
  207 +{
  208 + /**
  209 + * This is an array of js files to be included for this action
  210 + *
  211 + * @var array
  212 + */
  213 + var $js_paths = array();
  214 + /**
  215 + * This is custom javascript that should be included
  216 + *
  217 + * @var array
  218 + */
  219 + var $js = array();
  220 + /**
  221 + * Indicates if a custom function should be provided, or if the function is part of an existing js file.
  222 + * If true
  223 + *
  224 + * @var boolean
  225 + */
  226 + var $function_provided_by_action = true;
  227 +
  228 + /**
  229 + * Set the function name if you have a custom name you want to provide.
  230 + *
  231 + * @var string
  232 + */
  233 + var $function_name = null;
  234 +
  235 + function JavascriptDocumentAction($oDocument = null, $oUser = null, $oPlugin = null)
  236 + {
  237 + parent::KTDocumentAction($oDocument, $oUser, $oPlugin);
  238 + $this->js_initialise();
  239 + }
  240 +
  241 + function js_initialise()
  242 + {
  243 + // this will be overridden
  244 + }
  245 +
  246 + function js_include($js)
  247 + {
  248 + $this->js[] = $js;
  249 + }
  250 +
  251 + function js_include_file($path)
  252 + {
  253 + global $AjaxDocumentJSPaths;
  254 +
  255 + if (!isset($AjaxDocumentJSPaths))
  256 + {
  257 + $AjaxDocumentJSPaths = array();
  258 + }
  259 +
  260 + if (!in_array($AjaxDocumentJSPaths))
  261 + {
  262 + $AjaxDocumentJSPaths[] = $path;
  263 + $this->js_paths [] = $path;
  264 + }
  265 + }
  266 +
  267 + function customiseInfo($aInfo)
  268 + {
  269 + $js = '';
  270 + foreach($this->js_paths as $path)
  271 + {
  272 + $js .= "<script language=\"javascript\" src=\"$path\"></script>\n";
  273 + }
  274 +
  275 + $js .= '<script language="javascript">'. "\n";
  276 + foreach($this->js as $js2)
  277 + {
  278 + $js .= $js2 . "\n";
  279 + }
  280 +
  281 + $js .= $this->getScript() . '</script>'. "\n";
  282 +
  283 + $js .= '<div onclick="' . $this->getScriptActivation() . '"><a>' . $this->getDisplayName() . '</a></div>'. "\n";
  284 +
  285 +
  286 + $aInfo['js'] = $js;
  287 +
  288 + return $aInfo;
  289 + }
  290 +
  291 + function getScript()
  292 + {
  293 + if ($this->function_provided_by_action === false)
  294 + {
  295 + return '';
  296 + }
  297 + return "function " . $this->getScriptActivation() . '{'.$this->getFunctionScript().'}';
  298 + }
  299 +
  300 + function getFunctionScript()
  301 + {
  302 + return 'alert(\''. $this->getDisplayName() .' not implemented!\');';
  303 + }
  304 +
  305 + function getScriptActivation()
  306 + {
  307 + if (!is_null($this->function_name))
  308 + {
  309 + return $this->function_name;
  310 + }
  311 +
  312 + global $AjaxDocumentActions;
  313 + $class = get_class($this);
  314 + return 'js' . $class. 'Dispatcher()';
  315 + }
  316 +
  317 +
  318 +
  319 +}
  320 +
206 321 class KTDocumentActionUtil {
207 322 function getDocumentActionInfo($slot = 'documentaction') {
208 323 $oRegistry =& KTActionRegistry::getSingleton();
... ...
lib/actions/folderaction.inc.php
... ... @@ -5,32 +5,32 @@
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8   - *
  8 + *
9 9 * This program is free software; you can redistribute it and/or modify it under
10 10 * the terms of the GNU General Public License version 3 as published by the
11 11 * Free Software Foundation.
12   - *
  12 + *
13 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 16 * details.
17   - *
  17 + *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
  20 + *
21 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23   - *
  23 + *
24 24 * The interactive user interfaces in modified source and object code versions
25 25 * of this program must display Appropriate Legal Notices, as required under
26 26 * Section 5 of the GNU General Public License version 3.
27   - *
  27 + *
28 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 34 * Contributor( s): ______________________________________
35 35 *
36 36 */
... ... @@ -177,6 +177,122 @@ class KTFolderAction extends KTStandardDispatcher {
177 177  
178 178 }
179 179  
  180 +class JavascriptFolderAction extends KTFolderAction
  181 +{
  182 + /**
  183 + * This is an array of js files to be included for this action
  184 + *
  185 + * @var array
  186 + */
  187 + var $js_paths = array();
  188 + /**
  189 + * This is custom javascript that should be included
  190 + *
  191 + * @var array
  192 + */
  193 + var $js = array();
  194 + /**
  195 + * Indicates if a custom function should be provided, or if the function is part of an existing js file.
  196 + * If true
  197 + *
  198 + * @var boolean
  199 + */
  200 + var $function_provided_by_action = true;
  201 +
  202 + /**
  203 + * Set the function name if you have a custom name you want to provide.
  204 + *
  205 + * @var string
  206 + */
  207 + var $function_name = null;
  208 +
  209 + function JavascriptFolderAction($oFolder = null, $oUser = null, $oPlugin = null)
  210 + {
  211 + parent::KTFolderAction($oFolder, $oUser, $oPlugin);
  212 + $this->js_initialise();
  213 + }
  214 +
  215 + function js_initialise()
  216 + {
  217 + // this will be overridden
  218 + }
  219 +
  220 + function js_include($js)
  221 + {
  222 + $this->js[] = $js;
  223 + }
  224 +
  225 + function js_include_file($path)
  226 + {
  227 + global $AjaxDocumentJSPaths;
  228 +
  229 + if (!isset($AjaxDocumentJSPaths))
  230 + {
  231 + $AjaxDocumentJSPaths = array();
  232 + }
  233 +
  234 + if (!in_array($AjaxDocumentJSPaths))
  235 + {
  236 + $AjaxDocumentJSPaths[] = $path;
  237 + $this->js_paths [] = $path;
  238 + }
  239 + }
  240 +
  241 + function customiseInfo($aInfo)
  242 + {
  243 + $js = '';
  244 + foreach($this->js_paths as $path)
  245 + {
  246 + $js .= "<script language=\"javascript\" src=\"$path\"></script>\n";
  247 + }
  248 +
  249 + $js .= '<script language="javascript">'. "\n";
  250 + foreach($this->js as $js2)
  251 + {
  252 + $js .= $js2 . "\n";
  253 + }
  254 +
  255 + $js .= $this->getScript() . '</script>'. "\n";
  256 +
  257 + $js .= '<div onclick="' . $this->getScriptActivation() . '"><a>' . $this->getDisplayName() . '</a></div>'. "\n";
  258 +
  259 +
  260 + $aInfo['js'] = $js;
  261 +
  262 + return $aInfo;
  263 + }
  264 +
  265 + function getScript()
  266 + {
  267 + if ($this->function_provided_by_action === false)
  268 + {
  269 + return '';
  270 + }
  271 + return "function " . $this->getScriptActivation() . '{'.$this->getFunctionScript().'}';
  272 + }
  273 +
  274 + function getFunctionScript()
  275 + {
  276 + return 'alert(\''. $this->getDisplayName() .' not implemented!\');';
  277 + }
  278 +
  279 + function getScriptActivation()
  280 + {
  281 + if (!is_null($this->function_name))
  282 + {
  283 + return $this->function_name;
  284 + }
  285 +
  286 + global $AjaxDocumentActions;
  287 + $class = get_class($this);
  288 + return 'js' . $class. 'Dispatcher()';
  289 + }
  290 +
  291 +
  292 +
  293 +}
  294 +
  295 +
180 296 class KTFolderActionUtil {
181 297 function getFolderActions() {
182 298 $oRegistry =& KTActionRegistry::getSingleton();
... ...
lib/security/Permission.inc
... ... @@ -118,7 +118,14 @@ class Permission {
118 118 if ($iUserID == '') {
119 119 $iUserID = $_SESSION['userID'];
120 120 }
  121 + if (empty($iUserID)) {
  122 + return false;
  123 + }
121 124 $iUserID = KTUtil::getId($iUserID);
  125 + if (PEAR::isError($iUserID))
  126 + {
  127 + return false;
  128 + }
122 129  
123 130 $query = 'SELECT UGL.group_id
124 131 FROM '.$default->users_groups_table.' AS UGL
... ...
lib/util/ktutil.inc
... ... @@ -53,8 +53,22 @@ class KTUtil {
53 53 {
54 54 global $default;
55 55  
56   - return ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'] . $default->rootUrl;
  56 + $config = KTConfig::getSingleton();
  57 + $serverName = $config->get('knowledgeTree/serverName', $_SERVER['HTTP_HOST']);
57 58  
  59 + return ($default->sslEnabled ? 'https' : 'http') .'://'.$serverName . $default->rootUrl;
  60 +
  61 + }
  62 +
  63 + static function call_page($path)
  64 + {
  65 + $kt_url = KTUtil::kt_url();
  66 +
  67 + $full_url = $kt_url . '/' . $path;
  68 +
  69 + $ch = curl_init($full_url);
  70 + curl_exec($ch);
  71 + curl_close($ch);
58 72 }
59 73  
60 74 static function computePeriod($diff, $suffix = null, $returnArray=false)
... ...
search2/bin/cronIndexer.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id:$
  5 + *
  6 + * KnowledgeTree Open Source Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  23 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +chdir(dirname(__FILE__));
  40 +require_once(realpath('../../config/dmsDefaults.php'));
  41 +
  42 +KTUtil::call_page('search2/indexing/bin/cronIndexer.php');
  43 +
  44 +
  45 +?>
0 46 \ No newline at end of file
... ...
search2/bin/cronMigration.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id:$
  5 + *
  6 + * KnowledgeTree Open Source Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  23 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +chdir(dirname(__FILE__));
  40 +require_once(realpath('../../config/dmsDefaults.php'));
  41 +
  42 +KTUtil::call_page('search2/indexing/bin/cronMigration.php');
  43 +
  44 +?>
0 45 \ No newline at end of file
... ...
search2/bin/optimise.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id:$
  5 + *
  6 + * KnowledgeTree Open Source Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  23 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +chdir(dirname(__FILE__));
  40 +require_once(realpath('../../config/dmsDefaults.php'));
  41 +
  42 +KTUtil::call_page('search2/indexing/bin/optimise.php');
  43 +
  44 +
  45 +?>
0 46 \ No newline at end of file
... ...
search2/search/expr.inc.php
... ... @@ -591,22 +591,25 @@ class ValueExpr extends Expr
591 591 public function getSQL($field, $fieldname, $op, $not=false)
592 592 {
593 593 $val = $this->getValue();
594   - switch($op)
595   - {
596   - case ExprOp::LIKE:
597   -
598   - break;
599   - case ExprOp::CONTAINS:
600   - $val = "%$val%";
601   - break;
602   - case ExprOp::STARTS_WITH:
603   - $val = "$val%";
604   - break;
605   - case ExprOp::ENDS_WITH:
606   - $val = "%$val";
607   - break;
608   - }
  594 + if (strpos($val, '*') !== false || strpos($val, '?') !== false)
  595 + {
  596 + $val = str_replace(array('?','*'), array('%','%'), $val);
  597 + }
609 598  
  599 + switch($op)
  600 + {
  601 + case ExprOp::LIKE:
  602 + break;
  603 + case ExprOp::CONTAINS:
  604 + $val = "%$val%";
  605 + break;
  606 + case ExprOp::STARTS_WITH:
  607 + $val = "$val%";
  608 + break;
  609 + case ExprOp::ENDS_WITH:
  610 + $val = "%$val";
  611 + break;
  612 + }
610 613  
611 614 $val = $field->modifyValue($val);
612 615 $quote = '';
... ...
search2/search/fieldRegistry.inc.php
... ... @@ -158,10 +158,18 @@ class ExprFieldRegistry
158 158  
159 159 public function resolveMetadataField($fieldset, $field)
160 160 {
  161 + if ($fieldset instanceof ValueExpr)
  162 + {
  163 + $fieldset = $fieldset->getValue();
  164 + }
161 165 if (!array_key_exists($fieldset,$this->metadata))
162 166 {
163 167 throw new ResolutionException("Metadata class for fieldset '$fieldset' and field '$field' not found.");
164 168 }
  169 + if ($field instanceof ValueExpr)
  170 + {
  171 + $field = $field->getValue();
  172 + }
165 173 if (!array_key_exists($field,$this->metadata[$fieldset]))
166 174 {
167 175 throw new ResolutionException("Metadata class for fieldset '$fieldset' and field '$field' not found.");
... ... @@ -249,7 +257,7 @@ class ExprFieldRegistry
249 257 private function registerMetdataFields()
250 258 {
251 259 $sql = "SELECT
252   - fs.name as fieldset, f.name as field, fs.id as fsid, f.id as fid
  260 + fs.name as fieldset, f.name as field, fs.id as fsid, f.id as fid, f.data_type
253 261 FROM
254 262 fieldsets fs
255 263 INNER JOIN document_fields f ON f.parent_fieldset=fs.id
... ... @@ -263,6 +271,7 @@ class ExprFieldRegistry
263 271 $field = addslashes($record['field']);
264 272 $fieldsetid = $record['fsid'];
265 273 $fieldid = $record['fid'];
  274 + $type = $record['data_type'];
266 275 $classname = "MetadataField$fieldid";
267 276  
268 277 $classdefn = "
... ... @@ -270,7 +279,9 @@ class ExprFieldRegistry
270 279 {
271 280 public function __construct()
272 281 {
273   - parent::__construct('$fieldset','$field',$fieldsetid, $fieldid);
  282 + parent::__construct('$fieldset','$field',$fieldsetid, $fieldid);" .
  283 +
  284 + (($type=='INT')?'$this->isValueQuoted(false);':'') . "
274 285 }
275 286 }";
276 287 eval($classdefn);
... ...
search2/search/fields/FullPathField.inc.php
... ... @@ -43,7 +43,7 @@ class FullPathField extends DBFieldExpr
43 43 public function __construct()
44 44 {
45 45 parent::__construct('full_path', 'documents', _kt('Full Path'));
46   - $this->setAlias('Full Path');
  46 + $this->setAlias('FullPath');
47 47 }
48 48  
49 49 public function getInputRequirements()
... ...
search2/search/fields/TitleField.inc.php
... ... @@ -38,7 +38,6 @@
38 38  
39 39 class TitleField extends DBFieldExpr
40 40 {
41   - public $general_op = ExprOp::CONTAINS;
42 41  
43 42 public function __construct()
44 43 {
... ...
sql/mysql/install/data.sql
... ... @@ -804,9 +804,9 @@ UNLOCK TABLES;
804 804 LOCK TABLES `scheduler_tasks` WRITE;
805 805 /*!40000 ALTER TABLE `scheduler_tasks` DISABLE KEYS */;
806 806 INSERT INTO `scheduler_tasks` VALUES
807   -(1,'Indexing','search2/indexing/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'),
808   -(2,'Index Migration','search2/indexing/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),
809   -(3,'Index Optimisation','search2/indexing/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'),
  807 +(1,'Indexing','search2/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'),
  808 +(2,'Index Migration','search2/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),
  809 +(3,'Index Optimisation','search2/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'),
810 810 (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'),
811 811 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
812 812 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled');
... ...
sql/mysql/upgrade/3.5.2/scheduler_permissions.sql 0 → 100644
  1 +UPDATE scheduler_tasks SET script_url='search2/bin/cronIndexer.php' WHERE task='Indexing';
  2 +UPDATE scheduler_tasks SET script_url='search2/bin/cronMigration.php' WHERE task='Index Migration';
  3 +UPDATE scheduler_tasks SET script_url='search2/bin/optimise.php' WHERE task='Index Optimisation';
0 4 \ No newline at end of file
... ...
templates/kt3/portlets/actions_portlet.smarty
... ... @@ -2,6 +2,9 @@
2 2 {foreach item=action from=$context->actions }
3 3 {if $action != null}
4 4 <li {if $action.active}class="active"{/if}>
  5 +{if $action.js}
  6 + {$action.js}
  7 +{else}
5 8 {if ($action.url)}
6 9 <a href="{$action.url}" {if $action.description}title="{$action.description}"{/if}>
7 10 {$action.name}
... ... @@ -10,5 +13,6 @@
10 13 {$action.name}
11 14 {/if}</li>
12 15 {/if}
  16 +{/if}
13 17 {/foreach}
14 18 </ul>
... ...
templates/ktcore/forms/widgets/string.smarty
1   - <input type="text" name="{$name}" {if $has_id}id="{$id}"{/if} {if $has_value}value="{$value|sanitize_input}"{/if}{if ($options.autocomplete === false)}autocomplete="off"{/if} {if $options.width}size="{$options.width}"{/if} />
  1 + <input type="text" name="{$name}" {if $has_id}id="{$id}"{/if} {if $has_value}value="{$value|sanitize_input}"{/if}{if ($options.autocomplete === false)}autocomplete="off"{/if} {if $options.width}size="{$options.width}"{/if} {if $options.onchange}onchange="{$options.onchange}" {/if}/>
... ...