Commit 525d054b980497e3e2789c19d91f6a132faf98c9

Authored by Kevin Fourie
1 parent 1a4e1c31

KTS-2271

"Apparent typo in browse.php"
Fixed.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7080 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 67 additions and 67 deletions
browse.php
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 * License Version 1.1.2 ("License"); You may not use this file except in 6 * License Version 1.1.2 ("License"); You may not use this file except in
7 * compliance with the License. You may obtain a copy of the License at 7 * compliance with the License. You may obtain a copy of the License at
8 * http://www.knowledgetree.com/KPL 8 * http://www.knowledgetree.com/KPL
9 - * 9 + *
10 * Software distributed under the License is distributed on an "AS IS" 10 * Software distributed under the License is distributed on an "AS IS"
11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
12 * See the License for the specific language governing rights and 12 * See the License for the specific language governing rights and
@@ -17,9 +17,9 @@ @@ -17,9 +17,9 @@
17 * (ii) the KnowledgeTree copyright notice 17 * (ii) the KnowledgeTree copyright notice
18 * in the same form as they appear in the distribution. See the License for 18 * in the same form as they appear in the distribution. See the License for
19 * requirements. 19 * requirements.
20 - * 20 + *
21 * The Original Code is: KnowledgeTree Open Source 21 * The Original Code is: KnowledgeTree Open Source
22 - * 22 + *
23 * The Initial Developer of the Original Code is The Jam Warehouse Software 23 * The Initial Developer of the Original Code is The Jam Warehouse Software
24 * (Pty) Ltd, trading as KnowledgeTree. 24 * (Pty) Ltd, trading as KnowledgeTree.
25 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 25 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -77,18 +77,18 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -77,18 +77,18 @@ class BrowseDispatcher extends KTStandardDispatcher {
77 ); 77 );
78 return parent::KTStandardDispatcher(); 78 return parent::KTStandardDispatcher();
79 } 79 }
80 - 80 +
81 function check() { 81 function check() {
82 - $this->browse_mode = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', 'folder'); 82 + $this->browse_mode = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', 'folder');
83 $action = KTUtil::arrayGet($_REQUEST, $this->event_var, 'main'); 83 $action = KTUtil::arrayGet($_REQUEST, $this->event_var, 'main');
84 $this->editable = false; 84 $this->editable = false;
85 -  
86 - 85 +
  86 +
87 // catch the alternative actions. 87 // catch the alternative actions.
88 if ($action != 'main') { 88 if ($action != 'main') {
89 return true; 89 return true;
90 - }  
91 - 90 + }
  91 +
92 // if we're going to main ... 92 // if we're going to main ...
93 93
94 // folder browse mode 94 // folder browse mode
@@ -108,9 +108,9 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -108,9 +108,9 @@ class BrowseDispatcher extends KTStandardDispatcher {
108 if ($folder_id == 0) { 108 if ($folder_id == 0) {
109 $folder_id = 1; 109 $folder_id = 1;
110 } 110 }
111 - 111 +
112 $_REQUEST['fBrowseMode'] = 'folder'; 112 $_REQUEST['fBrowseMode'] = 'folder';
113 - 113 +
114 // here we need the folder object to do the breadcrumbs. 114 // here we need the folder object to do the breadcrumbs.
115 $oFolder =& Folder::get($folder_id); 115 $oFolder =& Folder::get($folder_id);
116 if (PEAR::isError($oFolder)) { 116 if (PEAR::isError($oFolder)) {
@@ -124,10 +124,10 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -124,10 +124,10 @@ class BrowseDispatcher extends KTStandardDispatcher {
124 } else { 124 } else {
125 $this->editable = false; 125 $this->editable = false;
126 } 126 }
127 - 127 +
128 // set the title and breadcrumbs... 128 // set the title and breadcrumbs...
129 $this->oPage->setTitle(_kt('Browse')); 129 $this->oPage->setTitle(_kt('Browse'));
130 - 130 +
131 if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $oFolder)) { 131 if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $oFolder)) {
132 $this->oPage->setSecondaryTitle($oFolder->getName()); 132 $this->oPage->setSecondaryTitle($oFolder->getName());
133 } else { 133 } else {
@@ -137,7 +137,7 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -137,7 +137,7 @@ class BrowseDispatcher extends KTStandardDispatcher {
137 $this->oPage->setSecondaryTitle('...'); 137 $this->oPage->setSecondaryTitle('...');
138 } 138 }
139 } 139 }
140 - 140 +
141 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oFolder)); 141 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oFolder));
142 $this->oFolder =& $oFolder; 142 $this->oFolder =& $oFolder;
143 143
@@ -148,20 +148,20 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -148,20 +148,20 @@ class BrowseDispatcher extends KTStandardDispatcher {
148 ); 148 );
149 $this->oQuery = new BrowseQuery($oFolder->getId(), $this->oUser, $aOptions); 149 $this->oQuery = new BrowseQuery($oFolder->getId(), $this->oUser, $aOptions);
150 $this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fFolderId=%d', $oFolder->getId())); 150 $this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fFolderId=%d', $oFolder->getId()));
151 - 151 +
152 // and the portlets 152 // and the portlets
153 $portlet = new KTActionPortlet(sprintf(_kt('About this folder'))); 153 $portlet = new KTActionPortlet(sprintf(_kt('About this folder')));
154 - $aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser); 154 + $aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser);
155 $portlet->setActions($aActions,$this->sName); 155 $portlet->setActions($aActions,$this->sName);
156 - $this->oPage->addPortlet($portlet);  
157 - 156 + $this->oPage->addPortlet($portlet);
  157 +
