Index: inc/admin/class.dc.filter.php
===================================================================
--- inc/admin/class.dc.filter.php	(revision 1148)
+++ inc/admin/class.dc.filter.php	(revision 1152)
@@ -14,53 +14,8 @@
 
 
-class dcFilterSetExtension extends Twig_Extension {
-	private $filtersets;
-
-	public function __construct($core)
-	{
-		$this->core = $core;
-		$this->tpl = 'formfilter_layout.html.twig';
-	}
-	
-	public function initRuntime(Twig_Environment $environment)
-	{
-		$this->core->tpl->getExtension('dc_form')->addTemplate($this->tpl);
-	}
-	
-	
-	public function getFunctions()
-	{
-		return array(
-			'filterset' => new Twig_Function_Method(
-				$this,
-				'renderFilterSet',
-				array(
-					'is_safe' => array('html'),
-					'needs_context' => true
-		)));
-	}
-
-	
-
-	public function renderFilterSet($context,$name,$attributes=array())
-	{
-		$context['filtersetname']=$name;
-		echo $this->core->tpl->getExtension('dc_form')->renderBlock(
-			'filterset',
-			$context
-		);
-	}
-	
-
-	public function getName()
-	{
-		return 'dc_filterset';
-	}
-
-}
-
-
 class dcFilterSet extends dcForm {
 	protected $filters;		/// <b>array</b> lists of currently applied filters
+	protected $static_filters;
+	protected $all_filters;
 	protected $form_prefix;		/// <b>string</b> displayed form prefix
 	protected $action; 			/// <b>string</b> form action page
@@ -69,4 +24,25 @@
 	protected $core;
 
+	public static function __init__($env) {
+		$env->getExtension('dc_form')->addTemplate('@forms/formfilter_layout.html.twig');
+		$env->addFunction(
+			new Twig_SimpleFunction(
+				'filterset',
+				'dcFilterSet::renderFilterSet',
+				array(
+					'is_safe' => array('html'),
+					'needs_context' => true,
+					'needs_environment' => true
+		)));
+	}
+	
+	public static function renderFilterSet($env,$context,$name,$attributes=array())
+	{
+		$context['filtersetname']=$name;
+		echo $env->getExtension('dc_form')->renderWidget(
+			'filterset',
+			$context
+		);
+	}
 	/**
 	Inits dcFilterSet object
@@ -78,4 +54,6 @@
 		$this->form_prefix=$form_prefix;
 		$this->filters = new ArrayObject();
+		$this->static_filters = new ArrayObject();
+		$this->all_filters = new ArrayObject();
 		$this->action = $action;
 		$this->filtered = false;
@@ -87,6 +65,8 @@
 		$form_combo = array();
 		$form_combo['-'] = '';
+		foreach ($this->all_filters as $filter) {
+			$filter->init();
+		}
 		foreach ($this->filters as $filter) {
-			$filter->init();
 			$form_combo[$filter->id]=$filter->name;
 		}
@@ -110,5 +90,4 @@
 		;
 		$this->setupFields();
-		$submitted = $this->getSubmittedFields();
 		/* Use cases :
 			(1) $_POST not empty for formfilter fields :
@@ -130,5 +109,4 @@
 				$tmp = substr($k,strlen($this->form_prefix));
 				$count = preg_match($allowed_actions,$tmp,$match);
-				echo $action;
 				if ($count==1) {
 					$action = $match[1];
@@ -137,19 +115,19 @@
 			}
 		}
+
 		if ($action !== false) {
 			// Use case (1)
 			if ($action != 'clear_filters' && $action != 'reset')  {
-				$this->setupEditFilters($_POST);
+				$this->setupEditFilters($this->all_filters,$_POST);
 				if ($action == 'add'){
-					if (isset($_POST[$p.'add_filter'])
-						&& isset($this->filters[$_POST[$p.'add_filter']])) {
-					$this->filters[$_POST[$p.'add_filter']]->add();
+					$fname = $p.'add_filter';
+					if (isset($_POST[$fname])
+						&& isset($this->filters[$_POST[$fname]])) {
+					$this->filters[$_POST[$fname]]->add();
 					}
 				} elseif (strpos($action,'del_') === 0) {
 					$count = preg_match('#del_(.+)_([0-9]+)#',$action,$match);
-					echo "action=".$action;
 					if (($count == 1) && isset($this->filters[$match[1]])) {
 						$this->filters[$match[1]]->remove($match[2]);
-						echo "remove";
 					}
 				} elseif ($action=="apply") {
@@ -165,7 +143,12 @@
 			if (isset($_POST[$p."query"])) {
 				parse_str($_POST[$p."query"],$out);
-				$this->setupAppliedFilters($out);
+				$this->setupAppliedFilters($this->all_filters,$out);
 				if ($action == 'reset') {
-					$this->setupEditFilters($out);
+					$this->setupEditFilters($this->all_filters,$out);
+				} elseif ($action == 'clear_filters') {
+					$this->setupEditFilters($this->static_filters,$out);
+					foreach ($this->filters as $f) {
+						$f->cleanup();
+					}
 				}
 			}
@@ -184,8 +167,14 @@
 				$get = new ArrayObject(array_merge($this->loadFilters(),$get));
 			}
-			$this->setupEditFilters($get);
-			$this->setupAppliedFilters($get);
-		}
-		$queryParams = $this->getListedFilters();
+			$this->setupEditFilters($this->all_filters,$get);
+
+			$this->setupAppliedFilters($this->all_filters,$get);
+		}
+		foreach ($this->static_filters as $f) {
+			if (!$f->isEnabled()) {
+				$f->add();
+			}
+		}
+		$queryParams = $this->getAppliedFilters();
 		$this->addField(
 			new dcFieldHidden($this->form_prefix.'query',
@@ -224,12 +213,12 @@
 	@param	form_data	<b>array</b>	form values (usually $_GET or $_POST)
 	*/
-	protected function setupEditFilters ($form_data) {
+	protected function setupEditFilters ($filters,$form_data) {
 		$this->hideform = true;
-		foreach ($this->filters as $filter) {
+		foreach ($filters as $filter) {
 			$filter->setupFields ($form_data);
 		}
 	}
-	protected function setupAppliedFilters ($form_data) {
-		foreach ($this->filters as $filter) {
+	protected function setupAppliedFilters ($filters,$form_data) {
+		foreach ($filters as $filter) {
 			$filter->setupAppliedFilter ($form_data);
 		}
@@ -251,4 +240,7 @@
 			}
 		}
+		foreach ($this->static_filters as $f) {
+			$f->serialize($arr);
+		}
 		return $arr;
 	}
@@ -261,9 +253,16 @@
 		$filter->setFormPrefix($this->form_prefix);
 		$filter->setFilterSet($this);
-		$this->filters[$filter->id] = $filter;
+		$this->all_filters[$filter->id] = $filter;
+		if ($filter->isStatic()) {
+			$this->static_filters[$filter->id] = $filter;
+		} else {
+			$this->filters[$filter->id] = $filter;
+		}
 		return $this;
 	}
+
 	public function getContext() {
 		$fcontext = new ArrayObject();
+		$sfcontext = new ArrayObject();
 		foreach ($this->filters as $f) {
 			if($f->isEnabled()) {
@@ -271,13 +270,17 @@
 			}
 		}
+		foreach ($this->static_filters as $f) {
+			$f->appendEditLines ($sfcontext);
+		}
 		return array(
 			'active_filters' => $fcontext, 
+			'static_filters' => $sfcontext,
 			'prefix'=>$this->form_prefix);
 	}
 
-	protected function getListedFilters() {
+	protected function getAppliedFilters() {
 		$arr = new ArrayObject();
-		foreach ($this->filters as $f) {
-			if ($f->isEnabled())
+		foreach ($this->all_filters as $f) {
+			if ($f->isApplied())
 				$f->updateAppliedValues($arr);
 		}
@@ -292,5 +295,5 @@
 	*/
 	public function applyFilters($params) {
-		foreach ($this->filters as $filter) {
+		foreach ($this->all_filters as $filter) {
 			if ($filter->isApplied()) {
 				$filter->applyFilter($params);
@@ -318,33 +321,28 @@
 	public $name;				///<b>string</b> filter name
 	public $desc;				///<b>string</b> field description
+	public $filter_id;			///<b>string</b> field id (global to the page)
 	protected $request_param;	///<b>string</b> resulting parameter array key
-	protected $enabled;			///<b>string</b> true if filter is enabled
-	protected $fields;			///<b>array</b> currently edited values
+	protected $field;			///<b>array</b> currently edited values
 	protected $avalues;			///<b>array</b> currently applied values
-	public $filter_id;			///<b>string</b> field id (global to the page)
-
-	public function __construct ($id,$name,$desc,$request_param) {
-		$this->id = $id;
-		$this->name=$name;
-		$this->desc = $desc;
-		$this->request_param = $request_param;
-		$this->enabled=false;
-		$this->avalues = array();
-		$this->filter_id = $this->id;
-		$this->fields = array();
-	}
-
-	public function setupFields($data) {
-		$val = $this->parseData($data);
-		$pos=0;
-		foreach($val['values'] as $v) {
-			$this->addField($pos,$v);
-			$pos++;
-		}
-		$this->enabled = ($pos> 0);
-	}//	abstract public function setupFields($data);
-
-
-	public function init() {
+	protected $static;
+	protected $options;
+	protected $multiple;
+
+	public function __construct ($id,$name,$desc,$request_param,$options=array()) {
+		$this->id  				= $id;
+		$this->name 			=$name;
+		$this->desc 			= $desc;
+		$this->request_param	= $request_param;
+		$this->avalues   		= array();
+		$this->filter_id 		= $this->id;
+		$this->static    		= false;
+		$this->multiple    		= false;
+		$this->options   		= $options;
+		if (isset($options['static']) && $options['static']) {
+			$this->static 		= true;
+		}
+		if (isset($options['multiple']) && $options['multiple']) {
+			$this->multiple		= true;
+		}
 	}
 
@@ -357,13 +355,24 @@
 	*/
 	protected function parseData($data) {
-		$count=0;
-		$arr = array();
-		while (isset($data[$this->getFieldId($count)])) {
-			$arr[] = $data[$this->getFieldId($count)];
-			$count++;
-		}
+		$arr = $this->field->parseValues($data);
 		return array('values' => $arr);
 	}
-	
+
+	public function isStatic() {
+		return $this->static;
+	}
+
+	public function setupFields($data) {
+		$this->field->setup($data);
+	}
+
+
+	public function init() {
+	}
+
+	public function cleanup() {
+		$this->field->setValues(array());
+	}
+
 	public function setupAppliedFilter($data) {
 		$this->avalues = $this->parseData($data);
@@ -371,7 +380,5 @@
 
 	public function updateAppliedValues($arr) {
-		foreach ($this->avalues['values'] as $k=>$v) {
-			$arr[$this->getFieldID($k)]=$v;
-		}
+		$arr[$this->filter_id] = $this->avalues['values'];
 	}
 
@@ -396,19 +403,4 @@
 
 	/**
-	Get a field id
-	
-	@param	pos		<b>integer</b>	position of field, in case of multiple field (0 if only 1 field set, default value)
-	@return	<b>string</b> The field ID
-	*/
-	protected function getFieldId($pos=0) {
-		if ($pos == 0) {
-			return $this->filter_id;
-		} else {
-			return $this->filter_id.'_'.$pos;
-		}
-	}
-	
-	
-	/**
 	Tells whether the filter is enabled or not
 	
@@ -416,8 +408,8 @@
 	*/
 	public function isEnabled() {
-		return $this->enabled;
-	}
-	
-	protected abstract function addField($pos,$value=NULL);
+		return count($this->field) != 0;
+	}
+	
+	protected abstract function addValue($value=NULL);
 
 	/**
@@ -425,6 +417,7 @@
 	*/
 	public function add() {
-		$this->addField(count($this->fields));
-		$this->enabled = true;
+		if (count($this->field) > 1 && !$this->multiple)
+			return;
+		$this->addValue();
 	}
 	
@@ -433,11 +426,7 @@
 	*/
 	public function remove($pos) {
-		if (isset($this->fields[$pos])) {
-			$this->filterset->removeField($this->fields[$pos]);
-			array_splice($this->fields,$pos,1);
-			for ($cur=$pos; $cur<count($this->fields);$cur++) {
-				$this->filterset->renameField($this->fields[$cur],$this->getFieldID($cur));
-			}
-			$this->enabled = (count($this->fields)!=0);
+		$values = $this->field->getValues();
+		if (isset($values[$pos])) {
+			$this->field->delValue($pos);
 		}
 
@@ -447,5 +436,5 @@
 
 	public function appendEditLines($ctx) {
-		foreach ($this->fields as $cur => $f) {
+		foreach ($this->field->getValues() as $cur => $f) {
 			$line = new ArrayObject();
 			$line['lineclass'] = $this->id;
@@ -465,6 +454,8 @@
 
 	public function serialize($arr) {
-		for ($cur=0; $cur < count($this->fields); $cur++) {
-			$arr[$this->getFieldId($cur)]=$this->fields[$cur]->getValue();
+		if (count($this->fields) == 1) {
+			$arr[$this->filter_id]=$this->field->getValue();
+		} else {
+			$arr[$this->filter_id]=$this->field->getValues();
 		}
 	}
@@ -492,4 +483,40 @@
 
 
+
+class dcFilterText extends dcFilter {
+
+	public function init() {
+		$this->field = new dcFieldText(
+			$this->filter_id,
+			NULL);
+		$this->filterset->addField($this->field);
+		$this->multiple = false;
+	}
+
+
+	public function appendSingleLine($line,$pos) {
+		$line['ffield'] = $this->field->getName();
+		if ($this->static) {
+			$line['display_inline'] = true;
+		}
+
+		if ($pos == 0) {
+			$line['fwidget']='filter_text';
+			$line['desc']=$this->desc;
+		};
+	}
+
+	protected function addValue($value=NULL) {
+		if ($value === NULL) {
+			$value = '';
+		}
+		$this->field->addValue($value);
+	}
+
+	public function applyFilter($params) {
+		$params[$this->request_param]=$this->avalues['values'][0];
+	}
+	
+}
 /**
 @ingroup DC_CORE
@@ -499,14 +526,59 @@
 Handle combo filter on admin side. Can be single or multi-valued
 */
-class comboFilter extends dcFilter {
-	protected $options;
+class dcFilterCombo extends dcFilter {
+	protected $combo;
+	
+	public function __construct($id,$name,$desc,$request_param,$combo,$options=array()) {
+		parent::__construct($id,$name,$desc,$request_param,$options);
+		$this->combo = $combo;
+	}
+	public function init() {
+		$this->field = new dcFieldCombo(
+			$this->filter_id,
+			NULL,
+			$this->combo);
+		$this->filterset->addField($this->field);
+	}
+
+	protected function addValue($value=NULL) {
+		if ($value === NULL) {
+			$value = current($this->combo);
+		}
+		$this->field->addValue($value);
+	}
+
+	public function appendSingleLine($line,$pos) {
+		if ($this->static) {
+			$line['display_inline'] = true;
+		}
+		$line['ffield'] = $this->field->getName();
+		$line['foffset'] = $pos;
+		if ($pos == 0) {
+			$line['fwidget']='filter_combo';
+			$line['desc']=$this->desc;
+		} else {
+			$line['fwidget']='filter_combo_cont';
+		};
+	}
+	
+	public function applyFilter($params) {
+		$attr = $this->request_param;
+		if ($this->multiple)
+			$params[$attr]=$this->avalues['values'];
+		else
+			$params[$attr]=$this->avalues['values'][0];
+	}
+
+}
+
+/**
+@ingroup DC_CORE
+@nosubgrouping
+@brief abstract filter class.
+
+Handle combo filter on admin side. Can be single or multi-valued
+*/
+class dcFilterRichCombo extends dcFilterCombo {
 	protected $verb;
-	protected $extra;
-	
-	public function __construct($id,$name,$desc,$request_param,$options,$extra=array()) {
-		parent::__construct($id,$name,$desc,$request_param);
-		$this->options = $options;
-		$this->extra = $extra;
-	}
 
 	public function init() {
@@ -519,59 +591,33 @@
 				'isnot'=>__('is not'))
 		);
+		$this->filterset->addField($this->verb);
 	}
 
 	protected function parseData($data) {
 		$val = parent::parseData($data);
-		$val['verb'] = $this->verb->parseValue($data);
+		$v = $this->verb->parseValues($data);
+		if (isset($v[0]) && $v[0] === 'isnot')
+			$val['verb'] = 'isnot';
+		else
+			$val['verb'] ='is';
 		return $val;
 	}
 
-	protected function addField($pos,$value=NULL) {
-		if ($value === NULL) {
-			$value = current($this->options);
-		}
-		$f = new dcFieldCombo(
-			$this->getFieldID($pos),
-			$value,
-			$this->options);
-		$this->filterset->addField($f);
-		$this->fields[]=$f;
-	}
-
 	public function setupFields($data) {
-		/*$val = $this->parseData($data);
-		$this->verb->setup($data);
-		$pos=0;
-		foreach($val['values'] as $v) {
-			$this->addField($pos,$v);
-		}
-		$this->enabled = (count($this->fields) != 0);*/
 		parent::setupFields($data);
 		$this->verb->setup($data);
-		$this->filterset->addField($this->verb);
-	}
+	}
+
 	public function updateAppliedValues($arr) {
 		parent::updateAppliedValues($arr);
-		if ($this->enabled) {
-			$arr[$this->verb->getName()] = $this->verb->getValue();
-		}
-	}
-	public function add() {
-		if (isset($this->extra['singleval']) && (count($this->fields) > 0))
-			return;
-		parent::add();
+		$arr['verb'] = $this->verb->getValue();
 	}
 
 	public function appendSingleLine($line,$pos) {
-		$f = $this->fields[$pos];
-		$line['ffield'] = $f->getName();
-
+		parent::appendSingleLine($line,$pos);
 		if ($pos == 0) {
-			$line['fwidget']='filter_combo';
 			$line['fverb'] = $this->verb->getName();
-			$line['desc']=$this->desc;
-		} else {
-			$line['fwidget']='filter_combo_cont';
-		};
+			$line['fwidget']='filter_richcombo';
+		} 
 	}
 	
@@ -582,102 +628,15 @@
 	
 	public function applyFilter($params) {
+		parent::applyFilter($params);
 		$attr = $this->request_param;
 		if ($this->avalues['verb'] != "is") {
 			$params[$attr."_not"] = true;
 		}
-		if (isset($this->extra['singleval']))
-			$params[$attr]=$this->avalues['values'][0];
-		else
-			$params[$attr]=$this->avalues['values'];
 	}
 
 }
 
-class booleanFilter extends dcFilter {
-	protected $options;
-	protected $verb;
-	
-	public function __construct($id,$name,$desc,$request_param,$options) {
-		parent::__construct($id,$name,$desc,$request_param);
-		$this->options = $options;
-	}
-
-
-
-	public function appendSingleLine($line,$pos) {
-		$f = $this->fields[$pos];
-		$line['ffield'] = $f->getName();
-
-		if ($pos == 0) {
-			$line['fwidget']='filter_boolean';
-			$line['desc']=$this->desc;
-		};
-	}
-
-	protected function addField($pos,$value=NULL) {
-		if (count($this->fields)>0)
-			return;
-		if ($value === NULL) {
-			$value = 1;
-		}
-		$f = new dcFieldCombo(
-			$this->getFieldID($pos),
-			$value,
-			$this->options);
-		$this->filterset->addField($f);
-		$this->fields[]=$f;
-	}
-
-	public function applyFilter($params) {
-		$params[$this->request_param]=$this->avalues['values'][0];
-	}
-	
-}
-
-class textFilter extends dcFilter {
-	protected $options;
-	protected $verb;
-	
-	public function __construct($id,$name,$desc,$request_param,$options) {
-		parent::__construct($id,$name,$desc,$request_param);
-		$this->options = $options;
-	}
-
-	public function setupFields($data) {
-		$val = $this->parseData($data);
-		foreach($val['values'] as $k=>$v) {
-			$this->addField($k,$v);
-		}
-		$this->enabled = (count($this->fields) != 0);
-	}
-
-	public function appendSingleLine($line,$pos) {
-		$f = $this->fields[$pos];
-		$line['ffield'] = $f->getName();
-
-		if ($pos == 0) {
-			$line['fwidget']='filter_boolean';
-			$line['desc']=$this->desc;
-		};
-	}
-
-	protected function addField($pos,$value=NULL) {
-		if (count($this->fields)>0)
-			return;
-		if ($value === NULL) {
-			$value = '';
-		}
-		$f = new dcFieldText(
-			$this->getFieldID($pos),
-			$value);
-		$this->filterset->addField($f);
-		$this->fields[]=$f;
-	}
-
-	public function applyFilter($params) {
-		$params[$this->request_param]=$this->avalues['values'][0];
-	}
-	
-}
-
+
+
+dcFilterSet::__init__($GLOBALS['core']->tpl);
 ?>
Index: inc/admin/class.dc.form.php
===================================================================
--- inc/admin/class.dc.form.php	(revision 1147)
+++ inc/admin/class.dc.form.php	(revision 1152)
@@ -90,6 +90,7 @@
 	{
 		$this->core = $core;
-		$this->tpl = 'form_layout.html.twig';
+		$this->tpl = array('@forms/form_layout.html.twig');
 		$this->forms = array();
+		$this->blocks = array();
 		$this->currentForm = null;
 	}
@@ -98,11 +99,17 @@
 	{
 		$this->twig = $environment;
-		$this->template = $this->twig->loadTemplate($this->tpl);
-		$this->blocks = $this->template->getBlocks();
+		$this->twig->getLoader()->addPath(dirname(__FILE__).'/default-templates/forms','forms');
+		foreach ($this->tpl as $tpl) {
+			$this->template = $this->twig->loadTemplate($tpl);
+			$this->blocks = array_merge($this->blocks,$this->template->getBlocks());
+		}
 	}
 	
 	public function addTemplate($tpl) {
-		$t = $this->twig->loadTemplate($tpl);
-		$this->blocks = array_merge($this->blocks,$t->getBlocks());
+		$this->tpl[]=$tpl;
+		if (isset($this->twig)) {
+			$this->template = $this->twig->loadTemplate($tpl);
+			$this->blocks = array_merge($this->blocks,$this->template->getBlocks());
+		}
 	}
 
@@ -115,17 +122,27 @@
 	{
 		return array(
-			'form_field' => new Twig_Function_Method(
-				$this,
-				'renderWidget',
+			new Twig_SimpleFunction(
+				'widget',
+				array($this,'renderWidget'),
 				array('is_safe' => array('html'))
 			),
-			'_form_is_choice_group' => new Twig_Function_Method(
-				$this,
-				'isChoiceGroup',
+			new Twig_SimpleFunction(
+				'haswidget',
+				array($this,'hasWidget'),
 				array('is_safe' => array('html'))
 			),
-			'_form_is_choice_selected' => new Twig_Function_Method(
-				$this,
-				'isChoiceSelected',
+			new Twig_SimpleFunction(
+				'form_field',
+				array($this,'renderField'),
+				array('is_safe' => array('html'))
+			),
+			new Twig_SimpleFunction(
+				'_form_is_choice_group',
+				array($this,'isChoiceGroup'),
+				array('is_safe' => array('html'))
+			),
+			new Twig_SimpleFunction(
+				'_form_is_choice_selected',
+				array($this,'isChoiceSelected'),
 				array('is_safe' => array('html'))
 			)
@@ -148,5 +165,10 @@
 	}
 	
-	public function renderBlock($name,$attr) {
+	public function hasWidget($name) {
+		return isset($this->blocks[$name]);
+	}
+	public function renderWidget($name,$attr) {
+		if (!isset($this->blocks[$name]))
+			return '';
 		echo $this->template->renderBlock(
 			$name,
@@ -160,9 +182,9 @@
 	}
 
-	public function renderWidget($name,$attributes=array(),$extra=array())
+	public function renderField($name,$attributes=array(),$extra=array())
 	{
 		$field = $this->currentForm->$name;
 		if ($field) {
-			$attr = $field->getAttributes();
+			$attr = $field->getAttributes($attributes);
 			if (isset($attr['attr'])) {
 				$attr['attr'] = array_merge($attr['attr'],$attributes);
@@ -170,5 +192,5 @@
 				$attr['attr'] = $attributes;
 			}
-			$this->renderBlock(
+			$this->renderWidget(
 				$field->getWidgetBlock(),
 				array_merge(
@@ -183,5 +205,5 @@
 	{
 		foreach ($this->currentForm->getHiddenFields() as $h) {
-			$this->renderWidget($h->getName());
+			$this->renderField($h->getName());
 		}
 	}
@@ -240,4 +262,7 @@
 	protected $errors;
 	
+	public function addTemplate($t) {
+		$this->core->tpl->getExtension('dc_form')->addTemplate($t);
+	}
 
     /**
@@ -355,5 +380,4 @@
 			$this->fields[$newname] = $field;
 		}
-		//print_r($this->fields);
 	}
 	public function begin()
@@ -386,5 +410,5 @@
 	{
 		if (isset($this->fields[$name])) {
-			$this->fields[$name]->setAttribute('value',$value);
+			$this->fields[$name]->setValue($value);
 		}
 	}
@@ -449,10 +473,11 @@
  * Template form field
  */
-abstract class dcField
-{
-	protected $attributes;
+abstract class dcField implements Countable
+{
+	protected $options;
 	protected $name;
-	protected $value;
+	protected $values;
 	protected $id;
+	protected $multiple;
 	protected $defined;
 	
@@ -468,53 +493,96 @@
 	}
 	
-	public function __construct($name,$value,$attributes=array())
+	public function __construct($name,$values,$options=array())
 	{
 		$this->setNID($name);
-		$this->attributes = $attributes;
-		$this->setValue($value);
-		$this->attributes['name'] = $this->name;
-		$this->attributes['id'] = $this->id;
+		$this->options = new ArrayObject($options);
+		if ($values === NULL){
+			$values = array();
+		}
+		$this->setValues($values);
 		$this->defined = false;
-	}
-	
-	public function setValue($value) {
-		$this->value = $value;
-		$this->attributes['value'] = $this->value;
-	}
-
-	public function getValue() {
-		return $this->value;
+		$this->multiple = (isset($options['multiple']) && $options['multiple']);
+
+	}
+	
+	public function setValue($value,$offset=0) {
+		$this->values[$offset] = $value;
+	}
+
+	public function setValues($values) {
+		if (is_array($values)) {
+			$this->values = $values;
+		} elseif ($values !== NULL) {
+			$this->values = array($values);
+		}
+
+	}
+
+	public function getValues() {
+		return $this->values;
+	}
+
+	public function getValue($offset=0) {
+		if (isset($this->values[$offset])) {
+			return $this->values[$offset];
+		}
+	}
+
+	public function addValue($value) {
+		$this->values[] = $value;
+	}
+	public function delValue($offset) {
+		if (isset($this->values[$offset])) {
+			array_splice($this->values,$offset,1);
+		}
+	}
+
+	public function count() {
+		return count($this->values);
 	}
 
 	public function __toString()
 	{
-		return $this->value;
+		return join(',',$this->values);
 	}
 	
 	abstract public function getWidgetBlock();
 	
-	public function setAttribute($name,$value)
-	{
-		$this->attributes[$name] = $value;
-	}
-	
-	public function getAttributes()
-	{
-		return $this->attributes;
-	}
-	
+	public function getAttributes($options)
+	{
+		$offset = isset($options['offset']) ? $options['offset'] : 0;
+
+		$attr = $this->options->getArrayCopy();
+		if (isset($this->values[$offset])) {
+			$attr['value'] = $this->values[$offset];
+		} else {
+			$attr['value'] = $this->getDefaultValue();
+		}
+		if ($offset==0) {
+			$attr['id']=$this->id;
+		}
+		$attr['name'] = $this->name;
+		if ($this->multiple) {
+			$attr['name'] = $attr['name'].'[]';
+		}
+		return $attr;
+	}
+	
+	public function getDefaultValue() {
+		return '';
+	}
+
 	public function getName()
 	{
 		return $this->name;
 	}
+
 	public function setName($name) {
 		$this->setNID($name);
-		$this->attributes['name'] = $this->name;
-		$this->attributes['id'] = $this->id;
 	}
 
 	public function check()
 	{
-		if (!$this->defined && $this->attributes['defined']) {
+		if (!$this->defined && $this->options['mandatory']) {
 			throw new InvalidFieldException(sprintf(
 				'Field "%s" is mandatory',
@@ -524,16 +592,20 @@
 	}
 	
-	public function parseValue($from) {
-		if (isset($from[$this->id])) {
-			return $from[$this->id];
-		}
-		return null;
+	public function parseValues($from) {
+		if (isset($from[$this->name])) {
+			$n = $from[$this->name];
+			if (!is_array($n)) {
+				$n = array($n);
+			}
+			return $n;
+		}
+		return array();
 	}
 
 	public function setup($from)
 	{
-		$value = $this->parseValue($from);
-		if ($value !== null) {
-			$this->setValue($value);
+		$values = $this->parseValues($from);
+		if (count($values)) {
+			$this->setValues($values);
 			$this->defined = true;
 		}
@@ -546,4 +618,5 @@
 }
 
+
 /**
  * Template form field of type "password"
@@ -599,4 +672,8 @@
 		return "field_checkbox";
 	}
+
+	public function getDefaultValue() {
+		return 0;
+	}
 }
 
@@ -607,16 +684,16 @@
 {
 	protected $action;
-	
-	public function __construct($name,$value,$attributes=array())
-	{
-		parent::__construct($name,$value,$attributes);
-		
-		if (isset($attributes['action'])) {
-			$this->action = $attributes['action'];
+
+	public function __construct($name,$values,$options=array())
+	{
+		parent::__construct($name,$values,$options);
+
+		if (isset($options['action'])) {
+			$this->action = $options['action'];
 		} else {
 			$this->action = NULL;
 		}
 	}
-	
+
 	public function getAction()
 	{
@@ -641,11 +718,10 @@
 class dcFieldCombo extends dcField
 {
-	protected $options;
-	
-	public function __construct($name,$value,$options,$attributes=array())
-	{
-		$this->options = $options;
-		parent::__construct($name,$value,$attributes);
-		$this->attributes['options']=$options;
+	protected $combo;
+	
+	public function __construct($name,$value,$combo,$options=array())
+	{
+		$this->combo = $combo;
+		parent::__construct($name,$value,$options);
 	}
 	
@@ -655,13 +731,26 @@
 	}
 
-	public function parseValue($from) {
-
-		$v = parent::parseValue($from);
-		if (!isset($this->options[$v])) {
-			return $this->value;
-		} else {
-			return $v;
-		}
-	}
-}
+	public function getDefaultValue() {
+		return current($this->combo);
+	}
+
+	public function parseValues($from) {
+		$values = parent::parseValues($from);
+		if (!is_array($values)) {
+			$values = array($values);
+		}
+		foreach ($values as &$v) {
+			if (!isset($this->combo[$v]))
+			$v = $this->getDefaultValue();
+		}
+		return $values;
+	}
+
+	public function getAttributes($options) {
+		$attr = parent::getAttributes($options);
+		$attr['options'] = $this->combo;
+		return $attr;
+	}
+}
+
 ?>
Index: inc/admin/class.dc.list.php
===================================================================
--- inc/admin/class.dc.list.php	(revision 1152)
+++ inc/admin/class.dc.list.php	(revision 1152)
@@ -0,0 +1,191 @@
+<?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 -----------------------------------------
+
+class dcItemList extends dcForm {
+
+	protected $columns;
+	protected $entries;
+	protected $filterset;
+	protected $selection;
+
+
+	public static function __init__($env) {
+		$env->getExtension('dc_form')->addTemplate('@forms/lists_layout.html.twig');
+		$env->addFunction(
+			new Twig_SimpleFunction(
+				'listitems',
+				'dcItemList::renderList',
+				array(
+					'is_safe' => array('html'),
+					'needs_context' => true,
+					'needs_environment' => true
+		)));
+	}
+
+	public static function renderList($env,$context,$name,$attributes=array())
+	{
+		$context['listname']=$name;
+		echo $env->getExtension('dc_form')->renderWidget(
+			'entrieslist',
+			$context
+		);
+	}
+	/**
+	Inits dcItemList object
+	
+	@param	core		<b>dcCore</b>		Dotclear core reference
+	@param	form_prefix	<b>string</b>		form prefix to use for parameters
+	*/
+	public function __construct($core,$name,$action,$form_prefix="f_") {
+		parent::__construct($core,$name,$action,'POST');
+		$this->entries = array();
+		$this->columns = array();
+		$this->selection = new dcFieldCheckbox('entries',NULL,array('multiple' => true));
+		$this->addField($this->selection);
+	}
+
+	public function setup() {
+		parent::setup();
+		$this
+			->addField(new dcFieldCombo('action',$this->actions_combo, '', array(
+				'label' => __('Selected entries action:'))))
+			->addField(new dcFieldSubmit('ok',__('ok'), array()));
+		$columns_combo = array();
+		foreach ($this->columns as $c) {
+			$columns_combo[$c->getID()] = $c->getName();
+		}
+		$this->filterset->addFilter(new dcFilterCombo(
+			'sortby',
+			__('Sort By'), 
+			__('Sort by'), 'sortby', $columns_combo,array('singleval'=> true,'static' => true)));
+		$order_combo = array('asc' => __('Ascending'),'desc' => __('Descending'));
+		$this->filterset->addFilter(new dcFilterCombo(
+			'order',
+			__('Order'), 
+			__('Order'), 'orderby', $order_combo,array('singleval'=> true, 'static' => true)));
+		$this->filterset->addFilter(new dcFilterText(
+			'limit',
+			__('Limit'), __('Limit'), 'limit',array('singleval'=> true,'static' =>true)));
+	}
+
+	public function setEntries($entries) {
+		$this->entries = $entries;
+		$this->core->tpl->addGlobal('list_'.$this->name,$this->getContext());
+		foreach ($this->entries as $e) {
+			$this->selection->addValue($e->post_id);
+		}
+	}
+
+	public function getContext() {
+		$ccontext = new ArrayObject();
+		foreach ($this->columns as $c) {
+			$c->appendEditLines($ccontext);
+		}
+		return array(
+			'cols' => $ccontext,
+			'entries' => $this->entries);
+	}
+
+	public function addColumn($c) {
+		$this->columns[] = $c;
+		$c->setForm($this);
+		return $this;
+	}
+
+	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) {
+	}
+
+}
+
+class dcColumn {
+	protected $form;
+	protected $id;
+	protected $name;
+	protected $sortable;
+	protected $col_id;
+
+	public function __construct($id, $name, $col_id,$attributes=array()) {
+		$this->id = $id;
+		$this->name = $name;
+		$this->col_id = $col_id;
+	}
+
+	public function getName() {
+		return $this->name;
+	}
+
+	public function getID() {
+		return $this->id;
+	}
+
+	public function getColID(){
+		return $this->col_id;
+	}
+
+	public function setForm($f){
+		$this->form = $f;
+	}
+
+	public function appendEditLines($line) {
+		$line[] = array (
+			'name' => $this->name,
+			'col_id' => $this->col_id,
+			'widget' => 'col_'.$this->id);
+	}
+
+}
+
+
+dcItemList::__init__($GLOBALS['core']->tpl);
+
+?>
Index: inc/admin/default-templates/form_layout.html.twig
===================================================================
--- inc/admin/default-templates/form_layout.html.twig	(revision 1148)
+++ 	(revision )
@@ -1,122 +1,0 @@
-{# Form Fields #}
-{# Heavily inspired from Symfony Framework #}
-
-{% block field_text %}
-{% spaceless %}
-	{% set type = type|default('text') %}
-	{{ block('field_input') }}
-{% endspaceless %}
-{% endblock field_text %}
-
-{% block field_submit %}
-{% spaceless %}
-	{% set type = type|default('submit') %}
-	{{ block('field_input') }}
-{% endspaceless %}
-{% endblock field_submit %}
-
-{% block field_textarea %}
-{% spaceless %}
-	{{ block('startlabel') }}
-    <textarea {{ block('field_attr') }}>{{ value }}</textarea>
-    {{ block('endlabel') }}
-{% endspaceless %}
-{% endblock field_textarea %}
-
-{% block field_password %}
-{% spaceless %}
-	{% set type = type|default('password') %}
-	{{ block('field_input') }}
-{% endspaceless %}
-{% endblock field_password %}
-
-{% block field_hidden %}
-    {% set type = type|default('hidden') %}
-    {{ block('field_input') }}
-{% endblock field_hidden %}
-
-{% block field_input %}
-{% autoescape "html" %}
-{% spaceless %}
-    {% set type = type|default('text') %}
-    {{ block('startlabel') }}
-	<input type="{{ type }}" {{ block('field_attr') }} {% if value is not empty %}value="{{ value }}" {% endif %} />
-    {{ block('endlabel') }}
-{% endspaceless %}
-{% endautoescape %}
-{% endblock field_input %}
-
-{% block field_checkbox %}
-{% spaceless %}
-	{% if label is not empty %}
-		<label for="{{name}}" class="classic">
-	{% endif %}
-    <input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
-	{% if label is not empty %}
-		{{ label }}</label>
-	{% endif %}
-{% endspaceless %}
-{% endblock field_checkbox %}
-
-{% block field_attr %}
-{% spaceless %}
- id="{{id}}" name="{{name}}" {% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %}
-    {% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %}
-{% endspaceless %}
-{% endblock field_attr %}
-
-{% block field_options %}
-{% spaceless %}
-    {% for choice, label in options %}
-        {% if _form_is_choice_group(label) %}
-            <optgroup label="{{ choice }}">
-                {% for nestedChoice, nestedLabel in label %}
-                    <option value="{{ nestedChoice }}"{% if nestedChoice == value %} selected="selected"{% endif %}>{{ nestedLabel }}</option>
-                {% endfor %}
-            </optgroup>
-        {% else %}
-            <option value="{{ choice }}"{% if choice == value %} selected="selected"{% endif %}>{{ label|raw }}</option>
-        {% endif %}
-    {% endfor %}
-{% endspaceless %}
-{% endblock field_options %}
-
-{% block field_combo %}
-{% spaceless %}
-    {{ block('startlabel') }}
-    <select {{ block('field_attr') }}>
-        {{ block('field_options') }}
-    </select>
-    {{ block('endlabel') }}
-{% endspaceless %}
-{% endblock field_combo %}
-{#
-{% block label %}
-{% spaceless %}
-	{% if label is not empty %}
-		<label for="{{name}}" {% if required is not empty %}class="required"> <abbr title="{{__('Required field')}}">*</abbr>{% else %}>{% endif %} {{label}}</label>
-	{% endif %}
-{% endspaceless %}
-{% endblock label %}
-#}
-
-{% block startlabel %}
-{% spaceless %}
-    {% if label is not empty %}
-        {% if required is not empty %}
-            {% set labelclass = labelclass + " required" %}
-        {% endif %}
-        <label for="{{name}}" {% if labelclass is not empty %}class="{{labelclass}}"{% endif %} {% if required is not empty %}<abbr title="{{__('Required field')}}">*</abbr>{% else %}>{% endif %} {{label}}
-        {% if nestedlabel is empty %}</label> {% endif %}
-    {% endif %}
-{% endspaceless %}
-{% endblock startlabel %}
-
-{% block endlabel %}
-{% spaceless %}
-    {% if label is not empty %}
-        {% if nestedlabel is not empty %}</label>{% endif %}
-    {% endif %}
-{% endspaceless %}
-{% endblock endlabel %}
-
Index: inc/admin/default-templates/formfilter_layout.html.twig
===================================================================
--- inc/admin/default-templates/formfilter_layout.html.twig	(revision 1147)
+++ 	(revision )
@@ -1,82 +1,0 @@
-{# Form filter default layout #}
-
-
-{% 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] %}
-	<div class="col70">
-		<h3>{{__('Entries filters')}}</h3>
-		<table summary="{{__('Query filters')}}" id="tfilters">
-		<tbody>
-			{% for f in fenv.active_filters %}
-				<tr class="{{f.id}}">
-					<td>{{form_field(f.del_id)}}</td>
-					{{block(f.fwidget)}}
-				</tr>
-			{% endfor %}
-		</tbody>
-		</table>
-		<h3 class="margintop">{{ __('Add a filter') }}</h3>
-		<p id="available_filters">
-			{{ form_field(fenv.prefix ~ 'add_filter')}} {{ form_field(fenv.prefix ~ 'add') }}
-		</p>
-		<p class="clear">{{form_field(fenv.prefix ~ 'clear_filters',{'class':'delete'})}} {{form_field(fenv.prefix ~ 'reset')}}</p>
-		<p class="clear margintop">
-		{{ form_field(fenv.prefix ~ 'apply')}}
-		</p>
-	</div>
-	<div class="col30">
-	</div>
-	<p class="clear margintop"></p>
-{% endform %}
-</div>
-{% endblock %}
-
-
-{% block filterenabled %}
-	<tr class="{{ id }}">';
-		<td>
-			<input id="{{ del_id }}" class="delete" type="submit" title="{{__('Delete the following filter : ') }}"
-			value=" - " name=" {{ del_id }}"/>
-		</td>
-		{{ block(filter) }}
-	</tr>
-{% endblock %}
-
-
-{% block filter_combo %}
-	<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 %}
-
-{% block filter_combo_cont %}
-	<td id='{{filter_id}}' colspan="2">{{ __('or :') }} </td><td>{{ form_field(f.ffield) }}</td>
-{% endblock %}
-
-{% 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 %}
-
-
-{% block entrieslist %}
-{% if entries %}
-	<table class="maximal clear">
-	<thead>
-		<tr>
-		{% for h in columns %}
-
-		{% endfor %}
-		</tr>
-	</thead>
-
-{% else %}
-	<p>{{ __('No entries') }}</p>
-{% endif %}
-
-{% endblock %}
Index: inc/admin/default-templates/forms/form_layout.html.twig
===================================================================
--- inc/admin/default-templates/forms/form_layout.html.twig	(revision 1152)
+++ inc/admin/default-templates/forms/form_layout.html.twig	(revision 1152)
@@ -0,0 +1,127 @@
+{# Form Fields #}
+{# Heavily inspired from Symfony Framework #}
+
+{% block field_text %}
+{% spaceless %}
+	{% set type = type|default('text') %}
+	{{ block('field_input') }}
+{% endspaceless %}
+{% endblock field_text %}
+
+{% block field_submit %}
+{% spaceless %}
+	{% set type = type|default('submit') %}
+	{{ block('field_input') }}
+{% endspaceless %}
+{% endblock field_submit %}
+
+{% block field_textarea %}
+{% spaceless %}
+	{{ block('startlabel') }}
+    <textarea {{ block('field_attr') }}>{{ value }}</textarea>
+    {{ block('endlabel') }}
+{% endspaceless %}
+{% endblock field_textarea %}
+
+{% block field_password %}
+{% spaceless %}
+	{% set type = type|default('password') %}
+	{{ block('field_input') }}
+{% endspaceless %}
+{% endblock field_password %}
+
+{% block field_hidden %}
+    {% set type = type|default('hidden') %}
+    {{ block('field_input') }}
+{% endblock field_hidden %}
+
+{% block field_input %}
+{% autoescape "html" %}
+{% spaceless %}
+    {% set type = type|default('text') %}
+    {{ block('startlabel') }}
+	<input type="{{ type }}" {{ block('field_attr') }} {% if value is not empty %}value="{{ value }}" {% endif %} />
+    {{ block('endlabel') }}
+{% endspaceless %}
+{% endautoescape %}
+{% endblock field_input %}
+
+{% block field_checkbox %}
+{% set type = type|default('checkbox') %}
+{% set nestedlabel = true %}
+{% set labelclass = "classic" %}
+    {{ block('field_input') }}
+{#{% spaceless %}
+
+	{% if label is not empty %}
+		<label for="{{name}}" class="classic">
+	{% endif %}
+    <input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
+	{% if label is not empty %}
+		{{ label }}</label>
+	{% endif %}
+{% endspaceless %}#}
+{% endblock field_checkbox %}
+
+{% block field_attr %}
+{% spaceless %}
+ id="{{id}}" name="{{name}}" {% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %}
+    {% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %}
+{% endspaceless %}
+{% endblock field_attr %}
+
+{% block field_options %}
+{% spaceless %}
+    {% for choice, label in options %}
+        {% if _form_is_choice_group(label) %}
+            <optgroup label="{{ choice }}">
+                {% for nestedChoice, nestedLabel in label %}
+                    <option value="{{ nestedChoice }}"{% if nestedChoice == value %} selected="selected"{% endif %}>{{ nestedLabel }}</option>
+                {% endfor %}
+            </optgroup>
+        {% else %}
+            <option value="{{ choice }}"{% if choice == value %} selected="selected"{% endif %}>{{ label|raw }}</option>
+        {% endif %}
+    {% endfor %}
+{% endspaceless %}
+{% endblock field_options %}
+
+{% block field_combo %}
+{% spaceless %}
+    {{ block('startlabel') }}
+    <select {{ block('field_attr') }}>
+        {{ block('field_options') }}
+    </select>
+    {{ block('endlabel') }}
+{% endspaceless %}
+{% endblock field_combo %}
+{#
+{% block label %}
+{% spaceless %}
+	{% if label is not empty %}
+		<label for="{{name}}" {% if required is not empty %}class="required"> <abbr title="{{__('Required field')}}">*</abbr>{% else %}>{% endif %} {{label}}</label>
+	{% endif %}
+{% endspaceless %}
+{% endblock label %}
+#}
+
+{% block startlabel %}
+{% spaceless %}
+    {% if label is not empty %}
+        {% if required is not empty %}
+            {% set labelclass = labelclass ~ " required" %}
+        {% endif %}
+        <label for="{{name}}" {% if labelclass is not empty %}class="{{labelclass}}"{% endif %} {% if required is not empty %}<abbr title="{{__('Required field')}}">*</abbr>{% else %}>{% endif %} {{label}}
+        {% if nestedlabel is empty %}</label> {% endif %}
+    {% endif %}
+{% endspaceless %}
+{% endblock startlabel %}
+
+{% block endlabel %}
+{% spaceless %}
+    {% if label is not empty %}
+        {% if nestedlabel is not empty %}</label>{% endif %}
+    {% endif %}
+{% endspaceless %}
+{% endblock endlabel %}
+
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 1152)
@@ -0,0 +1,93 @@
+{# Form filter default layout #}
+
+
+{% 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] %}
+	<div class="col70">
+		<h3>{{__('Entries filters')}}</h3>
+		<table summary="{{__('Query filters')}}" id="tfilters">
+		<tbody>
+			{% for f in fenv.active_filters %}
+				<tr class="{{f.id}}">
+					<td>{{form_field(f.del_id)}}</td>
+					{{block(f.fwidget)}}
+				</tr>
+			{% endfor %}
+		</tbody>
+		</table>
+		<h3 class="margintop">{{ __('Add a filter') }}</h3>
+		<p id="available_filters">
+			{{ form_field(fenv.prefix ~ 'add_filter')}} {{ form_field(fenv.prefix ~ 'add') }}
+		</p>
+		<p class="clear">{{form_field(fenv.prefix ~ 'clear_filters',{'class':'delete'})}} {{form_field(fenv.prefix ~ 'reset')}}</p>
+		<p class="clear margintop">
+		{{ form_field(fenv.prefix ~ 'apply')}}
+		</p>
+	</div>
+	<div class="col30">
+		{% for f in fenv.static_filters %}
+			{{block(f.fwidget)}}
+		{% endfor %}
+	</div>
+	<p class="clear margintop"></p>
+{% endform %}
+</div>
+{% endblock %}
+
+
+{% block filterenabled %}
+	<tr class="{{ id }}">';
+		<td>
+			<input id="{{ del_id }}" class="delete" type="submit" title="{{__('Delete the following filter : ') }}"
+			value=" - " name=" {{ del_id }}"/>
+		</td>
+		{{ block(filter) }}
+	</tr>
+{% endblock %}
+
+
+{% 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>
+	{%- else -%}
+		<td id='{{f.filter_id}}' title='{{f.desc}}' class="filter-title" colspan="2">{{f.desc}} : </td>
+		<td >{{ form_field(f.ffield) }}</td>
+	{%- endif %}
+{% endblock %}
+
+{% block filter_combo_cont %}
+	{% if f.display_inline is defined -%}
+		<p id='{{filter_id}}'>{{form_field(f.ffield,{'label':__('or :')})}}</p>
+	{%- else -%}
+		<td id='{{filter_id}}' colspan="2">{{ __('or :') }} </td><td>{{ form_field(f.ffield) }}</td>
+	{%- endif %}
+{% endblock %}
+
+
+{% 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 %}
+
+
+{% 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 %}
+
+{% 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>
+	{%- else -%}
+		<td id='{{filterd_id}}' title='{{f.desc}}' class="filter-title" colspan="2">{{f.desc}}</td>
+		<td>{{ form_field(f.ffield) }}</td>
+	{% 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 1152)
@@ -0,0 +1,35 @@
+{% block entrieslist -%}
+{% set lenv = _context['list_' ~ listname] %}
+{% if lenv.entries %}
+{% form listname -%}
+{% spaceless %}
+<table class="maximal clear">
+	<caption> {{ caption }} - {{__('Page %s')|format(page)}}</caption>
+		<tr>
+		{% for h in lenv.cols -%}
+			<th scope="col">{{h.name}}</th>
+		{%- endfor %}
+		</tr>
+		{% for e in lenv.entries %}
+			{% block list_line_start %}<tr class="line">{% endblock %}
+			{% for h in lenv.cols %}
+				<td>{{widget(h.widget,{'e':e,'offset':loop.parent.loop.index0})}}</td>
+			{% endfor %}
+			</tr>
+		{% endfor %}
+</table>
+<div class="two-cols">
+	<p class="col checkboxes-helpers"></p>
+	<p class="col right">{{ form_field ('action',{},{'labelclass':'classic'})}} {{form_field('ok')}}</p>
+</div>
+{% endspaceless %}
+{%- endform %}
+{% else %}
+	<p>{{ __('No entries') }}</p>
+{% endif %}
+{%- endblock %}
+
+{% block filter_checkbox %}
+
+{% endblock filter_checkbox %}
+
Index: inc/admin/default-templates/posts.html.twig
===================================================================
--- inc/admin/default-templates/posts.html.twig	(revision 1147)
+++ inc/admin/default-templates/posts.html.twig	(revision 1152)
@@ -7,5 +7,6 @@
 	{{ js.modal }}
 	{{ js.meta_editor }}
-	<script type="text/javascript" src="{{theme_url}}js/_post.js"></script>
+	<script type="text/javascript" src="{{theme_url}}js/_posts_list.js"></script>
+	<script type="text/javascript" src="{{theme_url}}js/filters.js"></script>
 	{{ js.confirm_close(['entry-form','comment-form']) }}
 	{{ js.page_tabs(default_tab) }}
@@ -18,4 +19,6 @@
 {% endblock %}
 
+
+
 {% block content %}
 {{ parent() }}
@@ -25,6 +28,5 @@
 <p> Applied filters : {{filters}} </p>
 
-
-
+{{ listitems('lposts')}}
 
 {% endblock %}
Index: inc/admin/default-templates/posts_cols.html.twig
===================================================================
--- inc/admin/default-templates/posts_cols.html.twig	(revision 1152)
+++ inc/admin/default-templates/posts_cols.html.twig	(revision 1152)
@@ -0,0 +1,43 @@
+
+{% block col_ref %}
+	{{form_field('entries',{'offset':offset})}}
+{% endblock %}
+
+{% block col_title %}
+	{{block('col_ref')}}
+	{{e.post_title}}
+{% endblock %}
+
+{% block col_cat -%}
+	{% if e.exists('cat_title') %}
+		<a href="category.php?id={{e.cat_id}}">{{e.cat_title}}</a>
+	{% else %}
+		{{__('None')}}
+	{% endif %}
+{%- endblock %}
+
+{% block col_date -%}
+	{{e.post_dt|date('Y-m-d')}}
+{%- endblock %}
+
+{% block col_datetime -%}
+	{{e.post_dt|date('Y-m-d h:i')}}
+{%- endblock %}
+
+{% block col_author -%}
+	{{e.user_id}}
+{%- endblock %}
+
+{% block col_status %}
+{% set statuses = {
+	"0": {'img' : 'check-off.png', 'name':__('unpublished')},
+	"1": {'img' : 'check-on.png', 'name':__('published')},
+	"-1": {'img' : 'scheduled.png', 'name':__('scheduled')},
+	"-2": {'img' : 'check-wrn.png', 'name':__('pending')}}
+%}
+<img alt="{{statuses[e.post_status].name}}" src="images/{{statuses[e.post_status].img}}" />
+{% endblock %}
+
+{% block list_line_start %} 
+<tr class="line" id="p{{e.post_id}}">
+{% endblock %}
