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 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 6 * KnowledgeTree Open Source Edition
7 7 * Document Management Made Simple
... ... @@ -63,9 +63,49 @@ if (!is_file($phpPath))
63 63 exit;
64 64 }
65 65  
66   -$default->log->info("Scheduler Service: starting main loop");
67 66  
68 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 109 // Main Scheduler Service Loop
70 110 while ($loop)
71 111 {
... ...
ktapi/KTAPIDocument.inc.php
... ... @@ -1146,7 +1146,7 @@ class KTAPI_Document extends KTAPI_FolderItem
1146 1146 // just ignore
1147 1147 continue;
1148 1148 }
1149   - switch($name)
  1149 + switch(strtolower($name))
1150 1150 {
1151 1151 case 'unique_oem_document_no':
1152 1152 $documents['oem_no'] = $value;
... ...
lib/permissions/permissiondynamiccondition.inc.php
... ... @@ -80,6 +80,12 @@ class KTPermissionDynamicCondition extends KTEntity {
80 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 89 function &getByPermissionObject($oPermissionObject) {
84 90 $iPermissionObjectId = KTUtil::getId($oPermissionObject);
85 91 return KTEntityUtil::getByDict('KTPermissionDynamicCondition', array(
... ...
plugins/ktcore/admin/conditions.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 */
... ... @@ -39,6 +39,7 @@ require_once(KT_LIB_DIR . &quot;/templating/templating.inc.php&quot;);
39 39 require_once(KT_LIB_DIR . "/dispatcher.inc.php");
40 40 require_once(KT_LIB_DIR . "/browse/Criteria.inc");
41 41 require_once(KT_LIB_DIR . "/search/savedsearch.inc.php");
  42 +require_once(KT_LIB_DIR .'/permissions/permissiondynamiccondition.inc.php');
42 43  
43 44 class KTConditionDispatcher extends KTAdminDispatcher {
44 45 var $bAutomaticTransaction = true;
... ... @@ -72,6 +73,12 @@ class KTConditionDispatcher extends KTAdminDispatcher {
72 73  
73 74 function do_delete_confirmed() {
74 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 82 $oSearch = KTSavedSearch::get($id);
76 83 KTPermissionDynamicCondition::deleteByCondition($oSearch);
77 84 $res = $oSearch->delete();
... ... @@ -79,19 +86,29 @@ class KTConditionDispatcher extends KTAdminDispatcher {
79 86 'redirect_to' => 'main',
80 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 99 $this->successRedirectToMain(_kt('Dynamic condition deleted'));
83 100 }
84 101  
85 102 function do_new() {
86 103 $this->oPage->setBreadcrumbDetails(_kt('Create a new condition'));
87 104 $this->oPage->setTitle(_kt('Create a new condition'));
88   -
  105 +
89 106 $oTemplating =& KTTemplating::getSingleton();
90 107 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search");
91   -
  108 +
92 109 $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
93 110 $aCriteria =& $oCriteriaRegistry->getCriteria();
94   -
  111 +
95 112 $aTemplateData = array(
96 113 "title" => _kt("Create a new condition"),
97 114 "sNameTitle" => _kt("Name of condition"),
... ... @@ -105,24 +122,24 @@ class KTConditionDispatcher extends KTAdminDispatcher {
105 122 function do_view() {
106 123  
107 124 }
108   -
  125 +
109 126 function do_edit() {
110 127 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId');
111 128 $oSearch = KTSavedSearch::get($id);
112   -
  129 +
113 130 if (PEAR::isError($oSearch) || ($oSearch == false)) {
114 131 $this->errorRedirectToMain('No such dynamic condition');
115 132 }
116   -
  133 +
117 134 $aSearch = $oSearch->getSearch();
118   -
119   -
  135 +
  136 +
120 137 $oTemplating =& KTTemplating::getSingleton();
121 138 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search_edit");
122   -
  139 +
123 140 $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
124 141 $aCriteria =& $oCriteriaRegistry->getCriteria();
125   -
  142 +
126 143 // we need to help out here, since it gets unpleasant inside the template.
127 144 foreach ($aSearch['subgroup'] as $isg => $as) {
128 145 $aSubgroup =& $aSearch['subgroup'][$isg];
... ... @@ -139,8 +156,8 @@ class KTConditionDispatcher extends KTAdminDispatcher {
139 156 }
140 157 }
141 158 }
142   -
143   -
  159 +
  160 +
144 161 $aTemplateData = array(
145 162 "title" => _kt("Edit an existing condition"),
146 163 "aCriteria" => $aCriteria,
... ... @@ -151,26 +168,26 @@ class KTConditionDispatcher extends KTAdminDispatcher {
151 168 'old_name' => $oSearch->getName(),
152 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 175 // XXX: Rename to do_save
159 176 function do_updateSearch() {
160 177 $id = KTUtil::arrayGet($_REQUEST, 'fSavedSearchId');
161 178 $sName = KTUtil::arrayGet($_REQUEST, 'name');
162 179 $oSearch = KTSavedSearch::get($id);
163   -
  180 +
164 181 if (PEAR::isError($oSearch) || ($oSearch == false)) {
165 182 $this->errorRedirectToMain('No such dynamic condition');
166 183 }
167   -
168   -
  184 +
  185 +
169 186 $datavars = KTUtil::arrayGet($_REQUEST, 'boolean_search');
170 187 if (!is_array($datavars)) {
171 188 $datavars = unserialize($datavars);
172 189 }
173   -
  190 +
174 191 if (empty($datavars)) {
175 192 $this->errorRedirectToMain(_kt('You need to have at least 1 condition.'));
176 193 }
... ... @@ -179,16 +196,30 @@ class KTConditionDispatcher extends KTAdminDispatcher {
179 196 if (!empty($sName)) {
180 197 $oSearch->setName($sName);
181 198 }
182   -
  199 +
183 200 $oSearch->setSearch($datavars);
184 201 $res = $oSearch->update();
185   -
  202 +
186 203 $this->oValidator->notError($res, array(
187 204 'redirect_to' => 'main',
188 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 221 $this->successRedirectToMain(_kt('Dynamic condition saved'));
191   - }
  222 + }
192 223  
193 224 // XXX: Rename to do_save
194 225 function do_performSearch() {
... ... @@ -196,17 +227,17 @@ class KTConditionDispatcher extends KTAdminDispatcher {
196 227 if (!is_array($datavars)) {
197 228 $datavars = unserialize($datavars);
198 229 }
199   -
  230 +
200 231 if (empty($datavars)) {
201 232 $this->errorRedirectToMain(_kt('You need to have at least 1 condition.'));
202 233 }
203 234  
204 235 $sName = $this->oValidator->validateEntityName(
205   - 'KTSavedSearch',
206   - KTUtil::arrayGet($_REQUEST, 'name'),
  236 + 'KTSavedSearch',
  237 + KTUtil::arrayGet($_REQUEST, 'name'),
207 238 array('extra_condition' => 'is_condition', 'redirect_to' => array('new'))
208 239 );
209   -
  240 +
210 241 $sNamespace = KTUtil::nameToLocalNamespace('Saved searches', $sName);
211 242  
212 243 $oSearch = KTSavedSearch::createFromArray(array(
... ...
resources/js/search2widget.js
... ... @@ -190,9 +190,7 @@ function createSearchBar(div, suffix)
190 190 var el = Ext.get(div);
191 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 195 else
198 196 {
... ...
templates/kt3/standard_page.smarty
... ... @@ -172,7 +172,13 @@
172 172 {/if}
173 173 {if (!$page->hide_section)}
174 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 182 {if ($page->breadcrumbSection !== false)}
177 183 {if ($page->breadcrumbSection.url) }
178 184 <a href="{$page->breadcrumbSection.url}" class="primary">{$page->breadcrumbSection.label|sanitize}</a>
... ... @@ -183,10 +189,11 @@
183 189 {if (($page->breadcrumbSection !== false) && ($page->breadcrumbs !== false))}
184 190 &raquo;
185 191 {/if}
  192 +
186 193 {if ($page->breadcrumbs !== false)}
187 194 {foreach item=aCrumb from=$page->breadcrumbs name=bc}
188 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 197 {else}
191 198 <span>{$aCrumb.label|mb_truncate:40:"...":true|sanitize}</span>
192 199 {/if}
... ... @@ -198,7 +205,12 @@
198 205 {if ($page->breadcrumbDetails !== false)}
199 206 <span class="additional">({$page->breadcrumbDetails|sanitize})</span>
200 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 214 </div>
203 215 {/if}
204 216 </div>
... ...