Index: admin/posts.php
===================================================================
--- admin/posts.php	(revision 1153)
+++ admin/posts.php	(revision 1154)
@@ -135,4 +135,18 @@
 	}
 }
+
+class PostsFetcher extends dcListFetcher {
+
+	public function getEntries($params,$offset,$limit) {
+		$params['limit'] = array($offset,$limit);
+		return $this->core->blog->getPosts($params);
+	}
+
+	public function getEntriesCount($params) {
+		$count = $this->core->blog->getPosts($params,true);
+		return $count->f(0);
+	}
+}
+
 /* DISPLAY
 -------------------------------------------------------- */
@@ -157,9 +171,7 @@
 
 
-
-$lposts = new dcItemList ($core,array('lposts','form-entries'),'posts_actions.php');
+$lfetcher = new PostsFetcher($core);
+$lposts = new dcItemList ($core,array('lposts','form-entries'),$filterSet,$lfetcher,'posts_actions.php');
 $lposts->addTemplate('posts_cols.html.twig');
-
-$lposts->setFilterSet($filterSet);
 
 $lposts
@@ -173,13 +185,8 @@
 
 $lposts->setup();
-$filterSet->setup();
 
 $_ctx
 	->fillPageTitle(__('Entries'),'posts.php');
-$params=new ArrayObject();
-$filterSet->applyFilters($params);
-$posts = $core->blog->getPosts($params);
-$lposts->setEntries($posts);
-$_ctx->filters = '['.print_r($params->getArrayCopy(),true).']';
+
 
 $core->tpl->display('posts.html.twig');
Index: inc/admin/class.dc.filter.php
===================================================================
--- inc/admin/class.dc.filter.php	(revision 1152)
+++ inc/admin/class.dc.filter.php	(revision 1154)
@@ -20,5 +20,5 @@
 	protected $form_prefix;		/// <b>string</b> displayed form prefix
 	protected $action; 			/// <b>string</b> form action page
-	protected $hideform;		/// <b>boolean</b> start form display hidden by default or not
+	protected $hide_filterset;		/// <b>boolean</b> start form display hidden by default or not
 	protected $name;			/// <b>string</b> filterset name
 	protected $core;
@@ -115,5 +115,5 @@
 			}
 		}
-
+		$this->hide_filterset = true;
 		if ($action !== false) {
 			// Use case (1)
@@ -126,4 +126,5 @@
 					$this->filters[$_POST[$fname]]->add();
 					}
+					$this->hide_filterset = false;
 				} elseif (strpos($action,'del_') === 0) {
 					$count = preg_match('#del_(.+)_([0-9]+)#',$action,$match);
@@ -131,4 +132,5 @@
 						$this->filters[$match[1]]->remove($match[2]);
 					}
+					$this->hide_filterset = false;
 				} elseif ($action=="apply") {
 					$data = $this->saveFilters();
@@ -153,5 +155,5 @@
 				}
 			}
-			$this->hideform=false;
+			
 		} else {
 			// Use case (2)
@@ -183,4 +185,8 @@
 	}
 
+	public function getURLParams() {
+		return $this->getAppliedFilters();
+	}
+
 	/**
 	Saves user filters to preferences
@@ -214,5 +220,4 @@
 	*/
 	protected function setupEditFilters ($filters,$form_data) {
-		$this->hideform = true;
 		foreach ($filters as $filter) {
 			$filter->setupFields ($form_data);
@@ -276,5 +281,6 @@
 			'active_filters' => $fcontext, 
 			'static_filters' => $sfcontext,
-			'prefix'=>$this->form_prefix);
+			'hide_filters'	 => $this->hide_filterset,
+			'prefix'		 => $this->form_prefix);
 	}
 
@@ -480,4 +486,8 @@
 	}
 
+	public function getFields() {
+		return $this->field;
+	}
+
 }
 
