Index: admin/comments.php
===================================================================
--- admin/comments.php	(revision 1719)
+++ admin/comments.php	(revision 1905)
@@ -131,21 +131,12 @@
 $combo_action = array();
 $default = '';
-if ($core->auth->check('publish,contentadmin',$core->blog->id))
+if ($core->auth->check('delete,contentadmin',$core->blog->id) && $status == -2)
 {
-	$combo_action[__('Publish')] = 'publish';
-	$combo_action[__('Unpublish')] = 'unpublish';
-	$combo_action[__('Mark as pending')] = 'pending';
-	$combo_action[__('Mark as junk')] = 'junk';
-}
-if ($core->auth->check('delete,contentadmin',$core->blog->id))
-{
-	$combo_action[__('Delete')] = 'delete';
-	if ($status == -2) {
-		$default = 'delete';
-	}
-}
-
-# --BEHAVIOR-- adminCommentsActionsCombo
-$core->callBehavior('adminCommentsActionsCombo',array(&$combo_action));
+	$default = 'delete';
+}
+
+$comments_actions_page = new dcCommentsActionsPage($core,'comments.php');
+
+$comments_actions_page->process();
 
 /* Get comments
@@ -165,6 +156,4 @@
 	$starting_script .= dcPage::jsLoad('js/filter-controls.js');
 }
-# --BEHAVIOR-- adminCommentsHeaders
-$starting_script .= $core->callBehavior('adminCommentsHeaders');
 
 dcPage::open(__('Comments and trackbacks'),$starting_script,
@@ -175,4 +164,9 @@
 		))
 );
+if (!empty($_GET['upd'])) {
+	dcPage::success(__('Selected comments have been successfully updated.'));
+} elseif (!empty($_GET['del'])) {
+	dcPage::success(__('Selected comments have been successfully deleted.'));
+}
 
 if (!$core->error->flag())
@@ -254,5 +248,5 @@
 	# Show comments
 	$comment_list->display($page,$nb_per_page,
-	'<form action="comments_actions.php" method="post" id="form-comments">'.
+	'<form action="comments.php" method="post" id="form-comments">'.
 	
 	'%s'.
@@ -262,5 +256,5 @@
 	
 	'<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '.
-	form::combo('action',$combo_action,$default,'','','','title="'.__('Actions').'"').
+	form::combo('action',$comments_actions_page->getCombo(),$default,'','','','title="'.__('Actions').'"').
 	$core->formNonce().
 	'<input type="submit" value="'.__('ok').'" /></p>'.
Index: admin/comments_actions.php
===================================================================
--- admin/comments_actions.php	(revision 1474)
+++ admin/comments_actions.php	(revision 1905)
@@ -11,132 +11,14 @@
 # -- END LICENSE BLOCK -----------------------------------------
 
+/* ### THIS FILE IS DEPRECATED 					### */
+/* ### IT IS ONLY USED FOR PLUGINS COMPATIBILITY ### */
+
 require dirname(__FILE__).'/../inc/admin/prepend.php';
 
 dcPage::check('usage,contentadmin');
 
-$params = array();
-$redir = 'comments.php';
+$comments_actions_page = new dcCommentsActionsPage($core,'posts.php');
 
-if (!empty($_POST['action']) && !empty($_POST['comments']))
-{
-	$comments = $_POST['comments'];
-	$action = $_POST['action'];
-	
-	if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false)
-	{
-		$redir = $_POST['redir'];
-	}
-	else
-	{
-		$redir =
-		'comments.php?type='.$_POST['type'].
-		'&author='.$_POST['author'].
-		'&status='.$_POST['status'].
-		'&sortby='.$_POST['sortby'].
-		'&ip='.$_POST['ip'].
-		'&order='.$_POST['order'].
-		'&page='.$_POST['page'].
-		'&nb='.(integer) $_POST['nb'];
-	}
-	
-	foreach ($comments as $k => $v) {
-		$comments[$k] = (integer) $v;
-	}
-	
-	$params['sql'] = 'AND C.comment_id IN('.implode(',',$comments).') ';
-	
-	if (!isset($_POST['full_content']) || empty($_POST['full_content'])) {
-		$params['no_content'] = true;
-	}
-	
-	$co = $core->blog->getComments($params);
-	
-	$co_ids = array();
-	while ($co->fetch())	{
-		$co_ids[] = $co->comment_id;
-	}
-	
-	# --BEHAVIOR-- adminCommentsActions
-	$core->callBehavior('adminCommentsActions',$core,$co,$action,$redir);
-	
-	if (preg_match('/^(publish|unpublish|pending|junk)$/',$action))
-	{
-		switch ($action) {
-			case 'unpublish' : $status = 0; break;
-			case 'pending' : $status = -1; break;
-			case 'junk' : $status = -2; break;
-			default : $status = 1; break;
-		}
-		
-		try {
-			$core->blog->updCommentsStatus($co_ids,$status);
-		} catch (Exception $e) {
-			$core->error->add($e->getMessage());
-		}
-		
-		if (!$core->error->flag()) {
-			http::redirect($redir);
-		}
-	}
-	elseif ($action == 'delete')
-	{
-		try {
-			// Backward compatibility
-			foreach($co_ids as $comment_id)
-			{
-				# --BEHAVIOR-- adminBeforeCommentDelete
-				$core->callBehavior('adminBeforeCommentDelete',$comment_id);				
-			}
-			
-			# --BEHAVIOR-- adminBeforeCommentsDelete
-			$core->callBehavior('adminBeforeCommentsDelete',$co_ids);
-			
-			$core->blog->delComments($co_ids);
-		} catch (Exception $e) {
-			$core->error->add($e->getMessage());
-		}
-		
-		if (!$core->error->flag()) {
-			http::redirect($redir);
-		}
-	}
-}
+$comments_actions_page->process();
 
