Fossil SCM
Add timeline query parameters 'ng', 'brbg' and 'ubg' for the Leaves web page.
Commit
2ac6b5077656c35ffbaaf98f86064d720a78c3184957630688357d89395b519c
Parent
e03610b1d2cfdcf…
1 file changed
+34
-6
+34
-6
| --- src/descendants.c | ||
| +++ src/descendants.c | ||
| @@ -454,29 +454,54 @@ | ||
| 454 | 454 | ** |
| 455 | 455 | ** Query parameters: |
| 456 | 456 | ** |
| 457 | 457 | ** all Show all leaves |
| 458 | 458 | ** closed Show only closed leaves |
| 459 | +** ng No graph | |
| 460 | +** brbg Background color by branch name | |
| 461 | +** ubg Background color by user name | |
| 459 | 462 | */ |
| 460 | 463 | void leaves_page(void){ |
| 461 | 464 | Blob sql; |
| 462 | 465 | Stmt q; |
| 463 | 466 | int showAll = P("all")!=0; |
| 464 | 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 */ | |
| 465 | 474 | |
| 466 | 475 | login_check_credentials(); |
| 467 | 476 | 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 | + } | |
| 469 | 489 | if( !showAll ){ |
| 470 | - style_submenu_element("All", "leaves?all"); | |
| 490 | + style_submenu_element("All", "leaves?all%s%s", | |
| 491 | + zParamSep, blob_str(&QueryParams)); | |
| 471 | 492 | } |
| 472 | 493 | if( !showClosed ){ |
| 473 | - style_submenu_element("Closed", "leaves?closed"); | |
| 494 | + style_submenu_element("Closed", "leaves?closed%s%s", | |
| 495 | + zParamSep, blob_str(&QueryParams)); | |
| 474 | 496 | } |
| 475 | 497 | 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)); | |
| 477 | 501 | } |
| 502 | + blob_reset(&QueryParams); | |
| 478 | 503 | style_header("Leaves"); |
| 479 | 504 | login_anonymous_available(); |
| 480 | 505 | timeline_ss_submenu(); |
| 481 | 506 | cookie_render(); |
| 482 | 507 | #if 0 |
| @@ -509,12 +534,15 @@ | ||
| 509 | 534 | }else if( !showAll ){ |
| 510 | 535 | blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); |
| 511 | 536 | } |
| 512 | 537 | db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql)); |
| 513 | 538 | 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); | |
| 516 | 544 | db_finalize(&q); |
| 517 | 545 | @ <br /> |
| 518 | 546 | style_footer(); |
| 519 | 547 | } |
| 520 | 548 | |
| 521 | 549 |
| --- 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 |