158 $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder'))); 158 $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder')));
159 - $aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser); 159 + $aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser);
160 $portlet->setActions($aActions,null); 160 $portlet->setActions($aActions,null);
161 $this->oPage->addPortlet($portlet); 161 $this->oPage->addPortlet($portlet);
162 162
163 163
164 - 164 +
165 } else if ($this->browse_mode == 'lookup_value') { 165 } else if ($this->browse_mode == 'lookup_value') {
166 // browsing by a lookup value 166 // browsing by a lookup value
167 167
@@ -172,28 +172,28 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -172,28 +172,28 @@ class BrowseDispatcher extends KTStandardDispatcher {
172 $oField = DocumentField::get($field); 172 $oField = DocumentField::get($field);
173 if (PEAR::isError($oField) || ($oField == false)) { 173 if (PEAR::isError($oField) || ($oField == false)) {
174 $this->errorRedirectToMain('No Field selected.'); 174 $this->errorRedirectToMain('No Field selected.');
175 - exit(0); 175 + exit(0);
176 } 176 }
177 $value = KTUtil::arrayGet($_REQUEST, 'fValue', null); 177 $value = KTUtil::arrayGet($_REQUEST, 'fValue', null);
178 $oValue = MetaData::get($value); 178 $oValue = MetaData::get($value);
179 if (PEAR::isError($oValue) || ($oValue == false)) { 179 if (PEAR::isError($oValue) || ($oValue == false)) {
180 $this->errorRedirectToMain('No Value selected.'); 180 $this->errorRedirectToMain('No Value selected.');
181 - exit(0); 181 + exit(0);
182 } 182 }
183 183
184 184
185 $this->oQuery = new ValueBrowseQuery($oField, $oValue); 185 $this->oQuery = new ValueBrowseQuery($oField, $oValue);
186 - $this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], 186 + $this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'],
187 sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value)); 187 sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value));
188 188
189 // setup breadcrumbs 189 // setup breadcrumbs
190 - $this->aBreadcrumbs = 190 + $this->aBreadcrumbs =
191 array( 191 array(
192 - array('name' => _kt('Lookup Values'), 192 + array('name' => _kt('Lookup Values'),
193 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectField')), 193 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectField')),
194 - array('name' => $oField->getName(), 194 + array('name' => $oField->getName(),
195 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectLookup&fField=' . $oField->getId())), 195 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectLookup&fField=' . $oField->getId())),
196 - array('name' => $oValue->getName(), 196 + array('name' => $oValue->getName(),
197 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value)))); 197 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value))));
198 198
199 199
@@ -209,13 +209,13 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -209,13 +209,13 @@ class BrowseDispatcher extends KTStandardDispatcher {
209 $this->errorRedirectToMain('No Document Type selected.'); 209 $this->errorRedirectToMain('No Document Type selected.');
210 exit(0); 210 exit(0);
211 } 211 }
212 - 212 +
213 $this->oQuery = new TypeBrowseQuery($oDocType); 213 $this->oQuery = new TypeBrowseQuery($oDocType);
214 - 214 +
215 // FIXME probably want to redirect to self + action=selectType 215 // FIXME probably want to redirect to self + action=selectType
216 - $this->aBreadcrumbs[] = array('name' => _kt('Document Types'), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectType'));  
217 - $this->aBreadcrumbs[] = array('name' => $oDocType->getName(), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'fBrowseMode=document_type&fType=' . $oDocType->getId()));  
218 - 216 + $this->aBreadcrumbs[] = array('name' => _kt('Document Types'), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectType'));
  217 + $this->aBreadcrumbs[] = array('name' => $oDocType->getName(), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'fBrowseMode=document_type&fType=' . $oDocType->getId()));
  218 +
