Fossil SCM
On the /bloblist webpage, enhance the "published" display and add the ability to display phantom artifacts. (A phantom is an artifact whose content is unknown.)
Commit
ea83cdad1d9bb63cb19a1ad2d9c0a32303d0854d7689214106acc997fab7df88
Parent
55f9d7b6ecfce6c…
2 files changed
+23
-5
+1
-1
+23
-5
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -1173,18 +1173,20 @@ | ||
| 1173 | 1173 | ** Return a page showing all artifacts in the repository. Query parameters: |
| 1174 | 1174 | ** |
| 1175 | 1175 | ** n=N Show N artifacts |
| 1176 | 1176 | ** s=S Start with artifact number S |
| 1177 | 1177 | ** unpub Show only unpublished artifacts |
| 1178 | +** phan Show only phantom artifacts | |
| 1178 | 1179 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 1179 | 1180 | */ |
| 1180 | 1181 | void bloblist_page(void){ |
| 1181 | 1182 | Stmt q; |
| 1182 | 1183 | int s = atoi(PD("s","0")); |
| 1183 | 1184 | int n = atoi(PD("n","5000")); |
| 1184 | 1185 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1185 | 1186 | int unpubOnly = PB("unpub"); |
| 1187 | + int phantomOnly = PB("phan"); | |
| 1186 | 1188 | int hashClr = PB("hclr"); |
| 1187 | 1189 | char *zRange; |
| 1188 | 1190 | char *zSha1Bg; |
| 1189 | 1191 | char *zSha3Bg; |
| 1190 | 1192 | |
| @@ -1196,11 +1198,17 @@ | ||
| 1196 | 1198 | style_submenu_element("Artifact Log", "rcvfromlist"); |
| 1197 | 1199 | } |
| 1198 | 1200 | if( g.perm.Write ){ |
| 1199 | 1201 | style_submenu_element("Artifact Stats", "artifact_stats"); |
| 1200 | 1202 | } |
| 1201 | - if( !unpubOnly && mx>n && P("s")==0 ){ | |
| 1203 | + if( !unpubOnly ){ | |
| 1204 | + style_submenu_element("Unpublished", "bloblist?unpub"); | |
| 1205 | + } | |
| 1206 | + if( !phantomOnly ){ | |
| 1207 | + style_submenu_element("Phantoms", "bloblist?phan"); | |
| 1208 | + } | |
| 1209 | + if( !unpubOnly && !phantomOnly && mx>n && P("s")==0 ){ | |
| 1202 | 1210 | int i; |
| 1203 | 1211 | @ <p>Select a range of artifacts to view:</p> |
| 1204 | 1212 | @ <ul> |
| 1205 | 1213 | for(i=1; i<=mx; i+=n){ |
| 1206 | 1214 | @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n)) |
| @@ -1208,22 +1216,25 @@ | ||
| 1208 | 1216 | } |
| 1209 | 1217 | @ </ul> |
| 1210 | 1218 | style_footer(); |
| 1211 | 1219 | return; |
| 1212 | 1220 | } |
| 1213 | - if( !unpubOnly && mx>n ){ | |
| 1221 | + if( phantomOnly || unpubOnly || mx>n ){ | |
| 1214 | 1222 | style_submenu_element("Index", "bloblist"); |
| 1215 | 1223 | } |
| 1216 | 1224 | if( unpubOnly ){ |
| 1217 | 1225 | zRange = mprintf("IN private"); |
| 1226 | + }else if( phantomOnly ){ | |
| 1227 | + zRange = mprintf("IN (SELECT rid FROM blob WHERE size<0)"); | |
| 1218 | 1228 | }else{ |
| 1219 | 1229 | zRange = mprintf("BETWEEN %d AND %d", s, s+n-1); |
| 1220 | 1230 | } |
| 1221 | 1231 | describe_artifacts(zRange); |
| 1222 | 1232 | fossil_free(zRange); |
| 1223 | 1233 | db_prepare(&q, |
| 1224 | - "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid" | |
| 1234 | + "SELECT rid, uuid, summary, isPrivate, type='phantom'" | |
| 1235 | + " FROM description ORDER BY rid" | |
| 1225 | 1236 | ); |
| 1226 | 1237 | if( skin_detail_boolean("white-foreground") ){ |
| 1227 | 1238 | zSha1Bg = "#714417"; |
| 1228 | 1239 | zSha3Bg = "#177117"; |
| 1229 | 1240 | }else{ |
| @@ -1234,20 +1245,27 @@ | ||
| 1234 | 1245 | while( db_step(&q)==SQLITE_ROW ){ |
| 1235 | 1246 | int rid = db_column_int(&q,0); |
| 1236 | 1247 | const char *zUuid = db_column_text(&q, 1); |
| 1237 | 1248 | const char *zDesc = db_column_text(&q, 2); |
| 1238 | 1249 | int isPriv = db_column_int(&q,3); |
| 1250 | + int isPhantom = db_column_int(&q,4); | |
| 1239 | 1251 | if( hashClr ){ |
| 1240 | 1252 | const char *zClr = db_column_bytes(&q,1)>40 ? zSha3Bg : zSha1Bg; |
| 1241 | 1253 | @ <tr style='background-color:%s(zClr);'><td align="right">%d(rid)</td> |
| 1242 | 1254 | }else{ |
| 1243 | 1255 | @ <tr><td align="right">%d(rid)</td> |
| 1244 | 1256 | } |
| 1245 | 1257 | @ <td> %z(href("%R/info/%!S",zUuid))%S(zUuid)</a> </td> |
| 1246 | 1258 | @ <td align="left">%h(zDesc)</td> |
| 1247 | - if( isPriv ){ | |
| 1248 | - @ <td>(unpublished)</td> | |
| 1259 | + if( isPriv || isPhantom ){ | |
| 1260 | + if( isPriv==0 ){ | |
| 1261 | + @ <td> (phantom)</td> | |
| 1262 | + }else if( isPhantom==0 ){ | |
| 1263 | + @ <td> (unpublished)</td> | |
| 1264 | + }else{ | |
| 1265 | + @ <td> (unpublished,phantom)</td> | |
| 1266 | + } | |
| 1249 | 1267 | } |
| 1250 | 1268 | @ </tr> |
| 1251 | 1269 | } |
| 1252 | 1270 | @ </table> |
| 1253 | 1271 | db_finalize(&q); |
| 1254 | 1272 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -1173,18 +1173,20 @@ | |
| 1173 | ** Return a page showing all artifacts in the repository. Query parameters: |
| 1174 | ** |
| 1175 | ** n=N Show N artifacts |
| 1176 | ** s=S Start with artifact number S |
| 1177 | ** unpub Show only unpublished artifacts |
| 1178 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 1179 | */ |
| 1180 | void bloblist_page(void){ |
| 1181 | Stmt q; |
| 1182 | int s = atoi(PD("s","0")); |
| 1183 | int n = atoi(PD("n","5000")); |
| 1184 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1185 | int unpubOnly = PB("unpub"); |
| 1186 | int hashClr = PB("hclr"); |
| 1187 | char *zRange; |
| 1188 | char *zSha1Bg; |
| 1189 | char *zSha3Bg; |
| 1190 | |
| @@ -1196,11 +1198,17 @@ | |
| 1196 | style_submenu_element("Artifact Log", "rcvfromlist"); |
| 1197 | } |
| 1198 | if( g.perm.Write ){ |
| 1199 | style_submenu_element("Artifact Stats", "artifact_stats"); |
| 1200 | } |
| 1201 | if( !unpubOnly && mx>n && P("s")==0 ){ |
| 1202 | int i; |
| 1203 | @ <p>Select a range of artifacts to view:</p> |
| 1204 | @ <ul> |
| 1205 | for(i=1; i<=mx; i+=n){ |
| 1206 | @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n)) |
| @@ -1208,22 +1216,25 @@ | |
| 1208 | } |
| 1209 | @ </ul> |
| 1210 | style_footer(); |
| 1211 | return; |
| 1212 | } |
| 1213 | if( !unpubOnly && mx>n ){ |
| 1214 | style_submenu_element("Index", "bloblist"); |
| 1215 | } |
| 1216 | if( unpubOnly ){ |
| 1217 | zRange = mprintf("IN private"); |
| 1218 | }else{ |
| 1219 | zRange = mprintf("BETWEEN %d AND %d", s, s+n-1); |
| 1220 | } |
| 1221 | describe_artifacts(zRange); |
| 1222 | fossil_free(zRange); |
| 1223 | db_prepare(&q, |
| 1224 | "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid" |
| 1225 | ); |
| 1226 | if( skin_detail_boolean("white-foreground") ){ |
| 1227 | zSha1Bg = "#714417"; |
| 1228 | zSha3Bg = "#177117"; |
| 1229 | }else{ |
| @@ -1234,20 +1245,27 @@ | |
| 1234 | while( db_step(&q)==SQLITE_ROW ){ |
| 1235 | int rid = db_column_int(&q,0); |
| 1236 | const char *zUuid = db_column_text(&q, 1); |
| 1237 | const char *zDesc = db_column_text(&q, 2); |
| 1238 | int isPriv = db_column_int(&q,3); |
| 1239 | if( hashClr ){ |
| 1240 | const char *zClr = db_column_bytes(&q,1)>40 ? zSha3Bg : zSha1Bg; |
| 1241 | @ <tr style='background-color:%s(zClr);'><td align="right">%d(rid)</td> |
| 1242 | }else{ |
| 1243 | @ <tr><td align="right">%d(rid)</td> |
| 1244 | } |
| 1245 | @ <td> %z(href("%R/info/%!S",zUuid))%S(zUuid)</a> </td> |
| 1246 | @ <td align="left">%h(zDesc)</td> |
| 1247 | if( isPriv ){ |
| 1248 | @ <td>(unpublished)</td> |
| 1249 | } |
| 1250 | @ </tr> |
| 1251 | } |
| 1252 | @ </table> |
| 1253 | db_finalize(&q); |
| 1254 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -1173,18 +1173,20 @@ | |
| 1173 | ** Return a page showing all artifacts in the repository. Query parameters: |
| 1174 | ** |
| 1175 | ** n=N Show N artifacts |
| 1176 | ** s=S Start with artifact number S |
| 1177 | ** unpub Show only unpublished artifacts |
| 1178 | ** phan Show only phantom artifacts |
| 1179 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 1180 | */ |
| 1181 | void bloblist_page(void){ |
| 1182 | Stmt q; |
| 1183 | int s = atoi(PD("s","0")); |
| 1184 | int n = atoi(PD("n","5000")); |
| 1185 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1186 | int unpubOnly = PB("unpub"); |
| 1187 | int phantomOnly = PB("phan"); |
| 1188 | int hashClr = PB("hclr"); |
| 1189 | char *zRange; |
| 1190 | char *zSha1Bg; |
| 1191 | char *zSha3Bg; |
| 1192 | |
| @@ -1196,11 +1198,17 @@ | |
| 1198 | style_submenu_element("Artifact Log", "rcvfromlist"); |
| 1199 | } |
| 1200 | if( g.perm.Write ){ |
| 1201 | style_submenu_element("Artifact Stats", "artifact_stats"); |
| 1202 | } |
| 1203 | if( !unpubOnly ){ |
| 1204 | style_submenu_element("Unpublished", "bloblist?unpub"); |
| 1205 | } |
| 1206 | if( !phantomOnly ){ |
| 1207 | style_submenu_element("Phantoms", "bloblist?phan"); |
| 1208 | } |
| 1209 | if( !unpubOnly && !phantomOnly && mx>n && P("s")==0 ){ |
| 1210 | int i; |
| 1211 | @ <p>Select a range of artifacts to view:</p> |
| 1212 | @ <ul> |
| 1213 | for(i=1; i<=mx; i+=n){ |
| 1214 | @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n)) |
| @@ -1208,22 +1216,25 @@ | |
| 1216 | } |
| 1217 | @ </ul> |
| 1218 | style_footer(); |
| 1219 | return; |
| 1220 | } |
| 1221 | if( phantomOnly || unpubOnly || mx>n ){ |
| 1222 | style_submenu_element("Index", "bloblist"); |
| 1223 | } |
| 1224 | if( unpubOnly ){ |
| 1225 | zRange = mprintf("IN private"); |
| 1226 | }else if( phantomOnly ){ |
| 1227 | zRange = mprintf("IN (SELECT rid FROM blob WHERE size<0)"); |
| 1228 | }else{ |
| 1229 | zRange = mprintf("BETWEEN %d AND %d", s, s+n-1); |
| 1230 | } |
| 1231 | describe_artifacts(zRange); |
| 1232 | fossil_free(zRange); |
| 1233 | db_prepare(&q, |
| 1234 | "SELECT rid, uuid, summary, isPrivate, type='phantom'" |
| 1235 | " FROM description ORDER BY rid" |
| 1236 | ); |
| 1237 | if( skin_detail_boolean("white-foreground") ){ |
| 1238 | zSha1Bg = "#714417"; |
| 1239 | zSha3Bg = "#177117"; |
| 1240 | }else{ |
| @@ -1234,20 +1245,27 @@ | |
| 1245 | while( db_step(&q)==SQLITE_ROW ){ |
| 1246 | int rid = db_column_int(&q,0); |
| 1247 | const char *zUuid = db_column_text(&q, 1); |
| 1248 | const char *zDesc = db_column_text(&q, 2); |
| 1249 | int isPriv = db_column_int(&q,3); |
| 1250 | int isPhantom = db_column_int(&q,4); |
| 1251 | if( hashClr ){ |
| 1252 | const char *zClr = db_column_bytes(&q,1)>40 ? zSha3Bg : zSha1Bg; |
| 1253 | @ <tr style='background-color:%s(zClr);'><td align="right">%d(rid)</td> |
| 1254 | }else{ |
| 1255 | @ <tr><td align="right">%d(rid)</td> |
| 1256 | } |
| 1257 | @ <td> %z(href("%R/info/%!S",zUuid))%S(zUuid)</a> </td> |
| 1258 | @ <td align="left">%h(zDesc)</td> |
| 1259 | if( isPriv || isPhantom ){ |
| 1260 | if( isPriv==0 ){ |
| 1261 | @ <td> (phantom)</td> |
| 1262 | }else if( isPhantom==0 ){ |
| 1263 | @ <td> (unpublished)</td> |
| 1264 | }else{ |
| 1265 | @ <td> (unpublished,phantom)</td> |
| 1266 | } |
| 1267 | } |
| 1268 | @ </tr> |
| 1269 | } |
| 1270 | @ </table> |
| 1271 | db_finalize(&q); |
| 1272 |
+1
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -41,11 +41,11 @@ | ||
| 41 | 41 | ** Add an appropriate tag to the output if "rid" is unpublished (private) |
| 42 | 42 | */ |
| 43 | 43 | #define UNPUB_TAG "<em>(unpublished)</em>" |
| 44 | 44 | void tag_private_status(int rid){ |
| 45 | 45 | if( content_is_private(rid) ){ |
| 46 | - cgi_printf("%s", UNPUB_TAG); | |
| 46 | + cgi_printf(" %s", UNPUB_TAG); | |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /* |
| 51 | 51 | ** Generate a hyperlink to a version. |
| 52 | 52 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | ** Add an appropriate tag to the output if "rid" is unpublished (private) |
| 42 | */ |
| 43 | #define UNPUB_TAG "<em>(unpublished)</em>" |
| 44 | void tag_private_status(int rid){ |
| 45 | if( content_is_private(rid) ){ |
| 46 | cgi_printf("%s", UNPUB_TAG); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /* |
| 51 | ** Generate a hyperlink to a version. |
| 52 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | ** Add an appropriate tag to the output if "rid" is unpublished (private) |
| 42 | */ |
| 43 | #define UNPUB_TAG "<em>(unpublished)</em>" |
| 44 | void tag_private_status(int rid){ |
| 45 | if( content_is_private(rid) ){ |
| 46 | cgi_printf(" %s", UNPUB_TAG); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /* |
| 51 | ** Generate a hyperlink to a version. |
| 52 |