Index: /extensions/regenerateThumbnails/admin.php
===================================================================
--- /extensions/regenerateThumbnails/admin.php	(revision 9922)
+++ /extensions/regenerateThumbnails/admin.php	(revision 9922)
@@ -0,0 +1,297 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+
+check_status(ACCESS_ADMINISTRATOR);
+
+check_input_parameter('selection', $_POST, true, PATTERN_ID);
+
+// +-----------------------------------------------------------------------+
+// |                      initialize current set                           |
+// +-----------------------------------------------------------------------+
+
+if (isset($_POST['submitFilter']))
+{
+  // echo '<pre>'; print_r($_POST); echo '</pre>';
+
+  $_SESSION['bulk_manager_filter'] = array();
+
+  if (isset($_POST['filter_prefilter_use']))
+  {
+    $prefilters = array('caddie', 'last import', 'with no album', 'with no tag', 'with no virtual album', 'duplicates', 'all photos');
+    if (in_array($_POST['filter_prefilter'], $prefilters))
+    {
+      $_SESSION['bulk_manager_filter']['prefilter'] = $_POST['filter_prefilter'];
+    }
+  }
+
+  if (isset($_POST['filter_category_use']))
+  {
+    $_SESSION['bulk_manager_filter']['category'] = $_POST['filter_category'];
+
+    if (isset($_POST['filter_category_recursive']))
+    {
+      $_SESSION['bulk_manager_filter']['category_recursive'] = true;
+    }
+  }
+
+  if (isset($_POST['filter_level_use']))
+  {
+    if (in_array($_POST['filter_level'], $conf['available_permission_levels']))
+    {
+      $_SESSION['bulk_manager_filter']['level'] = $_POST['filter_level'];
+    }
+  }
+}
+
+if (isset($_GET['cat']))
+{
+  if ('caddie' == $_GET['cat'])
+  {
+    $_SESSION['bulk_manager_filter'] = array(
+      'prefilter' => 'caddie'
+      );
+  }
+
+  if ('recent' == $_GET['cat'])
+  {
+    $_SESSION['bulk_manager_filter'] = array(
+      'prefilter' => 'last import'
+      );
+  }
+
+  if (is_numeric($_GET['cat']))
+  {
+    $_SESSION['bulk_manager_filter'] = array(
+      'category' => $_GET['cat']
+      );
+  }
+}
+
+if (!isset($_SESSION['bulk_manager_filter']))
+{
+  $_SESSION['bulk_manager_filter'] = array(
+    'prefilter' => 'caddie'
+    );
+}
+
+// echo '<pre>'; print_r($_SESSION['bulk_manager_filter']); echo '</pre>';
+
+// depending on the current filter (in session), we find the appropriate
+// photos
+$filter_sets = array();
+if (isset($_SESSION['bulk_manager_filter']['prefilter']))
+{
+  if ('caddie' == $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    $query = '
+SELECT element_id
+  FROM '.CADDIE_TABLE.'
+  WHERE user_id = '.$user['id'].'
+;';
+    array_push(
+      $filter_sets,
+      array_from_query($query, 'element_id')
+      );
+  }
+
+  if ('last import'== $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    $query = '
+SELECT MAX(date_available) AS date
+  FROM '.IMAGES_TABLE.'
+;';
+    $row = pwg_db_fetch_assoc(pwg_query($query));
+    if (!empty($row['date']))
+    {
+      $query = '
+SELECT id
+  FROM '.IMAGES_TABLE.'
+  WHERE date_available BETWEEN '.pwg_db_get_recent_period_expression(1, $row['date']).' AND \''.$row['date'].'\'
+;';
+      array_push(
+        $filter_sets,
+        array_from_query($query, 'id')
+        );
+    }
+  }
+
+  if ('with no virtual album' == $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    // we are searching elements not linked to any virtual category
+    $query = '
+ SELECT id
+   FROM '.IMAGES_TABLE.'
+ ;';
+    $all_elements = array_from_query($query, 'id');
+
+    $query = '
+ SELECT id
+   FROM '.CATEGORIES_TABLE.'
+   WHERE dir IS NULL
+ ;';
+    $virtual_categories = array_from_query($query, 'id');
+    if (!empty($virtual_categories))
+    {
+      $query = '
+ SELECT DISTINCT(image_id)
+   FROM '.IMAGE_CATEGORY_TABLE.'
+   WHERE category_id IN ('.implode(',', $virtual_categories).')
+ ;';
+      $linked_to_virtual = array_from_query($query, 'image_id');
+    }
+
+    array_push(
+      $filter_sets,
+      array_diff($all_elements, $linked_to_virtual)
+      );
+  }
+
+  if ('with no album' == $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    $query = '
+SELECT
+    id
+  FROM '.IMAGES_TABLE.'
+    LEFT JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
+  WHERE category_id is null
+;';
+    array_push(
+      $filter_sets,
+      array_from_query($query, 'id')
+      );
+  }
+
+  if ('with no tag' == $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    $query = '
+SELECT
+    id
+  FROM '.IMAGES_TABLE.'
+    LEFT JOIN '.IMAGE_TAG_TABLE.' ON id = image_id
+  WHERE tag_id is null
+;';
+    array_push(
+      $filter_sets,
+      array_from_query($query, 'id')
+      );
+  }
+
+
+  if ('duplicates' == $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    // we could use the group_concat MySQL function to retrieve the list of
+    // image_ids but it would not be compatible with PostgreSQL, so let's
+    // perform 2 queries instead. We hope there are not too many duplicates.
+
+    $query = '
+SELECT file
+  FROM '.IMAGES_TABLE.'
+  GROUP BY file
+  HAVING COUNT(*) > 1
+;';
+    $duplicate_files = array_from_query($query, 'file');
+
+    $query = '
+SELECT id
+  FROM '.IMAGES_TABLE.'
+  WHERE file IN (\''.implode("','", $duplicate_files).'\')
+;';
+
+    array_push(
+      $filter_sets,
+      array_from_query($query, 'id')
+      );
+  }
+
+  if ('all photos' == $_SESSION['bulk_manager_filter']['prefilter'])
+  {
+    $query = '
+SELECT id
+  FROM '.IMAGES_TABLE.'
+;';
+
+    array_push(
+      $filter_sets,
+      array_from_query($query, 'id')
+      );
+  }
+}
+
+if (isset($_SESSION['bulk_manager_filter']['category']))
+{
+  $categories = array();
+
+  if (isset($_SESSION['bulk_manager_filter']['category_recursive']))
+  {
+    $categories = get_subcat_ids(array($_SESSION['bulk_manager_filter']['category']));
+  }
+  else
+  {
+    $categories = array($_SESSION['bulk_manager_filter']['category']);
+  }
+
+  $query = '
+ SELECT DISTINCT(image_id)
+   FROM '.IMAGE_CATEGORY_TABLE.'
+   WHERE category_id IN ('.implode(',', $categories).')
+ ;';
+  array_push(
+    $filter_sets,
+    array_from_query($query, 'image_id')
+    );
+}
+
+if (isset($_SESSION['bulk_manager_filter']['level']))
+{
+  $query = '
+SELECT id
+  FROM '.IMAGES_TABLE.'
+  WHERE level >= '.$_SESSION['bulk_manager_filter']['level'].'
+;';
+  array_push(
+    $filter_sets,
+    array_from_query($query, 'id')
+    );
+}
+
+$current_set = array_shift($filter_sets);
+foreach ($filter_sets as $set)
+{
+  $current_set = array_intersect($current_set, $set);
+}
+$page['cat_elements_id'] = $current_set;
+
+// +-----------------------------------------------------------------------+
+// |                       first element to display                        |
+// +-----------------------------------------------------------------------+
+
+// $page['start'] contains the number of the first element in its
+// category. For exampe, $page['start'] = 12 means we must show elements #12
+// and $page['nb_images'] next elements
+
+if (!isset($_GET['start'])
+    or !is_numeric($_GET['start'])
+    or $_GET['start'] < 0
+    or (isset($_GET['display']) and 'all' == $_GET['display']))
+{
+  $page['start'] = 0;
+}
+else
+{
+  $page['start'] = $_GET['start'];
+}
+
+$template->assign('element_set_global_action_tpl', dirname(__FILE__).'\element_set_global_action.tpl');
+$template->assign('redirect_url', get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
+$template->set_extent(dirname(__FILE__).'/regenerate_thumbnails.tpl', 'batch_manager_global');
+include(PHPWG_ROOT_PATH.'admin/batch_manager_global.php');
+
+?>
Index: /extensions/regenerateThumbnails/element_set_global_action.tpl
===================================================================
--- /extensions/regenerateThumbnails/element_set_global_action.tpl	(revision 9921)
+++ /extensions/regenerateThumbnails/element_set_global_action.tpl	(revision 9922)
@@ -15,5 +15,5 @@
 jQuery(document).ready(function() {
   jQuery('#applyAction').click(function() {
-    if (jQuery('select[name="selectAction"]').val() == 'regenerateThumbnails') {
+    if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') {
       elements = new Array();
       if (jQuery('input[name="setSelected"]').attr('checked'))
@@ -25,4 +25,5 @@
           }
         });
+
       maxwidth = jQuery('input[name="thumb_maxwidth"]').val();
       maxheight = jQuery('input[name="thumb_maxheight"]').val();
@@ -58,5 +59,5 @@
               });
             if (todo == progressBar_max)
-              window.location = redirect+'&regeneratedThumbnail='+todo;
+              window.location = redirect;
           })
         });
