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