Index: trunk/admin/batch_manager_global.php
===================================================================
--- trunk/admin/batch_manager_global.php	(revision 18484)
+++ trunk/admin/batch_manager_global.php	(revision 18573)
@@ -75,12 +75,4 @@
 }
 
-// $page['category'] is a shortcut to test if the current filter contains a
-// given category. The idea is the same as for prefilter
-$page['category'] = -1;
-if (isset($_SESSION['bulk_manager_filter']['category']))
-{
-  $page['category'] = $_SESSION['bulk_manager_filter']['category'];
-}
-
 $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
 
@@ -106,13 +98,6 @@
     pwg_query($query);
 
-    if ('caddie' == $page['prefilter'])
-    {
-      redirect($redirect_url);
-    }
-    
-    // if we are here in the code, it means that the user is currently
-    // displaying the caddie content, so we have to remove the current
-    // selection from the current set
-    $page['cat_elements_id'] = array_diff($page['cat_elements_id'], $collection);
+    // remove from caddie action available only in caddie so reload content
+    redirect($redirect_url);
   }
 
@@ -130,5 +115,5 @@
       if ('with no tag' == $page['prefilter'])
       {
-        redirect(get_root_url().'admin.php?page='.$_GET['page']);
+        redirect($redirect_url);
       }
     }
@@ -446,7 +431,5 @@
 $base_url = get_root_url().'admin.php';
 
-$prefilters = array();
-
-array_push($prefilters,
+$prefilters = array(
   array('ID' => 'caddie', 'NAME' => l10n('Caddie')),
   array('ID' => 'last import', 'NAME' => l10n('Last import')),
@@ -482,37 +465,6 @@
 // |                            caddie options                             |
 // +-----------------------------------------------------------------------+
-
-$in_caddie = false;
-if (isset($_SESSION['bulk_manager_filter']['prefilter'])
-    and 'caddie' == $_SESSION['bulk_manager_filter']['prefilter'])
-{
-  $in_caddie = true;
-}
-$template->assign('IN_CADDIE', $in_caddie);
-
-// +-----------------------------------------------------------------------+
-// |                            deletion form                              |
-// +-----------------------------------------------------------------------+
-
-// we can only remove photos that have no storage_category_id, in other
-// word, it currently (Butterfly) means that the photo was added with
-// pLoader
-if (count($page['cat_elements_id']) > 0)
-{
-  $query = '
-SELECT
-    id
-  FROM '.IMAGES_TABLE.'
-  WHERE id IN ('.implode(',', $page['cat_elements_id']).')
-    AND file NOT LIKE \'http%\'
-  LIMIT 1
-;';
-  ;
-
-  if ( pwg_db_fetch_row(pwg_query($query)) )
-  {
-    $template->assign('show_delete_form', true);
-  }
-}
+$template->assign('IN_CADDIE', 'caddie' == $page['prefilter']);
+
 
 // +-----------------------------------------------------------------------+
@@ -557,6 +509,8 @@
   FROM '.CATEGORIES_TABLE.'
 ;';
-display_select_cat_wrapper($query, array(), 'associate_options', true);
-display_select_cat_wrapper($query, array(), 'move_options', true);
+$categories = array_from_query($query);
+usort($categories, 'global_rank_compare');
+display_select_categories($categories, array(), 'category_full_name_options', true);
+
 display_select_cat_wrapper($query, array(), 'category_parent_options');
 
@@ -571,6 +525,4 @@
 {
   // we need to know the category in which the last photo was added
-  $selected_category = array();
-
   $query = '
 SELECT
@@ -587,14 +539,9 @@
   {
     $row = pwg_db_fetch_assoc($result);
-  
     $selected_category = array($row['category_id']);
   }
 }
 
-$query = '
-SELECT id,name,uppercats,global_rank
-  FROM '.CATEGORIES_TABLE.'
-;';
-display_select_cat_wrapper($query, $selected_category, 'filter_category_options', true);
+$template->assign( 'filter_category_selected', $selected_category);
 
 // Dissociate from a category : categories listed for dissociation can only
Index: trunk/admin/themes/default/template/batch_manager_global.tpl
===================================================================
--- trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 18484)
+++ trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 18573)
@@ -16,5 +16,4 @@
     var inputs = [];
     var count=0;
-    var This=$(this);
     this.find('input[type=checkbox]').each(function() {
       var pos=count;
@@ -523,5 +522,5 @@
         {'Album'|@translate}
         <select style="width:400px" name="filter_category" size="1">
-          {html_options options=$filter_category_options selected=$filter_category_options_selected}
+          {html_options options=$category_full_name_options selected=$filter_category_selected}
         </select>
         <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
@@ -676,7 +675,5 @@
       <option value="-1">{'Choose an action'|@translate}</option>
       <option disabled="disabled">------------------</option>
-  {if isset($show_delete_form) }
       <option value="delete">{'Delete selected photos'|@translate}</option>
-  {/if}
       <option value="associate">{'Associate to album'|@translate}</option>
       <option value="move">{'Move to album'|@translate}</option>
@@ -715,5 +712,5 @@
     <div id="action_associate" class="bulkAction">
           <select style="width:400px" name="associate" size="1">
-            {html_options options=$associate_options }
+            {html_options options=$category_full_name_options}
          </select>
 <br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
@@ -723,5 +720,5 @@
     <div id="action_move" class="bulkAction">
           <select style="width:400px" name="move" size="1">
-            {html_options options=$move_options }
+            {html_options options=$category_full_name_options}
          </select>
 <br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
