Index: extensions/Ajax_Thumbnailer/ajaxThumbnailer.tpl
===================================================================
--- extensions/Ajax_Thumbnailer/admin/thumbnailer_admin.tpl	(revision 4549)
+++ extensions/Ajax_Thumbnailer/ajaxThumbnailer.tpl	(revision 10441)
@@ -1,12 +1,72 @@
-<script type="text/javascript">
-	var path="{$plugin.path}";
-</script>
-<script type="text/javascript" src="{$plugin.path}/admin/js/jquery.ajaxmanager.js"></script>
-<script type="text/javascript" src="{$plugin.path}/admin/js/thumbnailer.js"></script>
+{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
+
+{footer_script}{literal}
+var queuedManager = $.manageAjax.create('queued', { 
+	queue: true,  
+	cacheResponse: false,
+	maxRequests: 3
+}); 
+
+function processThumbs(width,height,gd_version) {
+  var square=$('input[name="square"]').attr('checked');
+  var done=0;
+	$('tr.nothumb').each(function() {
+		var file=$(this).find('td.filepath').text();
+		$(this).find('td.thumbpic').html('<img src="plugins/Ajax_Thumbnailer/ajax-loader.gif">');
+		var td=this;
+		queuedManager.add({
+			type: 'GET', 
+			url: 'ws.php', 
+			data: {method: 'pwg.images.createThumbnail',picture:file,format:'json',width: width,height: height, gd_version: gd_version, square: square},
+			dataType: 'json',
+			success: (function(row) { return function(data) {
+					if (data.stat =='ok') {
+							$(row).find('td.thumbpic').html('<img src="'+data.result.tn_file+'"/>');
+							$(row).find('td.thumbdim').html(""+data.result.tn_width+"X"+data.result.tn_height);
+							$(row).find('td.thumbgentime').html(""+data.result.tn_time);
+							$(row).find('td.thumbsize').html(""+data.result.tn_size);
+							$(row).removeClass("nothumb");
+						} else {
+							$(row).find('td.thumbpic').html('#ERR#'+data.err+"# : "+data.message);
+							$(row).removeClass("nothumb");
+							$(row).addClass("error");
+						}
+          if (done++ == 20) {
+              $('tr.item:not(.nothumb)').remove();
+              done = 0;
+            }
+					};})(td)
+			});
+	});
+}
+
+$(document).ready(function(){
+  $('input#proceed').click (function () {
+    var width = $('#width')[0].value;
+    var height = $('#height')[0].value;
+    var gd_version=$("input[@name='gd']:checked").val();
+    $("input:not(.nodisable)").attr("disabled",true);
+
+    
+    processThumbs(width,height,gd_version);
+  });
+
+  $('input#cancel').click (function () {
+    queuedManager.clear();
+    queuedManager.abort();
+    $("input:not(.nodisable)").attr("disabled",false);
+    $('tr.nothumb td.thumbpic').html("&nbsp;");
+    
+  });
+
+  $('input#clear').click (function () {
+    $('tr.item:not(.nothumb)').remove();
+  });
+});
+{/literal}{/footer_script}
 
 <div class="titrePage">
-  <h2>{'title_thumbnails'|@translate}</h2>
+  <h2>{'Thumbnail creation'|@translate}</h2>
 </div>
-
 
 {if isset($params) }
@@ -14,9 +74,9 @@
 
   <fieldset>
-    <legend>{'tn_params_title'|@translate}</legend>
+    <legend>{'Thumbnail creation'|@translate}</legend>
 
     <ul>
       <li>
-        <span class="property">{'tn_params_GD'|@translate}</span>
+        <span class="property">{'GD version'|@translate}</span>
 	<label>
           <input type="radio" name="gd" value="2" {if $params.GD_SELECTED==2}checked="checked"{/if}>2.x
@@ -51,18 +111,18 @@
 {/if} {*isset params*}
 
-{if !empty($wo_thumbnails) }
-<div class="admin">{$TOTAL_NB_REMAINING} {'tn_alone_title'|@translate}</div>
+{if !empty($remainings) }
+<div class="admin">{$TOTAL_NB_REMAINING} {'Number of thumbnails to create'|@translate}</div>
 <table style="width:100%;">
   <tr class="throw">
     <td>&nbsp;</td>
     <td style="width:60%;">{'Path'|@translate}</td>
-    <td>{'filesize'|@translate}</td>
+    <td>{'Filesize'|@translate}</td>
     <td>{'Dimensions'|@translate}</td>
-    <td>{'thumbnail'|@translate}</td>
-    <td>{'tn_results_gen_time'|@translate}</td>
-    <td>{'filesize'|@translate}</td>
+    <td>{'Thumbnail'|@translate}</td>
+    <td>{'generated in'|@translate}</td>
+    <td>{'Filesize'|@translate}</td>
     <td>{'Dimensions'|@translate}</td>
   </tr>
-  {foreach from=$wo_thumbnails item=elt name=remain_loop}
+  {foreach from=$remainings item=elt name=remain_loop}
   <tr class="{if $smarty.foreach.remain_loop.index is odd}row1{else}row2{/if} nothumb item" id="th_{$smarty.foreach.remain_loop.iteration}">
     <td>{$smarty.foreach.remain_loop.iteration}</td>
@@ -78,4 +138,4 @@
 </table>
 {else}
-<div style="text-align:center;font-weight:bold;margin:10px;"> [ {'tn_no_missing'|@translate} ]</div>
+<div style="text-align:center;font-weight:bold;margin:10px;"> [ {'No missing thumbnail'|@translate} ]</div>
 {/if}
