Fossil SCM
Slight layout tweaks to the forum Attach button. Avoid rendering a /forumpost's attachment list when rendering in raw mode.
Commit
59ac3a461cc73e76c402dd3b57d7de45601f0b54a1b55633638b917b129fa0a6
Parent
1f49b393745d32b…
2 files changed
+1
-1
+7
-2
+1
-1
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -87,11 +87,11 @@ | ||
| 87 | 87 | |
| 88 | 88 | /* |
| 89 | 89 | ** Emits a single-button FORM which invokes |
| 90 | 90 | ** /attachadd?target=$zTarget. |
| 91 | 91 | */ |
| 92 | -void attach_emit_attachadd_button(const char *zTarget){ | |
| 92 | +void attach_render_attachadd_button(const char *zTarget){ | |
| 93 | 93 | @ <form method="post" action="%R/attachadd">\ |
| 94 | 94 | @ <input type="hidden" name="target" value="%T(zTarget)">\ |
| 95 | 95 | @ <input type="submit" value="Attach..."> |
| 96 | 96 | @ </form>\ |
| 97 | 97 | } |
| 98 | 98 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -87,11 +87,11 @@ | |
| 87 | |
| 88 | /* |
| 89 | ** Emits a single-button FORM which invokes |
| 90 | ** /attachadd?target=$zTarget. |
| 91 | */ |
| 92 | void attach_emit_attachadd_button(const char *zTarget){ |
| 93 | @ <form method="post" action="%R/attachadd">\ |
| 94 | @ <input type="hidden" name="target" value="%T(zTarget)">\ |
| 95 | @ <input type="submit" value="Attach..."> |
| 96 | @ </form>\ |
| 97 | } |
| 98 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -87,11 +87,11 @@ | |
| 87 | |
| 88 | /* |
| 89 | ** Emits a single-button FORM which invokes |
| 90 | ** /attachadd?target=$zTarget. |
| 91 | */ |
| 92 | void attach_render_attachadd_button(const char *zTarget){ |
| 93 | @ <form method="post" action="%R/attachadd">\ |
| 94 | @ <input type="hidden" name="target" value="%T(zTarget)">\ |
| 95 | @ <input type="submit" value="Attach..."> |
| 96 | @ </form>\ |
| 97 | } |
| 98 |
+7
-2
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -1213,15 +1213,16 @@ | ||
| 1213 | 1213 | zMimetype = "text/plain"; |
| 1214 | 1214 | }else{ |
| 1215 | 1215 | zMimetype = pManifest->zMimetype; |
| 1216 | 1216 | } |
| 1217 | 1217 | forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw); |
| 1218 | - forum_render_attachment_list2(p); | |
| 1219 | 1218 | } |
| 1220 | 1219 | |
| 1221 | 1220 | /* When not in raw mode, finish creating the border around the post. */ |
| 1222 | 1221 | if( !bRaw ){ |
| 1222 | + int bBrBeforeAttach = 0; /* Layout kludge for Attach button */ | |
| 1223 | + forum_render_attachment_list2(p); | |
| 1223 | 1224 | /* If the user is able to write to the forum and if this post has not been |
| 1224 | 1225 | ** edited, create a form with various interaction buttons. */ |
| 1225 | 1226 | if( g.perm.WrForum && !p->pEditTail ){ |
| 1226 | 1227 | @ <div class="forumpost-single-controls">\ |
| 1227 | 1228 | @ <form action="%R/forumedit" method="POST"> |
| @@ -1250,10 +1251,11 @@ | ||
| 1250 | 1251 | @ <br><label><input type="checkbox" name="trust"> |
| 1251 | 1252 | @ Trust user "%h(pManifest->zUser)" so that future posts by \ |
| 1252 | 1253 | @ "%h(pManifest->zUser)" do not require moderation. |
| 1253 | 1254 | @ </label> |
| 1254 | 1255 | @ <input type="hidden" name="trustuser" value="%h(pManifest->zUser)"> |
| 1256 | + bBrBeforeAttach = 1 /* slightly improve the layout */; | |
| 1255 | 1257 | } |
| 1256 | 1258 | }else if( bSameUser ){ |
| 1257 | 1259 | /* Allow users to delete (reject) their own pending posts. */ |
| 1258 | 1260 | @ <input type="submit" name="reject" value="Delete"> |
| 1259 | 1261 | } |
| @@ -1278,11 +1280,14 @@ | ||
| 1278 | 1280 | if( attach_user_may(p/*not pHead*/->fpid, CFTYPE_FORUM) ){ |
| 1279 | 1281 | /* When an admin edits someone else's post, the admin |
| 1280 | 1282 | ** effectively takes over ownership of it (and we currently |
| 1281 | 1283 | ** have no way of passing it back). Because of this, we |
| 1282 | 1284 | ** check the ownership of `p` instead of `pHead`. */ |
| 1283 | - attach_emit_attachadd_button(pHead->zUuid); | |
| 1285 | + if( bBrBeforeAttach ){ | |
| 1286 | + @ <br> | |
| 1287 | + } | |
| 1288 | + attach_render_attachadd_button(pHead->zUuid); | |
| 1284 | 1289 | } |
| 1285 | 1290 | } |
| 1286 | 1291 | @ </div> |
| 1287 | 1292 | } |
| 1288 | 1293 | if( !p->pIrt && (flags & FDISPLAY_SELECTED)){ |
| 1289 | 1294 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -1213,15 +1213,16 @@ | |
| 1213 | zMimetype = "text/plain"; |
| 1214 | }else{ |
| 1215 | zMimetype = pManifest->zMimetype; |
| 1216 | } |
| 1217 | forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw); |
| 1218 | forum_render_attachment_list2(p); |
| 1219 | } |
| 1220 | |
| 1221 | /* When not in raw mode, finish creating the border around the post. */ |
| 1222 | if( !bRaw ){ |
| 1223 | /* If the user is able to write to the forum and if this post has not been |
| 1224 | ** edited, create a form with various interaction buttons. */ |
| 1225 | if( g.perm.WrForum && !p->pEditTail ){ |
| 1226 | @ <div class="forumpost-single-controls">\ |
| 1227 | @ <form action="%R/forumedit" method="POST"> |
| @@ -1250,10 +1251,11 @@ | |
| 1250 | @ <br><label><input type="checkbox" name="trust"> |
| 1251 | @ Trust user "%h(pManifest->zUser)" so that future posts by \ |
| 1252 | @ "%h(pManifest->zUser)" do not require moderation. |
| 1253 | @ </label> |
| 1254 | @ <input type="hidden" name="trustuser" value="%h(pManifest->zUser)"> |
| 1255 | } |
| 1256 | }else if( bSameUser ){ |
| 1257 | /* Allow users to delete (reject) their own pending posts. */ |
| 1258 | @ <input type="submit" name="reject" value="Delete"> |
| 1259 | } |
| @@ -1278,11 +1280,14 @@ | |
| 1278 | if( attach_user_may(p/*not pHead*/->fpid, CFTYPE_FORUM) ){ |
| 1279 | /* When an admin edits someone else's post, the admin |
| 1280 | ** effectively takes over ownership of it (and we currently |
| 1281 | ** have no way of passing it back). Because of this, we |
| 1282 | ** check the ownership of `p` instead of `pHead`. */ |
| 1283 | attach_emit_attachadd_button(pHead->zUuid); |
| 1284 | } |
| 1285 | } |
| 1286 | @ </div> |
| 1287 | } |
| 1288 | if( !p->pIrt && (flags & FDISPLAY_SELECTED)){ |
| 1289 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -1213,15 +1213,16 @@ | |
| 1213 | zMimetype = "text/plain"; |
| 1214 | }else{ |
| 1215 | zMimetype = pManifest->zMimetype; |
| 1216 | } |
| 1217 | forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw); |
| 1218 | } |
| 1219 | |
| 1220 | /* When not in raw mode, finish creating the border around the post. */ |
| 1221 | if( !bRaw ){ |
| 1222 | int bBrBeforeAttach = 0; /* Layout kludge for Attach button */ |
| 1223 | forum_render_attachment_list2(p); |
| 1224 | /* If the user is able to write to the forum and if this post has not been |
| 1225 | ** edited, create a form with various interaction buttons. */ |
| 1226 | if( g.perm.WrForum && !p->pEditTail ){ |
| 1227 | @ <div class="forumpost-single-controls">\ |
| 1228 | @ <form action="%R/forumedit" method="POST"> |
| @@ -1250,10 +1251,11 @@ | |
| 1251 | @ <br><label><input type="checkbox" name="trust"> |
| 1252 | @ Trust user "%h(pManifest->zUser)" so that future posts by \ |
| 1253 | @ "%h(pManifest->zUser)" do not require moderation. |
| 1254 | @ </label> |
| 1255 | @ <input type="hidden" name="trustuser" value="%h(pManifest->zUser)"> |
| 1256 | bBrBeforeAttach = 1 /* slightly improve the layout */; |
| 1257 | } |
| 1258 | }else if( bSameUser ){ |
| 1259 | /* Allow users to delete (reject) their own pending posts. */ |
| 1260 | @ <input type="submit" name="reject" value="Delete"> |
| 1261 | } |
| @@ -1278,11 +1280,14 @@ | |
| 1280 | if( attach_user_may(p/*not pHead*/->fpid, CFTYPE_FORUM) ){ |
| 1281 | /* When an admin edits someone else's post, the admin |
| 1282 | ** effectively takes over ownership of it (and we currently |
| 1283 | ** have no way of passing it back). Because of this, we |
| 1284 | ** check the ownership of `p` instead of `pHead`. */ |
| 1285 | if( bBrBeforeAttach ){ |
| 1286 | @ <br> |
| 1287 | } |
| 1288 | attach_render_attachadd_button(pHead->zUuid); |
| 1289 | } |
| 1290 | } |
| 1291 | @ </div> |
| 1292 | } |
| 1293 | if( !p->pIrt && (flags & FDISPLAY_SELECTED)){ |
| 1294 |