Index: /extensions/ContestResults/admin/get_tn.php
===================================================================
--- /extensions/ContestResults/admin/get_tn.php	(revision 9571)
+++ /extensions/ContestResults/admin/get_tn.php	(revision 9572)
@@ -10,5 +10,6 @@
 if (!pwg_db_num_rows($image)) {
 	$themeconf = $template->get_template_vars('themeconf');
-	$data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
+	//$data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
+	$data['TN_SRC'] = 'admin/themes/default/icon/errors.png';
 	$data['IMAGE_NAME'] = 'N/A';
 	
Index: /extensions/ContestResults/admin/manage.php
===================================================================
--- /extensions/ContestResults/admin/manage.php	(revision 9571)
+++ /extensions/ContestResults/admin/manage.php	(revision 9572)
@@ -18,23 +18,32 @@
 //				Affichage des concours
 // +-----------------------------------------------------------------------+
-foreach (array('pending','finished') AS $status) {
-	$result = pwg_query("SELECT id, name, visible, date_begin, date_end, logo
-		FROM " . CR_TABLE_1 . "
-		WHERE status = '" . $status . "'
-		ORDER BY date_begin DESC;");
+$contests = pwg_query("SELECT 
+		id, 
+		name, 
+		visible, 
+		date_begin, 
+		date_end, 
+		logo
+	FROM " . CR_TABLE_1 . "
+	ORDER BY date_begin DESC;");
 
-	while ($contest = pwg_db_fetch_assoc($result)) {
-		$template->append('contests_'.$status, array(
-			'NAME' => trigger_event('render_CR_content', $contest['name']),
-			'VISIBLE' => $contest['visible'],
-			'DATE_BEGIN' => format_date($contest['date_begin']),
-			'DATE_END' => format_date($contest['date_end']),
-			'LOGO' => $contest['logo'],
-			'U_RESULTS' => CR_ADMIN . '&amp;tab=results&amp;contest_id=' . $contest['id'],
-			'U_EDIT' => CR_ADMIN . '&amp;tab=edit&amp;contest_id=' . $contest['id'],
-			'U_DELETE' => CR_ADMIN . '&amp;delete_contest=' . $contest['id'],
-			'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
-		));
+while ($contest = pwg_db_fetch_assoc($contests)) {
+	if (is_date_passed($contest['date_end'])) {
+		$contest['status'] = 'finished';
+	} else { 
+		$contest['status'] = 'pending';
 	}
+	$template->append('contests_'.$contest['status'], array(
+		'NAME' => trigger_event('render_CR_content', $contest['name']),
+		'VISIBLE' => $contest['visible'],
+		'DATE_BEGIN' => format_date($contest['date_begin']),
+		'DATE_END' => format_date($contest['date_end']),
+		'LOGO' => $contest['logo'],
+		'U_RESULTS' => CR_ADMIN . '&amp;tab=results&amp;contest_id=' . $contest['id'],
+		'U_EDIT' => CR_ADMIN . '&amp;tab=edit&amp;contest_id=' . $contest['id'],
+		'U_DELETE' => CR_ADMIN . '&amp;delete_contest=' . $contest['id'],
+		'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
+		'DAYS' => DateDiff($contest['date_end'],date('Y-m-d')),
+	));
 }
 
Index: /extensions/ContestResults/admin/new.php
===================================================================
--- /extensions/ContestResults/admin/new.php	(revision 9571)
+++ /extensions/ContestResults/admin/new.php	(revision 9572)
@@ -1,7 +1,4 @@
 <?php
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-// Les quatre zones de texte principales
-$textareas = array('presentation','rules','prices','final');
 
 // +-----------------------------------------------------------------------+
@@ -10,9 +7,21 @@
 if (isset($_POST['new_submit'])) {
 	if ($_POST['name'] != null) {
+		// Mise en forme des descriptions
+		if (isset($_POST['description'])) {
+			$new_description = array();
+			foreach ($_POST['description'] as $data) {
+				$new_description[] = array(
+					'name' => $data['name'],
+					'content' => $data['content']
+				);
+			}
+			// encoder le tableau sérialisé est le seul moyen que j'ai trouvé pour pas perdre les caractères spéciaux et planter unserialize
+			$_POST['description'] = base64_encode(serialize($new_description));
+		}
+			
 		// Modification d'un concours
-		if (isset($_GET['contest_id'])) {
+		if (isset($_GET['contest_id'])) {	
 			pwg_query("UPDATE " . CR_TABLE_1 . " SET
 				`name` = '" . $_POST['name'] ."',
-				`status` = '" . $_POST['status'] ."',
 				`visible` = '" . $_POST['visible'] ."',
 				`date_begin` = '" . $_POST['date_begin'] ."',
@@ -21,8 +30,5 @@
 				`banner` = '" . $_POST['banner'] ."',
 				`summary` = '" . $_POST['summary'] ."',
-				`presentation` = '" . $_POST['presentation'] ."',
-				`rules` = '" . $_POST['rules'] ."',
-				`prices` = '" . $_POST['prices'] ."',
-				`final` = '" . $_POST['final'] ."'
+				`description` = '" . $_POST['description'] ."'
 			WHERE `id` = " . $_GET['contest_id'] .";");
 			
@@ -41,13 +47,9 @@
 					date_begin,
 					date_end,
-					status,
 					visible,
 					logo,
 					banner,
 					summary,
-					presentation,
-					rules,
-					prices,
-					final
+					description
 				)
 				VALUES(
@@ -55,13 +57,9 @@
 					'" . $_POST['date_begin'] ."',
 					'" . $_POST['date_end'] ."',
-					'" . $_POST['status'] ."',
 					'" . $_POST['visible'] ."',
 					'" . $_POST['logo'] ."',
 					'" . $_POST['banner'] ."',
 					'" . $_POST['summary'] ."',
-					'" . $_POST['presentation'] ."',
-					'" . $_POST['rules'] ."',
-					'" . $_POST['prices'] ."',
-					'" . $_POST['final'] ."'
+					'" . $_POST['description'] ."'
 				);");
 			redirect(CR_ADMIN .'&amp;tab=manage&amp;msg=added');
@@ -77,9 +75,8 @@
 //				Définition des variables template
 // +-----------------------------------------------------------------------+	
-// Formulaire incomplet
+// Formulaire incomplet ##############################################################################################################################################################
 if ($page['errors']) {
 	$template->assign(array(
 		'NAME' => $_POST['name'],
-		'STATUS' => $_POST['status'],
 		'VISIBLE' => $_POST['visible'],
 		'DATE_BEGIN' => $_POST['date_begin'],
@@ -90,6 +87,14 @@
 	));
 	
-	foreach ($textareas AS $key) {
-		$template->assign(strtoupper($key), $_POST[$key]);
+	if (isset($_POST['description'])) {
+		$i=0;
+		foreach ($_POST['description'] as $data) {
+			$template->append('description', array(
+					'NAME' => $data['name'],
+					'CONTENT' => $data['content'],
+					'RANK' => $i,
+			));
+			$i++;
+		}
 	}
 
@@ -102,5 +107,4 @@
 		'ID' => $contest['id'],
 		'NAME' => $contest['name'],
-		'STATUS' => $contest['status'],
 		'VISIBLE' => $contest['visible'],
 		'DATE_BEGIN' => $contest['date_begin'],
@@ -111,6 +115,15 @@
 	));
 	
-	foreach ($textareas AS $key) {
-		$template->assign(strtoupper($key), $contest[$key]);
+	if ($contest['description'] != null) {
+		$contest['description'] = unserialize(base64_decode($contest['description']));
+		$i=0;
+		foreach ($contest['description'] AS $desc) {
+			$template->append('description', array(
+				'NAME' => stripslashes($desc['name']),
+				'CONTENT' => stripslashes($desc['content']),
+				'RANK' => $i,
+			));
+			$i++;
+		}
 	}
 
@@ -119,5 +132,4 @@
 	$template->assign(array(
 		'NAME' => null,
-		'STATUS' => 'pending',
 		'VISIBLE' => 1,
 		'DATE_BEGIN' => date('Y-m-d'),
@@ -127,8 +139,4 @@
 		'SUMMARY' => null,
 	));
-	
-	foreach ($textareas AS $key) {
-		$template->assign(strtoupper($key), null);
-	}
 }
 
Index: /extensions/ContestResults/admin/template/config.tpl
===================================================================
--- /extensions/ContestResults/admin/template/config.tpl	(revision 9571)
+++ /extensions/ContestResults/admin/template/config.tpl	(revision 9572)
@@ -1,6 +1,6 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
+{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
+{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
 
 {html_head}
-	<link rel="stylesheet" type="text/css" href="{$CR_PATH}admin/template/style.css">
 	<style type="text/css">
 		tr td:first-child {ldelim} 
@@ -9,13 +9,12 @@
 		}
 	</style>
+	
 	<script type="text/javascript">
-		function ToggleConfig(sel, section, fast){ldelim}
-			var obj = $('#config_'+section);
+		function ToggleConfig(sel, section){ldelim}
+			var obj = jQuery('#config_'+section);
 			if(sel.checked){ldelim}
-				if(fast) obj.show();
-				else obj.slideDown("slow");
+				obj.show();
 			}else{ldelim}
-				if(fast) obj.hide();
-				else obj.slideUp("slow");
+				obj.hide();
 			}
 		}
@@ -66,5 +65,5 @@
 
 <script type="text/javascript">
-	ToggleConfig(document.forms[0].elements['menubar_mode_link'], 'link', 1);
-	ToggleConfig(document.forms[0].elements['menubar_mode_block'], 'block', 1);
+	ToggleConfig(document.forms[0].elements['menubar_mode_link'], 'link');
+	ToggleConfig(document.forms[0].elements['menubar_mode_block'], 'block');
 </script>
Index: /extensions/ContestResults/admin/template/manage.tpl
===================================================================
--- /extensions/ContestResults/admin/template/manage.tpl	(revision 9571)
+++ /extensions/ContestResults/admin/template/manage.tpl	(revision 9572)
@@ -1,5 +1,3 @@
-{html_head}
-	<link rel="stylesheet" type="text/css" href="{$CR_PATH}admin/template/style.css">
-{/html_head}
+{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
 
 <h2 style="float:right;top:-24px;position:relative;font-style:italic;margin-bottom:-20px;font-size:12px;font-weight:normal;">{$CR_VERSION}</h2>
@@ -41,4 +39,5 @@
 							{if !empty($contest.LOGO)}<img src="{$contest.LOGO}" width="13px" class="button"/>{/if}
 							<strong><a href="{$contest.URL}" title="{'CR_go'|@translate}">{$contest.NAME}</a></strong> - {$contest.DATE_BEGIN} | {$contest.DATE_END}
+							<span class="CR_finished">{$contest.DAYS} {'CR_days'|@translate}</span>
 						</p>
 					</li>
Index: /extensions/ContestResults/admin/template/new.tpl
===================================================================
--- /extensions/ContestResults/admin/template/new.tpl	(revision 9571)
+++ /extensions/ContestResults/admin/template/new.tpl	(revision 9572)
@@ -1,10 +1,86 @@
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
-
+{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
+{combine_script id='jquery.ui' path='themes/default/js/ui/minified/jquery.ui.core.min.js'}
+{combine_script id='jquery.ui.sortable' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'}
+{combine_script id='jquery.cluetip' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
+{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
 {include file='include/autosize.inc.tpl'}
 {include file='include/datepicker.inc.tpl'}
 
 {html_head}
-	<link rel="stylesheet" type="text/css" href="{$CR_PATH}admin/template/style.css">
+	<script type="text/javascript">
+		// AJOUTE UN CHAMP DE RESULTAT
+		function CreateDescField(j, new_contest){ldelim}
+			// Si il n'y a aucun résultats on efface le message
+			if(new_contest) document.getElementById('categoryUl').innerHTML = '';
+			
+			// Ajoute à la fin de la liste une nouvelle ligne de résultat vide
+			var new_result = document.createElement('li');
+			new_result.setAttribute('id', 'desc_'+(j));
+			new_result.setAttribute('class', 'categoryLi virtual_cat');
+			document.getElementById('categoryUl').appendChild(new_result);
+			
+			// Contenu de la ligne
+			new_result.innerHTML = '<ul class="categoryActions"> '+
+					'<li> '+
+						'<a href="#" title="{'CR_delete_desc'|@translate}" onclick="DeleteDescField('+ j +');return false;"> '+
+							'<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/> '+
+						'</a> '+
+					'</li> '+
+				'</ul> '+
+				'<p> '+
+					'<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}"> '+
+					'<input type="text" size="65" name="description['+ j +'][name]" value=""/> '+
+					'<textarea class="result_comment" name="description['+ j +'][content]"></textarea> '+
+				'</p> '+
+				'<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="description['+ j +'][rank]" value=""/></p>';
+			
+			// Remplace le lien de création
+			document.getElementById('AddLink').innerHTML = '<input class="submit" type="reset" onclick="CreateDescField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>';
+			
+			// Réinitiliase les fonctions jQuery
+			jQuery('.catPos').hide();
+			jQuery('.drag_button').show();
+			jQuery('.categoryLi').css('cursor', 'move');
+			jQuery('textarea').autogrow();
+			jQuery('textarea').css('overflow-y', 'hidden');
+			vtip();
+		}
+		
+		// SUPPRIME UN CHAMP DE RESULTAT
+		function DeleteDescField(k){ldelim}
+			var result = document.getElementById('desc_'+k);
+			var parent = result.parentNode;
+			parent.removeChild(result);
+		}
+
+		jQuery().ready(function(){ldelim}
+			//  Drag-and-Drop
+			jQuery('.catPos').hide();
+			jQuery('.drag_button').show();
+			jQuery('.categoryLi').css('cursor', 'move');
+			jQuery('.categoryUl').sortable({ldelim}
+				axis: 'y',
+				opacity: 0.8
+			});
+			jQuery('#categoryOrdering').submit(function(){ldelim}
+				ar = jQuery('.categoryUl').sortable('toArray');
+				for(i=0; i<ar.length; i++) {ldelim}
+					cat = ar[i].split('desc_');
+					document.getElementsByName('description[' + cat[1] + '][rank]')[0].value = i+1;
+				}
+			});
+			// Cluetip
+			jQuery('.cluetip').cluetip({ldelim}
+				width: 550,
+				splitTitle: '|'
+			});
+		});
+
+		$(function() {ldelim}
+			$('#DateBegin').datepicker({ldelim}dateFormat:'yy-mm-dd', firstDay:1});
+			$('#DateEnd').datepicker({ldelim}dateFormat:'yy-mm-dd', firstDay:1});
+		});
+	</script>
+
 	<style type="text/css">
 		.cluetip:after {ldelim}
@@ -12,17 +88,4 @@
 		}
 	</style>
-	<script type="text/javascript">
-		$(function() {ldelim}
-			$('#DateBegin').datepicker({ldelim}dateFormat:'yy-mm-dd', firstDay:1});
-			$('#DateEnd').datepicker({ldelim}dateFormat:'yy-mm-dd', firstDay:1});
-		});
-
-		jQuery().ready(function(){ldelim}
-			jQuery('.cluetip').cluetip({ldelim}
-				width: 550,
-				splitTitle: '|'
-			});
-		});
-	</script>
 {/html_head}
 
