summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2007-07-04 19:02:47 +0000
committerAndreas Unterkircher <unki@netshadow.at>2007-07-04 19:02:47 +0000
commit8f56c03f5e097d31ba940e6f97f65e0e23ae3861 (patch)
tree0624ef414512552a6fae36649696cff45e202637
parentd7790a08d8d457bf07d0277fc9fda3811faf2362 (diff)
issue13, if user jumps into from an external link, immediatley display the photo index according the tag selection provided
git-svn-id: file:///var/lib/svn/phpfspot/trunk@162 fa6a889d-dae6-447d-9e79-4ba9a3039384
-rw-r--r--phpfspot.class.php5
-rw-r--r--phpfspot.js17
-rw-r--r--templates/index.tpl2
-rw-r--r--templates/photo_index.tpl4
4 files changed, 25 insertions, 3 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 9d159ff..204c8a7 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -532,7 +532,10 @@ class PHPFSPOT {
$current_tags = substr($current_tags, 0, strlen($current_tags)-1);
}
- $extern_link = "http://". $_SERVER['SERVER_NAME'] ."/index.php?mode=showpi&tags=". $current_tags;
+ $extern_link = "http://". $_SERVER['SERVER_NAME'] ."/index.php?mode=showpi";
+ if($current_tags != "") {
+ $extern_link.= "&tags=". $current_tags;
+ }
$this->tmpl->assign('extern_link', $extern_link);
$this->tmpl->assign('count', $count);
diff --git a/phpfspot.js b/phpfspot.js
index 2d7e780..22840b7 100644
--- a/phpfspot.js
+++ b/phpfspot.js
@@ -49,6 +49,13 @@ function refreshSelectedTags()
var selected_tags = document.getElementById("selected_tags");
selected_tags.innerHTML = "Loading...";
selected_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_selected_tags'));
+
+ // if no tags are currently selected, return false from here
+ if(selected_tags.innerHTML == "")
+ return false;
+
+ return true;
+
}
function showPhotoIndex(begin_with)
@@ -113,4 +120,14 @@ function clearSearch()
document.getElementsByName('searchfor')[0].value = '';
}
+function init_phpfspot()
+{
+ refreshAvailableTags();
+
+ if(refreshSelectedTags()) {
+ showPhotoIndex();
+ }
+}
+
var startup = 1;
+
diff --git a/templates/index.tpl b/templates/index.tpl
index c00a591..3cad8ba 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -1,5 +1,5 @@
{include file="header.tpl"}
- <body onload="refreshAvailableTags(); refreshSelectedTags();">
+ <body onload="init_phpfspot();">
<div id="frame">
<table>
<tr>
diff --git a/templates/photo_index.tpl b/templates/photo_index.tpl
index ee11a4f..8111b1b 100644
--- a/templates/photo_index.tpl
+++ b/templates/photo_index.tpl
@@ -21,7 +21,9 @@
{/if}
</td>
<td class="index_header" style="text-align: right;">
- <a href="{$extern_link}">Extern</a>
+ {if $extern_link }
+ <a href="{$extern_link}">Extern</a>
+ {/if}
<img src="resources/photo_index.png" alt="photo index" />
</td>
</tr>