From 151920ed0943568ad51bd6d9bacadcdea46fea4f Mon Sep 17 00:00:00 2001 From: patdenice Date: Wed, 24 Mar 2010 00:39:34 +0000 Subject: [PATCH] Feature 1533: Allow activation or deactivation of download icon. Add display configuration for picture properties. git-svn-id: http://piwigo.org/svn/trunk@5304 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 26 ++++++ admin/themes/default/default-layout.css | 12 ++- .../themes/default/template/configuration.tpl | 84 ++++++++++++++++++- install/config.sql | 7 ++ install/db/87-database.php | 2 +- install/db/88-database.php | 49 +++++++++++ language/en_UK/admin.lang.php | 1 + language/fr_FR/admin.lang.php | 1 + picture.php | 6 +- themes/default/template/picture.tpl | 22 ++++- 10 files changed, 200 insertions(+), 10 deletions(-) create mode 100644 install/db/88-database.php diff --git a/admin/configuration.php b/admin/configuration.php index b8dc57433..9ec7ed805 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -89,6 +89,19 @@ $display_checkboxes = array( 'picture_navigation_thumb', ); +$display_info_checkboxes = array( + 'author', + 'created_on', + 'posted_on', + 'dimensions', + 'file', + 'filesize', + 'tags', + 'categories', + 'visits', + 'average_rate', + ); + //------------------------------ verification and registration of modifications if (isset($_POST['submit']) and !is_adviser()) { @@ -151,6 +164,12 @@ if (isset($_POST['submit']) and !is_adviser()) { $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true'; } + foreach( $display_info_checkboxes as $checkbox) + { + $_POST['picture_informations'][$checkbox] = + empty($_POST['picture_informations'][$checkbox])? false : true; + } + $_POST['picture_informations'] = addslashes(serialize($_POST['picture_informations'])); break; } } @@ -333,6 +352,13 @@ switch ($page['section']) true ); } + $template->append( + 'display', + array( + 'picture_informations' => unserialize($conf['picture_informations']) + ), + true + ); break; } } diff --git a/admin/themes/default/default-layout.css b/admin/themes/default/default-layout.css index aa9f4fae1..d9c71d96a 100644 --- a/admin/themes/default/default-layout.css +++ b/admin/themes/default/default-layout.css @@ -128,7 +128,8 @@ FIELDSET#historyConf SPAN.property, FIELDSET#commentsConf SPAN.property, FIELDSET#uploadConf SPAN.property, FIELDSET#indexDisplayConf SPAN.property, -FIELDSET#pictureDisplayConf SPAN.property { +FIELDSET#pictureDisplayConf SPAN.property, +FIELDSET#pictureInfoConf SPAN.property { float: right; text-align: left; } @@ -137,7 +138,8 @@ FIELDSET#historyConf INPUT, FIELDSET#commentsConf INPUT, FIELDSET#uploadConf INPUT, FIELDSET#indexDisplayConf INPUT, -FIELDSET#pictureDisplayConf INPUT { +FIELDSET#pictureDisplayConf INPUT, +FIELDSET#pictureInfoConf INPUT { float: none; } @@ -151,14 +153,16 @@ FIELDSET#mainConf TEXTAREA.description { FIELDSET#mainConfCheck SPAN.property, FIELDSET#historyConf SPAN.property, FIELDSET#indexDisplayConf SPAN.property, -FIELDSET#pictureDisplayConf SPAN.property { +FIELDSET#pictureDisplayConf SPAN.property, +FIELDSET#pictureInfoConf SPAN.property { width: 90%; } FIELDSET#mainConfCheck INPUT, FIELDSET#historyConf INPUT, FIELDSET#commentsConf INPUT, FIELDSET#indexDisplayConf INPUT, -FIELDSET#pictureDisplayConf INPUT { +FIELDSET#pictureDisplayConf INPUT, +FIELDSET#pictureInfoConf INPUT { margin-left: 5%; } FIELDSET#uploadConf SELECT { diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index 3ec558dbc..c31374148 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -103,7 +103,6 @@ {/if} - {if isset($comments)}
@@ -129,7 +128,6 @@ -
  • + +
    + {'Photo Properties'|@translate} + +
    {/if} {if !isset($default)} diff --git a/install/config.sql b/install/config.sql index ad638325b..97b8ad53a 100644 --- a/install/config.sql +++ b/install/config.sql @@ -41,8 +41,15 @@ INSERT INTO piwigo_config (param,value,comment) VALUES ('index_slideshow_icon',' INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_metadata_icon','true','Display metadata icon on picture page'); INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_slideshow_icon','true','Display slideshow icon on picture page'); INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_favorite_icon','true','Display favorite icon on picture page'); +INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_download_icon','true','Display download icon on picture page'); INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_navigation_icons','true','Display navigation icons on picture page'); INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_navigation_thumb','true','Display navigation thumbnails on picture page'); +INSERT INTO piwigo_config (param,value,comment) + VALUES ( + 'picture_informations', + 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"average_rate";b:1;s:13:"privacy_level";b:1;}', + 'Information displayed on picture page' + ); INSERT INTO piwigo_themes (id, name) VALUES ('Sylvia', 'Sylvia'); INSERT INTO piwigo_themes (id, name) VALUES ('clear', 'clear'); diff --git a/install/db/87-database.php b/install/db/87-database.php index d5d188eb2..4641caca4 100644 --- a/install/db/87-database.php +++ b/install/db/87-database.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | Piwigo - a PHP based picture gallery | // +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | +// | Copyright(C) 2008-2010 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 | // +-----------------------------------------------------------------------+ diff --git a/install/db/88-database.php b/install/db/88-database.php new file mode 100644 index 000000000..2ab0e4159 --- /dev/null +++ b/install/db/88-database.php @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index 9f190caf0..270972422 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -748,4 +748,5 @@ $lang['Activate Navigation Bar'] = 'Activate Navigation Bar'; $lang['Activate Navigation Thumbnails'] = 'Activate Navigation Thumbnails'; $lang['Activate icon "%s"'] = 'Activate icon "%s"'; $lang['Activate field "%s"'] = 'Activate field "%s"'; +$lang['Photo Properties'] = 'Photo Properties'; ?> diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index 714395e6a..e75b5b805 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -722,6 +722,7 @@ $lang['Activate Navigation Bar'] = 'Activer la barre de navigation'; $lang['Activate Navigation Thumbnails'] = 'Activer les miniatures de navigation'; $lang['Activate icon "%s"'] = 'Activer l\'icone "%s"'; $lang['Activate field "%s"'] = 'Activer le champ "%s"'; +$lang['Photo Properties'] = 'Propriétés de la photo'; $lang['Active Themes'] = 'Thèmes activés'; $lang['Add write access to the "%s" directory'] = 'Ajoutez l\'accès en écriture pour le répertoire "%s"'; diff --git a/picture.php b/picture.php index 289839e7a..7bb52056e 100644 --- a/picture.php +++ b/picture.php @@ -657,10 +657,13 @@ foreach (array('first','previous','next','last', 'current') as $which_image) 'U_IMG' => add_url_params( $picture[$which_image]['url'], $slideshow_url_params), - 'U_DOWNLOAD' => @$picture['current']['download_url'], ) ) ); + if ($conf['picture_download_icon'] and !empty($picture['current']['download_url'])) + { + $template->append($which_image, array('U_DOWNLOAD' => $picture['current']['download_url']), true); + } } } @@ -918,6 +921,7 @@ $infos['INFO_VISITS'] = $picture['current']['hit']; $infos['INFO_FILE'] = $picture['current']['file']; $template->assign($infos); +$template->assign('display_info', unserialize($conf['picture_informations'])); // related tags $tags = get_common_tags( array($page['image_id']), -1); diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl index 84dd8e43f..b1378132e 100644 --- a/themes/default/template/picture.tpl +++ b/themes/default/template/picture.tpl @@ -114,30 +114,43 @@ y.callService( {/if} + {if $display_info.author} + {/if} + {if $display_info.created_on} + {/if} + {if $display_info.posted_on} + {/if} + {if $display_info.dimensions} + {/if} + {if $display_info.file} + {/if} + {if $display_info.filesize} + {/if} + {if $display_info.tags} + {/if} + {if $display_info.categories} + {/if} + {if $display_info.visits} + {/if} -{if isset($rate_summary) } +{if $display_info.average_rate and isset($rate_summary) } {/if} -{if isset($available_permission_levels) } +{if $display_info.privacy_level and isset($available_permission_levels) }
    {'Author'|@translate} {if isset($INFO_AUTHOR)}{$INFO_AUTHOR}{else}{'N/A'|@translate}{/if}
    {'Created on'|@translate} {if isset($INFO_CREATION_DATE)}{$INFO_CREATION_DATE}{else}{'N/A'|@translate}{/if}
    {'Posted on'|@translate} {$INFO_POSTED_DATE}
    {'Dimensions'|@translate} {if isset($INFO_DIMENSIONS)}{$INFO_DIMENSIONS}{else}{'N/A'|@translate}{/if}
    {'File'|@translate} {$INFO_FILE}
    {'Filesize'|@translate} {if isset($INFO_FILESIZE)}{$INFO_FILESIZE}{else}{'N/A'|@translate}{/if}
    {'Tags'|@translate} @@ -147,6 +160,8 @@ y.callService( {/if}
    {'Categories'|@translate} @@ -159,12 +174,15 @@ y.callService( {/if}
    {'Visits'|@translate} {$INFO_VISITS}
    {'Average rate'|@translate} @@ -206,7 +224,7 @@ y.callService(
    {'Privacy level'|@translate}: