Commit f0575be53d8a90b4739936b2274202434baf2994

Authored by Brad Shuttleworth
1 parent 80f4428e

- improve the way that browse_modes are reported and detected.

- add better checking to prevent users from getting a blank screen on lookups.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4885 c91229c3-7414-0410-bfa2-8a42b809f60b
browse.php
... ... @@ -114,6 +114,8 @@ class BrowseDispatcher extends KTStandardDispatcher {
114 114 $folder_id = 1;
115 115 }
116 116  
  117 + $_REQUEST['fBrowseMode'] = 'folder';
  118 +
117 119 // here we need the folder object to do the breadcrumbs.
118 120 $oFolder =& Folder::get($folder_id);
119 121  
... ... @@ -230,6 +232,13 @@ class BrowseDispatcher extends KTStandardDispatcher {
230 232 function do_selectField() {
231 233 $aFields = DocumentField::getList('has_lookup = 1');
232 234  
  235 + if (empty($aFields)) {
  236 + $this->errorRedirectToMain('No lookup fields available.');
  237 + exit(0);
  238 + }
  239 +
  240 + $_REQUEST['fBrowseMode'] = 'lookup_value';
  241 +
233 242 $oTemplating = new KTTemplating;
234 243 $oTemplate = $oTemplating->loadTemplate("kt3/browse_lookup_selection");
235 244 $aTemplateData = array(
... ... @@ -247,6 +256,8 @@ class BrowseDispatcher extends KTStandardDispatcher {
247 256 exit(0);
248 257 }
249 258  
  259 + $_REQUEST['fBrowseMode'] = 'lookup_value';
  260 +
250 261 $aValues = MetaData::getByDocumentField($oField);
251 262  
252 263 $oTemplating = new KTTemplating;
... ... @@ -263,6 +274,8 @@ class BrowseDispatcher extends KTStandardDispatcher {
263 274 $aTypes = DocumentType::getList();
264 275 // FIXME what is the error message?
265 276  
  277 + $_REQUEST['fBrowseMode'] = 'document_type';
  278 +
266 279 if (empty($aTypes)) {
267 280 $this->errorRedirectToMain('No document types available.');
268 281 exit(0);
... ... @@ -559,7 +572,6 @@ class BrowseDispatcher extends KTStandardDispatcher {
559 572 $this->successRedirectToMain(_('Move completed.'), sprintf('fFolderId=%d', $target_folder));
560 573 }
561 574  
562   -
563 575 function do_startDelete() {
564 576 $this->oPage->setTitle('Delete Files and Folders');
565 577 $this->oPage->setBreadcrumbDetails('Delete Files and Folders');
... ...
plugins/ktcore/KTPortlets.php
... ... @@ -43,7 +43,7 @@ class KTBrowseModePortlet extends KTPortlet {
43 43  
44 44 function render() {
45 45 // this is unfortunate, but such is life.
46   - $current_action = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', 'folder');
  46 + $current_action = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', null);
47 47 $modes = array(
48 48 'folder' => array('name' => _('Folder'), 'target' => "main"),
49 49 'document_type' => array('name' => _('Document Type'), 'target' => 'selectType'),
... ...