@@ -39,5 +102,5 @@
 </div>
 
-<form method="post" action="" class="properties">
+<form method="post" action="" class="properties" id="categoryOrdering">
 	<fieldset>
 		<legend>{'Configuration'|@translate}</legend>
@@ -52,9 +115,4 @@
 			
 			<tr>
-				<td><span class="title cluetip" title="{'CR_status'|@translate}|{'CR_help_status'|@translate}">{'CR_status'|@translate}</span></td>
-				<td>
-					<label><input type="radio" name="status" value="pending" {if $STATUS == 'pending'}checked="checked"{/if}> {'CR_pending'|@translate}</label>
-					<label><input type="radio" name="status" value="finished" {if $STATUS == 'finished'}checked="checked"{/if}> {'CR_finished'|@translate}</label>
-				</td>
 				<td><span class="title cluetip" title="{'CR_visible'|@translate}|{'CR_help_visible'|@translate}">{'CR_visible'|@translate}</span></td>
 				<td>
@@ -62,4 +120,5 @@
 					<label><input type="radio" name="visible" value="0" {if $VISIBLE == 0}checked="checked"{/if}> {'No'|@translate}</label>
 				</td>
+				<td colspan="2"></td>
 			</tr>
 			<tr>
@@ -85,5 +144,5 @@
 			<tr>
 				<td><span class="title cluetip" title="{'CR_summary'|@translate}|{'CR_help_summary'|@translate}">{'CR_summary'|@translate}</span></td>
