Fossil SCM

Change the "Log" submenu element of the annotation page so that it shows or hides the log using javascript, avoiding a server roundtrip and a recomputation of the annotation.

drh 2017-09-25 15:36 trunk
Commit 037e06b37015873b0f45b08ebe2d8ddbfcfabd0f32002fff21a8c15498c85782
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -388,11 +388,11 @@
388388
int show_colors = PB("colors");
389389
login_check_credentials();
390390
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
391391
style_header("Branches");
392392
style_adunit_config(ADUNIT_RIGHT_OK);
393
- style_submenu_checkbox("colors", "Use Branch Colors", 0);
393
+ style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
394394
login_anonymous_available();
395395
396396
db_prepare(&q, brlistQuery/*works-like:""*/);
397397
rNow = db_double(0.0, "SELECT julianday('now')");
398398
@ <div class="brlist"><table id="branchlisttable">
399399
--- src/branch.c
+++ src/branch.c
@@ -388,11 +388,11 @@
388 int show_colors = PB("colors");
389 login_check_credentials();
390 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
391 style_header("Branches");
392 style_adunit_config(ADUNIT_RIGHT_OK);
393 style_submenu_checkbox("colors", "Use Branch Colors", 0);
394 login_anonymous_available();
395
396 db_prepare(&q, brlistQuery/*works-like:""*/);
397 rNow = db_double(0.0, "SELECT julianday('now')");
398 @ <div class="brlist"><table id="branchlisttable">
399
--- src/branch.c
+++ src/branch.c
@@ -388,11 +388,11 @@
388 int show_colors = PB("colors");
389 login_check_credentials();
390 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
391 style_header("Branches");
392 style_adunit_config(ADUNIT_RIGHT_OK);
393 style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
394 login_anonymous_available();
395
396 db_prepare(&q, brlistQuery/*works-like:""*/);
397 rNow = db_double(0.0, "SELECT julianday('now')");
398 @ <div class="brlist"><table id="branchlisttable">
399
+1 -1
--- src/browse.c
+++ src/browse.c
@@ -753,11 +753,11 @@
753753
zObjType = "Folders";
754754
}else{
755755
zObjType = "Files";
756756
}
757757
758
- style_submenu_checkbox("nofiles", "Folders Only", 0);
758
+ style_submenu_checkbox("nofiles", "Folders Only", 0, 0);
759759
760760
if( zCI ){
761761
@ <h2>%s(zObjType) from
762762
if( sqlite3_strnicmp(zCI, zUuid, (int)strlen(zCI))!=0 ){
763763
@ "%h(zCI)"
764764
--- src/browse.c
+++ src/browse.c
@@ -753,11 +753,11 @@
753 zObjType = "Folders";
754 }else{
755 zObjType = "Files";
756 }
757
758 style_submenu_checkbox("nofiles", "Folders Only", 0);
759
760 if( zCI ){
761 @ <h2>%s(zObjType) from
762 if( sqlite3_strnicmp(zCI, zUuid, (int)strlen(zCI))!=0 ){
763 @ "%h(zCI)"
764
--- src/browse.c
+++ src/browse.c
@@ -753,11 +753,11 @@
753 zObjType = "Folders";
754 }else{
755 zObjType = "Files";
756 }
757
758 style_submenu_checkbox("nofiles", "Folders Only", 0, 0);
759
760 if( zCI ){
761 @ <h2>%s(zObjType) from
762 if( sqlite3_strnicmp(zCI, zUuid, (int)strlen(zCI))!=0 ){
763 @ "%h(zCI)"
764
+25 -30
--- src/diff.c
+++ src/diff.c
@@ -2315,10 +2315,11 @@
23152315
int fileVers; /* Show file version instead of check-in versions */
23162316
int ignoreWs; /* Ignore whitespace */
23172317
const char *zFilename; /* Name of file to annotate */
23182318
const char *zRevision; /* Name of check-in from which to start annotation */
23192319
const char *zCI; /* The check-in containing zFilename */
2320
+ char *zLink;
23202321
Annotator ann;
23212322
HQuery url;
23222323
struct AnnVers *p;
23232324
unsigned clr1, clr2, clr;
23242325
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
@@ -2353,13 +2354,13 @@
23532354
url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
23542355
}
23552356
url_add_parameter(&url, "w", ignoreWs ? "1" : "0");
23562357
url_add_parameter(&url, "log", showLog ? "1" : "0");
23572358
url_add_parameter(&url, "filevers", fileVers ? "1" : "0");
2358
- style_submenu_checkbox("w", "Ignore Whitespace", 0);
2359
- style_submenu_checkbox("log", "Log", 0);
2360
- style_submenu_checkbox("filevers", "Link to Files", 0);
2359
+ style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
2360
+ style_submenu_checkbox("log", "Log", 0, "toggle_annotation_log()");
2361
+ style_submenu_checkbox("filevers", "Link to Files", 0, 0);
23612362
if( ann.bLimit ){
23622363
char *z1, *z2;
23632364
style_submenu_element("All Ancestors", "%s",
23642365
url_render(&url, "limit", "-1", 0, 0));
23652366
z1 = sqlite3_mprintf("%d Ancestors", iLimit+20);
@@ -2380,37 +2381,31 @@
23802381
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
23812382
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
23822383
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
23832384
}
23842385
2385
- if( showLog ){
2386
- char *zLink = href("%R/finfo?name=%t&ci=%!S",zFilename,zCI);
2387
- @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2388
- @ <ol>
2389
- for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2390
- @ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
2391
- @ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
2392
- @ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
2393
- @ </span>
2394
-#if 0
2395
- if( i>0 ){
2396
- char *zLink = xhref("target='infowindow'",
2397
- "%R/fdiff?v1=%S&v2=%S&sbs=1",
2398
- p->zFUuid,ann.aVers[0].zFUuid);
2399
- @ %z(zLink)[diff-to-top]</a>
2400
- if( i>1 ){
2401
- zLink = xhref("target='infowindow'",
2402
- "%R/fdiff?v1=%S&v2=%S&sbs=1",
2403
- p->zFUuid,p[-1].zFUuid);
2404
- @ %z(zLink)[diff-to-previous]</a>
2405
- }
2406
- }
2407
-#endif
2408
- }
2409
- @ </ol>
2410
- @ <hr />
2411
- }
2386
+ @ <div id="annotation_log" style='display:%s(showLog?"block":"none")'>
2387
+ zLink = href("%R/finfo?name=%t&ci=%!S",zFilename,zCI);
2388
+ @ <h2>Versions of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2389
+ @ <ol>
2390
+ for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2391
+ @ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
2392
+ @ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
2393
+ @ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
2394
+ @ </span>
2395
+ }
2396
+ @ </ol>
2397
+ @ <hr />
2398
+ @ </div>
2399
+ @ <script>
2400
+ @ function toggle_annotation_log(){
2401
+ @ var w = gebi("annotation_log");
2402
+ @ var x = document.forms["f01"].elements["log"].checked
2403
+ @ w.style.display = x ? "block" : "none";
2404
+ @ }
2405
+ @ </script>
2406
+
24122407
if( !ann.bLimit ){
24132408
@ <h2>Origin for each line in
24142409
@ %z(href("%R/finfo?name=%h&ci=%!S", zFilename, zCI))%h(zFilename)</a>
24152410
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
24162411
iLimit = ann.nVers+10;
24172412
--- src/diff.c
+++ src/diff.c
@@ -2315,10 +2315,11 @@
2315 int fileVers; /* Show file version instead of check-in versions */
2316 int ignoreWs; /* Ignore whitespace */
2317 const char *zFilename; /* Name of file to annotate */
2318 const char *zRevision; /* Name of check-in from which to start annotation */
2319 const char *zCI; /* The check-in containing zFilename */
 
2320 Annotator ann;
2321 HQuery url;
2322 struct AnnVers *p;
2323 unsigned clr1, clr2, clr;
2324 int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
@@ -2353,13 +2354,13 @@
2353 url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
2354 }
2355 url_add_parameter(&url, "w", ignoreWs ? "1" : "0");
2356 url_add_parameter(&url, "log", showLog ? "1" : "0");
2357 url_add_parameter(&url, "filevers", fileVers ? "1" : "0");
2358 style_submenu_checkbox("w", "Ignore Whitespace", 0);
2359 style_submenu_checkbox("log", "Log", 0);
2360 style_submenu_checkbox("filevers", "Link to Files", 0);
2361 if( ann.bLimit ){
2362 char *z1, *z2;
2363 style_submenu_element("All Ancestors", "%s",
2364 url_render(&url, "limit", "-1", 0, 0));
2365 z1 = sqlite3_mprintf("%d Ancestors", iLimit+20);
@@ -2380,37 +2381,31 @@
2380 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2381 clr = gradient_color(clr1, clr2, ann.nVers-1, i);
2382 ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2383 }
2384
2385 if( showLog ){
2386 char *zLink = href("%R/finfo?name=%t&ci=%!S",zFilename,zCI);
2387 @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2388 @ <ol>
2389 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2390 @ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
2391 @ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
2392 @ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
2393 @ </span>
2394 #if 0
2395 if( i>0 ){
2396 char *zLink = xhref("target='infowindow'",
2397 "%R/fdiff?v1=%S&v2=%S&sbs=1",
2398 p->zFUuid,ann.aVers[0].zFUuid);
2399 @ %z(zLink)[diff-to-top]</a>
2400 if( i>1 ){
2401 zLink = xhref("target='infowindow'",
2402 "%R/fdiff?v1=%S&v2=%S&sbs=1",
2403 p->zFUuid,p[-1].zFUuid);
2404 @ %z(zLink)[diff-to-previous]</a>
2405 }
2406 }
2407 #endif
2408 }
2409 @ </ol>
2410 @ <hr />
2411 }
2412 if( !ann.bLimit ){
2413 @ <h2>Origin for each line in
2414 @ %z(href("%R/finfo?name=%h&ci=%!S", zFilename, zCI))%h(zFilename)</a>
2415 @ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
2416 iLimit = ann.nVers+10;
2417
--- src/diff.c
+++ src/diff.c
@@ -2315,10 +2315,11 @@
2315 int fileVers; /* Show file version instead of check-in versions */
2316 int ignoreWs; /* Ignore whitespace */
2317 const char *zFilename; /* Name of file to annotate */
2318 const char *zRevision; /* Name of check-in from which to start annotation */
2319 const char *zCI; /* The check-in containing zFilename */
2320 char *zLink;
2321 Annotator ann;
2322 HQuery url;
2323 struct AnnVers *p;
2324 unsigned clr1, clr2, clr;
2325 int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
@@ -2353,13 +2354,13 @@
2354 url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
2355 }
2356 url_add_parameter(&url, "w", ignoreWs ? "1" : "0");
2357 url_add_parameter(&url, "log", showLog ? "1" : "0");
2358 url_add_parameter(&url, "filevers", fileVers ? "1" : "0");
2359 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
2360 style_submenu_checkbox("log", "Log", 0, "toggle_annotation_log()");
2361 style_submenu_checkbox("filevers", "Link to Files", 0, 0);
2362 if( ann.bLimit ){
2363 char *z1, *z2;
2364 style_submenu_element("All Ancestors", "%s",
2365 url_render(&url, "limit", "-1", 0, 0));
2366 z1 = sqlite3_mprintf("%d Ancestors", iLimit+20);
@@ -2380,37 +2381,31 @@
2381 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2382 clr = gradient_color(clr1, clr2, ann.nVers-1, i);
2383 ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2384 }
2385
2386 @ <div id="annotation_log" style='display:%s(showLog?"block":"none")'>
2387 zLink = href("%R/finfo?name=%t&ci=%!S",zFilename,zCI);
2388 @ <h2>Versions of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2389 @ <ol>
2390 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2391 @ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
2392 @ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
2393 @ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
2394 @ </span>
2395 }
2396 @ </ol>
2397 @ <hr />
2398 @ </div>
2399 @ <script>
2400 @ function toggle_annotation_log(){
2401 @ var w = gebi("annotation_log");
2402 @ var x = document.forms["f01"].elements["log"].checked
2403 @ w.style.display = x ? "block" : "none";
2404 @ }
2405 @ </script>
2406
 
 
 
 
 
 
2407 if( !ann.bLimit ){
2408 @ <h2>Origin for each line in
2409 @ %z(href("%R/finfo?name=%h&ci=%!S", zFilename, zCI))%h(zFilename)</a>
2410 @ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
2411 iLimit = ann.nVers+10;
2412
+5 -5
--- src/info.c
+++ src/info.c
@@ -1154,11 +1154,11 @@
11541154
sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
11551155
}else{
11561156
style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
11571157
}
11581158
if( sideBySide || verboseFlag ){
1159
- style_submenu_checkbox("w", "Ignore Whitespace", 0);
1159
+ style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
11601160
}
11611161
style_header("Check-in Differences");
11621162
if( P("nohdr")==0 ){
11631163
@ <h2>Difference From:</h2><blockquote>
11641164
checkin_description(ridFrom);
@@ -1586,13 +1586,13 @@
15861586
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
15871587
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
15881588
diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
15891589
15901590
style_header("Diff");
1591
- style_submenu_checkbox("w", "Ignore Whitespace", 0);
1592
- style_submenu_checkbox("sbs", "Side-by-Side Diff", 0);
1593
- style_submenu_checkbox("verbose", "Verbose", 0);
1591
+ style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1592
+ style_submenu_checkbox("sbs", "Side-by-Side Diff", 0, 0);
1593
+ style_submenu_checkbox("verbose", "Verbose", 0, 0);
15941594
style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch",
15951595
g.zTop, P("v1"), P("v2"));
15961596
15971597
if( P("smhdr")!=0 ){
15981598
@ <h2>Differences From Artifact
@@ -2084,11 +2084,11 @@
20842084
}
20852085
if( descOnly ){
20862086
style_submenu_element("Content", "%R/artifact/%s", zUuid);
20872087
}else{
20882088
if( zLn==0 || atoi(zLn)==0 ){
2089
- style_submenu_checkbox("ln", "Line Numbers", 0);
2089
+ style_submenu_checkbox("ln", "Line Numbers", 0, 0);
20902090
}
20912091
@ <hr />
20922092
content_get(rid, &content);
20932093
if( renderAsWiki ){
20942094
wiki_render_by_mimetype(&content, zMime);
20952095
--- src/info.c
+++ src/info.c
@@ -1154,11 +1154,11 @@
1154 sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
1155 }else{
1156 style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
1157 }
1158 if( sideBySide || verboseFlag ){
1159 style_submenu_checkbox("w", "Ignore Whitespace", 0);
1160 }
1161 style_header("Check-in Differences");
1162 if( P("nohdr")==0 ){
1163 @ <h2>Difference From:</h2><blockquote>
1164 checkin_description(ridFrom);
@@ -1586,13 +1586,13 @@
1586 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1587 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1588 diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
1589
1590 style_header("Diff");
1591 style_submenu_checkbox("w", "Ignore Whitespace", 0);
1592 style_submenu_checkbox("sbs", "Side-by-Side Diff", 0);
1593 style_submenu_checkbox("verbose", "Verbose", 0);
1594 style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1595 g.zTop, P("v1"), P("v2"));
1596
1597 if( P("smhdr")!=0 ){
1598 @ <h2>Differences From Artifact
@@ -2084,11 +2084,11 @@
2084 }
2085 if( descOnly ){
2086 style_submenu_element("Content", "%R/artifact/%s", zUuid);
2087 }else{
2088 if( zLn==0 || atoi(zLn)==0 ){
2089 style_submenu_checkbox("ln", "Line Numbers", 0);
2090 }
2091 @ <hr />
2092 content_get(rid, &content);
2093 if( renderAsWiki ){
2094 wiki_render_by_mimetype(&content, zMime);
2095
--- src/info.c
+++ src/info.c
@@ -1154,11 +1154,11 @@
1154 sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
1155 }else{
1156 style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
1157 }
1158 if( sideBySide || verboseFlag ){
1159 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1160 }
1161 style_header("Check-in Differences");
1162 if( P("nohdr")==0 ){
1163 @ <h2>Difference From:</h2><blockquote>
1164 checkin_description(ridFrom);
@@ -1586,13 +1586,13 @@
1586 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1587 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1588 diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
1589
1590 style_header("Diff");
1591 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1592 style_submenu_checkbox("sbs", "Side-by-Side Diff", 0, 0);
1593 style_submenu_checkbox("verbose", "Verbose", 0, 0);
1594 style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1595 g.zTop, P("v1"), P("v2"));
1596
1597 if( P("smhdr")!=0 ){
1598 @ <h2>Differences From Artifact
@@ -2084,11 +2084,11 @@
2084 }
2085 if( descOnly ){
2086 style_submenu_element("Content", "%R/artifact/%s", zUuid);
2087 }else{
2088 if( zLn==0 || atoi(zLn)==0 ){
2089 style_submenu_checkbox("ln", "Line Numbers", 0, 0);
2090 }
2091 @ <hr />
2092 content_get(rid, &content);
2093 if( renderAsWiki ){
2094 wiki_render_by_mimetype(&content, zMime);
2095
+19 -11
--- src/style.c
+++ src/style.c
@@ -44,17 +44,18 @@
4444
const char *zLabel; /* Button label */
4545
const char *zLink; /* Jump to this link when button is pressed */
4646
} aSubmenu[30];
4747
static int nSubmenu = 0; /* Number of buttons */
4848
static struct SubmenuCtrl {
49
- const char *zName; /* Form query parameter */
50
- const char *zLabel; /* Label. Might be NULL for FF_MULTI */
51
- unsigned char eType; /* FF_ENTRY, FF_MULTI, FF_BINARY */
52
- unsigned char isDisabled; /* True if this control is grayed out */
53
- short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
54
- const char *const *azChoice;/* value/display pairs for FF_MULTI */
55
- const char *zFalse; /* FF_BINARY label when false */
49
+ const char *zName; /* Form query parameter */
50
+ const char *zLabel; /* Label. Might be NULL for FF_MULTI */
51
+ unsigned char eType; /* FF_ENTRY, FF_MULTI, FF_BINARY */
52
+ unsigned char isDisabled; /* True if this control is grayed out */
53
+ short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
54
+ const char *const *azChoice; /* value/display pairs for FF_MULTI */
55
+ const char *zFalse; /* FF_BINARY label when false */
56
+ const char *zJS; /* Javascript to run on toggle */
5657
} aSubmenuCtrl[20];
5758
static int nSubmenuCtrl = 0;
5859
#define FF_ENTRY 1
5960
#define FF_MULTI 2
6061
#define FF_BINARY 3
@@ -260,16 +261,18 @@
260261
nSubmenuCtrl++;
261262
}
262263
void style_submenu_checkbox(
263264
const char *zName, /* Query parameter name */
264265
const char *zLabel, /* Label to display after the checkbox */
265
- int isDisabled /* True if disabled */
266
+ int isDisabled, /* True if disabled */
267
+ const char *zJS /* Optional javascript to run on toggle */
266268
){
267269
assert( nSubmenuCtrl < count(aSubmenuCtrl) );
268270
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
269271
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
270272
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
273
+ aSubmenuCtrl[nSubmenuCtrl].zJS = zJS;
271274
aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX;
272275
nSubmenuCtrl++;
273276
}
274277
void style_submenu_binary(
275278
const char *zName, /* Query parameter name */
@@ -593,19 +596,24 @@
593596
}
594597
@ >%h(aSubmenuCtrl[i].zFalse)</option>
595598
@ </select>
596599
break;
597600
}
598
- case FF_CHECKBOX:
601
+ case FF_CHECKBOX: {
599602
@ <label class='submenuctrl submenuckbox'>\
600603
@ <input type='checkbox' name='%s(zQPN)' \
601604
if( PB(zQPN) ){
602605
@ checked \
603606
}
604
- @ onchange='gebi("f01").submit();'%s(zDisabled)>\
607
+ if( aSubmenuCtrl[i].zJS ){
608
+ @ onchange='%s(aSubmenuCtrl[i].zJS)'%s(zDisabled)>\
609
+ }else{
610
+ @ onchange='gebi("f01").submit();'%s(zDisabled)>\
611
+ }
605612
@ %h(aSubmenuCtrl[i].zLabel)</label>
606613
break;
614
+ }
607615
}
608616
}
609617
@ </div>
610618
if( nSubmenuCtrl ){
611619
cgi_query_parameters_to_hidden();
@@ -1593,11 +1601,11 @@
15931601
return;
15941602
}
15951603
for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
15961604
style_header("Environment Test");
15971605
showAll = PB("showall");
1598
- style_submenu_checkbox("showall", "Cookies", 0);
1606
+ style_submenu_checkbox("showall", "Cookies", 0, 0);
15991607
style_submenu_element("Stats", "%R/stat");
16001608
16011609
#if !defined(_WIN32)
16021610
@ uid=%d(getuid()), gid=%d(getgid())<br />
16031611
#endif
16041612
--- src/style.c
+++ src/style.c
@@ -44,17 +44,18 @@
44 const char *zLabel; /* Button label */
45 const char *zLink; /* Jump to this link when button is pressed */
46 } aSubmenu[30];
47 static int nSubmenu = 0; /* Number of buttons */
48 static struct SubmenuCtrl {
49 const char *zName; /* Form query parameter */
50 const char *zLabel; /* Label. Might be NULL for FF_MULTI */
51 unsigned char eType; /* FF_ENTRY, FF_MULTI, FF_BINARY */
52 unsigned char isDisabled; /* True if this control is grayed out */
53 short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
54 const char *const *azChoice;/* value/display pairs for FF_MULTI */
55 const char *zFalse; /* FF_BINARY label when false */
 
56 } aSubmenuCtrl[20];
57 static int nSubmenuCtrl = 0;
58 #define FF_ENTRY 1
59 #define FF_MULTI 2
60 #define FF_BINARY 3
@@ -260,16 +261,18 @@
260 nSubmenuCtrl++;
261 }
262 void style_submenu_checkbox(
263 const char *zName, /* Query parameter name */
264 const char *zLabel, /* Label to display after the checkbox */
265 int isDisabled /* True if disabled */
 
266 ){
267 assert( nSubmenuCtrl < count(aSubmenuCtrl) );
268 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
269 aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
270 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
 
271 aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX;
272 nSubmenuCtrl++;
273 }
274 void style_submenu_binary(
275 const char *zName, /* Query parameter name */
@@ -593,19 +596,24 @@
593 }
594 @ >%h(aSubmenuCtrl[i].zFalse)</option>
595 @ </select>
596 break;
597 }
598 case FF_CHECKBOX:
599 @ <label class='submenuctrl submenuckbox'>\
600 @ <input type='checkbox' name='%s(zQPN)' \
601 if( PB(zQPN) ){
602 @ checked \
603 }
604 @ onchange='gebi("f01").submit();'%s(zDisabled)>\
 
 
 
 
605 @ %h(aSubmenuCtrl[i].zLabel)</label>
606 break;
 
