Fossil SCM

Add a 'Max' field to the forum thread list, analog to the one in /timeline, and remember that value as part of the display prefs cookie. Per request in [forum:113ee6f241b84403|forum post 113ee6f241b84403].

stephan 2023-03-11 11:05 trunk
Commit 2ee93fc0c577a5451a38382082569132217213adee948ed9c55152898070a5f5
1 file changed +17 -2
+17 -2
--- src/forum.c
+++ src/forum.c
@@ -1392,20 +1392,23 @@
13921392
** x=X Skip the first X threads
13931393
** s=Y Search for term Y.
13941394
*/
13951395
void forum_main_page(void){
13961396
Stmt q;
1397
- int iLimit, iOfst, iCnt;
1397
+ int iLimit = 0, iOfst, iCnt;
13981398
int srchFlags;
13991399
const int isSearch = P("s")!=0;
1400
+ char const *zLimit = 0;
1401
+
14001402
login_check_credentials();
14011403
srchFlags = search_restrict(SRCH_FORUM);
14021404
if( !g.perm.RdForum ){
14031405
login_needed(g.anon.RdForum);
14041406
return;
14051407
}
14061408
style_set_current_feature("forum");
1409
+ cookie_read_parameter("n","forum-n");
14071410
style_header( "%s", isSearch ? "Forum Search Results" : "Forum" );
14081411
style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx");
14091412
if( g.perm.WrForum ){
14101413
style_submenu_element("New Thread","%R/forumnew");
14111414
}else{
@@ -1423,11 +1426,23 @@
14231426
style_submenu_element("Recent Threads","%R/forum");
14241427
style_finish_page();
14251428
return;
14261429
}
14271430
}
1428
- iLimit = atoi(PD("n","25"));
1431
+ zLimit = P("n");
1432
+ if( zLimit!=0 ){
1433
+ iLimit = atoi(zLimit);
1434
+ if( iLimit>=0 && P("udc")!=0 ){
1435
+ cookie_write_parameter("n","forum-n",0);
1436
+ }
1437
+ }
1438
+ if( iLimit<=0 ){
1439
+ cgi_replace_query_parameter("n", fossil_strdup("25"))
1440
+ /*for the sake of Max, below*/;
1441
+ iLimit = 25;
1442
+ }
1443
+ style_submenu_entry("n","Max:",4,0);
14291444
iOfst = atoi(PD("x","0"));
14301445
iCnt = 0;
14311446
if( db_table_exists("repository","forumpost") ){
14321447
db_prepare(&q,
14331448
"WITH thread(age,duration,cnt,root,last) AS ("
14341449
--- src/forum.c
+++ src/forum.c
@@ -1392,20 +1392,23 @@
1392 ** x=X Skip the first X threads
1393 ** s=Y Search for term Y.
1394 */
1395 void forum_main_page(void){
1396 Stmt q;
1397 int iLimit, iOfst, iCnt;
1398 int srchFlags;
1399 const int isSearch = P("s")!=0;
 
 
1400 login_check_credentials();
1401 srchFlags = search_restrict(SRCH_FORUM);
1402 if( !g.perm.RdForum ){
1403 login_needed(g.anon.RdForum);
1404 return;
1405 }
1406 style_set_current_feature("forum");
 
1407 style_header( "%s", isSearch ? "Forum Search Results" : "Forum" );
1408 style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx");
1409 if( g.perm.WrForum ){
1410 style_submenu_element("New Thread","%R/forumnew");
1411 }else{
@@ -1423,11 +1426,23 @@
1423 style_submenu_element("Recent Threads","%R/forum");
1424 style_finish_page();
1425 return;
1426 }
1427 }
1428 iLimit = atoi(PD("n","25"));
 
 
 
 
 
 
 
 
 
 
 
 
1429 iOfst = atoi(PD("x","0"));
1430 iCnt = 0;
1431 if( db_table_exists("repository","forumpost") ){
1432 db_prepare(&q,
1433 "WITH thread(age,duration,cnt,root,last) AS ("
1434
--- src/forum.c
+++ src/forum.c
@@ -1392,20 +1392,23 @@
1392 ** x=X Skip the first X threads
1393 ** s=Y Search for term Y.
1394 */
1395 void forum_main_page(void){
1396 Stmt q;
1397 int iLimit = 0, iOfst, iCnt;
1398 int srchFlags;
1399 const int isSearch = P("s")!=0;
1400 char const *zLimit = 0;
1401
1402 login_check_credentials();
1403 srchFlags = search_restrict(SRCH_FORUM);
1404 if( !g.perm.RdForum ){
1405 login_needed(g.anon.RdForum);
1406 return;
1407 }
1408 style_set_current_feature("forum");
1409 cookie_read_parameter("n","forum-n");
1410 style_header( "%s", isSearch ? "Forum Search Results" : "Forum" );
1411 style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx");
1412 if( g.perm.WrForum ){
1413 style_submenu_element("New Thread","%R/forumnew");
1414 }else{
@@ -1423,11 +1426,23 @@
1426 style_submenu_element("Recent Threads","%R/forum");
1427 style_finish_page();
1428 return;
1429 }
1430 }
1431 zLimit = P("n");
1432 if( zLimit!=0 ){
1433 iLimit = atoi(zLimit);
1434 if( iLimit>=0 && P("udc")!=0 ){
1435 cookie_write_parameter("n","forum-n",0);
1436 }
1437 }
1438 if( iLimit<=0 ){
1439 cgi_replace_query_parameter("n", fossil_strdup("25"))
1440 /*for the sake of Max, below*/;
1441 iLimit = 25;
1442 }
1443 style_submenu_entry("n","Max:",4,0);
1444 iOfst = atoi(PD("x","0"));
1445 iCnt = 0;
1446 if( db_table_exists("repository","forumpost") ){
1447 db_prepare(&q,
1448 "WITH thread(age,duration,cnt,root,last) AS ("
1449

Keyboard Shortcuts

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