From 1bf32ff139ed565557d9c807034f8251f88636e3 Mon Sep 17 00:00:00 2001
From: Andreas Unterkircher <unki@netshadow.at>
Date: Sun, 24 Jun 2007 18:08:49 +0000
Subject: issue13, first try of external links, this time for photo index

git-svn-id: file:///var/lib/svn/phpfspot/trunk@129 fa6a889d-dae6-447d-9e79-4ba9a3039384
---
 phpfspot.class.php        | 20 +++++++++++++++++++-
 templates/photo_index.tpl |  1 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/phpfspot.class.php b/phpfspot.class.php
index 0a59d96..191e066 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -47,8 +47,19 @@ 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']);
+
+      switch($_GET['mode']) {
+         case 'showpi':
+            if(isset($_GET['tags'])) {
+               $_SESSION['selected_tags'] = split(',', $_GET['tags']);
+            }
+            break;
+      }
+
+      $this->tmpl->assign('content_page', 'welcome.tpl');
       $this->tmpl->show("index.tpl");
 
+
    } // show()
 
    private function get_tags()
@@ -418,7 +429,14 @@ class PHPFSPOT {
          if($end_with < $count)
             $this->tmpl->assign("next_url", "javascript:showPhotoIndex(". $next_start .");"); 
       }
-   
+
+      $current_tags = "";
+      foreach($_SESSION['selected_tags'] as $tag)
+         $current_tags.= $tag .",";
+      $current_tags = substr($current_tags, 0, strlen($current_tags)-1);
+      $extern_link = "http://". $_SERVER['SERVER_NAME'] ."/index.php?mode=showpi&tags=". $current_tags;
+
+      $this->tmpl->assign('extern_link', $extern_link);
       $this->tmpl->assign('count', $count);
       $this->tmpl->assign('width', $this->cfg->thumb_width);
       $this->tmpl->assign('images', $images);
diff --git a/templates/photo_index.tpl b/templates/photo_index.tpl
index 6d109d0..61f54d4 100644
--- a/templates/photo_index.tpl
+++ b/templates/photo_index.tpl
@@ -18,6 +18,7 @@
    {/if}
   </td>
   <td class="index_header" style="text-align: right;">
+   <a href="{$extern_link}">Extern</a>
    <img src="resources/photo_index.png" alt="photo index" />
   </td>
  </tr>
-- 
cgit v1.2.3-18-g5258