Index: /trunk/admin.php
===================================================================
--- /trunk/admin.php	(revision 24833)
+++ /trunk/admin.php	(revision 24834)
@@ -190,5 +190,5 @@
     'U_CAT_UPDATE'=> $link_start.'site_update&amp;site=1',
     'U_RATING'=> $link_start.'rating',
-    'U_RECENT_SET'=> $link_start.'batch_manager&amp;cat=recent',
+    'U_RECENT_SET'=> $link_start.'batch_manager&amp;filter=prefilter-last_import',
     'U_BATCH'=> $link_start.'batch_manager',
     'U_TAGS'=> $link_start.'tags',
@@ -223,5 +223,5 @@
     array(
       'NB_PHOTOS_IN_CADDIE' => $nb_photos_in_caddie,
-      'U_CADDIE' => $link_start.'batch_manager&amp;cat=caddie',
+      'U_CADDIE' => $link_start.'batch_manager&amp;filter=prefilter-caddie',
       )
     );
Index: /trunk/admin/batch_manager.php
===================================================================
--- /trunk/admin/batch_manager.php	(revision 24833)
+++ /trunk/admin/batch_manager.php	(revision 24834)
@@ -44,8 +44,10 @@
 check_input_parameter('selection', $_POST, true, PATTERN_ID);
 
+
 // +-----------------------------------------------------------------------+
 // |                      initialize current set                           |
 // +-----------------------------------------------------------------------+
 
+// filters from form
 if (isset($_POST['submitFilter']))
 {
@@ -110,37 +112,50 @@
   }
 }
-else if (isset($_GET['cat']))
-{
-  if ('caddie' == $_GET['cat'])
-  {
-    $_SESSION['bulk_manager_filter'] = array(
-      'prefilter' => 'caddie'
-      );
-  }
-  else if ('recent' == $_GET['cat'])
-  {
-    $_SESSION['bulk_manager_filter'] = array(
-      'prefilter' => 'last import'
-      );
-  }
-  else if (is_numeric($_GET['cat']))
-  {
-    $_SESSION['bulk_manager_filter'] = array(
-      'category' => $_GET['cat']
-      );
-  }
-}
-else if (isset($_GET['tag']))
-{
-  if (is_numeric($_GET['tag']))
-  {
-    $_SESSION['bulk_manager_filter'] = array(
-      'tags' => array($_GET['tag']),
-      'tag_mode' => 'AND',
-      );
-  }
-}
-
-if (!isset($_SESSION['bulk_manager_filter']))
+// filters from url
+else if (isset($_GET['filter']))
+{
+  if (!is_array($_GET['filter']))
+  {
+    $_GET['filter'] = explode(',', $_GET['filter']);
+  }
+  
+  $_SESSION['bulk_manager_filter'] = array();
+  
+  foreach ($_GET['filter'] as $filter)
+  {
+    list($type, $value) = explode('-', $filter);
+    
+    switch ($type)
+    {
+    case 'prefilter':
+      $_SESSION['bulk_manager_filter']['prefilter'] = $value;
+      break;
+    
+    case 'album':
+      if (is_numeric($value))
+      {
+        $_SESSION['bulk_manager_filter']['category'] = $value;
+      }
+      break;
+      
+    case 'tag':
+      if (is_numeric($value))
+      {
+        $_SESSION['bulk_manager_filter']['tags'] = array($value);
+        $_SESSION['bulk_manager_filter']['tag_mode'] = 'AND';
+      }
+      break;
+      
+    case 'level':
+      if (is_numeric($value) && in_array($value, $conf['available_permission_levels']))
+      {
+        $_SESSION['bulk_manager_filter']['level'] = $value;
+      }
+      break;
+    }
+  }
+}
+
+if (empty($_SESSION['bulk_manager_filter']))
 {
   $_SESSION['bulk_manager_filter'] = array(
@@ -151,11 +166,11 @@
 // echo '<pre>'; print_r($_SESSION['bulk_manager_filter']); echo '</pre>';
 
-// depending on the current filter (in session), we find the appropriate
-// photos
+// 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'])
-  {
+  switch ($_SESSION['bulk_manager_filter']['prefilter'])
+  {
+  case 'caddie':
     $query = '
 SELECT element_id
@@ -167,8 +182,8 @@
       array_from_query($query, 'element_id')
       );
-  }
-
-  if ('favorites' == $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+  case 'favorites':
     $query = '
 SELECT image_id
@@ -180,8 +195,8 @@
       array_from_query($query, 'image_id')
       );
-  }
-
-  if ('last import'== $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+  case 'last_import':
     $query = '
 SELECT MAX(date_available) AS date
@@ -201,8 +216,8 @@
         );
     }
-  }
-
-  if ('with no virtual album' == $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+  case 'no_virtual_album':
     // we are searching elements not linked to any virtual category
     $query = '
@@ -232,8 +247,8 @@
       array_diff($all_elements, $linked_to_virtual)
       );
-  }
-
-  if ('with no album' == $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+  case 'no_album':
     $query = '
 SELECT
@@ -247,8 +262,8 @@
       array_from_query($query, 'id')
       );
-  }
-
-  if ('with no tag' == $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+  case 'no_tag':
     $query = '
 SELECT
@@ -262,13 +277,12 @@
       array_from_query($query, 'id')
       );
-  }
-
-
-  if ('duplicates' == $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+
+  case 'duplicates':
     // 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
@@ -289,8 +303,8 @@
       array_from_query($query, 'id')
       );
