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

Back to archive index

Minahito minah****@users*****
2006年 7月 31日 (月) 19:22:42 JST


Index: xoops2jp/html/modules/base/admin/actions/CommentDeleteAction.class.php
diff -u xoops2jp/html/modules/base/admin/actions/CommentDeleteAction.class.php:1.1.2.7 xoops2jp/html/modules/base/admin/actions/CommentDeleteAction.class.php:1.1.2.8
--- xoops2jp/html/modules/base/admin/actions/CommentDeleteAction.class.php:1.1.2.7	Tue Apr 11 12:50:50 2006
+++ xoops2jp/html/modules/base/admin/actions/CommentDeleteAction.class.php	Mon Jul 31 19:22:42 2006
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @package Legacy
+ * @version $Id: CommentDeleteAction.class.php,v 1.1.2.8 2006/07/31 10:22:42 minahito Exp $
+ */
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
 
@@ -8,22 +12,15 @@
 
 class Legacy_CommentDeleteAction extends Legacy_AbstractDeleteAction
 {
-	function prepare(&$controller, &$xoopsUser)
-	{
-		parent::prepare($controller, $xoopsUser);
-				
-		$root =& XCube_Root::getSingleton();
-		$root->mEventManager->add("Module.Legacy.Comment.Delete.Success", new XCube_InstanceDelegate($this, "doDelete"));
-	}
-	
 	function _getId()
 	{
-		return isset($_REQUEST['com_id']) ? $_REQUEST['com_id'] : 0;
+		return isset($_REQUEST['com_id']) ? xoops_getrequest('com_id') : 0;
 	}
 
 	function &_getHandler()
 	{
 		$handler =& xoops_getmodulehandler('comment');
+		$handler->mDeleteSuccess->add(array(&$this, "doDelete"));
 		return $handler;
 	}
 
@@ -69,13 +66,11 @@
 
 	function executeViewError(&$controller, &$xoopsUser, &$render)
 	{
-		redirect_header("./index.php?action=CommentList", 1, _AD_BASE_ERROR_DBUPDATE_FAILED);
+		$controller->executeRedirect("./index.php?action=CommentList", 1, _AD_BASE_ERROR_DBUPDATE_FAILED);
 	}
 	
-	function doDelete(&$sender, &$eventArgs)
+	function doDelete($comment)
 	{
-		$comment =& $eventArgs['comment'];
-		
 		//
 		// Adjust user's post count.
 		//
Index: xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php
diff -u xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php:1.1.2.8 xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php:1.1.2.9
--- xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php:1.1.2.8	Tue Apr 11 12:51:10 2006
+++ xoops2jp/html/modules/base/admin/actions/CommentEditAction.class.php	Mon Jul 31 19:22:42 2006
@@ -39,15 +39,11 @@
 	{
 		if ($this->mObject->get('com_status') == 1) {
 			$this->mActionForm =& new Legacy_PendingCommentAdminEditForm();
-
-			$root =& XCube_Root::getSingleton();
-			$root->mEventManager->add("Module.Legacy.Comment.Update.Success", new XCube_InstanceDelegate($this, "doApprove"));
+			$this->mObjectHandler->mUpdateSuccess->add(array(&$this, "doApprove"));
 		}
 		else {
 			$this->mActionForm =& new Legacy_ApprovalCommentAdminEditForm();
-		
-			$root =& XCube_Root::getSingleton();
-			$root->mEventManager->add("Module.Legacy.Comment.Update.Success", new XCube_InstanceDelegate($this, "doUpdate"));
+			$this->mObjectHandler->mUpdateSuccess->add(array(&$this, "doUpdate"));
 		}
 		$this->mActionForm->prepare();
 	}
@@ -118,7 +114,7 @@
 		return $comment_config;
 	}
 	
-	function doApprove(&$sender, &$eventArgs)
+	function doApprove($comment)
 	{
 		$comment =& $eventArgs['comment'];
 		$comment_config = Legacy_CommentEditAction::loadCallbackFile($comment);
@@ -133,13 +129,18 @@
 			call_user_func($function, $comment);
 		}
 		
-		Legacy_CommentEditAction::addUserPost($comment);		
+		$handler =& xoops_gethandler('member');
+
+		//
+		// TODO We should adjust the following lines and handler's design.
+		// We think we should not use getUser() and updateUserByField in XCube 2.1.
+		//
+		$user =& $handler->getUser($comment->get('com_uid'));
+		$handler->updateUserByField($user, 'posts', $user->get('posts') + 1);
 	}
 	
-	function doUpdate(&$sender, &$eventArgs)
+	function doUpdate($comment)
 	{
-		$comment =& $eventArgs['comment'];
-		
 		//
 		// Adjust user's post count.
 		//


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