-/* DISPLAY
--------------------------------------------------------- */
-dcPage::open(__('Comments'));
-
-if (!isset($action)) {
-	dcPage::close();
-	exit;
-}
-
-$hidden_fields = '';
-while ($co->fetch()) {
-	$hidden_fields .= form::hidden(array('comments[]'),$co->comment_id);
-} 
-
-if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false)
-{
-	$hidden_fields .= form::hidden(array('redir'),html::escapeURL($_POST['redir']));
-}
-else
-{
-	$hidden_fields .=
-	form::hidden(array('type'),$_POST['type']).
-	form::hidden(array('author'),$_POST['author']).
-	form::hidden(array('status'),$_POST['status']).
-	form::hidden(array('sortby'),$_POST['sortby']).
-	form::hidden(array('ip'),$_POST['ip']).
-	form::hidden(array('order'),$_POST['order']).
-	form::hidden(array('page'),$_POST['page']).
-	form::hidden(array('nb'),$_POST['nb']);
-}
-
-# --BEHAVIOR-- adminCommentsActionsContent
-$core->callBehavior('adminCommentsActionsContent',$core,$action,$hidden_fields);
-
-echo '<p><a class="back" href="'.str_replace('&','&amp;',$redir).'">'.__('Back to comments list').'</a></p>';
-
-dcPage::close();
 ?>
Index: inc/admin/actions/class.dcaction.php
===================================================================
--- inc/admin/actions/class.dcaction.php	(revision 1903)
+++ inc/admin/actions/class.dcaction.php	(revision 1905)
@@ -38,4 +38,6 @@
 	/** @var array list of url parameters (usually $_POST) */
 	protected $from;
+	/** @var string form field name for "entries" (usually "entries") */
+	protected $field_entries;
 	
 	/** @var string title for checkboxes list, if displayed */
@@ -63,4 +65,5 @@
 		$this->entries = array();
 		$this->from = new ArrayObject($_POST);
+		$this->field_entries = 'entries';
 	}
 	
@@ -88,8 +91,8 @@
 				$this->combo[$k] = array_merge ($this->combo[$k],$a);
 			} elseif ($a instanceof formSelectOption) {
-				$values = $a->value;
+				$values = array($a->value);
 				$this->combo[$k] = $a->value;
 			} else {
-				$values = $a;
+				$values = array($a);
 				$this->combo[$k] = $a;
 			}
@@ -135,5 +138,5 @@
 		$ret = '';
 		foreach  ($this->entries as $id->$v) {
-			$ret .= form::hidden('entries[]',$id);
+			$ret .= form::hidden($this->field_entries.'[]',$id);
 		}
 		return $ret;
@@ -206,5 +209,5 @@
 		$redir_args = array_merge($params,$this->redir_args);
 		if ($with_selected_entries) {
-			$redir_args['entries'] = array_keys($this->entries);
+			$redir_args[$this->field_entries] = array_keys($this->entries);
 		}
 		return $this->uri.'?'.http_build_query($redir_args);
@@ -282,5 +285,5 @@
 			$ret .= 
 				'<tr><td>'.
-				form::checkbox(array('entries[]'),$id,true,'','').'</td>'.
+				form::checkbox(array($this->field_entries.'[]'),$id,true,'','').'</td>'.
 				'<td>'.	$title.'</td></tr>';
 		}
