Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | More improvements to the timeline display of ticket changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
f0c8693845d31d6592eafd35e4243f2e |
| User & Date: | drh 2008-10-20 06:41:12.000 |
Context
|
2008-10-20
| ||
| 16:05 | Improvements in the display of ticket history. ... (check-in: c8a78004ce user: drh tags: trunk) | |
| 06:41 | More improvements to the timeline display of ticket changes. ... (check-in: f0c8693845 user: drh tags: trunk) | |
|
2008-10-18
| ||
| 20:29 | Add the "version" command to print out the source-code version number for the fossil executable. ... (check-in: a1f727be9d user: drh tags: trunk) | |
Changes
Changes to src/manifest.c.
| ︙ | ︙ | |||
890 891 892 893 894 895 896 897 898 899 |
TAG_BGCOLOR, rid,
TAG_USER, rid,
TAG_COMMENT, rid
);
free(zComment);
}
if( m.type==CFTYPE_TICKET ){
char *zTag;
Blob comment;
| > > > > > > > | > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > > > > > > > > > > > > > | 890 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 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 995 996 997 998 999 1000 1001 1002 1003 1004 |
TAG_BGCOLOR, rid,
TAG_USER, rid,
TAG_COMMENT, rid
);
free(zComment);
}
if( m.type==CFTYPE_TICKET ){
int i;
char *zTitle;
char *zTag;
Blob comment;
char *zNewStatus = 0;
static char *zTitleExpr = 0;
static char *zStatusColumn = 0;
static int once = 1;
int isNew;
isNew = 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 0
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{
int i;
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 = ", ";
}
int i;
const char *zStatus = 0;
const char *zTitle;
for(i=0; i<m.nField; i++){
z = m.aField[i].zName;
if( strcmp(z, "status") ) zStatus = m.aField[i].zValue;
}
if( zField
blob_appendf(&comment, "Edits to ticket [%.10s]", m.zTicketUuid);
}
#endif
if( once ){
once = 0;
zTitleExpr = db_get("ticket-title-expr", "title");
zStatusColumn = db_get("ticket-status-column", "status");
}
zTitle = db_text("unknown",
"SELECT %s FROM ticket WHERE tkt_uuid='%s'",
zTitleExpr, m.zTicketUuid
);
if( !isNew ){
for(i=0; i<m.nField; i++){
if( strcmp(m.aField[i].zName, zStatusColumn)==0 ){
zNewStatus = m.aField[i].zValue;
}
}
if( zNewStatus ){
blob_appendf(&comment, "%h ticket [%.10s]: <i>%h</i>",
zNewStatus, m.zTicketUuid, zTitle
);
if( m.nField>1 ){
blob_appendf(&comment, " plus %d other change%s",
m.nField-1, m.nField==2 ? "" : "s");
}
}else{
zNewStatus = db_text("unknown",
"SELECT %s FROM ticket WHERE tkt_uuid='%s'",
zStatusColumn, m.zTicketUuid
);
blob_appendf(&comment, "Ticket [%.10s] <i>%h</i> status still %h with "
"%d other change%s",
m.zTicketUuid, zTitle, zNewStatus, m.nField,
m.nField==1 ? "" : "s"
);
free(zNewStatus);
}
}else{
blob_appendf(&comment, "New ticket [%.10s] <i>%h</i>.",
m.zTicketUuid, zTitle
);
}
free(zTitle);
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.
| ︙ | ︙ | |||
184 185 186 187 188 189 190 191 | /* ** Update an entry of the TICKET table according to the information ** in the control file given in p. Attempt to create the appropriate ** TICKET table entry if createFlag is true. If createFlag is false, ** that means we already know the entry exists and so we can save the ** work of trying to create it. */ | > > > | > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
/*
** Update an entry of the TICKET table according to the information
** in the control file given in p. Attempt to create the appropriate
** TICKET table entry if createFlag is true. If createFlag is false,
** that means we already know the entry exists and so we can save the
** work of trying to create it.
**
** Return TRUE if a new TICKET entry was created and FALSE if an
** existing entry was revised.
*/
int ticket_insert(Manifest *p, int createFlag, int checkTime){
Blob sql;
Stmt q;
int i;
const char *zSep;
int rc = 0;
getAllTicketFields();
if( createFlag ){
db_multi_exec("INSERT OR IGNORE INTO ticket(tkt_uuid, tkt_mtime) "
"VALUES(%Q, 0)", p->zTicketUuid);
rc = db_changes();
}
blob_zero(&sql);
blob_appendf(&sql, "UPDATE OR REPLACE ticket SET tkt_mtime=:mtime");
zSep = "SET";
for(i=0; i<p->nField; i++){
const char *zName = p->aField[i].zName;
if( zName[0]=='+' ){
|
| ︙ | ︙ | |||
227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
db_commit_hook(ticket_rebuild_at_commit, 1);
isInit = 1;
}
db_multi_exec("INSERT OR IGNORE INTO _pending_ticket "
"VALUES(%Q)", p->zTicketUuid);
}
blob_reset(&sql);
}
/*
** Rebuild an entire entry in the TICKET table
*/
void ticket_rebuild_entry(const char *zTktUuid){
char *zTag = mprintf("tkt-%s", zTktUuid);
| > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
db_commit_hook(ticket_rebuild_at_commit, 1);
isInit = 1;
}
db_multi_exec("INSERT OR IGNORE INTO _pending_ticket "
"VALUES(%Q)", p->zTicketUuid);
}
blob_reset(&sql);
return rc;
}
/*
** Rebuild an entire entry in the TICKET table
*/
void ticket_rebuild_entry(const char *zTktUuid){
char *zTag = mprintf("tkt-%s", zTktUuid);
|
| ︙ | ︙ |
Changes to src/tktsetup.c.
| ︙ | ︙ | |||
640 641 642 643 644 645 646 |
db_begin_transaction();
@ <form action="%s(g.zBaseURL)/tktsetup_timeline" method="POST">
login_insert_csrf_secret();
@ <hr>
entry_attribute("Ticket Title", 40, "ticket-title-expr", "t", "title");
@ <p>An SQL expression in a query against the TICKET table that will
| | | > > > > | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
db_begin_transaction();
@ <form action="%s(g.zBaseURL)/tktsetup_timeline" method="POST">
login_insert_csrf_secret();
@ <hr>
entry_attribute("Ticket Title", 40, "ticket-title-expr", "t", "title");
@ <p>An SQL expression in a query against the TICKET table that will
@ return the title of the ticket for display purposes.</p>
@ <hr>
entry_attribute("Ticket Status", 40, "ticket-status-column", "s", "status");
@ <p>The name of the column in the TICKET table that contains the ticket
@ status in human-readable form. Case sensitive.</p>
@ <hr>
entry_attribute("Ticket Closed", 40, "ticket-closed-expr", "c",
"status='Closed'");
@ <p>An SQL expression that evaluates to true in a TICKET table query if
@ the ticket is closed.</p>
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
866 867 868 869 870 871 872 | if( n<4 || n>UUID_SIZE ) return 0; if( !validate16(z, n) ) return 0; return 1; } /* ** zTarget is guaranteed to be a UUID. It might be the UUID of a ticket. | | | < < < | | > < < < < | | > > | < < < < < < < | | | > > | < > | | | < | | > | > | | | < < < < < | > | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 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 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 |
if( n<4 || n>UUID_SIZE ) return 0;
if( !validate16(z, n) ) return 0;
return 1;
}
/*
** zTarget is guaranteed to be a UUID. It might be the UUID of a ticket.
** If it is, store in *pClosed a true or false depending on whether or not
** the ticket is closed and return true. If zTarget
** is not the UUID of a ticket, return false.
*/
static int is_ticket(
const char *zTarget, /* Ticket UUID */
int *pClosed /* True if the ticket is closed */
){
static Stmt q;
static int once = 1;
int n;
int rc;
char zLower[UUID_SIZE+1];
char zUpper[UUID_SIZE+1];
n = strlen(zTarget);
memcpy(zLower, zTarget, n+1);
canonical16(zLower, n+1);
memcpy(zUpper, zLower, n+1);
zUpper[n-1]++;
if( once ){
const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'");
db_static_prepare(&q,
"SELECT %s FROM ticket "
" WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr",
zClosedExpr
);
once = 0;
}
db_bind_text(&q, ":lwr", zLower);
db_bind_text(&q, ":upr", zUpper);
if( db_step(&q)==SQLITE_ROW ){
rc = 1;
*pClosed = db_column_int(&q, 0);
}else{
rc = 0;
}
db_reset(&q);
return rc;
}
/*
** Resolve a hyperlink. The zTarget argument is the content of the [...]
** in the wiki. Append to the output string whatever text is approprate
** for opening the hyperlink. Write into zClose[0...nClose-1] text that will
** close the markup.
**
** Actually, this routine might or might not append the hyperlink, depending
** on current rendering rules: specifically does the current user have
** "History" permission.
*/
static void openHyperlink(
Renderer *p, /* Rendering context */
const char *zTarget, /* Hyperlink traget; text within [...] */
char *zClose, /* Write hyperlink closing text here */
int nClose /* Bytes available in zClose[] */
){
const char *zTerm = "</a>";
assert( nClose>10 );
if( strncmp(zTarget, "http:", 5)==0
|| strncmp(zTarget, "https:", 6)==0
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
){
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
}else if( zTarget[0]=='/' ){
if( g.okHistory ){
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zBaseURL, zTarget);
}else{
zTerm = "";
}
}else if( is_valid_uuid(zTarget) ){
int isClosed;
if( is_ticket(zTarget, &isClosed) ){
/* Special display processing for tickets. Display the hyperlink
** as crossed out if the ticket is closed.
*/
if( isClosed ){
if( g.okHistory ){
blob_appendf(p->pOut,"<a href=\"%s/info/%s\"><s>",
g.zBaseURL, zTarget
);
zTerm = "</s></a>";
}else{
blob_appendf(p->pOut,"<s>");
zTerm = "</s>";
}
}else{
if( g.okHistory ){
blob_appendf(p->pOut,"<a href=\"%s/info/%s\">",
g.zBaseURL, zTarget
);
}else{
zTerm = "";
}
}
}else if( g.okHistory ){
blob_appendf(p->pOut, "<a href=\"%s/info/%s\">", g.zBaseURL, zTarget);
}
}else if( wiki_name_is_wellformed(zTarget) ){
blob_appendf(p->pOut, "<a href=\"%s/wiki?name=%T\">", g.zBaseURL, zTarget);
}else{
blob_appendf(p->pOut, "[bad-link: %h]", zTarget);
zTerm = "";
}
assert( strlen(zTerm)<nClose );
strcpy(zClose, zTerm);
}
/*
** Check to see if the given parsed markup is the correct
** </verbatim> tag.
*/
static int endVerbatim(Renderer *p, ParsedMarkup *pMarkup){
|
| ︙ | ︙ | |||
1109 1110 1111 1112 1113 1114 1115 |
break;
}
case TOKEN_LINK: {
char *zTarget;
char *zDisplay = 0;
int i, j;
int savedState;
| | < < < < < | < < < | < | | 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 |
break;
}
case TOKEN_LINK: {
char *zTarget;
char *zDisplay = 0;
int i, j;
int savedState;
char zClose[20];
startAutoParagraph(p);
zTarget = &z[1];
for(i=1; z[i] && z[i]!=']'; i++){
if( z[i]=='|' && zDisplay==0 ){
zDisplay = &z[i+1];
z[i] = 0;
for(j=i-1; j>0 && isspace(z[j]); j--){ z[j] = 0; }
}
}
z[i] = 0;
if( zDisplay==0 ){
zDisplay = zTarget;
}else{
while( isspace(*zDisplay) ) zDisplay++;
}
openHyperlink(p, zTarget, zClose, sizeof(zClose));
savedState = p->state;
p->state &= ~ALLOW_WIKI;
p->state |= FONT_MARKUP_ONLY;
wiki_render(p, zDisplay);
p->state = savedState;
blob_append(p->pOut, zClose, -1);
break;
}
case TOKEN_TEXT: {
startAutoParagraph(p);
blob_append(p->pOut, z, n);
break;
}
|
| ︙ | ︙ |