fixes #428, ability to hide "sizes" icon on index.php or picture.php

This commit is contained in:
plegall 2017-04-06 15:52:47 +02:00
parent 1d5279e4a8
commit b0ae23e34d
6 changed files with 82 additions and 19 deletions

View file

@ -86,10 +86,12 @@ $display_checkboxes = array(
'index_posted_date_icon',
'index_created_date_icon',
'index_slideshow_icon',
'index_sizes_icon',
'index_new_icon',
'picture_metadata_icon',
'picture_slideshow_icon',
'picture_favorite_icon',
'picture_sizes_icon',
'picture_download_icon',
'picture_navigation_icons',
'picture_navigation_thumb',

View file

@ -65,6 +65,14 @@
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="index_sizes_icon" {if ($display.index_sizes_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Photo sizes'|translate|@ucfirst)}
</label>
</li>
<li>
<label>
{'Number of albums per page'|translate}
@ -109,6 +117,14 @@
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="picture_sizes_icon" {if ($display.picture_sizes_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Photo sizes'|translate|@ucfirst)}
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>

View file

@ -321,26 +321,30 @@ if ( empty($page['is_external']) )
if ( !empty($page['items']) )
{
include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
$url = add_url_params(
duplicate_index_url(),
array('display' => '')
);
$selected_type = $template->get_template_vars('derivative_params')->type;
$template->clear_assign( 'derivative_params' );
$type_map = ImageStdParams::get_defined_type_map();
unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]);
foreach($type_map as $params)
if ($conf['index_sizes_icon'])
{
$template->append(
'image_derivatives',
array(
'DISPLAY' => l10n($params->type),
'URL' => $url.$params->type,
'SELECTED' => ($params->type == $selected_type ? true:false),
)
$url = add_url_params(
duplicate_index_url(),
array('display' => '')
);
$selected_type = $template->get_template_vars('derivative_params')->type;
$template->clear_assign( 'derivative_params' );
$type_map = ImageStdParams::get_defined_type_map();
unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]);
foreach($type_map as $params)
{
$template->append(
'image_derivatives',
array(
'DISPLAY' => l10n($params->type),
'URL' => $url.$params->type,
'SELECTED' => ($params->type == $selected_type ? true:false),
)
);
}
}
}

View file

@ -65,3 +65,5 @@ INSERT INTO piwigo_config (param,value) VALUES ('original_resize_maxheight','201
INSERT INTO piwigo_config (param,value) VALUES ('original_resize_quality','95');
INSERT INTO piwigo_config (param,value) VALUES ('mobile_theme',null);
INSERT INTO piwigo_config (param,value) VALUES ('mail_theme','clear');
INSERT INTO piwigo_config (param,value) VALUES ('picture_sizes_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('index_sizes_icon','true');

View file

@ -0,0 +1,36 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2016 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}
$upgrade_description = 'add "picture_sizes_icon" and "index_sizes_icon" parameters';
conf_update_param('index_sizes_icon', 'true');
conf_update_param('picture_sizes_icon', 'true');
echo "\n".$upgrade_description."\n";
?>

View file

@ -186,7 +186,10 @@ function default_picture_content($content, $element_info)
continue;
$added[$url] = 1;
$show_original &= !($derivative->same_as_source());
$unique_derivatives[$type]= $derivative;
// in case we do not display the sizes icon, we only add the selected size to unique_derivatives
if ($conf['picture_sizes_icon'] or $type == $deriv_type)
$unique_derivatives[$type]= $derivative;
}
global $page, $template;