286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
return permClose;
}else if( g.perm.Admin ){
return permClose = 1;
}else if( g.perm.ModForum ){
return permClose = forumpost_close_policy()>0 ? -1 : 0;
}else{
return permClose = 0;
}
}
/*
** If iClosed is true and the current user forumpost-close privileges,
** this renders either a checkbox to unlock forum post fpid (if
** iClosed>0) or a SPAN.warning element that the given post inherits
** the CLOSED status from a parent post (if iClosed<0). If neither of
** the initial conditions is true, this is a no-op.
*/
static void forumpost_emit_closed_state(int fpid, int iClosed){
const char *zCommon;
int iHead = forumpost_head_rid(fpid);
const int permClose = forumpost_may_close();
zCommon = forumpost_close_policy()==0
? "Admins may close or re-open posts, or respond to closed posts."
: "Admins or moderators "
"may close or re-open posts, or respond to closed posts.";
/*@ forumpost_emit_closed_state(%d(fpid), %d(iClosed))<br/>*/
if( iHead != fpid ){
iClosed = forum_rid_is_closed(iHead, 1);
/*@ forumpost_emit_closed_state() %d(iHead), %d(iClosed)*/
}
if( iClosed<0 ){
@ <div class="warning forumpost-closure-warning">\
@ This post is CLOSED via a parent post. %s(zCommon)\
@ </div>
return;
}
else if( iClosed==0 ){
if( permClose==0 ) return;
@ <div class="warning forumpost-closure-warning">
@ <form method="post" action="%R/forumpost_close">
@ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" />
@ <input type="submit" value="CLOSE this post and its responses" />
@ <span>%s(zCommon)</span>
@ <span>This does NOT save any pending changes in
@ the editor!</span>
@ </form></div>
return;
}
assert( iClosed>0 );
/* Only show the "unlock" option on a post which is actually
** closed, not on a post which inherits that state. */
@ <div class="warning forumpost-closure-warning">\
@ This post is CLOSED. %s(zCommon)
if( permClose ){
@ <form method="post" action="%R/forumpost_reopen">
@ <input type="hidden" name="fpid" value="%z(rid_to_uuid(iHead))" />
@ <input type="submit" value="Re-open this post and its responses" />
@ <span>This does NOT save any pending changes in
@ the editor!</span>
@ </form>
}
@ </div>
}
/*
** Emits a warning that the current forum post is CLOSED and can only
** be edited or responded to by an administrator. */
static void forumpost_error_closed(void){
@ <div class='error'>This (sub)thread is CLOSED and can only be
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
return permClose;
}else if( g.perm.Admin ){
return permClose = 1;
}else if( g.perm.ModForum ){
return permClose = forumpost_close_policy()>0 ? -1 : 0;
}else{
return permClose = 0;
}
}
/*
** Emits a warning that the current forum post is CLOSED and can only
** be edited or responded to by an administrator. */
static void forumpost_error_closed(void){
@ <div class='error'>This (sub)thread is CLOSED and can only be
|
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
|
zMimetype = "text/x-fossil-wiki";
zContent = "";
if( pPost->zThreadTitle ) zTitle = "";
style_header("Delete %s", zTitle ? "Post" : "Reply");
@ <h1>Original Post:</h1>
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
"forumEdit", 1);
forumpost_emit_closed_state(fpid, iClosed);
@ <h1>Change Into:</h1>
forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
@ <form action="%R/forume2" method="POST">
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
@ <input type="hidden" name="nullout" value="1">
@ <input type="hidden" name="mimetype" value="%h(zMimetype)">
@ <input type="hidden" name="content" value="%h(zContent)">
|
<
|
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
|
zMimetype = "text/x-fossil-wiki";
zContent = "";
if( pPost->zThreadTitle ) zTitle = "";
style_header("Delete %s", zTitle ? "Post" : "Reply");
@ <h1>Original Post:</h1>
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
"forumEdit", 1);
@ <h1>Change Into:</h1>
forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
@ <form action="%R/forume2" method="POST">
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
@ <input type="hidden" name="nullout" value="1">
@ <input type="hidden" name="mimetype" value="%h(zMimetype)">
@ <input type="hidden" name="content" value="%h(zContent)">
|
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
|
if( !iClosed || g.perm.Admin ) {
@ <input type="submit" name="submit" value="Submit">
}
}
forum_render_debug_options();
@ </form>
forum_emit_js();
if( bReply==0 ){
/* Do not show CLOSE option for new posts/responses. */
forumpost_emit_closed_state(fpid, iClosed);
}
style_finish_page();
}
/*
** WEBPAGE: setup_forum
**
** Forum configuration and metrics.
|
<
<
<
<
|
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
|
if( !iClosed || g.perm.Admin ) {
@ <input type="submit" name="submit" value="Submit">
}
}
forum_render_debug_options();
@ </form>
forum_emit_js();
style_finish_page();
}
/*
** WEBPAGE: setup_forum
**
** Forum configuration and metrics.
|