Index: /trunk/admin/rating.php
===================================================================
--- /trunk/admin/rating.php	(revision 26836)
+++ /trunk/admin/rating.php	(revision 26837)
@@ -213,8 +213,9 @@
 
   $tpl_image = 
-     array(
-       'U_THUMB' => $thumbnail_src,
-       'U_URL' => $image_url,
-			 'SCORE_RATE' => $image['score'],
+    array(
+      'id' => $image['id'],
+      'U_THUMB' => $thumbnail_src,
+      'U_URL' => $image_url,
+      'SCORE_RATE' => $image['score'],
        'AVG_RATE' => $image['avg_rates'],
        'SUM_RATE' => $image['sum_rates'],
@@ -227,14 +228,4 @@
   while ($row = pwg_db_fetch_assoc($result))
   {
-
-    $url_del = PHPWG_ROOT_PATH.'admin.php'.
-                get_query_string_diff(array('del'));
-
-    $del_param = 'e='.$image['id'].
-                 '&u='.$row['user_id'].
-                 '&a='.$row['anonymous_id'];
-
-    $url_del .= '&amp;del='.urlencode(urlencode($del_param));
-
     if ( isset($users[$row['user_id']]) )
     {
@@ -250,11 +241,6 @@
     }
 
-    $tpl_image['rates'][] =
-       array(
-         'DATE' => /*format_date*/($row['date']),
-         'RATE' => $row['rate'],
-         'USER' => $user_rate,
-         'U_DELETE' => $url_del
-     );
+    $row['USER'] = $user_rate;
+    $tpl_image['rates'][] = $row;
   }
   $template->append( 'images', $tpl_image );
Index: /trunk/admin/themes/default/template/rating.tpl
===================================================================
--- /trunk/admin/themes/default/template/rating.tpl	(revision 26836)
+++ /trunk/admin/themes/default/template/rating.tpl	(revision 26837)
@@ -41,27 +41,56 @@
   <td>{'Average rate'|@translate}</td>
   <td>{'Sum of rates'|@translate}</td>
-  <td>{'Rate'|@translate}</td>
-  <td>{'Username'|@translate}</td>
-  <td>{'Rate date'|@translate}</td>
+  <td>{'Rate'|@translate}/{'Username'|@translate}/{'Rate date'|@translate}</td>
   <td></td>
 </tr>
 {foreach from=$images item=image name=image}
 <tr valign="top" class="{if $smarty.foreach.image.index is odd}row1{else}row2{/if}">
-	<td rowspan="{$image.NB_RATES_TOTAL+1}"><a href="{$image.U_URL}"><img src="{$image.U_THUMB}" alt="{$image.FILE}" title="{$image.FILE}"></a></td>
-	<td rowspan="{$image.NB_RATES_TOTAL+1}"><strong>{$image.NB_RATES}/{$image.NB_RATES_TOTAL}</strong></td>
-	<td rowspan="{$image.NB_RATES_TOTAL+1}"><strong>{$image.SCORE_RATE}</strong></td>
-	<td rowspan="{$image.NB_RATES_TOTAL+1}"><strong>{$image.AVG_RATE}</strong></td>
-	<td rowspan="{$image.NB_RATES_TOTAL+1}" style="border-right: 1px solid;" ><strong>{$image.SUM_RATE}</strong></td>
+	<td><a href="{$image.U_URL}"><img src="{$image.U_THUMB}" alt="{$image.FILE}" title="{$image.FILE}"></a></td>
+	<td><strong>{$image.NB_RATES}/{$image.NB_RATES_TOTAL}</strong></td>
+	<td><strong>{$image.SCORE_RATE}</strong></td>
+	<td><strong>{$image.AVG_RATE}</strong></td>
+	<td style="border-right:1px solid" ><strong>{$image.SUM_RATE}</strong></td>
+	<td>
+		<table style="width:100%">
+{foreach from=$image.rates item=rate name=rate}
+<tr>
+	<td>{$rate.rate}</td>
+	<td><b>{$rate.USER}</b></td>
+	<td>{$rate.date}</td>
+	<td><a onclick="return del(this,{$image.id},{$rate.user_id}{if !empty({$rate.anonymous_id})},'{$rate.anonymous_id}'{/if})" class="icon-trash"> </a></td>
 </tr>
-{foreach from=$image.rates item=rate name=rate}
-<tr class="{if ($smarty.foreach.image.index+$smarty.foreach.rate.index) is odd}row1{else}row2{/if}">
-	<td>{$rate.RATE}</td>
-	<td><b>{$rate.USER}</b></td>
-	<td>{$rate.DATE}</td>
-	<td><a href="{$rate.U_DELETE}"><img src="{$themeconf.admin_icon_dir}/delete.png" alt="[{'Delete'|@translate}]"></a></td>
+{/foreach}{*rates*}
+		</table>
+	</td>
 </tr>
-{/foreach} {*rates*}
-{/foreach} {*images*}
+{/foreach}{*images*}
 </table>
+{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
+{footer_script}
+function del(node,id,uid,aid){
+	var tr = jQuery(node).parents("tr").first().fadeTo(1000, 0.4),
+		data = {
+			image_id: id,
+			user_id: uid
+		};
+	if (aid)
+		data.anonymous_id = aid;
 
-{if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
+	(new PwgWS('{$ROOT_URL|@escape:javascript}')).callService(
+		'pwg.rates.delete', data,
+		{
+			method: 'POST',
+			onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); },
+			onSuccess: function(result){
+				if (result)
+					tr.remove();
+				else 
+					alert(result); 
+			}
+		}
+	);
+	return false;
+}
+{/footer_script}
+
+{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
Index: /trunk/admin/themes/default/template/rating_user.tpl
===================================================================
--- /trunk/admin/themes/default/template/rating_user.tpl	(revision 26836)
+++ /trunk/admin/themes/default/template/rating_user.tpl	(revision 26837)
@@ -1,6 +1,25 @@
+{combine_script id='jquery.dataTables' load='footer' path='themes/default/js/plugins/jquery.dataTables.js'}
+{html_style}
+.sorting { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_both.png) no-repeat center right; cursor:pointer; }
+.sorting_asc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc.png) no-repeat center right; }
+.sorting_desc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc.png) no-repeat center right; }
+
+.sorting, .sorting_asc, .sorting_desc { 
+	padding: 3px 18px 3px 10px;
+}
+.sorting_asc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc_disabled.png) no-repeat center right; }
+.sorting_desc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc_disabled.png) no-repeat center right; }
+
+.dtBar {
+	text-align:left;
+	padding-left: 20px;
+}
+{/html_style}
+
 <h2>{$ratings|@count} {'Users'|@translate}</h2>
 
 <form action="{$F_ACTION}" method="GET">
 <fieldset>