-				<td colspan="3"><textarea name="summary" id ="textarea" rows="4" style="width:100%;">{$SUMMARY}</textarea></td>
+				<td colspan="3"><textarea name="summary" rows="4" style="width:100%;">{$SUMMARY}</textarea></td>
 			</tr>
 		</table>
@@ -93,31 +152,32 @@
 		<legend><span class="title cluetip" title="{'CR_textareas'|@translate}|{'CR_help_textareas'|@translate}">{'CR_textareas'|@translate}</span></legend>
 		
-		<table>			
-			<tr>
-				<td><span class="title">{'CR_presentation'|@translate}</span></td>
-				<td style="width:75%;"><textarea name="presentation" id ="textarea" rows="4" style="width:100%;">{$PRESENTATION}</textarea></td>
-			</tr>
-			
-			<tr><td colspan="2"><br/></td></tr>
-			
-			<tr>
-				<td><span class="title">{'CR_rules'|@translate}</span></td>
-				<td><textarea name="rules" id ="textarea" rows="4" style="width:100%;">{$RULES}</textarea></td>
-			</tr>
-			
-			<tr><td colspan="2"><br/></td></tr>
-			
-			<tr>
-				<td><span class="title">{'CR_prices'|@translate}</span></td>
-				<td><textarea name="prices" id ="textarea" rows="4" style="width:100%;">{$PRICES}</textarea></td>
-			</tr>
-			
-			<tr><td colspan="2"><br/></td></tr>
-			
-			<tr>
-				<td><span class="title">{'CR_final'|@translate}</span></td>
-				<td><textarea name="final" id ="textarea" rows="4" style="width:100%;">{$FINAL}</textarea></td>
-			</tr>
-		</table>
+		<ul class="categoryUl" id="categoryUl">
+		{counter start=0 assign=i}
+		{if isset($description)}
+			{foreach from=$description item=desc}
+				<li class="categoryLi" id="desc_{$i}">
+					<ul class="categoryActions">
+						<li>
+							<a href="#" title="{'CR_delete_desc'|@translate}" onclick="DeleteDescField({$i});return false;">
+								<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/>
+							</a>
+						</li>
+					</ul>
+					
+					<p>
+						<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}">
+						<input type="text" size="65" name="description[{$i}][name]" value="{$desc.NAME}"/>
+						<textarea class="result_comment" name="description[{$i}][content]">{$desc.CONTENT}</textarea>
+					</p>
+					<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="description[{$i}][rank]" value="{$desc.RANK}"/></p>
+				</li>
+				{counter}
+			{/foreach}
+		{else}
+			{'CR_no_result'|@translate}
+		{/if}
+		</ul>
+		
+		<span id="AddLink"><input class="submit" type="reset" onclick="CreateDescField({$i}{if !isset($description)}, true{/if});return false;" value="{'CR_addfield'|@translate}"/></span>
 	</fieldset>
 
