Fossil SCM

Add timeline query parameters 'ng', 'brbg' and 'ubg' for the Leaves web page.

florian 2018-12-24 12:11 UTC fix-timeline-view
Commit 2ac6b5077656c35ffbaaf98f86064d720a78c3184957630688357d89395b519c
1 file changed +34 -6
--- src/descendants.c
+++ src/descendants.c
@@ -454,29 +454,54 @@
454454
**
455455
** Query parameters:
456456
**
457457
** all Show all leaves
458458
** closed Show only closed leaves
459
+** ng No graph
460
+** brbg Background color by branch name
461
+** ubg Background color by user name
459462
*/
460463
void leaves_page(void){
461464
Blob sql;
462465
Stmt q;
463466
int showAll = P("all")!=0;
464467
int showClosed = P("closed")!=0;
468
+ int fNg = P("ng")!=0; /* Flag for the "ng" query parameter */
469
+ int fBrBg = P("brbg")!=0; /* Flag for the "brbg" query parameter */
470
+ int fUBg = P("ubg")!=0; /* Flag for the "ubg" query parameter */
471
+ Blob QueryParams = empty_blob; /* Concatenated query parameters */
472
+ char *zParamSep = 0; /* Query parameter separator */
473
+ int tmFlags; /* Timeline display flags */
465474
466475
login_check_credentials();
467476
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
468
-
477
+ if( fNg ){
478
+ blob_appendf(&QueryParams, "%s%s", zParamSep, "ng");
479
+ zParamSep = "&";
480
+ }
481
+ if( fBrBg ){
482
+ blob_appendf(&QueryParams, "%s%s", zParamSep, "brbg");
483
+ zParamSep = "&";
484
+ }
485
+ if( fUBg ){
486
+ blob_appendf(&QueryParams, "%s%s", zParamSep, "ubg");
487
+ zParamSep = "&";
488
+ }
469489
if( !showAll ){
470
- style_submenu_element("All", "leaves?all");
490
+ style_submenu_element("All", "leaves?all%s%s",
491
+ zParamSep, blob_str(&QueryParams));
471492
}
472493
if( !showClosed ){
473
- style_submenu_element("Closed", "leaves?closed");
494
+ style_submenu_element("Closed", "leaves?closed%s%s",
495
+ zParamSep, blob_str(&QueryParams));
474496
}
475497
if( showClosed || showAll ){
476
- style_submenu_element("Open", "leaves");
498
+ if( zParamSep ) zParamSep = "?";
499
+ style_submenu_element("Open", "leaves%s%s",
500
+ zParamSep, blob_str(&QueryParams));
477501
}
502
+ blob_reset(&QueryParams);
478503
style_header("Leaves");
479504
login_anonymous_available();
480505
timeline_ss_submenu();
481506
cookie_render();
482507
#if 0
@@ -509,12 +534,15 @@
509534
}else if( !showAll ){
510535
blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
511536
}
512537
db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
513538
blob_reset(&sql);
514
- www_print_timeline(
515
- &q, TIMELINE_LEAFONLY|TIMELINE_GRAPH|TIMELINE_NOSCROLL, 0, 0, 0, 0);
539
+ tmFlags = TIMELINE_LEAFONLY | TIMELINE_NOSCROLL;
540
+ if( fNg==0 ) tmFlags |= TIMELINE_GRAPH;
541
+ if( fBrBg ) tmFlags |= TIMELINE_BRCOLOR;
542
+ if( fUBg ) tmFlags |= TIMELINE_UCOLOR;
543
+ www_print_timeline(&q, tmFlags, 0, 0, 0, 0);
516544
db_finalize(&q);
517545
@ <br />
518546
style_footer();
519547
}
520548
521549
--- src/descendants.c
+++ src/descendants.c
@@ -454,29 +454,54 @@
454 **
455 ** Query parameters:
456 **
457 ** all Show all leaves
458 ** closed Show only closed leaves
 
 
 
