Merge branch 'devel'
[phpfspot.git] / phpfspot.class.php
index 17ec45098abd8e4085a9f219f718055bed242a58..f1b0dc64dbf53702ab52e10c15a6b698dbfb1ca2 100644 (file)
@@ -503,7 +503,8 @@ class PHPFSPOT {
       $this->tmpl->assign('image_filename', $this->parse_uri($details['uri'], 'filename'));
 
       $this->tmpl->assign('tags', $this->get_photo_tags($photo));
-      $this->tmpl->assign('current', $this->getCurrentPage($current, $count));
+      $this->tmpl->assign('current_page', $this->getCurrentPage($current, $count));
+      $this->tmpl->assign('current_img', $photo);
 
       if($previous_img) {
          $this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");");
@@ -952,9 +953,6 @@ class PHPFSPOT {
 
       $count = count($photos);
 
-      if(isset($_SESSION['begin_with']) && $_SESSION['begin_with'] != "")
-         $anchor = $_SESSION['begin_with'];
-
       /* if all thumbnails should be shown on one page */
       if(!isset($this->cfg->thumbs_per_page) || $this->cfg->thumbs_per_page == 0) {
          $begin_with = 0;
@@ -1130,8 +1128,14 @@ class PHPFSPOT {
 
       $this->tmpl->show("photo_index.tpl");
 
-      if(isset($anchor))
-         print "<script language=\"JavaScript\">self.location.hash = '#image". $anchor ."';</script>\n";
+      /* if we are returning to photo index from an photo-view,
+         scroll the window to the last shown photo-thumbnail.
+         after this, unset the last_photo session variable.
+      */
+      if(isset($_SESSION['last_photo'])) {
+         print "<script language=\"JavaScript\">moveToThumb(". $_SESSION['last_photo'] .");</script>\n";
+         unset($_SESSION['last_photo']);
+      }
 
    } // showPhotoIndex()