Fossil SCM

Improvements to the display of /brtimeline.

drh 2025-10-17 15:49 timeline-enhance-2025
Commit 8b00a97140e55d955fc8d9e046b1a07ddba6a36b61d1d16eae94bdbbfdad9b87
2 files changed +19 -28 +25 -18
+19 -28
--- src/branch.c
+++ src/branch.c
@@ -1025,34 +1025,30 @@
10251025
Stmt *pQuery, /* Current row of the timeline query */
10261026
int tmFlags, /* Flags to www_print_timeline() */
10271027
const char *zThisUser, /* Suppress links to this user */
10281028
const char *zThisTag /* Suppress links to this tag */
10291029
){
1030
- int rid = db_column_int(pQuery, 0);
1031
- Stmt q;
1030
+ int rid;
1031
+ int tmFlagsNew;
1032
+ char *zBrName;
1033
+
1034
+ if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
1035
+ tmFlagsNew = (tmFlags & ~TIMELINE_VIEWS) | TIMELINE_MODERN;
1036
+ cgi_printf("(");
1037
+ }else{
1038
+ tmFlagsNew = tmFlags;
1039
+ }
1040
+ timeline_extra(pQuery,tmFlagsNew,zThisUser,zThisTag);
1041
+
10321042
if( !g.perm.Hyperlink ) return;
1033
- db_prepare(&q,
1034
- "SELECT substr(tagname,5) FROM tagxref, tag"
1035
- " WHERE tagxref.rid=%d"
1036
- " AND tagxref.tagid=tag.tagid"
1037
- " AND tagxref.tagtype>0"
1038
- " AND tag.tagname GLOB 'sym-*'",
1039
- rid
1040
- );
1041
- while( db_step(&q)==SQLITE_ROW ){
1042
- const char *zTagName = db_column_text(&q, 0);
1043
-#define OLD_STYLE 1
1044
-#if OLD_STYLE
1045
- @ %z(href("%R/timeline?r=%T",zTagName))[timeline]</a>
1046
-#else
1047
- char *zBrName = branch_of_rid(rid);
1048
- @ <strong>%h(zBrName)</strong><br>\
1049
- @ %z(href("%R/timeline?r=%T",zTagName))<button>timeline</button></a>
1050
- fossil_free(zBrName);
1051
-#endif
1052
- }
1053
- db_finalize(&q);
1043
+ rid = db_column_int(pQuery,0);
1044
+ zBrName = branch_of_rid(rid);
1045
+ @ branch:&nbsp;<span class='timelineHash'>\
1046
+ @ %z(href("%R/timeline?r=%T",zBrName))%h(zBrName)</a></span>
1047
+ if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
1048
+ cgi_printf(")");
1049
+ }
10541050
}
10551051
10561052
/*
10571053
** WEBPAGE: brtimeline
10581054
**
@@ -1075,13 +1071,11 @@
10751071
10761072
style_set_current_feature("branch");
10771073
style_header("Branches");
10781074
style_submenu_element("Branch List", "brlist");
10791075
login_anonymous_available();
1080
-#if OLD_STYLE
10811076
timeline_ss_submenu();
1082
-#endif
10831077
cgi_check_for_malice();
10841078
@ <h2>First check-in for every branch, starting with the most recent
10851079
@ and going backwards in time.</h2>
10861080
blob_append(&sql, timeline_query_for_www(), -1);
10871081
blob_append_sql(&sql,
@@ -1097,13 +1091,10 @@
10971091
db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
10981092
blob_reset(&sql);
10991093
/* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too
11001094
** many descenders to (off-screen) parents. */
11011095
tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL;
1102
-#if !OLD_STYLE
1103
- tmFlags |= TIMELINE_COLUMNAR;
1104
-#endif
11051096
if( PB("ubg")!=0 ){
11061097
tmFlags |= TIMELINE_UCOLOR;
11071098
}else{
11081099
tmFlags |= TIMELINE_BRCOLOR;
11091100
}
11101101
--- src/branch.c
+++ src/branch.c
@@ -1025,34 +1025,30 @@
1025 Stmt *pQuery, /* Current row of the timeline query */
1026 int tmFlags, /* Flags to www_print_timeline() */
1027 const char *zThisUser, /* Suppress links to this user */
1028 const char *zThisTag /* Suppress links to this tag */
1029 ){
1030 int rid = db_column_int(pQuery, 0);
1031 Stmt q;
 
 
 
 
 
 
 
 
 
 
1032 if( !g.perm.Hyperlink ) return;
1033 db_prepare(&q,
1034 "SELECT substr(tagname,5) FROM tagxref, tag"
1035 " WHERE tagxref.rid=%d"
1036 " AND tagxref.tagid=tag.tagid"
1037 " AND tagxref.tagtype>0"
1038 " AND tag.tagname GLOB 'sym-*'",
1039 rid
1040 );
1041 while( db_step(&q)==SQLITE_ROW ){
1042 const char *zTagName = db_column_text(&q, 0);
1043 #define OLD_STYLE 1
1044 #if OLD_STYLE
1045 @ %z(href("%R/timeline?r=%T",zTagName))[timeline]</a>
1046 #else
1047 char *zBrName = branch_of_rid(rid);
1048 @ <strong>%h(zBrName)</strong><br>\
1049 @ %z(href("%R/timeline?r=%T",zTagName))<button>timeline</button></a>
1050 fossil_free(zBrName);
1051 #endif
1052 }
1053 db_finalize(&q);
1054 }
1055
1056 /*
1057 ** WEBPAGE: brtimeline
1058 **
@@ -1075,13 +1071,11 @@
1075
1076 style_set_current_feature("branch");
1077 style_header("Branches");
1078 style_submenu_element("Branch List", "brlist");
1079 login_anonymous_available();
1080 #if OLD_STYLE
1081 timeline_ss_submenu();
1082 #endif
1083 cgi_check_for_malice();
1084 @ <h2>First check-in for every branch, starting with the most recent
1085 @ and going backwards in time.</h2>
1086 blob_append(&sql, timeline_query_for_www(), -1);
1087 blob_append_sql(&sql,
@@ -1097,13 +1091,10 @@
1097 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
1098 blob_reset(&sql);
1099 /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too
1100 ** many descenders to (off-screen) parents. */
1101 tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL;
1102 #if !OLD_STYLE
1103 tmFlags |= TIMELINE_COLUMNAR;
1104 #endif
1105 if( PB("ubg")!=0 ){
1106 tmFlags |= TIMELINE_UCOLOR;
1107 }else{
1108 tmFlags |= TIMELINE_BRCOLOR;
1109 }
1110
--- src/branch.c
+++ src/branch.c
@@ -1025,34 +1025,30 @@
1025 Stmt *pQuery, /* Current row of the timeline query */
1026 int tmFlags, /* Flags to www_print_timeline() */
1027 const char *zThisUser, /* Suppress links to this user */
1028 const char *zThisTag /* Suppress links to this tag */
1029 ){
1030 int rid;
1031 int tmFlagsNew;
1032 char *zBrName;
1033
1034 if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
1035 tmFlagsNew = (tmFlags & ~TIMELINE_VIEWS) | TIMELINE_MODERN;
1036 cgi_printf("(");
1037 }else{
1038 tmFlagsNew = tmFlags;
1039 }
1040 timeline_extra(pQuery,tmFlagsNew,zThisUser,zThisTag);
1041
1042 if( !g.perm.Hyperlink ) return;
1043 rid = db_column_int(pQuery,0);
1044 zBrName = branch_of_rid(rid);
1045 @ branch:&nbsp;<span class='timelineHash'>\
1046 @ %z(href("%R/timeline?r=%T",zBrName))%h(zBrName)</a></span>
1047 if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
1048 cgi_printf(")");
1049 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1050 }
1051
1052 /*
1053 ** WEBPAGE: brtimeline
1054 **
@@ -1075,13 +1071,11 @@
1071
1072 style_set_current_feature("branch");
1073 style_header("Branches");
1074 style_submenu_element("Branch List", "brlist");
1075 login_anonymous_available();
 
1076 timeline_ss_submenu();
 
1077 cgi_check_for_malice();
1078 @ <h2>First check-in for every branch, starting with the most recent
1079 @ and going backwards in time.</h2>
1080 blob_append(&sql, timeline_query_for_www(), -1);
1081 blob_append_sql(&sql,
@@ -1097,13 +1091,10 @@
1091 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
1092 blob_reset(&sql);
1093 /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too
1094 ** many descenders to (off-screen) parents. */
1095 tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL;
 
 
 
