Fossil SCM

Add the unpub query parameter to the /bloblist webpage.

drh 2015-12-16 01:21 trunk
Commit c8b1e81f1138e52fa8704d65ff0c9b2d5989ef9d
1 file changed +10 -3
+10 -3
--- src/name.c
+++ src/name.c
@@ -979,23 +979,25 @@
979979
**
980980
** Return a page showing all artifacts in the repository. Query parameters:
981981
**
982982
** n=N Show N artifacts
983983
** s=S Start with artifact number S
984
+** unpub Show only unpublished artifacts
984985
*/
985986
void bloblist_page(void){
986987
Stmt q;
987988
int s = atoi(PD("s","0"));
988989
int n = atoi(PD("n","5000"));
989990
int mx = db_int(0, "SELECT max(rid) FROM blob");
991
+ int unpubOnly = PB("unpub");
990992
char *zRange;
991993
992994
login_check_credentials();
993995
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
994996
style_header("List Of Artifacts");
995997
style_submenu_element("250 Largest", 0, "bigbloblist");
996
- if( mx>n && P("s")==0 ){
998
+ if( !unpubOnly && mx>n && P("s")==0 ){
997999
int i;
9981000
@ <p>Select a range of artifacts to view:</p>
9991001
@ <ul>
10001002
for(i=1; i<=mx; i+=n){
10011003
@ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
@@ -1003,15 +1005,20 @@
10031005
}
10041006
@ </ul>
10051007
style_footer();
10061008
return;
10071009
}
1008
- if( mx>n ){
1010
+ if( !unpubOnly && mx>n ){
10091011
style_submenu_element("Index", "Index", "bloblist");
10101012
}
1011
- zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
1013
+ if( unpubOnly ){
1014
+ zRange = mprintf("IN private");
1015
+ }else{
1016
+ zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
1017
+ }
10121018
describe_artifacts(zRange);
1019
+ fossil_free(zRange);
10131020
db_prepare(&q,
10141021
"SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid"
10151022
);
10161023
@ <table cellpadding="0" cellspacing="0">
10171024
while( db_step(&q)==SQLITE_ROW ){
10181025
--- src/name.c
+++ src/name.c
@@ -979,23 +979,25 @@
979 **
980 ** Return a page showing all artifacts in the repository. Query parameters:
981 **
982 ** n=N Show N artifacts
983 ** s=S Start with artifact number S
 
984 */
985 void bloblist_page(void){
986 Stmt q;
987 int s = atoi(PD("s","0"));
988 int n = atoi(PD("n","5000"));
989 int mx = db_int(0, "SELECT max(rid) FROM blob");
 
990 char *zRange;
991
992 login_check_credentials();
993 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
994 style_header("List Of Artifacts");
995 style_submenu_element("250 Largest", 0, "bigbloblist");
996 if( mx>n && P("s")==0 ){
997 int i;
998 @ <p>Select a range of artifacts to view:</p>
999 @ <ul>
1000 for(i=1; i<=mx; i+=n){
1001 @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
@@ -1003,15 +1005,20 @@
1003 }
1004 @ </ul>
1005 style_footer();
1006 return;
1007 }
1008 if( mx>n ){
1009 style_submenu_element("Index", "Index", "bloblist");
1010 }
1011 zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
 
 
 
 
1012 describe_artifacts(zRange);
 
1013 db_prepare(&q,
1014 "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid"
1015 );
1016 @ <table cellpadding="0" cellspacing="0">
1017 while( db_step(&q)==SQLITE_ROW ){
1018
--- src/name.c
+++ src/name.c
@@ -979,23 +979,25 @@
979 **
980 ** Return a page showing all artifacts in the repository. Query parameters:
981 **
982 ** n=N Show N artifacts
983 ** s=S Start with artifact number S
984 ** unpub Show only unpublished artifacts
985 */
986 void bloblist_page(void){
987 Stmt q;
988 int s = atoi(PD("s","0"));
989 int n = atoi(PD("n","5000"));
990 int mx = db_int(0, "SELECT max(rid) FROM blob");
991 int unpubOnly = PB("unpub");
992 char *zRange;
993
994 login_check_credentials();
995 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
996 style_header("List Of Artifacts");
997 style_submenu_element("250 Largest", 0, "bigbloblist");
998 if( !unpubOnly && mx>n && P("s")==0 ){
999 int i;
1000 @ <p>Select a range of artifacts to view:</p>
1001 @ <ul>
1002 for(i=1; i<=mx; i+=n){
1003 @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
@@ -1003,15 +1005,20 @@
1005 }
1006 @ </ul>
1007 style_footer();
1008 return;
1009 }
1010 if( !unpubOnly && mx>n ){
1011 style_submenu_element("Index", "Index", "bloblist");
1012 }
1013 if( unpubOnly ){
1014 zRange = mprintf("IN private");
1015 }else{
1016 zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
1017 }
1018 describe_artifacts(zRange);
1019 fossil_free(zRange);
1020 db_prepare(&q,
1021 "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid"
1022 );
1023 @ <table cellpadding="0" cellspacing="0">
1024 while( db_step(&q)==SQLITE_ROW ){
1025

Keyboard Shortcuts

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