Fossil SCM

An attempt to get /download comments working on system that have timeline-plaintext set.

drh 2025-10-18 23:57 timeline-enhance-2025
Commit 8a7a38baf50ada768db47fbafab410197d2ffd46ac0a3b159526335ba0a6f7f0
1 file changed +6 -2
+6 -2
--- src/tar.c
+++ src/tar.c
@@ -1135,10 +1135,11 @@
11351135
int nItem; /* Number of terms in azItem[] */
11361136
int i; /* Loop counter */
11371137
int tmFlags; /* Timeline display flags */
11381138
int n; /* Number of suggested downloads */
11391139
double rNow; /* Current time. Julian day number */
1140
+ int bPlainTextCom; /* Use plain-text comments */
11401141
11411142
login_check_credentials();
11421143
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
11431144
11441145
style_set_current_feature("timeline");
@@ -1150,10 +1151,11 @@
11501151
);
11511152
rNow = db_double(0.0,"SELECT julianday()");
11521153
if( !g.interp ) Th_FossilInit(0);
11531154
Th_SplitList(g.interp, zTarlistCfg, (int)strlen(zTarlistCfg),
11541155
&azItem, &anItem, &nItem);
1156
+ bPlainTextCom = db_get_boolean("timeline-plaintext",0);
11551157
for(i=0; i<nItem-3; i+=4){
11561158
int cnt; /* The number of instances of zLabel to use */
11571159
char *zLabel; /* The label to match */
11581160
double rStart; /* Starting time, julian day number */
11591161
char *zComment = 0; /* Comment to apply */
@@ -1193,12 +1195,14 @@
11931195
rStart = rNow - r/86400.0;
11941196
}
11951197
}
11961198
if( anItem[i+3]==0 ){
11971199
zComment = fossil_strdup("");
1200
+ }else if( bPlainTextCom ){
1201
+ zComment = mprintf("** %.*s ** ", anItem[i+3], azItem[i+3]);
11981202
}else{
1199
- zComment = fossil_strndup(azItem[i+3],anItem[i+3]);
1203
+ zComment = mprintf("<b>%.*s</b>\n<p>", anItem[i+3], azItem[i+3]);
12001204
}
12011205
if( fossil_strcmp("OPEN-LEAF",zLabel)==0 ){
12021206
db_multi_exec(
12031207
"INSERT OR IGNORE INTO tarlist(rid,com)"
12041208
" SELECT leaf.rid, %Q FROM leaf, event"
@@ -1236,11 +1240,11 @@
12361240
}else{
12371241
@ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2>
12381242
db_prepare(&q,
12391243
"WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n"
12401244
"SELECT blobRid, uuid, timestamp,"
1241
- " if(length(com)>0,'<b>'||com||'</b><p>','')||comment,"
1245
+ " com||comment,"
12421246
" user, leaf, bgColor, eventType, tags, tagid, brief, mtime"
12431247
" FROM matches JOIN tarlist ON tarlist.rid=blobRid"
12441248
" ORDER BY matches.mtime DESC",
12451249
timeline_query_for_www()
12461250
);
12471251
--- src/tar.c
+++ src/tar.c
@@ -1135,10 +1135,11 @@
1135 int nItem; /* Number of terms in azItem[] */
1136 int i; /* Loop counter */
1137 int tmFlags; /* Timeline display flags */
1138 int n; /* Number of suggested downloads */
1139 double rNow; /* Current time. Julian day number */
 
1140
1141 login_check_credentials();
1142 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
1143
1144 style_set_current_feature("timeline");
@@ -1150,10 +1151,11 @@
1150 );
1151 rNow = db_double(0.0,"SELECT julianday()");
1152 if( !g.interp ) Th_FossilInit(0);
1153 Th_SplitList(g.interp, zTarlistCfg, (int)strlen(zTarlistCfg),
1154 &azItem, &anItem, &nItem);
 
1155 for(i=0; i<nItem-3; i+=4){
1156 int cnt; /* The number of instances of zLabel to use */
1157 char *zLabel; /* The label to match */
1158 double rStart; /* Starting time, julian day number */
1159 char *zComment = 0; /* Comment to apply */
@@ -1193,12 +1195,14 @@
1193 rStart = rNow - r/86400.0;
1194 }
1195 }
1196 if( anItem[i+3]==0 ){
1197 zComment = fossil_strdup("");
 
 
1198 }else{
1199 zComment = fossil_strndup(azItem[i+3],anItem[i+3]);
1200 }
1201 if( fossil_strcmp("OPEN-LEAF",zLabel)==0 ){
1202 db_multi_exec(
1203 "INSERT OR IGNORE INTO tarlist(rid,com)"
1204 " SELECT leaf.rid, %Q FROM leaf, event"
@@ -1236,11 +1240,11 @@
1236 }else{
1237 @ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2>
1238 db_prepare(&q,
1239 "WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n"
1240 "SELECT blobRid, uuid, timestamp,"
1241 " if(length(com)>0,'<b>'||com||'</b><p>','')||comment,"
1242 " user, leaf, bgColor, eventType, tags, tagid, brief, mtime"
1243 " FROM matches JOIN tarlist ON tarlist.rid=blobRid"
1244 " ORDER BY matches.mtime DESC",
1245 timeline_query_for_www()
1246 );
1247
--- src/tar.c
+++ src/tar.c
@@ -1135,10 +1135,11 @@
1135 int nItem; /* Number of terms in azItem[] */
1136 int i; /* Loop counter */
1137 int tmFlags; /* Timeline display flags */
1138 int n; /* Number of suggested downloads */
1139 double rNow; /* Current time. Julian day number */
1140 int bPlainTextCom; /* Use plain-text comments */
1141
1142 login_check_credentials();
1143 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
1144
1145 style_set_current_feature("timeline");
@@ -1150,10 +1151,11 @@
1151 );
1152 rNow = db_double(0.0,"SELECT julianday()");
1153 if( !g.interp ) Th_FossilInit(0);
1154 Th_SplitList(g.interp, zTarlistCfg, (int)strlen(zTarlistCfg),
1155 &azItem, &anItem, &nItem);
1156 bPlainTextCom = db_get_boolean("timeline-plaintext",0);
1157 for(i=0; i<nItem-3; i+=4){
1158 int cnt; /* The number of instances of zLabel to use */
1159 char *zLabel; /* The label to match */
1160 double rStart; /* Starting time, julian day number */
1161 char *zComment = 0; /* Comment to apply */
@@ -1193,12 +1195,14 @@
1195 rStart = rNow - r/86400.0;
1196 }
1197 }
1198 if( anItem[i+3]==0 ){
1199 zComment = fossil_strdup("");
1200 }else if( bPlainTextCom ){
1201 zComment = mprintf("** %.*s ** ", anItem[i+3], azItem[i+3]);
1202 }else{
1203 zComment = mprintf("<b>%.*s</b>\n<p>", anItem[i+3], azItem[i+3]);
1204 }
1205 if( fossil_strcmp("OPEN-LEAF",zLabel)==0 ){
1206 db_multi_exec(
1207 "INSERT OR IGNORE INTO tarlist(rid,com)"
1208 " SELECT leaf.rid, %Q FROM leaf, event"
@@ -1236,11 +1240,11 @@
1240 }else{
1241 @ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2>
1242 db_prepare(&q,
1243 "WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n"
1244 "SELECT blobRid, uuid, timestamp,"
1245 " com||comment,"
1246 " user, leaf, bgColor, eventType, tags, tagid, brief, mtime"
1247 " FROM matches JOIN tarlist ON tarlist.rid=blobRid"
1248 " ORDER BY matches.mtime DESC",
1249 timeline_query_for_www()
1250 );
1251

Keyboard Shortcuts

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