added some comments
authorAndreas Unterkircher <unki@netshadow.at>
Tue, 1 Jan 2008 11:55:00 +0000 (12:55 +0100)
committerAndreas Unterkircher <unki@netshadow.at>
Tue, 1 Jan 2008 11:55:00 +0000 (12:55 +0100)
display "no tags selected" when nothing is selected. otherwise it looks like a bit kind of error when empty

phpfspot.class.php
phpfspot.js
rpc.php
themes/default/templates/tags.tpl

index eaa788a10b97a9b2e1a2b032f55040340f3e31e7..edf3965d6706cfef5929b0a39a4d65144854835d 100644 (file)
@@ -523,6 +523,7 @@ class PHPFSPOT {
     */
    public function getAvailableTags()
    {
+      /* retrive tags from database */
       $this->get_tags();
 
       $output = "";
@@ -566,10 +567,10 @@ class PHPFSPOT {
          if(isset($_SESSION['selected_tags']) && in_array($key, $_SESSION['selected_tags']))
             continue;
 
-          // calculate CSS font-size
-          // find the $value in excess of $min_qty
-          // multiply by the font-size increment ($size)
-          // and add the $min_size set above
+         // calculate CSS font-size
+         // find the $value in excess of $min_qty
+         // multiply by the font-size increment ($size)
+         // and add the $min_size set above
          $size = $min_size + (($value - $min_qty) * $step);
           // uncomment if you want sizes in whole %:
          $size = ceil($size);
@@ -594,9 +595,11 @@ class PHPFSPOT {
     */
    public function getSelectedTags()
    {
+      /* retrive tags from database */
       $this->get_tags();
 
       $output = "";
+
       foreach($this->avail_tags as $tag)
       {
          // return all selected tags
@@ -605,8 +608,13 @@ class PHPFSPOT {
          }
       }
 
-      $output = substr($output, 0, strlen($output)-2);
-      print $output;
+      if($output != "") {
+         $output = substr($output, 0, strlen($output)-2);
+         return $output;
+      }
+      else {
+         return "no tags selected";
+      }
 
    } // getSelectedTags()
 
index b196a68f846dbe3222b3309ac46f4066735daedb..26e50903c63b38cb78532dfe25bc53280ced1ff9 100644 (file)
@@ -160,10 +160,12 @@ function AskServerWhatToDo()
    return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
 }
 
-function init_phpfspot()
+function init_phpfspot(mode)
 {
+   /* always load list of available tags */
    refreshAvailableTags();
 
+   /* ask the server what we are currently displaying */
    whattodo = AskServerWhatToDo();
 
    if(whattodo == 'showpi' || whattodo == 'showpi_date') {
@@ -179,7 +181,7 @@ function init_phpfspot()
          refreshSelectedTags();
       }
    }
-}
+} // init_phpfspot()
 
 function setBackGrdColor(item, color)
 {
diff --git a/rpc.php b/rpc.php
index 1f016336b4102a7f10ebad60d0acc6632665f5fa..6c94e8f72653a0e6715bd09fe0ee04519c66576e 100644 (file)
--- a/rpc.php
+++ b/rpc.php
@@ -54,11 +54,11 @@ class PHPFSPOT_RPC {
             break;
    
          case 'show_available_tags':
-            $fspot->getAvailableTags();
+            print $fspot->getAvailableTags();
             break;
 
          case 'show_selected_tags':
-            $fspot->getSelectedTags();
+            print $fspot->getSelectedTags();
             break;
 
          case 'addtag':
index 4f32ad0a9c0a37c8f2256fdbb533caa8acd2f0d4..21469d887610116bf5d9b9627020b3d9986531b0 100644 (file)
@@ -27,7 +27,7 @@
  </tr>
  <tr>
   <td class="selected_tags">
-   <div id="selected_tags"></div>
+   <div id="selected_tags">no tags selected</div>
   </td>
  </tr>
  <tr>