[xoops-cvslog 5363] CVS update: xoops2jp/html/modules/legacy/class

Back to archive index

Minahito minah****@users*****
2006年 10月 16日 (月) 18:55:46 JST


Index: xoops2jp/html/modules/legacy/class/ActionFrame.class.php
diff -u xoops2jp/html/modules/legacy/class/ActionFrame.class.php:1.1.2.3 xoops2jp/html/modules/legacy/class/ActionFrame.class.php:1.1.2.4
--- xoops2jp/html/modules/legacy/class/ActionFrame.class.php:1.1.2.3	Sun Oct 15 02:15:19 2006
+++ xoops2jp/html/modules/legacy/class/ActionFrame.class.php	Mon Oct 16 18:55:45 2006
@@ -36,9 +36,17 @@
 	 */	
 	var $mMode = null;
 
+	/**
+	 * @var XCube_Delegate
+	 */
+	var $mCreateAction = null;
+	
 	function Legacy_ActionFrame($admin)
 	{
 		$this->mAdminFlag = $admin;
+		$this->mCreateAction =& new XCube_Delegate();
+		$this->mCreateAction->register('Legacy_ActionFrame.createAction');
+		$this->mCreateAction->add(array(&$this, '_createAction'));
 	}
 
 	function setActionName($name)
@@ -63,6 +71,35 @@
 		$this->mMode = $mode;
 	}
 
+	function _createAction(&$actionFrame)
+	{
+		if (is_object($this->mAction)) {
+			return;
+		}
+		
+		//
+		// Create action object by mActionName
+		//
+		$className = "Legacy_" . ucfirst($actionFrame->mActionName) . "Action";
+		$fileName = ucfirst($actionFrame->mActionName) . "Action";
+		if ($actionFrame->mAdminFlag) {
+			$fileName = XOOPS_MODULE_PATH . "/legacy/admin/actions/${fileName}.class.php";
+		}
+		else {
+			$fileName = XOOPS_MODULE_PATH . "/legacy/actions/${fileName}.class.php";
+		}
+	
+		if (!file_exists($fileName)) {
+			die();
+		}
+	
+		require_once $fileName;
+	
+		if (class_exists($className)) {
+			$this->mAction =& new $className($actionFrame->mAdminFlag);
+		}
+	}
+	
 	function execute(&$controller)
 	{
 		if (strlen($this->mActionName) > 0 && !preg_match("/^\w+$/", $this->mActionName)) {
@@ -85,27 +122,10 @@
 		//
 		// Create action object by mActionName
 		//
-		$className = "Legacy_" . ucfirst($this->mActionName) . "Action";
-		$fileName = ucfirst($this->mActionName) . "Action";
-		if ($this->mAdminFlag) {
-			$fileName = XOOPS_MODULE_PATH . "/legacy/admin/actions/${fileName}.class.php";
-		}
-		else {
-			$fileName = XOOPS_MODULE_PATH . "/legacy/actions/${fileName}.class.php";
-		}
+		$this->mCreateAction->call(new XCube_Ref($this));
 	
-		if (!file_exists($fileName)) {
-			die();
-		}
-	
-		require_once $fileName;
-	
-		if (class_exists($className)) {
-			$this->mAction =& new $className($this->mAdminFlag);
-		}
-	
-		if (!is_object($this->mAction)) {
-			die();
+		if (!(is_object($this->mAction) && is_a($this->mAction, 'Legacy_Action'))) {
+			die();	//< TODO
 		}
 		
 		$this->mAction->prepare($controller, $controller->mRoot->mContext->mXoopsUser);


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