Fossil SCM

On the /wiki page, put text to show that the page has been deleted.

drh 2018-12-11 18:55 trunk
Commit c7a7a5611762df9a0b6529994c9d521bd2593a812ef7f181b86e1b36368b6a4d
1 file changed +23 -5
+23 -5
--- src/wiki.c
+++ src/wiki.c
@@ -415,13 +415,17 @@
415415
}
416416
}
417417
style_set_current_page("%T?name=%T", g.zPath, zPageName);
418418
style_header("%s", zPageName);
419419
wiki_standard_submenu(submenuFlags);
420
- blob_init(&wiki, zBody, -1);
421
- wiki_render_by_mimetype(&wiki, zMimetype);
422
- blob_reset(&wiki);
420
+ if( zBody[0]==0 ){
421
+ @ <i>This page has been deleted</i>
422
+ }else{
423
+ blob_init(&wiki, zBody, -1);
424
+ wiki_render_by_mimetype(&wiki, zMimetype);
425
+ blob_reset(&wiki);
426
+ }
423427
attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
424428
manifest_destroy(pWiki);
425429
style_footer();
426430
}
427431
@@ -854,37 +858,43 @@
854858
** Function called to output extra text at the end of each line in
855859
** a wiki history listing.
856860
*/
857861
static void wiki_history_extra(int rid){
858862
if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){
859
- @ %z(href("%R/wdiff?name=%t&a=%d",zWikiPageName,rid))[diff]</a>
863
+ @ &nbsp;op: %z(href("%R/wdiff?name=%t&a=%d",zWikiPageName,rid))diff</a>\
860864
}
861865
}
862866
863867
/*
864868
** WEBPAGE: whistory
865869
** URL: /whistory?name=PAGENAME
866870
**
871
+** Additional parameters:
872
+**
873
+** showid Show RID values
874
+**
867875
** Show the complete change history for a single wiki page.
868876
*/
869877
void whistory_page(void){
870878
Stmt q;
871879
const char *zPageName;
880
+ int tmFlags = TIMELINE_ARTID;
872881
login_check_credentials();
873882
if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
874883
zPageName = PD("name","");
875884
style_header("History Of %s", zPageName);
885
+ if( P("showid")!=0 ) tmFlags |= TIMELINE_SHOWRID;
876886
877887
db_prepare(&q, "%s AND event.objid IN "
878888
" (SELECT rid FROM tagxref WHERE tagid="
879889
"(SELECT tagid FROM tag WHERE tagname='wiki-%q')"
880890
" UNION SELECT attachid FROM attachment"
881891
" WHERE target=%Q)"
882892
"ORDER BY mtime DESC",
883893
timeline_query_for_www(), zPageName, zPageName);
884894
zWikiPageName = zPageName;
885
- www_print_timeline(&q, TIMELINE_ARTID, 0, 0, 0, wiki_history_extra);
895
+ www_print_timeline(&q, tmFlags, 0, 0, 0, wiki_history_extra);
886896
db_finalize(&q);
887897
style_footer();
888898
}
889899
890900
/*
@@ -965,17 +975,19 @@
965975
966976
/*
967977
** WEBPAGE: wcontent
968978
**
969979
** all=1 Show deleted pages
980
+** showid Show rid values for each page.
970981
**
971982
** List all available wiki pages with date created and last modified.
972983
*/
973984
void wcontent_page(void){
974985
Stmt q;
975986
double rNow;
976987
int showAll = P("all")!=0;
988
+ int showRid = P("showid")!=0;
977989
978990
login_check_credentials();
979991
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
980992
style_header("Available Wiki Pages");
981993
if( showAll ){
@@ -989,10 +1001,13 @@
9891001
@ <table class='sortable' data-column-types='tKN' data-init-sort='1'>
9901002
@ <thead><tr>
9911003
@ <th>Name</th>
9921004
@ <th>Last Change</th>
9931005
@ <th>Versions</th>
1006
+ if( showRid ){
1007
+ @ <th>RID</th>
1008
+ }
9941009
@ </tr></thead><tbody>
9951010
rNow = db_double(0.0, "SELECT julianday('now')");
9961011
while( db_step(&q)==SQLITE_ROW ){
9971012
const char *zWName = db_column_text(&q, 0);
9981013
const char *zSort = db_column_text(&q, 1);
@@ -1011,10 +1026,13 @@
10111026
}
10121027
zAge = human_readable_age(rNow - rWmtime);
10131028
@ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
10141029
fossil_free(zAge);
10151030
@ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td>
1031
+ if( showRid ){
1032
+ @ <td>%d(wrid)</td>
1033
+ }
10161034
@ </tr>
10171035
}
10181036
@ </tbody></table></div>
10191037
db_finalize(&q);
10201038
style_table_sorter();
10211039
--- src/wiki.c
+++ src/wiki.c
@@ -415,13 +415,17 @@
415 }
416 }
417 style_set_current_page("%T?name=%T", g.zPath, zPageName);
418 style_header("%s", zPageName);
419 wiki_standard_submenu(submenuFlags);
420 blob_init(&wiki, zBody, -1);
421 wiki_render_by_mimetype(&wiki, zMimetype);
422 blob_reset(&wiki);
 
 
 
 
423 attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
424 manifest_destroy(pWiki);
425 style_footer();
426 }
427
@@ -854,37 +858,43 @@
854 ** Function called to output extra text at the end of each line in
855 ** a wiki history listing.
856 */
857 static void wiki_history_extra(int rid){
858 if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){
859 @ %z(href("%R/wdiff?name=%t&a=%d",zWikiPageName,rid))[diff]</a>
860 }
861 }
862
863 /*
864 ** WEBPAGE: whistory
865 ** URL: /whistory?name=PAGENAME
866 **
 
 
 
 
867 ** Show the complete change history for a single wiki page.
868 */
869 void whistory_page(void){
870 Stmt q;
871 const char *zPageName;
 
872 login_check_credentials();
873 if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
874 zPageName = PD("name","");
875 style_header("History Of %s", zPageName);
 
876
877 db_prepare(&q, "%s AND event.objid IN "
878 " (SELECT rid FROM tagxref WHERE tagid="
879 "(SELECT tagid FROM tag WHERE tagname='wiki-%q')"
880 " UNION SELECT attachid FROM attachment"
881 " WHERE target=%Q)"
882 "ORDER BY mtime DESC",
883 timeline_query_for_www(), zPageName, zPageName);
884 zWikiPageName = zPageName;
885 www_print_timeline(&q, TIMELINE_ARTID, 0, 0, 0, wiki_history_extra);
886 db_finalize(&q);
887 style_footer();
888 }
889
890 /*
@@ -965,17 +975,19 @@
965
966 /*
967 ** WEBPAGE: wcontent
968 **
969 ** all=1 Show deleted pages
 
970 **
971 ** List all available wiki pages with date created and last modified.
972 */
973 void wcontent_page(void){
974 Stmt q;
975 double rNow;
976 int showAll = P("all")!=0;
 
977
978 login_check_credentials();
979 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
980 style_header("Available Wiki Pages");
981 if( showAll ){
@@ -989,10 +1001,13 @@
989 @ <table class='sortable' data-column-types='tKN' data-init-sort='1'>
990 @ <thead><tr>
991 @ <th>Name</th>
992 @ <th>Last Change</th>
993 @ <th>Versions</th>
 
 
 
994 @ </tr></thead><tbody>
995 rNow = db_double(0.0, "SELECT julianday('now')");
996 while( db_step(&q)==SQLITE_ROW ){
997 const char *zWName = db_column_text(&q, 0);
998 const char *zSort = db_column_text(&q, 1);
@@ -1011,10 +1026,13 @@
1011 }
1012 zAge = human_readable_age(rNow - rWmtime);
1013 @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
1014 fossil_free(zAge);
1015 @ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td>
 
 
 
1016 @ </tr>
1017 }
1018 @ </tbody></table></div>
1019 db_finalize(&q);
1020 style_table_sorter();
1021
--- src/wiki.c
+++ src/wiki.c
@@ -415,13 +415,17 @@
415 }
416 }
417 style_set_current_page("%T?name=%T", g.zPath, zPageName);
418 style_header("%s", zPageName);
419 wiki_standard_submenu(submenuFlags);
420 if( zBody[0]==0 ){
421 @ <i>This page has been deleted</i>
422 }else{
423 blob_init(&wiki, zBody, -1);
424 wiki_render_by_mimetype(&wiki, zMimetype);
425 blob_reset(&wiki);
426 }
427 attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
428 manifest_destroy(pWiki);
429 style_footer();
430 }
431
@@ -854,37 +858,43 @@
858 ** Function called to output extra text at the end of each line in
859 ** a wiki history listing.
860 */
861 static void wiki_history_extra(int rid){
862 if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){
863 @ &nbsp;op: %z(href("%R/wdiff?name=%t&a=%d",zWikiPageName,rid))diff</a>\
864 }
865 }
866
867 /*
868 ** WEBPAGE: whistory
869 ** URL: /whistory?name=PAGENAME
870 **
871 ** Additional parameters:
872 **
873 ** showid Show RID values
874 **
875 ** Show the complete change history for a single wiki page.
876 */
877 void whistory_page(void){
878 Stmt q;
879 const char *zPageName;
880 int tmFlags = TIMELINE_ARTID;
881 login_check_credentials();
882 if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
883 zPageName = PD("name","");
884 style_header("History Of %s", zPageName);
885 if( P("showid")!=0 ) tmFlags |= TIMELINE_SHOWRID;
886
887 db_prepare(&q, "%s AND event.objid IN "
888 " (SELECT rid FROM tagxref WHERE tagid="
889 "(SELECT tagid FROM tag WHERE tagname='wiki-%q')"
890 " UNION SELECT attachid FROM attachment"
891 " WHERE target=%Q)"
892 "ORDER BY mtime DESC",
893 timeline_query_for_www(), zPageName, zPageName);
894 zWikiPageName = zPageName;
895 www_print_timeline(&q, tmFlags, 0, 0, 0, wiki_history_extra);
896 db_finalize(&q);
897 style_footer();
898 }
899
900 /*
@@ -965,17 +975,19 @@
975
976 /*
977 ** WEBPAGE: wcontent
978 **
979 ** all=1 Show deleted pages
980 ** showid Show rid values for each page.
981 **
982 ** List all available wiki pages with date created and last modified.
983 */
984 void wcontent_page(void){
985 Stmt q;
986 double rNow;
987 int showAll = P("all")!=0;
988 int showRid = P("showid")!=0;
989
990 login_check_credentials();
991 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
992 style_header("Available Wiki Pages");
993 if( showAll ){
@@ -989,10 +1001,13 @@
1001 @ <table class='sortable' data-column-types='tKN' data-init-sort='1'>
1002 @ <thead><tr>
1003 @ <th>Name</th>
1004 @ <th>Last Change</th>
1005 @ <th>Versions</th>
1006 if( showRid ){
1007 @ <th>RID</th>
1008 }
1009 @ </tr></thead><tbody>
1010 rNow = db_double(0.0, "SELECT julianday('now')");
1011 while( db_step(&q)==SQLITE_ROW ){
1012 const char *zWName = db_column_text(&q, 0);
1013 const char *zSort = db_column_text(&q, 1);
@@ -1011,10 +1026,13 @@
1026 }
1027 zAge = human_readable_age(rNow - rWmtime);
1028 @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
1029 fossil_free(zAge);
1030 @ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td>
1031 if( showRid ){
1032 @ <td>%d(wrid)</td>
1033 }
1034 @ </tr>
1035 }
1036 @ </tbody></table></div>
1037 db_finalize(&q);
1038 style_table_sorter();
1039

Keyboard Shortcuts

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