Index: inc/admin/class.dc.form.php
===================================================================
--- inc/admin/class.dc.form.php	(revision 1153)
+++ inc/admin/class.dc.form.php	(revision 1154)
@@ -20,7 +20,7 @@
 class dcFormNode extends Twig_Node
 {
-	public function __construct($name,Twig_NodeInterface $body,$lineno,$tag=null)
-	{
-		parent::__construct(array('body' => $body),array('name' => $name),$lineno,$tag);
+	public function __construct($name,Twig_NodeInterface $body,$attr,$lineno,$tag=null)
+	{
+		parent::__construct(array('body' => $body),array('name' => $name, 'attr' => $attr),$lineno,$tag);
 	}
 	
@@ -36,5 +36,11 @@
 		$compiler
 			->write("\$context['dc_form']->beginForm(")
-			->subcompile($this->getAttribute('name'))
+			->subcompile($this->getAttribute('name'));
+		if ($this->getAttribute('attr') !== null) {
+			$compiler
+				->write(',')
+				->subcompile($this->getAttribute('attr'));
+		}
+		$compiler
 			->write(");\n");
 		$compiler
@@ -56,9 +62,14 @@
 		$stream = $this->parser->getStream();
 		$name = $this->parser->getExpressionParser()->parseExpression();
+		$attr = null;
+		if ($stream->test(Twig_Token::NAME_TYPE, 'with')) {
+			$stream->next();
+			$attr = $this->parser->getExpressionParser()->parseExpression();
+		}
 		$stream->expect(Twig_Token::BLOCK_END_TYPE);
 		$body = $this->parser->subparse(array($this,'decideBlockEnd'),true);
 		$stream->expect(Twig_Token::BLOCK_END_TYPE);
 		
-		return new dcFormNode($name,$body,$token->getLine(),$this->getTag());
+		return new dcFormNode($name,$body,$attr,$token->getLine(),$this->getTag());
 	}
 	
@@ -219,9 +230,9 @@
 	}
 
-	public function beginForm($name)
+	public function beginForm($name,$attr=array())
 	{
 		if (isset($this->forms[$name])) {
 			$this->currentForm = $this->forms[$name];
-			$this->currentForm->begin();
+			$this->currentForm->begin($attr);
 		}
 		else {
@@ -381,12 +392,14 @@
 		}
 	}
-	public function begin()
-	{
-		echo sprintf(
-			'<form%s method="%s" action="%s">',
-			empty($this->id) ? '' : ' id="'.$this->id.'"',
-			$this->method,
-			$this->action
-		);
+	public function begin($attr=array())
+	{
+		$attr['method'] = $this->method;
+		$attr['action'] = $this->action;
+		if (!empty($this->id)) {
+			$attr['id'] = $this->id;
+		}
+		$this->core->tpl->getExtension('dc_form')->renderWidget(
+			'beginform',
+			$attr);
 	}
 	
Index: inc/admin/class.dc.list.php
===================================================================
--- inc/admin/class.dc.list.php	(revision 1152)
+++ inc/admin/class.dc.list.php	(revision 1154)
@@ -16,5 +16,9 @@
 	protected $entries;
 	protected $filterset;
+	protected $fetcher;
 	protected $selection;
+	protected $current_page;
+	protected $nb_items;
+	protected $nb_items_per_page;
 
 
@@ -46,5 +50,5 @@
 	@param	form_prefix	<b>string</b>		form prefix to use for parameters
 	*/
-	public function __construct($core,$name,$action,$form_prefix="f_") {
+	public function __construct($core,$name,$filterset,$fetcher,$action,$form_prefix="f_") {
 		parent::__construct($core,$name,$action,'POST');
 		$this->entries = array();
@@ -52,12 +56,14 @@
 		$this->selection = new dcFieldCheckbox('entries',NULL,array('multiple' => true));
 		$this->addField($this->selection);
+		$this->filterset = $filterset;
+		$this->fetcher = $fetcher;
 	}
 
 	public function setup() {
-		parent::setup();
 		$this
 			->addField(new dcFieldCombo('action',$this->actions_combo, '', array(
 				'label' => __('Selected entries action:'))))
-			->addField(new dcFieldSubmit('ok',__('ok'), array()));
+			->addField(new dcFieldSubmit('ok',__('ok'), array()))
+			->addField(new dcFieldHidden('page','1'));
 		$columns_combo = array();
 		foreach ($this->columns as $c) {
@@ -73,7 +79,25 @@
 			__('Order'), 
 			__('Order'), 'orderby', $order_combo,array('singleval'=> true, 'static' => true)));
-		$this->filterset->addFilter(new dcFilterText(
+		$limit = new dcFilterText(
 			'limit',
-			__('Limit'), __('Limit'), 'limit',array('singleval'=> true,'static' =>true)));
+			__('Limit'), __('Limit'), 'limit',array('singleval'=> true,'static' =>true));
+		$this->filterset->addFilter($limit);
+		$this->filterset->setup();
+		parent::setup();
+		$this->nb_items_per_page = $limit->getFields()->getValue();
+		$this->fetchEntries();
+
+	}
+
+	protected function fetchEntries() {
+		$params = new ArrayObject();
+		$offset = $this->nb_items_per_page*($this->page->getValue()-1);
+		$this->filterset->applyFilters($params);
+		$this->nb_items = $this->fetcher->getEntriesCount($params);
+		$entries = $this->fetcher->getEntries($params,$offset,$this->nb_items_per_page);
+		$this->setEntries($entries);
+		/*echo "LIMIT:".$this->nb_items_per_page;
+		echo 'count :'.print_r($this->nb_items,true);
+		echo 'page'.$this->page;*/
 	}
 
@@ -104,44 +128,4 @@
 	public function setFilterSet($fs) {
 		$this->filterset = $fs;
-	}
-
-}
-
-class dcFilterCheckbox extends dcFilter {
-
-	public function __construct($id,$name,$desc) {
-		parent::__construct($id,$name,$desc,$request_param);
-	}
-
-
-
-	public function appendSingleLine($line,$pos) {
-		$f = $this->fields[$pos];
-		$line['ffield'] = $f->getName();
-		if ($this->static) {
-			$line['display_inline'] = true;
-		}
-
-		if ($pos == 0) {
-			$line['fwidget']='filter_checkbox';
-			$line['desc']=$this->desc;
-		};
-	}
-
-	public function addValue($value=NULL) {
-		if (count($this->fields)>0)
-			return;
-		if ($value === NULL) {
-			$value = 1;
-		}
-		$f = new dcFieldCheckbox(
-			$this->getFieldID($pos),
-			$value,
-			array());
-		$this->filterset->addField($f);
-		$this->fields[]=$f;
-	}
-
-	public function applyFilter($params) {
 	}
 
@@ -186,4 +170,13 @@
 }
 
