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).

vor0nwe 2018-10-25 15:52 vor0nwe-wiki-wysiwyg
Commit 35963314c97911a5f0648b31aa8dafd9ad9eb5da5889c803f0aa2067d5c8357c
1 file changed +18 -10
+18 -10
--- src/timeline.c
+++ src/timeline.c
@@ -616,19 +616,10 @@
616616
}else{
617617
cgi_printf(" tags: %h", zTagList);
618618
}
619619
}
620620
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
-
630621
if( tmFlags & TIMELINE_SHOWRID ){
631622
int srcId = delta_source_rid(rid);
632623
if( srcId ){
633624
cgi_printf(" id:&nbsp;%d&larr;%d", rid, srcId);
634625
}else{
@@ -1351,10 +1342,22 @@
13511342
}
13521343
13531344
/* If execution reaches this point, the pattern was empty. Return NULL. */
13541345
return 0;
13551346
}
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
+}
13561359
13571360
/*
13581361
** WEBPAGE: timeline
13591362
**
13601363
** Query parameters:
@@ -1459,10 +1462,11 @@
14591462
char *zNewerButton = 0; /* URL for Newer button at the top */
14601463
int selectedRid = -9999999; /* Show a highlight on this RID */
14611464
int disableY = 0; /* Disable type selector on submenu */
14621465
int advancedMenu = 0; /* Use the advanced menu design */
14631466
char *zPlural; /* Ending for plural forms */
1467
+ void (*xExtra)(int) = NULL;
14641468
14651469
/* Set number of rows to display */
14661470
cookie_read_parameter("n","n");
14671471
z = P("n");
14681472
if( z==0 ) z = db_get("timeline-default-length",0);
@@ -2123,15 +2127,19 @@
21232127
21242128
/* Report any errors. */
21252129
if( zError ){
21262130
@ <p class="generalError">%h(zError)</p>
21272131
}
2132
+
2133
+ if( g.perm.Hyperlink && zType[0]=='w' ){
2134
+ xExtra = timeline_wiki_extra;
2135
+ }
21282136
21292137
if( zNewerButton ){
21302138
@ %z(chref("button","%z",zNewerButton))More&nbsp;&uarr;</a>
21312139
}
2132
- www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, 0);
2140
+ www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, xExtra);
21332141
db_finalize(&q);
21342142
if( zOlderButton ){
21352143
@ %z(chref("button","%z",zOlderButton))More&nbsp;&darr;</a>
21362144
}
21372145
style_footer();
21382146
--- src/timeline.c
+++ src/timeline.c
@@ -616,19 +616,10 @@
616 }else{
617 cgi_printf(" tags:&nbsp;%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:&nbsp;%d&larr;%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&nbsp;&uarr;</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&nbsp;&darr;</a>
2136 }
2137 style_footer();
2138
--- src/timeline.c
+++ src/timeline.c
@@ -616,19 +616,10 @@
616 }else{
617 cgi_printf(" tags:&nbsp;%h", zTagList);
618 }
619 }
620
 
 
 
 
 
 
 
 
 
621 if( tmFlags & TIMELINE_SHOWRID ){
622 int srcId = delta_source_rid(rid);
623 if( srcId ){
624 cgi_printf(" id:&nbsp;%d&larr;%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&nbsp;&uarr;</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&nbsp;&darr;</a>
2144 }
2145 style_footer();
2146

Keyboard Shortcuts

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