From 01a08cab7d859d6fe1289a86335f8877c02799fd Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Mon, 17 Mar 2008 15:01:41 +0000 Subject: [PATCH] Merged in from DEV trunk... --- ktwebservice/nunit/document_contents.cs | 4 ++-- ktwebservice/nunit/document_detail.cs | 4 ++-- ktwebservice/nunit/document_metadata.cs | 26 ++++++++++++++------------ ktwebservice/nunit/document_system_metadata.cs | 24 ++++++++++++------------ ktwebservice/nunit/makefile | 2 +- lib/actions/documentaction.inc.php | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- lib/actions/folderaction.inc.php | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- lib/security/Permission.inc | 7 +++++++ lib/util/ktutil.inc | 16 +++++++++++++++- search2/bin/cronIndexer.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ search2/bin/cronMigration.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ search2/bin/optimise.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ search2/search/expr.inc.php | 33 ++++++++++++++++++--------------- search2/search/fieldRegistry.inc.php | 15 +++++++++++++-- search2/search/fields/FullPathField.inc.php | 2 +- search2/search/fields/TitleField.inc.php | 1 - sql/mysql/install/data.sql | 6 +++--- sql/mysql/upgrade/3.5.2/scheduler_permissions.sql | 3 +++ templates/kt3/portlets/actions_portlet.smarty | 4 ++++ templates/ktcore/forms/widgets/string.smarty | 2 +- 20 files changed, 479 insertions(+), 71 deletions(-) create mode 100644 search2/bin/cronIndexer.php create mode 100644 search2/bin/cronMigration.php create mode 100644 search2/bin/optimise.php create mode 100644 sql/mysql/upgrade/3.5.2/scheduler_permissions.sql diff --git a/ktwebservice/nunit/document_contents.cs b/ktwebservice/nunit/document_contents.cs index 767355d..fcbd7f5 100644 --- a/ktwebservice/nunit/document_contents.cs +++ b/ktwebservice/nunit/document_contents.cs @@ -57,7 +57,7 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual("Administrator", response.items[1].owned_by); Assert.AreEqual("0.1", response.items[1].version); Assert.AreEqual("false", response.items[1].is_immutable); - Assert.AreEqual("n/a", response.items[1].permissions); + Assert.AreEqual("RW", response.items[1].permissions); Assert.AreEqual("n/a", response.items[1].workflow); Assert.AreEqual("n/a", response.items[1].workflow_state); Assert.AreEqual("text/plain", response.items[1].mime_type); @@ -79,7 +79,7 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual("n/a", response.items[0].owned_by); Assert.AreEqual("n/a", response.items[0].version); Assert.AreEqual("n/a", response.items[0].is_immutable); - Assert.AreEqual("n/a", response.items[0].permissions); + Assert.AreEqual("RW", response.items[0].permissions); Assert.AreEqual("n/a", response.items[0].workflow); Assert.AreEqual("n/a", response.items[0].workflow_state); Assert.AreEqual("folder", response.items[0].mime_type); diff --git a/ktwebservice/nunit/document_detail.cs b/ktwebservice/nunit/document_detail.cs index 61931f3..e9dbe7b 100644 --- a/ktwebservice/nunit/document_detail.cs +++ b/ktwebservice/nunit/document_detail.cs @@ -81,14 +81,14 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual("Administrator", response.owned_by); Assert.AreEqual(0.1, response.version); Assert.AreEqual(false, response.is_immutable); - Assert.AreEqual("n/a", response.permissions); + Assert.AreEqual("RW", response.permissions); Assert.AreEqual("n/a", response.workflow); Assert.AreEqual("n/a", response.workflow_state); Assert.AreEqual("text/plain", response.mime_type); Assert.AreEqual("text", response.mime_icon_path); Assert.AreEqual("Plain Text", response.mime_display); Assert.IsTrue("" != response.storage_path); - Assert.AreEqual(2, response.metadata.Length); + Assert.AreEqual(3, response.metadata.Length); Assert.AreEqual(null, response.links); Assert.AreEqual(1, response.transaction_history.Length); diff --git a/ktwebservice/nunit/document_metadata.cs b/ktwebservice/nunit/document_metadata.cs index 39bb5cc..fd3e58a 100644 --- a/ktwebservice/nunit/document_metadata.cs +++ b/ktwebservice/nunit/document_metadata.cs @@ -81,11 +81,11 @@ namespace MonoTests.KnowledgeTree fs[0].fieldset = "General information"; fs[0].fields = new kt_metadata_field[3]; fs[0].fields[0] = new kt_metadata_field(); - fs[0].fields[0].name = "Document Author"; - fs[0].fields[0].value = "Joe Soap"; + fs[0].fields[0].name = "Category"; + fs[0].fields[0].value = "Technical"; fs[0].fields[1] = new kt_metadata_field(); - fs[0].fields[1].name = "Category"; - fs[0].fields[1].value = "Technical"; + fs[0].fields[1].name = "Document Author"; + fs[0].fields[1].value = "Joe Soap"; fs[0].fields[2] = new kt_metadata_field(); fs[0].fields[2].name = "Media Type"; fs[0].fields[2].value = "Text"; @@ -96,11 +96,11 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual(0, update_resp.status_code); Assert.AreEqual("General information", update_resp.metadata[1].fieldset); - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name); - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value); + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name); + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value); - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name); - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value); + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name); + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value); Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name); Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value); @@ -131,11 +131,13 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual(0, update_resp.status_code); Assert.AreEqual("General information", update_resp.metadata[1].fieldset); - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name); - Assert.AreEqual("Joe \\Soap", update_resp.metadata[1].fields[0].value); + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name); + Assert.AreEqual("Tec/hn\\ical/", update_resp.metadata[1].fields[0].value); + + + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name); + Assert.AreEqual("Joe \\Soap", update_resp.metadata[1].fields[1].value); - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name); - Assert.AreEqual("Tec/hn\\ical/", update_resp.metadata[1].fields[1].value); Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name); Assert.AreEqual("Text'", update_resp.metadata[1].fields[2].value); diff --git a/ktwebservice/nunit/document_system_metadata.cs b/ktwebservice/nunit/document_system_metadata.cs index c7f9ff7..9b4b7fb 100644 --- a/ktwebservice/nunit/document_system_metadata.cs +++ b/ktwebservice/nunit/document_system_metadata.cs @@ -66,11 +66,11 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual(0, update_resp.status_code); Assert.AreEqual("General information", update_resp.metadata[1].fieldset); - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name); - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value); + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name); + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value); - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name); - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value); + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name); + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value); Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name); Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value); @@ -112,11 +112,11 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual(0, update_resp.status_code); Assert.AreEqual("General information", update_resp.metadata[1].fieldset); - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name); - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value); + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name); + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value); - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name); - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value); + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name); + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value); Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name); Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value); @@ -167,11 +167,11 @@ namespace MonoTests.KnowledgeTree Assert.AreEqual(0, update_resp.status_code); Assert.AreEqual("General information", update_resp.metadata[1].fieldset); - Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name); - Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value); + Assert.AreEqual("Category", update_resp.metadata[1].fields[0].name); + Assert.AreEqual("Technical", update_resp.metadata[1].fields[0].value); - Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name); - Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value); + Assert.AreEqual("Document Author", update_resp.metadata[1].fields[1].name); + Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[1].value); Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name); Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value); diff --git a/ktwebservice/nunit/makefile b/ktwebservice/nunit/makefile index 73cf630..65b3cf0 100644 --- a/ktwebservice/nunit/makefile +++ b/ktwebservice/nunit/makefile @@ -1,4 +1,4 @@ -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 +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 PROXY=KTproxy.cs WSDL=ktdms.wsdl ROOT_URL=http://ktdms.trunk diff --git a/lib/actions/documentaction.inc.php b/lib/actions/documentaction.inc.php index 8f90846..e96cfd3 100644 --- a/lib/actions/documentaction.inc.php +++ b/lib/actions/documentaction.inc.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -203,6 +203,121 @@ class KTDocumentAction extends KTStandardDispatcher { } } +class JavascriptDocumentAction extends KTDocumentAction +{ + /** + * This is an array of js files to be included for this action + * + * @var array + */ + var $js_paths = array(); + /** + * This is custom javascript that should be included + * + * @var array + */ + var $js = array(); + /** + * Indicates if a custom function should be provided, or if the function is part of an existing js file. + * If true + * + * @var boolean + */ + var $function_provided_by_action = true; + + /** + * Set the function name if you have a custom name you want to provide. + * + * @var string + */ + var $function_name = null; + + function JavascriptDocumentAction($oDocument = null, $oUser = null, $oPlugin = null) + { + parent::KTDocumentAction($oDocument, $oUser, $oPlugin); + $this->js_initialise(); + } + + function js_initialise() + { + // this will be overridden + } + + function js_include($js) + { + $this->js[] = $js; + } + + function js_include_file($path) + { + global $AjaxDocumentJSPaths; + + if (!isset($AjaxDocumentJSPaths)) + { + $AjaxDocumentJSPaths = array(); + } + + if (!in_array($AjaxDocumentJSPaths)) + { + $AjaxDocumentJSPaths[] = $path; + $this->js_paths [] = $path; + } + } + + function customiseInfo($aInfo) + { + $js = ''; + foreach($this->js_paths as $path) + { + $js .= "\n"; + } + + $js .= ''. "\n"; + + $js .= '
' . $this->getDisplayName() . '
'. "\n"; + + + $aInfo['js'] = $js; + + return $aInfo; + } + + function getScript() + { + if ($this->function_provided_by_action === false) + { + return ''; + } + return "function " . $this->getScriptActivation() . '{'.$this->getFunctionScript().'}'; + } + + function getFunctionScript() + { + return 'alert(\''. $this->getDisplayName() .' not implemented!\');'; + } + + function getScriptActivation() + { + if (!is_null($this->function_name)) + { + return $this->function_name; + } + + global $AjaxDocumentActions; + $class = get_class($this); + return 'js' . $class. 'Dispatcher()'; + } + + + +} + class KTDocumentActionUtil { function getDocumentActionInfo($slot = 'documentaction') { $oRegistry =& KTActionRegistry::getSingleton(); diff --git a/lib/actions/folderaction.inc.php b/lib/actions/folderaction.inc.php index 11879af..d3090ba 100644 --- a/lib/actions/folderaction.inc.php +++ b/lib/actions/folderaction.inc.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -177,6 +177,122 @@ class KTFolderAction extends KTStandardDispatcher { } +class JavascriptFolderAction extends KTFolderAction +{ + /** + * This is an array of js files to be included for this action + * + * @var array + */ + var $js_paths = array(); + /** + * This is custom javascript that should be included + * + * @var array + */ + var $js = array(); + /** + * Indicates if a custom function should be provided, or if the function is part of an existing js file. + * If true + * + * @var boolean + */ + var $function_provided_by_action = true; + + /** + * Set the function name if you have a custom name you want to provide. + * + * @var string + */ + var $function_name = null; + + function JavascriptFolderAction($oFolder = null, $oUser = null, $oPlugin = null) + { + parent::KTFolderAction($oFolder, $oUser, $oPlugin); + $this->js_initialise(); + } + + function js_initialise() + { + // this will be overridden + } + + function js_include($js) + { + $this->js[] = $js; + } + + function js_include_file($path) + { + global $AjaxDocumentJSPaths; + + if (!isset($AjaxDocumentJSPaths)) + { + $AjaxDocumentJSPaths = array(); + } + + if (!in_array($AjaxDocumentJSPaths)) + { + $AjaxDocumentJSPaths[] = $path; + $this->js_paths [] = $path; + } + } + + function customiseInfo($aInfo) + { + $js = ''; + foreach($this->js_paths as $path) + { + $js .= "\n"; + } + + $js .= ''. "\n"; + + $js .= '
' . $this->getDisplayName() . '
'. "\n"; + + + $aInfo['js'] = $js; + + return $aInfo; + } + + function getScript() + { + if ($this->function_provided_by_action === false) + { + return ''; + } + return "function " . $this->getScriptActivation() . '{'.$this->getFunctionScript().'}'; + } + + function getFunctionScript() + { + return 'alert(\''. $this->getDisplayName() .' not implemented!\');'; + } + + function getScriptActivation() + { + if (!is_null($this->function_name)) + { + return $this->function_name; + } + + global $AjaxDocumentActions; + $class = get_class($this); + return 'js' . $class. 'Dispatcher()'; + } + + + +} + + class KTFolderActionUtil { function getFolderActions() { $oRegistry =& KTActionRegistry::getSingleton(); diff --git a/lib/security/Permission.inc b/lib/security/Permission.inc index e12fc28..0a9454a 100644 --- a/lib/security/Permission.inc +++ b/lib/security/Permission.inc @@ -118,7 +118,14 @@ class Permission { if ($iUserID == '') { $iUserID = $_SESSION['userID']; } + if (empty($iUserID)) { + return false; + } $iUserID = KTUtil::getId($iUserID); + if (PEAR::isError($iUserID)) + { + return false; + } $query = 'SELECT UGL.group_id FROM '.$default->users_groups_table.' AS UGL diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index 2dc71e1..d9c6f58 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -53,8 +53,22 @@ class KTUtil { { global $default; - return ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'] . $default->rootUrl; + $config = KTConfig::getSingleton(); + $serverName = $config->get('knowledgeTree/serverName', $_SERVER['HTTP_HOST']); + return ($default->sslEnabled ? 'https' : 'http') .'://'.$serverName . $default->rootUrl; + + } + + static function call_page($path) + { + $kt_url = KTUtil::kt_url(); + + $full_url = $kt_url . '/' . $path; + + $ch = curl_init($full_url); + curl_exec($ch); + curl_close($ch); } static function computePeriod($diff, $suffix = null, $returnArray=false) diff --git a/search2/bin/cronIndexer.php b/search2/bin/cronIndexer.php new file mode 100644 index 0000000..485bbf8 --- /dev/null +++ b/search2/bin/cronIndexer.php @@ -0,0 +1,45 @@ +. + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +chdir(dirname(__FILE__)); +require_once(realpath('../../config/dmsDefaults.php')); + +KTUtil::call_page('search2/indexing/bin/cronIndexer.php'); + + +?> \ No newline at end of file diff --git a/search2/bin/cronMigration.php b/search2/bin/cronMigration.php new file mode 100644 index 0000000..ae03d10 --- /dev/null +++ b/search2/bin/cronMigration.php @@ -0,0 +1,44 @@ +. + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +chdir(dirname(__FILE__)); +require_once(realpath('../../config/dmsDefaults.php')); + +KTUtil::call_page('search2/indexing/bin/cronMigration.php'); + +?> \ No newline at end of file diff --git a/search2/bin/optimise.php b/search2/bin/optimise.php new file mode 100644 index 0000000..6921f03 --- /dev/null +++ b/search2/bin/optimise.php @@ -0,0 +1,45 @@ +. + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +chdir(dirname(__FILE__)); +require_once(realpath('../../config/dmsDefaults.php')); + +KTUtil::call_page('search2/indexing/bin/optimise.php'); + + +?> \ No newline at end of file diff --git a/search2/search/expr.inc.php b/search2/search/expr.inc.php index a4ed3a7..0b47c8d 100644 --- a/search2/search/expr.inc.php +++ b/search2/search/expr.inc.php @@ -591,22 +591,25 @@ class ValueExpr extends Expr public function getSQL($field, $fieldname, $op, $not=false) { $val = $this->getValue(); - switch($op) - { - case ExprOp::LIKE: - - break; - case ExprOp::CONTAINS: - $val = "%$val%"; - break; - case ExprOp::STARTS_WITH: - $val = "$val%"; - break; - case ExprOp::ENDS_WITH: - $val = "%$val"; - break; - } + if (strpos($val, '*') !== false || strpos($val, '?') !== false) + { + $val = str_replace(array('?','*'), array('%','%'), $val); + } + switch($op) + { + case ExprOp::LIKE: + break; + case ExprOp::CONTAINS: + $val = "%$val%"; + break; + case ExprOp::STARTS_WITH: + $val = "$val%"; + break; + case ExprOp::ENDS_WITH: + $val = "%$val"; + break; + } $val = $field->modifyValue($val); $quote = ''; diff --git a/search2/search/fieldRegistry.inc.php b/search2/search/fieldRegistry.inc.php index 46a4117..e240372 100644 --- a/search2/search/fieldRegistry.inc.php +++ b/search2/search/fieldRegistry.inc.php @@ -158,10 +158,18 @@ class ExprFieldRegistry public function resolveMetadataField($fieldset, $field) { + if ($fieldset instanceof ValueExpr) + { + $fieldset = $fieldset->getValue(); + } if (!array_key_exists($fieldset,$this->metadata)) { throw new ResolutionException("Metadata class for fieldset '$fieldset' and field '$field' not found."); } + if ($field instanceof ValueExpr) + { + $field = $field->getValue(); + } if (!array_key_exists($field,$this->metadata[$fieldset])) { throw new ResolutionException("Metadata class for fieldset '$fieldset' and field '$field' not found."); @@ -249,7 +257,7 @@ class ExprFieldRegistry private function registerMetdataFields() { $sql = "SELECT - fs.name as fieldset, f.name as field, fs.id as fsid, f.id as fid + fs.name as fieldset, f.name as field, fs.id as fsid, f.id as fid, f.data_type FROM fieldsets fs INNER JOIN document_fields f ON f.parent_fieldset=fs.id @@ -263,6 +271,7 @@ class ExprFieldRegistry $field = addslashes($record['field']); $fieldsetid = $record['fsid']; $fieldid = $record['fid']; + $type = $record['data_type']; $classname = "MetadataField$fieldid"; $classdefn = " @@ -270,7 +279,9 @@ class ExprFieldRegistry { public function __construct() { - parent::__construct('$fieldset','$field',$fieldsetid, $fieldid); + parent::__construct('$fieldset','$field',$fieldsetid, $fieldid);" . + + (($type=='INT')?'$this->isValueQuoted(false);':'') . " } }"; eval($classdefn); diff --git a/search2/search/fields/FullPathField.inc.php b/search2/search/fields/FullPathField.inc.php index 2b855e9..515b97b 100644 --- a/search2/search/fields/FullPathField.inc.php +++ b/search2/search/fields/FullPathField.inc.php @@ -43,7 +43,7 @@ class FullPathField extends DBFieldExpr public function __construct() { parent::__construct('full_path', 'documents', _kt('Full Path')); - $this->setAlias('Full Path'); + $this->setAlias('FullPath'); } public function getInputRequirements() diff --git a/search2/search/fields/TitleField.inc.php b/search2/search/fields/TitleField.inc.php index 2b2de0c..6b6a2ca 100644 --- a/search2/search/fields/TitleField.inc.php +++ b/search2/search/fields/TitleField.inc.php @@ -38,7 +38,6 @@ class TitleField extends DBFieldExpr { - public $general_op = ExprOp::CONTAINS; public function __construct() { diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index 961f50f..a94d388 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -804,9 +804,9 @@ UNLOCK TABLES; LOCK TABLES `scheduler_tasks` WRITE; /*!40000 ALTER TABLE `scheduler_tasks` DISABLE KEYS */; INSERT INTO `scheduler_tasks` VALUES -(1,'Indexing','search2/indexing/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'), -(2,'Index Migration','search2/indexing/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'), -(3,'Index Optimisation','search2/indexing/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'), +(1,'Indexing','search2/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'), +(2,'Index Migration','search2/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'), +(3,'Index Optimisation','search2/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'), (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'), (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'), (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'); diff --git a/sql/mysql/upgrade/3.5.2/scheduler_permissions.sql b/sql/mysql/upgrade/3.5.2/scheduler_permissions.sql new file mode 100644 index 0000000..87eb271 --- /dev/null +++ b/sql/mysql/upgrade/3.5.2/scheduler_permissions.sql @@ -0,0 +1,3 @@ +UPDATE scheduler_tasks SET script_url='search2/bin/cronIndexer.php' WHERE task='Indexing'; +UPDATE scheduler_tasks SET script_url='search2/bin/cronMigration.php' WHERE task='Index Migration'; +UPDATE scheduler_tasks SET script_url='search2/bin/optimise.php' WHERE task='Index Optimisation'; \ No newline at end of file diff --git a/templates/kt3/portlets/actions_portlet.smarty b/templates/kt3/portlets/actions_portlet.smarty index 8739ab3..e271fc4 100644 --- a/templates/kt3/portlets/actions_portlet.smarty +++ b/templates/kt3/portlets/actions_portlet.smarty @@ -2,6 +2,9 @@ {foreach item=action from=$context->actions } {if $action != null}
  • +{if $action.js} + {$action.js} +{else} {if ($action.url)} {$action.name} @@ -10,5 +13,6 @@ {$action.name} {/if}
  • {/if} +{/if} {/foreach} diff --git a/templates/ktcore/forms/widgets/string.smarty b/templates/ktcore/forms/widgets/string.smarty index 1de962c..48814ed 100644 --- a/templates/ktcore/forms/widgets/string.smarty +++ b/templates/ktcore/forms/widgets/string.smarty @@ -1 +1 @@ - + -- libgit2 0.21.4