Diff
Not logged in

Differences From:

File src/tagview.c part of check-in [5fb14b9a0f] - Include non-sym- tags in tagview web page. Also merge mainline into tagview branch. by eric on 2008-08-21 20:59:01. [view]

To:

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

@@ -160,8 +160,29 @@
   }
   style_footer();
 }
 
+#undef TAGVIEW_DEFAULT_FILTER
+
+/*
+** Generate a timeline for the chosen tag
+*/
+void tagview_print_timeline(char const *pName, char const *pPrefix){
+  char *zSql;
+  Stmt q;
+  zSql = mprintf("%s AND EXISTS (SELECT 1"
+         " FROM tagxref"
+         "  WHERE tagxref.rid = event.objid"
+         "  AND tagxref.tagid = (SELECT tagid FROM tag"
+         "      WHERE tagname = %Q||%Q))"
+         " ORDER BY 3 desc",
+         timeline_query_for_www(), pPrefix, pName);
+  db_prepare(&q, zSql);
+  free(zSql);
+  www_print_timeline(&q);
+  db_finalize(&q);
+}
+
 /*
 ** WEBPAGE: /tagview
 */
 void tagview_page(void){
@@ -172,41 +193,15 @@
   }
   login_anonymous_available();
   if( 0 != (zName = P("name")) ){
     Blob uuid;
-    char *zSql;
-    Stmt q;
+    style_header("Tagged Baselines");
+    @ <h2>%s(zName):</h2>
     if( sym_tag_to_uuid(zName, &uuid) > 0){
-      style_header("Tagged Baselines");
-      @ <h2>%s(zName):</h2>
-      zSql = mprintf("%s AND EXISTS (SELECT 1"
-             " FROM tagxref"
-             "  WHERE tagxref.rid = event.objid"
-             "  AND tagxref.tagid = (SELECT tagid FROM tag"
-             "      WHERE tagname = 'sym-'||%Q))"
-             " ORDER BY 3 desc",
-             timeline_query_for_www(), zName);
-      db_prepare(&q, zSql);
-      free(zSql);
-      www_print_timeline(&q);
-      db_finalize(&q);
+      tagview_print_timeline(zName, "sym-");
     }else if( tag_to_uuid(zName, &uuid, "") > 0){
-      style_header("Tagged Baselines");
-      @ <h2>%s(zName):</h2>
-      zSql = mprintf("%s AND EXISTS (SELECT 1"
-             " FROM tagxref"
-             "  WHERE tagxref.rid = event.objid"
-             "  AND tagxref.tagid = (SELECT tagid FROM tag"
-             "      WHERE tagname = %Q))"
-             " ORDER BY 3 desc",
-             timeline_query_for_www(), zName);
-      db_prepare(&q, zSql);
-      free(zSql);
-      www_print_timeline(&q);
-      db_finalize(&q);
-    }else{
-      style_header("TaggedBaselines");
-      @ <h2>%s(zName):</h2>
+      tagview_print_timeline(zName, "");
+    }else{
       @ There is no artifact with this tag.
     }
   }else{
     Stmt q;
@@ -240,6 +235,4 @@
     db_finalize(&q);
   }
   style_footer();
 }
-
-#undef TAGVIEW_DEFAULT_FILTER