607 }
608 }
609 @ </div>
610 if( nSubmenuCtrl ){
611 cgi_query_parameters_to_hidden();
@@ -1593,11 +1601,11 @@
1593 return;
1594 }
1595 for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
1596 style_header("Environment Test");
1597 showAll = PB("showall");
1598 style_submenu_checkbox("showall", "Cookies", 0);
1599 style_submenu_element("Stats", "%R/stat");
1600
1601 #if !defined(_WIN32)
1602 @ uid=%d(getuid()), gid=%d(getgid())<br />
1603 #endif
1604
--- src/style.c
+++ src/style.c
@@ -44,17 +44,18 @@
44 const char *zLabel; /* Button label */
45 const char *zLink; /* Jump to this link when button is pressed */
46 } aSubmenu[30];
47 static int nSubmenu = 0; /* Number of buttons */
48 static struct SubmenuCtrl {
49 const char *zName; /* Form query parameter */
50 const char *zLabel; /* Label. Might be NULL for FF_MULTI */
51 unsigned char eType; /* FF_ENTRY, FF_MULTI, FF_BINARY */
52 unsigned char isDisabled; /* True if this control is grayed out */
53 short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
54 const char *const *azChoice; /* value/display pairs for FF_MULTI */
55 const char *zFalse; /* FF_BINARY label when false */
56 const char *zJS; /* Javascript to run on toggle */
57 } aSubmenuCtrl[20];
58 static int nSubmenuCtrl = 0;
59 #define FF_ENTRY 1
60 #define FF_MULTI 2
61 #define FF_BINARY 3
@@ -260,16 +261,18 @@
261 nSubmenuCtrl++;
262 }
263 void style_submenu_checkbox(
264 const char *zName, /* Query parameter name */
265 const char *zLabel, /* Label to display after the checkbox */
266 int isDisabled, /* True if disabled */
267 const char *zJS /* Optional javascript to run on toggle */
268 ){
269 assert( nSubmenuCtrl < count(aSubmenuCtrl) );
270 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
271 aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
272 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
273 aSubmenuCtrl[nSubmenuCtrl].zJS = zJS;
274 aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX;
275 nSubmenuCtrl++;
276 }
277 void style_submenu_binary(
278 const char *zName, /* Query parameter name */
@@ -593,19 +596,24 @@
596 }
597 @ >%h(aSubmenuCtrl[i].zFalse)</option>
598 @ </select>
599 break;
600 }
601 case FF_CHECKBOX: {
602 @ <label class='submenuctrl submenuckbox'>\
603 @ <input type='checkbox' name='%s(zQPN)' \
604 if( PB(zQPN) ){
605 @ checked \
606 }
607 if( aSubmenuCtrl[i].zJS ){
608 @ onchange='%s(aSubmenuCtrl[i].zJS)'%s(zDisabled)>\
609 }else{
610 @ onchange='gebi("f01").submit();'%s(zDisabled)>\
611 }
612 @ %h(aSubmenuCtrl[i].zLabel)</label>
613 break;
614 }
615 }
616 }
617 @ </div>
618 if( nSubmenuCtrl ){
619 cgi_query_parameters_to_hidden();
@@ -1593,11 +1601,11 @@
1601 return;
1602 }
1603 for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
1604 style_header("Environment Test");
1605 showAll = PB("showall");
1606 style_submenu_checkbox("showall", "Cookies", 0, 0);
1607 style_submenu_element("Stats", "%R/stat");
1608
1609 #if !defined(_WIN32)
1610 @ uid=%d(getuid()), gid=%d(getgid())<br />
1611 #endif
1612
+7 -7
--- src/timeline.c
+++ src/timeline.c
@@ -1616,11 +1616,11 @@
16161616
/* For exact maching, inhibit links to the selected tag. */
16171617
zThisTag = zTagName;
16181618
}
16191619
16201620
/* Display a checkbox to enable/disable display of related check-ins. */
1621
- style_submenu_checkbox("rel", "Related", 0);
1621
+ style_submenu_checkbox("rel", "Related", 0, 0);
16221622
16231623
/* Construct the tag match expression. */
16241624
zTagSql = tagMatchExpression(matchStyle, zTagName, &zMatchDesc, &zError);
16251625
}
16261626
@@ -1748,11 +1748,11 @@
17481748
blob_append(&sql, ")", -1);
17491749
path_reset();
17501750
addFileGlobExclusion(zChng, &sql);
17511751
tmFlags |= TIMELINE_DISJOINT;
17521752
db_multi_exec("%s", blob_sql_text(&sql));
1753
- style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1753
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
17541754
blob_appendf(&desc, "%d check-ins going from ",
17551755
db_int(0, "SELECT count(*) FROM timeline"));
17561756
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
17571757
blob_append(&desc, " to ", -1);
17581758
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
@@ -1798,11 +1798,11 @@
17981798
if( p_rid ){
17991799
/* If both p= and d= are set, we don't have the uuid of d yet. */
18001800
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
18011801
}
18021802
}
1803
- style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1803
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
18041804
style_submenu_entry("n","Max:",4,0);
18051805
timeline_y_submenu(1);
18061806
}else if( f_rid && g.perm.Read ){
18071807
/* If f= is present, ignore all other parameters other than n= */
18081808
char *zUuid;
@@ -1818,12 +1818,12 @@
18181818
if( useDividers ) selectedRid = f_rid;
18191819
blob_appendf(&desc, "Parents and children of check-in ");
18201820
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
18211821
blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
18221822
tmFlags |= TIMELINE_DISJOINT;
1823
- style_submenu_checkbox("unhide", "Unhide", 0);
1824
- style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1823
+ style_submenu_checkbox("unhide", "Unhide", 0, 0);
1824
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
18251825
}else{
18261826
/* Otherwise, a timeline based on a span of time */
18271827
int n;
18281828
const char *zEType = "timeline item";
18291829
char *zDate;
@@ -2103,13 +2103,13 @@
21032103
timeline_submenu(&url, "Newer", "a", zDate, "b");
21042104
}
21052105
free(zDate);
21062106
}
21072107
if( zType[0]=='a' || zType[0]=='c' ){
2108
- style_submenu_checkbox("unhide", "Unhide", 0);
2108
+ style_submenu_checkbox("unhide", "Unhide", 0, 0);
21092109
}
2110
- style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
2110
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
21112111
style_submenu_entry("n","Max:",4,0);
21122112
timeline_y_submenu(disableY);
21132113
style_submenu_entry("t", "Tag Filter:", -8, 0);
21142114
style_submenu_multichoice("ms", count(azMatchStyles)/2, azMatchStyles, 0);
21152115
}
21162116
--- src/timeline.c
+++ src/timeline.c
@@ -1616,11 +1616,11 @@
1616 /* For exact maching, inhibit links to the selected tag. */
1617 zThisTag = zTagName;
1618 }
1619
1620 /* Display a checkbox to enable/disable display of related check-ins. */
1621 style_submenu_checkbox("rel", "Related", 0);
1622
1623 /* Construct the tag match expression. */
1624 zTagSql = tagMatchExpression(matchStyle, zTagName, &zMatchDesc, &zError);
1625 }
1626
@@ -1748,11 +1748,11 @@
1748 blob_append(&sql, ")", -1);
1749 path_reset();
1750 addFileGlobExclusion(zChng, &sql);
1751 tmFlags |= TIMELINE_DISJOINT;
1752 db_multi_exec("%s", blob_sql_text(&sql));
1753 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1754 blob_appendf(&desc, "%d check-ins going from ",
1755 db_int(0, "SELECT count(*) FROM timeline"));
1756 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
1757 blob_append(&desc, " to ", -1);
1758 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
@@ -1798,11 +1798,11 @@
1798 if( p_rid ){
1799 /* If both p= and d= are set, we don't have the uuid of d yet. */
1800 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
1801 }
1802 }
1803 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1804 style_submenu_entry("n","Max:",4,0);
1805 timeline_y_submenu(1);
1806 }else if( f_rid && g.perm.Read ){
1807 /* If f= is present, ignore all other parameters other than n= */
1808 char *zUuid;
@@ -1818,12 +1818,12 @@
1818 if( useDividers ) selectedRid = f_rid;
1819 blob_appendf(&desc, "Parents and children of check-in ");
1820 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1821 blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
1822 tmFlags |= TIMELINE_DISJOINT;
1823 style_submenu_checkbox("unhide", "Unhide", 0);
1824 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1825 }else{
1826 /* Otherwise, a timeline based on a span of time */
1827 int n;
1828 const char *zEType = "timeline item";
1829 char *zDate;
@@ -2103,13 +2103,13 @@
2103 timeline_submenu(&url, "Newer", "a", zDate, "b");
2104 }
2105 free(zDate);
2106 }
2107 if( zType[0]=='a' || zType[0]=='c' ){
2108 style_submenu_checkbox("unhide", "Unhide", 0);
2109 }
2110 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
2111 style_submenu_entry("n","Max:",4,0);
2112 timeline_y_submenu(disableY);
2113 style_submenu_entry("t", "Tag Filter:", -8, 0);
2114 style_submenu_multichoice("ms", count(azMatchStyles)/2, azMatchStyles, 0);
2115 }
2116
--- src/timeline.c
+++ src/timeline.c
@@ -1616,11 +1616,11 @@
1616 /* For exact maching, inhibit links to the selected tag. */
1617 zThisTag = zTagName;
1618 }
1619
1620 /* Display a checkbox to enable/disable display of related check-ins. */
1621 style_submenu_checkbox("rel", "Related", 0, 0);
1622
1623 /* Construct the tag match expression. */
1624 zTagSql = tagMatchExpression(matchStyle, zTagName, &zMatchDesc, &zError);
1625 }
1626
@@ -1748,11 +1748,11 @@
1748 blob_append(&sql, ")", -1);
1749 path_reset();
1750 addFileGlobExclusion(zChng, &sql);
1751 tmFlags |= TIMELINE_DISJOINT;
1752 db_multi_exec("%s", blob_sql_text(&sql));
1753 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
1754 blob_appendf(&desc, "%d check-ins going from ",
1755 db_int(0, "SELECT count(*) FROM timeline"));
1756 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
1757 blob_append(&desc, " to ", -1);
1758 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
@@ -1798,11 +1798,11 @@
1798 if( p_rid ){
1799 /* If both p= and d= are set, we don't have the uuid of d yet. */
1800 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
1801 }
1802 }
1803 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
1804 style_submenu_entry("n","Max:",4,0);
1805 timeline_y_submenu(1);
1806 }else if( f_rid && g.perm.Read ){
1807 /* If f= is present, ignore all other parameters other than n= */
1808 char *zUuid;
@@ -1818,12 +1818,12 @@
1818 if( useDividers ) selectedRid = f_rid;
1819 blob_appendf(&desc, "Parents and children of check-in ");
1820 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1821 blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
1822 tmFlags |= TIMELINE_DISJOINT;
1823 style_submenu_checkbox("unhide", "Unhide", 0, 0);
1824 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
1825 }else{
1826 /* Otherwise, a timeline based on a span of time */
1827 int n;
1828 const char *zEType = "timeline item";
1829 char *zDate;
@@ -2103,13 +2103,13 @@
2103 timeline_submenu(&url, "Newer", "a", zDate, "b");
2104 }
2105 free(zDate);
2106 }
2107 if( zType[0]=='a' || zType[0]=='c' ){
2108 style_submenu_checkbox("unhide", "Unhide", 0, 0);
2109 }
2110 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c', 0);
2111 style_submenu_entry("n","Max:",4,0);
2112 timeline_y_submenu(disableY);
2113 style_submenu_entry("t", "Tag Filter:", -8, 0);
2114 style_submenu_multichoice("ms", count(azMatchStyles)/2, azMatchStyles, 0);
2115 }
2116

Keyboard Shortcuts

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