fixes #235, show/hide edit/caddie/representative icons on index.php or picture.php

This commit is contained in:
plegall 2017-04-07 14:20:19 +02:00
parent 03c2d12991
commit 1c5b36f734
6 changed files with 128 additions and 17 deletions

View file

@ -88,11 +88,16 @@ $display_checkboxes = array(
'index_slideshow_icon',
'index_sizes_icon',
'index_new_icon',
'index_edit_icon',
'index_caddie_icon',
'picture_metadata_icon',
'picture_slideshow_icon',
'picture_favorite_icon',
'picture_sizes_icon',
'picture_download_icon',
'picture_edit_icon',
'picture_caddie_icon',
'picture_representative_icon',
'picture_navigation_icons',
'picture_navigation_thumb',
'picture_menu',

View file

@ -1,5 +1,22 @@
{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
{html_style}
/*
.adminOnlyIcon::before {
content:"(";
}
.adminOnlyIcon::after {
content:")";
}
*/
.adminOnlyIcon {
background-color:#ddd;
padding:2px 5px;
border-radius:5px;
font-size:90%;
}
{/html_style}
<h2>{'Piwigo configuration'|translate} {$TABSHEET_TITLE}</h2>
<form method="post" action="{$F_ACTION}" class="properties">
@ -73,6 +90,22 @@
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="index_edit_icon" {if ($display.index_edit_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Edit album'|translate|@ucfirst)} <span class="adminOnlyIcon tiptip" title="{'available for administrators only'|translate}"><i class="icon-users"></i> {'administrators'}</span>
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="index_caddie_icon" {if ($display.index_caddie_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Add to caddie'|translate|@ucfirst)} <span class="adminOnlyIcon tiptip" title="{'available for administrators only'|translate}"><i class="icon-users"></i> {'administrators'}</span>
</label>
</li>
<li>
<label>
{'Number of albums per page'|translate}
@ -125,6 +158,30 @@
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="picture_edit_icon" {if ($display.picture_edit_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Edit photo'|translate|@ucfirst)} <span class="adminOnlyIcon tiptip" title="{'available for administrators only'|translate}"><i class="icon-users"></i> {'administrators'}</span>
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="picture_caddie_icon" {if ($display.picture_caddie_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Add to caddie'|translate|@ucfirst)} <span class="adminOnlyIcon tiptip" title="{'available for administrators only'|translate}"><i class="icon-users"></i> {'administrators'}</span>
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="picture_representative_icon" {if ($display.picture_representative_icon)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('set as album representative'|translate|@ucfirst)} <span class="adminOnlyIcon tiptip" title="{'available for administrators only'|translate}"><i class="icon-users"></i> {'administrators'}</span>
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
@ -238,7 +295,7 @@
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="picture_informations[privacy_level]" {if ($display.picture_informations.privacy_level)}checked="checked"{/if}>
{'Who can see this photo?'|translate} ({'available for administrators only'|translate})
{'Who can see this photo?'|translate} <span class="adminOnlyIcon tiptip" title="{'available for administrators only'|translate}"><i class="icon-users"></i> {'administrators'}</span>
</label>
</li>
</ul>

View file

@ -199,7 +199,7 @@ if ( empty($page['is_external']) )
);
}
if (isset($page['category']) and is_admin())
if (isset($page['category']) and is_admin() and $conf['index_edit_icon'])
{
$template->assign(
'U_EDIT',
@ -207,7 +207,7 @@ if ( empty($page['is_external']) )
);
}
if (is_admin() and !empty($page['items']))
if (is_admin() and !empty($page['items']) and $conf['index_caddie_icon'])
{
$template->assign(
'U_CADDIE',

View file

@ -66,4 +66,9 @@ 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');
INSERT INTO piwigo_config (param,value) VALUES ('index_sizes_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('index_edit_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('index_caddie_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('picture_edit_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('picture_caddie_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('picture_representative_icon','true');

View file

@ -0,0 +1,40 @@
<?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 5 parameters to show/hide icons (edit/caddie/repressentative)';
conf_update_param('index_edit_icon','true');
conf_update_param('index_caddie_icon','true');
conf_update_param('picture_edit_icon','true');
conf_update_param('picture_caddie_icon','true');
conf_update_param('picture_representative_icon','true');
echo "\n".$upgrade_description."\n";
?>

View file

@ -797,7 +797,7 @@ if ($conf['picture_metadata_icon'])
// admin links
if (is_admin())
{
if (isset($page['category']))
if (isset($page['category']) and $conf['picture_representative_icon'])
{
$template->assign(
array(
@ -808,19 +808,23 @@ if (is_admin())
);
}
$url_admin =
get_root_url().'admin.php?page=photo-'.$page['image_id']
.(isset($page['category']) ? '&amp;cat_id='.$page['category']['id'] : '')
;
if ($conf['picture_edit_icon'])
{
$url_admin =
get_root_url().'admin.php?page=photo-'.$page['image_id']
.(isset($page['category']) ? '&amp;cat_id='.$page['category']['id'] : '')
;
$template->assign(
array(
'U_CADDIE' => add_url_params($url_self,
array('action'=>'add_to_caddie')
),
'U_PHOTO_ADMIN' => $url_admin,
)
);
$template->assign('U_PHOTO_ADMIN', $url_admin);
}
if ($conf['picture_caddie_icon'])
{
$template->assign(
'U_CADDIE',
add_url_params($url_self, array('action'=>'add_to_caddie'))
);
}
$template->assign('available_permission_levels', get_privacy_level_options());
}