issue49, fixed display header text in photo index
[phpfspot.git] / phpfspot.js
index bd2baf304a8f216aa56ad714319ec10916ad2cd0..3813d09d2a2e68f3fad544a9b1a4f28f0c87e838 100644 (file)
@@ -45,13 +45,6 @@ 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)
@@ -137,17 +130,28 @@ function clearSearch()
    document.getElementsByName('searchfor')[0].value = '';
 }
 
+function AskServerWhatToDo()
+{
+   return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
+}
+
 function init_phpfspot()
 {
    refreshAvailableTags();
 
-   if(photo = getPhotoToShow()) {
-      showImage(photo)
+   whattodo = AskServerWhatToDo();
+
+   if(whattodo == 'showpi' || whattodo == 'showpi_date') {
+      showPhotoIndex();
+   }
+   if(whattodo == 'showpi_tags') {
       refreshSelectedTags();
+      showPhotoIndex();
    }
-   else {
-      if(refreshSelectedTags()) {
-         showPhotoIndex();
+   if(whattodo == 'show_photo') {
+      if(photo = getPhotoToShow()) {
+         showImage(photo)
+         refreshSelectedTags();
       }
    }
 }