[xoops-cvslog 1741] CVS update: xoops2jp/html/modules/legacyRender/admin/actions

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 1月 14日 (土) 17:03:50 JST


Index: xoops2jp/html/modules/legacyRender/admin/actions/TplsetEditAction.class.php
diff -u xoops2jp/html/modules/legacyRender/admin/actions/TplsetEditAction.class.php:1.1.2.1 xoops2jp/html/modules/legacyRender/admin/actions/TplsetEditAction.class.php:1.1.2.2
--- xoops2jp/html/modules/legacyRender/admin/actions/TplsetEditAction.class.php:1.1.2.1	Sat Jan 14 02:29:01 2006
+++ xoops2jp/html/modules/legacyRender/admin/actions/TplsetEditAction.class.php	Sat Jan 14 17:03:50 2006
@@ -1,74 +1,28 @@
 <?php
 
+require_once XOOPS_MODULE_PATH . "/legacyRender/admin/class/AbstractEditAction.class.php";
 require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplsetEditForm.class.php";
 
-class LegacyRender_TplsetEditAction extends LegacyRender_Action
+class LegacyRender_TplsetEditAction extends LegacyRender_AbstractEditAction
 {
-	var $mObject = null;
-	var $mObjectHandler = null;
-	var $mActionForm=null;
-	
-	function getDefaultView(&$controller,&$xoopsUser)
+	function _getId()
 	{
-		$this->_setupActionForm();
-		$this->_setupObject($controller);
-		
-		if ($this->mObject == null) {
-			return LEGACYRENDER_FRAME_VIEW_ERROR;
-		}
-
-		$this->mActionForm->load($this->mObject);
-
-		return LEGACYRENDER_FRAME_VIEW_INPUT;
+		return isset($_REQUEST['tplset_id']) ? intval($_REQUEST['tplset_id']) : 0;
 	}
-	
-	function execute(&$controller,&$xoopsUser)
-	{
-		$this->_setupActionForm();
-		$this->_setupObject($controller);
-
-		if ($this->mObject == null) {
-			return LEGACYRENDER_FRAME_VIEW_ERROR;
-		}
 
-		//
-		// If image is no, the data has to continue to keep his value.
-		//
-		$this->mActionForm->load($this->mObject);
-
-		$this->mActionForm->fetch();
-		$this->mActionForm->validate();
-
-		if($this->mActionForm->hasError())
-			return LEGACYRENDER_FRAME_VIEW_INPUT;
-			
-		$this->mActionForm->update($this->mObject);
-
-		return $this->mObjectHandler->insert($this->mObject) ? LEGACYRENDER_FRAME_VIEW_SUCCESS
-		                                                     : LEGACYRENDER_FRAME_VIEW_ERROR;
-	}
-
-	function _setupObject(&$controller)
-	{
-		$id = $this->_getId();
-		
-		$this->mObjectHandler = $this->_getHandler();
-		
-		$this->mObject =& $this->mObjectHandler->get($id);
-		if (is_object($this->mObject) && $this->mObject->get('tplset_name') == 'default') {
-			$this->mObject = null;
-		}
-	}
-	
 	function &_getHandler()
 	{
 		$handler = xoops_getmodulehandler('tplset');
 		return $handler;
 	}
-	
-	function _getId()
+
+	function _setupObject()
 	{
-		return isset($_REQUEST['tplset_id']) ? intval($_REQUEST['tplset_id']) : 0;
+		parent::_setupObject();
+
+		if (is_object($this->mObject) && $this->mObject->get('tplset_name') == 'default') {
+			$this->mObject = null;
+		}
 	}
 	
 	function _setupActionForm()
@@ -77,6 +31,11 @@
 		$this->mActionForm->prepare();
 	}
 
