Index: admin/blogs.php
===================================================================
--- admin/blogs.php	(revision 456)
+++ admin/blogs.php	(revision 520)
@@ -15,26 +15,12 @@
 dcPage::check('usage,contentadmin');
 
-# Filters
-$sortby_combo = array(
-__('Last update') => 'blog_upddt',
-__('Blog name') => 'UPPER(blog_name)',
-__('Blog ID') => 'B.blog_id'
-);
+$q = !empty($_GET['q']) ? $_GET['q'] : '';
 
-$order_combo = array(
-__('Descending') => 'desc',
-__('Ascending') => 'asc'
-);
+$blogs_list = new adminBlogList($core);
 
-$q = !empty($_GET['q']) ? $_GET['q'] : '';
-$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'blog_upddt';
-$order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
+$params = new ArrayObject();
 
-$page = !empty($_GET['page']) ? $_GET['page'] : 1;
-$nb_per_page =  30;
-
-if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
-	$nb_per_page = $_GET['nb'];
-}
+# - Limit, sortby and order filter
+$params = $blogs_list->applyFilters($params);
 
 $show_filters = false;
@@ -46,21 +32,8 @@
 }
 
-# - Sortby and order filter
-if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
-	if ($order !== '' && in_array($order,$order_combo)) {
-		$params['order'] = $sortby.' '.$order;
-	}
-	
-	if ($sortby != 'blog_upddt' || $order != 'desc') {
-		$show_filters = true;
-	}
-}
-
-$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
-
 try {
 	$counter = $core->getBlogs($params,1);
 	$rs = $core->getBlogs($params);
-	$nb_blog = $counter->f(0);
+	$blogs_list->setItems($rs,$counter->f(0));
 } catch (Exception $e) {
 	$core->error->add($e->getMessage());
@@ -93,23 +66,10 @@
 	echo
 	'<form action="blogs.php" method="get" id="filters-form">'.
-	'<fieldset class="two-cols"><legend>'.__('Filters').'</legend>'.
+	'<fieldset><legend>'.__('Filters').'</legend>'.
 	
-	'<div class="col">'.
-	'<p><label for="sortby">'.__('Order by:').' '.
-	form::combo('sortby',$sortby_combo,html::escapeHTML($sortby)).
-	'</label> '.
-	'<label for="order">'.__('Sort:').' '.
-	form::combo('order',$order_combo,html::escapeHTML($order)).
-	'</label></p>'.
-	'</div>'.
-	
-	'<div class="col">'.
 	'<p><label for="q">'.__('Search:').' '.
 	form::field('q',20,255,html::escapeHTML($q)).
 	'</label></p>'.
-	'<p><label for="nb" class="classic">'.	form::field('nb',3,3,$nb_per_page).' '.
-	__('Blogs per page').'</label> '.
-	'<input type="submit" value="'.__('Apply filters').'" /></p>'.
-	'</div>'.
+	'<p><input type="submit" value="'.__('Apply filters').'" /></p>'.
 	
 	'<br class="clear" />'. //Opera sucks
@@ -118,6 +78,5 @@
 	
 	# Show blogs
-	$blogs_list = new adminBlogList($core,$rs,$nb_blog);
-	$blogs_list->display($page,$nb_per_page);
+	$blogs_list->display();
 }
 
Index: admin/comments.php
===================================================================
--- admin/comments.php	(revision 506)
+++ admin/comments.php	(revision 520)
@@ -27,30 +27,11 @@
 );
 
-$sortby_combo = array(
-__('Date') => 'comment_dt',
-__('Entry title') => 'post_title',
-__('Author') => 'comment_author',
-__('Status') => 'comment_status'
-);
+$comment_list = new adminCommentList($core);
 
-$order_combo = array(
-__('Descending') => 'desc',
-__('Ascending') => 'asc'
-);
+$params = new ArrayObject();
+$params['no_content'] = true;
 
