Minahito
minah****@users*****
2006年 4月 7日 (金) 17:44:28 JST
Index: xoops2jp/html/modules/base/admin/actions/BlockListAction.class.php diff -u xoops2jp/html/modules/base/admin/actions/BlockListAction.class.php:1.1.2.3 xoops2jp/html/modules/base/admin/actions/BlockListAction.class.php:1.1.2.4 --- xoops2jp/html/modules/base/admin/actions/BlockListAction.class.php:1.1.2.3 Thu Apr 6 15:12:29 2006 +++ xoops2jp/html/modules/base/admin/actions/BlockListAction.class.php Fri Apr 7 17:44:27 2006 @@ -5,9 +5,18 @@ require_once XOOPS_MODULE_PATH . "/base/class/PageNavigator.class.php"; require_once XOOPS_MODULE_PATH . "/base/class/AbstractListAction.class.php"; require_once XOOPS_MODULE_PATH . "/base/admin/forms/BlockFilterForm.class.php"; +require_once XOOPS_MODULE_PATH . "/base/admin/forms/BlockListForm.class.php"; class Legacy_BlockListAction extends Legacy_AbstractListAction { + var $mActionForm = null; + + function prepare(&$controller, &$xoopsUser) + { + $this->mActionForm =& new Legacy_BlockListForm(); + $this->mActionForm->prepare(); + } + function &_getHandler() { $handler =& xoops_getmodulehandler('newblocks'); @@ -25,6 +34,34 @@ return "./index.php?action=BlockList"; } + function execute(&$controller, &$xoopsUser) + { + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if ($this->mActionForm->hasError()) { + return $this->getDefaultView($controller, $xoopsUser); + } + + $weightArr = $this->mActionForm->get('weight'); + + $handler =& xoops_getmodulehandler('newblocks'); + foreach (array_keys($weightArr) as $bid) { + $block =& $handler->get($bid); + if (is_object($block) && $block->get('isactive') == 1 && $block->get('visible') == 1) { + $block->set('weight', $this->mActionForm->get('weight', $bid)); + $block->set('side', $this->mActionForm->get('side', $bid)); + $block->set('bcachetime', $this->mActionForm->get('bcachetime', $bid)); + + if (!$handler->insert($block)) { + return LEGACY_FRAME_VIEW_ERROR; + } + } + } + + return LEGACY_FRAME_VIEW_SUCCESS; + } + function executeViewIndex(&$controller, &$xoopsUser, &$render) { $render->setTemplateName("block_list.html"); @@ -37,6 +74,15 @@ $render->setAttribute("objects", $this->mObjects); $render->setAttribute("pageNavi", $this->mNavi); + + // + // Load cache-time pattern objects and set. + // + $handler =& xoops_gethandler('cachetime'); + $cachetimeArr =& $handler->getObjects(); + $render->setAttribute('cachetimeArr', $cachetimeArr); + + $render->setAttribute('actionForm', $this->mActionForm); } }