Fossil SCM
The hclr query parameter to /bloblist color-codes the display to show whether each artifact is SHA1 or SHA3. There are no links or buttons to activate this query parameter. It is designed for expert users only, to be typed in manually into the URL.
Commit
59a8438a85182e5cb6c4cd1cdfc9a442c80b70cdf37ee061cf865bfbe07d8a52
Parent
303a2084a35beec…
1 file changed
+20
-1
+20
-1
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -990,23 +990,30 @@ | ||
| 990 | 990 | ** Return a page showing all artifacts in the repository. Query parameters: |
| 991 | 991 | ** |
| 992 | 992 | ** n=N Show N artifacts |
| 993 | 993 | ** s=S Start with artifact number S |
| 994 | 994 | ** unpub Show only unpublished artifacts |
| 995 | +** hclr Color code hash types (SHA1 vs SHA3) | |
| 995 | 996 | */ |
| 996 | 997 | void bloblist_page(void){ |
| 997 | 998 | Stmt q; |
| 998 | 999 | int s = atoi(PD("s","0")); |
| 999 | 1000 | int n = atoi(PD("n","5000")); |
| 1000 | 1001 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1001 | 1002 | int unpubOnly = PB("unpub"); |
| 1003 | + int hashClr = PB("hclr"); | |
| 1002 | 1004 | char *zRange; |
| 1005 | + char *zSha1Bg; | |
| 1006 | + char *zSha3Bg; | |
| 1003 | 1007 | |
| 1004 | 1008 | login_check_credentials(); |
| 1005 | 1009 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1006 | 1010 | style_header("List Of Artifacts"); |
| 1007 | 1011 | style_submenu_element("250 Largest", "bigbloblist"); |
| 1012 | + if( !hashClr ){ | |
| 1013 | + style_submenu_element("Color by Hash", "bloblist?hclr"); | |
| 1014 | + } | |
| 1008 | 1015 | if( !unpubOnly && mx>n && P("s")==0 ){ |
| 1009 | 1016 | int i; |
| 1010 | 1017 | @ <p>Select a range of artifacts to view:</p> |
| 1011 | 1018 | @ <ul> |
| 1012 | 1019 | for(i=1; i<=mx; i+=n){ |
| @@ -1028,17 +1035,29 @@ | ||
| 1028 | 1035 | describe_artifacts(zRange); |
| 1029 | 1036 | fossil_free(zRange); |
| 1030 | 1037 | db_prepare(&q, |
| 1031 | 1038 | "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid" |
| 1032 | 1039 | ); |
| 1040 | + if( skin_detail_boolean("white-foreground") ){ | |
| 1041 | + zSha1Bg = "#714417"; | |
| 1042 | + zSha3Bg = "#177117"; | |
| 1043 | + }else{ | |
| 1044 | + zSha1Bg = "#ebffb0"; | |
| 1045 | + zSha3Bg = "#b0ffb0"; | |
| 1046 | + } | |
| 1033 | 1047 | @ <table cellpadding="0" cellspacing="0"> |
| 1034 | 1048 | while( db_step(&q)==SQLITE_ROW ){ |
| 1035 | 1049 | int rid = db_column_int(&q,0); |
| 1036 | 1050 | const char *zUuid = db_column_text(&q, 1); |
| 1037 | 1051 | const char *zDesc = db_column_text(&q, 2); |
| 1038 | 1052 | int isPriv = db_column_int(&q,3); |
| 1039 | - @ <tr><td align="right">%d(rid)</td> | |
| 1053 | + if( hashClr ){ | |
| 1054 | + const char *zClr = db_column_bytes(&q,1)>40 ? zSha3Bg : zSha1Bg; | |
| 1055 | + @ <tr style='background-color:%s(zClr);'><td align="right">%d(rid)</td> | |
| 1056 | + }else{ | |
| 1057 | + @ <tr><td align="right">%d(rid)</td> | |
| 1058 | + } | |
| 1040 | 1059 | @ <td> %z(href("%R/info/%!S",zUuid))%S(zUuid)</a> </td> |
| 1041 | 1060 | @ <td align="left">%h(zDesc)</td> |
| 1042 | 1061 | if( isPriv ){ |
| 1043 | 1062 | @ <td>(unpublished)</td> |
| 1044 | 1063 | } |
| 1045 | 1064 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -990,23 +990,30 @@ | |
| 990 | ** Return a page showing all artifacts in the repository. Query parameters: |
| 991 | ** |
| 992 | ** n=N Show N artifacts |
| 993 | ** s=S Start with artifact number S |
| 994 | ** unpub Show only unpublished artifacts |
| 995 | */ |
| 996 | void bloblist_page(void){ |
| 997 | Stmt q; |
| 998 | int s = atoi(PD("s","0")); |
| 999 | int n = atoi(PD("n","5000")); |
| 1000 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1001 | int unpubOnly = PB("unpub"); |
| 1002 | char *zRange; |
| 1003 | |
| 1004 | login_check_credentials(); |
| 1005 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1006 | style_header("List Of Artifacts"); |
| 1007 | style_submenu_element("250 Largest", "bigbloblist"); |
| 1008 | if( !unpubOnly && mx>n && P("s")==0 ){ |
| 1009 | int i; |
| 1010 | @ <p>Select a range of artifacts to view:</p> |
| 1011 | @ <ul> |
| 1012 | for(i=1; i<=mx; i+=n){ |
| @@ -1028,17 +1035,29 @@ | |
| 1028 | describe_artifacts(zRange); |
| 1029 | fossil_free(zRange); |
| 1030 | db_prepare(&q, |
| 1031 | "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid" |
| 1032 | ); |
| 1033 | @ <table cellpadding="0" cellspacing="0"> |
| 1034 | while( db_step(&q)==SQLITE_ROW ){ |
| 1035 | int rid = db_column_int(&q,0); |
| 1036 | const char *zUuid = db_column_text(&q, 1); |
| 1037 | const char *zDesc = db_column_text(&q, 2); |
| 1038 | int isPriv = db_column_int(&q,3); |
| 1039 | @ <tr><td align="right">%d(rid)</td> |
| 1040 | @ <td> %z(href("%R/info/%!S",zUuid))%S(zUuid)</a> </td> |
| 1041 | @ <td align="left">%h(zDesc)</td> |
| 1042 | if( isPriv ){ |
| 1043 | @ <td>(unpublished)</td> |
| 1044 | } |
| 1045 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -990,23 +990,30 @@ | |
| 990 | ** Return a page showing all artifacts in the repository. Query parameters: |
| 991 | ** |
| 992 | ** n=N Show N artifacts |
| 993 | ** s=S Start with artifact number S |
| 994 | ** unpub Show only unpublished artifacts |
| 995 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 996 | */ |
| 997 | void bloblist_page(void){ |
| 998 | Stmt q; |
| 999 | int s = atoi(PD("s","0")); |
| 1000 | int n = atoi(PD("n","5000")); |
| 1001 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1002 | int unpubOnly = PB("unpub"); |
| 1003 | int hashClr = PB("hclr"); |
| 1004 | char *zRange; |
| 1005 | char *zSha1Bg; |
| 1006 | char *zSha3Bg; |
| 1007 | |
| 1008 | login_check_credentials(); |
| 1009 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1010 | style_header("List Of Artifacts"); |
| 1011 | style_submenu_element("250 Largest", "bigbloblist"); |
| 1012 | if( !hashClr ){ |
| 1013 | style_submenu_element("Color by Hash", "bloblist?hclr"); |
| 1014 | } |
| 1015 | if( !unpubOnly && mx>n && P("s")==0 ){ |
| 1016 | int i; |
| 1017 | @ <p>Select a range of artifacts to view:</p> |
| 1018 | @ <ul> |
| 1019 | for(i=1; i<=mx; i+=n){ |
| @@ -1028,17 +1035,29 @@ | |
| 1035 | describe_artifacts(zRange); |
| 1036 | fossil_free(zRange); |
| 1037 | db_prepare(&q, |
| 1038 | "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid" |
| 1039 | ); |
| 1040 | if( skin_detail_boolean("white-foreground") ){ |
| 1041 | zSha1Bg = "#714417"; |
| 1042 | zSha3Bg = "#177117"; |
| 1043 | }else{ |
| 1044 | zSha1Bg = "#ebffb0"; |
| 1045 | zSha3Bg = "#b0ffb0"; |
| 1046 | } |
| 1047 | @ <table cellpadding="0" cellspacing="0"> |
| 1048 | while( db_step(&q)==SQLITE_ROW ){ |
| 1049 | int rid = db_column_int(&q,0); |
| 1050 | const char *zUuid = db_column_text(&q, 1); |
| 1051 | const char *zDesc = db_column_text(&q, 2); |
| 1052 | int isPriv = db_column_int(&q,3); |
| 1053 | if( hashClr ){ |
| 1054 | const char *zClr = db_column_bytes(&q,1)>40 ? zSha3Bg : zSha1Bg; |
| 1055 | @ <tr style='background-color:%s(zClr);'><td align="right">%d(rid)</td> |
| 1056 | }else{ |
| 1057 | @ <tr><td align="right">%d(rid)</td> |
| 1058 | } |
| 1059 | @ <td> %z(href("%R/info/%!S",zUuid))%S(zUuid)</a> </td> |
| 1060 | @ <td align="left">%h(zDesc)</td> |
| 1061 | if( isPriv ){ |
| 1062 | @ <td>(unpublished)</td> |
| 1063 | } |
| 1064 |