aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-01-01 14:35:52 +0000
committerplegall <plg@piwigo.org>2011-01-01 14:35:52 +0000
commit4b771b5ab632a8609e21bb538fed78a68d620cd0 (patch)
treeffebae3089c12d5eea963c809dd08284f87152bb
parent4effe045ee0b924cdcf17c7499d12ab4467433a3 (diff)
feature 2092 added: Batch Manager can filter all photos with no tag
feature 1866 added: Batch Manager can synchronize metadata git-svn-id: http://piwigo.org/svn/trunk@8422 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/batch_manager.php16
-rw-r--r--admin/batch_manager_global.php87
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl7
-rw-r--r--language/en_UK/admin.lang.php1
-rw-r--r--language/fr_FR/admin.lang.php1
5 files changed, 108 insertions, 4 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php
index e11c8213e..2288acfb2 100644
--- a/admin/batch_manager.php
+++ b/admin/batch_manager.php
@@ -192,6 +192,22 @@ SELECT
);
}
+ 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
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index 2741096bf..54b2a75a2 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -64,6 +64,25 @@ else if (isset($_POST['selection']))
// | global mode form submission |
// +-----------------------------------------------------------------------+
+// $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']))
{
// if the user tries to apply an action, it means that there is at least 1
@@ -85,6 +104,11 @@ DELETE
;';
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
@@ -95,6 +119,11 @@ DELETE
{
$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']);
+ }
}
if ('del_tags' == $action)
@@ -125,8 +154,19 @@ DELETE
);
// 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);
+ }
+ }
}
if ('dissociate' == $action)
@@ -163,7 +203,6 @@ DELETE
);
// 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);
}
}
@@ -261,6 +300,14 @@ DELETE
array('primary' => array('id'), 'update' => array('level')),
$datas
);
+
+ if (isset($_SESSION['bulk_manager_filter']['level']))
+ {
+ if ($_POST['level'] < $_SESSION['bulk_manager_filter']['level'])
+ {
+ redirect($redirect_url);
+ }
+ }
}
// add_to_caddie
@@ -301,6 +348,29 @@ DELETE
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')
+ );
+ }
}
// +-----------------------------------------------------------------------+
@@ -477,6 +547,17 @@ $template->assign(
)
);
+// 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 |
// +-----------------------------------------------------------------------+
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index 039caf78a..6220bf860 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -348,8 +348,8 @@ a.removeFilter:hover {background: url(admin/themes/default/icon/remove_filter_ho
{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="with no tag">with no tag</option> -->
</select>
</li>
<li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
@@ -484,6 +484,7 @@ a.removeFilter:hover {background: url(admin/themes/default/icon/remove_filter_ho
<option value="title">{'Set title'|@translate}</option>
<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>
{else}
@@ -566,6 +567,10 @@ a.removeFilter:hover {background: url(admin/themes/default/icon/remove_filter_ho
</select>
</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>
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index 1adef4441..6edb53994 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -798,4 +798,5 @@ $lang['remove title'] = 'remove title';
$lang['Type here the title'] = 'Type here the title';
$lang['remove creation date'] = 'remove creation date';
$lang['with no album'] = 'with no album';
+$lang['with no tag'] = 'with no tag';
?>
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index 4356cee5b..5879b3c4a 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -803,4 +803,5 @@ $lang['remove title'] = 'supprimer le titre';
$lang['Type here the title'] = 'Entrez ici le titre';
$lang['remove creation date'] = 'supprimer la date de création';
$lang['with no album'] = 'sans album';
+$lang['with no tag'] = 'sans tag';
?>