From 3d411a2abb2dacbd8adeba09a7d2ff9f5c7414e6 Mon Sep 17 00:00:00 2001 From: Brad Shuttleworth Date: Fri, 15 Sep 2006 11:44:57 +0000 Subject: [PATCH] Document collection widgets should do all the usual things like holding onto their original values, etc. --- plugins/ktcore/KTWidgets.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/ktcore/KTWidgets.php b/plugins/ktcore/KTWidgets.php index 2f1a6b9..73b7745 100644 --- a/plugins/ktcore/KTWidgets.php +++ b/plugins/ktcore/KTWidgets.php @@ -612,16 +612,21 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget { function configure($aOptions) { + if (!isset($aOptions['value'])) { + $aOptions['value'] = KTUtil::arrayGet($aOptions,'folder_id', 1); + } + $this->value = $aOptions['value']; + $collection = new AdvancedCollection(); $oCR =& KTColumnRegistry::getSingleton(); $col = $oCR->getColumn('ktcore.columns.title'); $col->setOptions(array('qs_params'=>array('fMoveCode'=>$sMoveCode, - 'fFolderId'=> KTUtil::arrayGet($aOptions,'folder_id', 1), + 'fFolderId'=> $this->value, 'action'=>'startMove'))); $collection->addColumn($col); - $qObj = new FolderBrowseQuery(KTUtil::arrayGet($aOptions,'folder_id', 1)); + $qObj = new FolderBrowseQuery(KTUtil::arrayGet($aOptions,'value')); $collection->setQueryObject($qObj); $aO = $collection->getEnvironOptions(); @@ -632,6 +637,18 @@ class KTCoreFolderCollectionWidget extends KTCoreCollectionWidget { return parent::configure($aOptions); } + + function getDefault() { return $this->value; } + function setDefault($mValue) { + if ($mValue != $this->value) { + $this->oCollection->setQueryObject(new FolderBrowseQuery($mValue)); + $this->value = $mValue; + $this->aOptions['folder_id'] = $this->value; + $this->iFolderId = $this->value; + $this->sCollection = serialize($this->oCollection); + $_SESSION['collection_widgets'][$this->sCode] = serialize($this); + } + } } class KTCoreCollectionPage extends KTStandardDispatcher { -- libgit2 0.21.4