Index: inc/admin/actions/class.dcactioncomments.php
===================================================================
--- inc/admin/actions/class.dcactioncomments.php	(revision 1905)
+++ inc/admin/actions/class.dcactioncomments.php	(revision 1905)
@@ -0,0 +1,140 @@
+<?php
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of Dotclear 2.
+#
+# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+if (!defined('DC_RC_PATH')) { return; }
+
+class dcCommentsActionsPage extends dcActionsPage
+{
+	public function __construct($core,$uri,$redirect_args=array()) {
+		parent::__construct($core,$uri,$redirect_args);
+		$this->redirect_fields = array('type','author','status',
+			'sortby','ip','order','page','nb');
+		$this->field_entries = 'comments';
+		$this->title_cb = __('Comments');
+		$this->loadDefaults();
+		$core->callBehavior('adminCommentsActionsPage',$core,$this);
+	}
+
+	protected function loadDefaults() {
+		// We could have added a behavior here, but we want default action
+		// to be setup first
+		dcDefaultCommentActions::adminCommentsActionsPage($this->core,$this);
+	}
+	
+	public function beginPage($breadcrumb='',$head='') {
+		dcPage::open(
+			__('Comments'),
+			
+			dcPage::jsLoad('js/_comments_actions.js').
+			$head,
+			$breadcrumb
+		);	
+		echo '<p><a class="back" href="'.$this->getRedirection(array(),true).'">'.__('Back to entries list').'</a></p>';
+	}
+	
+	public function endPage() {
+		dcPage::close();
+	}
+
+	public function error(Exception $e) {
+		$this->core->error->add($e->getMessage());
+		$this->beginPage(dcPage::breadcrumb(
+			array(
+				html::escapeHTML($this->core->blog->name) => '',
+				__('Comments') => 'comments.php',
+				'<span class="page-title">'.__('Comments actions').'</span>' => ''
+			))
+		);
+		$this->endPage();
+	}
+	
+	protected function fetchEntries($from) {
+		if (!empty($from['comments'])) {
+			$comments = $from['comments'];
+			
+			foreach ($comments as $k => $v) {
+				$comments[$k] = (integer) $v;
+			}
+			
+			$params['sql'] = 'AND C.comment_id IN('.implode(',',$comments).') ';
+			
+			if (!isset($from['full_content']) || empty($from['full_content'])) {
+				$params['no_content'] = true;
+			}
+			
+			$co = $this->core->blog->getComments($params);
+			while ($co->fetch())	{
+				$this->entries[$co->comment_id] = array(
+					'title' => $co->post_title,
+					'author' => $co->comment_author
+				);
+			}
+			$this->rs = $co;
+		}
+	}
+}
+
+class dcDefaultCommentActions 
+{
+	public static function adminCommentsActionsPage($core, dcCommentsActionsPage $ap) {
+		if ($core->auth->check('publish,contentadmin',$core->blog->id))
+		{
+			$action = array('dcDefaultCommentActions','doChangeCommentStatus');
+			$ap->addAction (array(__('Publish') => 'publish'), $action);
+			$ap->addAction (array(__('Publish') => 'publish'), $action);
+			$ap->addAction (array(__('Unpublish') => 'unpublish'), $action);
+			$ap->addAction (array(__('Mark as pending') => 'pending'), $action);
+			$ap->addAction(array(__('Mark as junk') => 'junk'), $action);
+		}
+	
+		if ($core->auth->check('delete,contentadmin',$core->blog->id))
+		{
+			$ap->addAction(array(__('Delete') => 'delete'),
+				array('dcDefaultCommentActions','doDeleteComment'));
+		}
+	}
+
+	public static function doChangeCommentStatus($core, dcCommentsActionsPage $ap, $post) {
+		$action = $ap->getAction();
+		$co_ids = $ap->getIDs();
+		if (empty($co_ids)) {
+			throw new Exception(__('No comment selected'));
+		}
+		switch ($action) {
+			case 'unpublish' : $status = 0; break;
+			case 'pending' : $status = -1; break;
+			case 'junk' : $status = -2; break;
+			default : $status = 1; break;
+		}
+		
+		$core->blog->updCommentsStatus($co_ids,$status);
+		$ap->redirect(array('upd'=>1),true);
+	}
+
+	public static function doDeleteComment($core, dcCommentsActionsPage $ap, $post) {
+		$co_ids = $ap->getIDs();
+		if (empty($co_ids)) {
+			throw new Exception(__('No comment selected'));
+		}
+		// Backward compatibility
+		foreach($co_ids as $comment_id)
+		{
+			# --BEHAVIOR-- adminBeforeCommentDelete
+			$core->callBehavior('adminBeforeCommentDelete',$comment_id);				
+		}
+		
+		# --BEHAVIOR-- adminBeforeCommentsDelete
+		$core->callBehavior('adminBeforeCommentsDelete',$co_ids);
+		
+		$core->blog->delComments($co_ids);
+		$ap->redirect(array('del'=>1), false);
+	}
+}
Index: inc/admin/lib.pager.php
===================================================================
--- inc/admin/lib.pager.php	(revision 1670)
+++ inc/admin/lib.pager.php	(revision 1905)
@@ -257,5 +257,10 @@
 			$pager->html_next = $this->html_next;
 			$pager->var_page = 'page';