+abstract class dcListFetcher {
+	protected $core;
+	public function __construct($core) {
+		$this->core = $core;
+	}
+
+	abstract function getEntries($params,$offset,$limit);
+	abstract function getEntriesCount($params);
+}
 
 dcItemList::__init__($GLOBALS['core']->tpl);
Index: inc/admin/default-templates/forms/form_layout.html.twig
===================================================================
--- inc/admin/default-templates/forms/form_layout.html.twig	(revision 1153)
+++ inc/admin/default-templates/forms/form_layout.html.twig	(revision 1154)
@@ -126,2 +126,10 @@
 {% endblock endlabel %}
 
+{%- block beginform -%}
+<form {% if class is not empty -%} class="{{class|join(' ')}}" {%- endif %} {% if id is not empty -%} id="{{id}}" {%- endif %}
+ method="{{method}}" action="{{action}}">
+{%- endblock beginform -%}
+
+{% block endform -%}
+</form>
+{%- endblock endform %}
Index: inc/admin/default-templates/forms/formfilter_layout.html.twig
===================================================================
--- inc/admin/default-templates/forms/formfilter_layout.html.twig	(revision 1152)
+++ inc/admin/default-templates/forms/formfilter_layout.html.twig	(revision 1154)
@@ -2,21 +2,21 @@
 
 
-{% block filterset %}
+{% block filterset -%}
 <p>
 	<a href="#" id="toggle-filters">{{ __('Toggle filters and display options') }} </a>
 </p>
 <div class="two-cols">
-{% form filtersetname %}
-	{% set fenv = _context['filterset_' ~ filtersetname] %}
+{% set fenv = _context['filterset_' ~ filtersetname] %}
+{% form filtersetname with {'class':fenv.hide_filters?'hidden':'opened' } -%}
 	<div class="col70">
 		<h3>{{__('Entries filters')}}</h3>
 		<table summary="{{__('Query filters')}}" id="tfilters">
 		<tbody>
-			{% for f in fenv.active_filters %}
+			{%- for f in fenv.active_filters -%}
 				<tr class="{{f.id}}">
 					<td>{{form_field(f.del_id)}}</td>
 					{{block(f.fwidget)}}
 				</tr>
-			{% endfor %}
+			{%- endfor -%}
 		</tbody>
 		</table>
@@ -31,15 +31,15 @@
 	</div>
 	<div class="col30">
-		{% for f in fenv.static_filters %}
+		{%- for f in fenv.static_filters -%}
 			{{block(f.fwidget)}}
