Fossil SCM

All timelines use the "ss" display preferences cookie.

drh 2017-11-29 14:02 sticky-timeline-style
Commit 6314b4ed94380d0e8982206808d0916a971db515061bf09a012fcbd489f2a491
+28 -17
--- src/cookies.c
+++ src/cookies.c
@@ -16,32 +16,29 @@
1616
*******************************************************************************
1717
**
1818
** This file contains code used to manage a cookie that stores user-specific
1919
** display preferences for the web interface.
2020
**
21
-** cookie_parse(zNameOfCookie);
21
+** cookie_parse(void);
2222
**
23
-** Identify a cookie that will be used to remember display choices
24
-** made by the user, so that those same choices are selected automatically
25
-** the next time the page is presented. This routine must be invoked
26
-** first, to initialize this module.
23
+** Read and parse the display preferences cookie.
2724
**
2825
** cookie_read_parameter(zQP, zPName);
2926
**
3027
** If query parameter zQP does not exist but zPName does exist in
3128
** the parsed cookie, then initialize zQP to hold the same value
3229
** as the zPName element in the parsed cookie.
3330
**
34
-** cookie_write_parameter(zQP, zPName);
31
+** cookie_write_parameter(zQP, zPName, zDefault);
3532
**
3633
** If query parameter zQP exists and if it has a different value from
3734
** the zPName parameter in the parsed cookie, then replace the value of
3835
** zPName with the value of zQP. If zQP exists but zPName does not
3936
** exist, then zPName is created. If zQP does not exist or if it has
4037
** the same value as zPName, then this routine is a no-op.
4138
**
42
-** cookie_link_parameter(zQP, zPName);
39
+** cookie_link_parameter(zQP, zPName, zDefault);
4340
**
4441
** This does both cookie_read_parameter() and cookie_write_parameter()
4542
** all at once.
4643
**
4744
** cookie_render();
@@ -49,10 +46,15 @@
4946
** If any prior calls to cookie_write_parameter() have changed the
5047
** value of the user preferences cookie, this routine will cause the
5148
** new cookie value to be included in the HTTP header for the current
5249
** web page. This routine is a destructor for this module and should
5350
** be called once.
51
+**
52
+** char *cookie_value(zPName, zDefault);
53
+**
54
+** Look up the value of a cookie parameter zPName. Return zDefault if
55
+** there is no display preferences cookie or if zPName does not exist.
5456
*/
5557
#include "cookies.h"
5658
#include <assert.h>
5759
#include <string.h>
5860
@@ -65,13 +67,13 @@
6567
/*
6668
** State information private to this module
6769
*/
6870
#define COOKIE_NPARAM 10
6971
static struct {
70
- const char *zCookieName; /* name of the user preferences cookie */
7172
char *zCookieValue; /* Value of the user preferences cookie */
7273
int bChanged; /* True if any value has changed */
74
+ int bIsInit; /* True after initialization */
7375
int nParam; /* Number of parameters in the cookie */
7476
struct {
7577
const char *zPName; /* Name of a parameter */
7678
char *zPValue; /* Value of that parameter */
7779
} aParam[COOKIE_NPARAM];
@@ -78,17 +80,17 @@
7880
} cookies;
7981
8082
/* Initialize this module by parsing the content of the cookie named
8183
** by zCookieName
8284
*/
83
-void cookie_parse(const char *zCookieName){
85
+void cookie_parse(void){
8486
char *z;
85
- assert( cookies.zCookieName==0 );
86
- cookies.zCookieName = zCookieName;
87
- z = (char*)P(zCookieName);
87
+ if( cookies.bIsInit ) return;
88
+ z = (char*)P(DISPLAY_SETTINGS_COOKIE);
8889
if( z==0 ) z = "";
8990
cookies.zCookieValue = z = mprintf("%s", z);
91
+ cookies.bIsInit = 1;
9092
while( cookies.nParam<COOKIE_NPARAM ){
9193
while( fossil_isspace(z[0]) ) z++;
9294
if( z[0]==0 ) break;
9395
cookies.aParam[cookies.nParam].zPName = z;
9496
while( *z && *z!='=' && *z!=',' ){ z++; }
@@ -118,11 +120,11 @@
118120
const char *zDflt, /* Default value for the query parameter */
119121
int flags /* READ or WRITE or both */
120122
){
121123
const char *zQVal = P(zQP);
122124
int i;
123
- assert( cookies.zCookieName!=0 );
125
+ cookie_parse();
124126
for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
125127
if( zQVal==0 && (flags & COOKIE_READ)!=0 && i<cookies.nParam ){
126128
cgi_set_parameter_nocopy(zQP, cookies.aParam[i].zPValue, 1);
127129
return;
128130
}
@@ -171,23 +173,32 @@
171173
172174
/* Update the user preferences cookie, if necessary, and shut down this
173175
** module
174176
*/
175177
void cookie_render(void){
176
- assert( cookies.zCookieName!=0 );
177178
if( cookies.bChanged ){
178179
Blob new;
179180
int i;
180181
blob_init(&new, 0, 0);
181182
for(i=0;i<cookies.nParam;i++){
182183
if( i>0 ) blob_append(&new, ",", 1);
183184
blob_appendf(&new, "%s=%T",
184185
cookies.aParam[i].zPName, cookies.aParam[i].zPValue);
185186
}
186
- cgi_set_cookie(cookies.zCookieName, blob_str(&new), 0, 31536000);
187
+ cgi_set_cookie(DISPLAY_SETTINGS_COOKIE, blob_str(&new), 0, 31536000);
187188
}
188
- cookies.zCookieName = 0;
189
+ cookies.bIsInit = 0;
190
+}
191
+
192
+/* Return the value of a preference cookie.
193
+*/
194
+const char *cookie_value(const char *zPName, const char *zDefault){
195
+ int i;
196
+ assert( zPName!=0 );
197
+ cookie_parse();
198
+ for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
199
+ return i<cookies.nParam ? cookies.aParam[i].zPValue : zDefault;
189200
}
190201
191202
/*
192203
** WEBPAGE: cookies
193204
**
@@ -198,11 +209,11 @@
198209
int i;
199210
if( PB("clear") ){
200211
cgi_set_cookie(DISPLAY_SETTINGS_COOKIE, "", 0, 1);
201212
cgi_replace_parameter(DISPLAY_SETTINGS_COOKIE, "");
202213
}
203
- cookie_parse(DISPLAY_SETTINGS_COOKIE);
214
+ cookie_parse();
204215
style_header("User Preference Cookie Values");
205216
if( cookies.nParam ){
206217
style_submenu_element("Clear", "%R/cookies?clear");
207218
}
208219
@ <p>The following are user preference settings held in the
209220
--- src/cookies.c
+++ src/cookies.c
@@ -16,32 +16,29 @@
16 *******************************************************************************
17 **
18 ** This file contains code used to manage a cookie that stores user-specific
19 ** display preferences for the web interface.
20 **
21 ** cookie_parse(zNameOfCookie);
22 **
23 ** Identify a cookie that will be used to remember display choices
24 ** made by the user, so that those same choices are selected automatically
25 ** the next time the page is presented. This routine must be invoked
26 ** first, to initialize this module.
27 **
28 ** cookie_read_parameter(zQP, zPName);
29 **
30 ** If query parameter zQP does not exist but zPName does exist in
31 ** the parsed cookie, then initialize zQP to hold the same value
32 ** as the zPName element in the parsed cookie.
33 **
34 ** cookie_write_parameter(zQP, zPName);
35 **
36 ** If query parameter zQP exists and if it has a different value from
37 ** the zPName parameter in the parsed cookie, then replace the value of
38 ** zPName with the value of zQP. If zQP exists but zPName does not
39 ** exist, then zPName is created. If zQP does not exist or if it has
40 ** the same value as zPName, then this routine is a no-op.
41 **
42 ** cookie_link_parameter(zQP, zPName);
43 **
44 ** This does both cookie_read_parameter() and cookie_write_parameter()
45 ** all at once.
46 **
47 ** cookie_render();
@@ -49,10 +46,15 @@
49 ** If any prior calls to cookie_write_parameter() have changed the
50 ** value of the user preferences cookie, this routine will cause the
51 ** new cookie value to be included in the HTTP header for the current
52 ** web page. This routine is a destructor for this module and should
53 ** be called once.
 
 
 
 
 
54 */
55 #include "cookies.h"
56 #include <assert.h>
57 #include <string.h>
58
@@ -65,13 +67,13 @@
65 /*
66 ** State information private to this module
67 */
68 #define COOKIE_NPARAM 10
69 static struct {
70 const char *zCookieName; /* name of the user preferences cookie */
71 char *zCookieValue; /* Value of the user preferences cookie */
72 int bChanged; /* True if any value has changed */
 
73 int nParam; /* Number of parameters in the cookie */
74 struct {
75 const char *zPName; /* Name of a parameter */
76 char *zPValue; /* Value of that parameter */
77 } aParam[COOKIE_NPARAM];
@@ -78,17 +80,17 @@
78 } cookies;
79
80 /* Initialize this module by parsing the content of the cookie named
81 ** by zCookieName
82 */
83 void cookie_parse(const char *zCookieName){
84 char *z;
85 assert( cookies.zCookieName==0 );
86 cookies.zCookieName = zCookieName;
87 z = (char*)P(zCookieName);
88 if( z==0 ) z = "";
89 cookies.zCookieValue = z = mprintf("%s", z);
 
90 while( cookies.nParam<COOKIE_NPARAM ){
91 while( fossil_isspace(z[0]) ) z++;
92 if( z[0]==0 ) break;
93 cookies.aParam[cookies.nParam].zPName = z;
94 while( *z && *z!='=' && *z!=',' ){ z++; }
@@ -118,11 +120,11 @@
118 const char *zDflt, /* Default value for the query parameter */
119 int flags /* READ or WRITE or both */
120 ){
121 const char *zQVal = P(zQP);
122 int i;
123 assert( cookies.zCookieName!=0 );
124 for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
125 if( zQVal==0 && (flags & COOKIE_READ)!=0 && i<cookies.nParam ){
126 cgi_set_parameter_nocopy(zQP, cookies.aParam[i].zPValue, 1);
127 return;
128 }
@@ -171,23 +173,32 @@
171
172 /* Update the user preferences cookie, if necessary, and shut down this
173 ** module
174 */
175 void cookie_render(void){
176 assert( cookies.zCookieName!=0 );
177 if( cookies.bChanged ){
178 Blob new;
179 int i;
180 blob_init(&new, 0, 0);
181 for(i=0;i<cookies.nParam;i++){
182 if( i>0 ) blob_append(&new, ",", 1);
183 blob_appendf(&new, "%s=%T",
184 cookies.aParam[i].zPName, cookies.aParam[i].zPValue);
185 }
186 cgi_set_cookie(cookies.zCookieName, blob_str(&new), 0, 31536000);
187 }
188 cookies.zCookieName = 0;
 
 
 
 
 
 
 
 
 
 
189 }
190
191 /*
192 ** WEBPAGE: cookies
193 **
@@ -198,11 +209,11 @@
198 int i;
199 if( PB("clear") ){
200 cgi_set_cookie(DISPLAY_SETTINGS_COOKIE, "", 0, 1);
201 cgi_replace_parameter(DISPLAY_SETTINGS_COOKIE, "");
202 }
203 cookie_parse(DISPLAY_SETTINGS_COOKIE);
204 style_header("User Preference Cookie Values");
205 if( cookies.nParam ){
206 style_submenu_element("Clear", "%R/cookies?clear");
207 }
208 @ <p>The following are user preference settings held in the
209
--- src/cookies.c
+++ src/cookies.c
@@ -16,32 +16,29 @@
16 *******************************************************************************
17 **
18 ** This file contains code used to manage a cookie that stores user-specific
19 ** display preferences for the web interface.
20 **
21 ** cookie_parse(void);
22 **
23 ** Read and parse the display preferences cookie.
 
 
 
24 **
25 ** cookie_read_parameter(zQP, zPName);
26 **
27 ** If query parameter zQP does not exist but zPName does exist in
28 ** the parsed cookie, then initialize zQP to hold the same value
29 ** as the zPName element in the parsed cookie.
30 **
31 ** cookie_write_parameter(zQP, zPName, zDefault);
32 **
33 ** If query parameter zQP exists and if it has a different value from
34 ** the zPName parameter in the parsed cookie, then replace the value of
35 ** zPName with the value of zQP. If zQP exists but zPName does not
36 ** exist, then zPName is created. If zQP does not exist or if it has
37 ** the same value as zPName, then this routine is a no-op.
38 **
39 ** cookie_link_parameter(zQP, zPName, zDefault);
40 **
41 ** This does both cookie_read_parameter() and cookie_write_parameter()
42 ** all at once.
43 **
44 ** cookie_render();
@@ -49,10 +46,15 @@
46 ** If any prior calls to cookie_write_parameter() have changed the
47 ** value of the user preferences cookie, this routine will cause the
48 ** new cookie value to be included in the HTTP header for the current
49 ** web page. This routine is a destructor for this module and should
50 ** be called once.
51 **
52 ** char *cookie_value(zPName, zDefault);
53 **
54 ** Look up the value of a cookie parameter zPName. Return zDefault if
55 ** there is no display preferences cookie or if zPName does not exist.
56 */
57 #include "cookies.h"
58 #include <assert.h>
59 #include <string.h>
60
@@ -65,13 +67,13 @@
67 /*
68 ** State information private to this module
69 */
70 #define COOKIE_NPARAM 10
71 static struct {
 
72 char *zCookieValue; /* Value of the user preferences cookie */
73 int bChanged; /* True if any value has changed */
74 int bIsInit; /* True after initialization */
75 int nParam; /* Number of parameters in the cookie */
76 struct {
77 const char *zPName; /* Name of a parameter */
78 char *zPValue; /* Value of that parameter */
79 } aParam[COOKIE_NPARAM];
@@ -78,17 +80,17 @@
80 } cookies;
81
82 /* Initialize this module by parsing the content of the cookie named
83 ** by zCookieName
84 */
85 void cookie_parse(void){
86 char *z;
87 if( cookies.bIsInit ) return;
88 z = (char*)P(DISPLAY_SETTINGS_COOKIE);
 
89 if( z==0 ) z = "";
90 cookies.zCookieValue = z = mprintf("%s", z);
91 cookies.bIsInit = 1;
92 while( cookies.nParam<COOKIE_NPARAM ){
93 while( fossil_isspace(z[0]) ) z++;
94 if( z[0]==0 ) break;
95 cookies.aParam[cookies.nParam].zPName = z;
96 while( *z && *z!='=' && *z!=',' ){ z++; }
@@ -118,11 +120,11 @@
120 const char *zDflt, /* Default value for the query parameter */
121 int flags /* READ or WRITE or both */
122 ){
123 const char *zQVal = P(zQP);
124 int i;
125 cookie_parse();
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 }
@@ -171,23 +173,32 @@
173
174 /* Update the user preferences cookie, if necessary, and shut down this
175 ** module
176 */
177 void cookie_render(void){
 
178 if( cookies.bChanged ){
179 Blob new;
180 int i;
181 blob_init(&new, 0, 0);
182 for(i=0;i<cookies.nParam;i++){
183 if( i>0 ) blob_append(&new, ",", 1);
184 blob_appendf(&new, "%s=%T",
185 cookies.aParam[i].zPName, cookies.aParam[i].zPValue);
186 }
187 cgi_set_cookie(DISPLAY_SETTINGS_COOKIE, blob_str(&new), 0, 31536000);
188 }
189 cookies.bIsInit = 0;
190 }
191
192 /* Return the value of a preference cookie.
193 */
194 const char *cookie_value(const char *zPName, const char *zDefault){
195 int i;
196 assert( zPName!=0 );
197 cookie_parse();
198 for(i=0; i<cookies.nParam && strcmp(zPName,cookies.aParam[i].zPName); i++){}
199 return i<cookies.nParam ? cookies.aParam[i].zPValue : zDefault;
200 }
201
202 /*
203 ** WEBPAGE: cookies
204 **
@@ -198,11 +209,11 @@
209 int i;
210 if( PB("clear") ){
211 cgi_set_cookie(DISPLAY_SETTINGS_COOKIE, "", 0, 1);
212 cgi_replace_parameter(DISPLAY_SETTINGS_COOKIE, "");
213 }
214 cookie_parse();
215 style_header("User Preference Cookie Values");
216 if( cookies.nParam ){
217 style_submenu_element("Clear", "%R/cookies?clear");
218 }
219 @ <p>The following are user preference settings held in the
220
--- src/finfo.c
+++ src/finfo.c
@@ -325,11 +325,10 @@
325325
326326
login_check_credentials();
327327
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
328328
style_header("File History");
329329
login_anonymous_available();
330
- cookie_parse(DISPLAY_SETTINGS_COOKIE);
331330
tmFlags = timeline_ss_submenu();
332331
if( tmFlags & TIMELINE_COLUMNAR ){
333332
zStyle = "Columnar";
334333
}else if( tmFlags & TIMELINE_COMPACT ){
335334
zStyle = "Compact";
336335
--- src/finfo.c
+++ src/finfo.c
@@ -325,11 +325,10 @@
325
326 login_check_credentials();
327 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
328 style_header("File History");
329 login_anonymous_available();
330 cookie_parse(DISPLAY_SETTINGS_COOKIE);
331 tmFlags = timeline_ss_submenu();
332 if( tmFlags & TIMELINE_COLUMNAR ){
333 zStyle = "Columnar";
334 }else if( tmFlags & TIMELINE_COMPACT ){
335 zStyle = "Compact";
336
--- src/finfo.c
+++ src/finfo.c
@@ -325,11 +325,10 @@
325
326 login_check_credentials();
327 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
328 style_header("File History");
329 login_anonymous_available();
 
330 tmFlags = timeline_ss_submenu();
331 if( tmFlags & TIMELINE_COLUMNAR ){
332 zStyle = "Columnar";
333 }else if( tmFlags & TIMELINE_COMPACT ){
334 zStyle = "Compact";
335
+20 -10
--- src/timeline.c
+++ src/timeline.c
@@ -105,12 +105,13 @@
105105
#define TIMELINE_UNHIDE 0x0200 /* Unhide check-ins with "hidden" tag */
106106
#define TIMELINE_SHOWRID 0x0400 /* Show RID values in addition to UUIDs */
107107
#define TIMELINE_BISECT 0x0800 /* Show supplimental bisect information */
108108
#define TIMELINE_COMPACT 0x1000 /* Use the "compact" view style */
109109
#define TIMELINE_VERBOSE 0x2000 /* Use the "detailed" view style */
110
-#define TIMELINE_MODERN 0x4000 /* Use the "normal" view style */
110
+#define TIMELINE_MODERN 0x4000 /* Use the "modern" view style */
111111
#define TIMELINE_COLUMNAR 0x8000 /* Use the "columns view style */
112
+#define TIMELINE_VIEWS 0xf000 /* Mask for all of the view styles */
112113
#endif
113114
114115
/*
115116
** Hash a string and use the hash to determine a background color.
116117
*/
@@ -263,10 +264,13 @@
263264
}
264265
zPrevDate[0] = 0;
265266
mxWikiLen = db_get_int("timeline-max-comment", 0);
266267
dateFormat = db_get_int("timeline-date-format", 0);
267268
bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
269
+ if( (tmFlags & TIMELINE_VIEWS)==0 ){
270
+ tmFlags |= timeline_ss_cookie();
271
+ }
268272
if( tmFlags & TIMELINE_COLUMNAR ){
269273
zStyle = "Columnar";
270274
}else if( tmFlags & TIMELINE_COMPACT ){
271275
zStyle = "Compact";
272276
}else if( tmFlags & TIMELINE_VERBOSE ){
@@ -1324,10 +1328,24 @@
13241328
}
13251329
if( i>2 ){
13261330
style_submenu_multichoice("y", i/2, az, isDisabled);
13271331
}
13281332
}
1333
+
1334
+/*
1335
+** Convert the current "ss" display preferences cookie into an appropriate TIMELINE_* flag
1336
+*/
1337
+int timeline_ss_cookie(void){
1338
+ int tmFlags;
1339
+ switch( cookie_value("ss","m")[0] ){
1340
+ case 'c': tmFlags = TIMELINE_COMPACT; break;
1341
+ case 'v': tmFlags = TIMELINE_VERBOSE; break;
1342
+ case 'j': tmFlags = TIMELINE_COLUMNAR; break;
1343
+ default: tmFlags = TIMELINE_MODERN; break;
1344
+ }
1345
+ return tmFlags;
1346
+}
13291347
13301348
/*
13311349
** Add the select/option box to the timeline submenu that is used to
13321350
** set the ss= parameter that determines the viewing mode.
13331351
**
@@ -1338,20 +1356,13 @@
13381356
"m", "Modern View",
13391357
"c", "Compact View",
13401358
"v", "Verbose View",
13411359
"j", "Columnar View",
13421360
};
1343
- int tmFlags;
13441361
cookie_link_parameter("ss","ss","m");
13451362
style_submenu_multichoice("ss", 4, azViewStyles, 0);
1346
- switch( PD("ss","m")[0] ){
1347
- case 'c': tmFlags = TIMELINE_COMPACT; break;
1348
- case 'v': tmFlags = TIMELINE_VERBOSE; break;
1349
- case 'j': tmFlags = TIMELINE_COLUMNAR; break;
1350
- default: tmFlags = TIMELINE_MODERN; break;
1351
- }
1352
- return tmFlags;
1363
+ return timeline_ss_cookie();
13531364
}
13541365
13551366
/*
13561367
** If the zChng string is not NULL, then it should be a comma-separated
13571368
** list of glob patterns for filenames. Add an term to the WHERE clause
@@ -1692,11 +1703,10 @@
16921703
char *zNewerButton = 0; /* URL for Newer button at the top */
16931704
int selectedRid = -9999999; /* Show a highlight on this RID */
16941705
int disableY = 0; /* Disable type selector on submenu */
16951706
16961707
/* Set number of rows to display */
1697
- cookie_parse(DISPLAY_SETTINGS_COOKIE);
16981708
cookie_read_parameter("n","n");
16991709
z = P("n");
17001710
if( z==0 ) z = db_get("timeline-default-length",0);
17011711
if( z ){
17021712
if( fossil_strcmp(z,"all")==0 ){
17031713
--- src/timeline.c
+++ src/timeline.c
@@ -105,12 +105,13 @@
105 #define TIMELINE_UNHIDE 0x0200 /* Unhide check-ins with "hidden" tag */
106 #define TIMELINE_SHOWRID 0x0400 /* Show RID values in addition to UUIDs */
107 #define TIMELINE_BISECT 0x0800 /* Show supplimental bisect information */
108 #define TIMELINE_COMPACT 0x1000 /* Use the "compact" view style */
109 #define TIMELINE_VERBOSE 0x2000 /* Use the "detailed" view style */
110 #define TIMELINE_MODERN 0x4000 /* Use the "normal" view style */
111 #define TIMELINE_COLUMNAR 0x8000 /* Use the "columns view style */
 
112 #endif
113
114 /*
115 ** Hash a string and use the hash to determine a background color.
116 */
@@ -263,10 +264,13 @@
263 }
264 zPrevDate[0] = 0;
265 mxWikiLen = db_get_int("timeline-max-comment", 0);
266 dateFormat = db_get_int("timeline-date-format", 0);
267 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
 
 
 
268 if( tmFlags & TIMELINE_COLUMNAR ){
269 zStyle = "Columnar";
270 }else if( tmFlags & TIMELINE_COMPACT ){
271 zStyle = "Compact";
272 }else if( tmFlags & TIMELINE_VERBOSE ){
@@ -1324,10 +1328,24 @@
1324 }
1325 if( i>2 ){
1326 style_submenu_multichoice("y", i/2, az, isDisabled);
1327 }
1328 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1329
1330 /*
1331 ** Add the select/option box to the timeline submenu that is used to
1332 ** set the ss= parameter that determines the viewing mode.
1333 **
@@ -1338,20 +1356,13 @@
1338 "m", "Modern View",
1339 "c", "Compact View",
1340 "v", "Verbose View",
1341 "j", "Columnar View",
1342 };
1343 int tmFlags;
1344 cookie_link_parameter("ss","ss","m");
1345 style_submenu_multichoice("ss", 4, azViewStyles, 0);
1346 switch( PD("ss","m")[0] ){
1347 case 'c': tmFlags = TIMELINE_COMPACT; break;
1348 case 'v': tmFlags = TIMELINE_VERBOSE; break;
1349 case 'j': tmFlags = TIMELINE_COLUMNAR; break;
1350 default: tmFlags = TIMELINE_MODERN; break;
1351 }
1352 return tmFlags;
1353 }
1354
1355 /*
1356 ** If the zChng string is not NULL, then it should be a comma-separated
1357 ** list of glob patterns for filenames. Add an term to the WHERE clause
@@ -1692,11 +1703,10 @@
1692 char *zNewerButton = 0; /* URL for Newer button at the top */
1693 int selectedRid = -9999999; /* Show a highlight on this RID */
1694 int disableY = 0; /* Disable type selector on submenu */
1695
1696 /* Set number of rows to display */
1697 cookie_parse(DISPLAY_SETTINGS_COOKIE);
1698 cookie_read_parameter("n","n");
1699 z = P("n");
1700 if( z==0 ) z = db_get("timeline-default-length",0);
1701 if( z ){
1702 if( fossil_strcmp(z,"all")==0 ){
1703
--- src/timeline.c
+++ src/timeline.c
@@ -105,12 +105,13 @@
105 #define TIMELINE_UNHIDE 0x0200 /* Unhide check-ins with "hidden" tag */
106 #define TIMELINE_SHOWRID 0x0400 /* Show RID values in addition to UUIDs */
107 #define TIMELINE_BISECT 0x0800 /* Show supplimental bisect information */
108 #define TIMELINE_COMPACT 0x1000 /* Use the "compact" view style */
109 #define TIMELINE_VERBOSE 0x2000 /* Use the "detailed" view style */
110 #define TIMELINE_MODERN 0x4000 /* Use the "modern" view style */
111 #define TIMELINE_COLUMNAR 0x8000 /* Use the "columns view style */
112 #define TIMELINE_VIEWS 0xf000 /* Mask for all of the view styles */
113 #endif
114
115 /*
116 ** Hash a string and use the hash to determine a background color.
117 */
@@ -263,10 +264,13 @@
264 }
265 zPrevDate[0] = 0;
266 mxWikiLen = db_get_int("timeline-max-comment", 0);
267 dateFormat = db_get_int("timeline-date-format", 0);
268 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
269 if( (tmFlags & TIMELINE_VIEWS)==0 ){
270 tmFlags |= timeline_ss_cookie();
271 }
272 if( tmFlags & TIMELINE_COLUMNAR ){
273 zStyle = "Columnar";
274 }else if( tmFlags & TIMELINE_COMPACT ){
275 zStyle = "Compact";
276 }else if( tmFlags & TIMELINE_VERBOSE ){
@@ -1324,10 +1328,24 @@
1328 }
1329 if( i>2 ){
1330 style_submenu_multichoice("y", i/2, az, isDisabled);
1331 }
1332 }
1333
1334 /*
1335 ** Convert the current "ss" display preferences cookie into an appropriate TIMELINE_* flag
1336 */
1337 int timeline_ss_cookie(void){
1338 int tmFlags;
1339 switch( cookie_value("ss","m")[0] ){
1340 case 'c': tmFlags = TIMELINE_COMPACT; break;
1341 case 'v': tmFlags = TIMELINE_VERBOSE; break;
1342 case 'j': tmFlags = TIMELINE_COLUMNAR; break;
1343 default: tmFlags = TIMELINE_MODERN; break;
1344 }
1345 return tmFlags;
1346 }
1347
1348 /*
1349 ** Add the select/option box to the timeline submenu that is used to
1350 ** set the ss= parameter that determines the viewing mode.
1351 **
@@ -1338,20 +1356,13 @@
1356 "m", "Modern View",
1357 "c", "Compact View",
1358 "v", "Verbose View",
1359 "j", "Columnar View",
1360 };
 
1361 cookie_link_parameter("ss","ss","m");
1362 style_submenu_multichoice("ss", 4, azViewStyles, 0);
1363 return timeline_ss_cookie();
 
 
 
 
 
 
1364 }
1365
1366 /*
1367 ** If the zChng string is not NULL, then it should be a comma-separated
1368 ** list of glob patterns for filenames. Add an term to the WHERE clause
@@ -1692,11 +1703,10 @@
1703 char *zNewerButton = 0; /* URL for Newer button at the top */
1704 int selectedRid = -9999999; /* Show a highlight on this RID */
1705 int disableY = 0; /* Disable type selector on submenu */
1706
1707 /* Set number of rows to display */
 
1708 cookie_read_parameter("n","n");
1709 z = P("n");
1710 if( z==0 ) z = db_get("timeline-default-length",0);
1711 if( z ){
1712 if( fossil_strcmp(z,"all")==0 ){
1713

Keyboard Shortcuts

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