Merge commit 'origin/master'
authorAndreas Unterkircher <unki@netshadow.at>
Sun, 25 May 2008 08:31:19 +0000 (10:31 +0200)
committerAndreas Unterkircher <unki@netshadow.at>
Sun, 25 May 2008 08:31:19 +0000 (10:31 +0200)
CHANGELOG
UPGRADE
phpfspot.class.php
phpfspot.js
themes/default/templates/export.tpl
themes/default/templates/photo_index.tpl
themes/default/templates/single_photo.tpl
themes/default/templates/slideshow.tpl

index ead95120e38288311ef56b4f37d8159f8c40a639..12cd368d934c4008ff49370ad6edec37b792e16a 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,7 +13,7 @@ phpfspot (1.5)
   * bug, file-name-search can now be combined with any other search and will no longer
     produce SQL errors.
 
- -- Andreas Unterkircher <unki@netshadow.at>  Sat, 13 Apr 2008 11:00:00 +0100
+ -- Andreas Unterkircher <unki@netshadow.at>  Sat, 25 May 2008 11:00:00 +0100
 
 phpfspot (1.4)
 
diff --git a/UPGRADE b/UPGRADE
index 89313b43ad0b37486ad43aa65be60f61b01a2dec..348d989a3eaa1a05bf2d823e1e69ac6d036dd995 100644 (file)
--- a/UPGRADE
+++ b/UPGRADE
@@ -1,12 +1,16 @@
 == Upgrading from 1.4 ==
 
  * nothing special necessary.
+ * Take a look into phpfspot_cfg.php.dist for supporting Nikon's NEF
+   format.
+ * If you want to give the new user-friendly-urls a try, checkout
+   the project website for more information.
 
 == Upgrading from 1.3 ==
 
  * nothing special necessary.
- * Take a look into phpfspot_cfg.dist for $use_lightbox and
* $use_autocomplete if you want to use the new features.
+ * Take a look into phpfspot_cfg.php.dist for $use_lightbox and
  $use_autocomplete if you want to use the new features.
 
 == Upgrading from 1.2 ==
 
index 58cda4e2f5776452aa56e07762aa107f17aa6834..b3455f014cc5450eee2b5de64975343597b6c724 100644 (file)
@@ -299,11 +299,15 @@ class PHPFSPOT {
                }
                break;
             case 'export':
-               $this->tmpl->show("export.tpl");
+               /* fetch export template */
+               print $this->tmpl->fetch("export.tpl");
+               /* no further execution necessary. */
                return;
                break;
             case 'slideshow':
-               $this->tmpl->show("slideshow.tpl");
+               /* fetch slideshow template */
+               print $this->tmpl->show("slideshow.tpl");
+               /* no further execution necessary. */
                return;
                break;
             case 'rss':
