Fossil SCM
Show the attachment list at the bottom of the forum post edit page. Fix a missing void in a function signature.
Commit
22bc6d7a2a2897af16454dbf0425c204bc1d53c2307b826019f474ce9d7f031a
Parent
ce5b3b5d388f9e5…
1 file changed
+19
-10
+19
-10
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -842,24 +842,30 @@ | ||
| 842 | 842 | if( p->zDisplayName==0 ) return "(unknown)"; |
| 843 | 843 | return p->zDisplayName; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | /* |
| 847 | -** Renders the attachment list for p or (if not NULL) pEditHead. | |
| 847 | +** Renders the attachment list for the given forum post. | |
| 848 | 848 | ** Emits no output if there are no attachments. |
| 849 | 849 | */ |
| 850 | -static void forum_render_attachment_list(ForumPost *p){ | |
| 851 | - char * zLbl; | |
| 852 | - if( p->pEditHead ) p = p->pEditHead; | |
| 853 | - zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>" | |
| 854 | - "Attachments:</a>", p->zUuid); | |
| 855 | - attachment_list(p->zUuid, zLbl, | |
| 850 | +static void forum_render_attachment_list(const char *zUuid){ | |
| 851 | + char * zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>" | |
| 852 | + "Attachments:</a>", zUuid); | |
| 853 | + attachment_list(zUuid, zLbl, | |
| 856 | 854 | ATTACHLIST_HRULE_ABOVE |
| 857 | 855 | | ATTACHLIST_SIZE |
| 858 | 856 | | ATTACHLIST_HIDE_UNAPPROVED); |
| 859 | 857 | fossil_free(zLbl); |
| 860 | 858 | } |
| 859 | + | |
| 860 | +/* | |
| 861 | +** Renders the attachment list for p or (if not NULL) pEditHead. | |
| 862 | +*/ | |
| 863 | +static void forum_render_attachment_list2(ForumPost *p){ | |
| 864 | + if( p->pEditHead ) p = p->pEditHead; | |
| 865 | + forum_render_attachment_list(p->zUuid); | |
| 866 | +} | |
| 861 | 867 | |
| 862 | 868 | /* |
| 863 | 869 | ** Display a single post in a forum thread. |
| 864 | 870 | */ |
| 865 | 871 | static void forum_display_post( |
| @@ -1001,11 +1007,11 @@ | ||
| 1001 | 1007 | zMimetype = "text/plain"; |
| 1002 | 1008 | }else{ |
| 1003 | 1009 | zMimetype = pManifest->zMimetype; |
| 1004 | 1010 | } |
| 1005 | 1011 | forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw); |
| 1006 | - forum_render_attachment_list(p); | |
| 1012 | + forum_render_attachment_list2(p); | |
| 1007 | 1013 | } |
| 1008 | 1014 | |
| 1009 | 1015 | /* When not in raw mode, finish creating the border around the post. */ |
| 1010 | 1016 | if( !bRaw ){ |
| 1011 | 1017 | /* If the user is able to write to the forum and if this post has not been |
| @@ -1696,11 +1702,11 @@ | ||
| 1696 | 1702 | /* |
| 1697 | 1703 | ** If the user has AttachForum permissions, emit a notice that |
| 1698 | 1704 | ** attachments may be added after saving. If p is not NULL, |
| 1699 | 1705 | ** also emit its list of attachments. |
| 1700 | 1706 | */ |
| 1701 | -static void forum_render_attachment_notice(){ | |
| 1707 | +static void forum_render_attachment_notice(void){ | |
| 1702 | 1708 | if( g.perm.AttachForum ){ |
| 1703 | 1709 | @ <div>You will be able to attach files to this post after saving |
| 1704 | 1710 | @ it.</div> |
| 1705 | 1711 | } |
| 1706 | 1712 | } |
| @@ -1741,11 +1747,11 @@ | ||
| 1741 | 1747 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 1742 | 1748 | } |
| 1743 | 1749 | forum_render_debug_options(); |
| 1744 | 1750 | login_insert_csrf_secret(); |
| 1745 | 1751 | @ </form> |
| 1746 | - forum_render_attachment_notice(0); | |
| 1752 | + forum_render_attachment_notice(); | |
| 1747 | 1753 | forum_emit_js(); |
| 1748 | 1754 | style_finish_page(); |
| 1749 | 1755 | } |
| 1750 | 1756 | |
| 1751 | 1757 | /* |
| @@ -1935,10 +1941,13 @@ | ||
| 1935 | 1941 | } |
| 1936 | 1942 | } |
| 1937 | 1943 | forum_render_debug_options(); |
| 1938 | 1944 | login_insert_csrf_secret(); |
| 1939 | 1945 | @ </form> |
| 1946 | + if( !bReply ){ | |
| 1947 | + forum_render_attachment_list(rid_to_uuid(fpid)); | |
| 1948 | + } | |
| 1940 | 1949 | forum_render_attachment_notice(); |
| 1941 | 1950 | forum_emit_js(); |
| 1942 | 1951 | style_finish_page(); |
| 1943 | 1952 | } |
| 1944 | 1953 | |
| 1945 | 1954 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -842,24 +842,30 @@ | |
| 842 | if( p->zDisplayName==0 ) return "(unknown)"; |
| 843 | return p->zDisplayName; |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | ** Renders the attachment list for p or (if not NULL) pEditHead. |
| 848 | ** Emits no output if there are no attachments. |
| 849 | */ |
| 850 | static void forum_render_attachment_list(ForumPost *p){ |
| 851 | char * zLbl; |
| 852 | if( p->pEditHead ) p = p->pEditHead; |
| 853 | zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>" |
| 854 | "Attachments:</a>", p->zUuid); |
| 855 | attachment_list(p->zUuid, zLbl, |
| 856 | ATTACHLIST_HRULE_ABOVE |
| 857 | | ATTACHLIST_SIZE |
| 858 | | ATTACHLIST_HIDE_UNAPPROVED); |
| 859 | fossil_free(zLbl); |
| 860 | } |
| 861 | |
| 862 | /* |
| 863 | ** Display a single post in a forum thread. |
| 864 | */ |
| 865 | static void forum_display_post( |
| @@ -1001,11 +1007,11 @@ | |
| 1001 | zMimetype = "text/plain"; |
| 1002 | }else{ |
| 1003 | zMimetype = pManifest->zMimetype; |
| 1004 | } |
| 1005 | forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw); |
| 1006 | forum_render_attachment_list(p); |
| 1007 | } |
| 1008 | |
| 1009 | /* When not in raw mode, finish creating the border around the post. */ |
| 1010 | if( !bRaw ){ |
| 1011 | /* If the user is able to write to the forum and if this post has not been |
| @@ -1696,11 +1702,11 @@ | |
| 1696 | /* |
| 1697 | ** If the user has AttachForum permissions, emit a notice that |
| 1698 | ** attachments may be added after saving. If p is not NULL, |
| 1699 | ** also emit its list of attachments. |
| 1700 | */ |
| 1701 | static void forum_render_attachment_notice(){ |
| 1702 | if( g.perm.AttachForum ){ |
| 1703 | @ <div>You will be able to attach files to this post after saving |
| 1704 | @ it.</div> |
| 1705 | } |
| 1706 | } |
| @@ -1741,11 +1747,11 @@ | |
| 1741 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 1742 | } |
| 1743 | forum_render_debug_options(); |
| 1744 | login_insert_csrf_secret(); |
| 1745 | @ </form> |
| 1746 | forum_render_attachment_notice(0); |
| 1747 | forum_emit_js(); |
| 1748 | style_finish_page(); |
| 1749 | } |
| 1750 | |
| 1751 | /* |
| @@ -1935,10 +1941,13 @@ | |
| 1935 | } |
| 1936 | } |
| 1937 | forum_render_debug_options(); |
| 1938 | login_insert_csrf_secret(); |
| 1939 | @ </form> |
| 1940 | forum_render_attachment_notice(); |
| 1941 | forum_emit_js(); |
| 1942 | style_finish_page(); |
| 1943 | } |
| 1944 | |
| 1945 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -842,24 +842,30 @@ | |
| 842 | if( p->zDisplayName==0 ) return "(unknown)"; |
| 843 | return p->zDisplayName; |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | ** Renders the attachment list for the given forum post. |
| 848 | ** Emits no output if there are no attachments. |
| 849 | */ |
| 850 | static void forum_render_attachment_list(const char *zUuid){ |
| 851 | char * zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>" |
| 852 | "Attachments:</a>", zUuid); |
| 853 | attachment_list(zUuid, zLbl, |
| 854 | ATTACHLIST_HRULE_ABOVE |
| 855 | | ATTACHLIST_SIZE |
| 856 | | ATTACHLIST_HIDE_UNAPPROVED); |
| 857 | fossil_free(zLbl); |
| 858 | } |
| 859 | |
| 860 | /* |
| 861 | ** Renders the attachment list for p or (if not NULL) pEditHead. |
| 862 | */ |
| 863 | static void forum_render_attachment_list2(ForumPost *p){ |
| 864 | if( p->pEditHead ) p = p->pEditHead; |
| 865 | forum_render_attachment_list(p->zUuid); |
| 866 | } |
| 867 | |
| 868 | /* |
| 869 | ** Display a single post in a forum thread. |
| 870 | */ |
| 871 | static void forum_display_post( |
| @@ -1001,11 +1007,11 @@ | |
| 1007 | zMimetype = "text/plain"; |
| 1008 | }else{ |
| 1009 | zMimetype = pManifest->zMimetype; |
| 1010 | } |
| 1011 | forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw); |
| 1012 | forum_render_attachment_list2(p); |
| 1013 | } |
| 1014 | |
| 1015 | /* When not in raw mode, finish creating the border around the post. */ |
| 1016 | if( !bRaw ){ |
| 1017 | /* If the user is able to write to the forum and if this post has not been |
| @@ -1696,11 +1702,11 @@ | |
| 1702 | /* |
| 1703 | ** If the user has AttachForum permissions, emit a notice that |
| 1704 | ** attachments may be added after saving. If p is not NULL, |
| 1705 | ** also emit its list of attachments. |
| 1706 | */ |
| 1707 | static void forum_render_attachment_notice(void){ |
| 1708 | if( g.perm.AttachForum ){ |
| 1709 | @ <div>You will be able to attach files to this post after saving |
| 1710 | @ it.</div> |
| 1711 | } |
| 1712 | } |
| @@ -1741,11 +1747,11 @@ | |
| 1747 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 1748 | } |
| 1749 | forum_render_debug_options(); |
| 1750 | login_insert_csrf_secret(); |
| 1751 | @ </form> |
| 1752 | forum_render_attachment_notice(); |
| 1753 | forum_emit_js(); |
| 1754 | style_finish_page(); |
| 1755 | } |
| 1756 | |
| 1757 | /* |
| @@ -1935,10 +1941,13 @@ | |
| 1941 | } |
| 1942 | } |
| 1943 | forum_render_debug_options(); |
| 1944 | login_insert_csrf_secret(); |
| 1945 | @ </form> |
| 1946 | if( !bReply ){ |
| 1947 | forum_render_attachment_list(rid_to_uuid(fpid)); |
| 1948 | } |
| 1949 | forum_render_attachment_notice(); |
| 1950 | forum_emit_js(); |
| 1951 | style_finish_page(); |
| 1952 | } |
| 1953 | |
| 1954 |