1096 if( PB("ubg")!=0 ){
1097 tmFlags |= TIMELINE_UCOLOR;
1098 }else{
1099 tmFlags |= TIMELINE_BRCOLOR;
1100 }
1101
+25 -18
--- src/timeline.c
+++ src/timeline.c
@@ -198,12 +198,18 @@
198198
199199
if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
200200
cgi_printf("(");
201201
}
202202
203
-/* Set to 0 for historical appearance. Set to 1 or more for new looks */
204
-#define EXTRA_FORMAT 2
203
+ /* The EXTRA_FORMAT macro is an integer that controls various experiments
204
+ ** in the layout of the extra text.
205
+ **
206
+ ** 0 Legacy appearance.
207
+ ** 1 Deemphasize "Leaf" and "Closed-Leaf". Highlight check-in hash.
208
+ ** 2 Omit "Leaf"/"Closed-Leaf". But check-in hash at the end.
209
+ */
210
+#define EXTRA_FORMAT 1
205211
#if EXTRA_FORMAT==0
206212
if( (tmFlags & TIMELINE_CLASSIC)==0 ){
207213
if( zType[0]=='c' ){
208214
int isLeaf = db_column_int(pQuery, 5);
209215
if( isLeaf ){
@@ -225,11 +231,11 @@
225231
}else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
226232
|| zType[0]=='n' || zType[0]=='f'){
227233
cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
228234
}
229235
#endif /* EXTRA_FORMAT==0 */
230
-#if EXTRA_FORMAT==2
236
+#if EXTRA_FORMAT==1
231237
if( (tmFlags & TIMELINE_CLASSIC)==0 ){
232238
if( zType[0]=='c' ){
233239
int isLeaf = db_column_int(pQuery, 5);
234240
const char *zPrefix;
235241
if( isLeaf ){
@@ -249,11 +255,11 @@
249255
}
250256
}else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
251257
|| zType[0]=='n' || zType[0]=='f'){
252258
cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
253259
}
254
-#endif /* EXTRA_FORMAT==0 */
260
+#endif /* EXTRA_FORMAT==1 */
255261
256262
if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
257263
char *zLink;
258264
if( zType[0]!='f' || (tmFlags & TIMELINE_FORUMTXT)==0 ){
259265
zLink = mprintf("%R/timeline?u=%h&c=%t&y=a", zDispUser, zDate);
@@ -305,33 +311,34 @@
305311
href("%R/deltachain/%d",rid), rid);
306312
}
307313
}
308314
tag_private_status(rid);
309315
310
-#if EXTRA_FORMAT==1
316
+#if EXTRA_FORMAT==2
311317
if( (tmFlags & TIMELINE_CLASSIC)==0 ){
312
- if( zType[0]=='e' && tagid ){
313
- char *zId = db_text(0,
314
- "SELECT substr(tagname,7) FROM tag WHERE tagid=abs(%d)", tagid);
315
- cgi_printf(" technote:&nbsp;%z%S</a>",
316
- href("%R/technote/%t",zId), zId);
318
+ if( zType[0]=='c' ){
319
+ cgi_printf(" check-in:&nbsp;%z<span class='timelineHash'>"
320
+ "%S</span></a>",
321
+ href("%R/info/%!S",zUuid),zUuid);
322
+ }else if( zType[0]=='e' && tagid ){
323
+ cgi_printf(" technote:&nbsp;");
324
+ hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
317325
}else{
318
- cgi_printf(" hash:&nbsp;%z%S</a>", href("%R/info/%!S", zUuid), zUuid);
326
+ cgi_printf(" artifact:&nbsp;%z%S</a>",
327
+ href("%R/info/%!S",zUuid),zUuid);
319328
}
329
+ }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
330
+ || zType[0]=='n' || zType[0]=='f'){
331
+ cgi_printf(" artifact:&nbsp;%z%S</a>",href("%R/info/%!S",zUuid),zUuid);
320332
}
321
-#endif /* EXTRA_FORMAT==1 */
333
+#endif /* EXTRA_FORMAT==2 */
334
+
322335
323336
/* End timelineDetail */
324337
if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
325338
cgi_printf(")");
326339
}
327
-
328
- if( tmFlags & TIMELINE_COMPACT ){
329
- @ </span></span>
330
- }else{
331
- @ </span>
332
- }
333340
}
334341
335342
336343
/*
337344
** SETTING: timeline-truncate-at-blank boolean default=off
338345
--- src/timeline.c
+++ src/timeline.c
@@ -198,12 +198,18 @@
198
199 if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
200 cgi_printf("(");
201 }
202
203 /* Set to 0 for historical appearance. Set to 1 or more for new looks */
204 #define EXTRA_FORMAT 2
 
 
 
 
 
 
205 #if EXTRA_FORMAT==0
206 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
207 if( zType[0]=='c' ){
208 int isLeaf = db_column_int(pQuery, 5);
209 if( isLeaf ){
@@ -225,11 +231,11 @@
225 }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
226 || zType[0]=='n' || zType[0]=='f'){
227 cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
228 }
229 #endif /* EXTRA_FORMAT==0 */
230 #if EXTRA_FORMAT==2
231 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
232 if( zType[0]=='c' ){
233 int isLeaf = db_column_int(pQuery, 5);
234 const char *zPrefix;
235 if( isLeaf ){
@@ -249,11 +255,11 @@
249 }
250 }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
251 || zType[0]=='n' || zType[0]=='f'){
252 cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
253 }
254 #endif /* EXTRA_FORMAT==0 */
255
256 if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
257 char *zLink;
258 if( zType[0]!='f' || (tmFlags & TIMELINE_FORUMTXT)==0 ){
259 zLink = mprintf("%R/timeline?u=%h&c=%t&y=a", zDispUser, zDate);
@@ -305,33 +311,34 @@
305 href("%R/deltachain/%d",rid), rid);
306 }
307 }
308 tag_private_status(rid);
309
310 #if EXTRA_FORMAT==1
311 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
312 if( zType[0]=='e' && tagid ){
313 char *zId = db_text(0,
314 "SELECT substr(tagname,7) FROM tag WHERE tagid=abs(%d)", tagid);
315 cgi_printf(" technote:&nbsp;%z%S</a>",
316 href("%R/technote/%t",zId), zId);
 
 
317 }else{
318 cgi_printf(" hash:&nbsp;%z%S</a>", href("%R/info/%!S", zUuid), zUuid);
 
319 }
 
 
 
