Fossil SCM
Move forumpost close/re-open controls around. Add, if appropriate, a Close/Re-open button to the thread view, but only for the currently-selected post.
Commit
ecc324b6af5d1e2142c558a42597246bfa7d1c36502bb69cee1a7967ffc9bdf8
Parent
914c6b5a0e585e3…
2 files changed
+9
-5
+23
-13
+9
-5
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -910,24 +910,28 @@ | ||
| 910 | 910 | content: "[CLOSED] "; |
| 911 | 911 | } |
| 912 | 912 | /*div.forumClosed > div.forumPostBody { |
| 913 | 913 | filter: blur(5px); |
| 914 | 914 | }*/ |
| 915 | -div.forumpost-closed-warning { | |
| 915 | +div.forumpost-closure-warning { | |
| 916 | 916 | margin-top: 1em; |
| 917 | 917 | margin-bottom: 1em; |
| 918 | 918 | border-style: solid; |
| 919 | 919 | padding: 0.25em 0.5em; |
| 920 | - background: yellow; | |
| 921 | - color: darkred; | |
| 922 | - font-weight: bold; | |
| 920 | + background: #f4f400bb; | |
| 921 | + /*font-weight: bold;*/ | |
| 923 | 922 | } |
| 924 | -div.forumpost-closed-warning input[type=submit] { | |
| 923 | +div.forumpost-closure-warning input[type=submit] { | |
| 925 | 924 | padding: 0.25em; |
| 925 | +} | |
| 926 | +div.forumpost-single-controls { | |
| 927 | + /* UI controls along the bottom of a single post | |
| 928 | + ** in the thread view. */ | |
| 926 | 929 | } |
| 927 | 930 | .forum div > form { |
| 928 | 931 | margin: 0.5em 0; |
| 932 | + display: inline-block; | |
| 929 | 933 | } |
| 930 | 934 | .forum-post-collapser { |
| 931 | 935 | /* Common style for the bottom-of-post and right-of-post |
| 932 | 936 | expand/collapse widgets. */ |
| 933 | 937 | font-size: 0.8em; |
| 934 | 938 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -910,24 +910,28 @@ | |
| 910 | content: "[CLOSED] "; |
| 911 | } |
| 912 | /*div.forumClosed > div.forumPostBody { |
| 913 | filter: blur(5px); |
| 914 | }*/ |
| 915 | div.forumpost-closed-warning { |
| 916 | margin-top: 1em; |
| 917 | margin-bottom: 1em; |
| 918 | border-style: solid; |
| 919 | padding: 0.25em 0.5em; |
| 920 | background: yellow; |
| 921 | color: darkred; |
| 922 | font-weight: bold; |
| 923 | } |
| 924 | div.forumpost-closed-warning input[type=submit] { |
| 925 | padding: 0.25em; |
| 926 | } |
| 927 | .forum div > form { |
| 928 | margin: 0.5em 0; |
| 929 | } |
| 930 | .forum-post-collapser { |
| 931 | /* Common style for the bottom-of-post and right-of-post |
| 932 | expand/collapse widgets. */ |
| 933 | font-size: 0.8em; |
| 934 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -910,24 +910,28 @@ | |
| 910 | content: "[CLOSED] "; |
| 911 | } |
| 912 | /*div.forumClosed > div.forumPostBody { |
| 913 | filter: blur(5px); |
| 914 | }*/ |
| 915 | div.forumpost-closure-warning { |
| 916 | margin-top: 1em; |
| 917 | margin-bottom: 1em; |
| 918 | border-style: solid; |
| 919 | padding: 0.25em 0.5em; |
| 920 | background: #f4f400bb; |
| 921 | /*font-weight: bold;*/ |
| 922 | } |
| 923 | div.forumpost-closure-warning input[type=submit] { |
| 924 | padding: 0.25em; |
| 925 | } |
| 926 | div.forumpost-single-controls { |
| 927 | /* UI controls along the bottom of a single post |
| 928 | ** in the thread view. */ |
| 929 | } |
| 930 | .forum div > form { |
| 931 | margin: 0.5em 0; |
| 932 | display: inline-block; |
| 933 | } |
| 934 | .forum-post-collapser { |
| 935 | /* Common style for the bottom-of-post and right-of-post |
| 936 | expand/collapse widgets. */ |
| 937 | font-size: 0.8em; |
| 938 |
+23
-13
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -277,18 +277,18 @@ | ||
| 277 | 277 | if( iHead != fpid ){ |
| 278 | 278 | iClosed = forum_rid_is_closed(iHead, 1); |
| 279 | 279 | /*@ forumpost_emit_closed_state() %d(iHead), %d(iClosed)*/ |
| 280 | 280 | } |
| 281 | 281 | if( iClosed<0 ){ |
| 282 | - @ <div class="warning forumpost-closed-warning">\ | |
| 282 | + @ <div class="warning forumpost-closure-warning">\ | |
| 283 | 283 | @ This post is CLOSED via a parent post. %s(zCommon)\ |
| 284 | 284 | @ </div> |
| 285 | 285 | return; |
| 286 | 286 | } |
| 287 | 287 | else if( iClosed==0 ){ |
| 288 | 288 | if( g.perm.Admin==0 ) return; |
| 289 | - @ <div class="warning forumpost-closed-warning"> | |
| 289 | + @ <div class="warning forumpost-closure-warning"> | |
| 290 | 290 | @ <form method="post" action="%R/forumpost_close"> |
| 291 | 291 | @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> |
| 292 | 292 | @ <input type="submit" value="CLOSE this post and its responses" /> |
| 293 | 293 | @ %s(zCommon) |
| 294 | 294 | @ </form></div> |
| @@ -295,16 +295,18 @@ | ||
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | assert( iClosed>0 ); |
| 298 | 298 | /* Only show the "unlock" checkbox on a post which is actually |
| 299 | 299 | ** closed, not on a post which inherits that state. */ |
| 300 | - @ <div class="warning forumpost-closed-warning">\ | |
| 300 | + @ <div class="warning forumpost-closure-warning">\ | |
| 301 | 301 | @ This post is CLOSED. %s(zCommon) |
| 302 | - @ <form method="post" action="%R/forumpost_reopen"> | |
| 303 | - @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> | |
| 304 | - @ <input type="submit" value="Re-open this post and its responses" /> | |
| 305 | - @ </form> | |
| 302 | + if( g.perm.Admin ){ | |
| 303 | + @ <form method="post" action="%R/forumpost_reopen"> | |
| 304 | + @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> | |
| 305 | + @ <input type="submit" value="Re-open this post and its responses" /> | |
| 306 | + @ </form> | |
| 307 | + } | |
| 306 | 308 | @ </div> |
| 307 | 309 | } |
| 308 | 310 | |
| 309 | 311 | /* |
| 310 | 312 | ** Emits a warning that the current forum post is CLOSED and can only |
| @@ -823,11 +825,12 @@ | ||
| 823 | 825 | /* When not in raw mode, finish creating the border around the post. */ |
| 824 | 826 | if( !bRaw ){ |
| 825 | 827 | /* If the user is able to write to the forum and if this post has not been |
| 826 | 828 | ** edited, create a form with various interaction buttons. */ |
| 827 | 829 | if( g.perm.WrForum && !p->pEditTail ){ |
| 828 | - @ <div><form action="%R/forumedit" method="POST"> | |
| 830 | + @ <div class="forumpost-single-controls">\ | |
| 831 | + @ <form action="%R/forumedit" method="POST"> | |
| 829 | 832 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)"> |
| 830 | 833 | if( !bPrivate ){ |
| 831 | 834 | /* Reply and Edit are only available if the post has been |
| 832 | 835 | ** approved. Closed threads can only be edited or replied to |
| 833 | 836 | ** by an admin but a user may delete their own posts even if |
| @@ -856,11 +859,20 @@ | ||
| 856 | 859 | } |
| 857 | 860 | }else if( bSameUser ){ |
| 858 | 861 | /* Allow users to delete (reject) their own pending posts. */ |
| 859 | 862 | @ <input type="submit" name="reject" value="Delete"> |
| 860 | 863 | } |
| 861 | - @ </form></div> | |
| 864 | + @ </form> | |
| 865 | + if( bSelect && g.perm.Admin && iClosed>=0 ){ | |
| 866 | + int iHead = forumpost_head_rid(p->fpid); | |
| 867 | + @ <form method="post" \ | |
| 868 | + @ action='%R/forumpost_%s(iClosed > 0 ? "reopen" : "close")'> | |
| 869 | + @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> | |
| 870 | + @ <input type="submit" value='%s(iClosed ? "Re-open" : "Close")' /> | |
| 871 | + @ </form> | |
| 872 | + } | |
| 873 | + @ </div> | |
| 862 | 874 | } |
| 863 | 875 | @ </div> |
| 864 | 876 | } |
| 865 | 877 | |
| 866 | 878 | /* Clean up. */ |
| @@ -1351,13 +1363,11 @@ | ||
| 1351 | 1363 | if( fpid<=0 ){ |
| 1352 | 1364 | webpage_error("Missing or invalid fpid query parameter"); |
| 1353 | 1365 | } |
| 1354 | 1366 | fClose = sqlite3_strglob("*_close*", g.zPath)==0; |
| 1355 | 1367 | if( fClose ) zReason = PD("reason",0); |
| 1356 | - if( forumpost_close(fpid, fClose, zReason)!=0 ){ | |
| 1357 | - admin_log("%s forum post %S", fClose ? "Close" : "Re-open", zFpid); | |
| 1358 | - } | |
| 1368 | + forumpost_close(fpid, fClose, zReason); | |
| 1359 | 1369 | cgi_redirectf("%R/forumpost/%S",zFpid); |
| 1360 | 1370 | return; |
| 1361 | 1371 | } |
| 1362 | 1372 | |
| 1363 | 1373 | /* |
| @@ -1612,11 +1622,10 @@ | ||
| 1612 | 1622 | } |
| 1613 | 1623 | style_header("Edit %s", zTitle ? "Post" : "Reply"); |
| 1614 | 1624 | @ <h2>Original Post:</h2> |
| 1615 | 1625 | forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki, |
| 1616 | 1626 | "forumEdit", 1); |
| 1617 | - forumpost_emit_closed_state(fpid, iClosed); | |
| 1618 | 1627 | if( bPreview ){ |
| 1619 | 1628 | @ <h2>Preview of Edited Post:</h2> |
| 1620 | 1629 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); |
| 1621 | 1630 | } |
| 1622 | 1631 | @ <h2>Revised Message:</h2> |
| @@ -1675,10 +1684,11 @@ | ||
| 1675 | 1684 | @ Show query parameters</label> |
| 1676 | 1685 | @ </div> |
| 1677 | 1686 | } |
| 1678 | 1687 | @ </form> |
| 1679 | 1688 | forum_emit_js(); |
| 1689 | + forumpost_emit_closed_state(fpid, iClosed); | |
| 1680 | 1690 | style_finish_page(); |
| 1681 | 1691 | } |
| 1682 | 1692 | |
| 1683 | 1693 | /* |
| 1684 | 1694 | ** WEBPAGE: forummain |
| 1685 | 1695 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -277,18 +277,18 @@ | |
| 277 | if( iHead != fpid ){ |
| 278 | iClosed = forum_rid_is_closed(iHead, 1); |
| 279 | /*@ forumpost_emit_closed_state() %d(iHead), %d(iClosed)*/ |
| 280 | } |
| 281 | if( iClosed<0 ){ |
| 282 | @ <div class="warning forumpost-closed-warning">\ |
| 283 | @ This post is CLOSED via a parent post. %s(zCommon)\ |
| 284 | @ </div> |
| 285 | return; |
| 286 | } |
| 287 | else if( iClosed==0 ){ |
| 288 | if( g.perm.Admin==0 ) return; |
| 289 | @ <div class="warning forumpost-closed-warning"> |
| 290 | @ <form method="post" action="%R/forumpost_close"> |
| 291 | @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> |
| 292 | @ <input type="submit" value="CLOSE this post and its responses" /> |
| 293 | @ %s(zCommon) |
| 294 | @ </form></div> |
| @@ -295,16 +295,18 @@ | |
| 295 | return; |
| 296 | } |
| 297 | assert( iClosed>0 ); |
| 298 | /* Only show the "unlock" checkbox on a post which is actually |
| 299 | ** closed, not on a post which inherits that state. */ |
| 300 | @ <div class="warning forumpost-closed-warning">\ |
| 301 | @ This post is CLOSED. %s(zCommon) |
| 302 | @ <form method="post" action="%R/forumpost_reopen"> |
| 303 | @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> |
| 304 | @ <input type="submit" value="Re-open this post and its responses" /> |
| 305 | @ </form> |
| 306 | @ </div> |
| 307 | } |
| 308 | |
| 309 | /* |
| 310 | ** Emits a warning that the current forum post is CLOSED and can only |
| @@ -823,11 +825,12 @@ | |
| 823 | /* When not in raw mode, finish creating the border around the post. */ |
| 824 | if( !bRaw ){ |
| 825 | /* If the user is able to write to the forum and if this post has not been |
| 826 | ** edited, create a form with various interaction buttons. */ |
| 827 | if( g.perm.WrForum && !p->pEditTail ){ |
| 828 | @ <div><form action="%R/forumedit" method="POST"> |
| 829 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)"> |
| 830 | if( !bPrivate ){ |
| 831 | /* Reply and Edit are only available if the post has been |
| 832 | ** approved. Closed threads can only be edited or replied to |
| 833 | ** by an admin but a user may delete their own posts even if |
| @@ -856,11 +859,20 @@ | |
| 856 | } |
| 857 | }else if( bSameUser ){ |
| 858 | /* Allow users to delete (reject) their own pending posts. */ |
| 859 | @ <input type="submit" name="reject" value="Delete"> |
| 860 | } |
| 861 | @ </form></div> |
| 862 | } |
| 863 | @ </div> |
| 864 | } |
| 865 | |
| 866 | /* Clean up. */ |
| @@ -1351,13 +1363,11 @@ | |
| 1351 | if( fpid<=0 ){ |
| 1352 | webpage_error("Missing or invalid fpid query parameter"); |
| 1353 | } |
| 1354 | fClose = sqlite3_strglob("*_close*", g.zPath)==0; |
| 1355 | if( fClose ) zReason = PD("reason",0); |
| 1356 | if( forumpost_close(fpid, fClose, zReason)!=0 ){ |
| 1357 | admin_log("%s forum post %S", fClose ? "Close" : "Re-open", zFpid); |
| 1358 | } |
| 1359 | cgi_redirectf("%R/forumpost/%S",zFpid); |
| 1360 | return; |
| 1361 | } |
| 1362 | |
| 1363 | /* |
| @@ -1612,11 +1622,10 @@ | |
| 1612 | } |
| 1613 | style_header("Edit %s", zTitle ? "Post" : "Reply"); |
| 1614 | @ <h2>Original Post:</h2> |
| 1615 | forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki, |
| 1616 | "forumEdit", 1); |
| 1617 | forumpost_emit_closed_state(fpid, iClosed); |
| 1618 | if( bPreview ){ |
| 1619 | @ <h2>Preview of Edited Post:</h2> |
| 1620 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); |
| 1621 | } |
| 1622 | @ <h2>Revised Message:</h2> |
| @@ -1675,10 +1684,11 @@ | |
| 1675 | @ Show query parameters</label> |
| 1676 | @ </div> |
| 1677 | } |
| 1678 | @ </form> |
| 1679 | forum_emit_js(); |
| 1680 | style_finish_page(); |
| 1681 | } |
| 1682 | |
| 1683 | /* |
| 1684 | ** WEBPAGE: forummain |
| 1685 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -277,18 +277,18 @@ | |
| 277 | if( iHead != fpid ){ |
| 278 | iClosed = forum_rid_is_closed(iHead, 1); |
| 279 | /*@ forumpost_emit_closed_state() %d(iHead), %d(iClosed)*/ |
| 280 | } |
| 281 | if( iClosed<0 ){ |
| 282 | @ <div class="warning forumpost-closure-warning">\ |
| 283 | @ This post is CLOSED via a parent post. %s(zCommon)\ |
| 284 | @ </div> |
| 285 | return; |
| 286 | } |
| 287 | else if( iClosed==0 ){ |
| 288 | if( g.perm.Admin==0 ) return; |
| 289 | @ <div class="warning forumpost-closure-warning"> |
| 290 | @ <form method="post" action="%R/forumpost_close"> |
| 291 | @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> |
| 292 | @ <input type="submit" value="CLOSE this post and its responses" /> |
| 293 | @ %s(zCommon) |
| 294 | @ </form></div> |
| @@ -295,16 +295,18 @@ | |
| 295 | return; |
| 296 | } |
| 297 | assert( iClosed>0 ); |
| 298 | /* Only show the "unlock" checkbox on a post which is actually |
| 299 | ** closed, not on a post which inherits that state. */ |
| 300 | @ <div class="warning forumpost-closure-warning">\ |
| 301 | @ This post is CLOSED. %s(zCommon) |
| 302 | if( g.perm.Admin ){ |
| 303 | @ <form method="post" action="%R/forumpost_reopen"> |
| 304 | @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> |
| 305 | @ <input type="submit" value="Re-open this post and its responses" /> |
| 306 | @ </form> |
| 307 | } |
| 308 | @ </div> |
| 309 | } |
| 310 | |
| 311 | /* |
| 312 | ** Emits a warning that the current forum post is CLOSED and can only |
| @@ -823,11 +825,12 @@ | |
| 825 | /* When not in raw mode, finish creating the border around the post. */ |
| 826 | if( !bRaw ){ |
| 827 | /* If the user is able to write to the forum and if this post has not been |
| 828 | ** edited, create a form with various interaction buttons. */ |
| 829 | if( g.perm.WrForum && !p->pEditTail ){ |
| 830 | @ <div class="forumpost-single-controls">\ |
| 831 | @ <form action="%R/forumedit" method="POST"> |
| 832 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)"> |
| 833 | if( !bPrivate ){ |
| 834 | /* Reply and Edit are only available if the post has been |
| 835 | ** approved. Closed threads can only be edited or replied to |
| 836 | ** by an admin but a user may delete their own posts even if |
| @@ -856,11 +859,20 @@ | |
| 859 | } |
| 860 | }else if( bSameUser ){ |
| 861 | /* Allow users to delete (reject) their own pending posts. */ |
| 862 | @ <input type="submit" name="reject" value="Delete"> |
| 863 | } |
| 864 | @ </form> |
| 865 | if( bSelect && g.perm.Admin && iClosed>=0 ){ |
| 866 | int iHead = forumpost_head_rid(p->fpid); |
| 867 | @ <form method="post" \ |
| 868 | @ action='%R/forumpost_%s(iClosed > 0 ? "reopen" : "close")'> |
| 869 | @ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" /> |
| 870 | @ <input type="submit" value='%s(iClosed ? "Re-open" : "Close")' /> |
| 871 | @ </form> |
| 872 | } |
| 873 | @ </div> |
| 874 | } |
| 875 | @ </div> |
| 876 | } |
| 877 | |
| 878 | /* Clean up. */ |
| @@ -1351,13 +1363,11 @@ | |
| 1363 | if( fpid<=0 ){ |
| 1364 | webpage_error("Missing or invalid fpid query parameter"); |
| 1365 | } |
| 1366 | fClose = sqlite3_strglob("*_close*", g.zPath)==0; |
| 1367 | if( fClose ) zReason = PD("reason",0); |
| 1368 | forumpost_close(fpid, fClose, zReason); |
| 1369 | cgi_redirectf("%R/forumpost/%S",zFpid); |
| 1370 | return; |
| 1371 | } |
| 1372 | |
| 1373 | /* |
| @@ -1612,11 +1622,10 @@ | |
| 1622 | } |
| 1623 | style_header("Edit %s", zTitle ? "Post" : "Reply"); |
| 1624 | @ <h2>Original Post:</h2> |
| 1625 | forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki, |
| 1626 | "forumEdit", 1); |
| 1627 | if( bPreview ){ |
| 1628 | @ <h2>Preview of Edited Post:</h2> |
| 1629 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); |
| 1630 | } |
| 1631 | @ <h2>Revised Message:</h2> |
| @@ -1675,10 +1684,11 @@ | |
| 1684 | @ Show query parameters</label> |
| 1685 | @ </div> |
| 1686 | } |
| 1687 | @ </form> |
| 1688 | forum_emit_js(); |
| 1689 | forumpost_emit_closed_state(fpid, iClosed); |
| 1690 | style_finish_page(); |
| 1691 | } |
| 1692 | |
| 1693 | /* |
| 1694 | ** WEBPAGE: forummain |
| 1695 |