Fossil SCM

Add the experimental test-describe-artifacts webpage.

drh 2014-12-10 20:53 trunk
Commit 59121b9c0d1737c1106ef9ec962ad9618b0e74d8
2 files changed +55 -1 +1
+55 -1
--- src/name.c
+++ src/name.c
@@ -944,11 +944,65 @@
944944
**
945945
** Display a one-line description of every artifact.
946946
*/
947947
void test_describe_artifacts_cmd(void){
948948
db_find_and_open_repository(0,0);
949
- describe_artifacts_to_stdout("IN (SELECT rid FROM blob)", 0);
949
+ describe_artifacts_to_stdout(">0", 0);
950
+}
951
+
952
+/*
953
+** WEBPAGE: test-describe-artifacts
954
+**
955
+** Return a page showing all artifacts in the repository
956
+*/
957
+void test_describe_artifacts_page(void){
958
+ Stmt q;
959
+ int s = atoi(PD("s","0"));
960
+ int n = atoi(PD("n","5000"));
961
+ int mx = db_int(0, "SELECT max(rid) FROM blob");
962
+ char *zRange;
963
+
964
+ login_check_credentials();
965
+ if( !g.perm.Read ){ login_needed(); return; }
966
+ style_header("List Of Artifacts");
967
+ if( mx>n && P("s")==0 ){
968
+ int i;
969
+ @ <p>Select a range of artifacts to view:</p>
970
+ @ <ul>
971
+ for(i=1; i<=mx; i+=n){
972
+ @ <li> %z(href("%R/test-describe-artifacts?s=%d&n=%d",i,n))
973
+ @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a>
974
+ }
975
+ @ </ul>
976
+ style_footer();
977
+ return;
978
+ }
979
+ if( mx>n ){
980
+ style_submenu_element("Index", "Index", "test-describe-artifacts");
981
+ }
982
+ zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
983
+ describe_artifacts(zRange);
984
+ db_prepare(&q,
985
+ "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid"
986
+ );
987
+ @ <table cellpadding="0" cellspacing="0">
988
+ while( db_step(&q)==SQLITE_ROW ){
989
+ int rid = db_column_int(&q,0);
990
+ const char *zUuid = db_column_text(&q, 1);
991
+ const char *zDesc = db_column_text(&q, 2);
992
+ int isPriv = db_column_int(&q,2);
993
+ @ <tr><td align="right">%d(rid)</td>
994
+ @ <td>&nbsp;%z(href("%R/info/%s",zUuid))%s(zUuid)</a>&nbsp;</td>
995
+ @ <td align="left">%h(zDesc)</td>
996
+ if( isPriv ){
997
+ @ <td>(unpublished)</td>
998
+ }
999
+ @ </tr>
1000
+ }
1001
+ @ </table>
1002
+ db_finalize(&q);
1003
+ style_footer();
9501004
}
9511005
9521006
/*
9531007
** COMMAND: test-unsent
9541008
**
9551009
--- src/name.c
+++ src/name.c
@@ -944,11 +944,65 @@
944 **
945 ** Display a one-line description of every artifact.
946 */
947 void test_describe_artifacts_cmd(void){
948 db_find_and_open_repository(0,0);
949 describe_artifacts_to_stdout("IN (SELECT rid FROM blob)", 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
950 }
951
952 /*
953 ** COMMAND: test-unsent
954 **
955
--- src/name.c
+++ src/name.c
@@ -944,11 +944,65 @@
944 **
945 ** Display a one-line description of every artifact.
946 */
947 void test_describe_artifacts_cmd(void){
948 db_find_and_open_repository(0,0);
949 describe_artifacts_to_stdout(">0", 0);
950 }
951
952 /*
953 ** WEBPAGE: test-describe-artifacts
954 **
955 ** Return a page showing all artifacts in the repository
956 */
957 void test_describe_artifacts_page(void){
958 Stmt q;
959 int s = atoi(PD("s","0"));
960 int n = atoi(PD("n","5000"));
961 int mx = db_int(0, "SELECT max(rid) FROM blob");
962 char *zRange;
963
964 login_check_credentials();
965 if( !g.perm.Read ){ login_needed(); return; }
966 style_header("List Of Artifacts");
967 if( mx>n && P("s")==0 ){
968 int i;
969 @ <p>Select a range of artifacts to view:</p>
970 @ <ul>
971 for(i=1; i<=mx; i+=n){
972 @ <li> %z(href("%R/test-describe-artifacts?s=%d&n=%d",i,n))
973 @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a>
974 }
975 @ </ul>
976 style_footer();
977 return;
978 }
979 if( mx>n ){
980 style_submenu_element("Index", "Index", "test-describe-artifacts");
981 }
982 zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
983 describe_artifacts(zRange);
984 db_prepare(&q,
985 "SELECT rid, uuid, summary, isPrivate FROM description ORDER BY rid"
986 );
987 @ <table cellpadding="0" cellspacing="0">
988 while( db_step(&q)==SQLITE_ROW ){
989 int rid = db_column_int(&q,0);
990 const char *zUuid = db_column_text(&q, 1);
991 const char *zDesc = db_column_text(&q, 2);
992 int isPriv = db_column_int(&q,2);
993 @ <tr><td align="right">%d(rid)</td>
994 @ <td>&nbsp;%z(href("%R/info/%s",zUuid))%s(zUuid)</a>&nbsp;</td>
995 @ <td align="left">%h(zDesc)</td>
996 if( isPriv ){
997 @ <td>(unpublished)</td>
998 }
999 @ </tr>
1000 }
1001 @ </table>
1002 db_finalize(&q);
1003 style_footer();
1004 }
1005
1006 /*
1007 ** COMMAND: test-unsent
1008 **
1009
--- src/sitemap.c
+++ src/sitemap.c
@@ -58,10 +58,11 @@
5858
@ <li>%z(href("%R/attachlist"))List of Attachments</a>
5959
@ <li>Repository Status
6060
@ <ul>
6161
@ <li>%z(href("%R/stat"))Status Summary</a>
6262
@ <li>%z(href("%R/urllist"))List of URLs used to access this repository</a>
63
+ @ <li>%z(href("%R/test-describe-artifacts"))List of Artifacts</a>
6364
@ </ul>
6465
@ <li>On-line Documentation
6566
@ <ul>
6667
@ <li>%z(href("%R/help"))List of All Commands and Web Pages</a>
6768
@ <li>%z(href("%R/test-all-help"))All "help" text on a single page</a>
6869
--- src/sitemap.c
+++ src/sitemap.c
@@ -58,10 +58,11 @@
58 @ <li>%z(href("%R/attachlist"))List of Attachments</a>
59 @ <li>Repository Status
60 @ <ul>
61 @ <li>%z(href("%R/stat"))Status Summary</a>
62 @ <li>%z(href("%R/urllist"))List of URLs used to access this repository</a>
 
63 @ </ul>
64 @ <li>On-line Documentation
65 @ <ul>
66 @ <li>%z(href("%R/help"))List of All Commands and Web Pages</a>
67 @ <li>%z(href("%R/test-all-help"))All "help" text on a single page</a>
68
--- src/sitemap.c
+++ src/sitemap.c
@@ -58,10 +58,11 @@
58 @ <li>%z(href("%R/attachlist"))List of Attachments</a>
59 @ <li>Repository Status
60 @ <ul>
61 @ <li>%z(href("%R/stat"))Status Summary</a>
62 @ <li>%z(href("%R/urllist"))List of URLs used to access this repository</a>
63 @ <li>%z(href("%R/test-describe-artifacts"))List of Artifacts</a>
64 @ </ul>
65 @ <li>On-line Documentation
66 @ <ul>
67 @ <li>%z(href("%R/help"))List of All Commands and Web Pages</a>
68 @ <li>%z(href("%R/test-all-help"))All "help" text on a single page</a>
69

Keyboard Shortcuts

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