320 }
321 #endif /* EXTRA_FORMAT==1 */
 
322
323 /* End timelineDetail */
324 if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
325 cgi_printf(")");
326 }
327
328 if( tmFlags & TIMELINE_COMPACT ){
329 @ </span></span>
330 }else{
331 @ </span>
332 }
333 }
334
335
336 /*
337 ** SETTING: timeline-truncate-at-blank boolean default=off
338
--- src/timeline.c
+++ src/timeline.c
@@ -198,12 +198,18 @@
198
199 if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
200 cgi_printf("(");
201 }
202
203 /* The EXTRA_FORMAT macro is an integer that controls various experiments
204 ** in the layout of the extra text.
205 **
206 ** 0 Legacy appearance.
207 ** 1 Deemphasize "Leaf" and "Closed-Leaf". Highlight check-in hash.
208 ** 2 Omit "Leaf"/"Closed-Leaf". But check-in hash at the end.
209 */
210 #define EXTRA_FORMAT 1
211 #if EXTRA_FORMAT==0
212 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
213 if( zType[0]=='c' ){
214 int isLeaf = db_column_int(pQuery, 5);
215 if( isLeaf ){
@@ -225,11 +231,11 @@
231 }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
232 || zType[0]=='n' || zType[0]=='f'){
233 cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
234 }
235 #endif /* EXTRA_FORMAT==0 */
236 #if EXTRA_FORMAT==1
237 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
238 if( zType[0]=='c' ){
239 int isLeaf = db_column_int(pQuery, 5);
240 const char *zPrefix;
241 if( isLeaf ){
@@ -249,11 +255,11 @@
255 }
256 }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
257 || zType[0]=='n' || zType[0]=='f'){
258 cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
259 }
260 #endif /* EXTRA_FORMAT==1 */
261
262 if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
263 char *zLink;
264 if( zType[0]!='f' || (tmFlags & TIMELINE_FORUMTXT)==0 ){
265 zLink = mprintf("%R/timeline?u=%h&c=%t&y=a", zDispUser, zDate);
@@ -305,33 +311,34 @@
311 href("%R/deltachain/%d",rid), rid);
312 }
313 }
314 tag_private_status(rid);
315
316 #if EXTRA_FORMAT==2
317 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
318 if( zType[0]=='c' ){
319 cgi_printf(" check-in:&nbsp;%z<span class='timelineHash'>"
320 "%S</span></a>",
321 href("%R/info/%!S",zUuid),zUuid);
322 }else if( zType[0]=='e' && tagid ){
323 cgi_printf(" technote:&nbsp;");
324 hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
325 }else{
326 cgi_printf(" artifact:&nbsp;%z%S</a>",
327 href("%R/info/%!S",zUuid),zUuid);
328 }
329 }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
330 || zType[0]=='n' || zType[0]=='f'){
331 cgi_printf(" artifact:&nbsp;%z%S</a>",href("%R/info/%!S",zUuid),zUuid);
332 }
333 #endif /* EXTRA_FORMAT==2 */
334
335
336 /* End timelineDetail */
337 if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
338 cgi_printf(")");
339 }
 
 
 
 
 
 
340 }
341
342
343 /*
344 ** SETTING: timeline-truncate-at-blank boolean default=off
345

Keyboard Shortcuts

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