933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
|
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
|
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
|
/*
** WEBPAGE: tkthistory
** URL: /tkthistory?name=TICKETUUID
**
** Show the complete change history for a single ticket. Or (to put it
** another way) show a list of artifacts associated with a single ticket.
**
** By default, the artifacts are decoded and formatted. If the
** By default, the artifacts are decoded and formatted. Text fields
** "plaintext" query parameter is present, then icomment text fields
** are shown as plain text rather than being formatted according
** to mimetype. Or if the "raw" query parameter is present, then the
** undecoded and unformatted text of each artifact is displayed.
** are formatted as text/plain, since in the general case Fossil does
** not have knowledge of the encoding. If the "raw" query parameter
** is present, then the* undecoded and unformatted text of each artifact
** is displayed.
*/
void tkthistory_page(void){
Stmt q;
char *zTitle;
const char *zUuid;
int tagid;
int nChng = 0;
login_check_credentials();
if( !g.perm.Hyperlink || !g.perm.RdTkt ){
login_needed(g.anon.Hyperlink && g.anon.RdTkt);
return;
}
zUuid = PD("name","");
zTitle = mprintf("History Of Ticket %h", zUuid);
style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
g.zTop, zUuid);
style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
if( P("raw")!=0 ){
style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
}else if( P("plaintext")!=0 ){
style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
if( g.perm.Admin ){
style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
}else if( g.perm.Admin ){
style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
}
}else{
style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
if( g.perm.Admin ){
style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
}
}
style_header("%z", zTitle);
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
if( tagid==0 ){
@ No such ticket: %h(zUuid)
style_footer();
return;
}
if( P("raw")!=0 ){
@ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
}else{
@ <h2>Artifacts Associated With Ticket %h(zUuid)</h2>
}
db_prepare(&q,
"SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
" FROM event, blob"
" WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
" AND blob.rid=event.objid"
" UNION "
|
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
|
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
|
-
-
+
+
-
-
-
-
-
-
+
-
+
|
/*
** The pTkt object is a ticket change artifact. Output a detailed
** description of this object.
*/
void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){
int i;
int wikiFlags = WIKI_NOBADLINKS;
const char *zBlock = "<blockquote>";
const char *zEnd = "</blockquote>";
const char *zBlock = "<blockquote><pre class='verbatim'>";
const char *zEnd = "</pre></blockquote>";
if( P("plaintext")!=0 ){
wikiFlags |= WIKI_LINKSONLY;
zBlock = "<blockquote><pre class='verbatim'>";
zEnd = "</pre></blockquote>";
}
if( zListType==0 ) zListType = "1";
@ <ol type="%s(zListType)">
for(i=0; i<pTkt->nField; i++){
Blob val;
const char *z;
z = pTkt->aField[i].zName;
blob_set(&val, pTkt->aField[i].zValue);
if( z[0]=='+' ){
@ <li>Appended to %h(&z[1]):%s(zBlock)
wiki_convert(&val, 0, wikiFlags);
@ %h(blob_str(&val))
@ %s(zEnd)</li>
}else if( blob_size(&val)>50 || contains_newline(&val) ){
@ <li>Change %h(z) to:%s(zBlock)
wiki_convert(&val, 0, wikiFlags);
@ %h(blob_str(&val))
@ %s(zEnd)</li>
}else{
@ <li>Change %h(z) to "%h(blob_str(&val))"</li>
}
blob_reset(&val);
}
@ </ol>
|