-  }
-
-  if ('all photos' == $_SESSION['bulk_manager_filter']['prefilter'])
-  {
+    
+    break;
+
+  case 'all_photos':
     $query = '
 SELECT id
@@ -299,4 +313,6 @@
 
     $filter_sets[] = array_from_query($query, 'id');
+    
+    break;
   }
 
@@ -404,4 +420,5 @@
 $page['cat_elements_id'] = $current_set;
 
+
 // +-----------------------------------------------------------------------+
 // |                       first element to display                        |
@@ -424,4 +441,5 @@
 }
 
+
 // +-----------------------------------------------------------------------+
 // |                                 Tabs                                  |
@@ -443,4 +461,5 @@
 $tabsheet->assign();
 
+
 // +-----------------------------------------------------------------------+
 // |                              tags                                     |
@@ -452,4 +471,5 @@
 ;';
 $template->assign('tags', get_taglist($query, false));
+
 
 // +-----------------------------------------------------------------------+
Index: /trunk/admin/batch_manager_global.php
===================================================================
--- /trunk/admin/batch_manager_global.php	(revision 24833)
+++ /trunk/admin/batch_manager_global.php	(revision 24834)
@@ -113,5 +113,5 @@
       add_tags($tag_ids, $collection);
 
-      if ('with no tag' == $page['prefilter'])
+      if ('no_tag' == $page['prefilter'])
       {
         redirect($redirect_url);
@@ -150,10 +150,10 @@
     
     // let's refresh the page because we the current set might be modified
-    if ('with no album' == $page['prefilter'])
+    if ('no_album' == $page['prefilter'])
     {
       redirect($redirect_url);
     }
 
-    if ('with no virtual album' == $page['prefilter'])
+    if ('no_virtual_album' == $page['prefilter'])
     {
       $category_info = get_cat_info($_POST['associate']);
@@ -174,10 +174,10 @@
     
     // let's refresh the page because we the current set might be modified
-    if ('with no album' == $page['prefilter'])
+    if ('no_album' == $page['prefilter'])
     {
       redirect($redirect_url);
     }
 
-    if ('with no virtual album' == $page['prefilter'])
+    if ('no_virtual_album' == $page['prefilter'])
     {
       $category_info = get_cat_info($_POST['move']);
@@ -436,9 +436,9 @@
   array('ID' => 'caddie', 'NAME' => l10n('Caddie')),
   array('ID' => 'favorites', 'NAME' => l10n('Your favorites')),
-  array('ID' => 'last import', 'NAME' => l10n('Last import')),
-  array('ID' => 'with no album', 'NAME' => l10n('With no album')),
-  array('ID' => 'with no tag', 'NAME' => l10n('With no tag')),
+  array('ID' => 'last_import', 'NAME' => l10n('Last import')),
+  array('ID' => 'no_album', 'NAME' => l10n('With no album')),
+  array('ID' => 'no_tag', 'NAME' => l10n('With no tag')),
   array('ID' => 'duplicates', 'NAME' => l10n('Duplicates')),
-  array('ID' => 'all photos', 'NAME' => l10n('All'))
+  array('ID' => 'all_photos', 'NAME' => l10n('All'))
 );
 
@@ -446,5 +446,5 @@
 {
   array_push($prefilters,
-    array('ID' => 'with no virtual album', 'NAME' => l10n('With no virtual album'))
+    array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'))
   );
 }
@@ -461,5 +461,5 @@
     'START' => $page['start'],
     'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
-    'F_ACTION'=>$base_url.get_query_string_diff(array('cat','start','tag')),
+    'F_ACTION'=>$base_url.get_query_string_diff(array('cat','start','tag','filter')),
    )
  );
Index: /trunk/admin/cat_list.php
===================================================================
--- /trunk/admin/cat_list.php	(revision 24833)
+++ /trunk/admin/cat_list.php	(revision 24834)
@@ -323,5 +323,5 @@
   {
     $tpl_cat['U_MANAGE_ELEMENTS']=
-      $base_url.'batch_manager&amp;cat='.$category['id'];
+      $base_url.'batch_manager&amp;filter=album-'.$category['id'];
   }
 
Index: /trunk/admin/cat_modify.php
===================================================================
--- /trunk/admin/cat_modify.php	(revision 24833)
+++ /trunk/admin/cat_modify.php	(revision 24834)
@@ -253,5 +253,5 @@
   $template->assign(
     'U_MANAGE_ELEMENTS',
-    $base_url.'batch_manager&amp;cat='.$category['id']
+    $base_url.'batch_manager&amp;filter=album-'.$category['id']
     );
 
Index: /trunk/admin/photos_add_direct.php
===================================================================
--- /trunk/admin/photos_add_direct.php	(revision 24833)
+++ /trunk/admin/photos_add_direct.php	(revision 24834)
@@ -58,5 +58,5 @@
     );
 
-  redirect(get_root_url().'admin.php?page=batch_manager&cat=caddie');
+  redirect(get_root_url().'admin.php?page=batch_manager&filter=prefilter-caddie');
 }
 
Index: /trunk/admin/tags.php
===================================================================
--- /trunk/admin/tags.php	(revision 24833)
+++ /trunk/admin/tags.php	(revision 24834)
@@ -462,5 +462,5 @@
   $tag['counter'] = intval(@$tag_counters[ $tag['id'] ]);
   $tag['U_VIEW'] = make_index_url(array('tags'=>array($tag)));
-  $tag['U_EDIT'] = 'admin.php?page=batch_manager&amp;tag='.$tag['id'];
+  $tag['U_EDIT'] = 'admin.php?page=batch_manager&amp;filter=tag-'.$tag['id'];
 
   $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
