Fossil SCM
Add the "raw" query parameter to the /tkthistory page.
Commit
4c9e24fdcc334b97e76c764657bb6748e751691808dd8a90e57e08c85837f099
Parent
8d114c2aff3a241…
1 file changed
+31
-3
+31
-3
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -932,11 +932,18 @@ | ||
| 932 | 932 | |
| 933 | 933 | /* |
| 934 | 934 | ** WEBPAGE: tkthistory |
| 935 | 935 | ** URL: /tkthistory?name=TICKETUUID |
| 936 | 936 | ** |
| 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. | |
| 938 | 945 | */ |
| 939 | 946 | void tkthistory_page(void){ |
| 940 | 947 | Stmt q; |
| 941 | 948 | char *zTitle; |
| 942 | 949 | const char *zUuid; |
| @@ -952,23 +959,35 @@ | ||
| 952 | 959 | zTitle = mprintf("History Of Ticket %h", zUuid); |
| 953 | 960 | style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid); |
| 954 | 961 | style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci", |
| 955 | 962 | g.zTop, zUuid); |
| 956 | 963 | 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 ){ | |
| 958 | 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 | + } | |
| 959 | 972 | }else{ |
| 960 | 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 | + } | |
| 961 | 977 | } |
| 962 | 978 | style_header("%z", zTitle); |
| 963 | 979 | |
| 964 | 980 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); |
| 965 | 981 | if( tagid==0 ){ |
| 966 | 982 | @ No such ticket: %h(zUuid) |
| 967 | 983 | style_footer(); |
| 968 | 984 | return; |
| 969 | 985 | } |
| 986 | + if( P("raw")!=0 ){ | |
| 987 | + @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2> | |
| 988 | + } | |
| 970 | 989 | db_prepare(&q, |
| 971 | 990 | "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL" |
| 972 | 991 | " FROM event, blob" |
| 973 | 992 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 974 | 993 | " AND blob.rid=event.objid" |
| @@ -1013,11 +1032,20 @@ | ||
| 1013 | 1032 | @ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>] |
| 1014 | 1033 | @ (rid %d(rid)) by |
| 1015 | 1034 | hyperlink_to_user(pTicket->zUser,zDate," on"); |
| 1016 | 1035 | hyperlink_to_date(zDate, ":"); |
| 1017 | 1036 | @ </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 | + } | |
| 1019 | 1047 | } |
| 1020 | 1048 | manifest_destroy(pTicket); |
| 1021 | 1049 | } |
| 1022 | 1050 | } |
| 1023 | 1051 | db_finalize(&q); |
| 1024 | 1052 |
| --- 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 |