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.

drh 2017-03-16 15:03 trunk
Commit 59a8438a85182e5cb6c4cd1cdfc9a442c80b70cdf37ee061cf865bfbe07d8a52
1 file changed +20 -1
+20 -1
--- src/name.c
+++ src/name.c
@@ -990,23 +990,30 @@
990990
** Return a page showing all artifacts in the repository. Query parameters:
991991
**
992992
** n=N Show N artifacts
993993
** s=S Start with artifact number S
994994
** unpub Show only unpublished artifacts
995
+** hclr Color code hash types (SHA1 vs SHA3)
995996
*/
996997
void bloblist_page(void){
997998
Stmt q;
998999
int s = atoi(PD("s","0"));
9991000
int n = atoi(PD("n","5000"));
10001001
int mx = db_int(0, "SELECT max(rid) FROM blob");
10011002
int unpubOnly = PB("unpub");
1003
+ int hashClr = PB("hclr");
10021004
char *zRange;
1005
+ char *zSha1Bg;
1006
+ char *zSha3Bg;
10031007
10041008
login_check_credentials();
10051009
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
10061010
style_header("List Of Artifacts");
10071011
style_submenu_element("250 Largest", "bigbloblist");
1012
+ if( !hashClr ){
1013
+ style_submenu_element("Color by Hash", "bloblist?hclr");
1014
+ }
10081015
if( !unpubOnly && mx>n && P("s")==0 ){
10091016
int i;
10101017
@ <p>Select a range of artifacts to view:</p>
10111018
@ <ul>
10121019
for(i=1; i<=mx; i+=n){
@@ -1028,17 +1035,29 @@
10281035
describe_artifacts(zRange);
10291036
fossil_free(zRange);
10301037
db_prepare(&q,
10311038
"SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid"
10321039
);
1040
+ if( skin_detail_boolean("white-foreground") ){
1041
+ zSha1Bg = "#714417";
1042
+ zSha3Bg = "#177117";
1043
+ }else{
1044
+ zSha1Bg = "#ebffb0";
1045
+ zSha3Bg = "#b0ffb0";
1046
+ }
10331047
@ <table cellpadding="0" cellspacing="0">
10341048
while( db_step(&q)==SQLITE_ROW ){
10351049
int rid = db_column_int(&q,0);
10361050
const char *zUuid = db_column_text(&q, 1);
10371051
const char *zDesc = db_column_text(&q, 2);
10381052
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
+ }
10401059
@ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%S(zUuid)</a>&nbsp;</td>
10411060
@ <td align="left">%h(zDesc)</td>
10421061
if( isPriv ){
10431062
@ <td>(unpublished)</td>
10441063
}
10451064
--- 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>&nbsp;%z(href("%R/info/%!S",zUuid))%S(zUuid)</a>&nbsp;</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>&nbsp;%z(href("%R/info/%!S",zUuid))%S(zUuid)</a>&nbsp;</td>
1060 @ <td align="left">%h(zDesc)</td>
1061 if( isPriv ){
1062 @ <td>(unpublished)</td>
1063 }
1064

Keyboard Shortcuts

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