From: Andreas Unterkircher Date: Fri, 20 Jul 2007 17:59:03 +0000 (+0000) Subject: issue46, first slideshow implementation X-Git-Tag: phpfspot-1.2~110 X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=005562e4a4fb2b37fc6f1d4a8ca4a9c11ab42ed1;ds=inline issue46, first slideshow implementation git-svn-id: file:///var/lib/svn/phpfspot/trunk@225 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- diff --git a/phpfspot.class.php b/phpfspot.class.php index 2c3170c..25d144c 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -135,6 +135,10 @@ class PHPFSPOT { $this->tmpl->show("export.tpl"); return; break; + case 'slideshow': + $this->tmpl->show("slideshow.tpl"); + return; + break; } $this->tmpl->assign('from_date', $this->get_calendar('from')); @@ -865,8 +869,10 @@ class PHPFSPOT { } $export_link = "index.php?mode=export"; + $slideshow_link = "index.php?mode=slideshow"; $this->tmpl->assign('extern_link', $extern_link); + $this->tmpl->assign('slideshow_link', $slideshow_link); $this->tmpl->assign('export_link', $export_link); $this->tmpl->assign('count', $count); $this->tmpl->assign('width', $this->cfg->thumb_width); @@ -1651,6 +1657,29 @@ class PHPFSPOT { } } // get_sort_order() + + public function getNextSlideShowImage() + { + $all_photos = $this->getPhotoSelection(); + + if(!isset($_SESSION['slideshow_img']) || $_SESSION['slideshow_img'] == count($all_photos)-1) + $_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; + + } // getNextSlideShowImage() + + public function resetSlideShow() + { + if(isset($_SESSION['slideshow_img'])) + unset($_SESSION['slideshow_img']); + } // resetSlideShow() } ?> diff --git a/phpfspot.js b/phpfspot.js index dff8da9..9e1a932 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -300,6 +300,19 @@ function preloadPhotos(lbImg) { } } +function startSlideShow() +{ + HTML_AJAX.grab(encodeURI('rpc.php?action=reset_slideshow')); + nextSlide(); +} + +function nextSlide() +{ + next_img = HTML_AJAX.grab(encodeURI('rpc.php?action=get_next_slideshow_img')); + document.getElementById('slide_img').src = next_img; + setTimeout("nextSlide()", 3000); +} + var startup = 1; var calendar_shown = 0; var calendar_mode = ''; diff --git a/rpc.php b/rpc.php index 937f432..d7dafce 100644 --- a/rpc.php +++ b/rpc.php @@ -112,6 +112,14 @@ class PHPFSPOT_RPC { print $fspot->whatToDo(); break; + case 'reset_slideshow': + print $fspot->resetSlideShow(); + break; + + case 'get_next_slideshow_img': + print $fspot->getNextSlideShowImage(); + break; + } } // process_ajax_request(); diff --git a/templates/photo_index.tpl b/templates/photo_index.tpl index 1590f85..bc7e5d1 100644 --- a/templates/photo_index.tpl +++ b/templates/photo_index.tpl @@ -30,6 +30,9 @@ {/if} + {if $slideshow_link } + Slideshow + {/if} {if $extern_link } {/if} diff --git a/templates/slideshow.tpl b/templates/slideshow.tpl new file mode 100644 index 0000000..a41a018 --- /dev/null +++ b/templates/slideshow.tpl @@ -0,0 +1,13 @@ +{include file="header.tpl"} + +
+ + + + +
+ slideshow_img +
+
+ +{include file="footer.tpl"}