Commit c4456bb8183a11273b93353b989be487bbab10f5

Authored by kevin_fourie
1 parent e36658c7

Merged in from DEV trunk...

WSA-55
"Allow users to be able to update the 'creator', 'created date', and other system fields via the KTAPI and web services"
Updated.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-2668
"When updating a Dynamic condition it does not the updated conditions with permissions already set in folders."
Fixed. Updated the permission object on updating or deleting a condition.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne

KTS-3047
"ktScheduler service does not start on upgrade"
Fixed. Added a check on whether the scheduler table exists before starting the scheduler.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne

KTS-3034
"Breadcrumb trail goes behind the search bar."
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8107 c91229c3-7414-0410-bfa2-8a42b809f60b
bin/win32/schedulerService.php
1 <?php 1 <?php
2 2
3 /** 3 /**
4 - * $Id: schedulerService.php 8085 2008-02-18 15:22:27Z kevin_fourie $ 4 + * $Id: schedulerService.php 8105 2008-02-20 08:35:13Z megan_w $
5 * 5 *
6 * KnowledgeTree Open Source Edition 6 * KnowledgeTree Open Source Edition
7 * Document Management Made Simple 7 * Document Management Made Simple
@@ -63,9 +63,49 @@ if (!is_file($phpPath)) @@ -63,9 +63,49 @@ if (!is_file($phpPath))
63 exit; 63 exit;
64 } 64 }
65 65
66 -$default->log->info("Scheduler Service: starting main loop");  
67 66
68 $loop = true; 67 $loop = true;
  68 +$bTableExists = false;
  69 +
  70 +while(!$bTableExists){
  71 + switch (win32_get_last_control_message())
  72 + {
  73 +
  74 + case WIN32_SERVICE_CONTROL_CONTINUE:
  75 + break; // Continue server routine
  76 + case WIN32_SERVICE_CONTROL_INTERROGATE:
  77 + win32_set_service_status(WIN32_NO_ERROR);
  78 + break; // Respond with status
  79 + case WIN32_SERVICE_CONTROL_STOP: win32_set_service_status(WIN32_SERVICE_STOPPED);
  80 + $loop = false; // Terminate script
  81 + $bTableExists = true;
  82 + continue;
  83 + default:
  84 + win32_set_service_status(WIN32_ERROR_CALL_NOT_IMPLEMENTED); // Add more cases to handle other service calls
  85 + }
  86 +
  87 + $default->log->info("Scheduler Service: Checking if the scheduler_tasks table exists.");
  88 +
  89 + $checkQuery = 'show tables';
  90 + $tableList = DBUtil::getResultArray($checkQuery);
  91 +
  92 + if(!empty($tableList)){
  93 + foreach($tableList as $table){
  94 + if(in_array('scheduler_tasks', $table)){
  95 + $bTableExists = true;
  96 + }
  97 + }
  98 + }
  99 +
  100 +
  101 + if(!$bTableExists){
  102 + $default->log->error('Scheduler Service: Scheduler_tasks table does not exist, sleeping for 30 seconds');
  103 + sleep(30);
  104 + }
  105 +}
  106 +
  107 +$default->log->info("Scheduler Service: starting main loop");
  108 +
69 // Main Scheduler Service Loop 109 // Main Scheduler Service Loop
70 while ($loop) 110 while ($loop)
71 { 111 {
ktapi/KTAPIDocument.inc.php
@@ -1146,7 +1146,7 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1146,7 +1146,7 @@ class KTAPI_Document extends KTAPI_FolderItem
1146 // just ignore 1146 // just ignore
1147 continue; 1147 continue;
1148 } 1148 }
1149 - switch($name) 1149 + switch(strtolower($name))
1150 { 1150 {
1151 case 'unique_oem_document_no': 1151 case 'unique_oem_document_no':
1152 $documents['oem_no'] = $value; 1152 $documents['oem_no'] = $value;
lib/permissions/permissiondynamiccondition.inc.php
@@ -80,6 +80,12 @@ class KTPermissionDynamicCondition extends KTEntity { @@ -80,6 +80,12 @@ class KTPermissionDynamicCondition extends KTEntity {
80 return KTEntityUtil::getList2('KTPermissionDynamicCondition', $sWhereClause); 80 return KTEntityUtil::getList2('KTPermissionDynamicCondition', $sWhereClause);
81 } 81 }
82 82
  83 + function getPermissionObjectIdList($sWhereClause, $aParams) {
  84 + $query = 'SELECT DISTINCT(permission_object_id) FROM permission_dynamic_conditions WHERE '.$sWhereClause;
  85 + $aQuery = array($query, $aParams);
  86 + return DBUtil::getResultArray($aQuery);
  87 + }
  88 +
83 function &getByPermissionObject($oPermissionObject) { 89 function &getByPermissionObject($oPermissionObject) {
84 $iPermissionObjectId = KTUtil::getId($oPermissionObject); 90 $iPermissionObjectId = KTUtil::getId($oPermissionObject);
85 return KTEntityUtil::getByDict('KTPermissionDynamicCondition', array( 91 return KTEntityUtil::getByDict('KTPermissionDynamicCondition', array(
plugins/ktcore/admin/conditions.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 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 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 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 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
@@ -39,6 +39,7 @@ require_once(KT_LIB_DIR . &quot;/templating/templating.inc.php&quot;); @@ -39,6 +39,7 @@ require_once(KT_LIB_DIR . &quot;/templating/templating.inc.php&quot;);
39 require_once(KT_LIB_DIR . "/dispatcher.inc.php"); 39 require_once(KT_LIB_DIR . "/dispatcher.inc.php");
40 require_once(KT_LIB_DIR . "/browse/Criteria.inc"); 40 require_once(KT_LIB_DIR . "/browse/Criteria.inc");
41 require_once(KT_LIB_DIR . "/search/savedsearch.inc.php"); 41 require_once(KT_LIB_DIR . "/search/savedsearch.inc.php");
  42 +require_once(KT_LIB_DIR .'/permissions/permissiondynamiccondition.inc.php');
42 43
43 class KTConditionDispatcher extends KTAdminDispatcher { 44 class KTConditionDispatcher extends KTAdminDispatcher {
44 var $bAutomaticTransaction = true; 45 var $bAutomaticTransaction = true;
@@ -72,6 +73,12 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -72,6 +73,12 @@ class KTConditionDispatcher extends KTAdminDispatcher {
72 73
73 function do_delete_confirmed() { 74 function do_delete_confirmed() {
74 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId'); 75 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId');
  76 +
  77 + // Get associated permission objects before deleting the condition
  78 + $sWhere = 'condition_id = ?';
  79 + $aParams = array($id);
  80 + $aPermissionObjects = KTPermissionDynamicCondition::getPermissionObjectIdList($sWhere, $aParams);
  81 +
75 $oSearch = KTSavedSearch::get($id); 82 $oSearch = KTSavedSearch::get($id);
76 KTPermissionDynamicCondition::deleteByCondition($oSearch); 83 KTPermissionDynamicCondition::deleteByCondition($oSearch);
77 $res = $oSearch->delete(); 84 $res = $oSearch->delete();
@@ -79,19 +86,29 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -79,19 +86,29 @@ class KTConditionDispatcher extends KTAdminDispatcher {
79 'redirect_to' => 'main', 86 'redirect_to' => 'main',
80 'message' => _kt('Search not deleted'), 87 'message' => _kt('Search not deleted'),
81 )); 88 ));
  89 +
  90 + // Update permission objects if they exist
  91 + if(!PEAR::isError($aPermissionObjects) && !empty($aPermissionObjects)){
  92 + // update permission objects
  93 + foreach($aPermissionObjects as $iPermObjectId){
  94 + $oPO = KTPermissionObject::get($iPermObjectId['permission_object_id']);
  95 + KTPermissionUtil::updatePermissionLookupForPO($oPO);
  96 + }
  97 + }
  98 +
82 $this->successRedirectToMain(_kt('Dynamic condition deleted')); 99 $this->successRedirectToMain(_kt('Dynamic condition deleted'));
83 } 100 }
84 101
85 function do_new() { 102 function do_new() {
86 $this->oPage->setBreadcrumbDetails(_kt('Create a new condition')); 103 $this->oPage->setBreadcrumbDetails(_kt('Create a new condition'));
87 $this->oPage->setTitle(_kt('Create a new condition')); 104 $this->oPage->setTitle(_kt('Create a new condition'));
88 - 105 +
89 $oTemplating =& KTTemplating::getSingleton(); 106 $oTemplating =& KTTemplating::getSingleton();
90 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search"); 107 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search");
91 - 108 +
92 $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); 109 $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
93 $aCriteria =& $oCriteriaRegistry->getCriteria(); 110 $aCriteria =& $oCriteriaRegistry->getCriteria();
94 - 111 +
95 $aTemplateData = array( 112 $aTemplateData = array(
96 "title" => _kt("Create a new condition"), 113 "title" => _kt("Create a new condition"),
97 "sNameTitle" => _kt("Name of condition"), 114 "sNameTitle" => _kt("Name of condition"),
@@ -105,24 +122,24 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -105,24 +122,24 @@ class KTConditionDispatcher extends KTAdminDispatcher {
105 function do_view() { 122 function do_view() {
106 123
107 } 124 }
108 - 125 +
109 function do_edit() { 126 function do_edit() {
110 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId'); 127 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId');
111 $oSearch = KTSavedSearch::get($id); 128 $oSearch = KTSavedSearch::get($id);
112 - 129 +
113 if (PEAR::isError($oSearch) || ($oSearch == false)) { 130 if (PEAR::isError($oSearch) || ($oSearch == false)) {
114 $this->errorRedirectToMain('No such dynamic condition'); 131 $this->errorRedirectToMain('No such dynamic condition');
115 } 132 }
116 - 133 +
117 $aSearch = $oSearch->getSearch(); 134 $aSearch = $oSearch->getSearch();
118 -  
119 - 135 +
  136 +
120 $oTemplating =& KTTemplating::getSingleton(); 137 $oTemplating =& KTTemplating::getSingleton();
121 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search_edit"); 138 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search_edit");
122 - 139 +
123 $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); 140 $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
124 $aCriteria =& $oCriteriaRegistry->getCriteria(); 141 $aCriteria =& $oCriteriaRegistry->getCriteria();
125 - 142 +
126 // we need to help out here, since it gets unpleasant inside the template. 143 // we need to help out here, since it gets unpleasant inside the template.
127 foreach ($aSearch['subgroup'] as $isg => $as) { 144 foreach ($aSearch['subgroup'] as $isg => $as) {
128 $aSubgroup =& $aSearch['subgroup'][$isg]; 145 $aSubgroup =& $aSearch['subgroup'][$isg];
@@ -139,8 +156,8 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -139,8 +156,8 @@ class KTConditionDispatcher extends KTAdminDispatcher {
139 } 156 }
140 } 157 }
141 } 158 }
142 -  
143 - 159 +
  160 +
144 $aTemplateData = array( 161 $aTemplateData = array(
145 "title" => _kt("Edit an existing condition"), 162 "title" => _kt("Edit an existing condition"),
146 "aCriteria" => $aCriteria, 163 "aCriteria" => $aCriteria,
@@ -151,26 +168,26 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -151,26 +168,26 @@ class KTConditionDispatcher extends KTAdminDispatcher {
151 'old_name' => $oSearch->getName(), 168 'old_name' => $oSearch->getName(),
152 'sNameTitle' => _kt('Edit Dynamic Condition'), 169 'sNameTitle' => _kt('Edit Dynamic Condition'),
153 ); 170 );
154 - return $oTemplate->render($aTemplateData); 171 + return $oTemplate->render($aTemplateData);
155 } 172 }
156 - 173 +
157 174
158 // XXX: Rename to do_save 175 // XXX: Rename to do_save
159 function do_updateSearch() { 176 function do_updateSearch() {
160 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId'); 177 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId');
161 $sName = KTUtil::arrayGet($_REQUEST, 'name'); 178 $sName = KTUtil::arrayGet($_REQUEST, 'name');
162 $oSearch = KTSavedSearch::get($id); 179 $oSearch = KTSavedSearch::get($id);
163 - 180 +
164 if (PEAR::isError($oSearch) || ($oSearch == false)) { 181 if (PEAR::isError($oSearch) || ($oSearch == false)) {
165 $this->errorRedirectToMain('No such dynamic condition'); 182 $this->errorRedirectToMain('No such dynamic condition');
166 } 183 }
167 -  
168 - 184 +
  185 +
169 $datavars = KTUtil::arrayGet($_REQUEST, 'boolean_search'); 186 $datavars = KTUtil::arrayGet($_REQUEST, 'boolean_search');
170 if (!is_array($datavars)) { 187 if (!is_array($datavars)) {
171 $datavars = unserialize($datavars); 188 $datavars = unserialize($datavars);
172 } 189 }
173 - 190 +
174 if (empty($datavars)) { 191 if (empty($datavars)) {
175 $this->errorRedirectToMain(_kt('You need to have at least 1 condition.')); 192 $this->errorRedirectToMain(_kt('You need to have at least 1 condition.'));
176 } 193 }
@@ -179,16 +196,30 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -179,16 +196,30 @@ class KTConditionDispatcher extends KTAdminDispatcher {
179 if (!empty($sName)) { 196 if (!empty($sName)) {
180 $oSearch->setName($sName); 197 $oSearch->setName($sName);
181 } 198 }
182 - 199 +
183 $oSearch->setSearch($datavars); 200 $oSearch->setSearch($datavars);
184 $res = $oSearch->update(); 201 $res = $oSearch->update();
185 - 202 +
186 $this->oValidator->notError($res, array( 203 $this->oValidator->notError($res, array(
187 'redirect_to' => 'main', 204 'redirect_to' => 'main',
188 'message' => _kt('Search not saved'), 205 'message' => _kt('Search not saved'),
189 )); 206 ));
  207 +
  208 + // Update permission object if exists
  209 + $sWhere = 'condition_id = ?';
  210 + $aParams = array($id);
  211 + $aPermissionObjects = KTPermissionDynamicCondition::getPermissionObjectIdList($sWhere, $aParams);
  212 +
  213 + if(!PEAR::isError($aPermissionObjects) && !empty($aPermissionObjects)){
  214 + // update permission objects
  215 + foreach($aPermissionObjects as $iPermObjectId){
  216 + $oPO = KTPermissionObject::get($iPermObjectId['permission_object_id']);
  217 + KTPermissionUtil::updatePermissionLookupForPO($oPO);
  218 + }
  219 + }
  220 +
190 $this->successRedirectToMain(_kt('Dynamic condition saved')); 221 $this->successRedirectToMain(_kt('Dynamic condition saved'));
191 - } 222 + }
192 223
193 // XXX: Rename to do_save 224 // XXX: Rename to do_save
194 function do_performSearch() { 225 function do_performSearch() {
@@ -196,17 +227,17 @@ class KTConditionDispatcher extends KTAdminDispatcher { @@ -196,17 +227,17 @@ class KTConditionDispatcher extends KTAdminDispatcher {
196 if (!is_array($datavars)) { 227 if (!is_array($datavars)) {
197 $datavars = unserialize($datavars); 228 $datavars = unserialize($datavars);
198 } 229 }
199 - 230 +
200 if (empty($datavars)) { 231 if (empty($datavars)) {
201 $this->errorRedirectToMain(_kt('You need to have at least 1 condition.')); 232 $this->errorRedirectToMain(_kt('You need to have at least 1 condition.'));
202 } 233 }
203 234
204 $sName = $this->oValidator->validateEntityName( 235 $sName = $this->oValidator->validateEntityName(
205 - 'KTSavedSearch',  
206 - KTUtil::arrayGet($_REQUEST, 'name'), 236 + 'KTSavedSearch',
  237 + KTUtil::arrayGet($_REQUEST, 'name'),
207 array('extra_condition' => 'is_condition', 'redirect_to' => array('new')) 238 array('extra_condition' => 'is_condition', 'redirect_to' => array('new'))
208 ); 239 );
209 - 240 +
210 $sNamespace = KTUtil::nameToLocalNamespace('Saved searches', $sName); 241 $sNamespace = KTUtil::nameToLocalNamespace('Saved searches', $sName);
211 242
212 $oSearch = KTSavedSearch::createFromArray(array( 243 $oSearch = KTSavedSearch::createFromArray(array(
resources/js/search2widget.js
@@ -190,9 +190,7 @@ function createSearchBar(div, suffix) @@ -190,9 +190,7 @@ function createSearchBar(div, suffix)
190 var el = Ext.get(div); 190 var el = Ext.get(div);
191 if (suffix == 1) 191 if (suffix == 1)
192 { 192 {
193 - el.applyStyles('position:relative; top: -15px; margin-right: 15px');  
194 - if (Ext.isSafari)  
195 - el.applyStyles('top: 0px'); 193 + el.applyStyles('position:relative; margin-right: 15px');
196 } 194 }
197 else 195 else
198 { 196 {
templates/kt3/standard_page.smarty
@@ -172,7 +172,13 @@ @@ -172,7 +172,13 @@
172 {/if} 172 {/if}
173 {if (!$page->hide_section)} 173 {if (!$page->hide_section)}
174 <div id="breadcrumbs"> 174 <div id="breadcrumbs">
175 - <span class="additional">{i18n}You are here{/i18n}: </span> 175 + <table width="100%">
  176 + <tr>
  177 + <td valign=top align=left width="100">
  178 + <span class="additional"><nobr>{i18n}You are here{/i18n}: </span>
  179 + </td>
  180 + <td valign=top align=left width="100%">
  181 +
176 {if ($page->breadcrumbSection !== false)} 182 {if ($page->breadcrumbSection !== false)}
177 {if ($page->breadcrumbSection.url) } 183 {if ($page->breadcrumbSection.url) }
178 <a href="{$page->breadcrumbSection.url}" class="primary">{$page->breadcrumbSection.label|sanitize}</a> 184 <a href="{$page->breadcrumbSection.url}" class="primary">{$page->breadcrumbSection.label|sanitize}</a>
@@ -183,10 +189,11 @@ @@ -183,10 +189,11 @@
183 {if (($page->breadcrumbSection !== false) && ($page->breadcrumbs !== false))} 189 {if (($page->breadcrumbSection !== false) && ($page->breadcrumbs !== false))}
184 &raquo; 190 &raquo;
185 {/if} 191 {/if}
  192 +
186 {if ($page->breadcrumbs !== false)} 193 {if ($page->breadcrumbs !== false)}
187 {foreach item=aCrumb from=$page->breadcrumbs name=bc} 194 {foreach item=aCrumb from=$page->breadcrumbs name=bc}
188 {if ($aCrumb.url) } 195 {if ($aCrumb.url) }
189 - <a href="{$aCrumb.url}">{$aCrumb.label|sanitize}</a> 196 + <a href="{$aCrumb.url}">{$aCrumb.label|mb_truncate:40:"...":true|sanitize}</a>
190 {else} 197 {else}
191 <span>{$aCrumb.label|mb_truncate:40:"...":true|sanitize}</span> 198 <span>{$aCrumb.label|mb_truncate:40:"...":true|sanitize}</span>
192 {/if} 199 {/if}
@@ -198,7 +205,12 @@ @@ -198,7 +205,12 @@
198 {if ($page->breadcrumbDetails !== false)} 205 {if ($page->breadcrumbDetails !== false)}
199 <span class="additional">({$page->breadcrumbDetails|sanitize})</span> 206 <span class="additional">({$page->breadcrumbDetails|sanitize})</span>
200 {/if} 207 {/if}
201 - <div id="newSearchQuery" style="float: right; "/> 208 + </td>
  209 + <td width="5px">&nbsp;</td>
  210 + <td valign=top align=right width="100">
  211 + <div id="newSearchQuery" /></td>
  212 + </tr>
  213 + </table>
202 </div> 214 </div>
203 {/if} 215 {/if}
204 </div> 216 </div>