Index: /trunk/admin/batch_manager.php
===================================================================
--- /trunk/admin/batch_manager.php	(revision 8421)
+++ /trunk/admin/batch_manager.php	(revision 8422)
@@ -193,4 +193,20 @@
   }
 
+  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'])
   {
Index: /trunk/admin/batch_manager_global.php
===================================================================
--- /trunk/admin/batch_manager_global.php	(revision 8421)
+++ /trunk/admin/batch_manager_global.php	(revision 8422)
@@ -65,4 +65,23 @@
 // +-----------------------------------------------------------------------+
 
+// $page['prefilter'] is a shortcut to test if the current filter contains a
+// given prefilter. The idea is to make conditions simpler to write in the
+// code.
+$page['prefilter'] = 'none';
+if (isset($_SESSION['bulk_manager_filter']['prefilter']))
+{
+  $page['prefilter'] = $_SESSION['bulk_manager_filter']['prefilter'];
+}
+
+// $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'];
+
 if (isset($_POST['submit']))
 {
@@ -86,4 +105,9 @@
     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
@@ -96,4 +120,9 @@
     $tag_ids = get_fckb_tag_ids($_POST['add_tags']);
     add_tags($tag_ids, $collection);
+
+    if ('with no tag' == $page['prefilter'])
+    {
+      redirect(get_root_url().'admin.php?page='.$_GET['page']);
+    }
   }
 
@@ -126,6 +155,17 @@
     
     // let's refresh the page because we the current set might be modified
-    $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
-    redirect($redirect_url);
+    if ('with no album' == $page['prefilter'])
+    {
+      redirect($redirect_url);
+    }
+
+    if ('with no virtual album' == $page['prefilter'])
+    {
+      $category_info = get_cat_info($_POST['associate']);
+      if (empty($category_info['dir']))
+      {
+        redirect($redirect_url);
+      }
+    }
   }
 
@@ -164,5 +204,4 @@
       
       // let's refresh the page because we the current set might be modified
-      $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
       redirect($redirect_url);
     }
@@ -262,4 +301,12 @@
       $datas
       );
+
+    if (isset($_SESSION['bulk_manager_filter']['level']))
+    {
+      if ($_POST['level'] < $_SESSION['bulk_manager_filter']['level'])
+      {
+        redirect($redirect_url);
+      }
+    }
   }
   
@@ -301,4 +348,27 @@
       array_push($page['errors'], l10n('You need to confirm deletion'));
     }
+  }
+
+  // synchronize metadata
+  if ('metadata' == $action)
+  {
+    $query = '
+SELECT id, path
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $collection).')
+;';
+    $id_to_path = array();
+    $result = pwg_query($query);
+    while ($row = pwg_db_fetch_assoc($result))
+    {
+      $id_to_path[$row['id']] = $row['path'];
+    }
+    
+    update_metadata($id_to_path);
+
+    array_push(
+      $page['infos'],
+      l10n('Metadata synchronized from file')
+      );
   }
 }
@@ -478,4 +548,15 @@
   );
 
+// metadata
+include_once( PHPWG_ROOT_PATH.'admin/site_reader_local.php');
+$site_reader = new LocalSiteReader('./');
+$used_metadata = implode( ', ', $site_reader->get_metadata_attributes());
+
+$template->assign(
+    array(
+      'used_metadata' => $used_metadata,
+    )
+  );
+
 // +-----------------------------------------------------------------------+
 // |                        global mode thumbnails                         |
Index: /trunk/admin/themes/default/template/batch_manager_global.tpl
===================================================================
--- /trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 8421)
+++ /trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 8422)
@@ -349,6 +349,6 @@
           <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="with no tag">with no tag</option> -->
         </select>
       </li>
@@ -485,4 +485,5 @@
       <option value="date_creation">{'Set creation date'|@translate}</option>
       <option value="level">{'Who can see these photos?'|@translate}</option>
+      <option value="metadata">{'synchronize metadata'|@translate}</option>
   {if ($IN_CADDIE)}
       <option value="remove_from_caddie">{'Remove from caddie'|@translate}</option>
@@ -567,4 +568,8 @@
     </div>
 
+    <!-- metadata -->
+    <div id="action_metadata" class="bulkAction">
+    </div>
+
     <p id="applyActionBlock" style="display:none" class="actionButtons">
       <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span></p>
Index: /trunk/language/en_UK/admin.lang.php
===================================================================
--- /trunk/language/en_UK/admin.lang.php	(revision 8421)
+++ /trunk/language/en_UK/admin.lang.php	(revision 8422)
@@ -799,3 +799,4 @@
 $lang['remove creation date'] = 'remove creation date';
 $lang['with no album'] = 'with no album';
+$lang['with no tag'] = 'with no tag';
 ?>
Index: /trunk/language/fr_FR/admin.lang.php
===================================================================
--- /trunk/language/fr_FR/admin.lang.php	(revision 8421)
+++ /trunk/language/fr_FR/admin.lang.php	(revision 8422)
@@ -804,3 +804,4 @@
 $lang['remove creation date'] = 'supprimer la date de création';
 $lang['with no album'] = 'sans album';
+$lang['with no tag'] = 'sans tag';
 ?>
