aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/batch_manager.php50
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl8
-rw-r--r--admin/themes/default/theme.css2
-rw-r--r--language/en_UK/admin.lang.php4
-rw-r--r--language/fr_FR/admin.lang.php6
5 files changed, 57 insertions, 13 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php
index e00364367..28c7fe06d 100644
--- a/admin/batch_manager.php
+++ b/admin/batch_manager.php
@@ -79,6 +79,19 @@ if (isset($_POST['submitFilter']))
if (isset($_POST['filter_prefilter_use']))
{
$_SESSION['bulk_manager_filter']['prefilter'] = $_POST['filter_prefilter'];
+
+ if ('duplicates' == $_POST['filter_prefilter'])
+ {
+ if (isset($_POST['filter_duplicates_date']))
+ {
+ $_SESSION['bulk_manager_filter']['duplicates_date'] = true;
+ }
+
+ if (isset($_POST['filter_duplicates_dimensions']))
+ {
+ $_SESSION['bulk_manager_filter']['duplicates_dimensions'] = true;
+ }
+ }
}
if (isset($_POST['filter_category_use']))
@@ -300,23 +313,36 @@ SELECT
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.
+ $duplicates_on_fields = array('file');
+
+ if (isset($_SESSION['bulk_manager_filter']['duplicates_date']))
+ {
+ $duplicates_on_fields[] = 'date_creation';
+ }
+
+ if (isset($_SESSION['bulk_manager_filter']['duplicates_dimensions']))
+ {
+ $duplicates_on_fields[] = 'width';
+ $duplicates_on_fields[] = 'height';
+ }
+
$query = '
-SELECT file
+SELECT
+ GROUP_CONCAT(id) AS ids
FROM '.IMAGES_TABLE.'
- GROUP BY file, date_creation
+ GROUP BY '.implode(',', $duplicates_on_fields).'
HAVING COUNT(*) > 1
;';
- $duplicate_files = query2array($query, null, 'file');
+ $array_of_ids_string = query2array($query, null, 'ids');
- $query = '
-SELECT id
- FROM '.IMAGES_TABLE.'
- WHERE file IN (\''.implode("','", array_map('pwg_db_real_escape_string', $duplicate_files)).'\')
-;';
- $filter_sets[] = query2array($query, null, 'id');
+ $ids = array();
+
+ foreach ($array_of_ids_string as $ids_string)
+ {
+ $ids = array_merge($ids, explode(',', $ids_string));
+ }
+
+ $filter_sets[] = $ids;
break;
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index 6ee116408..575929674 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -392,6 +392,7 @@ $(document).ready(function() {
jQuery("select[name=filter_prefilter]").change(function() {
jQuery("#empty_caddie").toggle(jQuery(this).val() == "caddie");
+ jQuery("#duplicates_options").toggle(jQuery(this).val() == "duplicates");
});
});
@@ -418,6 +419,13 @@ $(document).ready(function() {
{/foreach}
</select>
<a id="empty_caddie" href="admin.php?page=batch_manager&amp;action=empty_caddie" style="{if !isset($filter.prefilter) or $filter.prefilter ne 'caddie'}display:none{/if}">{'Empty caddie'|translate}</a>
+
+ <span id="duplicates_options" style="{if !isset($filter.prefilter) or $filter.prefilter ne 'duplicates'}display:none{/if}">
+ {'based on'|translate}
+ <input type="checkbox" checked="checked" disabled="disabled"> {'file name'|translate}
+ <label><input type="checkbox" name="filter_duplicates_date" {if isset($filter.duplicates_date) or (isset($filter.prefilter) and $filter.prefilter ne 'duplicates')}checked="checked"{/if}> {'date & time'|translate}</label>
+ <label><input type="checkbox" name="filter_duplicates_dimensions" {if isset($filter.duplicates_dimensions)}checked="checked"{/if}> {'width & height'|translate}</label>
+ </span>
</li>
<li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index 1dd29258f..262728f29 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -981,6 +981,8 @@ LEGEND {
#batchManagerGlobal blockquote {margin:5px 0 20px 15px;}
#batchManagerGlobal .ui-slider-horizontal {width:650px;margin:5px 0 10px 0;}
+#batchManagerGlobal #duplicates_options label {margin-left:10px;}
+
#order_filters a.addFilter {font-weight:normal;margin-left:20px;}
#order_filters a.removeFilter {font-weight:normal;}
#order_filters span.property span.filter:first-child a.removeFilter {display:none;} /* can't delete the first field */
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index f7992360a..be8b3b1a5 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -976,4 +976,8 @@ $lang['Open user details'] = 'Open user details';
$lang['Close user details'] = 'Close user details';
$lang['Empty caddie'] = 'Empty caddie';
$lang['between %s and %s MB'] = 'between %s and %s MB';
+$lang['based on'] = 'based on';
+$lang['file name'] = 'file name';
+$lang['date & time'] = 'date & time';
+$lang['width & height'] = 'width & height';
?> \ No newline at end of file
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index c21414665..28ae9229d 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -977,4 +977,8 @@ $lang['Allow users to add a link to their website'] = 'Autoriser les utilisateur
$lang['Impossible to deactivate the default theme.'] = 'Impossible de désactiver le thème par défaut.';
$lang['Empty caddie'] = 'Vider le panier';
$lang['The settings for the guest are from the %s user'] = 'Les préféreces des invités sont celles de l\'utilisateur %s';
-$lang['between %s and %s MB'] = 'entre %s et %s Mo'; \ No newline at end of file
+$lang['between %s and %s MB'] = 'entre %s et %s Mo';
+$lang['based on'] = 'basé sur';
+$lang['file name'] = 'nom de fichier';
+$lang['date & time'] = 'date et heure';
+$lang['width & height'] = 'largeur et hauteur';