219 $this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fType=%s&fBrowseMode=document_type', $doctype));; 219 $this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fType=%s&fBrowseMode=document_type', $doctype));;
220 220
221 221
@@ -230,15 +230,15 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -230,15 +230,15 @@ class BrowseDispatcher extends KTStandardDispatcher {
230 function do_main() { 230 function do_main() {
231 $oColumnRegistry =& KTColumnRegistry::getSingleton(); 231 $oColumnRegistry =& KTColumnRegistry::getSingleton();
232 232
233 - $collection = new AdvancedCollection;  
234 - $collection->addColumns($oColumnRegistry->getColumnsForView('ktcore.views.browse'));  
235 -  
236 - $aOptions = $collection->getEnvironOptions(); // extract data from the environment  
237 - $aOptions['result_url'] = $this->resultURL; 233 + $collection = new AdvancedCollection;
  234 + $collection->addColumns($oColumnRegistry->getColumnsForView('ktcore.views.browse'));
  235 +
  236 + $aOptions = $collection->getEnvironOptions(); // extract data from the environment
  237 + $aOptions['result_url'] = $this->resultURL;
238 $aOptions['is_browse'] = true; 238 $aOptions['is_browse'] = true;
239 - 239 +
240 $collection->setOptions($aOptions); 240 $collection->setOptions($aOptions);
241 - $collection->setQueryObject($this->oQuery); 241 + $collection->setQueryObject($this->oQuery);
242 $collection->setColumnOptions('ktcore.columns.selection', array( 242 $collection->setColumnOptions('ktcore.columns.selection', array(
243 'rangename' => 'selection', 243 'rangename' => 'selection',
244 'show_folders' => true, 244 'show_folders' => true,
@@ -260,23 +260,23 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -260,23 +260,23 @@ class BrowseDispatcher extends KTStandardDispatcher {
260 'returnaction' => 'browse', 260 'returnaction' => 'browse',
261 ); 261 );
262 if ($this->oFolder) { 262 if ($this->oFolder) {
263 - $aTemplateDate['returndata'] = $this->oFolder->getId(); 263 + $aTemplateData['returndata'] = $this->oFolder->getId();
264 } 264 }
265 return $oTemplate->render($aTemplateData); 265 return $oTemplate->render($aTemplateData);
266 - }  
267 - 266 + }
  267 +
268 268
269 269
270 function do_selectField() { 270 function do_selectField() {
271 $aFields = DocumentField::getList('has_lookup = 1'); 271 $aFields = DocumentField::getList('has_lookup = 1');
272 - 272 +
273 if (empty($aFields)) { 273 if (empty($aFields)) {
274 $this->errorRedirectToMain(_kt('No lookup fields available.')); 274 $this->errorRedirectToMain(_kt('No lookup fields available.'));
275 exit(0); 275 exit(0);
276 - }  
277 - 276 + }
  277 +
278 $_REQUEST['fBrowseMode'] = 'lookup_value'; 278 $_REQUEST['fBrowseMode'] = 'lookup_value';
279 - 279 +
280 $oTemplating =& KTTemplating::getSingleton(); 280 $oTemplating =& KTTemplating::getSingleton();
281 $oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_selection'); 281 $oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_selection');
282 $aTemplateData = array( 282 $aTemplateData = array(
@@ -285,19 +285,19 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -285,19 +285,19 @@ class BrowseDispatcher extends KTStandardDispatcher {
285 ); 285 );
286 return $oTemplate->render($aTemplateData); 286 return $oTemplate->render($aTemplateData);
287 } 287 }
288 - 288 +
289 function do_selectLookup() { 289 function do_selectLookup() {
290 $field = KTUtil::arrayGet($_REQUEST, 'fField', null); 290 $field = KTUtil::arrayGet($_REQUEST, 'fField', null);
291 $oField = DocumentField::get($field); 291 $oField = DocumentField::get($field);
292 if (PEAR::isError($oField) || ($oField == false) || (!$oField->getHasLookup())) { 292 if (PEAR::isError($oField) || ($oField == false) || (!$oField->getHasLookup())) {
293 $this->errorRedirectToMain('No Field selected.'); 293 $this->errorRedirectToMain('No Field selected.');
294 - exit(0); 294 + exit(0);
295 } 295 }
296 -  
297 - $_REQUEST['fBrowseMode'] = 'lookup_value';  
298 - 296 +
  297 + $_REQUEST['fBrowseMode'] = 'lookup_value';
  298 +
299 $aValues = MetaData::getByDocumentField($oField); 299 $aValues = MetaData::getByDocumentField($oField);
300 - 300 +
301 $oTemplating =& KTTemplating::getSingleton(); 301 $oTemplating =& KTTemplating::getSingleton();
302 $oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_value'); 302 $oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_value');
303 $aTemplateData = array( 303 $aTemplateData = array(
@@ -306,19 +306,19 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -306,19 +306,19 @@ class BrowseDispatcher extends KTStandardDispatcher {
306 'values' => $aValues, 306 'values' => $aValues,
307 ); 307 );
308 return $oTemplate->render($aTemplateData); 308 return $oTemplate->render($aTemplateData);
309 - }  
310 - 309 + }
  310 +
311 function do_selectType() { 311 function do_selectType() {
312 $aTypes = DocumentType::getList(); 312 $aTypes = DocumentType::getList();
313 // FIXME what is the error message? 313 // FIXME what is the error message?
314 - 314 +
315 $_REQUEST['fBrowseMode'] = 'document_type'; 315 $_REQUEST['fBrowseMode'] = 'document_type';
316 - 316 +
317 if (empty($aTypes)) { 317 if (empty($aTypes)) {
318 $this->errorRedirectToMain('No document types available.'); 318 $this->errorRedirectToMain('No document types available.');
319 exit(0); 319 exit(0);
320 - }  
321 - 320 + }
  321 +
322 $oTemplating =& KTTemplating::getSingleton(); 322 $oTemplating =& KTTemplating::getSingleton();
323 $oTemplate = $oTemplating->loadTemplate('kt3/browse_types'); 323 $oTemplate = $oTemplating->loadTemplate('kt3/browse_types');
324 $aTemplateData = array( 324 $aTemplateData = array(
@@ -327,7 +327,7 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -327,7 +327,7 @@ class BrowseDispatcher extends KTStandardDispatcher {
327 ); 327 );
328 return $oTemplate->render($aTemplateData); 328 return $oTemplate->render($aTemplateData);
329 } 329 }
330 - 330 +
331 function do_enableAdminMode() { 331 function do_enableAdminMode() {
332 $iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); 332 $iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
333 $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId'); 333 $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId');
@@ -342,7 +342,7 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -342,7 +342,7 @@ class BrowseDispatcher extends KTStandardDispatcher {
342 if (!Permission::userIsSystemAdministrator() && !Permission::isUnitAdministratorForFolder($this->oUser, $iFolderId)) { 342 if (!Permission::userIsSystemAdministrator() && !Permission::isUnitAdministratorForFolder($this->oUser, $iFolderId)) {
343 $this->errorRedirectToMain(_kt('You are not an administrator')); 343 $this->errorRedirectToMain(_kt('You are not an administrator'));
344 } 344 }
345 - 345 +
346 // log this entry 346 // log this entry
347 $oLogEntry =& KTUserHistory::createFromArray(array( 347 $oLogEntry =& KTUserHistory::createFromArray(array(
348 'userid' => $this->oUser->getId(), 348 'userid' => $this->oUser->getId(),
@@ -350,17 +350,17 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -350,17 +350,17 @@ class BrowseDispatcher extends KTStandardDispatcher {
350 'actionnamespace' => 'ktcore.user_history.enable_admin_mode', 350 'actionnamespace' => 'ktcore.user_history.enable_admin_mode',
351 'comments' => 'Admin Mode enabled', 351 'comments' => 'Admin Mode enabled',
352 'sessionid' => $_SESSION['sessionID'], 352 'sessionid' => $_SESSION['sessionID'],
353 - )); 353 + ));
354 $aOpts = array( 354 $aOpts = array(
355 'redirect_to' => 'main', 355 'redirect_to' => 'main',
356 'message' => _kt('Unable to log admin mode entry. Not activating admin mode.'), 356 'message' => _kt('Unable to log admin mode entry. Not activating admin mode.'),
357 ); 357 );
358 $this->oValidator->notError($oLogEntry, $aOpts); 358 $this->oValidator->notError($oLogEntry, $aOpts);
359 - 359 +
360 $_SESSION['adminmode'] = true; 360 $_SESSION['adminmode'] = true;
361 -  
362 -  
363 - 361 +
  362 +
  363 +
364 if ($_REQUEST['fDocumentId']) { 364 if ($_REQUEST['fDocumentId']) {
365 $_SESSION['KTInfoMessage'][] = _kt('Administrator mode enabled'); 365 $_SESSION['KTInfoMessage'][] = _kt('Administrator mode enabled');
366 redirect(KTBrowseUtil::getUrlForDocument($iDocumentId)); 366 redirect(KTBrowseUtil::getUrlForDocument($iDocumentId));
@@ -394,12 +394,12 @@ class BrowseDispatcher extends KTStandardDispatcher { @@ -394,12 +394,12 @@ class BrowseDispatcher extends KTStandardDispatcher {
394 'actionnamespace' => 'ktcore.user_history.disable_admin_mode', 394 'actionnamespace' => 'ktcore.user_history.disable_admin_mode',
395 'comments' => 'Admin Mode disabled', 395 'comments' => 'Admin Mode disabled',
396 'sessionid' => $_SESSION['sessionID'], 396 'sessionid' => $_SESSION['sessionID'],
397 - )); 397 + ));
398 $aOpts = array( 398 $aOpts = array(
399 'redirect_to' => 'main', 399 'redirect_to' => 'main',
400 'message' => _kt('Unable to log admin mode exit. Not de-activating admin mode.'), 400 'message' => _kt('Unable to log admin mode exit. Not de-activating admin mode.'),
401 ); 401 );
402 - $this->oValidator->notError($oLogEntry, $aOpts); 402 + $this->oValidator->notError($oLogEntry, $aOpts);
403 403
404 $_SESSION['adminmode'] = false; 404 $_SESSION['adminmode'] = false;
405 if ($_REQUEST['fDocumentId']) { 405 if ($_REQUEST['fDocumentId']) {