Diff
Not logged in

Differences From:

File src/tagview.c part of check-in [0e924820bf] - Tidy up tagview code. by eric on 2008-08-24 20:16:43. [view]

To:

File src/tagview.c part of check-in [5b87749575] - Disable tag URLs without sufficient permission, display a message when there are no tags, provide dummy Javascript functions for the tag timeline. by eric on 2008-09-06 13:09:44. Also file src/tagview.c part of check-in [8745d0d579] - Merge tagview branch into mainline by eric on 2008-09-06 13:29:29. [view]

@@ -186,8 +186,9 @@
 ** WEBPAGE: /tagview
 */
 void tagview_page(void){
   char const *zName = 0;
+  int zTcount = 0;
   login_check_credentials();
   if( !g.okRead ){
     login_needed();
   }
@@ -221,18 +222,46 @@
       MAX_INT_TAG
     );
     @ <ul>
     while( db_step(&q)==SQLITE_ROW ){
+      zTcount++;
       const char *name = db_column_text(&q, 0);
-      if( strncmp(name, prefix, preflen)==0 ){
-        @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)>
-        @ <strong>%s(name+preflen)</strong></a></li>
+      if( g.okHistory ){
+        if( strncmp(name, prefix, preflen)==0 ){
+          @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)>
+          @ %s(name+preflen)</a>
+        }else{
+          @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name)>
+          @ %s(name)</a>
+        }
       }else{
-        @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name)>
-        @ %s(name)</a></li>
+        if( strncmp(name, prefix, preflen)==0 ){
+          @ <li><strong>%s(name+preflen)</strong>
+        }else{
+          @ <li><strong>%s(name)</strong>
+        }
+      }
+      if( strncmp(name, prefix, preflen)==0 ){
+        @ (symbolic label)
       }
+      @ </li>
     }
     @ </ul>
+    if( zTcount == 0) {
+      @ There are no relevant tags.
+    }
     db_finalize(&q);
   }
+  /*
+   * Put in dummy functions since www_print_timeline has generated calls to
+   * them. Some browsers don't seem to care, but better to be safe.
+   * Actually, it would be nice to use the functions on this page, but at
+   * the moment it looks to be too difficult.
+   */
+  @ <script>
+  @ function xin(id){
+  @ }
+  @ function xout(id){
+  @ }
+  @ </script>
   style_footer();
 }