Fossil SCM

Make the maximum title length when creating a new forum post configurable using the new forum-max-title setting.

drh 2026-10-23 13:23 UTC trunk
Commit 83613064b853e70bf6cb76fa5c1e2342f29b267f02c002dcf8d93ae6574cf6d8
1 file changed +12 -1
+12 -1
--- src/forum.c
+++ src/forum.c
@@ -1846,12 +1846,17 @@
18461846
const char *zTitle,
18471847
const char *zMimetype,
18481848
const char *zContent
18491849
){
18501850
if( zTitle ){
1851
+ int mxTitle = db_get_int("forum-max-title", 125);
18511852
@ Title: <input type="input" name="title" value="%h(zTitle)" size="50"
1852
- @ maxlength="125"><br>
1853
+ if( mxTitle>0 ){
1854
+ @ maxlength="%d(mxTitle)"><br>
1855
+ }else{
1856
+ @ ><br>
1857
+ }
18531858
}
18541859
@ %z(href("%R/markup_help"))Markup style</a>:
18551860
mimetype_option_menu(zMimetype, "mimetype");
18561861
@ <div class="forum-editor-widget">
18571862
@ <textarea aria-label="Content:" name="content" class="wikiedit" \
@@ -2305,10 +2310,15 @@
23052310
** This is the name or "title" of the Forum for this repository. The
23062311
** default is just "Forum". But in some setups, admins might want to
23072312
** change it to "Developer Forum" or "User Forum" or whatever other name
23082313
** seems more appropriate for the particular usage.
23092314
**
2315
+** SETTING: forum-max-title width=10 default=125
2316
+** The maximum number of characters allowed in the title of a new
2317
+** forum thread, as enforced by the web browser on the post editor.
2318
+** A value of zero or less means there is no limit.
2319
+**
23102320
** SETTING: attachment-size-limit width=16
23112321
** The maximum number of bytes for an attachment to a wiki page,
23122322
** ticket, tech note, or forum post. The default (or 0) is unlimited
23132323
** but a limit may be imposed by the web server or a proxy.
23142324
**
@@ -2332,10 +2342,11 @@
23322342
void forum_setup(void){
23332343
/* boolean config settings specific to the forum. */
23342344
static const char *azForumSettings[] = {
23352345
"forum-close-policy",
23362346
"forum-title",
2347
+ "forum-max-title",
23372348
"forum-statuses",
23382349
};
23392350
23402351
login_check_credentials();
23412352
if( !g.perm.Setup ){
23422353
--- src/forum.c
+++ src/forum.c
@@ -1846,12 +1846,17 @@
1846 const char *zTitle,
1847 const char *zMimetype,
1848 const char *zContent
1849 ){
1850 if( zTitle ){
 
1851 @ Title: <input type="input" name="title" value="%h(zTitle)" size="50"
1852 @ maxlength="125"><br>
 
 
 
 
1853 }
1854 @ %z(href("%R/markup_help"))Markup style</a>:
1855 mimetype_option_menu(zMimetype, "mimetype");
1856 @ <div class="forum-editor-widget">
1857 @ <textarea aria-label="Content:" name="content" class="wikiedit" \
@@ -2305,10 +2310,15 @@
2305 ** This is the name or "title" of the Forum for this repository. The
2306 ** default is just "Forum". But in some setups, admins might want to
2307 ** change it to "Developer Forum" or "User Forum" or whatever other name
2308 ** seems more appropriate for the particular usage.
2309 **
 
 
 
 
 
2310 ** SETTING: attachment-size-limit width=16
2311 ** The maximum number of bytes for an attachment to a wiki page,
2312 ** ticket, tech note, or forum post. The default (or 0) is unlimited
2313 ** but a limit may be imposed by the web server or a proxy.
2314 **
@@ -2332,10 +2342,11 @@
2332 void forum_setup(void){
2333 /* boolean config settings specific to the forum. */
2334 static const char *azForumSettings[] = {
2335 "forum-close-policy",
2336 "forum-title",
 
2337 "forum-statuses",
2338 };
2339
2340 login_check_credentials();
2341 if( !g.perm.Setup ){
2342
--- src/forum.c
+++ src/forum.c
@@ -1846,12 +1846,17 @@
1846 const char *zTitle,
1847 const char *zMimetype,
1848 const char *zContent
1849 ){
1850 if( zTitle ){
1851 int mxTitle = db_get_int("forum-max-title", 125);
1852 @ Title: <input type="input" name="title" value="%h(zTitle)" size="50"
1853 if( mxTitle>0 ){
1854 @ maxlength="%d(mxTitle)"><br>
1855 }else{
1856 @ ><br>
1857 }
1858 }
1859 @ %z(href("%R/markup_help"))Markup style</a>:
1860 mimetype_option_menu(zMimetype, "mimetype");
1861 @ <div class="forum-editor-widget">
1862 @ <textarea aria-label="Content:" name="content" class="wikiedit" \
@@ -2305,10 +2310,15 @@
2310 ** This is the name or "title" of the Forum for this repository. The
2311 ** default is just "Forum". But in some setups, admins might want to
2312 ** change it to "Developer Forum" or "User Forum" or whatever other name
2313 ** seems more appropriate for the particular usage.
2314 **
2315 ** SETTING: forum-max-title width=10 default=125
2316 ** The maximum number of characters allowed in the title of a new
2317 ** forum thread, as enforced by the web browser on the post editor.
2318 ** A value of zero or less means there is no limit.
2319 **
2320 ** SETTING: attachment-size-limit width=16
2321 ** The maximum number of bytes for an attachment to a wiki page,
2322 ** ticket, tech note, or forum post. The default (or 0) is unlimited
2323 ** but a limit may be imposed by the web server or a proxy.
2324 **
@@ -2332,10 +2342,11 @@
2342 void forum_setup(void){
2343 /* boolean config settings specific to the forum. */
2344 static const char *azForumSettings[] = {
2345 "forum-close-policy",
2346 "forum-title",
2347 "forum-max-title",
2348 "forum-statuses",
2349 };
2350
2351 login_check_credentials();
2352 if( !g.perm.Setup ){
2353

Keyboard Shortcuts

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