Fossil SCM

Put all sections of the /vinfo page (or the /info page for a check-in) inside an accordion widget.

drh 2022-08-02 20:55 trunk
Commit ab553393a1675e36200fe2c34c15c5c57255967235abae4058d6c75a27d68b43
2 files changed +11 -1 +11 -5
+11 -1
--- src/backlink.c
+++ src/backlink.c
@@ -34,10 +34,11 @@
3434
*/
3535
void render_backlink_graph(const char *zUuid, const char *zLabel){
3636
Blob sql;
3737
Stmt q;
3838
char *zGlob;
39
+ int needEndPanel = 0;
3940
zGlob = mprintf("%.5s*", zUuid);
4041
db_multi_exec(
4142
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);\n"
4243
"DELETE FROM ok;\n"
4344
"INSERT OR IGNORE INTO ok(rid)\n"
@@ -49,19 +50,28 @@
4950
" WHERE target GLOB %Q"
5051
" AND %Q GLOB (target || '*');",
5152
zGlob, zUuid
5253
);
5354
if( !db_exists("SELECT 1 FROM ok") ) return;
54
- if( zLabel ) cgi_printf("%s", zLabel);
55
+ if( zLabel ){
56
+ cgi_printf("%s", zLabel);
57
+ if( strstr(zLabel, "accordion")!=0 ){
58
+ cgi_printf("<div class=\"accordion_panel\">\n");
59
+ needEndPanel = 1;
60
+ }
61
+ }
5562
blob_zero(&sql);
5663
blob_append(&sql, timeline_query_for_www(), -1);
5764
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
5865
db_prepare(&q, "%s", blob_sql_text(&sql));
5966
www_print_timeline(&q,
6067
TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL|TIMELINE_REFS,
6168
0, 0, 0, 0, 0, 0);
6269
db_finalize(&q);
70
+ if( needEndPanel ){
71
+ cgi_printf("</div>\n");
72
+ }
6373
}
6474
6575
/*
6676
** WEBPAGE: test-backlink-timeline
6777
**
6878
--- src/backlink.c
+++ src/backlink.c
@@ -34,10 +34,11 @@
34 */
35 void render_backlink_graph(const char *zUuid, const char *zLabel){
36 Blob sql;
37 Stmt q;
38 char *zGlob;
 
39 zGlob = mprintf("%.5s*", zUuid);
40 db_multi_exec(
41 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);\n"
42 "DELETE FROM ok;\n"
43 "INSERT OR IGNORE INTO ok(rid)\n"
@@ -49,19 +50,28 @@
49 " WHERE target GLOB %Q"
50 " AND %Q GLOB (target || '*');",
51 zGlob, zUuid
52 );
53 if( !db_exists("SELECT 1 FROM ok") ) return;
54 if( zLabel ) cgi_printf("%s", zLabel);
 
 
 
 
 
 
55 blob_zero(&sql);
56 blob_append(&sql, timeline_query_for_www(), -1);
57 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
58 db_prepare(&q, "%s", blob_sql_text(&sql));
59 www_print_timeline(&q,
60 TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL|TIMELINE_REFS,
61 0, 0, 0, 0, 0, 0);
62 db_finalize(&q);
 
 
 
