Fossil SCM

Propagate the timeline-default-style setting when cloning. Fix the initialization of the timeline style select menu so that it shows it is initialized to the default setting.

drh 2020-02-12 14:17 trunk
Commit bc8691cd09e89ce3e6362ac51e87edcb6f21790b07254f23ed9fac5c4796c894
--- src/configure.c
+++ src/configure.c
@@ -96,10 +96,11 @@
9696
{ "logo-image", CONFIGSET_SKIN },
9797
{ "background-mimetype", CONFIGSET_SKIN },
9898
{ "background-image", CONFIGSET_SKIN },
9999
{ "timeline-block-markup", CONFIGSET_SKIN },
100100
{ "timeline-date-format", CONFIGSET_SKIN },
101
+ { "timeline-default-style", CONFIGSET_SKIN },
101102
{ "timeline-dwelltime", CONFIGSET_SKIN },
102103
{ "timeline-closetime", CONFIGSET_SKIN },
103104
{ "timeline-max-comment", CONFIGSET_SKIN },
104105
{ "timeline-plaintext", CONFIGSET_SKIN },
105106
{ "timeline-truncate-at-blank", CONFIGSET_SKIN },
106107
--- src/configure.c
+++ src/configure.c
@@ -96,10 +96,11 @@
96 { "logo-image", CONFIGSET_SKIN },
97 { "background-mimetype", CONFIGSET_SKIN },
98 { "background-image", CONFIGSET_SKIN },
99 { "timeline-block-markup", CONFIGSET_SKIN },
100 { "timeline-date-format", CONFIGSET_SKIN },
 
