[xoops-cvslog 2604] CVS update: xoops2jp/html/modules/base/admin/actions

Back to archive index

Minahito minah****@users*****
2006年 3月 30日 (木) 23:56:54 JST


Index: xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php
diff -u xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php:1.1.2.5 xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php:1.1.2.6
--- xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php:1.1.2.5	Thu Mar 30 14:28:57 2006
+++ xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php	Thu Mar 30 23:56:54 2006
@@ -7,6 +7,15 @@
 
 class Legacy_CommentEditAction extends Legacy_AbstractEditAction
 {
+	/**
+	 * Override. At first, call _setupObject().
+	 */
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$this->_setupObject();
+		$this->_setupActionForm();
+	}
+	
 	function _getId()
 	{
 		return isset($_REQUEST['com_id']) ? $_REQUEST['com_id'] : 0;
@@ -23,9 +32,17 @@
 		return false;
 	}
 
+	/**
+	 * Choose appropriate ActionForm by the value of com_status.
+	 */
 	function _setupActionForm()
 	{
-		$this->mActionForm =& new Legacy_CommentAdminEditForm();
+		if ($this->mObject->get('com_status') == 1) {
+			$this->mActionForm =& new Legacy_PendingCommentAdminEditForm();
+		}
+		else {
+			$this->mActionForm =& new Legacy_ApprovalCommentAdminEditForm();
+		}
 		$this->mActionForm->prepare();
 	}
 
@@ -33,15 +50,28 @@
 	{
 		$this->mObject->loadUser();
 		$this->mObject->loadModule();
+		$this->mObject->loadStatus();
 		
 		$render->setTemplateName("comment_edit.html");
 		$render->setAttribute('actionForm', $this->mActionForm);
 		$render->setAttribute('object', $this->mObject);
 		
-		$handler =& xoops_gethandler('subjecticon');
-		$subjectIconArr =& $handler->getObjects();
+		$subjectHandler =& xoops_gethandler('subjecticon');
+		$subjectIconArr =& $subjectHandler->getObjects();
 		
 		$render->setAttribute('subjectIconArr', $subjectIconArr);
+
+		$statusHandler =& xoops_getmodulehandler('commentstatus');
+		if ($this->mObject->get('com_status') == XOOPS_COMMENT_PENDING) {
+			$statusArr =& $statusHandler->getObjects();
+		}
+		else {
+			$statusArr = array();
+			$statusArr[0] =& $statusHandler->get(XOOPS_COMMENT_ACTIVE);
+			$statusArr[1] =& $statusHandler->get(XOOPS_COMMENT_HIDDEN);
+		}
+		
+		$render->setAttribute('statusArr', $statusArr);
 	}
 
 	function executeViewSuccess(&$controller, &$xoopsUser, &$render)


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