Index: admin/posts_actions.php
===================================================================
--- admin/posts_actions.php	(revision 1468)
+++ admin/posts_actions.php	(revision 1471)
@@ -16,5 +16,67 @@
 
 $params = array();
-$action = '';
+
+class FieldsList {
+	protected $hidden;
+	protected $entries;
+	public function __construct() {
+		$this->hidden=array();
+		$this->entries =array();
+	}
+	public function addHidden($name,$value) {
+		$this->hidden[] = form::hidden($name,$value);
+		return $this;
+	}
+	public function addEntry($id,$title) {
+		$this->entries[$id]=$title;
+		return $this;
+	}
+
+	public function getHidden() {
+		return join('',$this->hidden);
+	}
+	
+	public function getEntries ($hidden=false) {
+		$ret = '';
+		if ($hidden) {
+			foreach ($this->entries as $id=> $e) {
+				$ret .= form::hidden('entries[]',$id);
+			}
+		} else {
+			$ret = 
+				'<table class="posts-list"><tr>'.
+				'<th colspan="2">'.__('Title').'</th>'.
+				'</tr>';
+			foreach ($this->entries as $id=>$title) {
+				$ret .= 
+					'<tr><td>'.
+					form::checkbox(array('entries[]'),$id,true,'','').'</td>'.
+					'<td>'.	$title.'</td></tr>';
+			}
+			$ret .= '</table>';
+		}
+		return $ret;
+	}
+	
+	public function __toString() {
+		return join('',$this->hidden).$this->getEntries(true);
+	}
+}
+
+
+function listEntries($titles) {
+	$ret = 
+		'<table class="posts-list"><tr>'.
+		'<th colspan="2">'.__('Title').'</th>'.
+		'</tr>';
+	foreach ($titles as $id=>$title) {
+		$ret .= 
+			'<tr><td>'.
+			form::checkbox(array('entries[]'),$id,true,'','').'</td>'.
+			'<td>'.	$title.'</td></tr>';
+	}
+	$ret .= '</table>';
+	return $ret;
+}
 
 /* Actions
@@ -127,26 +189,7 @@
 	elseif ($action == 'category' && isset($_POST['new_cat_id']))
 	{
-		$new_cat_id = $_POST['new_cat_id'];
-		
-		try
-		{
-			if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id))
-			{
-				$cur_cat = $core->con->openCursor($core->prefix.'category');
-				$cur_cat->cat_title = $_POST['new_cat_title'];
-				$cur_cat->cat_url = '';
-				
-				$parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : '';
-				
-				# --BEHAVIOR-- adminBeforeCategoryCreate
-				$core->callBehavior('adminBeforeCategoryCreate', $cur_cat);
-				
-				$new_cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat);
-				
-				# --BEHAVIOR-- adminAfterCategoryCreate
-				$core->callBehavior('adminAfterCategoryCreate', $cur_cat, $new_cat_id);
-			}
-			
-			$core->blog->updPostsCategory($posts_ids, $new_cat_id);
+		try
+		{
+			$core->blog->updPostsCategory($posts_ids,$_POST['new_cat_id']);
 			
 			http::redirect($redir);
@@ -195,6 +238,22 @@
 		}
 	}
-}
-
+} else {
+	if (empty($_POST['entries'])) {
+		$core->error->add(__('At least one entry should be selected'));
+	} else {
+		$core->error->add(__('No action specified.'));
+	}
+	dcPage::open(
+		__('Entries'),'',dcPage::breadcrumb(
+		array(
+			html::escapeHTML($core->blog->name) => '',
+			__('Entries') => 'posts.php',
+			'<span class="page-title">'.__('Entries actions').'</span>' => ''
+		))
+	);
+
+	dcPage::close();
+	exit;
+}
 /* DISPLAY
 -------------------------------------------------------- */
@@ -231,50 +290,56 @@
 }
 
-$hidden_fields = '';
+$fields = new FieldsList();
 while ($posts->fetch()) {
-	$hidden_fields .= form::hidden(array('entries[]'),$posts->post_id);
+	$fields->addEntry($posts->post_id,$posts->post_title);
 }
 
 if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false)
 {
-	$hidden_fields .= form::hidden(array('redir'),html::escapeURL($_POST['redir']));
+	$fields->addHidden(array('redir'),html::escapeURL($_POST['redir']));
 }
 else
 {
-	$hidden_fields .=
-	form::hidden(array('user_id'),$_POST['user_id']).
-	form::hidden(array('cat_id'),$_POST['cat_id']).
-	form::hidden(array('status'),$_POST['status']).
-	form::hidden(array('selected'),$_POST['selected']).
-	form::hidden(array('month'),$_POST['month']).
-	form::hidden(array('lang'),$_POST['lang']).
-	form::hidden(array('sortby'),$_POST['sortby']).
-	form::hidden(array('order'),$_POST['order']).
-	form::hidden(array('page'),$_POST['page']).
-	form::hidden(array('nb'),$_POST['nb']);
+	$fields
+		->addHidden(array('user_id'),$_POST['user_id'])
+		->addHidden(array('cat_id'),$_POST['cat_id'])
+		->addHidden(array('status'),$_POST['status'])
+		->addHidden(array('selected'),$_POST['selected'])
+		->addHidden(array('month'),$_POST['month'])
+		->addHidden(array('lang'),$_POST['lang'])
+		->addHidden(array('sortby'),$_POST['sortby'])
+		->addHidden(array('order'),$_POST['order'])
+		->addHidden(array('page'),$_POST['page'])
+		->addHidden(array('nb'),$_POST['nb'])
+	;
 }
 
 if (isset($_POST['post_type'])) {
-	$hidden_fields .= form::hidden(array('post_type'),$_POST['post_type']);
+	$fields->addHidden(array('post_type'),$_POST['post_type']);
 }
 
 # --BEHAVIOR-- adminPostsActionsContent
