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.)

drh 2020-04-12 23:10 trunk
Commit ea83cdad1d9bb63cb19a1ad2d9c0a32303d0854d7689214106acc997fab7df88
2 files changed +23 -5 +1 -1
+23 -5
--- src/name.c
+++ src/name.c
@@ -1173,18 +1173,20 @@
11731173
** Return a page showing all artifacts in the repository. Query parameters:
11741174
**
11751175
** n=N Show N artifacts
11761176
** s=S Start with artifact number S
11771177
** unpub Show only unpublished artifacts
1178
+** phan Show only phantom artifacts
11781179
** hclr Color code hash types (SHA1 vs SHA3)
11791180
*/
11801181
void bloblist_page(void){
11811182
Stmt q;
11821183
int s = atoi(PD("s","0"));
11831184
int n = atoi(PD("n","5000"));
11841185
int mx = db_int(0, "SELECT max(rid) FROM blob");
11851186
int unpubOnly = PB("unpub");
1187
+ int phantomOnly = PB("phan");
11861188
int hashClr = PB("hclr");
11871189
char *zRange;
11881190
char *zSha1Bg;
11891191
char *zSha3Bg;
11901192
@@ -1196,11 +1198,17 @@
11961198
style_submenu_element("Artifact Log", "rcvfromlist");
11971199
}
11981200
if( g.perm.Write ){
11991201
style_submenu_element("Artifact Stats", "artifact_stats");
12001202
}
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 ){
12021210
int i;
12031211
@ <p>Select a range of artifacts to view:</p>
12041212
@ <ul>
12051213
for(i=1; i<=mx; i+=n){
12061214
@ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
@@ -1208,22 +1216,25 @@
12081216
}
12091217
@ </ul>
12101218
style_footer();
12111219
return;
12121220
}
1213
- if( !unpubOnly && mx>n ){
1221
+ if( phantomOnly || unpubOnly || mx>n ){
12141222
style_submenu_element("Index", "bloblist");
12151223
}
12161224
if( unpubOnly ){
12171225
zRange = mprintf("IN private");
1226
+ }else if( phantomOnly ){
1227
+ zRange = mprintf("IN (SELECT rid FROM blob WHERE size<0)");
12181228
}else{
12191229
zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
12201230
}
12211231
describe_artifacts(zRange);
12221232
fossil_free(zRange);
12231233
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"
12251236
);
12261237
if( skin_detail_boolean("white-foreground") ){
12271238
zSha1Bg = "#714417";
12281239
zSha3Bg = "#177117";
12291240
}else{
@@ -1234,20 +1245,27 @@
12341245
while( db_step(&q)==SQLITE_ROW ){
12351246
int rid = db_column_int(&q,0);
12361247
const char *zUuid = db_column_text(&q, 1);
12371248
const char *zDesc = db_column_text(&q, 2);
12381249
int isPriv = db_column_int(&q,3);
1250
+ int isPhantom = db_column_int(&q,4);
12391251
if( hashClr ){
12401252
const char *zClr = db_column_bytes(&q,1)>40 ? zSha3Bg : zSha1Bg;
12411253
@ <tr style='background-color:%s(zClr);'><td align="right">%d(rid)</td>
12421254
}else{
12431255
@ <tr><td align="right">%d(rid)</td>
12441256
}
12451257
@ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%S(zUuid)</a>&nbsp;</td>
12461258
@ <td align="left">%h(zDesc)</td>
1247
- if( isPriv ){
1248
- @ <td>(unpublished)</td>
1259
+ if( isPriv || isPhantom ){
1260
+ if( isPriv==0 ){
1261
+ @ <td>&nbsp;(phantom)</td>
1262
+ }else if( isPhantom==0 ){
1263
+ @ <td>&nbsp;(unpublished)</td>
1264
+ }else{
1265
+ @ <td>&nbsp;(unpublished,phantom)</td>
1266
+ }
12491267
}
12501268
@ </tr>
12511269
}
12521270
@ </table>
12531271
db_finalize(&q);
12541272
--- 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>&nbsp;%z(href("%R/info/%!S",zUuid))%S(zUuid)</a>&nbsp;</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>&nbsp;%z(href("%R/info/%!S",zUuid))%S(zUuid)</a>&nbsp;</td>
1258 @ <td align="left">%h(zDesc)</td>
1259 if( isPriv || isPhantom ){
1260 if( isPriv==0 ){
1261 @ <td>&nbsp;(phantom)</td>
1262 }else if( isPhantom==0 ){
1263 @ <td>&nbsp;(unpublished)</td>
1264 }else{
1265 @ <td>&nbsp;(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 @@
4141
** Add an appropriate tag to the output if "rid" is unpublished (private)
4242
*/
4343
#define UNPUB_TAG "<em>(unpublished)</em>"
4444
void tag_private_status(int rid){
4545
if( content_is_private(rid) ){
46
- cgi_printf("%s", UNPUB_TAG);
46
+ cgi_printf(" %s", UNPUB_TAG);
4747
}
4848
}
4949
5050
/*
5151
** Generate a hyperlink to a version.
5252
--- 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

Keyboard Shortcuts

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