Skip to content

Commit

Permalink
Resolved issue 0000807: New slideshow features
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@2218 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rub committed Feb 27, 2008
1 parent 98d4b28 commit bf40122
Show file tree
Hide file tree
Showing 29 changed files with 574 additions and 158 deletions.
18 changes: 17 additions & 1 deletion include/category_default.inc.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -66,6 +66,22 @@
$template->assign_block_vars('thumbnails.line', array());
// current row displayed
$row_number = 0;

// define category slideshow url
$row = reset($pictures);
$page['cat_slideshow_url'] =
add_url_params(
duplicate_picture_url(
array(
'image_id' => $row['id'],
'image_file' => $row['file']
),
array('start')
),
array('slideshow' =>
(isset($_GET['slideshow']) ? $_GET['slideshow']
: '' ))
);
}

trigger_action('loc_begin_index_thumbnails', $pictures);
Expand Down
20 changes: 14 additions & 6 deletions include/config_default.inc.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -66,10 +66,6 @@
// the date_available
$conf['order_by'] = ' ORDER BY date_available DESC, file ASC, id ASC';

// slideshow_period : waiting time in seconds before loading a new page
// during automated slideshow
$conf['slideshow_period'] = 4;

// file_ext : file extensions (case sensitive) authorized
$conf['file_ext'] = array('jpg','JPG','jpeg','JPEG',
'png','PNG','gif','GIF','mpg','zip',
Expand Down Expand Up @@ -692,8 +688,20 @@
);

// +-----------------------------------------------------------------------+
// | Light slideshow |
// | Slideshow |
// +-----------------------------------------------------------------------+
// slideshow_period : waiting time in seconds before loading a new page
// during automated slideshow
// slideshow_period_min, slideshow_period_max are bounds of slideshow_period
// slideshow_period_step is the step of navigation between min and max
$conf['slideshow_period_min'] = 1;
$conf['slideshow_period_max'] = 10;
$conf['slideshow_period_step'] = 1;
$conf['slideshow_period'] = 4;

// slideshow_repeat : slideshow loops on pictures
$conf['slideshow_repeat'] = true;

// $conf['light_slideshow'] indicates to use slideshow.tpl in state of
// picture.tpl for slideshow
// Take care to have slideshow.tpl in all available templates
Expand Down
4 changes: 3 additions & 1 deletion include/functions.inc.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -749,6 +749,8 @@ function redirect_http( $url )
{
ob_clean();
}
// default url is on html format
$url = html_entity_decode($url);
header('Request-URI: '.$url);
header('Content-Location: '.$url);
header('Location: '.$url);
Expand Down
108 changes: 107 additions & 1 deletion include/functions_picture.inc.php
@@ -1,7 +1,7 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -223,4 +223,110 @@ function get_download_url($what_part, $element_info)
return trigger_event( 'get_download_url', $url, $element_info);
}

/*
* get slideshow default params into array
*
* @param void
*
* @return slideshow default values into array
*/
function get_default_slideshow_params()
{
global $conf;

return array(
'period' => $conf['slideshow_period'],
'repeat' => $conf['slideshow_repeat'],
'play' => true,
);
}

/*
* check and correct slideshow params from array
*
* @param array of params
*
* @return slideshow corrected values into array
*/
function correct_slideshow_params($params = array())
{
global $conf;

if ($params['period'] < $conf['slideshow_period_min'])
{
$params['period'] = $conf['slideshow_period_min'];
}
else if ($params['period'] > $conf['slideshow_period_max'])
{
$params['period'] = $conf['slideshow_period_max'];
}

return $params;
}

/*
* Decode slideshow string params into array
*
* @param string params like ""
*
* @return slideshow values into array
*/
function decode_slideshow_params($encode_params = null)
{
global $conf;

$result = get_default_slideshow_params();

if (is_numeric($encode_params))
{
$result['period'] = $encode_params;
}
else
{
$matches = array();
if (preg_match_all('/([a-z]+)-(\d+)/', $encode_params, $matches))
{
$matchcount = count($matches[1]);
for ($i = 0; $i < $matchcount; $i++)
{
$result[$matches[1][$i]] = $matches[2][$i];
}
}

if (preg_match_all('/([a-z]+)-(true|false)/', $encode_params, $matches))
{
$matchcount = count($matches[1]);
for ($i = 0; $i < $matchcount; $i++)
{
$result[$matches[1][$i]] = get_boolean($matches[2][$i]);
}
}
}

return correct_slideshow_params($result);
}