-$core->callBehavior('adminPostsActionsContent',$core,$action,$hidden_fields);
+$core->callBehavior('adminPostsActionsContent',$core,$action,$fields);
 
 if ($action == 'category')
 {
-	echo '<h2 class="page-title">'.__('Change category for entries').'</h2>';
-	
+	echo dcPage::breadcrumb(
+		array(
+			html::escapeHTML($core->blog->name) => '',
+			__('Entries') => 'posts.php',
+			__('Change category for entries') => ''
+	));
+
+	# categories list
 	# Getting categories
-	$categories_combo = array(__('(No cat)') => '');
+	$categories_combo = array('&nbsp;' => '');
 	try {
 		$categories = $core->blog->getCategories(array('post_type'=>'post'));
-		if (!$categories->isEmpty()) {
-			while ($categories->fetch()) {
-				$catparents_combo[] = $categories_combo[] = new formSelectOption(
-					str_repeat('&nbsp;&nbsp;',$categories->level-1).($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title),
-					$categories->cat_id
-				);
-			}
+		while ($categories->fetch()) {
+			$categories_combo[] = new formSelectOption(
+				str_repeat('&nbsp;&nbsp;',$categories->level-1).
+				($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title),
+				$categories->cat_id
+			);
 		}
 	} catch (Exception $e) { }
@@ -282,21 +347,11 @@
 	echo
 	'<form action="posts_actions.php" method="post">'.
-	'<p><label for="new_cat_id" class="classic">'.__('Category:').'</label> '.
-	form::combo('new_cat_id',$categories_combo,'');
-	
-	if ($core->auth->check('categories', $core->blog->id)) {
-		echo 
-		'<div>'.
-		'<p id="new_cat">'.__('Add a new category').'</p>'.
-		'<p><label for="new_cat_title">'.__('Title:').' '.
-		form::field('new_cat_title',30,255,'','maximal').'</label></p>'.
-		'<p><label for="new_cat_parent">'.__('Parent:').' '.
-		form::combo('new_cat_parent',$categories_combo,'','maximal').
-		'</label></p>'.
-		'</div>';
-	}
-	
-	echo
-	$hidden_fields.
+	$fields->getEntries().
+	'<p><label for="new_cat_id" class="classic">'.__('Category:').' '.
+	form::combo('new_cat_id',$categories_combo,'').
+	'</label> ';
+	
+	echo
+	$fields->getHidden().
 	$core->formNonce().
 	form::hidden(array('action'),'category').
@@ -306,5 +361,10 @@
 elseif ($action == 'lang')
 {
-	echo '<h2 class="page-title">'.__('Change language for entries').'</h2>';
+	echo dcPage::breadcrumb(
+		array(
+			html::escapeHTML($core->blog->name) => '',
+			__('Entries') => 'posts.php',
+			'<span class="page-title">'.__('Change language for entries').'</span>' => ''
+	));
 	
 	# lang list
@@ -326,9 +386,11 @@
 	echo
 	'<form action="posts_actions.php" method="post">'.
-	'<p><label for="new_lang" class="classic">'.__('Entry lang:').'</label> '.
-	form::combo('new_lang',$lang_combo,'');
-	
-	echo
-	$hidden_fields.
+	$fields->getEntries().	
+	'<p><label for="new_lang" class="classic">'.__('Entry lang:').' '.
+	form::combo('new_lang',$lang_combo,'').
+	'</label> ';
+	
+	echo
+	$fields->getHidden().
 	$core->formNonce().
 	form::hidden(array('action'),'lang').
@@ -339,13 +401,20 @@
 elseif ($action == 'author' && $core->auth->check('admin',$core->blog->id))
 {
-	echo '<h2 class="page-title">'.__('Change author for entries').'</h2>';
+	echo dcPage::breadcrumb(
+		array(
+			html::escapeHTML($core->blog->name) => '',
+			__('Entries') => 'posts.php',
+			'<span class="page-title">'.__('Change author for entries').'</span>' => ''
+	));
 	
 	echo
 	'<form action="posts_actions.php" method="post">'.
-	'<p><label for="new_auth_id" class="classic">'.__('Author ID:').'</label> '.
-	form::field('new_auth_id',20,255);
-	
-	echo
-	$hidden_fields.
+	$fields->getEntries().
+	'<p><label for="new_auth_id" class="classic">'.__('Author ID:').' '.
+	form::field('new_auth_id',20,255).
+	'</label> ';
+	
+	echo
+	$fields->getHidden().
 	$core->formNonce().
 	form::hidden(array('action'),'author').
