Skip to content

Commit

Permalink
Feature 1533: Change "General" by "Options" in Configuration menu.
Browse files Browse the repository at this point in the history
Change "Default Display" tab by "Guest Settings" tab.
Add display tab in Configuration/Option menu.

Allow to activate/deactivate a lot of display features:

On main page:
# Display only recently posted images
# Sort order
# Display all elements in all sub-categories
# Display a calendar by posted date
# Display a calendar by creation date
# Slideshow

On photo page:
# Show file metadata
# slideshow
# Add this image to your favorites
# Navigation Bar
# Navigation Thumbnails

git-svn-id: http://piwigo.org/svn/trunk@5293 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
patdenice committed Mar 23, 2010
1 parent 8b816a1 commit c4fd9f9
Show file tree
Hide file tree
Showing 13 changed files with 263 additions and 32 deletions.
39 changes: 38 additions & 1 deletion admin/configuration.php
Expand Up @@ -75,6 +75,20 @@
'email_admin_on_comment_deletion'
);

$display_checkboxes = array(
'menubar_filter_icon',
'index_sort_order_input',
'index_flat_icon',
'index_posted_date_icon',
'index_created_date_icon',
'index_slideshow_icon',
'picture_metadata_icon',
'picture_slideshow_icon',
'picture_favorite_icon',
'picture_navigation_icons',
'picture_navigation_thumb',
);

//------------------------------ verification and registration of modifications
if (isset($_POST['submit']) and !is_adviser())
{
Expand Down Expand Up @@ -131,6 +145,14 @@
// Never go here
break;
}
case 'display' :
{
foreach( $display_checkboxes as $checkbox)
{
$_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
}
break;
}
}

// updating configuration if no error found
Expand Down Expand Up @@ -174,10 +196,11 @@
$tabsheet = new tabsheet();
// TabSheet initialization
$tabsheet->add('main', l10n('Main'), $conf_link.'main');
$tabsheet->add('display', l10n('Display'), $conf_link.'display');
$tabsheet->add('history', l10n('History'), $conf_link.'history');
$tabsheet->add('comments', l10n('Comments'), $conf_link.'comments');
$tabsheet->add('upload', l10n('Upload'), $conf_link.'upload');
$tabsheet->add('default', l10n('Default display'), $conf_link.'default');
$tabsheet->add('default', l10n('Guest Settings'), $conf_link.'default');
// TabSheet selection
$tabsheet->select($page['section']);
// Assign tabsheet to template
Expand Down Expand Up @@ -298,6 +321,20 @@
$template->assign('default', array());
break;
}
case 'display' :
{
foreach ($display_checkboxes as $checkbox)
{
$template->append(
'display',
array(
$checkbox => $conf[$checkbox]
),
true
);
}
break;
}
}

//----------------------------------------------------------- sending html code
Expand Down
16 changes: 12 additions & 4 deletions admin/themes/default/default-layout.css
Expand Up @@ -126,14 +126,18 @@ FORM#categoryPermissions LI {
FIELDSET#mainConfCheck SPAN.property,
FIELDSET#historyConf SPAN.property,
FIELDSET#commentsConf SPAN.property,
FIELDSET#uploadConf SPAN.property {
FIELDSET#uploadConf SPAN.property,
FIELDSET#indexDisplayConf SPAN.property,
FIELDSET#pictureDisplayConf SPAN.property {
float: right;
text-align: left;
}
FIELDSET#mainConfCheck INPUT,
FIELDSET#historyConf INPUT,
FIELDSET#commentsConf INPUT,
FIELDSET#uploadConf INPUT {
FIELDSET#uploadConf INPUT,
FIELDSET#indexDisplayConf INPUT,
FIELDSET#pictureDisplayConf INPUT {
float: none;
}

Expand All @@ -145,12 +149,16 @@ FIELDSET#mainConf TEXTAREA.description {
}