/*
* Encode slideshow array params into array
*
* @param array params
*
* @return slideshow values into string
*/
function encode_slideshow_params($decode_params = array())
{
global $conf;

$params = array_diff_assoc(correct_slideshow_params($decode_params), get_default_slideshow_params());
$result = '';

foreach ($params as $name => $value)
{
// boolean_to_string return $value, if it's not a bool
$result .= '+'.$name.'-'.boolean_to_string($value);
}

return $result;
}

?>
23 changes: 19 additions & 4 deletions index.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -67,7 +67,7 @@
check_restrictions($page['category']['id']);
}

if ( count($page['items']) > $user['nb_image_page'])
if (count($page['items']) > $user['nb_image_page'])
{
$page['navigation_bar'] = create_navigation_bar(
duplicate_index_url(array(), array('start')),
Expand Down Expand Up @@ -99,7 +99,7 @@
$template->set_filenames( array('index'=>'index.tpl') );
//-------------------------------------------------------------- category title
$template_title = $page['title'];
if ( count($page['items']) > 0)
if (count($page['items']) > 0)
{
$template_title.= ' ['.count($page['items']).']';
}
Expand Down Expand Up @@ -192,7 +192,7 @@
);
}

if (is_admin() and !empty($page['items']) )
if (is_admin() and !empty($page['items']))
{
$template->assign_block_vars(
'caddie',
Expand Down Expand Up @@ -262,6 +262,21 @@
}
//------------------------------------------------------- category informations

// slideshow
// execute after init thumbs in order to have all picture informations
if (!empty($page['cat_slideshow_url']))
{
if (isset($_GET['slideshow']))
{
redirect($page['cat_slideshow_url']);
}
else
{
$template->assign_block_vars(
'slideshow', array('URL' => $page['cat_slideshow_url']));
}
}

// navigation bar
if ($page['navigation_bar'] != '')
{
Expand Down
51 changes: 51 additions & 0 deletions install/db/67-database.php
@@ -0,0 +1,51 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
// +-----------------------------------------------------------------------+
// | 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 = 'Uninstall dew plugin';

include_once(PHPWG_ROOT_PATH.'include/constants.php');

// +-----------------------------------------------------------------------+
// | Upgrade content |
// +-----------------------------------------------------------------------+

$query = "
delete from ".PLUGINS_TABLE." where id ='dew';
";
pwg_query($query);

echo
"\n"
.'"'.$upgrade_description.'"'.' ended'
."\n"
;

?>
8 changes: 7 additions & 1 deletion language/en_UK/common.lang.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -382,5 +382,11 @@
$lang['Category results for'] = 'Category results for';
$lang['Tag results for'] = 'Tag results for';
$lang['from %s to %s'] = 'from %s to %s';
$lang['start_play'] = 'Play of slideshow';
$lang['stop_play'] = 'Pause of slideshow';
$lang['start_repeat'] = 'Repeat the slideshow';
$lang['stop_repeat'] = 'Not repeat the slideshow';
$lang['inc_period'] = 'Increase waiting between pictures';
$lang['dec_period'] = 'Decrease waiting between pictures';

?>
9 changes: 8 additions & 1 deletion language/es_ES/common.lang.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $ $
// | last update : $2007-10-12 (ven., 12 oct. 2007)) $
Expand Down Expand Up @@ -381,4 +381,11 @@
$lang['Category results for'] = 'Los resultados de las categorías para';
$lang['Tag results for'] = 'Los resultados de los tags para';
$lang['from %s to %s'] = 'de %s a %s';
/* TODO */ $lang['start_play'] = 'Play of slideshow';
/* TODO */ $lang['stop_play'] = 'Pause of slideshow';
/* TODO */ $lang['start_repeat'] = 'Repeat the slideshow';
/* TODO */ $lang['stop_repeat'] = 'Not repeat the slideshow';
/* TODO */ $lang['inc_period'] = 'Increase waiting between pictures';
/* TODO */ $lang['dec_period'] = 'Decrease waiting between pictures';

?>
8 changes: 7 additions & 1 deletion language/fr_FR/common.lang.php
Expand Up @@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
Expand Down Expand Up @@ -381,5 +381,11 @@
$lang['Category results for'] = 'Résultats des catégories pour';
$lang['Tag results for'] = 'Résultats des tags pour';
$lang['from %s to %s'] = 'de %s à %s';
$lang['start_play'] = 'Lecture du diaporama';
$lang['stop_play'] = 'Pause du diaporama';
$lang['start_repeat'] = 'Répeter le diaporama';
$lang['stop_repeat'] = 'Ne pas répeter le diaporama';
$lang['inc_period'] = 'Augmenter l\'attente entre les images';
$lang['dec_period'] = 'Diminuer l\'attente entre les images';

?>

0 comments on commit bf40122

Please sign in to comment.