+<noscript>
 	<label>{'Sort by'|@translate}
 		<select name="order_by">
@@ -8,4 +27,5 @@
 		</select>
 	</label>
+</noscript>
 	<label>{'Number of rates'|@translate}&gt;
 	<input type="text" size="5" name="f_min_rates" value="{$F_MIN_RATES}">
@@ -18,35 +38,69 @@
 
 {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
-{footer_script}{literal}
-function del(elt,uid,aid)
-{
-	if (!confirm({/literal}'{'Are you sure?'|@translate|@escape:'javascript'}'{literal}))
+{footer_script}
+var oTable = jQuery('#rateTable').dataTable({
+	sDom : '<"dtBar"f>rt',
+	bPaginate: false,
+	aaSorting: [[4,'desc']],
+	aoColumnDefs: [
+		{
+			aTargets: ["dtc_user"],
+		},
+		{
+			aTargets: ["dtc_stat"],
+			asSorting: ["desc","asc"],
+			bSearchable: false
+		},
+		{
+			aTargets: ["dtc_rate"],
+			asSorting: ["desc","asc"],
+			bSearchable: false
+		},
+		{
+			aTargets: ["dtc_del"],
+			bSortable: false,
+			bSearchable: false
+		}
+	]
+});
+
+function del(elt,uid,aid){
+	if (!confirm('{'Are you sure?'|@translate|@escape:'javascript'}'))
 		return false;
 	var tr = elt;
 	while ( tr.nodeName != "TR") tr = tr.parentNode;
 	tr = jQuery(tr).fadeTo(1000, 0.4);
-	(new PwgWS({/literal}'{$ROOT_URL|@escape:javascript}'{literal})).callService(
-		'pwg.rates.delete', {user_id:uid, anonymous_id:aid},
+
+	(new PwgWS('{$ROOT_URL|@escape:javascript}')).callService(
+		'pwg.rates.delete', { user_id:uid, anonymous_id:aid},
 		{
 			method: 'POST',
 			onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); },
-			onSuccess: function(result) { if (result) {tr.remove();} else alert(result); }
+			onSuccess: function(result){
+				if (result)
+					oTable.fnDeleteRow(tr[0]);
+				else 
+					alert(result); 
+			}
 		}
 	);
+	
 	return false;
 }
-{/literal}{/footer_script}
-<table>
+{/footer_script}
+<table id="rateTable">
+<thead>
 <tr class="throw">
-	<td>{'Username'|@translate}</td>
-	<td>{'Number of rates'|@translate}</td>
-	<td>{'Average rate'|@translate}</td>
-	<td>{'Variation'|@translate}</td>
-	<td>{'Consensus deviation'|@translate|@replace:' ':'<br>'}</td>
+	<td class="dtc_user">{'Username'|@translate}</td>
+	<td class="dtc_stat">{'Number of rates'|@translate}</td>
+	<td class="dtc_stat">{'Average rate'|@translate}</td>
+	<td class="dtc_stat">{'Variation'|@translate}</td>
+	<td class="dtc_stat">{'Consensus deviation'|@translate|@replace:' ':'<br>'}</td>
 {foreach from=$available_rates item=rate}
-	<td>{$rate}</td>
+	<td class="dtc_rate">{$rate}</td>
 {/foreach}
-	<td></td>
+	<td class="dtc_del"></td>
 </tr>
+</thead>
 {foreach from=$ratings item=rating key=user}
 <tr>
@@ -63,5 +117,5 @@
 		{/if}</td>
 	{/foreach}
-	<td><a onclick="return del(this,{$rating.uid},'{$rating.aid}');"><img src="{$themeconf.admin_icon_dir}/delete.png" alt="[{'Delete'|@translate}]"></a></td>
+	<td><a onclick="return del(this,{$rating.uid},'{$rating.aid}');" class="icon-trash"></a></td>
 </tr>
 {/foreach}
Index: /trunk/include/ws_functions/pwg.php
===================================================================
--- /trunk/include/ws_functions/pwg.php	(revision 26836)
+++ /trunk/include/ws_functions/pwg.php	(revision 26837)
@@ -272,4 +272,8 @@
     $query .= ' AND anonymous_id=\''.$params['anonymous_id'].'\'';
   }
+  if (!empty($params['image_id']))
+  {
+    $query .= ' AND element_id='.$params['image_id'];
+  }
 
   $changes = pwg_db_changes(pwg_query($query));
Index: /trunk/ws.php
===================================================================
--- /trunk/ws.php	(revision 26836)
+++ /trunk/ws.php	(revision 26837)
@@ -308,4 +308,5 @@
         'user_id' =>      array('type'=>WS_TYPE_ID),
         'anonymous_id' => array('default'=>null),
+        'image_id' =>     array('flags'=>WS_PARAM_OPTIONAL, 'type'=>WS_TYPE_ID),
         ),
       'Deletes all rates for a user.',
