aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-12-31 11:58:14 +0000
committerplegall <plg@piwigo.org>2010-12-31 11:58:14 +0000
commitaa30ee72d24a4eeca69e46be72baf055bf869889 (patch)
treec99fbdce8a694ef41fbc25bf4bbcc0f604ac22b9
parentff36bf3b70b58a117b7ccfe72d0f3faf58d97f34 (diff)
feature 2089: add the "not_linked" feature as "with no virtual album" in the
new Batch Manager. git-svn-id: http://piwigo.org/svn/trunk@8403 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/batch_manager.php65
-rw-r--r--admin/batch_manager_global.php30
-rw-r--r--admin/maintenance.php8
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl3
4 files changed, 52 insertions, 54 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php
index 123304a8c..e9a82966e 100644
--- a/admin/batch_manager.php
+++ b/admin/batch_manager.php
@@ -54,7 +54,7 @@ if (isset($_POST['submitFilter']))
if (isset($_POST['filter_prefilter_use']))
{
- $prefilters = array('caddie', 'last import', 'with no album', 'with no tag');
+ $prefilters = array('caddie', 'last import', 'with no album', 'with no tag', 'with no virtual album');
if (in_array($_POST['filter_prefilter'], $prefilters))
{
$_SESSION['bulk_manager_filter']['prefilter'] = $_POST['filter_prefilter'];
@@ -144,6 +144,37 @@ SELECT id
);
}
}
+
+ if ('with no virtual album' == $_SESSION['bulk_manager_filter']['prefilter'])
+ {
+ // we are searching elements not linked to any virtual category
+ $query = '
+ SELECT id
+ FROM '.IMAGES_TABLE.'
+ ;';
+ $all_elements = array_from_query($query, 'id');
+
+ $query = '
+ SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ WHERE dir IS NULL
+ ;';
+ $virtual_categories = array_from_query($query, 'id');
+ if (!empty($virtual_categories))
+ {
+ $query = '
+ SELECT DISTINCT(image_id)
+ FROM '.IMAGE_CATEGORY_TABLE.'
+ WHERE category_id IN ('.implode(',', $virtual_categories).')
+ ;';
+ $linked_to_virtual = array_from_query($query, 'image_id');
+ }
+
+ array_push(
+ $filter_sets,
+ array_diff($all_elements, $linked_to_virtual)
+ );
+ }
}
if (isset($_SESSION['bulk_manager_filter']['category']))
@@ -194,38 +225,6 @@ $page['cat_elements_id'] = $current_set;
// // managed category in $page['cat_elements_id'] array.
// $page['cat_elements_id'] = array();
-// else if ('not_linked' == $_GET['cat'])
-// {
-// $page['title'] = l10n('Not linked elements');
-// $template->assign(array('U_ACTIVE_MENU' => 5 ));
-//
-// // we are searching elements not linked to any virtual category
-// $query = '
-// SELECT id
-// FROM '.IMAGES_TABLE.'
-// ;';
-// $all_elements = array_from_query($query, 'id');
-//
-// $linked_to_virtual = array();
-//
-// $query = '
-// SELECT id
-// FROM '.CATEGORIES_TABLE.'
-// WHERE dir IS NULL
-// ;';
-// $virtual_categories = array_from_query($query, 'id');
-// if (!empty($virtual_categories))
-// {
-// $query = '
-// SELECT DISTINCT(image_id)
-// FROM '.IMAGE_CATEGORY_TABLE.'
-// WHERE category_id IN ('.implode(',', $virtual_categories).')
-// ;';
-// $linked_to_virtual = array_from_query($query, 'image_id');
-// }
-//
-// $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
-// }
// else if ('duplicates' == $_GET['cat'])
// {
// $page['title'] = l10n('Files with same name in more than one physical category');
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index 419ac3c35..d6b793f39 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -120,6 +120,14 @@ DELETE
$collection,
array($_POST['associate'])
);
+
+ $_SESSION['page_infos'] = array(
+ l10n('Information data registered in database')
+ );
+
+ // 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 ('dissociate' == $action)
@@ -149,20 +157,16 @@ DELETE
';
pwg_query($query);
- // we remove the dissociated images if we are currently displaying the
- // category to dissociate from.
- //
- // TODO we can display the photo of a given album without the $_GET['cat']
- if (is_numeric($_GET['cat']) and $_POST['dissociate'] == $_GET['cat'])
- {
- $page['cat_elements_id'] = array_diff(
- $page['cat_elements_id'],
- $dissociables
- );
- }
+ update_category($_POST['dissociate']);
+
+ $_SESSION['page_infos'] = array(
+ l10n('Information data registered in database')
+ );
+
+ // 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);
}
-
- update_category($_POST['dissociate']);
}
// author
diff --git a/admin/maintenance.php b/admin/maintenance.php
index 09f90ce68..0f8f23aaa 100644
--- a/admin/maintenance.php
+++ b/admin/maintenance.php
@@ -153,14 +153,6 @@ $advanced_features = array();
array_push(
$advanced_features,
array(
- 'CAPTION' => l10n('Not linked elements'),
- 'URL' => get_root_url().'admin.php?page=element_set&amp;cat=not_linked'
- )
- );
-
-array_push(
- $advanced_features,
- array(
'CAPTION' => l10n('Files with same name in more than one physical album'),
'URL' => get_root_url().'admin.php?page=element_set&amp;cat=duplicates'
)
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index f9bb4b651..a663089d4 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -353,6 +353,9 @@ a.removeFilter:hover {background: url(admin/themes/default/icon/remove_filter_ho
<select name="filter_prefilter">
<option value="caddie" {if $filter.prefilter eq 'caddie'}selected="selected"{/if}>caddie</option>
<option value="last import" {if $filter.prefilter eq 'last import'}selected="selected"{/if}>last import</option>
+{if $ENABLE_SYNCHRONIZATION}
+ <option value="with no virtual album" {if $filter.prefilter eq 'with no virtual album'}selected="selected"{/if}>with no virtual album</option>
+{/if}
<!-- <option value="with no album">with no album</option> -->
<!-- <option value="with no virtual album">with no virtual album</option> -->
<!-- <option value="with no tag">with no tag</option> -->