-		{% endfor %}
+		{%- endfor -%}
 	</div>
 	<p class="clear margintop"></p>
-{% endform %}
+{%- endform -%}
 </div>
-{% endblock %}
+{%- endblock %}
 
 
-{% block filterenabled %}
+{% block filterenabled -%}
 	<tr class="{{ id }}">';
 		<td>
@@ -49,8 +49,8 @@
 		{{ block(filter) }}
 	</tr>
-{% endblock %}
+{%- endblock %}
 
 
-{% block filter_combo %}
+{% block filter_combo -%}
 	{% if f.display_inline is defined -%}
 		<p id='{{f.filter_id}}'>{{form_field(f.ffield,{},{'label':f.desc,'nestedlabel': true, 'labelclass':'classic' })}}</p>
@@ -59,7 +59,7 @@
 		<td >{{ form_field(f.ffield) }}</td>
 	{%- endif %}
-{% endblock %}
+{%- endblock %}
 
-{% block filter_combo_cont %}
+{% block filter_combo_cont -%}
 	{% if f.display_inline is defined -%}
 		<p id='{{filter_id}}'>{{form_field(f.ffield,{'label':__('or :')})}}</p>
@@ -67,20 +67,20 @@
 		<td id='{{filter_id}}' colspan="2">{{ __('or :') }} </td><td>{{ form_field(f.ffield) }}</td>
 	{%- endif %}
-{% endblock %}
+{%- endblock %}
 
 
-{% block filter_richcombo %}
+{% block filter_richcombo -%}
 	<td id='{{filterd_id}}' title='{{f.desc}}' class="filter-title">{{f.desc}} : </td>
 	<td>{{ form_field(f.fverb)}}</td>
 	<td>{{ form_field(f.ffield) }}</td>
-{% endblock %}
+{%- endblock %}
 
 
-{% block filter_boolean %}
+{% block filter_boolean -%}
 	<td id='{{filterd_id}}' title='{{f.desc}}' class="filter-title" colspan="2">{{f.desc}}</td>
 	<td>{{ form_field(f.ffield) }}</td>
-{% endblock %}
+{%- endblock %}
 
-{% block filter_text %}
+{% block filter_text -%}
 	{% if f.display_inline is defined -%}
 		<p id='{{filter_id}}'>{{form_field(f.ffield,{},{'label':f.desc,'nestedlabel': true, 'labelclass':'classic' })}}</p>
@@ -88,6 +88,6 @@
 		<td id='{{filterd_id}}' title='{{f.desc}}' class="filter-title" colspan="2">{{f.desc}}</td>
 		<td>{{ form_field(f.ffield) }}</td>
-	{% endif %}
-{% endblock %}
+	{%- endif %}
+{%- endblock %}
 
 
Index: inc/admin/default-templates/forms/lists_layout.html.twig
===================================================================
--- inc/admin/default-templates/forms/lists_layout.html.twig	(revision 1152)
+++ inc/admin/default-templates/forms/lists_layout.html.twig	(revision 1154)
@@ -2,4 +2,5 @@
 {% set lenv = _context['list_' ~ listname] %}
 {% if lenv.entries %}
+<p>Pages:</p>
 {% form listname -%}
 {% spaceless %}
Index: inc/core/class.dc.blog.php
===================================================================
--- inc/core/class.dc.blog.php	(revision 1152)
+++ inc/core/class.dc.blog.php	(revision 1154)
@@ -889,8 +889,7 @@
 				$strReq .= 'ORDER BY post_dt DESC ';
 			}
-		}
-		
-		if (!$count_only && !empty($params['limit'])) {
-			$strReq .= $this->con->limit($params['limit']);
+			if (!empty($params['limit'])) {
+				$strReq .= $this->con->limit($params['limit']);
+			}
 		}
 		
Index: inc/prepend.php
===================================================================
--- inc/prepend.php	(revision 1153)
+++ inc/prepend.php	(revision 1154)
@@ -69,4 +69,5 @@
 $__autoload['dcTabExtension']			= dirname(__FILE__).'/admin/class.dc.tab.php';
 $__autoload['dcItemList']			= dirname(__FILE__).'/admin/class.dc.list.php';
+$__autoload['dcListFetcher']			= dirname(__FILE__).'/admin/class.dc.list.php';
 
 foreach (array('dcFilterSet', 'dcFilter','dcFilterCombo','dcFilterText','dcFilterBoolean') as $c) {