459 */
460 void leaves_page(void){
461 Blob sql;
462 Stmt q;
463 int showAll = P("all")!=0;
464 int showClosed = P("closed")!=0;
 
 
 
 
 
 
465
466 login_check_credentials();
467 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
468
 
 
 
 
 
 
 
 
 
 
 
469 if( !showAll ){
470 style_submenu_element("All", "leaves?all");
 
471 }
472 if( !showClosed ){
473 style_submenu_element("Closed", "leaves?closed");
 
474 }
475 if( showClosed || showAll ){
476 style_submenu_element("Open", "leaves");
 
 
477 }
 
478 style_header("Leaves");
479 login_anonymous_available();
480 timeline_ss_submenu();
481 cookie_render();
482 #if 0
@@ -509,12 +534,15 @@
509 }else if( !showAll ){
510 blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
511 }
512 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
513 blob_reset(&sql);
514 www_print_timeline(
515 &q, TIMELINE_LEAFONLY|TIMELINE_GRAPH|TIMELINE_NOSCROLL, 0, 0, 0, 0);
 
 
 
516 db_finalize(&q);
517 @ <br />
518 style_footer();
519 }
520
521
--- src/descendants.c
+++ src/descendants.c
@@ -454,29 +454,54 @@
454 **
455 ** Query parameters:
456 **
457 ** all Show all leaves
458 ** closed Show only closed leaves
459 ** ng No graph
460 ** brbg Background color by branch name
461 ** ubg Background color by user name
462 */
463 void leaves_page(void){
464 Blob sql;
465 Stmt q;
466 int showAll = P("all")!=0;
467 int showClosed = P("closed")!=0;
468 int fNg = P("ng")!=0; /* Flag for the "ng" query parameter */
469 int fBrBg = P("brbg")!=0; /* Flag for the "brbg" query parameter */
470 int fUBg = P("ubg")!=0; /* Flag for the "ubg" query parameter */
471 Blob QueryParams = empty_blob; /* Concatenated query parameters */
472 char *zParamSep = 0; /* Query parameter separator */
473 int tmFlags; /* Timeline display flags */
474
475 login_check_credentials();
476 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
477 if( fNg ){
478 blob_appendf(&QueryParams, "%s%s", zParamSep, "ng");
479 zParamSep = "&";
480 }
481 if( fBrBg ){
482 blob_appendf(&QueryParams, "%s%s", zParamSep, "brbg");
483 zParamSep = "&";
484 }
485 if( fUBg ){
486 blob_appendf(&QueryParams, "%s%s", zParamSep, "ubg");
487 zParamSep = "&";
488 }
489 if( !showAll ){
490 style_submenu_element("All", "leaves?all%s%s",
491 zParamSep, blob_str(&QueryParams));
492 }
493 if( !showClosed ){
494 style_submenu_element("Closed", "leaves?closed%s%s",
495 zParamSep, blob_str(&QueryParams));
496 }
497 if( showClosed || showAll ){
498 if( zParamSep ) zParamSep = "?";
499 style_submenu_element("Open", "leaves%s%s",
500 zParamSep, blob_str(&QueryParams));
501 }
502 blob_reset(&QueryParams);
503 style_header("Leaves");
504 login_anonymous_available();
505 timeline_ss_submenu();
506 cookie_render();
507 #if 0
@@ -509,12 +534,15 @@
534 }else if( !showAll ){
535 blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
536 }
537 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
538 blob_reset(&sql);
539 tmFlags = TIMELINE_LEAFONLY | TIMELINE_NOSCROLL;
540 if( fNg==0 ) tmFlags |= TIMELINE_GRAPH;
541 if( fBrBg ) tmFlags |= TIMELINE_BRCOLOR;
542 if( fUBg ) tmFlags |= TIMELINE_UCOLOR;
543 www_print_timeline(&q, tmFlags, 0, 0, 0, 0);
544 db_finalize(&q);
545 @ <br />
546 style_footer();
547 }
548
549

Keyboard Shortcuts

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