Fossil SCM

Slight layout tweaks to the forum Attach button. Avoid rendering a /forumpost's attachment list when rendering in raw mode.

stephan 2026-06-03 15:54 UTC attach-v2
Commit 59ac3a461cc73e76c402dd3b57d7de45601f0b54a1b55633638b917b129fa0a6
2 files changed +1 -1 +7 -2
+1 -1
--- src/attach.c
+++ src/attach.c
@@ -87,11 +87,11 @@
8787
8888
/*
8989
** Emits a single-button FORM which invokes
9090
** /attachadd?target=$zTarget.
9191
*/
92
-void attach_emit_attachadd_button(const char *zTarget){
92
+void attach_render_attachadd_button(const char *zTarget){
9393
@ <form method="post" action="%R/attachadd">\
9494
@ <input type="hidden" name="target" value="%T(zTarget)">\
9595
@ <input type="submit" value="Attach...">
9696
@ </form>\
9797
}
9898
--- 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 @@
12131213
zMimetype = "text/plain";
12141214
}else{
12151215
zMimetype = pManifest->zMimetype;
12161216
}
12171217
forum_render(0, zMimetype, pManifest->zWiki, 0, !bRaw);
1218
- forum_render_attachment_list2(p);
12191218
}
12201219
12211220
/* When not in raw mode, finish creating the border around the post. */
12221221
if( !bRaw ){
1222
+ int bBrBeforeAttach = 0; /* Layout kludge for Attach button */
1223
+ forum_render_attachment_list2(p);
12231224
/* If the user is able to write to the forum and if this post has not been
12241225
** edited, create a form with various interaction buttons. */
12251226
if( g.perm.WrForum && !p->pEditTail ){
12261227
@ <div class="forumpost-single-controls">\
12271228
@ <form action="%R/forumedit" method="POST">
@@ -1250,10 +1251,11 @@
12501251
@ <br><label><input type="checkbox" name="trust">
12511252
@ Trust user "%h(pManifest->zUser)" so that future posts by \
12521253
@ "%h(pManifest->zUser)" do not require moderation.
12531254
@ </label>
12541255
@ <input type="hidden" name="trustuser" value="%h(pManifest->zUser)">
1256
+ bBrBeforeAttach = 1 /* slightly improve the layout */;
12551257
}
12561258
}else if( bSameUser ){
12571259
/* Allow users to delete (reject) their own pending posts. */
12581260
@ <input type="submit" name="reject" value="Delete">
12591261
}
@@ -1278,11 +1280,14 @@
12781280
if( attach_user_may(p/*not pHead*/->fpid, CFTYPE_FORUM) ){
12791281
/* When an admin edits someone else's post, the admin
12801282
** effectively takes over ownership of it (and we currently
12811283
** have no way of passing it back). Because of this, we
12821284
** 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);
12841289
}
12851290
}
12861291
@ </div>
12871292
}
12881293
if( !p->pIrt && (flags & FDISPLAY_SELECTED)){
12891294
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button