Fossil SCM

Reenable the "Tags" menu item, but make it go to the new "taglist" page. Also add separate "tagtimeline" page and separate "brlist" into "brlist" and "brtimeline".

drh 2009-01-22 13:08 trunk
Commit a12cb216b74d859beb0e1e1b4de10e87694b4769
+48 -38
--- src/branch.c
+++ src/branch.c
@@ -212,18 +212,61 @@
212212
}else{
213213
fossil_panic("branch subcommand should be one of: "
214214
"new list");
215215
}
216216
}
217
+
218
+/*
219
+** WEBPAGE: brlist
220
+**
221
+** Show a timeline of all branches
222
+*/
223
+void brlist_page(void){
224
+ Stmt q;
225
+
226
+ login_check_credentials();
227
+ if( !g.okRead ){ login_needed(); return; }
228
+
229
+ style_header("Branches");
230
+ style_submenu_element("Timeline", "Timeline", "brtimeline");
231
+ login_anonymous_available();
232
+ @ <h2>Branches:</h2>
233
+ @ <ul>
234
+ db_prepare(&q,
235
+ "SELECT DISTINCT value FROM tagxref"
236
+ " WHERE tagid=%d AND srcid!=0 AND value NOT NULL"
237
+ " ORDER BY value",
238
+ TAG_BRANCH
239
+ );
240
+ while( db_step(&q)==SQLITE_ROW ){
241
+ const char *zBr = db_column_text(&q, 0);
242
+ if( g.okHistory ){
243
+ @ <li><a href="%s(g.zBaseURL)/timeline?t=%T(zBr)">%h(zBr)</a></li>
244
+ }else{
245
+ @ <li><b>%h(zBr)</b></li>
246
+ }
247
+ }
248
+ db_finalize(&q);
249
+ @ </ul>
250
+ @ <br clear="both">
251
+ @ <script>
252
+ @ function xin(id){
253
+ @ }
254
+ @ function xout(id){
255
+ @ }
256
+ @ </script>
257
+ style_footer();
258
+}
217259
218260
/*
219261
** This routine is called while for each check-in that is rendered by
220262
** the timeline of a "brlist" page. Add some additional hyperlinks
221263
** to the end of the line.
222264
*/
223
-static void brlist_extra(int rid){
265
+static void brtimeline_extra(int rid){
224266
Stmt q;
267
+ if( !g.okHistory ) return;
225268
db_prepare(&q,
226269
"SELECT substr(tagname,5) FROM tagxref, tag"
227270
" WHERE tagxref.rid=%d"
228271
" AND tagxref.tagid=tag.tagid"
229272
" AND tagxref.tagtype>0"
@@ -236,64 +279,31 @@
236279
}
237280
db_finalize(&q);
238281
}
239282
240283
/*
241
-** WEBPAGE: brlist
284
+** WEBPAGE: brtimeline
242285
**
243286
** Show a timeline of all branches
244287
*/
245
-void brlist_page(void){
288
+void brtimeline_page(void){
246289
Stmt q;
247290
248291
login_check_credentials();
249292
if( !g.okRead ){ login_needed(); return; }
250293
251294
style_header("Branches");
295
+ style_submenu_element("List", "List", "brlist");
252296
login_anonymous_available();
253297
@ <h2>The initial check-in for each branch:</h2>
254298
db_prepare(&q,
255299
"%s AND blob.rid IN (SELECT rid FROM tagxref"
256300
" WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
257301
" ORDER BY event.mtime DESC",
258302
timeline_query_for_www(), TAG_BRANCH
259303
);
260
- www_print_timeline(&q, 0, brlist_extra);
261
- db_finalize(&q);
262
- @ <br clear="both">
263
- @ <script>
264
- @ function xin(id){
265
- @ }
266
- @ function xout(id){
267
- @ }
268
- @ </script>
269
- style_footer();
270
-}
271
-
272
-/*
273
-** WEBPAGE: symtaglist
274
-**
275
-** Show a timeline of all check-ins that have a primary symbolic tag.
276
-*/
277
-void symtaglist_page(void){
278
- Stmt q;
279
-
280
- login_check_credentials();
281
- if( !g.okRead ){ login_needed(); return; }
282
-
283
- style_header("Tagged Check-ins");
284
- login_anonymous_available();
285
- @ <h2>Check-ins that have one or more primary symbolic tags</h2>
286
- db_prepare(&q,
287
- "%s AND blob.rid IN (SELECT rid FROM tagxref"
288
- " WHERE tagtype>1 AND srcid>0"
289
- " AND tagid IN (SELECT tagid FROM tag "
290
- " WHERE tagname GLOB 'sym-*'))"
291
- " ORDER BY event.mtime DESC",
292
- timeline_query_for_www()
293
- );
294
- www_print_timeline(&q, 0, 0);
304
+ www_print_timeline(&q, 0, brtimeline_extra);
295305
db_finalize(&q);
296306
@ <br clear="both">
297307
@ <script>
298308
@ function xin(id){
299309
@ }
300310
--- src/branch.c
+++ src/branch.c
@@ -212,18 +212,61 @@
212 }else{
213 fossil_panic("branch subcommand should be one of: "
214 "new list");
215 }
216 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
218 /*
219 ** This routine is called while for each check-in that is rendered by
220 ** the timeline of a "brlist" page. Add some additional hyperlinks
221 ** to the end of the line.
222 */
223 static void brlist_extra(int rid){
224 Stmt q;
 
225 db_prepare(&q,
226 "SELECT substr(tagname,5) FROM tagxref, tag"
227 " WHERE tagxref.rid=%d"
228 " AND tagxref.tagid=tag.tagid"
229 " AND tagxref.tagtype>0"
@@ -236,64 +279,31 @@
236 }
237 db_finalize(&q);
238 }
239
240 /*
241 ** WEBPAGE: brlist
242 **
243 ** Show a timeline of all branches
244 */
245 void brlist_page(void){
246 Stmt q;
247
248 login_check_credentials();
249 if( !g.okRead ){ login_needed(); return; }
250
251 style_header("Branches");
 
252 login_anonymous_available();
253 @ <h2>The initial check-in for each branch:</h2>
254 db_prepare(&q,
255 "%s AND blob.rid IN (SELECT rid FROM tagxref"
256 " WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
257 " ORDER BY event.mtime DESC",
258 timeline_query_for_www(), TAG_BRANCH
259 );
260 www_print_timeline(&q, 0, brlist_extra);
261 db_finalize(&q);
262 @ <br clear="both">
263 @ <script>
264 @ function xin(id){
265 @ }
266 @ function xout(id){
267 @ }
268 @ </script>
269 style_footer();
270 }
271
272 /*
273 ** WEBPAGE: symtaglist
274 **
275 ** Show a timeline of all check-ins that have a primary symbolic tag.
276 */
277 void symtaglist_page(void){
278 Stmt q;
279
280 login_check_credentials();
281 if( !g.okRead ){ login_needed(); return; }
282
283 style_header("Tagged Check-ins");
284 login_anonymous_available();
285 @ <h2>Check-ins that have one or more primary symbolic tags</h2>
286 db_prepare(&q,
287 "%s AND blob.rid IN (SELECT rid FROM tagxref"
288 " WHERE tagtype>1 AND srcid>0"
289 " AND tagid IN (SELECT tagid FROM tag "
290 " WHERE tagname GLOB 'sym-*'))"
291 " ORDER BY event.mtime DESC",
292 timeline_query_for_www()
293 );
294 www_print_timeline(&q, 0, 0);
295 db_finalize(&q);
296 @ <br clear="both">
297 @ <script>
298 @ function xin(id){
299 @ }
300
--- src/branch.c
+++ src/branch.c
@@ -212,18 +212,61 @@
212 }else{
213 fossil_panic("branch subcommand should be one of: "
214 "new list");
215 }
216 }
217
218 /*
219 ** WEBPAGE: brlist
220 **
221 ** Show a timeline of all branches
222 */
223 void brlist_page(void){
224 Stmt q;
225
226 login_check_credentials();
227 if( !g.okRead ){ login_needed(); return; }
228
229 style_header("Branches");
230 style_submenu_element("Timeline", "Timeline", "brtimeline");
231 login_anonymous_available();
232 @ <h2>Branches:</h2>
233 @ <ul>
234 db_prepare(&q,
235 "SELECT DISTINCT value FROM tagxref"
236 " WHERE tagid=%d AND srcid!=0 AND value NOT NULL"
237 " ORDER BY value",
238 TAG_BRANCH
239 );
240 while( db_step(&q)==SQLITE_ROW ){
241 const char *zBr = db_column_text(&q, 0);
242 if( g.okHistory ){
243 @ <li><a href="%s(g.zBaseURL)/timeline?t=%T(zBr)">%h(zBr)</a></li>
244 }else{
245 @ <li><b>%h(zBr)</b></li>
246 }
247 }
248 db_finalize(&q);
249 @ </ul>
250 @ <br clear="both">
251 @ <script>
252 @ function xin(id){
253 @ }
254 @ function xout(id){
255 @ }
256 @ </script>
257 style_footer();
258 }
259
260 /*
261 ** This routine is called while for each check-in that is rendered by
262 ** the timeline of a "brlist" page. Add some additional hyperlinks
263 ** to the end of the line.
264 */
265 static void brtimeline_extra(int rid){
266 Stmt q;
267 if( !g.okHistory ) return;
268 db_prepare(&q,
269 "SELECT substr(tagname,5) FROM tagxref, tag"
270 " WHERE tagxref.rid=%d"
271 " AND tagxref.tagid=tag.tagid"
272 " AND tagxref.tagtype>0"
@@ -236,64 +279,31 @@
279 }
280 db_finalize(&q);
281 }
282
283 /*
284 ** WEBPAGE: brtimeline
285 **
286 ** Show a timeline of all branches
287 */
288 void brtimeline_page(void){
289 Stmt q;
290
291 login_check_credentials();
292 if( !g.okRead ){ login_needed(); return; }
293
294 style_header("Branches");
295 style_submenu_element("List", "List", "brlist");
296 login_anonymous_available();
297 @ <h2>The initial check-in for each branch:</h2>
298 db_prepare(&q,
299 "%s AND blob.rid IN (SELECT rid FROM tagxref"
300 " WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
301 " ORDER BY event.mtime DESC",
302 timeline_query_for_www(), TAG_BRANCH
303 );
304 www_print_timeline(&q, 0, brtimeline_extra);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305 db_finalize(&q);
306 @ <br clear="both">
307 @ <script>
308 @ function xin(id){
309 @ }
310
-1
--- src/info.c
+++ src/info.c
@@ -1105,11 +1105,10 @@
11051105
zName = blob_str(&uuid);
11061106
break;
11071107
}
11081108
case 2: {
11091109
/* go somewhere to show the multiple UUIDs */
1110
- tagview_page();
11111110
return;
11121111
break;
11131112
}
11141113
default: {
11151114
fossil_redirect_home();
11161115
--- src/info.c
+++ src/info.c
@@ -1105,11 +1105,10 @@
1105 zName = blob_str(&uuid);
1106 break;
1107 }
1108 case 2: {
1109 /* go somewhere to show the multiple UUIDs */
1110 tagview_page();
1111 return;
1112 break;
1113 }
1114 default: {
1115 fossil_redirect_home();
1116
--- src/info.c
+++ src/info.c
@@ -1105,11 +1105,10 @@
1105 zName = blob_str(&uuid);
1106 break;
1107 }
1108 case 2: {
1109 /* go somewhere to show the multiple UUIDs */
 
1110 return;
1111 break;
1112 }
1113 default: {
1114 fossil_redirect_home();
1115
--- src/style.c
+++ src/style.c
@@ -194,10 +194,11 @@
194194
@ }
195195
@ if {[hascap o]} {
196196
@ html "<a href='$baseurl/leaves'>Leaves</a>"
197197
@ html "<a href='$baseurl/timeline'>Timeline</a>"
198198
@ html "<a href='$baseurl/brlist'>Branches</a>"
199
+@ html "<a href='$baseurl/taglist'>Tags</a>"
199200
@ }
200201
@ if {[hascap r]} {
201202
@ html "<a href='$baseurl/reportlist'>Bugs</a>"
202203
@ }
203204
@ if {[hascap j]} {
204205
--- src/style.c
+++ src/style.c
@@ -194,10 +194,11 @@
194 @ }
195 @ if {[hascap o]} {
196 @ html "<a href='$baseurl/leaves'>Leaves</a>"
197 @ html "<a href='$baseurl/timeline'>Timeline</a>"
198 @ html "<a href='$baseurl/brlist'>Branches</a>"
 
199 @ }
200 @ if {[hascap r]} {
201 @ html "<a href='$baseurl/reportlist'>Bugs</a>"
202 @ }
203 @ if {[hascap j]} {
204
--- src/style.c
+++ src/style.c
@@ -194,10 +194,11 @@
194 @ }
195 @ if {[hascap o]} {
196 @ html "<a href='$baseurl/leaves'>Leaves</a>"
197 @ html "<a href='$baseurl/timeline'>Timeline</a>"
198 @ html "<a href='$baseurl/brlist'>Branches</a>"
199 @ html "<a href='$baseurl/taglist'>Tags</a>"
200 @ }
201 @ if {[hascap r]} {
202 @ html "<a href='$baseurl/reportlist'>Bugs</a>"
203 @ }
204 @ if {[hascap j]} {
205
+95
--- src/tag.c
+++ src/tag.c
@@ -480,5 +480,100 @@
480480
return;
481481
482482
tag_cmd_usage:
483483
usage("add|cancel|find|list ...");
484484
}
485
+
486
+/*
487
+** WEBPAGE: /taglist
488
+*/
489
+void taglist_page(void){
490
+ Stmt q;
491
+
492
+ login_check_credentials();
493
+ if( !g.okRead ){
494
+ login_needed();
495
+ }
496
+ style_header("Tags");
497
+ style_submenu_element("Timeline", "Timeline", "tagtimeline");
498
+ @ <h2>Tags used by one or more check-ins:</h2>
499
+ db_prepare(&q,
500
+ "SELECT substr(tagname,5)"
501
+ " FROM tag"
502
+ " WHERE EXISTS(SELECT 1 FROM tagxref"
503
+ " WHERE tagid=tag.tagid"
504
+ " AND tagtype>0)"
505
+ " AND tagname GLOB 'sym-*'"
506
+ " ORDER BY tagname"
507
+ );
508
+ @ <ul>
509
+ while( db_step(&q)==SQLITE_ROW ){
510
+ const char *zName = db_column_text(&q, 0);
511
+ if( g.okHistory ){
512
+ @ <li><a href=%s(g.zBaseURL)/timeline?t=%T(zName)>%h(zName)</a></li>
513
+ }else{
514
+ @ <li><strong>%h(zName)</strong></li>
515
+ }
516
+ }
517
+ @ </ul>
518
+ db_finalize(&q);
519
+ style_footer();
520
+}
521
+
522
+/*
523
+** Draw the names of all tags added to check-in rid. Only tags
524
+** that are directly applied to rid are named. Propagated tags
525
+** are omitted.
526
+*/
527
+static void tagtimeline_extra(int rid){
528
+ Stmt q;
529
+ db_prepare(&q,
530
+ "SELECT substr(tagname,5) FROM tagxref, tag"
531
+ " WHERE tagxref.rid=%d"
532
+ " AND tagxref.tagid=tag.tagid"
533
+ " AND tagxref.tagtype>0 AND tagxref.srcid>0"
534
+ " AND tag.tagname GLOB 'sym-*'",
535
+ rid
536
+ );
537
+ while( db_step(&q)==SQLITE_ROW ){
538
+ const char *zTagName = db_column_text(&q, 0);
539
+ if( g.okHistory ){
540
+ @ <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">[%h(zTagName)]</a>
541
+ }else{
542
+ @ <b>[%h(zTagName)]</b>
543
+ }
544
+ }
545
+ db_finalize(&q);
546
+}
547
+
548
+/*
549
+** WEBPAGE: /tagtimeline
550
+*/
551
+void tagtimeline_page(void){
552
+ Stmt q;
553
+
554
+ login_check_credentials();
555
+ if( !g.okRead ){ login_needed(); return; }
556
+
557
+ style_header("Tagged Check-ins");
558
+ style_submenu_element("List", "List", "taglist");
559
+ login_anonymous_available();
560
+ @ <h2>Initial check-ins for each tag:</t2>
561
+ db_prepare(&q,
562
+ "%s AND blob.rid IN (SELECT rid FROM tagxref"
563
+ " WHERE tagtype>0 AND srcid>0"
564
+ " AND tagid IN (SELECT tagid FROM tag "
565
+ " WHERE tagname GLOB 'sym-*'))"
566
+ " ORDER BY event.mtime DESC",
567
+ timeline_query_for_www()
568
+ );
569
+ www_print_timeline(&q, 0, tagtimeline_extra);
570
+ db_finalize(&q);
571
+ @ <br clear="both">
572
+ @ <script>
573
+ @ function xin(id){
574
+ @ }
575
+ @ function xout(id){
576
+ @ }
577
+ @ </script>
578
+ style_footer();
579
+}
485580
--- src/tag.c
+++ src/tag.c
@@ -480,5 +480,100 @@
480 return;
481
482 tag_cmd_usage:
483 usage("add|cancel|find|list ...");
484 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
--- src/tag.c
+++ src/tag.c
@@ -480,5 +480,100 @@
480 return;
481
482 tag_cmd_usage:
483 usage("add|cancel|find|list ...");
484 }
485
486 /*
487 ** WEBPAGE: /taglist
488 */
489 void taglist_page(void){
490 Stmt q;
491
492 login_check_credentials();
493 if( !g.okRead ){
494 login_needed();
495 }
496 style_header("Tags");
497 style_submenu_element("Timeline", "Timeline", "tagtimeline");
498 @ <h2>Tags used by one or more check-ins:</h2>
499 db_prepare(&q,
500 "SELECT substr(tagname,5)"
501 " FROM tag"
502 " WHERE EXISTS(SELECT 1 FROM tagxref"
503 " WHERE tagid=tag.tagid"
504 " AND tagtype>0)"
505 " AND tagname GLOB 'sym-*'"
506 " ORDER BY tagname"
507 );
508 @ <ul>
509 while( db_step(&q)==SQLITE_ROW ){
510 const char *zName = db_column_text(&q, 0);
511 if( g.okHistory ){
512 @ <li><a href=%s(g.zBaseURL)/timeline?t=%T(zName)>%h(zName)</a></li>
513 }else{
514 @ <li><strong>%h(zName)</strong></li>
515 }
516 }
517 @ </ul>
518 db_finalize(&q);
519 style_footer();
520 }
521
522 /*
523 ** Draw the names of all tags added to check-in rid. Only tags
524 ** that are directly applied to rid are named. Propagated tags
525 ** are omitted.
526 */
527 static void tagtimeline_extra(int rid){
528 Stmt q;
529 db_prepare(&q,
530 "SELECT substr(tagname,5) FROM tagxref, tag"
531 " WHERE tagxref.rid=%d"
532 " AND tagxref.tagid=tag.tagid"
533 " AND tagxref.tagtype>0 AND tagxref.srcid>0"
534 " AND tag.tagname GLOB 'sym-*'",
535 rid
536 );
537 while( db_step(&q)==SQLITE_ROW ){
538 const char *zTagName = db_column_text(&q, 0);
539 if( g.okHistory ){
540 @ <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">[%h(zTagName)]</a>
541 }else{
542 @ <b>[%h(zTagName)]</b>
543 }
544 }
545 db_finalize(&q);
546 }
547
548 /*
549 ** WEBPAGE: /tagtimeline
550 */
551 void tagtimeline_page(void){
552 Stmt q;
553
554 login_check_credentials();
555 if( !g.okRead ){ login_needed(); return; }
556
557 style_header("Tagged Check-ins");
558 style_submenu_element("List", "List", "taglist");
559 login_anonymous_available();
560 @ <h2>Initial check-ins for each tag:</t2>
561 db_prepare(&q,
562 "%s AND blob.rid IN (SELECT rid FROM tagxref"
563 " WHERE tagtype>0 AND srcid>0"
564 " AND tagid IN (SELECT tagid FROM tag "
565 " WHERE tagname GLOB 'sym-*'))"
566 " ORDER BY event.mtime DESC",
567 timeline_query_for_www()
568 );
569 www_print_timeline(&q, 0, tagtimeline_extra);
570 db_finalize(&q);
571 @ <br clear="both">
572 @ <script>
573 @ function xin(id){
574 @ }
575 @ function xout(id){
576 @ }
577 @ </script>
578 style_footer();
579 }
580
+4 -1
--- src/tagview.c
+++ src/tagview.c
@@ -27,10 +27,11 @@
2727
*/
2828
#include <assert.h>
2929
#include "config.h"
3030
#include "tagview.h"
3131
32
+#if 0 /* DISABLED */
3233
3334
#if 0
3435
# define TAGVIEW_DEFAULT_FILTER "AND t.tagname NOT GLOB 'wiki-*' "
3536
#else
3637
# define TAGVIEW_DEFAULT_FILTER
@@ -188,11 +189,11 @@
188189
www_print_timeline(&q, 0, 0);
189190
db_finalize(&q);
190191
}
191192
192193
/*
193
-** WEBPAGE: /tagview
194
+** WEB PAGE: /tagview
194195
*/
195196
void tagview_page(void){
196197
char const *zName = 0;
197198
char const *zTitle = 0;
198199
int nTag = 0;
@@ -285,5 +286,7 @@
285286
@ }
286287
@ </script>
287288
288289
style_footer();
289290
}
291
+
292
+#endif /* DISABLED */
290293
--- src/tagview.c
+++ src/tagview.c
@@ -27,10 +27,11 @@
27 */
28 #include <assert.h>
29 #include "config.h"
30 #include "tagview.h"
31
 
