[xoops-cvslog 2357] CVS update: xoops2jp/html/modules/base/kernel

Back to archive index

Minahito minah****@users*****
2006年 2月 21日 (火) 20:52:21 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.23 xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.24
--- xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.23	Mon Feb  6 00:56:36 2006
+++ xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php	Tue Feb 21 20:52:21 2006
@@ -651,6 +651,18 @@
 	{
 		return $this->mDialogMode;
 	}
+	
+	/**
+	 *  Return current module object. But, it's decided by the rules of the state.
+	 *  Preferences page, Help page and some pages returns the specified module by
+	 * dirname. It's useful for controlling a theme. 
+	 * 
+	 * @return XoopsModule
+	 */
+	function &getVirtualCurrentModule()
+	{
+		return $this->_mControllerState->getVirtualCurrentModule($this);
+	}
 }
 
 /**
@@ -671,6 +683,16 @@
 	function setupBlock(&$controller)
 	{
 	}
+
+	/**
+	 * @return XoopsModule
+	 * @see Legacy_Controller::getVirtualCurrentModule()
+	 */	
+	function &getVirtualCurrentModule(&$controller)
+	{
+		$ret = null;
+		return $ret;
+	}
 }
 
 class BaseControllerPublicState extends BaseControllerState
@@ -729,6 +751,14 @@
 class BaseControllerAdminState extends BaseControllerState
 {
 	var $mStatusFlag=LEGACY_CONTROLLER_STATE_ADMIN;
+	
+	/**
+	 *  If this array includes current action, getVirtualCurrentModule() returns
+	 * the module object that specified by dirname.
+	 * 
+	 * @access private
+	 */
+	var $_mSpecialActions = array("Help", "CommentList");
 
 	function BaseControllerAdminState()
 	{
@@ -753,8 +783,7 @@
 		// Controller or Root should have factory-method so that we create a 
 		// instance by a site config.
 		//
-		require_once XOOPS_BASE_PATH."/class/Legacy_AdminRenderSystem.class.php";
-		$controller->mRenderSystem=new Legacy_AdminRenderSystem($controller);
+		$renderSystem =& $this->mRoot->getRenderSystem("Legacy_AdminRenderSystem");
 		$controller->mRenderSystem->prepare();
 	}
 	
@@ -762,37 +791,28 @@
 	{
 		require_once XOOPS_BASE_PATH."/admin/blocks/AdminActionSearch.class.php";
 		require_once XOOPS_BASE_PATH."/admin/blocks/AdminSideMenu.class.php";
-		$controller->mBlockChain[]=new Legacy_AdminActionSearch();
-		$controller->mBlockChain[]=new Legacy_AdminSideMenu();
+		$controller->mBlockChain[] =& new Legacy_AdminActionSearch();
+		$controller->mBlockChain[] =& new Legacy_AdminSideMenu();
 	}
-}
-
 
-/**
- * TEST
- */
-class XCube_AdminBlockProcedure extends XCube_BlockProcedure
-{
-	function getTitle()
+	function &getVirtualCurrentModule(&$controller)
 	{
-		return "TEST BLOCK!";
-	}
-
-	function enableCached()
-	{
-		return false;
-	}
-
-	function hasResult()
-	{
-		return true;
-	}
+		$module = null;
+		
+		if ($controller->mModuleController->isModuleProcess()) {
+			$module =& $controller->mModuleController->getXoopsModule();
+			
+			if ($module->get('dirname') == "base" && isset($_REQUEST['dirname'])) {
+				if (in_array(xoops_getrequest('action'), $this->_mSpecialActions)) {
+					$handler =& xoops_gethandler('module');
+					$module =& $handler->getByDirname(xoops_getrequest('dirname'));
+				}
+			}
+		}
 
-	function &getResult()
-	{
-		$ret['comment']="hello,world!";
-		return $ret;
+		return $module;
 	}
 }
 
+
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index