aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-09-12 11:35:32 +0000
committermistic100 <mistic@piwigo.org>2014-09-12 11:35:32 +0000
commitf83e780249d55dd3d463cd0f21faf92b4215a508 (patch)
treec531046b3e58ff6aecb108707bfb353f9360526a
parent67ad8fb81ae125e99abc616ccc5a2bf8e44a2f42 (diff)
add URL filter input for dimension and filesize + batch_manager_url_filter trigger + fixes in doubleSlider.js
git-svn-id: http://piwigo.org/svn/trunk@29505 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/batch_manager.php34
-rw-r--r--admin/themes/default/js/doubleSlider.js27
-rw-r--r--tools/triggers_list.php7
3 files changed, 61 insertions, 7 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php
index 65f8e69af..05590e29c 100644
--- a/admin/batch_manager.php
+++ b/admin/batch_manager.php
@@ -175,7 +175,7 @@ elseif (isset($_GET['filter']))
foreach ($_GET['filter'] as $filter)
{
- list($type, $value) = explode('-', $filter);
+ list($type, $value) = explode('-', $filter, 2);
switch ($type)
{
@@ -183,7 +183,7 @@ elseif (isset($_GET['filter']))
$_SESSION['bulk_manager_filter']['prefilter'] = $value;
break;
- case 'album':
+ case 'album': case 'category': case 'cat':
if (is_numeric($value))
{
$_SESSION['bulk_manager_filter']['category'] = $value;
@@ -204,10 +204,38 @@ elseif (isset($_GET['filter']))
$_SESSION['bulk_manager_filter']['level'] = $value;
}
break;
-
+
case 'search':
$_SESSION['bulk_manager_filter']['search']['q'] = $value;
break;
+
+ case 'dimension':
+ $dim_map = array('w'=>'width','h'=>'height','r'=>'ratio');
+ foreach (explode('-', $value) as $part)
+ {
+ $values = explode('..', substr($part, 1));
+ if (isset($dim_map[$part[0]]))
+ {
+ $type = $dim_map[$part[0]];
+ list(
+ $_SESSION['bulk_manager_filter']['dimension']['min_'.$type],
+ $_SESSION['bulk_manager_filter']['dimension']['max_'.$type]
+ ) = $values;
+ }
+ }
+ break;
+
+ case 'filesize':
+ list(
+ $_SESSION['bulk_manager_filter']['filesize']['min'],
+ $_SESSION['bulk_manager_filter']['filesize']['max']
+ ) = explode('..', $value);
+ break;
+
+ default:
+ $_SESSION['bulk_manager_filter'] = trigger_change('batch_manager_url_filter',
+ $_SESSION['bulk_manager_filter'], $type, $value);
+ break;
}
}
}
diff --git a/admin/themes/default/js/doubleSlider.js b/admin/themes/default/js/doubleSlider.js
index 490331feb..c03c3d52f 100644
--- a/admin/themes/default/js/doubleSlider.js
+++ b/admin/themes/default/js/doubleSlider.js
@@ -20,14 +20,33 @@ $.fn.pwgDoubleSlider = function(options) {
));
}
+ function findClosest(array, value) {
+ var closest = null, index = -1;
+ $.each(array, function(i, v){
+ if (closest == null || Math.abs(v - value) < Math.abs(closest - value)) {
+ closest = v;
+ index = i;
+ }
+ });
+ return index;
+ }
+
+ var values = [
+ options.values.indexOf(options.selected.min),
+ options.values.indexOf(options.selected.max)
+ ];
+ if (values[0] == -1) {
+ values[0] = findClosest(options.values, options.selected.min);
+ }
+ if (values[1] == -1) {
+ values[1] = findClosest(options.values, options.selected.max);
+ }
+
var slider = this.find('.slider-slider').slider({
range: true,
min: 0,
max: options.values.length - 1,
- values: [
- options.values.indexOf(options.selected.min),
- options.values.indexOf(options.selected.max)
- ],
+ values: values,
slide: onChange,
change: onChange
});
diff --git a/tools/triggers_list.php b/tools/triggers_list.php
index 22374a8c2..d30057d0b 100644
--- a/tools/triggers_list.php
+++ b/tools/triggers_list.php
@@ -897,6 +897,13 @@ array(
'files' => array('include\ws_functions\pwg.users.php'),
'infos' => 'New in 2.6.2.',
),
+array(
+ 'name' => 'batch_manager_url_filter',
+ 'type' => 'trigger_change',
+ 'vars' => array('array', 'bulk_manager_filter', 'string', 'type', 'string', 'value'),
+ 'files' => array('admin\batch_manager.php'),
+ 'infos' => 'New in 2.7.',
+),
);
?>
<!DOCTYPE html>