Fossil SCM
An attempt to get /download comments working on system that have timeline-plaintext set.
Commit
8a7a38baf50ada768db47fbafab410197d2ffd46ac0a3b159526335ba0a6f7f0
Parent
54e1d7dcfa18008…
1 file changed
+6
-2
+6
-2
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -1135,10 +1135,11 @@ | ||
| 1135 | 1135 | int nItem; /* Number of terms in azItem[] */ |
| 1136 | 1136 | int i; /* Loop counter */ |
| 1137 | 1137 | int tmFlags; /* Timeline display flags */ |
| 1138 | 1138 | int n; /* Number of suggested downloads */ |
| 1139 | 1139 | double rNow; /* Current time. Julian day number */ |
| 1140 | + int bPlainTextCom; /* Use plain-text comments */ | |
| 1140 | 1141 | |
| 1141 | 1142 | login_check_credentials(); |
| 1142 | 1143 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 1143 | 1144 | |
| 1144 | 1145 | style_set_current_feature("timeline"); |
| @@ -1150,10 +1151,11 @@ | ||
| 1150 | 1151 | ); |
| 1151 | 1152 | rNow = db_double(0.0,"SELECT julianday()"); |
| 1152 | 1153 | if( !g.interp ) Th_FossilInit(0); |
| 1153 | 1154 | Th_SplitList(g.interp, zTarlistCfg, (int)strlen(zTarlistCfg), |
| 1154 | 1155 | &azItem, &anItem, &nItem); |
| 1156 | + bPlainTextCom = db_get_boolean("timeline-plaintext",0); | |
| 1155 | 1157 | for(i=0; i<nItem-3; i+=4){ |
| 1156 | 1158 | int cnt; /* The number of instances of zLabel to use */ |
| 1157 | 1159 | char *zLabel; /* The label to match */ |
| 1158 | 1160 | double rStart; /* Starting time, julian day number */ |
| 1159 | 1161 | char *zComment = 0; /* Comment to apply */ |
| @@ -1193,12 +1195,14 @@ | ||
| 1193 | 1195 | rStart = rNow - r/86400.0; |
| 1194 | 1196 | } |
| 1195 | 1197 | } |
| 1196 | 1198 | if( anItem[i+3]==0 ){ |
| 1197 | 1199 | zComment = fossil_strdup(""); |
| 1200 | + }else if( bPlainTextCom ){ | |
| 1201 | + zComment = mprintf("** %.*s ** ", anItem[i+3], azItem[i+3]); | |
| 1198 | 1202 | }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]); | |
| 1200 | 1204 | } |
| 1201 | 1205 | if( fossil_strcmp("OPEN-LEAF",zLabel)==0 ){ |
| 1202 | 1206 | db_multi_exec( |
| 1203 | 1207 | "INSERT OR IGNORE INTO tarlist(rid,com)" |
| 1204 | 1208 | " SELECT leaf.rid, %Q FROM leaf, event" |
| @@ -1236,11 +1240,11 @@ | ||
| 1236 | 1240 | }else{ |
| 1237 | 1241 | @ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2> |
| 1238 | 1242 | db_prepare(&q, |
| 1239 | 1243 | "WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n" |
| 1240 | 1244 | "SELECT blobRid, uuid, timestamp," |
| 1241 | - " if(length(com)>0,'<b>'||com||'</b><p>','')||comment," | |
| 1245 | + " com||comment," | |
| 1242 | 1246 | " user, leaf, bgColor, eventType, tags, tagid, brief, mtime" |
| 1243 | 1247 | " FROM matches JOIN tarlist ON tarlist.rid=blobRid" |
| 1244 | 1248 | " ORDER BY matches.mtime DESC", |
| 1245 | 1249 | timeline_query_for_www() |
| 1246 | 1250 | ); |
| 1247 | 1251 |
| --- 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 |