FIELDSET#mainConfCheck SPAN.property,
FIELDSET#historyConf SPAN.property {
FIELDSET#historyConf SPAN.property,
FIELDSET#indexDisplayConf SPAN.property,
FIELDSET#pictureDisplayConf SPAN.property {
width: 90%;
}
FIELDSET#mainConfCheck INPUT,
FIELDSET#historyConf INPUT,
FIELDSET#commentsConf INPUT {
FIELDSET#commentsConf INPUT,
FIELDSET#indexDisplayConf INPUT,
FIELDSET#pictureDisplayConf INPUT {
margin-left: 5%;
}
FIELDSET#uploadConf SELECT {
Expand Down
3 changes: 1 addition & 2 deletions admin/themes/default/template/admin.tpl
Expand Up @@ -81,8 +81,7 @@ jQuery().ready(function(){ldelim}
<dt class="rdion"><span>{'Configuration'|@translate}&nbsp;</span></dt>
<dd>
<ul>
<li><a href="{$U_CONFIG_GENERAL}">{'General'|@translate}</a></li>
<li><a href="{$U_CONFIG_DISPLAY}">{'Default display'|@translate}</a></li>
<li><a href="{$U_CONFIG_GENERAL}">{'Options'|@translate}</a></li>
<li><a href="{$U_CONFIG_MENUBAR}">{'Menu'|@translate}</a></li>
<li><a href="{$U_CONFIG_EXTENTS}">{'Templates'|@translate}</a></li>
<li><a href="{$U_CONFIG_THEMES}">{'Themes'|@translate}</a></li>
Expand Down
89 changes: 89 additions & 0 deletions admin/themes/default/template/configuration.tpl
Expand Up @@ -202,6 +202,95 @@
{$PROFILE_CONTENT}
{/if}

{if isset($display)}
<fieldset id="indexDisplayConf">
<legend>{'Main Page'|@translate}</legend>
<ul>
<li>
<label>
<span class="property">{'display only recently posted images'|@translate|@ucfirst}</span>
<input type="checkbox" name="menubar_filter_icon" {if ($display.menubar_filter_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'Sort order'|@translate}</span>
<input type="checkbox" name="index_sort_order_input" {if ($display.index_sort_order_input)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'display all elements in all sub-categories'|@translate|@ucfirst}</span>
<input type="checkbox" name="index_flat_icon" {if ($display.index_flat_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'display a calendar by posted date'|@translate|@ucfirst}</span>
<input type="checkbox" name="index_posted_date_icon" {if ($display.index_posted_date_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'display a calendar by creation date'|@translate|@ucfirst}</span>
<input type="checkbox" name="index_created_date_icon" {if ($display.index_created_date_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'slideshow'|@translate|@ucfirst}</span>
<input type="checkbox" name="index_slideshow_icon" {if ($display.index_slideshow_icon)}checked="checked"{/if}>
</label>
</li>
</ul>
</fieldset>

<fieldset id="pictureDisplayConf">
<legend>{'Photo Page'|@translate}</legend>
<ul>
<li>
<label>
<span class="property">{'Show file metadata'|@translate}</span>
<input type="checkbox" name="picture_metadata_icon" {if ($display.picture_metadata_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'slideshow'|@translate}</span>
<input type="checkbox" name="picture_slideshow_icon" {if ($display.picture_slideshow_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'add this image to your favorites'|@translate|@ucfirst}</span>
<input type="checkbox" name="picture_favorite_icon" {if ($display.picture_favorite_icon)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'Navigation Bar'|@translate|@ucfirst}</span>
<input type="checkbox" name="picture_navigation_icons" {if ($display.picture_navigation_icons)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'Navigation Thumbnails'|@translate|@ucfirst}</span>
<input type="checkbox" name="picture_navigation_thumb" {if ($display.picture_navigation_thumb)}checked="checked"{/if}>
</label>
</li>
</ul>
</fieldset>
{/if}

{if !isset($default)}
<p>
<input class="submit" type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}>
Expand Down
2 changes: 1 addition & 1 deletion include/menubar.inc.php
Expand Up @@ -79,7 +79,7 @@ function initialize_menu()
//-------------------------------------------------------------- categories
$block = $menu->get_block('mbCategories');
//------------------------------------------------------------------------ filter
if (!empty($conf['filter_pages']) and get_filter_page_value('used'))
if ($conf['menubar_filter_icon'] and !empty($conf['filter_pages']) and get_filter_page_value('used'))
{
if ($filter['enabled'])
{
Expand Down
51 changes: 30 additions & 21 deletions index.php
Expand Up @@ -107,7 +107,7 @@
);
}

if (!isset($page['flat']) and 'categories' == $page['section'])
if ($conf['index_flat_icon'] and !isset($page['flat']) and 'categories' == $page['section'])
{
$template->assign(
'U_MODE_FLAT',
Expand All @@ -123,16 +123,21 @@
'chronology_style' => 'monthly',
'chronology_view' => 'list',
);
$template->assign(
'U_MODE_CREATED',
duplicate_index_url( $chronology_params, array('start', 'flat') )
);

$chronology_params['chronology_field'] = 'posted';
$template->assign(
'U_MODE_POSTED',
duplicate_index_url( $chronology_params, array('start', 'flat') )
);
if ($conf['index_created_date_icon'])
{
$template->assign(
'U_MODE_CREATED',
duplicate_index_url( $chronology_params, array('start', 'flat') )
);
}
if ($conf['index_posted_date_icon'])
{
$chronology_params['chronology_field'] = 'posted';
$template->assign(
'U_MODE_POSTED',
duplicate_index_url( $chronology_params, array('start', 'flat') )
);
}
}
else
{
Expand All @@ -144,14 +149,17 @@
{
$chronology_field = 'created';
}
$url = duplicate_index_url(
array('chronology_field'=>$chronology_field ),
array('chronology_date', 'start', 'flat')
);
$template->assign(
'U_MODE_'.strtoupper($chronology_field),
$url
);
if ($conf['index_'.$chronology_field.'_date_icon'])
{
$url = duplicate_index_url(
array('chronology_field'=>$chronology_field ),
array('chronology_date', 'start', 'flat')
);
$template->assign(
'U_MODE_'.strtoupper($chronology_field),
$url
);
}
}

if ('search' == $page['section'])
Expand Down Expand Up @@ -218,7 +226,8 @@
// navigation bar
$template->assign( 'navbar', $page['navigation_bar'] );

if ( count($page['items']) > 0
if ( $conf['index_sort_order_input']
and count($page['items']) > 0
and $page['section'] != 'most_visited'
and $page['section'] != 'best_rated')
{
Expand Down Expand Up @@ -278,7 +287,7 @@
{
redirect($page['cat_slideshow_url']);
}
else
elseif ($conf['index_slideshow_icon'])
{
$template->assign('U_SLIDESHOW', $page['cat_slideshow_url']);
}
Expand Down
11 changes: 11 additions & 0 deletions install/config.sql
Expand Up @@ -32,6 +32,17 @@ INSERT INTO piwigo_config (param,value,comment) VALUES ('upload_link_everytime',
INSERT INTO piwigo_config (param,value,comment) VALUES ('upload_user_access',2 /*ACCESS_CLASSIC*/,'User access level to upload');
INSERT INTO piwigo_config (param,value,comment) VALUES ('extents_for_templates','a:0:{}','Actived template-extension(s)');
INSERT INTO piwigo_config (param,value,comment) VALUES ('blk_menubar','','Menubar options');
INSERT INTO piwigo_config (param,value,comment) VALUES ('menubar_filter_icon','true','Display filter icon');
INSERT INTO piwigo_config (param,value,comment) VALUES ('index_sort_order_input','true','Display image order selection list');
INSERT INTO piwigo_config (param,value,comment) VALUES ('index_flat_icon','true','Display flat icon');
INSERT INTO piwigo_config (param,value,comment) VALUES ('index_posted_date_icon','true','Display calendar by posted date');
INSERT INTO piwigo_config (param,value,comment) VALUES ('index_created_date_icon','true','Display calendar by creation date icon');
INSERT INTO piwigo_config (param,value,comment) VALUES ('index_slideshow_icon','true','Display 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_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_themes (id, name) VALUES ('Sylvia', 'Sylvia');
INSERT INTO piwigo_themes (id, name) VALUES ('clear', 'clear');
Expand Down
54 changes: 54 additions & 0 deletions install/db/87-database.php
@@ -0,0 +1,54 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based picture gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2009 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 display configuration options.';

$query = '
INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
VALUES
("menubar_filter_icon","true","Display filter icon"),
("index_sort_order_input","true","Display image order selection list"),
("index_flat_icon","true","Display flat icon"),
("index_posted_date_icon","true","Display calendar by posted date"),
("index_created_date_icon","true","Display calendar by creation date icon"),
("index_slideshow_icon","true","Display slideshow icon"),
("picture_metadata_icon","true","Display metadata icon on picture page"),
("picture_slideshow_icon","true","Display slideshow icon on picture page"),
("picture_favorite_icon","true","Display favorite icon on picture page"),
("picture_navigation_icons","true","Display navigation icons on picture page"),
("picture_navigation_thumb","true","Display navigation thumbnails on picture page")
;';

pwg_query($query);

echo
"\n"
. $upgrade_description
."\n"
;
?>
6 changes: 6 additions & 0 deletions language/en_UK/admin.lang.php
Expand Up @@ -679,4 +679,10 @@
$lang['Forbid this theme to users'] = "Forbid this theme to users";
$lang['Set as default theme for unregistered and new users'] = "Set as default theme for unregistered and new users";
$lang['unknown'] = 'unknown';

$lang['Guest Settings'] = 'Guest Settings';
$lang['Main Page'] = 'Main Page';
$lang['Photo Page'] = 'Photo Page';
$lang['Navigation Bar'] = 'Navigation Bar';
$lang['Navigation Thumbnails'] = 'Navigation Thumbnails';
?>

0 comments on commit c4fd9f9

Please sign in to comment.