Index: plugins/widgets/_admin.php
===================================================================
--- plugins/widgets/_admin.php	(revision 2230)
+++ plugins/widgets/_admin.php	(revision 1179)
@@ -12,14 +12,11 @@
 if (!defined('DC_CONTEXT_ADMIN')) { return; }
 
-$core->addBehavior('adminDashboardFavorites','widgets_dashboard_favorites');
+$core->addBehavior('adminDashboardFavs','widgets_dashboard_favs');
 
-function widgets_dashboard_favorites($core,$favs)
+function widgets_dashboard_favs($core,$favs)
 {
-	$favs->register('widgets', array(
-		'title' => __('Presentation widgets'),
-		'url' => 'plugin.php?p=widgets',
-		'small-icon' => 'index.php?pf=widgets/icon.png',
-		'large-icon' => 'index.php?pf=widgets/icon-big.png',
-	));
+	$favs['widgets'] = new ArrayObject(array('widgets','Presentation widgets','plugin.php?p=widgets',
+		'index.php?pf=widgets/icon.png','index.php?pf=widgets/icon-big.png',
+		'admin',null,null));
 }
 
Index: plugins/widgets/_default_widgets.php
===================================================================
--- plugins/widgets/_default_widgets.php	(revision 2198)
+++ plugins/widgets/_default_widgets.php	(revision 2395)
@@ -22,6 +22,6 @@
 $__widgets->search->setting('homeonly',__('Display on:'),0,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->search->setting('content_only',__('Content only'),0,'check');
-$__widgets->search->setting('class',__('CSS class:'),'');
+$__widgets->search->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->search->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation'),null,'List of navigation links');
@@ -29,6 +29,6 @@
 $__widgets->navigation->setting('homeonly',__('Display on:'),0,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->navigation->setting('content_only',__('Content only'),0,'check');
-$__widgets->navigation->setting('class',__('CSS class:'),'');
+$__widgets->navigation->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->navigation->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof'),null,'List of selected entries');
@@ -37,6 +37,6 @@
 $__widgets->bestof->setting('homeonly',__('Display on:'),1,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->bestof->setting('content_only',__('Content only'),0,'check');
-$__widgets->bestof->setting('class',__('CSS class:'),'');
+$__widgets->bestof->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->bestof->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs'),null,'List of available languages');
@@ -44,16 +44,15 @@
 $__widgets->langs->setting('homeonly',__('Display on:'),1,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->langs->setting('content_only',__('Content only'),0,'check');
-$__widgets->langs->setting('class',__('CSS class:'),'');
+$__widgets->langs->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->langs->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('categories',__('Categories'),array('defaultWidgets','categories'),null,'List of categories');
 $__widgets->categories->setting('title',__('Title:'),__('Categories'));
 $__widgets->categories->setting('postcount',__('With entries counts'),0,'check');
-$__widgets->categories->setting('subcatscount', __('Include sub cats in count'), false, 'check');
 $__widgets->categories->setting('with_empty',__('Include empty categories'),0,'check');
 $__widgets->categories->setting('homeonly',__('Display on:'),0,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->categories->setting('content_only',__('Content only'),0,'check');
-$__widgets->categories->setting('class',__('CSS class:'),'');
+$__widgets->categories->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->categories->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe'),null,'RSS or Atom feed subscription links');
@@ -62,8 +61,8 @@
 $__widgets->subscribe->setting('homeonly',__('Display on:'),1,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->subscribe->setting('content_only',__('Content only'),0,'check');
-$__widgets->subscribe->setting('class',__('CSS class:'),'');
+$__widgets->subscribe->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->subscribe->advanced_setting('class',__('CSS class:'),'');
 
-$__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed');
+$__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed ( RSS or Atom )');
 $__widgets->feed->setting('title',__('Title:'),__('Somewhere else'));
 $__widgets->feed->setting('url',__('Feed URL:'),'');
@@ -71,6 +70,6 @@
 $__widgets->feed->setting('homeonly',__('Display on:'),1,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->feed->setting('content_only',__('Content only'),0,'check');
-$__widgets->feed->setting('class',__('CSS class:'),'');
+$__widgets->feed->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->feed->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('text',__('Text'),array('defaultWidgets','text'),null,'Simple text');
@@ -79,6 +78,6 @@
 $__widgets->text->setting('homeonly',__('Display on:'),0,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->text->setting('content_only',__('Content only'),0,'check');
-$__widgets->text->setting('class',__('CSS class:'),'');
+$__widgets->text->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->text->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts'),null,'List of last entries published');
@@ -97,6 +96,6 @@
 $__widgets->lastposts->setting('homeonly',__('Display on:'),1,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->lastposts->setting('content_only',__('Content only'),0,'check');
-$__widgets->lastposts->setting('class',__('CSS class:'),'');
+$__widgets->lastposts->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->lastposts->advanced_setting('class',__('CSS class:'),'');
 
 $__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments'),null,'List of last comments posted');
@@ -105,6 +104,6 @@
 $__widgets->lastcomments->setting('homeonly',__('Display on:'),1,'combo',
 	array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
-$__widgets->lastcomments->setting('content_only',__('Content only'),0,'check');
-$__widgets->lastcomments->setting('class',__('CSS class:'),'');
+$__widgets->lastcomments->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0')));
+$__widgets->lastcomments->advanced_setting('class',__('CSS class:'),'');
 
 # --BEHAVIOR-- initWidgets
Index: plugins/widgets/_define.php
===================================================================
--- plugins/widgets/_define.php	(revision 2257)
+++ plugins/widgets/_define.php	(revision 1179)
@@ -19,6 +19,5 @@
 	array(
 		'permissions' =>	'admin',
-		'priority' =>		1000000000,
-		'type'		=>		'plugin'
+		'priority' =>		1000000000
 	)
 );
Index: plugins/widgets/_widgets_functions.php
===================================================================
--- plugins/widgets/_widgets_functions.php	(revision 2198)
+++ plugins/widgets/_widgets_functions.php	(revision 1610)
@@ -108,5 +108,5 @@
 			'<a href="'.$core->blog->url.$core->url->getURLFor('category', $rs->cat_url).'">'.
 			html::escapeHTML($rs->cat_title).'</a>'.
-			($w->postcount ? ' <span>('.($w->subcatscount ? $rs->nb_total : $rs->nb_post).')</span>' : '');
+			($w->postcount ? ' <span>('.$rs->nb_post.')</span>' : '');
 			
 			
Index: plugins/widgets/class.widgets.php
===================================================================
--- plugins/widgets/class.widgets.php	(revision 1474)
+++ plugins/widgets/class.widgets.php	(revision 2395)
@@ -139,4 +139,6 @@
 	public $append_callback = null;
 	private $settings = array();
+	private $advance_id;
+	private $advanced_settings = array();
 	
 	public function serialize($order) {
@@ -144,4 +146,6 @@
 		foreach ($this->settings as $k=>$v)
 			$values[$k]=$v['value'];
+		foreach ($this->advanced_settings as $k=>$v)
+			$values[$k]=$v['value'];
 		$values['id']=$this->id;
 		$values['order']=$order;
@@ -189,8 +193,11 @@
 	public function __get($n)
 	{
+		$setting = null;
 		if (isset($this->settings[$n])) {
-			return $this->settings[$n]['value'];
-		}
-		return null;
+			$setting = $this->settings[$n]['value'];
+		} else if (isset($this->advanced_settings[$n])) {
+			$setting = $this->advanced_settings[$n]['value'];
+		}
+		return $setting;
 	}
 	
@@ -199,4 +206,6 @@
 		if (isset($this->settings[$n])) {
 			$this->settings[$n]['value'] = $v;
+		} else if (isset($this->advanced_settings[$n])) {
+			$this->advanced_settings[$n]['value'] = $v;
 		}
 	}
@@ -222,4 +231,29 @@
 	}
 	
+	public function advanced_setting($name,$title,$value,$type='text')
+	{
+		if ($type == 'combo' || $type == 'radio') {
+			$options = @func_get_arg(4);
+			if (!is_array($options)) {
+				return false;
+			}
+		}
+		
+		$this->advanced_settings[$name] = array(
+			'title' => $title,
+			'type' => $type,
+			'value' => $value
+		);
+		
+		if (isset($options)) {
+			$this->advanced_settings[$name]['options'] = $options;
+		}
+	}
+	
+	public function advance_settings()
+	{
+		return $this->advanced_settings;
+	}
+	
 	public function settings()
 	{
@@ -232,35 +266,70 @@
 		foreach ($this->settings as $id => $s)
 		{
-			$wfid = "wf-".$i;
-			$iname = $pr ? $pr.'['.$id.']' : $id;
-			switch ($s['type'])
+			$res .= $this->formSetting($id,$s,$pr,$i=0);
+			$i++;
+		}
+		
+		if ( count($this->advanced_settings) > 0 )
+		{
+			$res .= '<div class="widgetAdvancedSettings">';
+			$res .= '<h5>'.__('Réglages avancés').'</h5>';
+		
+			foreach ($this->advanced_settings as $id => $s)
 			{
-				case 'text':
-					$res .=
-					'<p><label for="'.$wfid.'">'.$s['title'].'</label> '.
-					form::field(array($iname,$wfid),20,255,html::escapeHTML($s['value']),'maximal').
-					'</p>';
-					break;
-				case 'textarea':
-					$res .=
-					'<p><label for="'.$wfid.'">'.$s['title'].'</label> '.
-					form::textarea(array($iname,$wfid),30,5,html::escapeHTML($s['value']),'maximal').
-					'</p>';
-					break;
-				case 'check':
-					$res .=
-					'<p>'.form::hidden(array($iname),'0').
-					'<label class="classic" for="'.$wfid.'">'.
-					form::checkbox(array($iname,$wfid),'1',$s['value']).' '.$s['title'].
-					'</label></p>';
-					break;
-				case 'combo':
-					$res .=
-					'<p><label for="'.$wfid.'">'.$s['title'].'</label> '.
-					form::combo(array($iname,$wfid),$s['options'],$s['value']).
-					'</p>';
-					break;
-			}
-			$i++;
+				$res .= $this->formSetting($id,$s,$pr,$i);
+				$i++;
+			}
+			
+			$res .= '</div>';
+		}
+		
+		return $res;
+	}
+	
+	public function formSetting($id,$s,$pr='',&$i=0)
+	{
+		$res = '';
+		$wfid = "wf-".$i;
+		$iname = $pr ? $pr.'['.$id.']' : $id;
+		switch ($s['type'])
+		{
+			case 'text':
+				$res .=
+				'<p><label for="'.$wfid.'">'.$s['title'].'</label> '.
+				form::field(array($iname,$wfid),20,255,html::escapeHTML($s['value']),'maximal').
+				'</p>';
+				break;
+			case 'textarea':
+				$res .=
+				'<p><label for="'.$wfid.'">'.$s['title'].'</label> '.
+				form::textarea(array($iname,$wfid),30,5,html::escapeHTML($s['value']),'maximal').
+				'</p>';
+				break;
+			case 'check':
+				$res .=
+				'<p>'.form::hidden(array($iname),'0').
+				'<label class="classic" for="'.$wfid.'">'.
+				form::checkbox(array($iname,$wfid),'1',$s['value']).' '.$s['title'].
+				'</label></p>';
+				break;
+			case 'radio':
+				$res .= '<p>'.($s['title'] ? '<label class="classic">'.$s['title'].'</label><br/>' : '');
+				if(!empty($s['options'])) {
+					foreach ($s['options'] as $k => $v) {
+						$res .= $k > 0 ? '<br/>' : '';
+						$res .=
+						'<label class="classic" for="'.$wfid.'-'.$k.'">'.
+						form::radio(array($iname,$wfid.'-'.$k),$v[1],$s['value'] == $v[1]).' '.$v[0].
+						'</label>';
+					}
+				}
+				$res .= '</p>';
+				break;
+			case 'combo':
+				$res .=
+				'<p><label for="'.$wfid.'">'.$s['title'].'</label> '.
+				form::combo(array($iname,$wfid),$s['options'],$s['value']).
+				'</p>';
+				break;
 		}
 		
Index: plugins/widgets/dragdrop.js
===================================================================
--- plugins/widgets/dragdrop.js	(revision 1766)
+++ plugins/widgets/dragdrop.js	(revision 2395)
@@ -27,5 +27,5 @@
 		handle: ".widget-name",
 		placeholder: "ui-sortable-placeholder",
-		items: "li:not(.sortable-delete-placeholder)",
+		items: "li:not(.sortable-delete-placeholder,.empty-widgets)",
 		connectWith: ".connected, .sortable-delete",
 		start: function( event, ui ) {
@@ -43,7 +43,11 @@
 			
 			// signale les zones vides
-			if( ul.find('li').length == 0 )
-				 field.find('.empty-widgets').show();
-			else field.find('.empty-widgets').hide();
+			if( ul.find('li:not(.empty-widgets)').length == 0 ) {
+				ul.find('li.empty-widgets').show();
+				field.find('ul.sortable-delete').hide();
+			} else {
+				ul.find('li.empty-widgets').hide();
+				field.find('ul.sortable-delete').show();
+			}
 			
 			// remove
@@ -95,4 +99,7 @@
 		}
 	});
-	$("li.ui-draggable, ul.ui-sortable li").css({'cursor':'move'});
+	
+	$("li.ui-draggable, ul.ui-sortable li")
+		.not('ul.sortable-delete li, li.empty-widgets')
+		.css({'cursor':'move'});
 });
Index: plugins/widgets/index.php
===================================================================
--- plugins/widgets/index.php	(revision 2369)
+++ plugins/widgets/index.php	(revision 2395)
@@ -13,149 +13,4 @@
 
 include dirname(__FILE__).'/_default_widgets.php';
-
-# Loading navigation, extra widgets and custom widgets
-$widgets_nav = null;
-if ($core->blog->settings->widgets->widgets_nav) {
-	$widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav);
-}
-$widgets_extra = null;
-if ($core->blog->settings->widgets->widgets_extra) {
-	$widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra);
-}
-$widgets_custom = null;
-if ($core->blog->settings->widgets->widgets_custom) {
-	$widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom);
-}
-
-$append_combo = array(
-	'-' => 0,
-	__('navigation') => 'nav',
-	__('extra') => 'extra',
-	__('custom') => 'custom'
-);
-
-function literalNullString($v)
-{
-	if ($v == '') {
-		return '&lt;'.__('empty string').'&gt;';
-	}
-	return $v;
-}
-
-# Adding widgets to sidebars
-if (!empty($_POST['append']) && is_array($_POST['addw']))
-{
-	# Filter selection
-	$addw = array();
-	foreach ($_POST['addw'] as $k => $v) {
-		if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null ) {
-			$addw[$k] = $v;
-		}
-	}
-	
-	# Append widgets
-	if (!empty($addw))
-	{
-		if (!($widgets_nav instanceof dcWidgets)) {
-			$widgets_nav = new dcWidgets;
-		}
-		if (!($widgets_extra instanceof dcWidgets)) {
-			$widgets_extra = new dcWidgets();
-		}
-		if (!($widgets_custom instanceof dcWidgets)) {
-			$widgets_custom = new dcWidgets();
-		}
-		
-		foreach ($addw as $k => $v)
-		{
-			switch ($v) {
-				case 'nav':
-					$widgets_nav->append($__widgets->{$k});
-					break;
-				case 'extra':
-					$widgets_extra->append($__widgets->{$k});
-					break;
-				case 'custom':
-					$widgets_custom->append($__widgets->{$k});
-					break;
-			}
-		}
-		
-		try {
-			$core->blog->settings->addNamespace('widgets');
-			$core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store());
-			$core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store());
-			$core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store());
-			$core->blog->triggerBlog();
-			http::redirect($p_url);
-		} catch (Exception $e) {
-			$core->error->add($e->getMessage());
-		}
-	}
-}
-
-# Update sidebars
-if (!empty($_POST['wup']))
-{
-	if (!isset($_POST['w']) || !is_array($_POST['w'])) {
-		$_POST['w'] = array();
-	}
-	
-	try
-	{
-		# Removing mark as _rem widgets
-		foreach ($_POST['w'] as $nsid => $nsw) {
-			foreach ($nsw as $i => $v) {
-				if (!empty($v['_rem'])) {
-					unset($_POST['w'][$nsid][$i]);
-					continue;
-				}
-			}
-		}
-		
-		if (!isset($_POST['w']['nav'])) {
-			$_POST['w']['nav'] = array();
-		}
-		if (!isset($_POST['w']['extra'])) {
-			$_POST['w']['extra'] = array();
-		}
-		if (!isset($_POST['w']['custom'])) {
-			$_POST['w']['custom'] = array();
-		}
-		
-		$widgets_nav = dcWidgets::loadArray($_POST['w']['nav'],$__widgets);
-		$widgets_extra = dcWidgets::loadArray($_POST['w']['extra'],$__widgets);
-		$widgets_custom = dcWidgets::loadArray($_POST['w']['custom'],$__widgets);
-		
-		$core->blog->settings->addNamespace('widgets');
-		$core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store());
-		$core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store());
-		$core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store());
-		$core->blog->triggerBlog();
-		
-		http::redirect($p_url);
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
-}
-elseif (!empty($_POST['wreset']))
-{
-	try
-	{
-		$core->blog->settings->addNamespace('widgets');
-		$core->blog->settings->widgets->put('widgets_nav','');
-		$core->blog->settings->widgets->put('widgets_extra','');
-		$core->blog->settings->widgets->put('widgets_custom','');
-		$core->blog->triggerBlog();
-		
-		http::redirect($p_url);
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
-}
 ?>
 <html>
@@ -187,10 +42,193 @@
 <body>
 <?php
+# Loading navigation, extra widgets and custom widgets
+$widgets_nav = null;
+if ($core->blog->settings->widgets->widgets_nav) {
+	$widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav);
+}
+$widgets_extra = null;
+if ($core->blog->settings->widgets->widgets_extra) {
+	$widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra);
+}
+$widgets_custom = null;
+if ($core->blog->settings->widgets->widgets_custom) {
+	$widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom);
+}
+
+$append_combo = array(
+	'-' => 0,
+	__('navigation') => 'nav',
+	__('extra') => 'extra',
+	__('custom') => 'custom'
+);
+
+function literalNullString($v)
+{
+	if ($v == '') {
+		return '&lt;'.__('empty string').'&gt;';
+	}
+	return $v;
+}
+
+# Adding widgets to sidebars
+if (!empty($_POST['append']) && is_array($_POST['addw']))
+{
+	# Filter selection
+	$addw = array();
+	foreach ($_POST['addw'] as $k => $v) {
+		if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null ) {
+			$addw[$k] = $v;
+		}
+	}
+		
+	# Append 1 widget
+	$wid = false;
+	if( gettype($_POST['append']) == 'array' && count($_POST['append']) == 1 ) {
+		$wid = array_keys($_POST['append']);
+		$wid = $wid[0];
+	}
+	
+	# Append widgets
+	if (!empty($addw))
+	{
+		if (!($widgets_nav instanceof dcWidgets)) {
+			$widgets_nav = new dcWidgets;
+		}
+		if (!($widgets_extra instanceof dcWidgets)) {
+			$widgets_extra = new dcWidgets();
+		}
+		if (!($widgets_custom instanceof dcWidgets)) {
+			$widgets_custom = new dcWidgets();
+		}
+		
+		foreach ($addw as $k => $v)
+		{
+			if( !$wid || $wid == $k )
+			{
+				switch ($v) {
+					case 'nav':
+						$widgets_nav->append($__widgets->{$k});
+						break;
+					case 'extra':
+						$widgets_extra->append($__widgets->{$k});
+						break;
+					case 'custom':
+						$widgets_custom->append($__widgets->{$k});
+						break;
+				}
+			}
+			
+		}
+		
+		try {
+			$core->blog->settings->addNamespace('widgets');
+			$core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store());
+			$core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store());
+			$core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store());
+			$core->blog->triggerBlog();
+			http::redirect($p_url);
+		} catch (Exception $e) {
+			$core->error->add($e->getMessage());
+		}
+	}
+}
+
+# Update sidebars
+if (!empty($_POST['wup']))
+{
+	if (!isset($_POST['w']) || !is_array($_POST['w'])) {
+		$_POST['w'] = array();
+	}
+	
+	try
+	{
+		# Removing mark as _rem widgets
+		foreach ($_POST['w'] as $nsid => $nsw) {
+			foreach ($nsw as $i => $v) {
+				if (!empty($v['_rem'])) {
+					unset($_POST['w'][$nsid][$i]);
+					continue;
+				}
+			}
+		}
+		
+		if (!isset($_POST['w']['nav'])) {
+			$_POST['w']['nav'] = array();
+		}
+		if (!isset($_POST['w']['extra'])) {
+			$_POST['w']['extra'] = array();
+		}
+		if (!isset($_POST['w']['custom'])) {
+			$_POST['w']['custom'] = array();
+		}
+		
+		$widgets_nav = dcWidgets::loadArray($_POST['w']['nav'],$__widgets);
+		$widgets_extra = dcWidgets::loadArray($_POST['w']['extra'],$__widgets);
+		$widgets_custom = dcWidgets::loadArray($_POST['w']['custom'],$__widgets);
+		
+		$core->blog->settings->addNamespace('widgets');
+		$core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store());
+		$core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store());
+		$core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store());
+		$core->blog->triggerBlog();
+		
+		http::redirect($p_url);
+	}
+	catch (Exception $e)
+	{
+		$core->error->add($e->getMessage());
+	}
+}
+elseif (!empty($_POST['wreset']))
+{
+	try
+	{
+		$core->blog->settings->addNamespace('widgets');
+		$core->blog->settings->widgets->put('widgets_nav','');
+		$core->blog->settings->widgets->put('widgets_extra','');
+		$core->blog->settings->widgets->put('widgets_custom','');
+		$core->blog->triggerBlog();
+		
+		http::redirect($p_url);
+	}
+	catch (Exception $e)
+	{
+		$core->error->add($e->getMessage());
+	}
+}
+/*?>
+<html>
+<head>
+  <title><?php echo __('Widgets'); ?></title>
+  <style type="text/css">
+  <?php echo file_get_contents(dirname(__FILE__).'/style.css'); ?>
+  </style>
+  <?php
+		echo
+			dcPage::jsLoad('js/jquery/jquery-ui.custom.js').
+			dcPage::jsLoad('index.php?pf=widgets/widgets.js');
+  ?>
+  <?php 
+	$core->auth->user_prefs->addWorkspace('accessibility'); 
+	$user_dm_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop;
+  ?>
+  <?php if (!$user_dm_nodragdrop) : ?>
+  <script type="text/javascript" src="index.php?pf=widgets/dragdrop.js"></script>
+  <?php endif; ?>
+  <script type="text/javascript">
+  //<![CDATA[
+  <?php echo dcPage::jsVar('dotclear.msg.confirm_widgets_reset',
+  	__('Are you sure you want to reset sidebars?')); ?>
+  //]]>
+  </script>
+  <?php echo(dcPage::jsConfirmClose('sidebarsWidgets')); ?>
+</head>
+<body>
+<?php*/
 echo dcPage::breadcrumb(
 	array(
 		html::escapeHTML($core->blog->name) => '',
-		__('Widgets') => ''
-	)).
-	dcPage::notices();
+		'<span class="page-title">'.__('Widgets').'</span>' => ''
+	));
 
 # All widgets
@@ -198,5 +236,5 @@
 '<form id="listWidgets" action="'.$p_url.'" method="post"  class="widgets">'.
 '<h3>'.__('Available widgets').'</h3>'.
-'<p>'.__('Move widgets from this list to one of the sidebars.').'</p>'.
+'<p>'.__('Drag widgets from this list to one of the sidebars, for add.').'</p>'.
 '<ul id="widgets-ref">';
 
@@ -208,5 +246,6 @@
 	($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'.
 	'<p class="manual-move remove-if-drag"><label class="classic">'.__('Append to:').'</label> '.
-	form::combo(array('addw['.$w->id().']'),$append_combo).'</p>'.
+	form::combo(array('addw['.$w->id().']'),$append_combo).
+	'<input type="submit" name="append['.$w->id().']" value="'.__('Add').'" /></p>'.
 	'<div class="widgetSettings hidden-if-drag">'.$w->formSettings('w[void][0]',$j).'</div>'.
 	'</li>';
@@ -247,5 +286,24 @@
 
 $widget_elements = new stdClass;
-$widget_elements->content = '<dl>';
+$widget_elements->content =
+'<h4>'.__('Use of widgets').'</h4>'.
+'<p>'.__('Widgets may be used to add various blocks of content to be displayed on your public pages. To add a widget, '.
+'drag it from the Available widgets list on the left to one of the sidebars on the right of this page. You can order '.
+'your widgets in a sidebar by dragging them up or down. You must update sidebars to apply your changes.').'</p>'.
+'<p>'.__('Once included in a sidebar, widgets have configuration options that you can reach by clicking on the arrow next '.
+'to their name.').'</p>'.
+'<p>'.__('Reset sidebars to get back to default widgets installation.').'</p>'.
+'<h4>'.__('Widget templates tags').'</h4>'.
+'<div id="widgets-tpl">'.
+'<p>'.__('If you are allowed to edit your theme templates, you can directly add widgets as '.
+'templates tags, with their own configuration.').'</p>'.
+'<p>'.__('To add a widget in your template, you need to write code like this:').'</p>'.
+'<pre>&lt;tpl:Widget id="<strong>'.__('Widget ID').'</strong>"&gt;
+  &lt;setting name="<strong>'.__('Setting name').'</strong>"&gt;<strong>'.__('Setting value').'</strong>&lt;/setting&gt;
+  ...
+&lt;/tpl:Widget&gt;</pre>'.
+'<p>'.__('Here are the following available widgets for your blog:').'</p>';
+
+$widget_elements->content .= '<dl>';
 foreach ($__widgets->elements() as $w)
 {
@@ -293,5 +351,5 @@
 $widget_elements->content .= '</dl></div>';
 
-dcPage::helpBlock('widgets',$widget_elements);
+dcPage::helpBlock($widget_elements);
 
 function sidebarWidgets($id,$title,$widgets,$pr,$default_widgets,&$j)
@@ -304,7 +362,7 @@
 	}
 	
-	$res .= '<p class="empty-widgets" '.(!$widgets->isEmpty() ? 'style="display: none;"' : '').'>'.__('No widget.').'</p>';
-	
 	$res .= '<ul id="'.$id.'" class="connected">';
+	
+	$res .= '<li class="empty-widgets" '.(!$widgets->isEmpty() ? 'style="display: none;"' : '').'>'.__('No widget for now.').'</li>';
 	
 	$i = 0;
@@ -328,9 +386,7 @@
 	
 	$res .= '</ul>';
-
-	if ($i > 0) {
-		$res .= '<ul class="sortable-delete"><li class="sortable-delete-placeholder">'.
-			__('Drag widgets here to remove them from this sidebar.').'</li></ul>';
-	}
+	
+	$res .= '<ul class="sortable-delete"'.($i > 0 ? '':' style="display: none;"').'><li class="sortable-delete-placeholder">'.
+			__('Drag widgets here to remove.').'</li></ul>';
 	
 	return $res;
Index: plugins/widgets/locales/en/help/help.html
===================================================================
--- plugins/widgets/locales/en/help/help.html	(revision 2375)
+++ 	(revision )
@@ -1,34 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
-  <title>Widgets</title>
-</head>
-
-<body>
-<h4>Use of widgets</h4>
-
-<p>Widgets may be used to add various blocks of content to be displayed on your public pages. To add a widget, drag it from the Available widgets list on the left to one of the sidebars on the right of this page. You can order your widgets in a sidebar by dragging them up or down. You must update sidebars to apply your changes.</p>
-
-<p>Once included in a sidebar, widgets have configuration options that you can reach by clicking on the arrow next to their name.</p>
-
-<p>Reset sidebars to get back to default widgets installation</p>
-
-<h4>Widget templates tags</h4>
-
-<div id="widgets-tpl">
-
-<p>If you are allowed to edit your theme templates, you can directly add widgets as templates tags, with their own configuration.</p>
-
-<p>To add a widget in your template, you need to write code like this:</p>
-
-<pre>
-&lt;tpl:Widget id="<strong>Widget ID</strong>"&gt;
-  &lt;setting name="<strong>Setting name</strong>"&gt;<strong>Setting value</strong>&lt;/setting&gt;
-  ...
-&lt;/tpl:Widget&gt;
-</pre>
-
-<p>Here are the following available widgets for your blog:</p><!-- the widgets and their descriptions are automatically inserted here -->
-
-</body>
-</html>
Index: plugins/widgets/locales/en/resources.php
===================================================================
--- plugins/widgets/locales/en/resources.php	(revision 2375)
+++ 	(revision )
@@ -1,16 +1,0 @@
-<?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 (!isset($__resources['help']['widgets']))
-{
-	$__resources['help']['widgets'] = dirname(__FILE__).'/help/help.html';
-}
Index: plugins/widgets/locales/fr/help/help.html
===================================================================
--- plugins/widgets/locales/fr/help/help.html	(revision 2375)
+++ 	(revision )
@@ -1,34 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
-  <title>Widgets</title>
-</head>
-
-<body>
-<h4>Utilisation des widgets</h4>
-
-<p>Les widgets sont utilisés pour ajouter des blocs de contenus divers dans vos pages publiques. Pour ajouter un widget, faites-le glisser depuis la liste des Widgets disponibles à gauche jusqu'à l'un des bandeaux sur la droite de la page. Vous pouvez ré-ordonner vos widgets dans un bandeau en le faisant glisser vers le haut ou vers le bas. Vous devez mettre à jour les bandeaux pour enregistrer vos modifications.</p>
-
-<p>Une fois inclus dans un bandeau, les widgets ont généralement des options que vous pouvez configurer. Cliquez sur la flèche à côté de leur nom pour y accéder.</p>
-
-<p>Réinitialisez les bandeaux pour retrouver les widgets par défaut de votre installation.</p>
-
-<h4>Balises de widget</h4>
-
-<div id="widgets-tpl">
-
-<p>Si vous êtes autorisé à modifier vos fichiers de thème, vous pouvez ajouter des widgets sous forme de balise, avec leur propre configuration.</p>
-
-<p>Pour ajouter un widget à votre thème, vous devez insérer un code similaire à :</p>
-
-<pre>
-&lt;tpl:Widget id="<strong>ID du widget</strong>"&gt;
-  &lt;setting name="<strong>Nom de l'élément de réglage</strong>"&gt;<strong>Valeur de l'élément de réglage</strong>&lt;/setting&gt;
-  ...
-&lt;/tpl:Widget&gt;
-</pre>
-
-<p>Voici les widgets disponibles pour votre blog :</p><!-- les widgets et leur descriptions sont automatiquement insérés ici -->
-
-</body>
-</html>
Index: plugins/widgets/locales/fr/resources.php
===================================================================
--- plugins/widgets/locales/fr/resources.php	(revision 2375)
+++ 	(revision )
@@ -1,16 +1,0 @@
-<?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 (!isset($__resources['help']['widgets']))
-{
-	$__resources['help']['widgets'] = dirname(__FILE__).'/help/help.html';
-}
Index: plugins/widgets/style.css
===================================================================
--- plugins/widgets/style.css	(revision 2342)
+++ plugins/widgets/style.css	(revision 2395)
@@ -16,5 +16,5 @@
 #sidebarsWidgets {
 	float: left;
-	width: 49%;
+	width: 47%;
 	margin: 0 0 0 1%;
 	padding: 0 1%;
@@ -38,4 +38,9 @@
 	margin-bottom: 1em;
 	list-style: none;
+}
+#dndnav > li.empty-widgets,
+#dndextra > li.empty-widgets,
+#dndcustom > li.empty-widgets {
+	border: 0;
 }
 #dndnav > li.ui-sortable-placeholder,
@@ -114,5 +119,5 @@
 #listWidgets {
 	float: left;
-	width: 49%;
+	width: 46%;
 	background: #eee;
 	padding: 1.5em 1% 0; 