32
33 #if 0
34 # define TAGVIEW_DEFAULT_FILTER "AND t.tagname NOT GLOB 'wiki-*' "
35 #else
36 # define TAGVIEW_DEFAULT_FILTER
@@ -188,11 +189,11 @@
188 www_print_timeline(&q, 0, 0);
189 db_finalize(&q);
190 }
191
192 /*
193 ** WEBPAGE: /tagview
194 */
195 void tagview_page(void){
196 char const *zName = 0;
197 char const *zTitle = 0;
198 int nTag = 0;
@@ -285,5 +286,7 @@
285 @ }
286 @ </script>
287
288 style_footer();
289 }
 
 
290
--- src/tagview.c
+++ src/tagview.c
@@ -27,10 +27,11 @@
27 */
28 #include <assert.h>
29 #include "config.h"
30 #include "tagview.h"
31
32 #if 0 /* DISABLED */
33
34 #if 0
35 # define TAGVIEW_DEFAULT_FILTER "AND t.tagname NOT GLOB 'wiki-*' "
36 #else
37 # define TAGVIEW_DEFAULT_FILTER
@@ -188,11 +189,11 @@
189 www_print_timeline(&q, 0, 0);
190 db_finalize(&q);
191 }
192
193 /*
194 ** WEB PAGE: /tagview
195 */
196 void tagview_page(void){
197 char const *zName = 0;
198 char const *zTitle = 0;
199 int nTag = 0;
@@ -285,5 +286,7 @@
286 @ }
287 @ </script>
288
289 style_footer();
290 }
291
292 #endif /* DISABLED */
293

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button