From: Andreas Unterkircher Date: Sun, 22 Jul 2007 07:31:40 +0000 (+0000) Subject: issue46, slideshow control (rew, pause/play/stop, fwd) X-Git-Tag: phpfspot-1.2~96 X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=a36bd6f4555cf410712611b5efcb82fdf5898551 issue46, slideshow control (rew, pause/play/stop, fwd) git-svn-id: file:///var/lib/svn/phpfspot/trunk@239 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- diff --git a/phpfspot.class.php b/phpfspot.class.php index 825f92d..2a28135 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -105,6 +105,7 @@ class PHPFSPOT { $this->tmpl->assign('searchfor', $_SESSION['searchfor']); $this->tmpl->assign('page_title', $this->cfg->page_title); $this->tmpl->assign('current_condition', $_SESSION['tag_condition']); + $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name); $_SESSION['start_action'] = $_GET['mode']; @@ -150,7 +151,6 @@ class PHPFSPOT { $this->tmpl->assign('to_date', $this->get_calendar('to')); $this->tmpl->assign('sort_field', $this->get_sort_field()); $this->tmpl->assign('content_page', 'welcome.tpl'); - $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name); $this->tmpl->show("index.tpl"); @@ -1666,6 +1666,12 @@ class PHPFSPOT { } // get_sort_order() + /*** + * return the next to be shown slide show image + * + * this function returns the URL of the next image + * in the slideshow sequence. + */ public function getNextSlideShowImage() { $all_photos = $this->getPhotoSelection(); @@ -1683,6 +1689,29 @@ class PHPFSPOT { } // getNextSlideShowImage() + /*** + * return the previous to be shown slide show image + * + * this function returns the URL of the previous image + * in the slideshow sequence. + */ + public function getPrevSlideShowImage() + { + $all_photos = $this->getPhotoSelection(); + + if(!isset($_SESSION['slideshow_img']) || $_SESSION['slideshow_img'] == 0) + $_SESSION['slideshow_img'] = 0; + else + $_SESSION['slideshow_img']--; + + $server_name = $_SERVER['SERVER_NAME']; + if(!isset($_SERVER['HTTPS'])) $protocol = "http"; + else $protocol = "https"; + + return $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width; + + } // getPrevSlideShowImage() + public function resetSlideShow() { if(isset($_SESSION['slideshow_img'])) diff --git a/phpfspot.js b/phpfspot.js index 6bc0d2c..1e074bb 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -302,9 +302,17 @@ function preloadPhotos(lbImg) { function startSlideShow() { - HTML_AJAX.grab(encodeURI('rpc.php?action=reset_slideshow')); - nextSlide(); - setInterval("nextSlide()", 3000); + if(!sliding) { + HTML_AJAX.grab(encodeURI('rpc.php?action=reset_slideshow')); + nextSlide(); + sliding = setInterval("nextSlide()", 3000); + document.getElementById('stop_ico').src = "resources/32_stop.png"; + } + else { + clearInterval(sliding); + sliding = 0; + document.getElementById('stop_ico').src = "resources/32_play.png"; + } } function nextSlide() @@ -313,6 +321,26 @@ function nextSlide() document.getElementById('slide_img').src = next_img; } +function prevSlide() +{ + prev_img = HTML_AJAX.grab(encodeURI('rpc.php?action=get_prev_slideshow_img')); + document.getElementById('slide_img').src = prev_img; +} + +function pauseSlideShow() +{ + if(!sliding_paused) { + sliding_paused = 1; + clearInterval(sliding); + document.getElementById('pause_ico').src = "resources/32_play.png"; + } + else { + sliding_paused = 0; + sliding = setInterval("nextSlide()", 3000); + document.getElementById('pause_ico').src = "resources/32_pause.png"; + } +} + function startAutoBrowse() { if(!autobrowse) { @@ -339,3 +367,5 @@ var startup = 1; var calendar_shown = 0; var calendar_mode = ''; var autobrowse = 0; +var sliding = 0; +var sliding_paused = 0; diff --git a/resources/32_fwd.png b/resources/32_fwd.png new file mode 100644 index 0000000..128920e Binary files /dev/null and b/resources/32_fwd.png differ diff --git a/resources/32_rew.png b/resources/32_rew.png new file mode 100644 index 0000000..d94192d Binary files /dev/null and b/resources/32_rew.png differ diff --git a/resources/32_stop.png b/resources/32_stop.png new file mode 100644 index 0000000..4d88e48 Binary files /dev/null and b/resources/32_stop.png differ diff --git a/rpc.php b/rpc.php index d5a7e8f..b691bd8 100644 --- a/rpc.php +++ b/rpc.php @@ -121,6 +121,10 @@ class PHPFSPOT_RPC { case 'get_next_slideshow_img': print $fspot->getNextSlideShowImage(); break; + + case 'get_prev_slideshow_img': + print $fspot->getPrevSlideShowImage(); + break; } diff --git a/themes/default/templates/slideshow.tpl b/themes/default/templates/slideshow.tpl index bba5cd2..3d0ab27 100644 --- a/themes/default/templates/slideshow.tpl +++ b/themes/default/templates/slideshow.tpl @@ -5,5 +5,11 @@ slideshow_img +
+ + + + +
{include file="footer.tpl"}