Fossil SCM
Timeline enhancements: (1) Add the "nc" query parameter which means to omit all graph colorations other than highlights from "m" or "m2". (2) Add the "m2=" query parameter for secondary highlight. (3) Undocumented sel1= and sel2= query parameters remain undocumented but are now aliases for the documented "m=" and "m2=" query parameters.
Commit
a3392298c341e5120dd25a76711a3bcde41dd974cb357f7982efadab912ad7c0
Parent
c51ace6bc8bd0e1…
2 files changed
+19
+13
-4
+19
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1321,10 +1321,29 @@ | ||
| 1321 | 1321 | } |
| 1322 | 1322 | } |
| 1323 | 1323 | CGIDEBUG(("no-match [%s]\n", zName)); |
| 1324 | 1324 | return zDefault; |
| 1325 | 1325 | } |
| 1326 | + | |
| 1327 | +/* | |
| 1328 | +** Return the value of the first defined query parameter or cookie whose | |
| 1329 | +** name appears in the list of arguments. Or if no parameter is found, | |
| 1330 | +** return NULL. | |
| 1331 | +*/ | |
| 1332 | +const char *cgi_coalesce(const char *zName, ...){ | |
| 1333 | + va_list ap; | |
| 1334 | + const char *z; | |
| 1335 | + const char *zX; | |
| 1336 | + if( zName==0 ) return 0; | |
| 1337 | + z = cgi_parameter(zName, 0); | |
| 1338 | + va_start(ap, zName); | |
| 1339 | + while( z==0 && (zX = va_arg(ap,const char*))!=0 ){ | |
| 1340 | + z = cgi_parameter(zX, 0); | |
| 1341 | + } | |
| 1342 | + va_end(ap); | |
| 1343 | + return z; | |
| 1344 | +} | |
| 1326 | 1345 | |
| 1327 | 1346 | /* |
| 1328 | 1347 | ** Return the value of a CGI parameter with leading and trailing |
| 1329 | 1348 | ** spaces removed and with internal \r\n changed to just \n |
| 1330 | 1349 | */ |
| 1331 | 1350 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1321,10 +1321,29 @@ | |
| 1321 | } |
| 1322 | } |
| 1323 | CGIDEBUG(("no-match [%s]\n", zName)); |
| 1324 | return zDefault; |
| 1325 | } |
| 1326 | |
| 1327 | /* |
| 1328 | ** Return the value of a CGI parameter with leading and trailing |
| 1329 | ** spaces removed and with internal \r\n changed to just \n |
| 1330 | */ |
| 1331 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1321,10 +1321,29 @@ | |
| 1321 | } |
| 1322 | } |
| 1323 | CGIDEBUG(("no-match [%s]\n", zName)); |
| 1324 | return zDefault; |
| 1325 | } |
| 1326 | |
| 1327 | /* |
| 1328 | ** Return the value of the first defined query parameter or cookie whose |
| 1329 | ** name appears in the list of arguments. Or if no parameter is found, |
| 1330 | ** return NULL. |
| 1331 | */ |
| 1332 | const char *cgi_coalesce(const char *zName, ...){ |
| 1333 | va_list ap; |
| 1334 | const char *z; |
| 1335 | const char *zX; |
| 1336 | if( zName==0 ) return 0; |
| 1337 | z = cgi_parameter(zName, 0); |
| 1338 | va_start(ap, zName); |
| 1339 | while( z==0 && (zX = va_arg(ap,const char*))!=0 ){ |
| 1340 | z = cgi_parameter(zX, 0); |
| 1341 | } |
| 1342 | va_end(ap); |
| 1343 | return z; |
| 1344 | } |
| 1345 | |
| 1346 | /* |
| 1347 | ** Return the value of a CGI parameter with leading and trailing |
| 1348 | ** spaces removed and with internal \r\n changed to just \n |
| 1349 | */ |
| 1350 |
+13
-4
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -118,10 +118,11 @@ | ||
| 118 | 118 | #define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */ |
| 119 | 119 | #define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */ |
| 120 | 120 | #define TIMELINE_FORUMTXT 0x4000000 /* Render all forum messages */ |
| 121 | 121 | #define TIMELINE_REFS 0x8000000 /* Output intended for References tab */ |
| 122 | 122 | #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */ |
| 123 | +#define TIMELINE_NOCOLOR 0x20000000 /* No colors except for highlights */ | |
| 123 | 124 | #endif |
| 124 | 125 | |
| 125 | 126 | /* |
| 126 | 127 | ** Return a new timelineTable id. |
| 127 | 128 | */ |
| @@ -363,13 +364,15 @@ | ||
| 363 | 364 | }else{ |
| 364 | 365 | zDateLink = mprintf("<a>"); |
| 365 | 366 | } |
| 366 | 367 | @ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td> |
| 367 | 368 | @ <td class="timelineGraph"> |
| 368 | - if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA) ){ | |
| 369 | + if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ | |
| 369 | 370 | if( tmFlags & TIMELINE_UCOLOR ){ |
| 370 | 371 | zBgClr = zUser ? user_color(zUser) : 0; |
| 372 | + }else if( tmFlags & TIMELINE_NOCOLOR ){ | |
| 373 | + zBgClr = 0; | |
| 371 | 374 | }else if( zType[0]=='c' ){ |
| 372 | 375 | static Stmt qdelta; |
| 373 | 376 | db_static_prepare(&qdelta, "SELECT baseid IS NULL FROM plink" |
| 374 | 377 | " WHERE cid=:rid"); |
| 375 | 378 | db_bind_int(&qdelta, ":rid", rid); |
| @@ -392,11 +395,11 @@ | ||
| 392 | 395 | zBr = db_column_text(&qbranch, 0); |
| 393 | 396 | }else{ |
| 394 | 397 | zBr = "trunk"; |
| 395 | 398 | } |
| 396 | 399 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 397 | - if( tmFlags & TIMELINE_DELTA ){ | |
| 400 | + if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ | |
| 398 | 401 | }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 399 | 402 | zBgClr = 0; |
| 400 | 403 | }else{ |
| 401 | 404 | zBgClr = hash_color(zBr); |
| 402 | 405 | } |
| @@ -1545,10 +1548,11 @@ | ||
| 1545 | 1548 | ** b=TIMEORTAG Show events before TIMEORTAG |
| 1546 | 1549 | ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG |
| 1547 | 1550 | ** cf=FILEHASH Show events around the time of the first use of |
| 1548 | 1551 | ** the file with FILEHASH |
| 1549 | 1552 | ** m=TIMEORTAG Highlight the event at TIMEORTAG |
| 1553 | +** m2=TIMEORTAG Secondary highlight | |
| 1550 | 1554 | ** n=COUNT Maximum number of events. "all" for no limit |
| 1551 | 1555 | ** n1=COUNT Same as "n" but doesn't set the display-preference cookie |
| 1552 | 1556 | ** Use "n1=COUNT" for a one-time display change |
| 1553 | 1557 | ** p=CHECKIN Parents and ancestors of CHECKIN |
| 1554 | 1558 | ** bt=PRIOR ... going back to PRIOR |
| @@ -1572,10 +1576,11 @@ | ||
| 1572 | 1576 | ** advm Use the "Advanced" or "Busy" menu design. |
| 1573 | 1577 | ** ng No Graph. |
| 1574 | 1578 | ** ncp Omit cherrypick merges |
| 1575 | 1579 | ** nd Do not highlight the focus check-in |
| 1576 | 1580 | ** nsm Omit the submenu |
| 1581 | +** nc Omit all graph colors other than highlights | |
| 1577 | 1582 | ** v Show details of files changed |
| 1578 | 1583 | ** vfx Show complete text of forum messages |
| 1579 | 1584 | ** f=CHECKIN Show family (immediate parents and children) of CHECKIN |
| 1580 | 1585 | ** from=CHECKIN Path from... |
| 1581 | 1586 | ** to=CHECKIN ... to this |
| @@ -1728,12 +1733,12 @@ | ||
| 1728 | 1733 | } |
| 1729 | 1734 | |
| 1730 | 1735 | /* Undocumented query parameter to set JS mode */ |
| 1731 | 1736 | builtin_set_js_delivery_mode(P("jsmode"),1); |
| 1732 | 1737 | |
| 1733 | - secondaryRid = name_to_typed_rid(P("sel2"),"ci"); | |
| 1734 | - selectedRid = name_to_typed_rid(P("sel1"),"ci"); | |
| 1738 | + secondaryRid = name_to_typed_rid(cgi_coalesce("sel2","m2",NULL),"ci"); | |
| 1739 | + selectedRid = name_to_typed_rid(cgi_coalesce("m","sel1",NULL),"ci"); | |
| 1735 | 1740 | tmFlags |= timeline_ss_submenu(); |
| 1736 | 1741 | cookie_link_parameter("advm","advm","0"); |
| 1737 | 1742 | advancedMenu = atoi(PD("advm","0")); |
| 1738 | 1743 | |
| 1739 | 1744 | /* Omit all cherry-pick merge lines if the "ncp" query parameter is |
| @@ -1861,10 +1866,14 @@ | ||
| 1861 | 1866 | tmFlags |= TIMELINE_UCOLOR; |
| 1862 | 1867 | } |
| 1863 | 1868 | if( PB("deltabg") ){ |
| 1864 | 1869 | tmFlags |= TIMELINE_DELTA; |
| 1865 | 1870 | } |
| 1871 | + if( PB("nc") ){ | |
| 1872 | + tmFlags &= ~(TIMELINE_DELTA|TIMELINE_BRCOLOR|TIMELINE_UCOLOR); | |
| 1873 | + tmFlags |= TIMELINE_NOCOLOR; | |
| 1874 | + } | |
| 1866 | 1875 | if( zUses!=0 ){ |
| 1867 | 1876 | int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses); |
| 1868 | 1877 | if( ufid ){ |
| 1869 | 1878 | zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid); |
| 1870 | 1879 | db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)"); |
| 1871 | 1880 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -118,10 +118,11 @@ | |
| 118 | #define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */ |
| 119 | #define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */ |
| 120 | #define TIMELINE_FORUMTXT 0x4000000 /* Render all forum messages */ |
| 121 | #define TIMELINE_REFS 0x8000000 /* Output intended for References tab */ |
| 122 | #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */ |
| 123 | #endif |
| 124 | |
| 125 | /* |
| 126 | ** Return a new timelineTable id. |
| 127 | */ |
| @@ -363,13 +364,15 @@ | |
| 363 | }else{ |
| 364 | zDateLink = mprintf("<a>"); |
| 365 | } |
| 366 | @ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td> |
| 367 | @ <td class="timelineGraph"> |
| 368 | if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA) ){ |
| 369 | if( tmFlags & TIMELINE_UCOLOR ){ |
| 370 | zBgClr = zUser ? user_color(zUser) : 0; |
| 371 | }else if( zType[0]=='c' ){ |
| 372 | static Stmt qdelta; |
| 373 | db_static_prepare(&qdelta, "SELECT baseid IS NULL FROM plink" |
| 374 | " WHERE cid=:rid"); |
| 375 | db_bind_int(&qdelta, ":rid", rid); |
| @@ -392,11 +395,11 @@ | |
| 392 | zBr = db_column_text(&qbranch, 0); |
| 393 | }else{ |
| 394 | zBr = "trunk"; |
| 395 | } |
| 396 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 397 | if( tmFlags & TIMELINE_DELTA ){ |
| 398 | }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 399 | zBgClr = 0; |
| 400 | }else{ |
| 401 | zBgClr = hash_color(zBr); |
| 402 | } |
| @@ -1545,10 +1548,11 @@ | |
| 1545 | ** b=TIMEORTAG Show events before TIMEORTAG |
| 1546 | ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG |
| 1547 | ** cf=FILEHASH Show events around the time of the first use of |
| 1548 | ** the file with FILEHASH |
| 1549 | ** m=TIMEORTAG Highlight the event at TIMEORTAG |
| 1550 | ** n=COUNT Maximum number of events. "all" for no limit |
| 1551 | ** n1=COUNT Same as "n" but doesn't set the display-preference cookie |
| 1552 | ** Use "n1=COUNT" for a one-time display change |
| 1553 | ** p=CHECKIN Parents and ancestors of CHECKIN |
| 1554 | ** bt=PRIOR ... going back to PRIOR |
| @@ -1572,10 +1576,11 @@ | |
| 1572 | ** advm Use the "Advanced" or "Busy" menu design. |
| 1573 | ** ng No Graph. |
| 1574 | ** ncp Omit cherrypick merges |
| 1575 | ** nd Do not highlight the focus check-in |
| 1576 | ** nsm Omit the submenu |
| 1577 | ** v Show details of files changed |
| 1578 | ** vfx Show complete text of forum messages |
| 1579 | ** f=CHECKIN Show family (immediate parents and children) of CHECKIN |
| 1580 | ** from=CHECKIN Path from... |
| 1581 | ** to=CHECKIN ... to this |
| @@ -1728,12 +1733,12 @@ | |
| 1728 | } |
| 1729 | |
| 1730 | /* Undocumented query parameter to set JS mode */ |
| 1731 | builtin_set_js_delivery_mode(P("jsmode"),1); |
| 1732 | |
| 1733 | secondaryRid = name_to_typed_rid(P("sel2"),"ci"); |
| 1734 | selectedRid = name_to_typed_rid(P("sel1"),"ci"); |
| 1735 | tmFlags |= timeline_ss_submenu(); |
| 1736 | cookie_link_parameter("advm","advm","0"); |
| 1737 | advancedMenu = atoi(PD("advm","0")); |
| 1738 | |
| 1739 | /* Omit all cherry-pick merge lines if the "ncp" query parameter is |
| @@ -1861,10 +1866,14 @@ | |
| 1861 | tmFlags |= TIMELINE_UCOLOR; |
| 1862 | } |
| 1863 | if( PB("deltabg") ){ |
| 1864 | tmFlags |= TIMELINE_DELTA; |
| 1865 | } |
| 1866 | if( zUses!=0 ){ |
| 1867 | int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses); |
| 1868 | if( ufid ){ |
| 1869 | zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid); |
| 1870 | db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)"); |
| 1871 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -118,10 +118,11 @@ | |
| 118 | #define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */ |
| 119 | #define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */ |
| 120 | #define TIMELINE_FORUMTXT 0x4000000 /* Render all forum messages */ |
| 121 | #define TIMELINE_REFS 0x8000000 /* Output intended for References tab */ |
| 122 | #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */ |
| 123 | #define TIMELINE_NOCOLOR 0x20000000 /* No colors except for highlights */ |
| 124 | #endif |
| 125 | |
| 126 | /* |
| 127 | ** Return a new timelineTable id. |
| 128 | */ |
| @@ -363,13 +364,15 @@ | |
| 364 | }else{ |
| 365 | zDateLink = mprintf("<a>"); |
| 366 | } |
| 367 | @ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td> |
| 368 | @ <td class="timelineGraph"> |
| 369 | if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 370 | if( tmFlags & TIMELINE_UCOLOR ){ |
| 371 | zBgClr = zUser ? user_color(zUser) : 0; |
| 372 | }else if( tmFlags & TIMELINE_NOCOLOR ){ |
| 373 | zBgClr = 0; |
| 374 | }else if( zType[0]=='c' ){ |
| 375 | static Stmt qdelta; |
| 376 | db_static_prepare(&qdelta, "SELECT baseid IS NULL FROM plink" |
| 377 | " WHERE cid=:rid"); |
| 378 | db_bind_int(&qdelta, ":rid", rid); |
| @@ -392,11 +395,11 @@ | |
| 395 | zBr = db_column_text(&qbranch, 0); |
| 396 | }else{ |
| 397 | zBr = "trunk"; |
| 398 | } |
| 399 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 400 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 401 | }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 402 | zBgClr = 0; |
| 403 | }else{ |
| 404 | zBgClr = hash_color(zBr); |
| 405 | } |
| @@ -1545,10 +1548,11 @@ | |
| 1548 | ** b=TIMEORTAG Show events before TIMEORTAG |
| 1549 | ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG |
| 1550 | ** cf=FILEHASH Show events around the time of the first use of |
| 1551 | ** the file with FILEHASH |
| 1552 | ** m=TIMEORTAG Highlight the event at TIMEORTAG |
| 1553 | ** m2=TIMEORTAG Secondary highlight |
| 1554 | ** n=COUNT Maximum number of events. "all" for no limit |
| 1555 | ** n1=COUNT Same as "n" but doesn't set the display-preference cookie |
| 1556 | ** Use "n1=COUNT" for a one-time display change |
| 1557 | ** p=CHECKIN Parents and ancestors of CHECKIN |
| 1558 | ** bt=PRIOR ... going back to PRIOR |
| @@ -1572,10 +1576,11 @@ | |
| 1576 | ** advm Use the "Advanced" or "Busy" menu design. |
| 1577 | ** ng No Graph. |
| 1578 | ** ncp Omit cherrypick merges |
| 1579 | ** nd Do not highlight the focus check-in |
| 1580 | ** nsm Omit the submenu |
| 1581 | ** nc Omit all graph colors other than highlights |
| 1582 | ** v Show details of files changed |
| 1583 | ** vfx Show complete text of forum messages |
| 1584 | ** f=CHECKIN Show family (immediate parents and children) of CHECKIN |
| 1585 | ** from=CHECKIN Path from... |
| 1586 | ** to=CHECKIN ... to this |
| @@ -1728,12 +1733,12 @@ | |
| 1733 | } |
| 1734 | |
| 1735 | /* Undocumented query parameter to set JS mode */ |
| 1736 | builtin_set_js_delivery_mode(P("jsmode"),1); |
| 1737 | |
| 1738 | secondaryRid = name_to_typed_rid(cgi_coalesce("sel2","m2",NULL),"ci"); |
| 1739 | selectedRid = name_to_typed_rid(cgi_coalesce("m","sel1",NULL),"ci"); |
| 1740 | tmFlags |= timeline_ss_submenu(); |
| 1741 | cookie_link_parameter("advm","advm","0"); |
| 1742 | advancedMenu = atoi(PD("advm","0")); |
| 1743 | |
| 1744 | /* Omit all cherry-pick merge lines if the "ncp" query parameter is |
| @@ -1861,10 +1866,14 @@ | |
| 1866 | tmFlags |= TIMELINE_UCOLOR; |
| 1867 | } |
| 1868 | if( PB("deltabg") ){ |
| 1869 | tmFlags |= TIMELINE_DELTA; |
| 1870 | } |
| 1871 | if( PB("nc") ){ |
| 1872 | tmFlags &= ~(TIMELINE_DELTA|TIMELINE_BRCOLOR|TIMELINE_UCOLOR); |
| 1873 | tmFlags |= TIMELINE_NOCOLOR; |
| 1874 | } |
| 1875 | if( zUses!=0 ){ |
| 1876 | int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses); |
| 1877 | if( ufid ){ |
| 1878 | zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid); |
| 1879 | db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)"); |
| 1880 |