@@ -74,4 +75,21 @@
   <td><input type="checkbox" name="square" id="square" {if $SQUARE}checked="checked"{/if}></td>
 </tr>
+{footer_script require='jquery'}{literal}
+jQuery().ready(function(){
+  jQuery("input[name^='thumb_max']").keyup(function(){
+    if(jQuery("#square").attr("checked")){
+      if (this.name == "thumb_maxwidth"){
+        jQuery("input[name='thumb_maxheight']").attr("value", this.value);
+      }else{
+        jQuery("input[name='thumb_maxwidth']").attr("value", this.value);
+      }
+    }
+  });
+  jQuery("#square").click(function(){
+    if (this.checked)
+      jQuery("input[name^='thumb_maxheight']").attr("value", jQuery("input[name^='thumb_maxwidth']").attr("value"));
+  });
+});
+{/literal}{/footer_script}
 {else}
 <tr><td><input type="checkbox" name="square" id="square" style="display:none;"></td></tr>
Index: /extensions/regenerateThumbnails/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/regenerateThumbnails/language/en_UK/plugin.lang.php	(revision 9921)
+++ /extensions/regenerateThumbnails/language/en_UK/plugin.lang.php	(revision 9922)
@@ -3,5 +3,5 @@
 $lang['Regenerate Thumbnails'] = 'Regenerate Thumbnails';
 $lang['Thumbnails generation in progress...'] = 'Thumbnails generation in progress...';