Index: /extensions/ContestResults/admin/template/results.tpl
===================================================================
--- /extensions/ContestResults/admin/template/results.tpl	(revision 9571)
+++ /extensions/ContestResults/admin/template/results.tpl	(revision 9572)
@@ -1,13 +1,11 @@
+{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
+{combine_script id='jquery.ui' path='themes/default/js/ui/minified/jquery.ui.core.min.js'}
+{combine_script id='jquery.ui.sortable' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'}
+{combine_script id='jquery.cluetip' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
+{combine_script id='jquery.vtip' path=$CR_PATH|@cat:'admin/template/vtip.js'}
+{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
 {include file='include/autosize.inc.tpl'}
 
-{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js" }
-{known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.sortable.packed.js" }
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
-
 {html_head}
-	<link rel="stylesheet" type="text/css" href="{$CR_PATH}admin/template/style.css">
-	<script type="text/javascript" src="{$CR_PATH}admin/template/vtip.js"></script>
-
 	<script type="text/javascript">
 		// AJOUTE UN CHAMP DE RESULTAT
@@ -34,5 +32,5 @@
 					'{'CR_image_no'|@translate} <input type="text" size="6" name="results['+ j +'][image_id]" value="" onkeyup="UpdatePreview('+ j +', this);"/> '+
 					'<span id="preview-'+ j +'"> '+
-						'<span class="vtip" title="<img src=\'{$themeconf.admin_icon_dir}/errors.png\'/><br>N/A"> '+
+						'<span class="vtip" title="<img src=\'admin/themes/default/icon/errors.png\'/><br>N/A"> '+
 							'<img src="{$CR_PATH}admin/template/image/images.png"/> '+
 						'</span> '+
@@ -44,5 +42,5 @@
 			
 			// Remplace le lien de création
-			document.getElementById('AddLink').innerHTML = '<input class="submit" type="submit" onclick="CreateResultField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>';
+			document.getElementById('AddLink').innerHTML = '<input class="submit" type="reset" onclick="CreateResultField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>';
 			
 			// Réinitiliase les fonctions jQuery
@@ -97,4 +95,5 @@
 		}
 	</script>
+	
 	<style type="text/css">
 		.cluetip:after {ldelim}
@@ -112,41 +111,41 @@
 <form method="post" id="categoryOrdering" action="">
 	<ul class="categoryUl" id="categoryUl">
-		{counter start=0 assign=i}
-		{if isset($results)}
-			{foreach from=$results item=result name=result_loop}
-				<li class="categoryLi {if $result.IMAGE_NAME == 'N/A'}error_cat{/if}" id="result_{$i}">
-					<ul class="categoryActions">
-						<li>
-							<a href="#" title="{'CR_delete_result'|@translate}" onclick="DeleteResultField({$i});return false;">
-								<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/>
-							</a>
-						</li>
-					</ul>
+	{counter start=0 assign=i}
+	{if isset($results)}
+		{foreach from=$results item=result}
+			<li class="categoryLi {if $result.IMAGE_NAME == 'N/A'}error_cat{/if}" id="result_{$i}">
+				<ul class="categoryActions">
+					<li>
+						<a href="#" title="{'CR_delete_result'|@translate}" onclick="DeleteResultField({$i});return false;">
+							<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/>
+						</a>
+					</li>
+				</ul>
+				
+				<p>
+					<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}">
+					{'CR_image_no'|@translate} <input type="text" size="6" name="results[{$i}][image_id]" value="{$result.IMAGE_ID}" onkeyup="UpdatePreview({$i}, this);"/>
 					
-					<p>
-						<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}">
-						{'CR_image_no'|@translate} <input type="text" size="6" name="results[{$i}][image_id]" value="{$result.IMAGE_ID}" onkeyup="UpdatePreview({$i}, this);"/>
-						
-						<span id="preview-{$i}">
-							<span class="vtip" title="<img src='{$result.TN_SRC}'/><br>{$result.IMAGE_NAME}">
-								<img src="{$CR_PATH}admin/template/image/images.png"/>
-							</span>
+					<span id="preview-{$i}">
+						<span class="vtip" title="<img src='{$result.TN_SRC}'/><br>{$result.IMAGE_NAME}">
+							<img src="{$CR_PATH}admin/template/image/images.png"/>
 						</span>
-						
-						{'CR_author'|@translate} : <input type="text" name="results[{$i}][author]" value="{$result.AUTHOR}"/>
-						<textarea class="result_comment" name="results[{$i}][comment]">{$result.COMMENT}</textarea>
-					</p>
-					<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="results[{$i}][rank]" value="{$result.RANK}"/></p>
-				</li>
-				{counter}
-			{/foreach}
-		{else}
-			{'CR_no_result'|@translate}
-		{/if}
+					</span>
+					
+					{'CR_author'|@translate} : <input type="text" name="results[{$i}][author]" value="{$result.AUTHOR}"/>
+					<textarea class="result_comment" name="results[{$i}][comment]">{$result.COMMENT}</textarea>
+				</p>
+				<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="results[{$i}][rank]" value="{$result.RANK}"/></p>
+			</li>
+			{counter}
+		{/foreach}
+	{else}
+		{'CR_no_result'|@translate}
+	{/if}
 	</ul>
 	
 	<p>
+		<span id="AddLink"><input class="submit" type="reset" onclick="CreateResultField({$i}{if !isset($results)}, true{/if});return false;" value="{'CR_addfield'|@translate}"/></span>
 		<input class="submit" type="submit" value="{'Submit'|@translate}" name="results_modify"/>
-		<span id="AddLink"><input class="submit" type="submit" onclick="CreateResultField({$i}{if !isset($results)}, true{/if});return false;" value="{'CR_addfield'|@translate}"/></a>
 	</p>
 </form>
Index: /extensions/ContestResults/admin/template/style.css
===================================================================
--- /extensions/ContestResults/admin/template/style.css	(revision 9571)
+++ /extensions/ContestResults/admin/template/style.css	(revision 9572)
@@ -9,5 +9,5 @@
 	width:95%;
 	min-height:40px;
-	margin-left:5%;
+	margin:0 30px;
 }
 
@@ -63,2 +63,10 @@
 	z-index: 9999;
 }
+
+.CR_finished {
+	font-weight:normal;
+	font-size:0.8em;
+	letter-spacing:0.2em;
+	padding-left:10px;
+	color:#a00;
+}
Index: /extensions/ContestResults/changelog.txt
===================================================================
--- /extensions/ContestResults/changelog.txt	(revision 9571)
+++ /extensions/ContestResults/changelog.txt	(revision 9572)
@@ -1,5 +1,8 @@
-1.2.b
+1.3
 - Add error and success messages on admin page
-- ...
+- Add Spain (es_ES) thanks to jpr928
+- Contest status is automatic and shows remaining days
+- More flexibility for description fields
+- Compatibility with Piwigo 2.2.0
 
 1.2.a
Index: /extensions/ContestResults/include/cr_comment_picture.php
===================================================================
--- /extensions/ContestResults/include/cr_comment_picture.php	(revision 9571)
+++ /extensions/ContestResults/include/cr_comment_picture.php	(revision 9572)
@@ -1,4 +1,8 @@
 <?php
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// +-----------------------------------------------------------------------+
+//		Affichage du commentaire sur la page d'une image participante
+// +-----------------------------------------------------------------------+
 
 // Requète simple pour savoir si l'image a participé à des concours 
@@ -6,4 +10,5 @@
 
 if(pwg_db_num_rows($participation)){
+	// requète complète
 	$results = pwg_query("SELECT 
 			i.rank,
@@ -46,6 +51,9 @@
 	</style>';
 
+	// +-----------------------------------------------------------------------+
+	//				Template
+	// +-----------------------------------------------------------------------+
 	$template->assign('COMMENT_IMG', $template->get_template_vars('COMMENT_IMG') . $comment);
-	$template->assign('PLUGIN_PICTURE_BEFORE', $template->get_template_vars('PLUGIN_PICTURE_BEFORE') . $css);
+	$template->append('footer_elements', $css);
 }
 ?>
Index: /extensions/ContestResults/include/cr_main.php
===================================================================
--- /extensions/ContestResults/include/cr_main.php	(revision 9571)
+++ /extensions/ContestResults/include/cr_main.php	(revision 9572)
@@ -11,5 +11,4 @@
 		date_begin, 
 		date_end, 
-		status, 
 		logo, 
 		summary 
@@ -19,4 +18,6 @@
 while ($contest = pwg_db_fetch_assoc($contests)) {
 	if ($contest['visible'] OR is_admin()) {
+		$contest['finished'] = is_date_passed($contest['date_end']);
+		
 		// infos sur le concours
 		$item =  array(
@@ -24,5 +25,5 @@
 			'NAME' => trigger_event('render_CR_content', $contest['name']),
 			'VISIBLE' => $contest['visible'],
-			'STATUS' => $contest['status'],
+			'FINISHED' => $contest['finished'],
 			'DATE_END' => format_date($contest['date_end']),
 			'DATE_BEGIN' => format_date($contest['date_begin']),
@@ -30,8 +31,9 @@
 			'SUMMARY' => CR_cut_string(trigger_event('render_CR_content', $contest['summary']), 350),
 			'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
+			'DAYS' => DateDiff($contest['date_end'], date('Y-m-d')),
 		);
 		
 		// podium si terminé
-		if ($contest['status'] == 'finished') {
+		if ($contest['finished'] == true) {
 			$results = pwg_query("SELECT
 					i.id,
@@ -67,4 +69,7 @@
 //				Template
 // +-----------------------------------------------------------------------+
+if (is_admin()) {
+	$template->assign('U_EDIT', CR_ADMIN);
+}
 $template->assign('CR_PATH', CR_PATH);
 $template->assign('SEPARATOR', $conf['level_separator']);
Index: /extensions/ContestResults/include/cr_menubar.php
===================================================================
--- /extensions/ContestResults/include/cr_menubar.php	(revision 9571)
+++ /extensions/ContestResults/include/cr_menubar.php	(revision 9572)
@@ -37,5 +37,4 @@
 				name, 
 				visible, 
-				status, 
 				date_begin, 
 				date_end 
@@ -43,5 +42,5 @@
 			ORDER BY date_begin DESC;");
 
-		$m = 0; // copteur pour limiter le nombre de concours affichés
+		$m = 0; // compteur pour limiter le nombre de concours affichés
 		while($contest = pwg_db_fetch_assoc($contests)){
 			if (($contest['visible'] OR is_admin()) AND $m < $config['menubar_block']['number']) {
@@ -50,6 +49,7 @@
 					'LABEL' => trigger_event('render_CR_content', $contest['name']),
 					'DATE' => format_date($contest['date_begin']) . ' - ' . format_date($contest['date_end']),
-					'STATUS' => $contest['status'],
-					'VISIBLE' => $contest['visible']
+					'VISIBLE' => $contest['visible'],
+					'FINISHED' => is_date_passed($contest['date_end']),
+					'DAYS' => DateDiff($contest['date_end'],date('Y-m-d')),
 				));
 			}
Index: /extensions/ContestResults/include/cr_page.php
===================================================================
--- /extensions/ContestResults/include/cr_page.php	(revision 9571)
+++ /extensions/ContestResults/include/cr_page.php	(revision 9572)
@@ -15,4 +15,5 @@
 if (pwg_db_num_rows($contest)) { 
 	$contest = pwg_db_fetch_assoc($contest);
+	$contest['finished'] = is_date_passed($contest['date_end']);
 	
 	// Concours non-publique
@@ -25,6 +26,6 @@
 		'ID' => $contest['id'],
 		'NAME' => trigger_event('render_CR_content', $contest['name']),
-		'STATUS' => $contest['status'],
 		'VISIBLE' => $contest['visible'],
+		'FINISHED' => $contest['finished'],
 		'DATE_BEGIN' => format_date($contest['date_begin']),
 		'DATE_END' => format_date($contest['date_end']),
@@ -32,13 +33,20 @@
 		'BANNER' => $contest['banner'],
 		'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
+		'DAYS' => DateDiff($contest['date_end'], date('Y-m-d')),
 	));
 	
 	// Les quatre zones texte
-	foreach (array('presentation','rules','prices','final') AS $key) {
-		$template->assign(strtoupper($key), trigger_event('render_CR_content', $contest[$key]));
+	if (!empty($contest['description'])) {
+		$contest['description'] = unserialize(base64_decode($contest['description']));
+		foreach ($contest['description'] as $desc) {
+			$template->append('description', array(
+				'NAME' => trigger_event('render_CR_content', stripslashes($desc['name'])),
+				'CONTENT' => trigger_event('render_CR_content', stripslashes($desc['content'])),
+			));
+		}
 	}
 	
 	// Affichage des résultats
-	if ($contest['status'] == 'finished') {
+	if ($contest['finished'] == true) {
 		// Infos des résultats
 		$results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;");
Index: /extensions/ContestResults/include/cutstring.class.php
===================================================================
--- /extensions/ContestResults/include/cutstring.class.php	(revision 9571)
+++ /extensions/ContestResults/include/cutstring.class.php	(revision 9572)
@@ -6,60 +6,58 @@
 
 class HtmlCutString{
-  function __construct($string, $limit){
-    // create dom element using the html string
-    $this->tempDiv = new DomDocument;
-    $this->tempDiv->loadXML('<div>'.$string.'</div>');
-    // keep the characters count till now
-    $this->charCount = 0;
-    $this->encoding = 'UTF-8';
-    // character limit need to check
-    $this->limit = $limit;
-  }
-  function cut(){
-    // create empty document to store new html
-    $this->newDiv = new DomDocument;
-    // cut the string by parsing through each element
-    $this->searchEnd($this->tempDiv->documentElement,$this->newDiv);
-    $newhtml = $this->newDiv->saveHTML();
-    return $newhtml;
-  }
-
-  function deleteChildren($node) {
-    while (isset($node->firstChild)) {
-      $this->deleteChildren($node->firstChild);
-      $node->removeChild($node->firstChild);
-    }
-  } 
-  function searchEnd($parseDiv, $newParent){
-    foreach($parseDiv->childNodes as $ele){
-	// not text node
-	if($ele->nodeType != 3){
-	  $newEle = $this->newDiv->importNode($ele,true);
-	  if(count($ele->childNodes) === 0){
-	    $newParent->appendChild($newEle);
-	    continue;
-	  }
-	  $this->deleteChildren($newEle);
-	  $newParent->appendChild($newEle);
-	    $res = $this->searchEnd($ele,$newEle);
-	    if($res)
-			return $res;
-	    else
-			continue;
+	function __construct($string, $limit){
+		// create dom element using the html string
+		$this->tempDiv = new DomDocument;
+		$this->tempDiv->loadXML('<div>'.$string.'</div>');
+		// keep the characters count till now
+		$this->charCount = 0;
+		$this->encoding = 'UTF-8';
+		// character limit need to check
+		$this->limit = $limit;
 	}
-
-	// the limit of the char count reached
-	if(mb_strlen($ele->nodeValue,$this->encoding) + $this->charCount >= $this->limit){
-	  $newEle = $this->newDiv->importNode($ele);
-	    $newEle->nodeValue = substr($newEle->nodeValue,0, $this->limit - $this->charCount);
-	    $newParent->appendChild($newEle);
-	    return true;
+	function cut(){
+		// create empty document to store new html
+		$this->newDiv = new DomDocument;
+		// cut the string by parsing through each element
+		$this->searchEnd($this->tempDiv->documentElement,$this->newDiv);
+		$newhtml = $this->newDiv->saveHTML();
+		return $newhtml;
 	}
-	$newEle = $this->newDiv->importNode($ele);
-	$newParent->appendChild($newEle);
-	$this->charCount += mb_strlen($newEle->nodeValue,$this->encoding);
-    }
-    return false;
-  }
+	function deleteChildren($node) {
+		while (isset($node->firstChild)) {
+			$this->deleteChildren($node->firstChild);
+			$node->removeChild($node->firstChild);
+		}
+	} 
+	function searchEnd($parseDiv, $newParent){
+		foreach($parseDiv->childNodes as $ele){
+			// not text node
+			if($ele->nodeType != 3){
+				$newEle = $this->newDiv->importNode($ele,true);
+				if(count($ele->childNodes) === 0){
+					$newParent->appendChild($newEle);
+					continue;
+				}
+				$this->deleteChildren($newEle);
+				$newParent->appendChild($newEle);
+				$res = $this->searchEnd($ele,$newEle);
+				if($res)
+					return $res;
+				else
+					continue;
+			}
+			// the limit of the char count reached
+			if(mb_strlen($ele->nodeValue,$this->encoding) + $this->charCount >= $this->limit){
+				$newEle = $this->newDiv->importNode($ele);
+				$newEle->nodeValue = substr($newEle->nodeValue,0, $this->limit - $this->charCount);
+				$newParent->appendChild($newEle);
+				return true;
+			}
+			$newEle = $this->newDiv->importNode($ele);
+			$newParent->appendChild($newEle);
+			$this->charCount += mb_strlen($newEle->nodeValue,$this->encoding);
+		}
+		return false;
+	}
 }
 ?>
Index: /extensions/ContestResults/include/functions.php
===================================================================
--- /extensions/ContestResults/include/functions.php	(revision 9571)
+++ /extensions/ContestResults/include/functions.php	(revision 9572)
@@ -23,3 +23,17 @@
 	}
 }
+
+// Nombre de jours entre deux dates
+function DateDiff($date2, $date1) {
+	return ceil((strtotime($date2)-strtotime($date1))/(3600*24));
+}
+
+// Date passée
+function is_date_passed($date) {
+	if (time() > strtotime($date)) {
+		return true;
+	} else {
+		return false;
+	}
+}
 ?>
Index: /extensions/ContestResults/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/ContestResults/language/en_UK/plugin.lang.php	(revision 9571)
+++ /extensions/ContestResults/language/en_UK/plugin.lang.php	(revision 9572)
@@ -20,8 +20,4 @@
 $lang['CR_pending'] = 'Pending';
 $lang['CR_finished'] = 'Finished';
-$lang['CR_presentation'] = 'Presentation';
-$lang['CR_rules'] = 'Rules';
-$lang['CR_prices'] = 'Prices';
-$lang['CR_final'] = 'Ending';
 $lang['CR_summary'] = 'Summary';
 $lang['CR_textareas'] = 'Contest description';
@@ -45,4 +41,5 @@
 $lang['CR_results_saved'] = "Results saved";
 $lang['CR_name_empty'] = "The name of the contest can't be empty";
+$lang['CR_days'] = "days remaining";
 
 $lang['CR_order_1'] = '1<sup>st</sup>';
@@ -64,5 +61,5 @@
 $lang['CR_help_summary'] = "The summary is only displayed in the general contest page.<br/>
 	<br/>" . $lang['CR_help_lang'];
-$lang['CR_help_textareas'] = "These four areas allow you to describe the contest.<br/>
+$lang['CR_help_textareas'] = "Add here some text boxes to describe your contest.<br/>
 	<br/>" . $lang['CR_help_lang'];
 $lang['CR_help_results'] = "- Descriptions are displayed on each pictures pages and on the contest page for the first three.<br/>
Index: /extensions/ContestResults/language/es_ES/description.txt
===================================================================
--- /extensions/ContestResults/language/es_ES/description.txt	(revision 9572)
+++ /extensions/ContestResults/language/es_ES/description.txt	(revision 9572)
@@ -0,0 +1,1 @@
+Add contests management pages
Index: /extensions/ContestResults/language/es_ES/index.php
===================================================================
--- /extensions/ContestResults/language/es_ES/index.php	(revision 9572)
+++ /extensions/ContestResults/language/es_ES/index.php	(revision 9572)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/ContestResults/language/es_ES/plugin.lang.php
===================================================================
--- /extensions/ContestResults/language/es_ES/plugin.lang.php	(revision 9572)
+++ /extensions/ContestResults/language/es_ES/plugin.lang.php	(revision 9572)
@@ -0,0 +1,70 @@
+<?php
+
+$lang['Contests'] = 'Concurso';
+$lang['CR_edit_tab'] = 'Edición del Concurso';
+$lang['CR_delete'] = 'Suprimir el concurso';
+$lang['CR_delete_result'] = 'Eliminar elemento';
+$lang['CR_manage_tab'] = 'Gestiòn de concurso';
+$lang['CR_new_tab'] = 'Añadir un nuevo concurso';
+$lang['CR_results_tab'] = 'Resultados del Concurso';
+$lang['CR_pending_title'] = 'Concursos en curso';
+$lang['CR_finished_title'] = 'Concurso terminado';
+$lang['CR_results'] = 'Resultados';
+$lang['CR_go'] = 'Ir a la página del concurso';
+$lang['CR_title'] = 'Titulo';
+$lang['CR_status'] = 'Estatuto';
+$lang['CR_dateB'] = 'Fecha de inicio';
+$lang['CR_dateE'] = 'Fecha de finalización';
+$lang['CR_logo'] = 'Logo';
+$lang['CR_banner'] = 'Bandera';
+$lang['CR_pending'] = 'En curso';
+$lang['CR_finished'] = 'Terminado';
+$lang['CR_summary'] = 'Resumen';
+$lang['CR_textareas'] = 'Descripcion del concurso';
+$lang['CR_new'] = 'Nuevo concurso';
+$lang['CR_addfield'] = 'Añadir elemento';
+$lang['CR_no_result'] = 'No hay elementos registrados';
+$lang['CR_no_contest'] = 'No hay concurso registrado';
+$lang['CR_image_no'] = 'Imagen n°';
+$lang['CR_author'] = 'Autor';
+$lang['CR_comment'] = 'Comentario';
+$lang['CR_rank'] = 'Rango';
+$lang['CR_place'] = 'sitio';
+$lang['CR_period'] = 'Periodo';
+$lang['CR_visible'] = 'Publico';
+$lang['CR_nopublic'] = "Esta página no es accesible al público !";
+$lang['CR_notavailable'] = "Este concurso no está disponible";
+$lang['CR_id_unknown %d'] = "Imagen #% d no existe";
+$lang['CR_contest_saved'] = "Configuración del concurso guardada";
+$lang['CR_contest_added'] = "Concurso añadido";
+$lang['CR_contest_deleted'] = "Concurso eliminado";
+$lang['CR_results_saved'] = "Resultados guardado ";
+$lang['CR_name_empty'] = "El nombre del concurso no puede estar vacío";
+$lang['CR_days'] = "días restantes";
+
+$lang['CR_order_1'] = '1<sup>a</sup>';
+$lang['CR_order_2'] = '2<sup>0</sup>';
+$lang['CR_order_3'] = '3<sup>0</sup>';
+$lang['CR_order_sup'] = '<sup>0</sup>';
+
+$lang['CR_menubar_mode'] = 'Insertar ContestResults al menú';
+$lang['CR_menubar_link'] = 'Vínculo en un bloque menú existente'; 
+$lang['CR_menubar_link_display'] = 'Ver el enlace en los bloques';
+$lang['CR_menubar_block'] = 'Nuevo bloque menú';
+$lang['CR_menubar_block_number'] = 'Número de Concursos para mostrar en el bloque';
+
+$lang['CR_help_lang'] = (CR_ED_STATE == 'active') ? "<b>Puede usar HTML y descripciones multilingüe.</b>" : "<b>Puede usar HTML.</b>";
+$lang['CR_help_title'] = "" .$lang['CR_help_lang'];
+$lang['CR_help_status'] = "Cuando el concurso se <i>Termina</i> los resultados se publican en la página del concurso y el indicador <span style='color:#a00;'>(Terminado)</span> se activa.<br/>
+	<b>Atención :</b> El concurso no entra automáticamente en el estado terminado cuando la fecha de finalización se alcanza !";
+$lang['CR_help_visible'] = "Si el concurso no es público solo los <b>administradores</b> pueden verlo.";
+$lang['CR_help_summary'] = "El resumen se publica en la página listadando todos los concursos.<br/>
+	<br/>" .$lang['CR_help_lang'];
+$lang['CR_help_textareas'] = "Añadir cuadros de texto para describir su concurso.<br/>
+	<br/>" .$lang['CR_help_lang'];
+$lang['CR_help_results'] = "- Las descripciones se publicarán en las páginas de cada imagen y en la página del concurso para los tres primeros.<br/>
+	- Ordenar elementos arrastrando y soltando.<br/>
+	- Pase el ratón sobre el icono <img src='".CR_PATH."admin/template/image/images.png'/> para ver la imagen correspondiente al identificador de entrada.<br/>
+	<br/>" .$lang['CR_help_lang'];
+	
+?>
Index: /extensions/ContestResults/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/ContestResults/language/fr_FR/plugin.lang.php	(revision 9571)
+++ /extensions/ContestResults/language/fr_FR/plugin.lang.php	(revision 9572)
@@ -20,8 +20,4 @@
 $lang['CR_pending'] = 'En cours';
 $lang['CR_finished'] = 'Terminé';
-$lang['CR_presentation'] = 'Présentation';
-$lang['CR_rules'] = 'Contraintes';
-$lang['CR_prices'] = 'Prix';
-$lang['CR_final'] = 'Conclusion';
 $lang['CR_summary'] = 'Résumé';
 $lang['CR_textareas'] = 'Description du concours';
@@ -45,4 +41,5 @@
 $lang['CR_results_saved'] = "Résultats sauvegardés";
 $lang['CR_name_empty'] = "Le nom du concours ne peut être vide";
+$lang['CR_days'] = "jours restants";
 
 $lang['CR_order_1'] = '1<sup>ère</sup>';
@@ -64,5 +61,5 @@
 $lang['CR_help_summary'] = "Le résumé n'est affiché que sur la page regroupant tous les concours.<br/>
 	<br/>" . $lang['CR_help_lang'];
-$lang['CR_help_textareas'] = "Ces quatres zones de texte vous permettent de décrire le concours.<br/>
+$lang['CR_help_textareas'] = "Ajoutez ici des zones de texte pour décrire votre concours.<br/>
 	<br/>" . $lang['CR_help_lang'];
 $lang['CR_help_results'] = "- Les descriptions seront affichées sur les pages de chaque images et sur la page du concours pour les trois premiers.<br/>
Index: /extensions/ContestResults/language/lv_LV/plugin.lang.php
===================================================================
--- /extensions/ContestResults/language/lv_LV/plugin.lang.php	(revision 9571)
+++ /extensions/ContestResults/language/lv_LV/plugin.lang.php	(revision 9572)
@@ -20,8 +20,4 @@
 $lang['CR_pending'] = 'Vēl nepabeigts';
 $lang['CR_finished'] = 'Pabeigts';
-$lang['CR_presentation'] = 'Prezentācija';
-$lang['CR_rules'] = 'Noteikumi';
-$lang['CR_prices'] = 'Cenas';
-$lang['CR_final'] = 'Beigšana';
 $lang['CR_summary'] = 'Kopā';
 $lang['CR_textareas'] = 'Konkursa apraksts';
@@ -45,4 +41,5 @@
 $lang['CR_results_saved'] = "Rezultāti saglabāti";
 $lang['CR_name_empty'] = "Konkursa nosaukums nevar būt tukšs";
+$lang['CR_days'] = "atlikušo dienu";
 
 $lang['CR_order_1'] = '1.';
@@ -64,5 +61,5 @@
 $lang['CR_help_summary'] = "Kopsavilkums tiek attēlots tikai konkursa galvenajā lapā.<br/>
 	<br/>" . $lang['CR_help_lang'];
-$lang['CR_help_textareas'] = "Šie četri apgabali dod jums iespēju aprakstīt konkursu.<br/>
+$lang['CR_help_textareas'] = "Lūdzu, pievienojiet tekstlodziņus, lai aprakstītu jūsu konkurentiem.<br/>
 	<br/>" . $lang['CR_help_lang'];
 $lang['CR_help_results'] = "- Apraksti tiek rādīti uz katras attēla lapas un uz konkursa lapas - pirmajiem trim.<br/>
Index: /extensions/ContestResults/main.inc.php
===================================================================
--- /extensions/ContestResults/main.inc.php	(revision 9571)
+++ /extensions/ContestResults/main.inc.php	(revision 9572)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: ContestResults
-Version: 1.2.a
+Version: 1.3
 Description: Add contests management pages
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=439
@@ -16,10 +16,10 @@
 //				Variables globales CR
 // +-----------------------------------------------------------------------+
+define('CR_NAME' , 'Contest Results');
+define('CR_VERSION', '1.3');
 define('CR_DIR' , basename(dirname(__FILE__)));
 define('CR_PATH' , PHPWG_PLUGINS_PATH . CR_DIR . '/');
 define('CR_TABLE_1' , $prefixeTable . 'contests');
 define('CR_TABLE_2' , $prefixeTable . 'contests_results');
-define('CR_NAME' , 'ContestResults');
-define('CR_VERSION', '1.2.a');
 define('CR_ADMIN', PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . CR_DIR . '/admin/admin.php');
 define('CR_PUBLIC', make_index_url(array('section' => 'contests')) . '/');
@@ -42,4 +42,5 @@
 //					Fonctions
 // +-----------------------------------------------------------------------+
+include(CR_PATH . 'include/functions.php');
 // Gestion du menu
 include(CR_PATH . 'include/cr_menubar.php');
@@ -59,5 +60,4 @@
 	
 	load_language('plugin.lang', CR_PATH);
-	include(CR_PATH . 'include/functions.php');
 	
     if ($tokens[0] == 'contests') { // on est dans la section concours
@@ -65,8 +65,10 @@
 		$page['title'] = l10n('Contests');
 		
-		if (isset($tokens[1]) AND $tokens[1]) { // on est sur la page d'un concours
-			$page['contest'] = explode('-', $tokens[1]);
-			$page['contest'] = $page['contest'][0];
-			$page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', get_contest_name($page['contest']));
+		if (isset($tokens[1]) AND !empty($tokens[1])) { // on est sur la page d'un concours
+			$tokens[1] = explode('-', $tokens[1]);
+			if (preg_match('#^([0-9]*)$#', $tokens[1][0])) { // is_int ne marche pas parce que le chiffre est stocké en (string)
+				$page['contest'] = $tokens[1][0];
+				$page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', get_contest_name($page['contest']));
+			}
 		}
 	}
Index: /extensions/ContestResults/maintain.inc.php
===================================================================
--- /extensions/ContestResults/maintain.inc.php	(revision 9571)
+++ /extensions/ContestResults/maintain.inc.php	(revision 9572)
@@ -3,5 +3,5 @@
 
 // Configuration par défaut
-define('default_config' , serialize(array(
+define('default_config', serialize(array(
 	'menubar_mode' => array(
 		'link' => 0,
@@ -26,13 +26,8 @@
 		`date_begin` DATE NOT NULL ,
 		`date_end` DATE NOT NULL ,
-		`status` VARCHAR( 255 ) NOT NULL ,
 		`visible` TINYINT(1) NOT NULL ,
 		`logo` VARCHAR( 255 ) NULL ,
 		`banner` VARCHAR( 255 ) NULL ,
-		`summary` TEXT NULL ,
-		`presentation` TEXT NULL ,
-		`rules` TEXT NULL ,
-		`prices` TEXT NULL ,
-		`final` TEXT NULL ,
+		`description` TEXT NULL ,
 		PRIMARY KEY ( `id` )
 	);");
@@ -62,9 +57,61 @@
 	$field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'");
 	if (pwg_db_num_rows($field)) {
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `presentation_display`");
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `rules_display`");
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `prices_display`");
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `final_display`");
+		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 
+			DROP `presentation_display`,
+			DROP `rules_display`,
+			DROP `prices_display`,
+			DROP `final_display`;"
+		);
 	}
+	
+	// compatibilité avec les versions < 1.3 (suppression option status, regroupement des champs de description)
+	$field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'");
+	if (pwg_db_num_rows($field)) {
+		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`");
+		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL");
+		
+		$contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`");
+		while ($contest = pwg_db_fetch_assoc($contests)) {
+			$new_description = array();
+			if (!empty($contest['presentation'])) {
+				$new_description[] = array(
+					'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]',
+					'content' => $contest['presentation'],
+				);
+			}
+			if (!empty($contest['rules'])) {
+				$new_description[] = array(
+					'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]',
+					'content' => $contest['rules'],
+				);
+			}
+			if (!empty($contest['prices'])) {
+				$new_description[] = array(
+					'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]',
+					'content' => $contest['prices'],
+				);
+			}
+			if (!empty($contest['final'])) {
+				$new_description[] = array(
+					'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]',
+					'content' => $contest['final'],
+				);
+			}
+		
+			$new_description = base64_encode(serialize($new_description));
+			pwg_query("UPDATE `" . $prefixeTable . "contests`
+				SET description = '". $new_description ."'
+				WHERE id = ". $contest['id'] .";"
+			);
+		}
+		
+		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 
+			DROP `presentation`,
+			DROP `rules`,
+			DROP `prices`,
+			DROP `final`;"
+		);
+	}
+	
 }
 
Index: /extensions/ContestResults/template/cr_main.tpl
===================================================================
--- /extensions/ContestResults/template/cr_main.tpl	(revision 9571)
+++ /extensions/ContestResults/template/cr_main.tpl	(revision 9572)
@@ -1,5 +1,3 @@
-{html_head}
-<link rel="stylesheet" type="text/css" href="{$CR_PATH}template/style.css">
-{/html_head}
+{combine_css id='cr_style' path=$CR_PATH|@cat:'template/style.css'}
 
 {$MENUBAR}
@@ -10,5 +8,11 @@
 	<div class="titrePage">
 		<ul class="categoryActions">
+			{if isset($U_EDIT)}
+			<li><a href="{$U_EDIT}" title="{'edit'|@translate}" class="pwg-state-default pwg-button">
+				<span class="pwg-icon pwg-icon-category-edit"> </span><span class="pwg-button-text">{'edit'|@translate}</span>
+			</a></li>
+			{/if}
 			{if !empty($PLUGIN_INDEX_ACTIONS)}{$PLUGIN_INDEX_ACTIONS}{/if}
+		</ul>
 		</ul>
 		<h2>{'Contests'|@translate}</h2>
@@ -26,10 +30,10 @@
 			<div class="thumbnailCategory {if $contest.VISIBLE == 0}novisible{/if}">
 				<div class="illustration">
-				{if $contest.STATUS == 'pending'}
+				{if !$contest.FINISHED == 'pending'}
+					<a href="{$contest.URL}">
 					{if !empty($contest.LOGO)}
-						<a href="{$contest.URL}">
-							<img src="{$contest.LOGO}" alt="{$contest.NAME}" style="max-height:120px;max-width:120px;">
-						</a>
+						<img src="{$contest.LOGO}" alt="{$contest.NAME}" style="max-height:120px;max-width:120px;">
 					{/if}
+					</a>
 				{else}
 					<a href="{$contest.URL}">
@@ -41,10 +45,14 @@
 					<h3>
 						<a href="{$contest.URL}">{$contest.NAME}</a>
-						{if $contest.STATUS == 'finished'}<span class="CR_finished">({'CR_finished'|@translate})</span>{/if}
+						{if $contest.FINISHED}
+							<span class="CR_finished">({'CR_finished'|@translate})</span>
+						{else}
+							<span class="CR_finished">({$contest.DAYS} {'CR_days'|@translate})</span>
+						{/if}
 					</h3>
 					<div class="text">
 						<p class="Nb_images">{$contest.DATE_BEGIN} - {$contest.DATE_END}</p>
 						<p>
-						{if $contest.STATUS == 'pending'}
+						{if !$contest.FINISHED}
 							{if !empty($contest.SUMMARY)}
 								{$contest.SUMMARY}
Index: /extensions/ContestResults/template/cr_menubar.tpl
===================================================================
--- /extensions/ContestResults/template/cr_menubar.tpl	(revision 9571)
+++ /extensions/ContestResults/template/cr_menubar.tpl	(revision 9572)
@@ -1,7 +1,8 @@
 {html_head}
 	<style type="text/css">
-		.CR_finished {ldelim}
+		.CR_finished_menu {ldelim}
 			font-size:0.8em;
 			color:#a00;
+			letter-spacing:0px;
 		}
 	</style>
@@ -15,5 +16,9 @@
 				<a href="{$data.URL}" title="{$data.DATE}">
 					{$data.LABEL}
-					{if $data.STATUS == 'finished'}<span class="CR_finished">&times;</span>{/if}
+					{if $data.FINISHED}
+						<span class="CR_finished_menu">&times;</span>
+					{else}
+						<span class="CR_finished_menu">{$data.DAYS}</span>
+					{/if}
 				</a>
 			</li>
Index: /extensions/ContestResults/template/cr_page.tpl
===================================================================
--- /extensions/ContestResults/template/cr_page.tpl	(revision 9571)
+++ /extensions/ContestResults/template/cr_page.tpl	(revision 9572)
@@ -1,5 +1,3 @@
-{html_head}
-	<link rel="stylesheet" type="text/css" href="{$CR_PATH}template/style.css">
-{/html_head}
+{combine_css id='cr_style' path=$CR_PATH|@cat:'template/style.css'}
 
 {$MENUBAR}
@@ -10,5 +8,7 @@
 		<ul class="categoryActions">  
 			{if isset($U_EDIT) }
-				<li><a href="{$U_EDIT}" title="{'CR_edit_tab'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/category_edit.png" class="button" alt="{'CR_edit_tab'|@translate}"></a></li>
+			<li><a href="{$U_EDIT}" title="{'CR_edit_tab'|@translate}" class="pwg-state-default pwg-button">
+				<span class="pwg-icon pwg-icon-category-edit"> </span><span class="pwg-button-text">{'CR_edit_tab'|@translate}</span>
+			</a></li>
 			{/if}
 			{if !empty($PLUGIN_INDEX_ACTIONS)}{$PLUGIN_INDEX_ACTIONS}{/if}
@@ -16,5 +16,9 @@
 		<h2>
 			<a href="index.php?/contests" name="top">{'Contests'|@translate}</a>{$SEPARATOR}<a href="{$URL}">{$NAME}</a>
-			{if $STATUS=='finished'}<span class="CR_finished">({'CR_finished'|@translate})</span>{/if}
+			{if $FINISHED}
+				<span class="CR_finished">({'CR_finished'|@translate})</span>
+			{else}
+				<span class="CR_finished">({$DAYS} {'CR_days'|@translate})</span>
+			{/if}
 		</h2>
 	</div> <!-- titrePage -->
@@ -38,31 +42,10 @@
 	</div>
 	
-	{if !empty($PRESENTATION)}
+	{foreach from=$description item=desc name=desc_loop}
 		<div class="CR_text">
-			<h3>{'CR_presentation'|@translate} :</h3>
-			{$PRESENTATION}
+			<h3>{$desc.NAME} :</h3>
+			{$desc.CONTENT}
 		</div>
-	{/if}
-	
-	{if !empty($RULES)}	
-		<div class="CR_text">
-			<h3>{'CR_rules'|@translate} :</h3>
-			{$RULES}
-		</div>
-	{/if}
-	
-	{if !empty($PRICES)}
-		<div class="CR_text">
-			<h3>{'CR_prices'|@translate} :</h3>
-			{$PRICES}
-		</div>
-	{/if}
-	
-	{if !empty($FINAL)}
-		<div class="CR_text">
-			<h3>{'CR_final'|@translate} :</h3>
-			{$FINAL}
-		</div>
-	{/if}
+	{/foreach}
 </div> <!-- content_contest -->
 
@@ -72,5 +55,7 @@
 			<ul class="categoryActions">  
 				{if isset($U_RESULTS) }
-					<li><a href="{$U_RESULTS}" title="{'CR_results'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/category_edit.png" class="button" alt="{'CR_results'|@translate}"></a></li>
+				<li><a href="{$U_RESULTS}" title="{'CR_results'|@translate}" class="pwg-state-default pwg-button">
+					<span class="pwg-icon pwg-icon-category-edit"> </span><span class="pwg-button-text">{'CR_edit_tab'|@translate}</span>
+				</a></li>
 				{/if}
 			</ul>
Index: /extensions/ContestResults/template/style.css
===================================================================
--- /extensions/ContestResults/template/style.css	(revision 9571)
+++ /extensions/ContestResults/template/style.css	(revision 9572)
@@ -2,5 +2,5 @@
 	font-weight:normal;
 	font-size:0.8em;
-	letter-spacing:0.3em;
+	letter-spacing:0.2em;
 	padding-left:10px;
 	color:#a00;
