issue118, user-friendly-url to directly address a tag
authorAndreas Unterkircher <unki@netshadow.at>
Sun, 4 May 2008 19:46:25 +0000 (21:46 +0200)
committerAndreas Unterkircher <unki@netshadow.at>
Sun, 11 May 2008 07:14:44 +0000 (09:14 +0200)
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
CHANGELOG
phpfspot.class.php
themes/default/templates/index.tpl

index fe5117a1d6d5c0dc06774c5eea206a48f0026b86..a96c36163970f61e6cd402ff1f404185ab883e3f 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
 phpfspot (1.5)
 
 phpfspot (1.5)
 
+  * feature, user-friendly URL's (with Apache's mod_rewrite).
   * feature, display tag-selection with preview-icons in photo index.
   * feature, support for Nikon's NEF RAW photo format (via dcraw and ImageMagick).
   * feature, auto-scroll in photo index if thumbnails are out of sight.
   * feature, display tag-selection with preview-icons in photo index.
   * feature, support for Nikon's NEF RAW photo format (via dcraw and ImageMagick).
   * feature, auto-scroll in photo index if thumbnails are out of sight.
index 55bd713abedcc4f1818a3eb1a020e991ca90e480..49d0c7df071da319c16c829bbc9d5be55a101d2e 100644 (file)
@@ -314,13 +314,17 @@ class PHPFSPOT {
       $this->tmpl->assign('from_date', $this->get_calendar('from'));
       $this->tmpl->assign('to_date', $this->get_calendar('to'));
 
       $this->tmpl->assign('from_date', $this->get_calendar('from'));
       $this->tmpl->assign('to_date', $this->get_calendar('to'));
 
+      $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
+      $this->tmpl->assign('preset_available_tags', $this->getAvailableTags());
+
       if(!isset($content)) {
       if(!isset($content)) {
-         $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
-         $this->tmpl->assign('preset_available_tags', $this->getAvailableTags());
-         $this->tmpl->assign('content_page', $this->tmpl->fetch('welcome.tpl'));
+         if(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags']))
+            $this->tmpl->assign('initial_content', $this->showPhotoIndex());
+         else
+            $this->tmpl->assign('initial_content', $this->tmpl->fetch('welcome.tpl'));
       }
       else
       }
       else
-         $this->tmpl->assign('content_page', $content);
+         $this->tmpl->assign('initial_content', $content);
 
       $this->tmpl->show("index.tpl");
 
 
       $this->tmpl->show("index.tpl");
 
@@ -730,9 +734,11 @@ class PHPFSPOT {
          $b = '88';
 
          if(isset($this->tags[$key])) {
          $b = '88';
 
          if(isset($this->tags[$key])) {
-            $output.= "<a href=\"javascript:Tags('add', ". $key .");\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
+            if($this->is_user_friendly_url())
+               $output.= "<a href=\"". $this->cfg->web_path ."/tag/". $key ."\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
+            else
+               $output.= "<a href=\"". $this->cfg->web_path ."/index.php?mode=showpi\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
          }
          }
-
       }
 
       $output = substr($output, 0, strlen($output)-2);
       }
 
       $output = substr($output, 0, strlen($output)-2);
@@ -1176,6 +1182,7 @@ class PHPFSPOT {
     *
     * this function provides all the necessary information
     * for the photo index template.
     *
     * this function provides all the necessary information
     * for the photo index template.
+    * @return string
     */
    public function showPhotoIndex()
    {
     */
    public function showPhotoIndex()
    {
@@ -3122,9 +3129,8 @@ class PHPFSPOT {
                break;
             case 'tag':
                if(is_numeric($options[2])) {
                break;
             case 'tag':
                if(is_numeric($options[2])) {
-                  $_GET['mode'] = 'showpi';
-                  $_SESSION['selected_tags'] = Array($options[2]);
                   $_GET['tags'] = $options[2];
                   $_GET['tags'] = $options[2];
+                  $_SESSION['selected_tags'] = Array($options[2]);
                   return $this->showPhotoIndex();
                }
                break;
                   return $this->showPhotoIndex();
                }
                break;
index 468239a7c2dd2fe2df9554a1c68f1c50be1a737a..46effe2436f4bcd6d36ec1967543e5a97aceef00 100644 (file)
@@ -39,7 +39,7 @@
 
   <!-- content column -->
   <div id="content" class="content">
 
   <!-- content column -->
   <div id="content" class="content">
-   { $content_page }
+   { $initial_content }
   </div>
   </span>
 
   </div>
   </span>