+	function isEnableCreate()
+	{
+		return false;
+	}
+
 	function executeViewInput(&$controller, &$xoopsUser, &$render)
 	{
 		$render->setTemplateName("tplset_edit.html");
Index: xoops2jp/html/modules/legacyRender/admin/actions/TplfileEditAction.class.php
diff -u xoops2jp/html/modules/legacyRender/admin/actions/TplfileEditAction.class.php:1.1.2.1 xoops2jp/html/modules/legacyRender/admin/actions/TplfileEditAction.class.php:1.1.2.2
--- xoops2jp/html/modules/legacyRender/admin/actions/TplfileEditAction.class.php:1.1.2.1	Sat Jan 14 02:29:01 2006
+++ xoops2jp/html/modules/legacyRender/admin/actions/TplfileEditAction.class.php	Sat Jan 14 17:03:50 2006
@@ -1,66 +1,13 @@
 <?php
 
 require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplfileEditForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacyRender/admin/class/AbstractEditAction.class.php";
 
-class LegacyRender_TplfileEditAction extends LegacyRender_Action
+class LegacyRender_TplfileEditAction extends LegacyRender_AbstractEditAction
 {
-	var $mObject = null;
-	var $mObjectHandler = null;
-	var $mActionForm=null;
-	
-	function getDefaultView(&$controller,&$xoopsUser)
-	{
-		$this->_setupActionForm();
-		$this->_setupObject($controller);
-		
-		if ($this->mObject == null)
-			return LEGACYRENDER_FRAME_VIEW_ERROR;
-
-		$this->mActionForm->load($this->mObject);
-
-		return LEGACYRENDER_FRAME_VIEW_INPUT;
-	}
-	
-	function execute(&$controller,&$xoopsUser)
-	{
-		$this->_setupActionForm();
-		$this->_setupObject($controller);
-
-		if ($this->mObject == null)
-			return LEGACYRENDER_FRAME_VIEW_ERROR;
-
-		//
-		// If image is no, the data has to continue to keep his value.
-		//
-		$this->mActionForm->load($this->mObject);
-
-		$this->mActionForm->fetch();
-		$this->mActionForm->validate();
-
-		if($this->mActionForm->hasError())
-			return LEGACYRENDER_FRAME_VIEW_INPUT;
-			
-		$this->mActionForm->update($this->mObject);
-
-		return $this->mObjectHandler->insert($this->mObject) ? LEGACYRENDER_FRAME_VIEW_SUCCESS
-		                                                     : LEGACYRENDER_FRAME_VIEW_ERROR;
-	}
-
-	function _setupObject(&$controller)
+	function _getId()
 	{
-		$id = $this->_getId();
-		
-		$this->mObjectHandler = $this->_getHandler();
-		
-		$this->mObject =& $this->mObjectHandler->get($id);
-		if (is_object($this->mObject) && $this->mObject->get('tplset_name') == 'default') {
-			$this->mObject = null;
-			die();
-		}
-		else {
-			print_r($this->mObject);
-			die();
-		}
+		return isset($_REQUEST['tpl_id']) ? intval($_REQUEST['tpl_id']) : 0;
 	}
 	
 	function &_getHandler()
@@ -68,10 +15,14 @@
 		$handler = xoops_getmodulehandler('tplfile');
 		return $handler;
 	}
-	
-	function _getId()
+
+	function _setupObject()
 	{
-		return isset($_REQUEST['tpl_id']) ? intval($_REQUEST['tpl_id']) : 0;
+		parent::_setupObject();
+
+		if (is_object($this->mObject) && $this->mObject->get('tpl_tplset') == 'default') {
+			$this->mObject = null;
+		}
 	}
 	
 	function _setupActionForm()
@@ -80,6 +31,11 @@
 		$this->mActionForm->prepare();
 	}
 
+	function isEnableCreate()
+	{
+		return false;
+	}
+
 	function executeViewInput(&$controller, &$xoopsUser, &$render)
 	{
 		$render->setTemplateName("tplfile_edit.html");
@@ -89,8 +45,7 @@
 
 	function executeViewSuccess(&$controller, &$xoopsUser, &$render)
 	{
-		header("location: ./index.php?action=TplfileList&amp;module=" . $this->mObject->get('module'));
-		exit();
+		$controller->executeForward("./index.php?action=TplfileList&amp;module=" . $this->mObject->get('module'));
 	}
 
 	function executeViewError(&$controller, &$xoopsUser, &$render)


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る