Fossil SCM
Wrap the list of attachments displayed on technotes/events, tickets and wiki pages in their own 'section' HTML element with CSS class name 'attachlist'. Inspired by [forum:8da5a5d868 | forum thread 8da5a5d868].
Commit
4f9ecd0392368b70ee139fbc1a0ae701c6ea7009046ef2f3b40e7fbbda398aee
Parent
f96a3ba792736d7…
5 files changed
+8
-1
+1
-1
+1
-1
+3
-3
+3
-3
+8
-1
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -634,11 +634,12 @@ | ||
| 634 | 634 | /* |
| 635 | 635 | ** Output HTML to show a list of attachments. |
| 636 | 636 | */ |
| 637 | 637 | void attachment_list( |
| 638 | 638 | const char *zTarget, /* Object that things are attached to */ |
| 639 | - const char *zHeader /* Header to display with attachments */ | |
| 639 | + const char *zHeader, /* Header to display with attachments */ | |
| 640 | + int fHorizontalRule /* Insert <hr> separator above header */ | |
| 640 | 641 | ){ |
| 641 | 642 | int cnt = 0; |
| 642 | 643 | Stmt q; |
| 643 | 644 | db_prepare(&q, |
| 644 | 645 | "SELECT datetime(mtime,toLocal()), filename, user," |
| @@ -654,11 +655,16 @@ | ||
| 654 | 655 | const char *zUser = db_column_text(&q, 2); |
| 655 | 656 | const char *zUuid = db_column_text(&q, 3); |
| 656 | 657 | const char *zSrc = db_column_text(&q, 4); |
| 657 | 658 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 658 | 659 | if( cnt==0 ){ |
| 660 | + @ <section class='attachlist'> | |
| 661 | + if( fHorizontalRule ){ | |
| 662 | + @ <hr> | |
| 663 | + } | |
| 659 | 664 | @ %s(zHeader) |
| 665 | + @ <ul> | |
| 660 | 666 | } |
| 661 | 667 | cnt++; |
| 662 | 668 | @ <li> |
| 663 | 669 | @ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a> |
| 664 | 670 | @ [<a href="%R/attachdownload/%t(zFile)?page=%t(zTarget)&file=%t(zFile)">download</a>] |
| @@ -667,10 +673,11 @@ | ||
| 667 | 673 | @ [%z(href("%R/ainfo/%!S",zUuid))details</a>] |
| 668 | 674 | @ </li> |
| 669 | 675 | } |
| 670 | 676 | if( cnt ){ |
| 671 | 677 | @ </ul> |
| 678 | + @ </section> | |
| 672 | 679 | } |
| 673 | 680 | db_finalize(&q); |
| 674 | 681 | |
| 675 | 682 | } |
| 676 | 683 | |
| 677 | 684 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -634,11 +634,12 @@ | |
| 634 | /* |
| 635 | ** Output HTML to show a list of attachments. |
| 636 | */ |
| 637 | void attachment_list( |
| 638 | const char *zTarget, /* Object that things are attached to */ |
| 639 | const char *zHeader /* Header to display with attachments */ |
| 640 | ){ |
| 641 | int cnt = 0; |
| 642 | Stmt q; |
| 643 | db_prepare(&q, |
| 644 | "SELECT datetime(mtime,toLocal()), filename, user," |
| @@ -654,11 +655,16 @@ | |
| 654 | const char *zUser = db_column_text(&q, 2); |
| 655 | const char *zUuid = db_column_text(&q, 3); |
| 656 | const char *zSrc = db_column_text(&q, 4); |
| 657 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 658 | if( cnt==0 ){ |
| 659 | @ %s(zHeader) |
| 660 | } |
| 661 | cnt++; |
| 662 | @ <li> |
| 663 | @ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a> |
| 664 | @ [<a href="%R/attachdownload/%t(zFile)?page=%t(zTarget)&file=%t(zFile)">download</a>] |
| @@ -667,10 +673,11 @@ | |
| 667 | @ [%z(href("%R/ainfo/%!S",zUuid))details</a>] |
| 668 | @ </li> |
| 669 | } |
| 670 | if( cnt ){ |
| 671 | @ </ul> |
| 672 | } |
| 673 | db_finalize(&q); |
| 674 | |
| 675 | } |
| 676 | |
| 677 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -634,11 +634,12 @@ | |
| 634 | /* |
| 635 | ** Output HTML to show a list of attachments. |
| 636 | */ |
| 637 | void attachment_list( |
| 638 | const char *zTarget, /* Object that things are attached to */ |
| 639 | const char *zHeader, /* Header to display with attachments */ |
| 640 | int fHorizontalRule /* Insert <hr> separator above header */ |
| 641 | ){ |
| 642 | int cnt = 0; |
| 643 | Stmt q; |
| 644 | db_prepare(&q, |
| 645 | "SELECT datetime(mtime,toLocal()), filename, user," |
| @@ -654,11 +655,16 @@ | |
| 655 | const char *zUser = db_column_text(&q, 2); |
| 656 | const char *zUuid = db_column_text(&q, 3); |
| 657 | const char *zSrc = db_column_text(&q, 4); |
| 658 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 659 | if( cnt==0 ){ |
| 660 | @ <section class='attachlist'> |
| 661 | if( fHorizontalRule ){ |
| 662 | @ <hr> |
| 663 | } |
| 664 | @ %s(zHeader) |
| 665 | @ <ul> |
| 666 | } |
| 667 | cnt++; |
| 668 | @ <li> |
| 669 | @ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a> |
| 670 | @ [<a href="%R/attachdownload/%t(zFile)?page=%t(zTarget)&file=%t(zFile)">download</a>] |
| @@ -667,10 +673,11 @@ | |
| 673 | @ [%z(href("%R/ainfo/%!S",zUuid))details</a>] |
| 674 | @ </li> |
| 675 | } |
| 676 | if( cnt ){ |
| 677 | @ </ul> |
| 678 | @ </section> |
| 679 | } |
| 680 | db_finalize(&q); |
| 681 | |
| 682 | } |
| 683 | |
| 684 |
+1
-1
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -229,11 +229,11 @@ | ||
| 229 | 229 | } |
| 230 | 230 | zFullId = db_text(0, "SELECT SUBSTR(tagname,7)" |
| 231 | 231 | " FROM tag" |
| 232 | 232 | " WHERE tagname GLOB 'event-%q*'", |
| 233 | 233 | zId); |
| 234 | - attachment_list(zFullId, "<hr><h2>Attachments:</h2><ul>"); | |
| 234 | + attachment_list(zFullId, "<h2>Attachments:</h2>", 1); | |
| 235 | 235 | document_emit_js(); |
| 236 | 236 | style_finish_page(); |
| 237 | 237 | manifest_destroy(pTNote); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -229,11 +229,11 @@ | |
| 229 | } |
| 230 | zFullId = db_text(0, "SELECT SUBSTR(tagname,7)" |
| 231 | " FROM tag" |
| 232 | " WHERE tagname GLOB 'event-%q*'", |
| 233 | zId); |
| 234 | attachment_list(zFullId, "<hr><h2>Attachments:</h2><ul>"); |
| 235 | document_emit_js(); |
| 236 | style_finish_page(); |
| 237 | manifest_destroy(pTNote); |
| 238 | } |
| 239 | |
| 240 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -229,11 +229,11 @@ | |
| 229 | } |
| 230 | zFullId = db_text(0, "SELECT SUBSTR(tagname,7)" |
| 231 | " FROM tag" |
| 232 | " WHERE tagname GLOB 'event-%q*'", |
| 233 | zId); |
| 234 | attachment_list(zFullId, "<h2>Attachments:</h2>", 1); |
| 235 | document_emit_js(); |
| 236 | style_finish_page(); |
| 237 | manifest_destroy(pTNote); |
| 238 | } |
| 239 | |
| 240 |
+1
-1
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -781,11 +781,11 @@ | ||
| 781 | 781 | |
| 782 | 782 | zFullName = db_text(0, |
| 783 | 783 | "SELECT tkt_uuid FROM ticket" |
| 784 | 784 | " WHERE tkt_uuid GLOB '%q*'", zUuid); |
| 785 | 785 | if( zFullName ){ |
| 786 | - attachment_list(zFullName, "<hr><h2>Attachments:</h2><ul>"); | |
| 786 | + attachment_list(zFullName, "<h2>Attachments:</h2>", 1); | |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | style_finish_page(); |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -781,11 +781,11 @@ | |
| 781 | |
| 782 | zFullName = db_text(0, |
| 783 | "SELECT tkt_uuid FROM ticket" |
| 784 | " WHERE tkt_uuid GLOB '%q*'", zUuid); |
| 785 | if( zFullName ){ |
| 786 | attachment_list(zFullName, "<hr><h2>Attachments:</h2><ul>"); |
| 787 | } |
| 788 | |
| 789 | style_finish_page(); |
| 790 | } |
| 791 | |
| 792 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -781,11 +781,11 @@ | |
| 781 | |
| 782 | zFullName = db_text(0, |
| 783 | "SELECT tkt_uuid FROM ticket" |
| 784 | " WHERE tkt_uuid GLOB '%q*'", zUuid); |
| 785 | if( zFullName ){ |
| 786 | attachment_list(zFullName, "<h2>Attachments:</h2>", 1); |
| 787 | } |
| 788 | |
| 789 | style_finish_page(); |
| 790 | } |
| 791 | |
| 792 |
+3
-3
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -622,14 +622,14 @@ | ||
| 622 | 622 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 623 | 623 | blob_reset(&wiki); |
| 624 | 624 | } |
| 625 | 625 | manifest_destroy(pWiki); |
| 626 | 626 | if( !isPopup ){ |
| 627 | - char * zLabel = mprintf("<hr><h2><a href='%R/attachlist?name=%T'>" | |
| 628 | - "Attachments</a>:</h2><ul>", | |
| 627 | + char * zLabel = mprintf("<h2><a href='%R/attachlist?page=%T'>" | |
| 628 | + "Attachments</a>:</h2>", | |
| 629 | 629 | zPageName); |
| 630 | - attachment_list(zPageName, zLabel); | |
| 630 | + attachment_list(zPageName, zLabel, 1); | |
| 631 | 631 | fossil_free(zLabel); |
| 632 | 632 | document_emit_js(/*for optional pikchr support*/); |
| 633 | 633 | style_finish_page(); |
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | 636 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -622,14 +622,14 @@ | |
| 622 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 623 | blob_reset(&wiki); |
| 624 | } |
| 625 | manifest_destroy(pWiki); |
| 626 | if( !isPopup ){ |
| 627 | char * zLabel = mprintf("<hr><h2><a href='%R/attachlist?name=%T'>" |
| 628 | "Attachments</a>:</h2><ul>", |
| 629 | zPageName); |
| 630 | attachment_list(zPageName, zLabel); |
| 631 | fossil_free(zLabel); |
| 632 | document_emit_js(/*for optional pikchr support*/); |
| 633 | style_finish_page(); |
| 634 | } |
| 635 | } |
| 636 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -622,14 +622,14 @@ | |
| 622 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 623 | blob_reset(&wiki); |
| 624 | } |
| 625 | manifest_destroy(pWiki); |
| 626 | if( !isPopup ){ |
| 627 | char * zLabel = mprintf("<h2><a href='%R/attachlist?page=%T'>" |
| 628 | "Attachments</a>:</h2>", |
| 629 | zPageName); |
| 630 | attachment_list(zPageName, zLabel, 1); |
| 631 | fossil_free(zLabel); |
| 632 | document_emit_js(/*for optional pikchr support*/); |
| 633 | style_finish_page(); |
| 634 | } |
| 635 | } |
| 636 |
+3
-3
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -622,14 +622,14 @@ | ||
| 622 | 622 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 623 | 623 | blob_reset(&wiki); |
| 624 | 624 | } |
| 625 | 625 | manifest_destroy(pWiki); |
| 626 | 626 | if( !isPopup ){ |
| 627 | - char * zLabel = mprintf("<hr><h2><a href='%R/attachlist?name=%T'>" | |
| 628 | - "Attachments</a>:</h2><ul>", | |
| 627 | + char * zLabel = mprintf("<h2><a href='%R/attachlist?page=%T'>" | |
| 628 | + "Attachments</a>:</h2>", | |
| 629 | 629 | zPageName); |
| 630 | - attachment_list(zPageName, zLabel); | |
| 630 | + attachment_list(zPageName, zLabel, 1); | |
| 631 | 631 | fossil_free(zLabel); |
| 632 | 632 | document_emit_js(/*for optional pikchr support*/); |
| 633 | 633 | style_finish_page(); |
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | 636 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -622,14 +622,14 @@ | |
| 622 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 623 | blob_reset(&wiki); |
| 624 | } |
| 625 | manifest_destroy(pWiki); |
| 626 | if( !isPopup ){ |
| 627 | char * zLabel = mprintf("<hr><h2><a href='%R/attachlist?name=%T'>" |
| 628 | "Attachments</a>:</h2><ul>", |
| 629 | zPageName); |
| 630 | attachment_list(zPageName, zLabel); |
| 631 | fossil_free(zLabel); |
| 632 | document_emit_js(/*for optional pikchr support*/); |
| 633 | style_finish_page(); |
| 634 | } |
| 635 | } |
| 636 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -622,14 +622,14 @@ | |
| 622 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 623 | blob_reset(&wiki); |
| 624 | } |
| 625 | manifest_destroy(pWiki); |
| 626 | if( !isPopup ){ |
| 627 | char * zLabel = mprintf("<h2><a href='%R/attachlist?page=%T'>" |
| 628 | "Attachments</a>:</h2>", |
| 629 | zPageName); |
| 630 | attachment_list(zPageName, zLabel, 1); |
| 631 | fossil_free(zLabel); |
| 632 | document_emit_js(/*for optional pikchr support*/); |
| 633 | style_finish_page(); |
| 634 | } |
| 635 | } |
| 636 |