-$lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenerated';
+$lang['Thumbnails have been regenerated'] = 'Thumbnails have been regenerated';
 
 ?>
Index: /extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php	(revision 9921)
+++ /extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php	(revision 9922)
@@ -3,5 +3,5 @@
 $lang['Regenerate Thumbnails'] = 'Régénérer les miniatures';
 $lang['Thumbnails generation in progress...'] = 'Génération des miniatures en cours...';
-$lang['%s thumbnails have been regenerated'] = '%s miniatures ont été régénérées.';
+$lang['Thumbnails have been regenerated'] = 'Les miniatures ont été régénérées.';
 
 ?>
Index: /extensions/regenerateThumbnails/main.inc.php
===================================================================
--- /extensions/regenerateThumbnails/main.inc.php	(revision 9921)
+++ /extensions/regenerateThumbnails/main.inc.php	(revision 9922)
@@ -10,6 +10,29 @@
 define('REGENERATE_THUMBNAILS_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
 
+add_event_handler('loc_begin_admin', 'rg_add_thumbnails_tab');
 add_event_handler('loc_begin_element_set_global', 'rg_element_set_global_add_action');
 add_event_handler('ws_add_methods', 'add_regenerate_thumbnails_method');
+
+function rg_add_thumbnails_tab()
+{
+  global $page;
+
+  if (isset($_GET['page']) and in_array($_GET['page'], array('thumbnail', 'plugin-regenerateThumbnails')))
+  {
+    load_language('plugin.lang', REGENERATE_THUMBNAILS_PATH);
+    include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+    if ($_GET['page'] == 'plugin-regenerateThumbnails')
+      $page['tab'] = 'regenerateThumbnails';
+    else
+      $page['tab'] = 'thumbnail';
+
+    $tabsheet = new tabsheet();
+    $tabsheet->add('thumbnail', l10n('Thumbnail creation'), get_root_url().'admin.php?page=thumbnail');
+    $tabsheet->add('regenerateThumbnails', l10n('Regenerate Thumbnails'), get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
+    $tabsheet->select($page['tab']);
+    $tabsheet->assign();
+  }
+}
 
 function rg_element_set_global_add_action()
@@ -22,8 +45,9 @@
   $template->set_filename('regenerateThumbnails', realpath(REGENERATE_THUMBNAILS_PATH.'element_set_global_action.tpl'));
 
-  if (isset($_GET['regeneratedThumbnail']))
+  if (isset($_SESSION['regeneratedThumbnail']))
   {
     $template->delete_compiled_templates();
-    array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_GET['regeneratedThumbnail']));
+    array_push($page['infos'], l10n('Thumbnails have been regenerated'));
+    unset($_SESSION['regeneratedThumbnail']);
   }
 
