From 1c5b36f7347c04eb305ba623b75fed48abd2510a Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 7 Apr 2017 14:20:19 +0200 Subject: [PATCH] fixes #235, show/hide edit/caddie/representative icons on index.php or picture.php --- admin/configuration.php | 5 ++ .../template/configuration_display.tpl | 59 ++++++++++++++++++- index.php | 4 +- install/config.sql | 7 ++- install/db/152-database.php | 40 +++++++++++++ picture.php | 30 ++++++---- 6 files changed, 128 insertions(+), 17 deletions(-) create mode 100644 install/db/152-database.php diff --git a/admin/configuration.php b/admin/configuration.php index 8f683e304..2b76aef5d 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -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', diff --git a/admin/themes/default/template/configuration_display.tpl b/admin/themes/default/template/configuration_display.tpl index 9682a44e3..fb47b22d9 100644 --- a/admin/themes/default/template/configuration_display.tpl +++ b/admin/themes/default/template/configuration_display.tpl @@ -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} +

{'Piwigo configuration'|translate} {$TABSHEET_TITLE}

@@ -73,6 +90,22 @@ +
  • + +
  • + +
  • + +
  • +
  • +
  • + +
  • + +
  • + +
  • + +
  • + +
  • +
  • diff --git a/index.php b/index.php index 6bbdf86b0..e3af45f10 100644 --- a/index.php +++ b/index.php @@ -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', diff --git a/install/config.sql b/install/config.sql index 722dcb4d9..87e075ff5 100644 --- a/install/config.sql +++ b/install/config.sql @@ -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'); \ No newline at end of file +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'); diff --git a/install/db/152-database.php b/install/db/152-database.php new file mode 100644 index 000000000..4bd4fcd87 --- /dev/null +++ b/install/db/152-database.php @@ -0,0 +1,40 @@ + diff --git a/picture.php b/picture.php index 9ad4f1551..c6fb4cde1 100644 --- a/picture.php +++ b/picture.php @@ -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']) ? '&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']) ? '&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()); }