-			
+			$comments = array();
+			if (isset($_REQUEST['comments'])) {
+				foreach ($_REQUEST['comments'] as $v) {
+					$comments[(integer)$v]=true;
+				}
+			}			
 			$html_block =
 			'<table><caption class="hidden">'.__('Comments and trackbacks list').'</caption><tr>'.
@@ -279,5 +284,5 @@
 			while ($this->rs->fetch())
 			{
-				echo $this->commentLine();
+				echo $this->commentLine(isset($comments[$this->rs->comment_id]));
 			}
 			
@@ -288,5 +293,5 @@
 	}
 	
-	private function commentLine()
+	private function commentLine($checked)
 	{
 		global $author, $status, $sortby, $order, $nb_per_page;
@@ -336,5 +341,5 @@
 		$res .=
 		'<td class="nowrap">'.
-		form::checkbox(array('comments[]'),$this->rs->comment_id,'','','',0).'</td>'.
+		form::checkbox(array('comments[]'),$this->rs->comment_id,$checked,'','',0).'</td>'.
 		'<td class="nowrap" abbr="'.__('Type and author').'" scope="raw">'.
 			'<a href="'.$comment_url.'" title="'.$comment_title.'">'.
Index: inc/prepend.php
===================================================================
--- inc/prepend.php	(revision 1806)
+++ inc/prepend.php	(revision 1905)
@@ -65,4 +65,5 @@
 $__autoload['dcUrlHandlers']			= dirname(__FILE__).'/public/lib.urlhandlers.php';
 $__autoload['dcPostsActionsPage']			= dirname(__FILE__).'/admin/actions/class.dcactionposts.php';
+$__autoload['dcCommentsActionsPage']			= dirname(__FILE__).'/admin/actions/class.dcactioncomments.php';
 $__autoload['dcActionsPage']			= dirname(__FILE__).'/admin/actions/class.dcaction.php';
 
Index: plugins/dclegacy/_admin.php
===================================================================
--- plugins/dclegacy/_admin.php	(revision 1806)
+++ plugins/dclegacy/_admin.php	(revision 1905)
@@ -13,4 +13,5 @@
 
 $GLOBALS['core']->addBehavior('adminPostsActionsPage',array('dcLegacyPosts','adminPostsActionsPage'));
+$GLOBALS['core']->addBehavior('adminCommentsActionsPage',array('dcLegacyComments','adminCommentsActionsPage'));
 
 /* Handle deprecated behaviors : 
@@ -40,3 +41,30 @@
 	}
 }
-?>
+
+
+/* Handle deprecated behaviors : 
+    * adminCommentsActionsCombo
+	* adminCommentsActionsHeaders
+	* adminCommentsActionsContent
+*/
+class dcLegacyComments
+{
+	public static function adminCommentsActionsPage($core, dcCommentsActionsPage $as) {
+		$stub_actions = new ArrayObject();
+		$core->callBehavior('adminCommentsActionsCombo',array($stub_actions));
+		if (!empty($stub_actions)) {
+			$as->addAction($stub_actions,array('dcLegacyComments','onActionLegacy'));
+		}
+	}
+	
+	public static function onActionLegacy($core, dcCommentsActionsPage $as, $Comment) {
+		$core->callBehavior('adminCommentsActions',$core,$as->getRS(),$as->getAction(),$as->getRedirection());
+		$as->beginPage('',
+			dcPage::jsLoad('js/jquery/jquery.autocomplete.js').
+			dcPage::jsMetaEditor().
+			$core->callBehavior('adminCommentsActionsHeaders'),'');
+		$core->callBehavior('adminCommentsActionsContent',$core,$as->getAction(),$as->getHiddenFields(true));
+		$as->endPage();
+	
+	}
+}