63 }
64
65 /*
66 ** WEBPAGE: test-backlink-timeline
67 **
68
--- src/backlink.c
+++ src/backlink.c
@@ -34,10 +34,11 @@
34 */
35 void render_backlink_graph(const char *zUuid, const char *zLabel){
36 Blob sql;
37 Stmt q;
38 char *zGlob;
39 int needEndPanel = 0;
40 zGlob = mprintf("%.5s*", zUuid);
41 db_multi_exec(
42 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);\n"
43 "DELETE FROM ok;\n"
44 "INSERT OR IGNORE INTO ok(rid)\n"
@@ -49,19 +50,28 @@
50 " WHERE target GLOB %Q"
51 " AND %Q GLOB (target || '*');",
52 zGlob, zUuid
53 );
54 if( !db_exists("SELECT 1 FROM ok") ) return;
55 if( zLabel ){
56 cgi_printf("%s", zLabel);
57 if( strstr(zLabel, "accordion")!=0 ){
58 cgi_printf("<div class=\"accordion_panel\">\n");
59 needEndPanel = 1;
60 }
61 }
62 blob_zero(&sql);
63 blob_append(&sql, timeline_query_for_www(), -1);
64 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
65 db_prepare(&q, "%s", blob_sql_text(&sql));
66 www_print_timeline(&q,
67 TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL|TIMELINE_REFS,
68 0, 0, 0, 0, 0, 0);
69 db_finalize(&q);
70 if( needEndPanel ){
71 cgi_printf("</div>\n");
72 }
73 }
74
75 /*
76 ** WEBPAGE: test-backlink-timeline
77 **
78
+11 -5
--- src/info.c
+++ src/info.c
@@ -680,11 +680,12 @@
680680
zUser = zEUser ? zEUser : zOrigUser;
681681
zComment = db_column_text(&q1, 3);
682682
zDate = db_column_text(&q1,1);
683683
zOrigDate = db_column_text(&q1, 4);
684684
if( zOrigDate==0 ) zOrigDate = zDate;
685
- @ <div class="section">Overview</div>
685
+ @ <div class="section accordion">Overview</div>
686
+ @ <div class="accordion_panel">
686687
@ <table class="label-value">
687688
@ <tr><th>Comment:</th><td class="infoComment">\
688689
@ %!W(zEComment?zEComment:zComment)</td></tr>
689690
690691
/* The Download: line */
@@ -868,17 +869,21 @@
868869
}else{
869870
style_header("Check-in Information");
870871
login_anonymous_available();
871872
}
872873
db_finalize(&q1);
874
+ @ </div>
875
+ builtin_request_js("accordion.js");
873876
if( !PB("nowiki") ){
874877
wiki_render_associated("checkin", zUuid, 0);
875878
}
876
- render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
877
- @ <div class="section">Context</div>
879
+ render_backlink_graph(zUuid,
880
+ "<div class=\"section accordion\">References</div>\n");
881
+ @ <div class="section accordion">Context</div><div class="accordion_panel">
878882
render_checkin_context(rid, 0, 0, 0);
879
- @ <div class="section">Changes</div>
883
+ @ </div><div class="section accordion">Changes</div>
884
+ @ <div class="accordion_panel">
880885
@ <div class="sectionmenu">
881886
pCfg = construct_diff_flags(diffType, &DCfg);
882887
DCfg.pRe = pRe;
883888
zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
884889
if( diffType!=0 ){
@@ -907,11 +912,11 @@
907912
@ Patch</a>
908913
}
909914
if( g.perm.Admin ){
910915
@ %z(chref("button","%R/mlink?ci=%!S",zUuid))MLink Table</a>
911916
}
912
- @</div>
917
+ @ </div>
913918
if( pRe ){
914919
@ <p><b>Only differences that match regular expression "%h(zRe)"
915920
@ are shown.</b></p>
916921
}
917922
db_prepare(&q3,
@@ -935,10 +940,11 @@
935940
const char *zOldName = db_column_text(&q3, 4);
936941
append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
937942
pCfg,mperm);
938943
}
939944
db_finalize(&q3);
945
+ @ </div>
940946
append_diff_javascript(diffType);
941947
style_finish_page();
942948
}
943949
944950
/*
945951
--- src/info.c
+++ src/info.c
@@ -680,11 +680,12 @@
680 zUser = zEUser ? zEUser : zOrigUser;
681 zComment = db_column_text(&q1, 3);
682 zDate = db_column_text(&q1,1);
683 zOrigDate = db_column_text(&q1, 4);
684 if( zOrigDate==0 ) zOrigDate = zDate;
685 @ <div class="section">Overview</div>
 
686 @ <table class="label-value">
687 @ <tr><th>Comment:</th><td class="infoComment">\
688 @ %!W(zEComment?zEComment:zComment)</td></tr>
689
690 /* The Download: line */
@@ -868,17 +869,21 @@
868 }else{
869 style_header("Check-in Information");
870 login_anonymous_available();
871 }
872 db_finalize(&q1);
 
 
873 if( !PB("nowiki") ){
874 wiki_render_associated("checkin", zUuid, 0);
875 }
876 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
877 @ <div class="section">Context</div>
 
