Fossil SCM
Fix the annoying extra space in the attachment list. Minor doc update.
Commit
0436eb5ce3961d6c9012e8dc5216bf9465cc4a7fed11e5a97cd28a6829895e14
Parent
2302e4141ce6a5b…
2 files changed
+5
-7
+1
-1
+5
-7
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -757,13 +757,14 @@ | ||
| 757 | 757 | ** Output HTML to show a list of attachments. |
| 758 | 758 | */ |
| 759 | 759 | void attachment_list( |
| 760 | 760 | const char *zTarget, /* Object that things are attached to */ |
| 761 | 761 | const char *zHeader, /* Header to display with attachments */ |
| 762 | - int flags /* ATTACHLIST_... flags */ | |
| 762 | + const int flags /* ATTACHLIST_... flags */ | |
| 763 | 763 | ){ |
| 764 | 764 | int cnt = 0; |
| 765 | + char szBuf[36] = {0}; /* scratchpad for attachment size value */ | |
| 765 | 766 | const char * zLinkTgt = (ATTACHLIST_TARGET_BLANK & flags) |
| 766 | 767 | ? " target=\"_blank\"" : ""; |
| 767 | 768 | Stmt q; |
| 768 | 769 | db_prepare(&q, |
| 769 | 770 | "SELECT datetime(mtime,toLocal()), filename, user," |
| @@ -798,19 +799,16 @@ | ||
| 798 | 799 | case CFTYPE_WIKI: |
| 799 | 800 | default: zTypeArg = "page"; break; |
| 800 | 801 | } |
| 801 | 802 | @ <li> |
| 802 | 803 | @ <a href="%R/artifact/%!S(zSrc)"%s(zLinkTgt)>%h(zFile)</a> |
| 803 | - @ [<a href="%R/attachdownload/%t(zFile)?%s(zTypeArg)=%t(zTarget)&file=%t(zFile)" \ | |
| 804 | - @ %s(zLinkTgt)>download</a> | |
| 805 | 804 | if( flags & ATTACHLIST_SIZE ){ |
| 806 | - /* FIXME: this block causes us to interupt the @ lines and | |
| 807 | - ** introduces an extra space before the closing ']'. */ | |
| 808 | 805 | const int sz = db_int(0,"SELECT size FROM blob WHERE uuid=%Q", zSrc); |
| 809 | - @ %d(sz) bytes | |
| 806 | + sqlite3_snprintf(sizeof(szBuf), szBuf, " %d bytes", sz); | |
| 810 | 807 | } |
| 811 | - @ ] | |
| 808 | + @ [<a href="%R/attachdownload/%t(zFile)?%s(zTypeArg)=%t(zTarget)\ | |
| 809 | + @&file=%t(zFile)%s(zLinkTgt)">download</a>%s(szBuf)] | |
| 812 | 810 | @ added by %h(zDispUser) on |
| 813 | 811 | hyperlink_to_date(zDate, "."); |
| 814 | 812 | @ [<a href="%R/ainfo/%!S(zUuid)"%s(zLinkTgt)>details</a>] |
| 815 | 813 | @ </li> |
| 816 | 814 | } |
| 817 | 815 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -757,13 +757,14 @@ | |
| 757 | ** Output HTML to show a list of attachments. |
| 758 | */ |
| 759 | void attachment_list( |
| 760 | const char *zTarget, /* Object that things are attached to */ |
| 761 | const char *zHeader, /* Header to display with attachments */ |
| 762 | int flags /* ATTACHLIST_... flags */ |
| 763 | ){ |
| 764 | int cnt = 0; |
| 765 | const char * zLinkTgt = (ATTACHLIST_TARGET_BLANK & flags) |
| 766 | ? " target=\"_blank\"" : ""; |
| 767 | Stmt q; |
| 768 | db_prepare(&q, |
| 769 | "SELECT datetime(mtime,toLocal()), filename, user," |
| @@ -798,19 +799,16 @@ | |
| 798 | case CFTYPE_WIKI: |
| 799 | default: zTypeArg = "page"; break; |
| 800 | } |
| 801 | @ <li> |
| 802 | @ <a href="%R/artifact/%!S(zSrc)"%s(zLinkTgt)>%h(zFile)</a> |
| 803 | @ [<a href="%R/attachdownload/%t(zFile)?%s(zTypeArg)=%t(zTarget)&file=%t(zFile)" \ |
| 804 | @ %s(zLinkTgt)>download</a> |
| 805 | if( flags & ATTACHLIST_SIZE ){ |
| 806 | /* FIXME: this block causes us to interupt the @ lines and |
| 807 | ** introduces an extra space before the closing ']'. */ |
| 808 | const int sz = db_int(0,"SELECT size FROM blob WHERE uuid=%Q", zSrc); |
| 809 | @ %d(sz) bytes |
| 810 | } |
| 811 | @ ] |
| 812 | @ added by %h(zDispUser) on |
| 813 | hyperlink_to_date(zDate, "."); |
| 814 | @ [<a href="%R/ainfo/%!S(zUuid)"%s(zLinkTgt)>details</a>] |
| 815 | @ </li> |
| 816 | } |
| 817 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -757,13 +757,14 @@ | |
| 757 | ** Output HTML to show a list of attachments. |
| 758 | */ |
| 759 | void attachment_list( |
| 760 | const char *zTarget, /* Object that things are attached to */ |
| 761 | const char *zHeader, /* Header to display with attachments */ |
| 762 | const int flags /* ATTACHLIST_... flags */ |
| 763 | ){ |
| 764 | int cnt = 0; |
| 765 | char szBuf[36] = {0}; /* scratchpad for attachment size value */ |
| 766 | const char * zLinkTgt = (ATTACHLIST_TARGET_BLANK & flags) |
| 767 | ? " target=\"_blank\"" : ""; |
| 768 | Stmt q; |
| 769 | db_prepare(&q, |
| 770 | "SELECT datetime(mtime,toLocal()), filename, user," |
| @@ -798,19 +799,16 @@ | |
| 799 | case CFTYPE_WIKI: |
| 800 | default: zTypeArg = "page"; break; |
| 801 | } |
| 802 | @ <li> |
| 803 | @ <a href="%R/artifact/%!S(zSrc)"%s(zLinkTgt)>%h(zFile)</a> |
| 804 | if( flags & ATTACHLIST_SIZE ){ |
| 805 | const int sz = db_int(0,"SELECT size FROM blob WHERE uuid=%Q", zSrc); |
| 806 | sqlite3_snprintf(sizeof(szBuf), szBuf, " %d bytes", sz); |
| 807 | } |
| 808 | @ [<a href="%R/attachdownload/%t(zFile)?%s(zTypeArg)=%t(zTarget)\ |
| 809 | @&file=%t(zFile)%s(zLinkTgt)">download</a>%s(szBuf)] |
| 810 | @ added by %h(zDispUser) on |
| 811 | hyperlink_to_date(zDate, "."); |
| 812 | @ [<a href="%R/ainfo/%!S(zUuid)"%s(zLinkTgt)>details</a>] |
| 813 | @ </li> |
| 814 | } |
| 815 |
+1
-1
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -427,11 +427,11 @@ | ||
| 427 | 427 | @ CREATE TABLE attachment( |
| 428 | 428 | @ attachid INTEGER PRIMARY KEY, -- Local id for this attachment |
| 429 | 429 | @ isLatest BOOLEAN DEFAULT 0, -- True if this is the one to use |
| 430 | 430 | @ mtime TIMESTAMP, -- Last changed. Julian day. |
| 431 | 431 | @ src TEXT, -- Hash of the attachment. NULL to delete |
| 432 | -@ target TEXT, -- Object attached to. Wikiname or Tkt hash | |
| 432 | +@ target TEXT, -- Object attached to. Wikiname or Tkt/Event/Forum post ID | |
| 433 | 433 | @ filename TEXT, -- Filename for the attachment |
| 434 | 434 | @ comment TEXT, -- Comment associated with this attachment |
| 435 | 435 | @ user TEXT -- Name of user adding attachment |
| 436 | 436 | @ ); |
| 437 | 437 | @ CREATE INDEX attachment_idx1 ON attachment(target, filename, mtime); |
| 438 | 438 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -427,11 +427,11 @@ | |
| 427 | @ CREATE TABLE attachment( |
| 428 | @ attachid INTEGER PRIMARY KEY, -- Local id for this attachment |
| 429 | @ isLatest BOOLEAN DEFAULT 0, -- True if this is the one to use |
| 430 | @ mtime TIMESTAMP, -- Last changed. Julian day. |
| 431 | @ src TEXT, -- Hash of the attachment. NULL to delete |
| 432 | @ target TEXT, -- Object attached to. Wikiname or Tkt hash |
| 433 | @ filename TEXT, -- Filename for the attachment |
| 434 | @ comment TEXT, -- Comment associated with this attachment |
| 435 | @ user TEXT -- Name of user adding attachment |
| 436 | @ ); |
| 437 | @ CREATE INDEX attachment_idx1 ON attachment(target, filename, mtime); |
| 438 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -427,11 +427,11 @@ | |
| 427 | @ CREATE TABLE attachment( |
| 428 | @ attachid INTEGER PRIMARY KEY, -- Local id for this attachment |
| 429 | @ isLatest BOOLEAN DEFAULT 0, -- True if this is the one to use |
| 430 | @ mtime TIMESTAMP, -- Last changed. Julian day. |
| 431 | @ src TEXT, -- Hash of the attachment. NULL to delete |
| 432 | @ target TEXT, -- Object attached to. Wikiname or Tkt/Event/Forum post ID |
| 433 | @ filename TEXT, -- Filename for the attachment |
| 434 | @ comment TEXT, -- Comment associated with this attachment |
| 435 | @ user TEXT -- Name of user adding attachment |
| 436 | @ ); |
| 437 | @ CREATE INDEX attachment_idx1 ON attachment(target, filename, mtime); |
| 438 |