@@ -40,10 +64,17 @@
   }
 
+  $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
+  if ($_GET['page'] == 'plugin')
+    $redirect_url .= '-regenerateThumbnails';
+  
   $template->assign(array(
     'upload_form_settings' => $form_values,
     'all_elements' => $page['cat_elements_id'],
-    'redirect_url' => get_root_url().'admin.php?page='.$_GET['page'],
+    'redirect_url' => $redirect_url,
     )
   );
+
+  if ($template->get_template_vars('redirect_url') == null)
+    $template->assign('redirect_url', get_root_url().'admin.php?page='.$_GET['page']);
 
   $template->append('element_set_global_plugins_actions', array(
@@ -111,4 +142,6 @@
     );
 
+  $_SESSION['regeneratedThumbnail'] = true;
+
   return true;
 }
Index: /extensions/regenerateThumbnails/regenerate_thumbnails.tpl
===================================================================
--- /extensions/regenerateThumbnails/regenerate_thumbnails.tpl	(revision 9922)
+++ /extensions/regenerateThumbnails/regenerate_thumbnails.tpl	(revision 9922)
@@ -0,0 +1,448 @@
+{include file='include/tag_selection.inc.tpl'}
+{include file='include/datepicker.inc.tpl'}
+
+{footer_script}{literal}
+  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
+{/literal}{/footer_script}
+
+{combine_script id='jquery.fcbkcomplete' load='footer' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
+
+{footer_script require='jquery.fcbkcomplete'}{literal}
+jQuery(document).ready(function() {
+  jQuery("#tags").fcbkcomplete({
+    json_url: "admin.php?fckb_tags=1",
+    cache: false,
+    filter_case: false,
+    filter_hide: true,
+    firstselected: true,
+    filter_selected: true,
+    maxitems: 100,
+    newel: true
+  });
+});
+{/literal}{/footer_script}
+
+{footer_script}
+var nb_thumbs_page = {$nb_thumbs_page};
+var nb_thumbs_set = {$nb_thumbs_set};
+var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}";
+
+var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}";
+var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}";
+var selectedMessage_all = "{'All %d photos are selected'|@translate}";
+{literal}
+function str_repeat(i, m) {
+        for (var o = []; m > 0; o[--m] = i);
+        return o.join('');
+}
+
+function sprintf() {
+        var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = '';
+        while (f) {
+                if (m = /^[^\x25]+/.exec(f)) {
+                        o.push(m[0]);
+                }
+                else if (m = /^\x25{2}/.exec(f)) {
+                        o.push('%');
+                }
+                else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
+                        if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) {
+                                throw('Too few arguments.');
+                        }
+                        if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) {
+                                throw('Expecting number but found ' + typeof(a));
+                        }
+                        switch (m[7]) {
+                                case 'b': a = a.toString(2); break;
+                                case 'c': a = String.fromCharCode(a); break;
+                                case 'd': a = parseInt(a); break;
+                                case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
+                                case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
+                                case 'o': a = a.toString(8); break;
+                                case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
+                                case 'u': a = Math.abs(a); break;
+                                case 'x': a = a.toString(16); break;
+                                case 'X': a = a.toString(16).toUpperCase(); break;
+                        }
+                        a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a);
+                        c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
+                        x = m[5] - String(a).length - s.length;
+                        p = m[5] ? str_repeat(c, x) : '';
+                        o.push(s + (m[4] ? a + p : p + a));
+                }
+                else {
+                        throw('Huh ?!');
+                }
+                f = f.substring(m[0].length);
+        }
+        return o.join('');
+}
+
+$(document).ready(function() {
+  function checkPermitAction() {
+    var nbSelected = 0;
+    if ($("input[name=setSelected]").is(':checked')) {
+      nbSelected = nb_thumbs_set;
+    }
+    else {
+      $(".thumbnails input[type=checkbox]").each(function() {
+         if ($(this).is(':checked')) {
+           nbSelected++;
+         }
+      });
+    }
+
+    if (nbSelected == 0) {
+      $("#applyActionBlock").hide();
+      $("#forbidAction").show();
+    }
+    else {
+      $("#applyActionBlock").show();
+      $("#forbidAction").hide();
+    }
+
+    $("#applyOnDetails").text(
+      sprintf(
+        applyOnDetails_pattern,
+        nbSelected
+      )
+    );
+
+    // display the number of currently selected photos in the "Selection" fieldset
+    if (nbSelected == 0) {
+      $("#selectedMessage").text(
+        sprintf(
+          selectedMessage_none,
+          nb_thumbs_set
+        )
+      );
+    }
+    else if (nbSelected == nb_thumbs_set) {
+      $("#selectedMessage").text(
+        sprintf(
+          selectedMessage_all,
+          nb_thumbs_set
+        )
+      );
+    }
+    else {
+      $("#selectedMessage").text(
+        sprintf(
+          selectedMessage_pattern,
+          nbSelected,
+          nb_thumbs_set
+        )
+      );
+    }
+  }
+
+  $('img.thumbnail').tipTip({
+    'delay' : 0,
+    'fadeIn' : 200,
+    'fadeOut' : 200
+  });
+
+  $(".wrap1 label").click(function () {
+    $("input[name=setSelected]").attr('checked', false);
+
+    var wrap2 = $(this).children(".wrap2");
+    var checkbox = $(this).children("input[type=checkbox]");
+
+    if ($(checkbox).is(':checked')) {
+      $(wrap2).addClass("thumbSelected"); 
+    }
+    else {
+      $(wrap2).removeClass('thumbSelected'); 
+    }
+
+    checkPermitAction();
+  });
+
+  $("#selectAll").click(function () {
+    $("input[name=setSelected]").attr('checked', false);
+    selectPageThumbnails();
+    checkPermitAction();
+    return false;
+  });
+
+  function selectPageThumbnails() {
+    $(".thumbnails label").each(function() {
+      var wrap2 = $(this).children(".wrap2");
+      var checkbox = $(this).children("input[type=checkbox]");
+
+      $(checkbox).attr('checked', true);
+      $(wrap2).addClass("thumbSelected"); 
+    });
+  }
+
+  $("#selectNone").click(function () {
+    $("input[name=setSelected]").attr('checked', false);
+
+    $(".thumbnails label").each(function() {
+      var wrap2 = $(this).children(".wrap2");
+      var checkbox = $(this).children("input[type=checkbox]");
+
+      $(checkbox).attr('checked', false);
+      $(wrap2).removeClass("thumbSelected"); 
+    });
+    checkPermitAction();
+    return false;
+  });
+
+  $("#selectInvert").click(function () {
+    $("input[name=setSelected]").attr('checked', false);
+
+    $(".thumbnails label").each(function() {
+      var wrap2 = $(this).children(".wrap2");
+      var checkbox = $(this).children("input[type=checkbox]");
+
+      $(checkbox).attr('checked', !$(checkbox).is(':checked'));
+
+      if ($(checkbox).is(':checked')) {
+        $(wrap2).addClass("thumbSelected"); 
+      }
+      else {
+        $(wrap2).removeClass('thumbSelected'); 
+      }
+    });
+    checkPermitAction();
+    return false;
+  });
+
+  $("#selectSet").click(function () {
+    selectPageThumbnails();
+    $("input[name=setSelected]").attr('checked', true);
+    checkPermitAction();
+    return false;
+  });
+
+  $("input[name=remove_author]").click(function () {
+    if ($(this).is(':checked')) {
+      $("input[name=author]").hide();
+    }
+    else {
+      $("input[name=author]").show();
+    }
+  });
+
+  $("input[name=remove_title]").click(function () {
+    if ($(this).is(':checked')) {
+      $("input[name=title]").hide();
+    }
+    else {
+      $("input[name=title]").show();
+    }
+  });
+
+  $("input[name=remove_date_creation]").click(function () {
+    if ($(this).is(':checked')) {
+      $("#set_date_creation").hide();
+    }
+    else {
+      $("#set_date_creation").show();
+    }
+  });
+
+  $(".removeFilter").click(function () {
+    var filter = $(this).parent('li').attr("id");
+    filter_disable(filter);
+
+    return false;
+  });
+
+  function filter_enable(filter) {
+    /* show the filter*/
+    $("#"+filter).show();
+
+    /* check the checkbox to declare we use this filter */
+    $("input[type=checkbox][name="+filter+"_use]").attr("checked", true);
+
+    /* forbid to select this filter in the addFilter list */
+    $("#addFilter").children("option[value="+filter+"]").attr("disabled", "disabled");
+  }
+
+  $("#addFilter").change(function () {
+    var filter = $(this).attr("value");
+    filter_enable(filter);
+    $(this).attr("value", -1);
+  });
+
+  function filter_disable(filter) {
+    /* hide the filter line */
+    $("#"+filter).hide();
+
+    /* uncheck the checkbox to declare we do not use this filter */
+    $("input[name="+filter+"_use]").removeAttr("checked");
+
+    /* give the possibility to show it again */
+    $("#addFilter").children("option[value="+filter+"]").removeAttr("disabled");
+  }
+
+  $("#removeFilters").click(function() {
+    $("#filterList li").each(function() {
+      var filter = $(this).attr("id");
+      filter_disable(filter);
+    });
+    return false;
+  });
+
+  checkPermitAction()
+});
+{/literal}{/footer_script}
+
+<div id="batchManagerGlobal">
+
+<h2>{'Regenerate Thumbnails'|@translate}</h2>
+
+  <form action="{$F_ACTION}" method="post">
+
+  <fieldset>
+    <legend>{'Filter'|@translate}</legend>
+
+    <ul id="filterList">
+      <li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
+        <a href="#" class="removeFilter" title="{'remove this filter'|@translate}"><span>[x]</span></a>
+        <input type="checkbox" name="filter_prefilter_use" class="useFilterCheckbox" {if isset($filter.prefilter)}checked="checked"{/if}>
+        {'predefined filter'|@translate}
+        <select name="filter_prefilter">
+          <option value="caddie" {if $filter.prefilter eq 'caddie'}selected="selected"{/if}>{'caddie'|@translate}</option>
+          <option value="last import" {if $filter.prefilter eq 'last import'}selected="selected"{/if}>{'last import'|@translate}</option>
+          <option value="with no album" {if $filter.prefilter eq 'with no album'}selected="selected"{/if}>{'with no album'|@translate}</option>
+{if $ENABLE_SYNCHRONIZATION}
+          <option value="with no virtual album" {if $filter.prefilter eq 'with no virtual album'}selected="selected"{/if}>{'with no virtual album'|@translate}</option>
+{/if}
+          <option value="with no tag" {if $filter.prefilter eq 'with no tag'}selected="selected"{/if}>{'with no tag'|@translate}</option>
+          <option value="duplicates" {if $filter.prefilter eq 'duplicates'}selected="selected"{/if}>{'duplicates'|@translate}</option>
+          <option value="all photos" {if $filter.prefilter eq 'all photos'}selected="selected"{/if}>{'all photos'|@translate}</option>
+        </select>
+      </li>
+      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
+        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
+        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
+        {'album'|@translate}
+        <select style="width:400px" name="filter_category" size="1">
+          {html_options options=$filter_category_options selected=$filter_category_options_selected}
+        </select>
+        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
+      </li>
+      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
+        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
+        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
+        {'Who can see these photos?'|@translate}
+        <select name="filter_level" size="1">
+          {html_options options=$filter_level_options selected=$filter_level_options_selected}
+        </select>
+      </li>
+    </ul>
+
+    <p class="actionButtons" style="">
+      <select id="addFilter">
+        <option value="-1">{'Add a filter'|@translate}</option>
+        <option disabled="disabled">------------------</option>
+        <option value="filter_prefilter">{'predefined filter'|@translate}</option>
+        <option value="filter_category">{'album'|@translate}</option>
+        <option value="filter_level">{'Who can see these photos?'|@translate}</option>
+      </select>
+<!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
+      <a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
+    </p>
+
+    <p class="actionButtons" id="applyFilterBlock">
+      <input id="applyFilter" class="submit" type="submit" value="{'Refresh photo set'|@translate}" name="submitFilter">
+    </p>
+
+  </fieldset>
+
+  <fieldset>
+
+    <legend>{'Selection'|@translate}</legend>
+
+  {if !empty($thumbnails)}
+  <p id="checkActions">
+    {'Select:'|@translate}
+{if $nb_thumbs_set > $nb_thumbs_page}
+    <a href="#" id="selectAll">{'The whole page'|@translate}</a>,
+    <a href="#" id="selectSet">{'The whole set'|@translate}</a>,
+{else}
+    <a href="#" id="selectAll">{'All'|@translate}</a>,
+{/if}
+    <a href="#" id="selectNone">{'None'|@translate}</a>,
+    <a href="#" id="selectInvert">{'Invert'|@translate}</a>
+
+    <span id="selectedMessage"></span>
+
+    <input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
+  </p>
+
+    <ul class="thumbnails">
+      {foreach from=$thumbnails item=thumbnail}
+        {if in_array($thumbnail.ID, $selection)}
+          {assign var='isSelected' value=true}
+        {else}
+          {assign var='isSelected' value=false}
+        {/if}
+
+      <li><span class="wrap1">
+          <label>
+            <span class="wrap2{if $isSelected} thumbSelected{/if}">
+        {if $thumbnail.LEVEL > 0}
+        <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
+        <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
+        {/if}
+            <span>
+              <img src="{$thumbnail.TN_SRC}"
+                 alt="{$thumbnail.FILE}"
+                 title="{$thumbnail.TITLE|@escape:'html'}"
+                 class="thumbnail">
+            </span></span>
+            <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
+          </label>
+          </span>
+      </li>
+      {/foreach}
+    </ul>
+
+  {if !empty($navbar) }
+  <div style="clear:both;">
+
+    <div style="float:left">
+    {include file='navigation_bar.tpl'|@get_extent:'navbar'}
+    </div>
+
+    <div style="float:right;margin-top:10px;">{'display'|@translate}
+      <a href="{$U_DISPLAY}&amp;display=20">20</a>
+      &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
+      &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
+      &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
+      {'photos per page'|@translate}
+    </div>
+  </div>
+  {/if}
+
+  {else}
+  <div>{'No photo in the current set.'|@translate}</div>
+  {/if}
+  </fieldset>
+
+  <fieldset id="action">
+
+    <legend>{'Miniaturization parameters'|@translate}</legend>
+
+{if !empty($element_set_global_plugins_actions)}
+  {foreach from=$element_set_global_plugins_actions item=action}
+    {if $action.ID == 'regenerateThumbnails'}
+    <div id="action_{$action.ID}" class="bulkAction">{$action.CONTENT}</div>
+    {/if}
+  {/foreach}
+{/if}
+
+    <p id="applyActionBlock" class="actionButtons">
+      <input type="hidden" name="selectAction" value="regenerateThumbnails">
+      <input id="applyAction" class="submit" type="submit" value="{'Regenerate Thumbnails'|@translate}" name="submit"> <span id="applyOnDetails"></span></p>
+    <p id="forbidAction">{'No photo selected, no action possible.'|@translate}</p>
+
+  </fieldset>
+
+  </form>
+
+</div> <!-- #batchManagerGlobal -->