101 { "timeline-dwelltime", CONFIGSET_SKIN },
102 { "timeline-closetime", CONFIGSET_SKIN },
103 { "timeline-max-comment", CONFIGSET_SKIN },
104 { "timeline-plaintext", CONFIGSET_SKIN },
105 { "timeline-truncate-at-blank", CONFIGSET_SKIN },
106
--- src/configure.c
+++ src/configure.c
@@ -96,10 +96,11 @@
96 { "logo-image", CONFIGSET_SKIN },
97 { "background-mimetype", CONFIGSET_SKIN },
98 { "background-image", CONFIGSET_SKIN },
99 { "timeline-block-markup", CONFIGSET_SKIN },
100 { "timeline-date-format", CONFIGSET_SKIN },
101 { "timeline-default-style", CONFIGSET_SKIN },
102 { "timeline-dwelltime", CONFIGSET_SKIN },
103 { "timeline-closetime", CONFIGSET_SKIN },
104 { "timeline-max-comment", CONFIGSET_SKIN },
105 { "timeline-plaintext", CONFIGSET_SKIN },
106 { "timeline-truncate-at-blank", CONFIGSET_SKIN },
107
+4 -1
--- src/cookies.c
+++ src/cookies.c
@@ -126,11 +126,14 @@
126126
for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
127127
if( zQVal==0 && (flags & COOKIE_READ)!=0 && i<cookies.nParam ){
128128
cgi_set_parameter_nocopy(zQP, cookies.aParam[i].zPValue, 1);
129129
return;
130130
}
131
- if( zQVal==0 ) zQVal = zDflt;
131
+ if( zQVal==0 ){
132
+ zQVal = zDflt;
133
+ if( flags & COOKIE_WRITE ) cgi_set_parameter_nocopy(zQP, zQVal, 1);
134
+ }
132135
if( (flags & COOKIE_WRITE)!=0
133136
&& i<COOKIE_NPARAM
134137
&& (i==cookies.nParam || strcmp(zQVal, cookies.aParam[i].zPValue))
135138
){
136139
if( i==cookies.nParam ){
137140
--- src/cookies.c
+++ src/cookies.c
@@ -126,11 +126,14 @@
126 for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
127 if( zQVal==0 && (flags & COOKIE_READ)!=0 && i<cookies.nParam ){
128 cgi_set_parameter_nocopy(zQP, cookies.aParam[i].zPValue, 1);
129 return;
130 }
131 if( zQVal==0 ) zQVal = zDflt;
 
 
 
132 if( (flags & COOKIE_WRITE)!=0
133 && i<COOKIE_NPARAM
134 && (i==cookies.nParam || strcmp(zQVal, cookies.aParam[i].zPValue))
135 ){
136 if( i==cookies.nParam ){
137
--- src/cookies.c
+++ src/cookies.c
@@ -126,11 +126,14 @@
126 for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
127 if( zQVal==0 && (flags & COOKIE_READ)!=0 && i<cookies.nParam ){
128 cgi_set_parameter_nocopy(zQP, cookies.aParam[i].zPValue, 1);
129 return;
130 }
131 if( zQVal==0 ){
132 zQVal = zDflt;
133 if( flags & COOKIE_WRITE ) cgi_set_parameter_nocopy(zQP, zQVal, 1);
134 }
135 if( (flags & COOKIE_WRITE)!=0
136 && i<COOKIE_NPARAM
137 && (i==cookies.nParam || strcmp(zQVal, cookies.aParam[i].zPValue))
138 ){
139 if( i==cookies.nParam ){
140
+13 -2
--- src/timeline.c
+++ src/timeline.c
@@ -1200,19 +1200,30 @@
12001200
}
12011201
if( i>2 ){
12021202
style_submenu_multichoice("y", i/2, az, isDisabled);
12031203
}
12041204
}
1205
+
1206
+/*
1207
+** Return the default value for the "ss" cookie or query parameter.
1208
+** The "ss" cookie determines the graph style. See the
1209
+** timeline_view_styles[] global constant for a list of choices.
1210
+*/
1211
+const char *timeline_default_ss(void){
1212
+ static const char *zSs = 0;
1213
+ if( zSs==0 ) zSs = db_get("timeline-default-style","m");
1214
+ return zSs;
1215
+}
12051216
12061217
/*
12071218
** Convert the current "ss" display preferences cookie into an
12081219
** appropriate TIMELINE_* flag
12091220
*/
12101221
int timeline_ss_cookie(void){
12111222
int tmFlags;
12121223
const char *v = cookie_value("ss",0);
1213
- if( v==0 ) v = db_get("timeline-default-style","m");
1224
+ if( v==0 ) v = timeline_default_ss();
12141225
switch( v[0] ){
12151226
case 'c': tmFlags = TIMELINE_COMPACT; break;
12161227
case 'v': tmFlags = TIMELINE_VERBOSE; break;
12171228
case 'j': tmFlags = TIMELINE_COLUMNAR; break;
12181229
case 'x': tmFlags = TIMELINE_CLASSIC; break;
@@ -1240,11 +1251,11 @@
12401251
** set the ss= parameter that determines the viewing mode.
12411252
**
12421253
** Return the TIMELINE_* value appropriate for the view-style.
12431254
*/
12441255
int timeline_ss_submenu(void){
1245
- cookie_link_parameter("ss","ss",db_get("timeline-default-style","m"));
1256
+ cookie_link_parameter("ss","ss",timeline_default_ss());
12461257
style_submenu_multichoice("ss",
12471258
N_TIMELINE_VIEW_STYLE,
12481259
timeline_view_styles, 0);
12491260
return timeline_ss_cookie();
12501261
}
12511262
--- src/timeline.c
+++ src/timeline.c
@@ -1200,19 +1200,30 @@
1200 }
1201 if( i>2 ){
1202 style_submenu_multichoice("y", i/2, az, isDisabled);
1203 }
1204 }
 
 
 
 
 
 
 
 
 
 
 
1205
1206 /*
1207 ** Convert the current "ss" display preferences cookie into an
1208 ** appropriate TIMELINE_* flag
1209 */
1210 int timeline_ss_cookie(void){
1211 int tmFlags;
1212 const char *v = cookie_value("ss",0);
1213 if( v==0 ) v = db_get("timeline-default-style","m");
1214 switch( v[0] ){
1215 case 'c': tmFlags = TIMELINE_COMPACT; break;
1216 case 'v': tmFlags = TIMELINE_VERBOSE; break;
1217 case 'j': tmFlags = TIMELINE_COLUMNAR; break;
1218 case 'x': tmFlags = TIMELINE_CLASSIC; break;
@@ -1240,11 +1251,11 @@
1240 ** set the ss= parameter that determines the viewing mode.
1241 **
1242 ** Return the TIMELINE_* value appropriate for the view-style.
1243 */
1244 int timeline_ss_submenu(void){
1245 cookie_link_parameter("ss","ss",db_get("timeline-default-style","m"));
1246 style_submenu_multichoice("ss",
1247 N_TIMELINE_VIEW_STYLE,
1248 timeline_view_styles, 0);
1249 return timeline_ss_cookie();
1250 }
1251
--- src/timeline.c
+++ src/timeline.c
@@ -1200,19 +1200,30 @@
1200 }
1201 if( i>2 ){
1202 style_submenu_multichoice("y", i/2, az, isDisabled);
1203 }
1204 }
1205
1206 /*
1207 ** Return the default value for the "ss" cookie or query parameter.
1208 ** The "ss" cookie determines the graph style. See the
1209 ** timeline_view_styles[] global constant for a list of choices.
1210 */
1211 const char *timeline_default_ss(void){
1212 static const char *zSs = 0;
1213 if( zSs==0 ) zSs = db_get("timeline-default-style","m");
1214 return zSs;
1215 }
1216
1217 /*
1218 ** Convert the current "ss" display preferences cookie into an
1219 ** appropriate TIMELINE_* flag
1220 */
1221 int timeline_ss_cookie(void){
1222 int tmFlags;
1223 const char *v = cookie_value("ss",0);
1224 if( v==0 ) v = timeline_default_ss();
1225 switch( v[0] ){
1226 case 'c': tmFlags = TIMELINE_COMPACT; break;
1227 case 'v': tmFlags = TIMELINE_VERBOSE; break;
1228 case 'j': tmFlags = TIMELINE_COLUMNAR; break;
1229 case 'x': tmFlags = TIMELINE_CLASSIC; break;
@@ -1240,11 +1251,11 @@
1251 ** set the ss= parameter that determines the viewing mode.
1252 **
1253 ** Return the TIMELINE_* value appropriate for the view-style.
1254 */
1255 int timeline_ss_submenu(void){
1256 cookie_link_parameter("ss","ss",timeline_default_ss());
1257 style_submenu_multichoice("ss",
1258 N_TIMELINE_VIEW_STYLE,
1259 timeline_view_styles, 0);
1260 return timeline_ss_cookie();
1261 }
1262

Keyboard Shortcuts

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