mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-05 01:12:29 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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';
|
||||
?>
|
||||
|
||||
@@ -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';
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user