Commit 3d411a2abb2dacbd8adeba09a7d2ff9f5c7414e6

Authored by Brad Shuttleworth
1 parent 0255080c

Document collection widgets should do all the usual things

like holding onto their original values, etc.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5972 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 19 additions and 2 deletions
plugins/ktcore/KTWidgets.php
... ... @@ -612,16 +612,21 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget {
612 612  
613 613 function configure($aOptions) {
614 614  
  615 + if (!isset($aOptions['value'])) {
  616 + $aOptions['value'] = KTUtil::arrayGet($aOptions,'folder_id', 1);
  617 + }
  618 + $this->value = $aOptions['value'];
  619 +
615 620  
616 621 $collection = new AdvancedCollection();
617 622 $oCR =& KTColumnRegistry::getSingleton();
618 623 $col = $oCR->getColumn('ktcore.columns.title');
619 624 $col->setOptions(array('qs_params'=>array('fMoveCode'=>$sMoveCode,
620   - 'fFolderId'=> KTUtil::arrayGet($aOptions,'folder_id', 1),
  625 + 'fFolderId'=> $this->value,
621 626 'action'=>'startMove')));
622 627 $collection->addColumn($col);
623 628  
624   - $qObj = new FolderBrowseQuery(KTUtil::arrayGet($aOptions,'folder_id', 1));
  629 + $qObj = new FolderBrowseQuery(KTUtil::arrayGet($aOptions,'value'));
625 630 $collection->setQueryObject($qObj);
626 631  
627 632 $aO = $collection->getEnvironOptions();
... ... @@ -632,6 +637,18 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget {
632 637  
633 638 return parent::configure($aOptions);
634 639 }
  640 +
  641 + function getDefault() { return $this->value; }
  642 + function setDefault($mValue) {
  643 + if ($mValue != $this->value) {
  644 + $this->oCollection->setQueryObject(new FolderBrowseQuery($mValue));
  645 + $this->value = $mValue;
  646 + $this->aOptions['folder_id'] = $this->value;
  647 + $this->iFolderId = $this->value;
  648 + $this->sCollection = serialize($this->oCollection);
  649 + $_SESSION['collection_widgets'][$this->sCode] = serialize($this);
  650 + }
  651 + }
635 652 }
636 653  
637 654 class KTCoreCollectionPage extends KTStandardDispatcher {
... ...