Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Implement history display for tickets. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
b3ee50c9463214942d0af7055f4a06e2 |
| User & Date: | drh 2008-07-15 19:03:42.000 |
References
|
2008-11-20
| ||
| 00:36 | • Fixed ticket [c62fac40af]: Edit CSS/HTML in Setup adds extra CR/LF, wrong http Content-length plus 1 other change ... (artifact: e3d3a3ce3f user: drh) | |
|
2008-11-17
| ||
| 22:04 | • Ticket [c62fac40af]: 4 changes ... (artifact: 0582023acc user: anonymous) | |
|
2008-09-02
| ||
| 14:02 | • New ticket [c62fac40af]. ... (artifact: 727fdd03f3 user: anonymous) | |
Context
|
2008-07-17
| ||
| 01:49 | Avoid the use of chdir() since this seems to cause problems on windows. ... (check-in: 849b94c631 user: drh tags: trunk) | |
|
2008-07-15
| ||
| 19:03 | Implement history display for tickets. ... (check-in: b3ee50c946 user: drh tags: trunk) | |
| 16:42 | Work toward getting bug-tracking working well. ... (check-in: d3e711fd2f user: drh tags: trunk) | |
Changes
Changes to src/info.c.
| ︙ | ︙ | |||
789 790 791 792 793 794 795 796 797 798 799 800 801 802 | @ <blockquote><pre> content_get(rid, &content); @ %h(blob_str(&content)) @ </pre></blockquote> blob_reset(&content); style_footer(); } /* ** WEBPAGE: info ** URL: info/UUID ** ** The argument is a UUID which might be a baseline or a file or ** a ticket changes or a wiki editor or something else. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 |
@ <blockquote><pre>
content_get(rid, &content);
@ %h(blob_str(&content))
@ </pre></blockquote>
blob_reset(&content);
style_footer();
}
/*
** Return TRUE if the given BLOB contains a newline character.
*/
static int contains_newline(Blob *p){
const char *z = blob_str(p);
while( *z ){
if( *z=='\n' ) return 1;
z++;
}
return 0;
}
/*
** WEBPAGE: tinfo
** URL: /tinfo?name=UUID
**
** Show the details of a ticket change control artifact.
*/
void tinfo_page(void){
int rid;
Blob content;
char *zDate;
int i;
const char *zUuid;
char zTktName[20];
const char *z;
Manifest m;
login_check_credentials();
if( !g.okRdTkt ){ login_needed(); return; }
rid = name_to_rid(PD("name","0"));
if( rid==0 ){ fossil_redirect_home(); }
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( g.okAdmin ){
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1",
g.zTop, zUuid);
}else{
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
g.zTop, zUuid);
}
}
content_get(rid, &content);
if( manifest_parse(&m, &content)==0 ){
fossil_redirect_home();
}
if( m.type!=CFTYPE_TICKET ){
fossil_redirect_home();
}
style_header("Ticket Change Details");
zDate = db_text(0, "SELECT datetime(%.12f)", m.rDate);
memcpy(zTktName, m.zTicketUuid, 10);
zTktName[10] = 0;
@ <h2>Changes to ticket <a href="%s(m.zTicketUuid)">%s(zTktName)</a></h2>
@
@ <p>By %h(m.zUser) on %s(zDate). See also:
@ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@ <a href="%s(g.zTop)/tkthistory/%s(m.zTicketUuid)">ticket history</a>
@ </p>
@
@ <ol>
free(zDate);
for(i=0; i<m.nField; i++){
Blob val;
z = m.aField[i].zName;
blob_set(&val, m.aField[i].zValue);
if( z[0]=='+' ){
@ <li><p>Appended to %h(&z[1]):</p><blockquote>
wiki_convert(&val, 0, 0);
@ </blockquote></li>
}else if( blob_size(&val)<=50 && contains_newline(&val) ){
@ <li><p>Change %h(z) to:</p><blockquote>
wiki_convert(&val, 0, 0);
@ </blockquote></li>
}else{
@ <li><p>Change %h(z) to "%h(blob_str(&val))"</p></li>
}
blob_reset(&val);
}
manifest_clear(&m);
@ </ol>
style_footer();
}
/*
** WEBPAGE: info
** URL: info/UUID
**
** The argument is a UUID which might be a baseline or a file or
** a ticket changes or a wiki editor or something else.
|
| ︙ | ︙ | |||
829 830 831 832 833 834 835 836 837 838 839 840 |
}else
if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
finfo_page();
}else
if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)"
" WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){
winfo_page();
}else
{
artifact_page();
}
}
| > > > > | 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
}else
if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
finfo_page();
}else
if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)"
" WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){
winfo_page();
}else
if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)"
" WHERE rid=%d AND tagname LIKE 'tkt-%%'", rid) ){
tinfo_page();
}else
{
artifact_page();
}
}
|
Changes to src/manifest.c.
| ︙ | ︙ | |||
891 892 893 894 895 896 897 |
TAG_USER, rid,
TAG_COMMENT, rid
);
free(zComment);
}
if( m.type==CFTYPE_TICKET ){
char *zTag;
| | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > | | | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 |
TAG_USER, rid,
TAG_COMMENT, rid
);
free(zComment);
}
if( m.type==CFTYPE_TICKET ){
char *zTag;
Blob comment;
int i;
ticket_insert(&m, 1, 1);
zTag = mprintf("tkt-%s", m.zTicketUuid);
tag_insert(zTag, 1, 0, rid, m.rDate, rid);
free(zTag);
blob_zero(&comment);
if( m.nField==1 ){
if( m.aField[0].zName[0]=='+' ){
blob_appendf(&comment,
"Appended to %h in ticket [%.10s]",
&m.aField[0].zName[1], m.zTicketUuid
);
}else if( strlen(m.aField[0].zValue)<40 ){
blob_appendf(&comment,
"Changed %h to \"%h\" in ticket [%.10s]",
m.aField[0].zName, m.aField[0].zValue, m.zTicketUuid
);
}else{
blob_appendf(&comment,
"Changed %h in ticket [%.10s]",
m.aField[0].zName, m.zTicketUuid
);
}
}else{
const char *z;
const char *zSep = " ";
blob_appendf(&comment, "%d changes to ticket [%.10s]:",
m.nField, m.zTicketUuid);
for(i=0; i<m.nField; i++){
z = m.aField[i].zName;
if( z[0]=='+' ) z++;
blob_appendf(&comment, "%s%h", zSep, z);
zSep = ", ";
}
}
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,user,comment)"
"VALUES('t',%.17g,%d,%Q,%Q)",
m.rDate, rid, m.zUser, blob_str(&comment)
);
blob_reset(&comment);
}
db_end_transaction(0);
manifest_clear(&m);
return 1;
}
|
Changes to src/tkt.c.
| ︙ | ︙ | |||
302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
const char *zScript;
login_check_credentials();
if( !g.okRdTkt ){ login_needed(); return; }
if( g.okWrTkt ){
style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
g.zTop, PD("name",""));
}
style_header("View Ticket");
ticket_init();
initializeVariablesFromDb();
zScript = ticket_viewpage_code();
Th_Render(zScript);
style_footer();
}
| > > > > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
const char *zScript;
login_check_credentials();
if( !g.okRdTkt ){ login_needed(); return; }
if( g.okWrTkt ){
style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
g.zTop, PD("name",""));
}
if( g.okHistory ){
style_submenu_element("History", "History Of This Ticket",
"%s/tkthistory/%T", g.zTop, PD("name",""));
}
style_header("View Ticket");
ticket_init();
initializeVariablesFromDb();
zScript = ticket_viewpage_code();
Th_Render(zScript);
style_footer();
}
|
| ︙ | ︙ | |||
545 546 547 548 549 550 551 |
zErr = mprintf("schema fails to define a valid ticket table "
"containing all required fields");
return zErr;
}
}
return 0;
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
zErr = mprintf("schema fails to define a valid ticket table "
"containing all required fields");
return zErr;
}
}
return 0;
}
/*
** WEBPAGE: tkthistory
** URL: /tkthistory?name=TICKETUUID
**
** Show the complete change history for a single ticket
*/
void tkthistory_page(void){
Stmt q;
char *zTitle;
char *zSQL;
const char *zUuid;
int tagid;
login_check_credentials();
if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
zUuid = PD("name","");
zTitle = mprintf("History Of Ticket %h", zUuid);
style_header(zTitle);
free(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;
}
zSQL = mprintf("%s AND event.objid IN "
" (SELECT rid FROM tagxref WHERE tagid=%d) "
"ORDER BY mtime DESC",
timeline_query_for_www(), tagid);
db_prepare(&q, zSQL);
free(zSQL);
www_print_timeline(&q);
db_finalize(&q);
style_footer();
}
|