Commit 3d411a2abb2dacbd8adeba09a7d2ff9f5c7414e6
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,16 +612,21 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget { | ||
| 612 | 612 | ||
| 613 | function configure($aOptions) { | 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 | $collection = new AdvancedCollection(); | 621 | $collection = new AdvancedCollection(); |
| 617 | $oCR =& KTColumnRegistry::getSingleton(); | 622 | $oCR =& KTColumnRegistry::getSingleton(); |
| 618 | $col = $oCR->getColumn('ktcore.columns.title'); | 623 | $col = $oCR->getColumn('ktcore.columns.title'); |
| 619 | $col->setOptions(array('qs_params'=>array('fMoveCode'=>$sMoveCode, | 624 | $col->setOptions(array('qs_params'=>array('fMoveCode'=>$sMoveCode, |
| 620 | - 'fFolderId'=> KTUtil::arrayGet($aOptions,'folder_id', 1), | 625 | + 'fFolderId'=> $this->value, |
| 621 | 'action'=>'startMove'))); | 626 | 'action'=>'startMove'))); |
| 622 | $collection->addColumn($col); | 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 | $collection->setQueryObject($qObj); | 630 | $collection->setQueryObject($qObj); |
| 626 | 631 | ||
| 627 | $aO = $collection->getEnvironOptions(); | 632 | $aO = $collection->getEnvironOptions(); |
| @@ -632,6 +637,18 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget { | @@ -632,6 +637,18 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget { | ||
| 632 | 637 | ||
| 633 | return parent::configure($aOptions); | 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 | class KTCoreCollectionPage extends KTStandardDispatcher { | 654 | class KTCoreCollectionPage extends KTStandardDispatcher { |