Minahito
minah****@users*****
2006年 8月 21日 (月) 19:01:35 JST
Index: xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php diff -u xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.70 xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.71 --- xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.70 Sun Aug 20 12:08:28 2006 +++ xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php Mon Aug 21 19:01:35 2006 @@ -1,7 +1,7 @@ <?php /** * @package Legacy - * @version $Id: Legacy_Controller.class.php,v 1.1.2.70 2006/08/20 03:08:28 nobunobu Exp $ + * @version $Id: Legacy_Controller.class.php,v 1.1.2.71 2006/08/21 10:01:35 minahito Exp $ */ if (!defined('XOOPS_ROOT_PATH')) exit(); @@ -213,24 +213,7 @@ */ function _setupFilterChain() { - $primaryPreloads = $this->mRoot->getSiteConfig('Legacy.PrimaryPreloads'); - foreach ($primaryPreloads as $className => $classPath) { - if (file_exists(XOOPS_ROOT_PATH . $classPath)) { - require_once XOOPS_ROOT_PATH . $classPath; - if (class_exists($className)) { - $filter =& new $className($this); - $this->addActionFilter($filter); - unset($filter); - } - } - } - - // - // Auto pre-loading. - // - if($this->mRoot->getSiteConfig('Legacy', 'AutoPreload')==1) { - $this->_executePreload(XOOPS_ROOT_PATH . "/preload"); - } + $this->_mStrategy->_setupFilterChain(); } function _setupBlock() @@ -546,6 +529,12 @@ function _processPreBlockFilter() { + $this->_mStrategy->_processPreBlockFilter(); + parent::_processPreBlockFilter(); + } + + function _executeModulePreload($dirname) + { // // Auto pre-loading for Module. // @@ -554,7 +543,7 @@ $moduleObjects =& $moduleHandler->getObjects(); foreach ($moduleObjects as $moduleObject) { $mod_dir = $moduleObject->getVar('dirname'); - $dir = XOOPS_ROOT_PATH . '/modules/' . $mod_dir . '/preload/'; + $dir = XOOPS_ROOT_PATH . '/modules/' . $mod_dir . $dirname . '/'; if(is_dir($dir)) { $files = glob($dir.'*.class.php'); if (is_array($files)) { @@ -573,8 +562,7 @@ } } } - parent::_processPreBlockFilter(); - } + } function _setupSession() { @@ -1071,6 +1059,27 @@ { $this->mController =& $controller; } + + function _setupFilterChain() + { $primaryPreloads = $this->mController->mRoot->getSiteConfig('Legacy.PrimaryPreloads'); + foreach ($primaryPreloads as $className => $classPath) { + if (file_exists(XOOPS_ROOT_PATH . $classPath)) { + require_once XOOPS_ROOT_PATH . $classPath; + if (class_exists($className)) { + $filter =& new $className($this->mController); + $this->mController->addActionFilter($filter); + unset($filter); + } + } + } + + // + // Auto pre-loading. + // + if($this->mController->mRoot->getSiteConfig('Legacy', 'AutoPreload') == 1) { + $this->mController->_executePreload(XOOPS_ROOT_PATH . "/preload"); + } + } /** * Create a instance of ModuleController, and set it to mModuleController @@ -1085,6 +1094,11 @@ function setupBlock() { } + + function _processPreBlockFilter() + { + $this->mController->_executeModulePreload('/preload'); + } /** * @return XoopsModule @@ -1167,6 +1181,12 @@ var $mStatusFlag = LEGACY_CONTROLLER_STATE_ADMIN; /** + * @var XCube_Delegate + * @param XCube_Controller &$controller + */ + var $mSetupBlock = null; + + /** * If this array includes current action, getVirtualCurrentModule() returns * the module object that specified by dirname. * @@ -1184,8 +1204,23 @@ if (!defined("LEGACY_DEPENDENCE_RENDERER")) { define("LEGACY_DEPENDENCE_RENDERER", "Legacy_AdminRenderSystem"); } + + $this->mSetupBlock =& new XCube_Delegate(); + $this->mSetupBlock->register('Legacy_AdminControllerStrategy.SetupBlock'); } + function _setupFilterChain() + { + parent::_setupFilterChain(); + + // + // Auto pre-loading. + // + if($this->mController->mRoot->getSiteConfig('Legacy', 'AutoPreload') == 1) { + $this->mController->_executePreload(XOOPS_ROOT_PATH . "/preload/admin"); + } + } + function setupModuleController() { require_once XOOPS_BASE_PATH . "/kernel/Legacy_AdminModuleController.class.php"; @@ -1198,6 +1233,14 @@ require_once XOOPS_BASE_PATH . "/admin/blocks/AdminSideMenu.class.php"; $this->mController->mBlockChain[] =& new Legacy_AdminActionSearch(); $this->mController->mBlockChain[] =& new Legacy_AdminSideMenu(); + + $this->mSetupBlock->call(new XCube_Ref($this->mController)); + } + + function _processPreBlockFilter() + { + parent::_processPreBlockFilter(); + $this->mController->_executeModulePreload('/admin/preload/'); } function &getVirtualCurrentModule()