mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
feature 2718: Add batch manager filters for photo dimensions
git-svn-id: http://piwigo.org/svn/trunk@17931 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -90,6 +90,19 @@ if (isset($_POST['submitFilter']))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['filter_dimension_use']))
|
||||
{
|
||||
if ( $_POST['filter_dimension'] != 'format' and !preg_match('#^[0-9]+$#', $_POST['filter_dimension_'. $_POST['filter_dimension'] ]) )
|
||||
{
|
||||
array_push($page['errors'], l10n('Invalid dimension'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['bulk_manager_filter']['dimension'] = $_POST['filter_dimension'];
|
||||
$_SESSION['bulk_manager_filter']['dimension_'. $_POST['filter_dimension'] ] = $_POST['filter_dimension_'. $_POST['filter_dimension'] ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['cat']))
|
||||
@@ -327,6 +340,44 @@ if (!empty($_SESSION['bulk_manager_filter']['tags']))
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($_SESSION['bulk_manager_filter']['dimension']))
|
||||
{
|
||||
switch ($_SESSION['bulk_manager_filter']['dimension'])
|
||||
{
|
||||
case 'min_width':
|
||||
$where_clause = 'width >= '.$_SESSION['bulk_manager_filter']['dimension_min_width']; break;
|
||||
case 'max_width':
|
||||
$where_clause = 'width <= '.$_SESSION['bulk_manager_filter']['dimension_max_width']; break;
|
||||
case 'min_height':
|
||||
$where_clause = 'height >= '.$_SESSION['bulk_manager_filter']['dimension_min_height']; break;
|
||||
case 'max_height':
|
||||
$where_clause = 'height <= '.$_SESSION['bulk_manager_filter']['dimension_max_height']; break;
|
||||
case 'format':
|
||||
{
|
||||
switch ($_SESSION['bulk_manager_filter']['dimension_format'])
|
||||
{
|
||||
case 'portrait':
|
||||
$where_clause = 'width/height < 0.95'; break;
|
||||
case 'square':
|
||||
$where_clause = 'width/height >= 0.95 AND width/height <= 1.05'; break;
|
||||
case 'landscape':
|
||||
$where_clause = 'width/height > 1.05 AND width/height < 2.5'; break;
|
||||
case 'panorama':
|
||||
$where_clause = 'width/height >= 2.5'; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE '.$where_clause.'
|
||||
'.$conf['order_by'];
|
||||
|
||||
$filter_sets[] = array_from_query($query, 'id');
|
||||
}
|
||||
|
||||
$current_set = array_shift($filter_sets);
|
||||
foreach ($filter_sets as $set)
|
||||
{
|
||||
|
||||
@@ -391,6 +391,11 @@ $(document).ready(function() {
|
||||
filter_enable(filter);
|
||||
$(this).attr("value", -1);
|
||||
});
|
||||
|
||||
$("select[name='filter_dimension']").change(function () {
|
||||
$("span[id^='filter_dimension_']").hide();
|
||||
$("span#filter_dimension_"+ $(this).attr("value")).show();
|
||||
});
|
||||
|
||||
function filter_disable(filter) {
|
||||
/* hide the filter line */
|
||||
@@ -506,6 +511,7 @@ $(document).ready(function() {
|
||||
{/foreach}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
|
||||
<a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
|
||||
<input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
|
||||
@@ -515,6 +521,7 @@ $(document).ready(function() {
|
||||
</select>
|
||||
<label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
|
||||
</li>
|
||||
|
||||
<li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>
|
||||
<a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
|
||||
<input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}>
|
||||
@@ -527,6 +534,7 @@ $(document).ready(function() {
|
||||
<label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label>
|
||||
<label><span><input type="radio" name="tag_mode" value="OR" {if isset($filter.tag_mode) and $filter.tag_mode eq 'OR'}checked="checked"{/if}> {'Any tag'|@translate}</span></label>
|
||||
</li>
|
||||
|
||||
<li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
|
||||
<a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
|
||||
<input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
|
||||
@@ -536,16 +544,41 @@ $(document).ready(function() {
|
||||
</select>
|
||||
<label><input type="checkbox" name="filter_level_include_lower" {if isset($filter.level_include_lower)}checked="checked"{/if}> {'include photos with lower privacy level'|@translate}</label>
|
||||
</li>
|
||||
|
||||
<li id="filter_dimension" {if !isset($filter.dimension)}style="display:none"{/if}>
|
||||
<a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
|
||||
<input type="checkbox" name="filter_dimension_use" class="useFilterCheckbox" {if isset($filter.dimension)}checked="checked"{/if}>
|
||||
<select name="filter_dimension">
|
||||
<option value="min_width" {if $filter.dimension=='min_width'}selected="selected"{/if}>{'Minimum width'|@translate}</option>
|
||||
<option value="max_width" {if $filter.dimension=='max_width'}selected="selected"{/if}>{'Maximum width'|@translate}</option>
|
||||
<option value="min_height" {if $filter.dimension=='min_height'}selected="selected"{/if}>{'Minimum height'|@translate}</option>
|
||||
<option value="max_height" {if $filter.dimension=='max_height'}selected="selected"{/if}>{'Maximum height'|@translate}</option>
|
||||
<option value="format" {if $filter.dimension=='format'}selected="selected"{/if}>{'Format'|@translate}</option>
|
||||
</select>
|
||||
<span id="filter_dimension_min_width" {if !isset($filter.dimension_min_width) and isset($filter.dimension)}style="display:none;"{/if}><input type="text" name="filter_dimension_min_width" value="{$filter.dimension_min_width}" size="4"> px</span>
|
||||
<span id="filter_dimension_max_width" {if !isset($filter.dimension_max_width)}style="display:none;"{/if}><input type="text" name="filter_dimension_max_width" value="{$filter.dimension_max_width}" size="4"> px</span>
|
||||
<span id="filter_dimension_min_height" {if !isset($filter.dimension_min_height)}style="display:none;"{/if}><input type="text" name="filter_dimension_min_height" value="{$filter.dimension_min_height}" size="4"> px</span>
|
||||
<span id="filter_dimension_max_height" {if !isset($filter.dimension_max_height)}style="display:none;"{/if}><input type="text" name="filter_dimension_max_height" value="{$filter.dimension_max_height}" size="4"> px</span>
|
||||
<span id="filter_dimension_format" {if !isset($filter.dimension_format)}style="display:none;"{/if}>
|
||||
<select name="filter_dimension_format">
|
||||
<option value="portrait" {if $filter.dimension_format=='portrait'}selected="selected"{/if}>{'Portrait'|@translate}</option>
|
||||
<option value="square" {if $filter.dimension_format=='square'}selected="selected"{/if}>{'square'|@translate}</option>
|
||||
<option value="landscape" {if $filter.dimension_format=='landscape'}selected="selected"{/if}>{'Landscape'|@translate}</option>
|
||||
<option value="panorama" {if $filter.dimension_format=='panorama'}selected="selected"{/if}>{'Panorama'|@translate}</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p class="actionButtons">
|
||||
<select id="addFilter">
|
||||
<option value="-1">{'Add a filter'|@translate}</option>
|
||||
<option disabled="disabled">------------------</option>
|
||||
<option value="filter_prefilter">{'Predefined filter'|@translate}</option>
|
||||
<option value="filter_category">{'Album'|@translate}</option>
|
||||
<option value="filter_tags">{'Tags'|@translate}</option>
|
||||
<option value="filter_level">{'Privacy level'|@translate}</option>
|
||||
<option value="filter_prefilter" {if isset($filter.prefilter)}disabled="disabled"{/if}>{'Predefined filter'|@translate}</option>
|
||||
<option value="filter_category" {if isset($filter.category)}disabled="disabled"{/if}>{'Album'|@translate}</option>
|
||||
<option value="filter_tags" {if isset($filter.tags)}disabled="disabled"{/if}>{'Tags'|@translate}</option>
|
||||
<option value="filter_level" {if isset($filter.level)}disabled="disabled"{/if}>{'Privacy level'|@translate}</option>
|
||||
<option value="filter_dimension" {if isset($filter.dimension)}disabled="disabled"{/if}>{'Dimensions'|@translate}</option>
|
||||
</select>
|
||||
<!-- <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
|
||||
<a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
|
||||
|
||||
@@ -357,6 +357,7 @@ $lang['Forbid this language to users'] = 'Forbid this language to users';
|
||||
$lang['Forbid this theme to users'] = "Forbid this theme to users";
|
||||
$lang['Forbidden'] = "Forbidden";
|
||||
$lang['Form'] = "Form";
|
||||
$lang['Format'] = 'Format';
|
||||
$lang['FTP + Synchronization'] = 'FTP + Synchronization';
|
||||
$lang['Gallery title'] = "Gallery title";
|
||||
$lang['Gallery unlocked'] = 'Gallery unlocked';
|
||||
@@ -428,12 +429,14 @@ $lang['Install'] = "Install";
|
||||
$lang['Installed Languages'] = 'Installed Languages';
|
||||
$lang['Installed Themes'] = "Installed Themes";
|
||||
$lang['Instructions to use Piwigo'] = "Instructions to use Piwigo";
|
||||
$lang['Invalid dimension'] = 'Invalid dimension';
|
||||
$lang['Invert'] = 'Invert';
|
||||
$lang['IP'] = "IP";
|
||||
$lang['iPhoto is the default photo manager on MacOSX. The Piwigo export plugin let you create new albums and export your photos directly from iPhoto to your Piwigo photo gallery.'] = 'iPhoto is the default photo manager on MacOSX. The Piwigo export plugin let you create new albums and export your photos directly from iPhoto to your Piwigo photo gallery.';
|
||||
$lang['jump to album'] = "jump to album";
|
||||
$lang['jump to photo'] = "jump to photo";
|
||||
$lang['Keep in touch with Piwigo project, subscribe to Piwigo Announcement Newsletter. You will receive emails when a new release is available (sometimes including a security bug fix, it\'s important to know and upgrade) and when major events happen to the project. Only a few emails a year.'] = "Keep in touch with Piwigo project, subscribe to Piwigo Announcement Newsletter. You will be sent emails when a new release is available (sometimes including a security bug fix, it is important to know and upgrade) and when major events happen to the project. Only a few emails a year.";
|
||||
$lang['Landscape'] = 'Landscape';
|
||||
$lang['Language has been successfully installed'] = 'Language has been successfully installed';
|
||||
$lang['Languages which need upgrade'] = 'Languages which need upgrade';
|
||||
$lang['Languages'] = 'Languages';
|
||||
@@ -491,6 +494,8 @@ $lang['Merge tags'] = 'Merge tags';
|
||||
$lang['Metadata synchronization results'] = "Metadata synchronization results";
|
||||
$lang['Metadata synchronized from file'] = "Metadata synchronized from file";
|
||||
$lang['middle'] = 'middle';
|
||||
$lang['Minimum width'] = 'Minimum width';
|
||||
$lang['Minimum height'] = 'Minimum height';
|
||||
$lang['Minimum privacy level'] = "Minimum privacy level";
|
||||
$lang['Miscellaneous'] = 'Miscellaneous';
|
||||
$lang['Missing a temporary folder'] = 'Missing a temporary folder';
|
||||
@@ -564,6 +569,7 @@ $lang['overrides existing values with empty ones'] = "overrides existing values
|
||||
$lang['Page banner'] = "Page banner";
|
||||
$lang['Page end'] = 'Page end';
|
||||
$lang['Pages seen'] = "Pages seen";
|
||||
$lang['Panorama'] = 'Panorama';
|
||||
$lang['Parameter'] = "Settings";
|
||||
$lang['Parameters'] = "Parameters";
|
||||
$lang['Parent album'] = "Parent album";
|
||||
@@ -621,6 +627,7 @@ $lang['Plugin has been successfully copied'] = "The plugin has been successfully
|
||||
$lang['Plugin list'] = "Plugins list";
|
||||
$lang['Plugins which need upgrade'] = "Plugins to be upgraded";
|
||||
$lang['Plugins'] = "Plugins";
|
||||
$lang['Portrait'] = 'Portrait';
|
||||
$lang['Position'] = "Position";
|
||||
$lang['Posted %s on %s'] = 'Posted %s on %s';
|
||||
$lang['Predefined filter'] = 'Predefined filter';
|
||||
|
||||
@@ -927,4 +927,11 @@ $lang['Name of the duplicate'] = "Nom du duplicata";
|
||||
$lang['Source tag'] = 'Tag source';
|
||||
$lang['Tag "%s" is now a duplicate of "%s"'] = "Le tag \"%s\" est désormais une copie de \"%s\"";
|
||||
$lang['Duplicate selected tags'] = 'Dupliquer les tags sélectionnés';
|
||||
$lang['Invalid dimension'] = 'Dimension invalide';
|
||||
$lang['Minimum width'] = 'Largeur minimale';
|
||||
$lang['Minimum height'] = 'Hauteur minimale';
|
||||
$lang['Format'] = 'Format';
|
||||
$lang['Portrait'] = 'Portrait';
|
||||
$lang['Landscape'] = 'Paysage';
|
||||
$lang['Panorama'] = 'Panorama';
|
||||
?>
|
||||
Reference in New Issue
Block a user