723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
|
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
|
+
-
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
+
|
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;
}
db_prepare(&q,
"SELECT datetime(mtime,'localtime'), objid, uuid, NULL, NULL, NULL"
"SELECT objid, uuid FROM event, blob"
" FROM event, blob"
" WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
" AND blob.rid=event.objid"
" UNION "
"SELECT datetime(mtime,'localtime'), attachid, uuid, src, filename, user"
" FROM attachment, blob"
" WHERE isLatest AND target=(SELECT substr(tagname,5) FROM tag"
" WHERE tagid=%d)"
" AND blob.rid=attachid"
" ORDER BY mtime DESC",
tagid
" ORDER BY 1 DESC",
tagid, tagid
);
while( db_step(&q)==SQLITE_ROW ){
Blob content;
Manifest m;
char zShort[12];
const char *zDate = db_column_text(&q, 0);
int rid = db_column_int(&q, 0);
const char *zChngUuid = db_column_text(&q, 1);
int rid = db_column_int(&q, 1);
const char *zChngUuid = db_column_text(&q, 2);
content_get(rid, &content);
if( manifest_parse(&m, &content) && m.type==CFTYPE_TICKET ){
char *zDate = db_text(0, "SELECT datetime(%.12f)", m.rDate);
char zUuid[12];
memcpy(zUuid, zChngUuid, 10);
zUuid[10] = 0;
@
@ Ticket change
@ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zUuid)</a>]</a>
const char *zFile = db_column_text(&q, 4);
memcpy(zShort, zChngUuid, 10);
zShort[10] = 0;
if( zFile!=0 ){
const char *zSrc = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 5);
if( zSrc==0 ){
@
@ <p>Delete attachment "%h(zFile)"
}else{
@
@ <p>Add attachment "%h(zFile)"
}
@ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zShort)</a>]
@ (rid %d(rid)) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".</p>");
}else{
content_get(rid, &content);
if( manifest_parse(&m, &content) && m.type==CFTYPE_TICKET ){
@
@ <p>Ticket change
@ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zShort)</a>]
@ (rid %d(rid)) by
hyperlink_to_user(m.zUser,zDate," on");
hyperlink_to_date(zDate, ":");
hyperlink_to_user(m.zUser,zDate," on");
hyperlink_to_date(zDate, ":");
free(zDate);
ticket_output_change_artifact(&m);
}
manifest_clear(&m);
ticket_output_change_artifact(&m);
@ </p>
}
manifest_clear(&m);
}
}
db_finalize(&q);
style_footer();
}
/*
** Return TRUE if the given BLOB contains a newline character.
|