Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Provide extra buttons to get to "Plaintext" views of tickets and ticket artifacts. Invert the order of ticket history so that the oldest changes are on top and more recent changes are appended. Reject [...] style hyperlinks if they do not begin with ./ or ../. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | ticket-enhancements |
| Files: | files | file ages | folders |
| SHA1: |
aaa8e45b3626bfeaf0764090749b8b8e |
| User & Date: | drh 2012-11-24 01:01:05.664 |
Context
|
2012-11-24
| ||
| 14:44 | Add the "query" command to the TH1 language, used to query the repository database. ... (check-in: f6ac3c6f3d user: drh tags: ticket-enhancements) | |
| 01:01 | Provide extra buttons to get to "Plaintext" views of tickets and ticket artifacts. Invert the order of ticket history so that the oldest changes are on top and more recent changes are appended. Reject [...] style hyperlinks if they do not begin with ./ or ../. ... (check-in: aaa8e45b36 user: drh tags: ticket-enhancements) | |
| 00:04 | Improvements to hyperlinks showing details of tickets and attachments. ... (check-in: ceda22ac80 user: drh tags: ticket-enhancements) | |
Changes
Changes to src/info.c.
| ︙ | ︙ | |||
1753 1754 1755 1756 1757 1758 1759 |
@ <input type="submit" value="Submit">
@ </form>
@ </blockquote>
}
@ <div class="section">Changes</div>
@ <p>
| | | 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 |
@ <input type="submit" value="Submit">
@ </form>
@ </blockquote>
}
@ <div class="section">Changes</div>
@ <p>
ticket_output_change_artifact(pTktChng, 0);
manifest_destroy(pTktChng);
style_footer();
}
/*
** WEBPAGE: info
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
struct GenerateHTML {
int rn; /* Report number */
int nCount; /* Row number */
int nCol; /* Number of columns */
int isMultirow; /* True if multiple table rows per query result row */
int iNewRow; /* Index of first column that goes on separate row */
int iBg; /* Index of column that defines background color */
};
/*
** The callback function for db_query
*/
static int generate_html(
void *pUser, /* Pointer to output state */
| > > > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
struct GenerateHTML {
int rn; /* Report number */
int nCount; /* Row number */
int nCol; /* Number of columns */
int isMultirow; /* True if multiple table rows per query result row */
int iNewRow; /* Index of first column that goes on separate row */
int iBg; /* Index of column that defines background color */
int wikiFlags; /* Flags passed into wiki_convert() */
const char *zWikiStart; /* HTML before display of multi-line wiki */
const char *zWikiEnd; /* HTML after display of multi-line wiki */
};
/*
** The callback function for db_query
*/
static int generate_html(
void *pUser, /* Pointer to output state */
|
| ︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 |
if( g.perm.Write && azName[i][0]=='#' ){
pState->nCol++;
}
if( !pState->isMultirow ){
if( azName[i][0]=='_' ){
pState->isMultirow = 1;
pState->iNewRow = i;
}else{
pState->nCol++;
}
}
}
/* The first time this routine is called, output a table header
| > > > > > > > > > > > > > | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
if( g.perm.Write && azName[i][0]=='#' ){
pState->nCol++;
}
if( !pState->isMultirow ){
if( azName[i][0]=='_' ){
pState->isMultirow = 1;
pState->iNewRow = i;
pState->wikiFlags = WIKI_NOBADLINKS;
pState->zWikiStart = "";
pState->zWikiEnd = "";
if( P("plaintext") ){
pState->wikiFlags |= WIKI_LINKSONLY;
pState->zWikiStart = "<pre class='verbatim'>";
pState->zWikiEnd = "</pre>";
style_submenu_element("Formatted", "Formatted",
"%R/rptview?rn=%d", pState->rn);
}else{
style_submenu_element("Plaintext", "Plaintext",
"%R/rptview?rn=%d&plaintext", pState->rn);
}
}else{
pState->nCol++;
}
}
}
/* The first time this routine is called, output a table header
|
| ︙ | ︙ | |||
735 736 737 738 739 740 741 742 |
@ <td valign="top">%z(href("%R/tktedit/%h",zTid))edit</a></td>
zTid = 0;
}
if( zData[0] ){
Blob content;
@ </tr>
@ <tr style="background-color:%h(zBg)"><td colspan=%d(pState->nCol)>
blob_init(&content, zData, -1);
| > | > | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 |
@ <td valign="top">%z(href("%R/tktedit/%h",zTid))edit</a></td>
zTid = 0;
}
if( zData[0] ){
Blob content;
@ </tr>
@ <tr style="background-color:%h(zBg)"><td colspan=%d(pState->nCol)>
@ %s(pState->zWikiStart)
blob_init(&content, zData, -1);
wiki_convert(&content, 0, pState->wikiFlags);
blob_reset(&content);
@ %s(pState->zWikiEnd)
}
}else if( azName[i][0]=='#' ){
zTid = zData;
@ <td valign="top">%z(href("%R/tktview?name=%h",zData))%h(zData)</a></td>
}else if( zData[0]==0 ){
@ <td valign="top"> </td>
}else{
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
"%s/tktnew", g.zTop);
}
if( g.perm.ApndTkt && g.perm.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?tkt=%T&from=%s/tktview/%t",
g.zTop, zUuid, g.zTop, zUuid);
}
style_header("View Ticket");
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1);
ticket_init();
initializeVariablesFromCGI();
initializeVariablesFromDb();
zScript = ticket_viewpage_code();
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1);
| > > > > > > | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
"%s/tktnew", g.zTop);
}
if( g.perm.ApndTkt && g.perm.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?tkt=%T&from=%s/tktview/%t",
g.zTop, zUuid, g.zTop, zUuid);
}
if( P("plaintext") ){
style_submenu_element("Formatted", "Formatted", "%R/tktview/%S", zUuid);
}else{
style_submenu_element("Plaintext", "Plaintext",
"%R/tktview/%S?plaintext", zUuid);
}
style_header("View Ticket");
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1);
ticket_init();
initializeVariablesFromCGI();
initializeVariablesFromDb();
zScript = ticket_viewpage_code();
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1);
|
| ︙ | ︙ | |||
733 734 735 736 737 738 739 740 741 742 743 744 745 746 |
** Show the complete change history for a single ticket
*/
void tkthistory_page(void){
Stmt q;
char *zTitle;
const char *zUuid;
int tagid;
login_check_credentials();
if( !g.perm.Hyperlink || !g.perm.RdTkt ){ login_needed(); return; }
zUuid = PD("name","");
zTitle = mprintf("History Of Ticket %h", zUuid);
style_submenu_element("Status", "Status",
"%s/info/%s", g.zTop, zUuid);
| > | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
** Show the complete change history for a single ticket
*/
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(); return; }
zUuid = PD("name","");
zTitle = mprintf("History Of Ticket %h", zUuid);
style_submenu_element("Status", "Status",
"%s/info/%s", g.zTop, zUuid);
|
| ︙ | ︙ | |||
770 771 772 773 774 775 776 |
" 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 target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
" AND blob.rid=attachid"
| | > > > > | | > | | > > > | > | | 777 778 779 780 781 782 783 784 785 786 787 788 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 |
" 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 target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
" AND blob.rid=attachid"
" ORDER BY 1",
tagid, tagid
);
while( db_step(&q)==SQLITE_ROW ){
Manifest *pTicket;
char zShort[12];
const char *zDate = db_column_text(&q, 0);
int rid = db_column_int(&q, 1);
const char *zChngUuid = db_column_text(&q, 2);
const char *zFile = db_column_text(&q, 4);
memcpy(zShort, zChngUuid, 10);
zShort[10] = 0;
if( nChng==0 ){
@ <ol>
}
nChng++;
if( zFile!=0 ){
const char *zSrc = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 5);
if( zSrc==0 || zSrc[0]==0 ){
@
@ <li><p>Delete attachment "%h(zFile)"
}else{
@
@ <li><p>Add attachment
@ "%z(href("%R/artifact/%S",zSrc))%h(zFile)</a>"
}
@ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
@ (rid %d(rid)) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".</p>");
}else{
pTicket = manifest_get(rid, CFTYPE_TICKET);
if( pTicket ){
@
@ <li><p>Ticket change
@ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
@ (rid %d(rid)) by
hyperlink_to_user(pTicket->zUser,zDate," on");
hyperlink_to_date(zDate, ":");
@ </p>
ticket_output_change_artifact(pTicket, "a");
}
manifest_destroy(pTicket);
}
}
db_finalize(&q);
if( nChng ){
@ </ol>
}
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;
}
/*
** 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>";
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)
|
| ︙ | ︙ | |||
1055 1056 1057 1058 1059 1060 1061 |
if( eCmd==history ){
Stmt q;
int tagid;
if ( i != g.argc ){
fossil_fatal("no other parameters expected to %s!",g.argv[2]);
}
| | > | > | 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 |
if( eCmd==history ){
Stmt q;
int tagid;
if ( i != g.argc ){
fossil_fatal("no other parameters expected to %s!",g.argv[2]);
}
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
zTktUuid);
if( tagid==0 ){
fossil_fatal("no such ticket %h", zTktUuid);
}
db_prepare(&q,
"SELECT datetime(mtime,'localtime'), objid, uuid, NULL, NULL, NULL"
" 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 target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
" AND blob.rid=attachid"
" ORDER BY 1 DESC",
tagid, tagid
);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 |
|| 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]=='/' ){
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
| | > > > > | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 |
|| 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]=='/' ){
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
}else if( zTarget[0]=='.'
&& (zTarget[1]=='/' || (zTarget[1]=='.' && zTarget[2]=='/'))
&& (p->state & WIKI_LINKSONLY)==0 ){
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
}else if( zTarget[0]=='#' ){
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
}else if( is_valid_uuid(zTarget) ){
int isClosed = 0;
if( is_ticket(zTarget, &isClosed) ){
/* Special display processing for tickets. Display the hyperlink
** as crossed out if the ticket is closed.
*/
|
| ︙ | ︙ |