-
-
-$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
-$nb_per_page =  30;
-
-if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
-	if ($nb_per_page != $_GET['nb']) {
-		$show_filters = true;
-	}
-	$nb_per_page = (integer) $_GET['nb'];
-}
-$params = new ArrayObject();
-$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
-$params['no_content'] = true;
+# - Limit, sortby and order filter
+$params = $comment_list->applyFilters($params);
 
 # Actions combo box
@@ -106,5 +87,5 @@
 	}
 
-	$comment_list = new adminCommentList($core,$comments,$counter->f(0));
+	$comment_list->setItems($comments,$counter->f(0));
 } catch (Exception $e) {
 	$core->error->add($e->getMessage());
@@ -126,8 +107,4 @@
 {
 	# Filters
-	if (!$show_filters) {
-		echo '<p><a id="filter-control" class="form-control" href="#">'.
-		__('Filters').'</a></p>';
-	}
 	$filterSet->display();
 	
@@ -144,6 +121,5 @@
 	
 	# Show comments
-	$comment_list->display($page,$nb_per_page,
-	'<form action="comments_actions.php" method="post" id="form-comments">'.
+	$comment_list->display('<form action="comments_actions.php" method="post" id="form-comments">'.
 	
 	'%s'.
@@ -157,11 +133,8 @@
 	'<input type="submit" value="'.__('ok').'" /></p>'.
 	form::hidden(array('type'),$type).
-	form::hidden(array('sortby'),$sortby).
-	form::hidden(array('order'),$order).
 	form::hidden(array('author'),preg_replace('/%/','%%',$author)).
 	form::hidden(array('status'),$status).
 	form::hidden(array('ip'),preg_replace('/%/','%%',$ip)).
-	form::hidden(array('page'),$page).
-	form::hidden(array('nb'),$nb_per_page).
+	$comment_list->getFormFieldsAsHidden().
 	'</div>'.
 	
Index: admin/permissions_blog.php
===================================================================
--- admin/permissions_blog.php	(revision 456)
+++ admin/permissions_blog.php	(revision 520)
@@ -15,19 +15,5 @@
 dcPage::checkSuper();
 
-# Filters
-$sortby_combo = array(
-__('Blog ID') => 'B.blog_id',
-__('Blog name') => 'blog_name'
-);
-
-$order_combo = array(
-__('Descending') => 'desc',
-__('Ascending') => 'asc'
-);
-
 $q = !empty($_GET['q']) ? $_GET['q'] : '';
-$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'blog_id';
-$order = !empty($_GET['order']) ? $_GET['order'] : 'asc';
-
 
 # Check users
@@ -48,10 +34,10 @@
 else
 {
-	$page = !empty($_GET['page']) ? $_GET['page'] : 1;
-	$nb_per_page =  30;
+	$blogs_list = new adminBlogPermissionsList($core);
 	
-	if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
-		$nb_per_page = $_GET['nb'];
-	}
+	$params = new ArrayObject();
+	
+	# - Limit, sortby and order filter
+	$params = $blogs_list->applyFilters($params);
 	
 	$show_filters = false;
@@ -63,18 +49,8 @@
 	}
 	
-	# - Sortby and order filter
-	if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
-		if ($order !== '' && in_array($order,$order_combo)) {
-			$params['order'] = $sortby.' '.$order;
-			$show_filters = true;
-		}
-	}
-	
-	$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
-	
 	try {
 		$rs = $core->getBlogs($params);
 		$counter = $core->getBlogs($params,1);
-		$nb_blog = $counter->f(0);
+		$blogs_list->setItems($rs,$counter->f(0));
 	} catch (Exception $e) {
 		$core->error->add($e->getMessage());
@@ -107,22 +83,9 @@
 	'<fieldset class="two-cols"><legend>'.__('Filters').'</legend>'.
 	
-	'<div class="col">'.
-	'<p><label for="sortby">'.__('Order by:').' '.
-	form::combo('sortby',$sortby_combo,html::escapeHTML($sortby)).
-	'</label> '.
-	'<label for="order">'.__('Sort:').' '.
-	form::combo('order',$order_combo,html::escapeHTML($order)).
-	'</label></p>'.
-	'</div>'.
-	
-	'<div class="col">'.
 	'<p><label for="q">'.__('Search:').' '.
 	form::field('q',20,255,html::escapeHTML($q)).
 	'</label></p>'.
-	'<p><label for="nb" class="classic">'.	form::field('nb',3,3,$nb_per_page).' '.
-	__('Entries per page').'</label> '.
-	'<input type="submit" value="'.__('Apply filters').'" />'.
+	'<p><input type="submit" value="'.__('Apply filters').'" />'.
 	$hidden_fields.'</p>'.
-	'</div>'.
 	
 	'<br class="clear" />'. //Opera sucks
@@ -136,6 +99,5 @@
 	
 	# Show blogs
-	$blogs_list = new adminBlogPermissionsList($core,$rs,$nb_blog);
-	$blogs_list->display($page,$nb_per_page,'<form action="permissions.php" method="post" id="form-blogs">'.
+	$blogs_list->display('<form action="permissions.php" method="post" id="form-blogs">'.
 		'%s'.
 		'<p class="checkboxes-helpers"></p>'.
Index: admin/popup_posts.php
===================================================================
--- admin/popup_posts.php	(revision 68)
+++ admin/popup_posts.php	(revision 520)
@@ -17,11 +17,11 @@
 $q = !empty($_GET['q']) ? $_GET['q'] : null;
 
-$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
-$nb_per_page =  10;
+$post_list = new adminPostMiniList($core);
 
 $params = array();
-$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
 $params['no_content'] = true;
-$params['order'] = 'post_dt DESC';
+
+# - Limit, sortby and order filter
+$params = $post_list->applyFilters($params);
 
 if ($q) {
@@ -43,5 +43,5 @@
 	$posts = $core->blog->getPosts($params);
 	$counter = $core->blog->getPosts($params,true);
-	$post_list = new adminPostMiniList($core,$posts,$counter->f(0));
+	$post_list->setItems($posts,$counter->f(0));
 } catch (Exception $e) {
 	$core->error->add($e->getMessage());
@@ -49,5 +49,5 @@
 
 echo '<div id="form-entries">'; # I know it's not a form but we just need the ID
-$post_list->display($page,$nb_per_page);
+$post_list->display();
 echo '</div>';
 
Index: admin/posts.php
===================================================================
--- admin/posts.php	(revision 509)
+++ admin/posts.php	(revision 520)
@@ -119,26 +119,11 @@
 /* Get posts
 -------------------------------------------------------- */
-$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
-$nb_per_page =  30;
-
-if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
-	if ($nb_per_page != $_GET['nb']) {
-		$show_filters = true;
-	}
-	$nb_per_page = (integer) $_GET['nb'];
-}
+$post_list = new adminPostList($core);
 
 $params = new ArrayObject();
-$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
 $params['no_content'] = true;
 
-# - Sortby and order filter
-$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'post_dt';
-$order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
-if ($sortby !== '') {
-	if ($order !== '') {
-		$params['order'] = $sortby.' '.$order;
-	}
-}
+# - Limit, sortby and order filter
+$params = $post_list->applyFilters($params);
 
 $filterSet = new dcFilterSet('posts','posts.php');
@@ -181,5 +166,5 @@
 		$page_title = __('Entries');
 	}
-	$post_list = new adminPostList($core,$posts,$counter->f(0));
+	$post_list->setItems($posts,$counter->f(0));
 } catch (Exception $e) {
 	$core->error->add($e->getMessage());
@@ -205,6 +190,5 @@
 
 	# Show posts
-	$post_list->display($page,$nb_per_page,
-	'<form action="posts_actions.php" method="post" id="form-entries">'.
+	$post_list->display('<form action="posts_actions.php" method="post" id="form-entries">'.
 	
 	'%s'.
@@ -217,4 +201,5 @@
 	'<input type="submit" value="'.__('ok').'" /></p>'.
 	$filterSet->getFormFieldsAsHidden().
+	$post_list->getFormFieldsAsHidden().
 	$core->formNonce().
 	'</div>'.
Index: admin/style/default.css
===================================================================
--- admin/style/default.css	(revision 508)
+++ admin/style/default.css	(revision 520)
@@ -958,5 +958,5 @@
 	vertical-align: top;
 }
-thead th{
+thead th {
 	text-align: left;
 	border-top: 1px solid #666;
@@ -968,9 +968,11 @@
 	border-bottom: 1px dotted #000;
 }
-thead th.asc {
+thead th.asc a {
+	color: #2373A8;
 	padding-left: 15px;
 	background: transparent url(asc.png) no-repeat left center;
 }
-thead th.desc {
+thead th.desc a {
+	color: #2373A8;
 	padding-left: 15px;
 	background: transparent url(desc.png) no-repeat left center;
Index: admin/users.php
===================================================================
--- admin/users.php	(revision 158)
+++ admin/users.php	(revision 520)
@@ -64,18 +64,14 @@
 
 # Get users
-$page = !empty($_GET['page']) ? $_GET['page'] : 1;
-$nb_per_page =  30;
-
-if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
-	$nb_per_page = $_GET['nb'];
-}
+$user_list = new adminUserList($core);
 
 $q = !empty($_GET['q']) ? $_GET['q'] : '';
-$sortby = !empty($_GET['sortby']) ?	$_GET['sortby'] : 'user_id';
-$order = !empty($_GET['order']) ?		$_GET['order'] : 'asc';
-
-$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
 
 $show_filters = false;
+
+$params = new ArrayObject();
+
+# - Limit, sortby and order filter
+$params = $user_list->applyFilters($params);
 
 # - Search filter
@@ -85,20 +81,11 @@
 }
 
-# - Sortby and order filter
-if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
-	if ($order !== '' && in_array($order,$order_combo)) {
-		$params['order'] = $sortby.' '.$order;
-		$show_filters = true;
-	}
-}
-
 try {
 	$rs = $core->getUsers($params);
 	$counter = $core->getUsers($params,1);
-	$user_list = new adminUserList($core,$rs,$counter->f(0));
+	$user_list->setItems($rs,$counter->f(0));
 } catch (Exception $e) {
 	$core->error->add($e->getMessage());
 }
-
 
 /* DISPLAY
@@ -127,23 +114,10 @@
 	echo
 	'<form action="users.php" method="get" id="filters-form">'.
-	'<fieldset class="two-cols"><legend>'.__('Filters').'</legend>'.
+	'<fieldset><legend>'.__('Filters').'</legend>'.
 	
-	'<div class="col">'.
-	'<p><label for="sortby">'.__('Order by:').' '.
-	form::combo('sortby',$sortby_combo,$sortby).
-	'</label> '.
-	'<label for="order">'.__('Sort:').' '.
-	form::combo('order',$order_combo,$order).
-	'</label></p>'.
-	'</div>'.
-	
-	'<div class="col">'.
 	'<p><label for="q">'.__('Search:').' '.
 	form::field('q',20,255,html::escapeHTML($q)).
 	'</label></p>'.
-	'<p><label for="nb" class="classic">'.	form::field('nb',3,3,$nb_per_page).' '.
-	__('Users per page').'</label> '.
-	'<input type="submit" value="'.__('Apply filters').'" /></p>'.
-	'</div>'.
+	'<p><input type="submit" value="'.__('Apply filters').'" /></p>'.
 	
 	'<br class="clear" />'. //Opera sucks
@@ -152,6 +126,5 @@
 	
 	# Show users
-	$user_list->display($page,$nb_per_page,
-	'<form action="dispatcher.php" method="get" id="form-users">'.
+	$user_list->display('<form action="dispatcher.php" method="get" id="form-users">'.
 	
 	'%s'.
@@ -166,4 +139,5 @@
 	'<input type="submit" value="'.__('ok').'" />'.
 	'</p>'.
+	$user_list->getFormFieldsAsHidden().
 	'</div>'.
 	'</form>'
