Fossil SCM
Only show diff link once, both on the timeline?y=w and on the whistory pages. (We use the `xExtra` parameter of www_print_timeline for this).
Commit
35963314c97911a5f0648b31aa8dafd9ad9eb5da5889c803f0aa2067d5c8357c
Parent
e8adab959161683…
1 file changed
+18
-10
+18
-10
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -616,19 +616,10 @@ | ||
| 616 | 616 | }else{ |
| 617 | 617 | cgi_printf(" tags: %h", zTagList); |
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - if ( zType[0] == 'w' ){ | |
| 622 | - char *zPageName = db_text(0, "SELECT substr(tagname, 6) as name" | |
| 623 | - " FROM tag INNER JOIN tagxref ON tag.tagid = tagxref.tagid" | |
| 624 | - " WHERE rid = %d", rid); | |
| 625 | - char *zLink = mprintf("%R/wdiff?name=%T&a=%d", zPageName, rid); | |
| 626 | - cgi_printf(" %z[diff]</a>", href("%z",zLink)); | |
| 627 | - fossil_free(zPageName); | |
| 628 | - } | |
| 629 | - | |
| 630 | 621 | if( tmFlags & TIMELINE_SHOWRID ){ |
| 631 | 622 | int srcId = delta_source_rid(rid); |
| 632 | 623 | if( srcId ){ |
| 633 | 624 | cgi_printf(" id: %d←%d", rid, srcId); |
| 634 | 625 | }else{ |
| @@ -1351,10 +1342,22 @@ | ||
| 1351 | 1342 | } |
| 1352 | 1343 | |
| 1353 | 1344 | /* If execution reaches this point, the pattern was empty. Return NULL. */ |
| 1354 | 1345 | return 0; |
| 1355 | 1346 | } |
| 1347 | + | |
| 1348 | +/* | |
| 1349 | +** Function called to output extra text at the end of each wiki line in | |
| 1350 | +** a timeline. | |
| 1351 | +*/ | |
| 1352 | +static void timeline_wiki_extra(int rid){ | |
| 1353 | + char *zPageName = db_text(0, "SELECT substr(tagname, 6) as name" | |
| 1354 | + " FROM tag INNER JOIN tagxref ON tag.tagid = tagxref.tagid" | |
| 1355 | + " WHERE rid = %d", rid); | |
| 1356 | + @ %z(href("%R/wdiff?name=%t&a=%d",zPageName,rid))[diff]</a> | |
| 1357 | + fossil_free(zPageName); | |
| 1358 | +} | |
| 1356 | 1359 | |
| 1357 | 1360 | /* |
| 1358 | 1361 | ** WEBPAGE: timeline |
| 1359 | 1362 | ** |
| 1360 | 1363 | ** Query parameters: |
| @@ -1459,10 +1462,11 @@ | ||
| 1459 | 1462 | char *zNewerButton = 0; /* URL for Newer button at the top */ |
| 1460 | 1463 | int selectedRid = -9999999; /* Show a highlight on this RID */ |
| 1461 | 1464 | int disableY = 0; /* Disable type selector on submenu */ |
| 1462 | 1465 | int advancedMenu = 0; /* Use the advanced menu design */ |
| 1463 | 1466 | char *zPlural; /* Ending for plural forms */ |
| 1467 | + void (*xExtra)(int) = NULL; | |
| 1464 | 1468 | |
| 1465 | 1469 | /* Set number of rows to display */ |
| 1466 | 1470 | cookie_read_parameter("n","n"); |
| 1467 | 1471 | z = P("n"); |
| 1468 | 1472 | if( z==0 ) z = db_get("timeline-default-length",0); |
| @@ -2123,15 +2127,19 @@ | ||
| 2123 | 2127 | |
| 2124 | 2128 | /* Report any errors. */ |
| 2125 | 2129 | if( zError ){ |
| 2126 | 2130 | @ <p class="generalError">%h(zError)</p> |
| 2127 | 2131 | } |
| 2132 | + | |
| 2133 | + if( g.perm.Hyperlink && zType[0]=='w' ){ | |
| 2134 | + xExtra = timeline_wiki_extra; | |
| 2135 | + } | |
| 2128 | 2136 | |
| 2129 | 2137 | if( zNewerButton ){ |
| 2130 | 2138 | @ %z(chref("button","%z",zNewerButton))More ↑</a> |
| 2131 | 2139 | } |
| 2132 | - www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, 0); | |
| 2140 | + www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, xExtra); | |
| 2133 | 2141 | db_finalize(&q); |
| 2134 | 2142 | if( zOlderButton ){ |
| 2135 | 2143 | @ %z(chref("button","%z",zOlderButton))More ↓</a> |
| 2136 | 2144 | } |
| 2137 | 2145 | style_footer(); |
| 2138 | 2146 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -616,19 +616,10 @@ | |
| 616 | }else{ |
| 617 | cgi_printf(" tags: %h", zTagList); |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | if ( zType[0] == 'w' ){ |
| 622 | char *zPageName = db_text(0, "SELECT substr(tagname, 6) as name" |
| 623 | " FROM tag INNER JOIN tagxref ON tag.tagid = tagxref.tagid" |
| 624 | " WHERE rid = %d", rid); |
| 625 | char *zLink = mprintf("%R/wdiff?name=%T&a=%d", zPageName, rid); |
| 626 | cgi_printf(" %z[diff]</a>", href("%z",zLink)); |
| 627 | fossil_free(zPageName); |
| 628 | } |
| 629 | |
| 630 | if( tmFlags & TIMELINE_SHOWRID ){ |
| 631 | int srcId = delta_source_rid(rid); |
| 632 | if( srcId ){ |
| 633 | cgi_printf(" id: %d←%d", rid, srcId); |
| 634 | }else{ |
| @@ -1351,10 +1342,22 @@ | |
| 1351 | } |
| 1352 | |
| 1353 | /* If execution reaches this point, the pattern was empty. Return NULL. */ |
| 1354 | return 0; |
| 1355 | } |
| 1356 | |
| 1357 | /* |
| 1358 | ** WEBPAGE: timeline |
| 1359 | ** |
| 1360 | ** Query parameters: |
| @@ -1459,10 +1462,11 @@ | |
| 1459 | char *zNewerButton = 0; /* URL for Newer button at the top */ |
| 1460 | int selectedRid = -9999999; /* Show a highlight on this RID */ |
| 1461 | int disableY = 0; /* Disable type selector on submenu */ |
| 1462 | int advancedMenu = 0; /* Use the advanced menu design */ |
| 1463 | char *zPlural; /* Ending for plural forms */ |
| 1464 | |
| 1465 | /* Set number of rows to display */ |
| 1466 | cookie_read_parameter("n","n"); |
| 1467 | z = P("n"); |
| 1468 | if( z==0 ) z = db_get("timeline-default-length",0); |
| @@ -2123,15 +2127,19 @@ | |
| 2123 | |
| 2124 | /* Report any errors. */ |
| 2125 | if( zError ){ |
| 2126 | @ <p class="generalError">%h(zError)</p> |
| 2127 | } |
| 2128 | |
| 2129 | if( zNewerButton ){ |
| 2130 | @ %z(chref("button","%z",zNewerButton))More ↑</a> |
| 2131 | } |
| 2132 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, 0); |
| 2133 | db_finalize(&q); |
| 2134 | if( zOlderButton ){ |
| 2135 | @ %z(chref("button","%z",zOlderButton))More ↓</a> |
| 2136 | } |
| 2137 | style_footer(); |
| 2138 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -616,19 +616,10 @@ | |
| 616 | }else{ |
| 617 | cgi_printf(" tags: %h", zTagList); |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | if( tmFlags & TIMELINE_SHOWRID ){ |
| 622 | int srcId = delta_source_rid(rid); |
| 623 | if( srcId ){ |
| 624 | cgi_printf(" id: %d←%d", rid, srcId); |
| 625 | }else{ |
| @@ -1351,10 +1342,22 @@ | |
| 1342 | } |
| 1343 | |
| 1344 | /* If execution reaches this point, the pattern was empty. Return NULL. */ |
| 1345 | return 0; |
| 1346 | } |
| 1347 | |
| 1348 | /* |
| 1349 | ** Function called to output extra text at the end of each wiki line in |
| 1350 | ** a timeline. |
| 1351 | */ |
| 1352 | static void timeline_wiki_extra(int rid){ |
| 1353 | char *zPageName = db_text(0, "SELECT substr(tagname, 6) as name" |
| 1354 | " FROM tag INNER JOIN tagxref ON tag.tagid = tagxref.tagid" |
| 1355 | " WHERE rid = %d", rid); |
| 1356 | @ %z(href("%R/wdiff?name=%t&a=%d",zPageName,rid))[diff]</a> |
| 1357 | fossil_free(zPageName); |
| 1358 | } |
| 1359 | |
| 1360 | /* |
| 1361 | ** WEBPAGE: timeline |
| 1362 | ** |
| 1363 | ** Query parameters: |
| @@ -1459,10 +1462,11 @@ | |
| 1462 | char *zNewerButton = 0; /* URL for Newer button at the top */ |
| 1463 | int selectedRid = -9999999; /* Show a highlight on this RID */ |
| 1464 | int disableY = 0; /* Disable type selector on submenu */ |
| 1465 | int advancedMenu = 0; /* Use the advanced menu design */ |
| 1466 | char *zPlural; /* Ending for plural forms */ |
| 1467 | void (*xExtra)(int) = NULL; |
| 1468 | |
| 1469 | /* Set number of rows to display */ |
| 1470 | cookie_read_parameter("n","n"); |
| 1471 | z = P("n"); |
| 1472 | if( z==0 ) z = db_get("timeline-default-length",0); |
| @@ -2123,15 +2127,19 @@ | |
| 2127 | |
| 2128 | /* Report any errors. */ |
| 2129 | if( zError ){ |
| 2130 | @ <p class="generalError">%h(zError)</p> |
| 2131 | } |
| 2132 | |
| 2133 | if( g.perm.Hyperlink && zType[0]=='w' ){ |
| 2134 | xExtra = timeline_wiki_extra; |
| 2135 | } |
| 2136 | |
| 2137 | if( zNewerButton ){ |
| 2138 | @ %z(chref("button","%z",zNewerButton))More ↑</a> |
| 2139 | } |
| 2140 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, xExtra); |
| 2141 | db_finalize(&q); |
| 2142 | if( zOlderButton ){ |
| 2143 | @ %z(chref("button","%z",zOlderButton))More ↓</a> |
| 2144 | } |
| 2145 | style_footer(); |
| 2146 |