@@ -343,11 +347,21 @@ class PHPFSPOT {
       $this->tmpl->assign('preset_available_tags', $this->getAvailableTags());
       $this->tmpl->assign('rate_search', $this->get_rate_search());
 
+      /* if no site-content has been set yet... */
       if(!isset($content)) {
-         if(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags']))
+         /* if tags are already selected, we can immediately display photo-index */
+         if((isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags']) &&
+            $_SESSION['start_action'] != 'showp') || $_SESSION['start_action'] == 'showpi')
             $this->tmpl->assign('initial_content', $this->showPhotoIndex());
-         else
-            $this->tmpl->assign('initial_content', $this->tmpl->fetch('welcome.tpl'));
+         else {
+            /* if a photo is already selected, we can immediately display single-photo */
+            if(isset($_SESSION['current_photo']) && !empty($_SESSION['current_photo']))
+               $this->tmpl->assign('initial_content', $this->showPhoto($_SESSION['current_photo']));
+            else {
+               /* ok, then let us show the welcome page... */
+               $this->tmpl->assign('initial_content', $this->tmpl->fetch('welcome.tpl'));
+            }
+         }
       }
       else
          $this->tmpl->assign('initial_content', $content);
@@ -689,7 +703,7 @@ class PHPFSPOT {
       $info = getimagesize($orig_path);
 
       /* get EXIF information if JPEG */
-      if($info['mime'] == "image/jpeg") {
+      if(isset($info['mime']) && $info['mime'] == "image/jpeg") {
          $meta = $this->get_meta_informations($orig_path);
       }
 
@@ -748,15 +762,16 @@ class PHPFSPOT {
       $this->tmpl->assign('current_page', $this->getCurrentPage($current, $count));
       $this->tmpl->assign('current_img', $photo);
 
-      if($previous_img) {
+      if(isset($previous_img)) {
          $this->tmpl->assign('previous_url', "javascript:showPhoto(". $previous_img .");");
          $this->tmpl->assign('prev_img', $previous_img);
       }
 
-      if($next_img) {
+      if(isset($next_img)) {
          $this->tmpl->assign('next_url', "javascript:showPhoto(". $next_img .");");
          $this->tmpl->assign('next_img', $next_img);
       }
+
       $this->tmpl->assign('mini_width', $this->cfg->mini_width);
       $this->tmpl->assign('photo_width', $this->cfg->photo_width);
       $this->tmpl->assign('photo_number', $i);
@@ -1322,6 +1337,7 @@ class PHPFSPOT {
    public function showPhotoIndex()
    {
       $photos = $this->getPhotoSelection();
+      $current_tags = $this->getCurrentTags();
 
       $count = count($photos);
 
@@ -1479,7 +1495,6 @@ class PHPFSPOT {
             $this->tmpl->assign('page_selector', $page_select);
       }
       
-      $current_tags = $this->getCurrentTags();
       $extern_link = "index.php?mode=showpi";
       $rss_link = "index.php?mode=rss";
       if($current_tags != "") {
@@ -1575,23 +1590,25 @@ class PHPFSPOT {
             $flip_hori = false;
             $flip_vert = false;
 
-            switch($meta['Orientation']) {
-               case 1: /* top, left */
-                  /* nothing to do */ break;
-               case 2: /* top, right */
-                  $rotate = 0; $flip_hori = true; break;
-               case 3: /* bottom, left */
-                  $rotate = 180; break;
-               case 4: /* bottom, right */
-                  $flip_vert = true; break;
-               case 5: /* left side, top */
-                  $rotate = 90; $flip_vert = true; break;
-               case 6: /* right side, top */
-                  $rotate = 90; break;
-               case 7: /* left side, bottom */
-                  $rotate = 270; $flip_vert = true; break;
-               case 8: /* right side, bottom */
-                  $rotate = 270; break;
+            if(isset($meta['Orientation'])) {
+               switch($meta['Orientation']) {
+                  case 1: /* top, left */
+                     /* nothing to do */ break;
+                  case 2: /* top, right */
+                     $rotate = 0; $flip_hori = true; break;
+                  case 3: /* bottom, left */
+                     $rotate = 180; break;
+                  case 4: /* bottom, right */
+                     $flip_vert = true; break;
+                  case 5: /* left side, top */
+                     $rotate = 90; $flip_vert = true; break;
+                  case 6: /* right side, top */
+                     $rotate = 90; break;
+                  case 7: /* left side, bottom */
+                     $rotate = 270; $flip_vert = true; break;
+                  case 8: /* right side, bottom */
+                     $rotate = 270; break;
+               }
             }
 
             $src_img = @imagecreatefromjpeg($orig_image);
@@ -2291,7 +2308,7 @@ class PHPFSPOT {
 
    private function _debug($text)
    {
-      if($this->fromcmd) {
+      if(isset($this->fromcmd)) {
          print $text;
       }
 
@@ -2549,7 +2566,7 @@ class PHPFSPOT {
          $orig_path = $this->translate_path($this->parse_uri($details['uri'], 'fullpath'));
 
          /* get EXIF information if JPEG */
-         if($details['mime'] == "image/jpeg") {
+         if(isset($details['mime']) && $details['mime'] == "image/jpeg") {
             $meta = $this->get_meta_informations($orig_path);
          }
 
@@ -2579,7 +2596,10 @@ class PHPFSPOT {
 
  
    /**
-    * return all selected tags as one string
+    * get all selected tags
+    *
+    * This function will return all selected tags as one string, seperated
+    * by a comma.
     * @return array
     */
    private function getCurrentTags()
index b4e8421e045bd33147bd332ae2d2a46bd54c5da3..555e8ff47155eb9f49dd0aa971ac46a2fbb55633 100644 (file)
@@ -337,8 +337,13 @@ function datesearch()
  * called for photo-index export. will return the
  * selected mode via AJAX from the server.
  */
-function setViewMode(mode)
+function setViewMode(srv_webpath, mode)
 {
+   if(srv_webpath != undefined)
+      web_path = srv_webpath;
+   else
+      web_path = '';
+
    var exprt = document.getElementById('output');
    exprt.innerHTML = "Loading...";
    exprt.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_export&mode=' + mode));
@@ -655,17 +660,19 @@ function preloadPhotos(image_url) {
    var waiting = 100;
    var counting;
 
-   lbImg=WSR_getElementsByClassName(document,"img","thumb");
-   for(i=0;i<lbImg.length;i++){
-      lbImg[i].src=image_url[i];
-      // to not bomb the server with requests, give the page some time
-      // to load the images one by one. if a image exceeds the timeout,
-      // the next image will be loaded.
-      if(lbImg[i].complete != undefined && lbImg[i].complete != true) {
-         counting = 0;
-         while(lbImg[i].complete != true && counting < timeout) {
-            window.setTimeout("noop()", waiting);
-            counting+=waiting;
+   lbImg = WSR_getElementsByClassName(document,"img","thumb");
+   if(lbImg != undefined) {
+      for(i=0;i<lbImg.length;i++){
+         lbImg[i].src=image_url[i];
+         // to not bomb the server with requests, give the page some time
+         // to load the images one by one. if a image exceeds the timeout,
+         // the next image will be loaded.
+         if(lbImg[i].complete != undefined && lbImg[i].complete != true) {
+            counting = 0;
+            while(lbImg[i].complete != true && counting < timeout) {
+               window.setTimeout("noop()", waiting);
+               counting+=waiting;
+            }
          }
       }
    }
@@ -678,8 +685,13 @@ function noop() {}
 /**
  * start slideshow
  */
-function startSlideShow()
+function startSlideShow(srv_webpath)
 {
+   if(srv_webpath != undefined)
+      web_path = srv_webpath;
+   else
+      web_path = '';
+
    if(!sliding) {
       HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=reset_slideshow'));
       nextSlide();
@@ -744,7 +756,7 @@ function startAutoBrowse()
    else {
       clearInterval(autobrowse);
       autobrowse = 0;
-      document.getElementById('autobrowse_ico').src = web_path + "/resources/32_play.png";
+      document.getElementById('autobrowse_ico').src = web_path + "/resources/16_play.png";
    }
 
 } // startAutoBrowser()
index 7f6f2de9ec0a00a3368ce4dbb08a2cf042cf84ad..d7443de0371291d3505adcf30c017c2b114356f7 100644 (file)
@@ -1,7 +1,7 @@
 {include file="header.tpl"}
  <body>
   <div id="frame">
-  <form action="javascript:#" onsubmit="setViewMode(document.getElementsByName('format')[0].options[document.getElementsByName('format')[0].selectedIndex].value); return false;">
+  <form action="javascript:#" onsubmit="setViewMode('{$web_path}', document.getElementsByName('format')[0].options[document.getElementsByName('format')[0].selectedIndex].value); return false;">
    <select name="format">
     <option value="HTML">HTML</option>
     <option value="MoinMoin">MoinMoin Wiki</option>
index 7fe04ab053e00c788340269aa0ab6c88b256cf55..fa63b31aa043e47886bd031394beb04482eea044 100644 (file)
 <br class="cb" />
 <script type="text/javascript" language="JavaScript">
 <!--
-   /*** image preloading ***/
+   // image preloading
+   //
+   // these few javascript lines will try to speed up loading all the photo
+   // thumbnails. An array of all photos to display will be built written
+   // by the smarty-template. The js-code will then loop through this array
+   // and invoke loading of each photo. Sadly this does not work good on all
+   // browsers.
    { counter start=-1 }
 
    var current;
index 20b59f8d6c49f9a540e27e5742bb9797f0769672..e8e326dfc96a6b777a51e1e8e53446e5eca5312f 100644 (file)
 <script type="text/javascript">
 <!--
    if(autobrowse && document.getElementById("autobrowse_ico"))
-      document.getElementById("autobrowse_ico").src = '{$web_path}/resources/32_pause.png';
+      document.getElementById("autobrowse_ico").src = '{$web_path}/resources/16_pause.png';
 
    /* lets preload to previous and the next image to speedup */
    var image_next = new Image();
index 9a8f1fe7adfca8d85e192ee8808568d29e5ad95a..1e64dbce5c60e2de778ece8f696fa757f73fffe5 100644 (file)
@@ -3,7 +3,7 @@
  <script type="text/javascript" src="{$web_path}/slider/js/timer.js"></script>
  <script type="text/javascript" src="{$web_path}/slider/js/slider.js"></script>
  <link type="text/css" rel="StyleSheet" href="{$web_path}/slider/css/bluecurve/bluecurve.css" />
- <body onload="startSlideShow();" class="slideshow">
+ <body onload="startSlideShow('{$web_path}');" class="slideshow">
   <div id="slide_navigation">
    <a href="javascript:prevSlide();" onclick="click(this);" title="slive to previous photo"><img id="rew_ico" src="{$web_path}/resources/32_rew.png" /></a>
    <a href="javascript:pauseSlideShow();" onclick="click(this);"><img id="pause_ico" src="{$web_path}/resources/32_pause.png" /></a>