878 render_checkin_context(rid, 0, 0, 0);
879 @ <div class="section">Changes</div>
 
880 @ <div class="sectionmenu">
881 pCfg = construct_diff_flags(diffType, &DCfg);
882 DCfg.pRe = pRe;
883 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
884 if( diffType!=0 ){
@@ -907,11 +912,11 @@
907 @ Patch</a>
908 }
909 if( g.perm.Admin ){
910 @ %z(chref("button","%R/mlink?ci=%!S",zUuid))MLink Table</a>
911 }
912 @</div>
913 if( pRe ){
914 @ <p><b>Only differences that match regular expression "%h(zRe)"
915 @ are shown.</b></p>
916 }
917 db_prepare(&q3,
@@ -935,10 +940,11 @@
935 const char *zOldName = db_column_text(&q3, 4);
936 append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
937 pCfg,mperm);
938 }
939 db_finalize(&q3);
 
940 append_diff_javascript(diffType);
941 style_finish_page();
942 }
943
944 /*
945
--- src/info.c
+++ src/info.c
@@ -680,11 +680,12 @@
680 zUser = zEUser ? zEUser : zOrigUser;
681 zComment = db_column_text(&q1, 3);
682 zDate = db_column_text(&q1,1);
683 zOrigDate = db_column_text(&q1, 4);
684 if( zOrigDate==0 ) zOrigDate = zDate;
685 @ <div class="section accordion">Overview</div>
686 @ <div class="accordion_panel">
687 @ <table class="label-value">
688 @ <tr><th>Comment:</th><td class="infoComment">\
689 @ %!W(zEComment?zEComment:zComment)</td></tr>
690
691 /* The Download: line */
@@ -868,17 +869,21 @@
869 }else{
870 style_header("Check-in Information");
871 login_anonymous_available();
872 }
873 db_finalize(&q1);
874 @ </div>
875 builtin_request_js("accordion.js");
876 if( !PB("nowiki") ){
877 wiki_render_associated("checkin", zUuid, 0);
878 }
879 render_backlink_graph(zUuid,
880 "<div class=\"section accordion\">References</div>\n");
881 @ <div class="section accordion">Context</div><div class="accordion_panel">
882 render_checkin_context(rid, 0, 0, 0);
883 @ </div><div class="section accordion">Changes</div>
884 @ <div class="accordion_panel">
885 @ <div class="sectionmenu">
886 pCfg = construct_diff_flags(diffType, &DCfg);
887 DCfg.pRe = pRe;
888 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
889 if( diffType!=0 ){
@@ -907,11 +912,11 @@
912 @ Patch</a>
913 }
914 if( g.perm.Admin ){
915 @ %z(chref("button","%R/mlink?ci=%!S",zUuid))MLink Table</a>
916 }
917 @ </div>
918 if( pRe ){
919 @ <p><b>Only differences that match regular expression "%h(zRe)"
920 @ are shown.</b></p>
921 }
922 db_prepare(&q3,
@@ -935,10 +940,11 @@
940 const char *zOldName = db_column_text(&q3, 4);
941 append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
942 pCfg,mperm);
943 }
944 db_finalize(&q3);
945 @ </div>
946 append_diff_javascript(diffType);
947 style_finish_page();
948 }
949
950 /*
951

Keyboard Shortcuts

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