Fossil SCM

Add the "raw" query parameter to the /tkthistory page.

drh 2020-03-22 15:02 trunk
Commit 4c9e24fdcc334b97e76c764657bb6748e751691808dd8a90e57e08c85837f099
1 file changed +31 -3
+31 -3
--- src/tkt.c
+++ src/tkt.c
@@ -932,11 +932,18 @@
932932
933933
/*
934934
** WEBPAGE: tkthistory
935935
** URL: /tkthistory?name=TICKETUUID
936936
**
937
-** Show the complete change history for a single ticket
937
+** Show the complete change history for a single ticket. Or (to put it
938
+** another way) show a list of artifacts associated with a single ticket.
939
+**
940
+** By default, the artifacts are decoded and formatted. If the
941
+** "plaintext" query parameter is present, then icomment text fields
942
+** are shown as plain text rather than being formatted according
943
+** to mimetype. Or if the "raw" query parameter is present, then the
944
+** undecoded and unformatted text of each artifact is displayed.
938945
*/
939946
void tkthistory_page(void){
940947
Stmt q;
941948
char *zTitle;
942949
const char *zUuid;
@@ -952,23 +959,35 @@
952959
zTitle = mprintf("History Of Ticket %h", zUuid);
953960
style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
954961
style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
955962
g.zTop, zUuid);
956963
style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
957
- if( P("plaintext")!=0 ){
964
+ if( P("raw")!=0 ){
965
+ style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
966
+ style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
967
+ }else if( P("plaintext")!=0 ){
958968
style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
969
+ if( g.perm.Admin ){
970
+ style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
971
+ }
959972
}else{
960973
style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
974
+ if( g.perm.Admin ){
975
+ style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
976
+ }
961977
}
962978
style_header("%z", zTitle);
963979
964980
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
965981
if( tagid==0 ){
966982
@ No such ticket: %h(zUuid)
967983
style_footer();
968984
return;
969985
}
986
+ if( P("raw")!=0 ){
987
+ @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
988
+ }
970989
db_prepare(&q,
971990
"SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
972991
" FROM event, blob"
973992
" WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
974993
" AND blob.rid=event.objid"
@@ -1013,11 +1032,20 @@
10131032
@ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
10141033
@ (rid %d(rid)) by
10151034
hyperlink_to_user(pTicket->zUser,zDate," on");
10161035
hyperlink_to_date(zDate, ":");
10171036
@ </p>
1018
- ticket_output_change_artifact(pTicket, "a");
1037
+ if( P("raw")!=0 ){
1038
+ Blob c;
1039
+ content_get(rid, &c);
1040
+ @ <blockquote><pre>
1041
+ @ %h(blob_str(&c))
1042
+ @ </pre></blockquote>
1043
+ blob_reset(&c);
1044
+ }else{
1045
+ ticket_output_change_artifact(pTicket, "a");
1046
+ }
10191047
}
10201048
manifest_destroy(pTicket);
10211049
}
10221050
}
10231051
db_finalize(&q);
10241052
--- src/tkt.c
+++ src/tkt.c
@@ -932,11 +932,18 @@
932
933 /*
934 ** WEBPAGE: tkthistory
935 ** URL: /tkthistory?name=TICKETUUID
936 **
937 ** Show the complete change history for a single ticket
 
 
 
 
 
 
 
938 */
939 void tkthistory_page(void){
940 Stmt q;
941 char *zTitle;
942 const char *zUuid;
@@ -952,23 +959,35 @@
952 zTitle = mprintf("History Of Ticket %h", zUuid);
953 style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
954 style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
955 g.zTop, zUuid);
956 style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
957 if( P("plaintext")!=0 ){
 
 
 
958 style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
 
 
 
959 }else{
960 style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
 
 
 
961 }
962 style_header("%z", zTitle);
963
964 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
965 if( tagid==0 ){
966 @ No such ticket: %h(zUuid)
967 style_footer();
968 return;
969 }
 
 
 
970 db_prepare(&q,
971 "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
972 " FROM event, blob"
973 " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
974 " AND blob.rid=event.objid"
@@ -1013,11 +1032,20 @@
1013 @ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
1014 @ (rid %d(rid)) by
1015 hyperlink_to_user(pTicket->zUser,zDate," on");
1016 hyperlink_to_date(zDate, ":");
1017 @ </p>
1018 ticket_output_change_artifact(pTicket, "a");
 
 
 
 
 
 
 
 
 
1019 }
1020 manifest_destroy(pTicket);
1021 }
1022 }
1023 db_finalize(&q);
1024
--- src/tkt.c
+++ src/tkt.c
@@ -932,11 +932,18 @@
932
933 /*
934 ** WEBPAGE: tkthistory
935 ** URL: /tkthistory?name=TICKETUUID
936 **
937 ** Show the complete change history for a single ticket. Or (to put it
938 ** another way) show a list of artifacts associated with a single ticket.
939 **
940 ** By default, the artifacts are decoded and formatted. If the
941 ** "plaintext" query parameter is present, then icomment text fields
942 ** are shown as plain text rather than being formatted according
943 ** to mimetype. Or if the "raw" query parameter is present, then the
944 ** undecoded and unformatted text of each artifact is displayed.
945 */
946 void tkthistory_page(void){
947 Stmt q;
948 char *zTitle;
949 const char *zUuid;
@@ -952,23 +959,35 @@
959 zTitle = mprintf("History Of Ticket %h", zUuid);
960 style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
961 style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
962 g.zTop, zUuid);
963 style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
964 if( P("raw")!=0 ){
965 style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
966 style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
967 }else if( P("plaintext")!=0 ){
968 style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
969 if( g.perm.Admin ){
970 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
971 }
972 }else{
973 style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
974 if( g.perm.Admin ){
975 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
976 }
977 }
978 style_header("%z", zTitle);
979
980 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
981 if( tagid==0 ){
982 @ No such ticket: %h(zUuid)
983 style_footer();
984 return;
985 }
986 if( P("raw")!=0 ){
987 @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
988 }
989 db_prepare(&q,
990 "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
991 " FROM event, blob"
992 " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
993 " AND blob.rid=event.objid"
@@ -1013,11 +1032,20 @@
1032 @ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
1033 @ (rid %d(rid)) by
1034 hyperlink_to_user(pTicket->zUser,zDate," on");
1035 hyperlink_to_date(zDate, ":");
1036 @ </p>
1037 if( P("raw")!=0 ){
1038 Blob c;
1039 content_get(rid, &c);
1040 @ <blockquote><pre>
1041 @ %h(blob_str(&c))
1042 @ </pre></blockquote>
1043 blob_reset(&c);
1044 }else{
1045 ticket_output_change_artifact(pTicket, "a");
1046 }
1047 }
1048 manifest_destroy(pTicket);
1049 }
1050 }
1051 db_finalize(&q);
1052

Keyboard Shortcuts

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