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].
Commit
2ee93fc0c577a5451a38382082569132217213adee948ed9c55152898070a5f5
Parent
1f184d0e82da4c5…
1 file changed
+17
-2
+17
-2
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -1392,20 +1392,23 @@ | ||
| 1392 | 1392 | ** x=X Skip the first X threads |
| 1393 | 1393 | ** s=Y Search for term Y. |
| 1394 | 1394 | */ |
| 1395 | 1395 | void forum_main_page(void){ |
| 1396 | 1396 | Stmt q; |
| 1397 | - int iLimit, iOfst, iCnt; | |
| 1397 | + int iLimit = 0, iOfst, iCnt; | |
| 1398 | 1398 | int srchFlags; |
| 1399 | 1399 | const int isSearch = P("s")!=0; |
| 1400 | + char const *zLimit = 0; | |
| 1401 | + | |
| 1400 | 1402 | login_check_credentials(); |
| 1401 | 1403 | srchFlags = search_restrict(SRCH_FORUM); |
| 1402 | 1404 | if( !g.perm.RdForum ){ |
| 1403 | 1405 | login_needed(g.anon.RdForum); |
| 1404 | 1406 | return; |
| 1405 | 1407 | } |
| 1406 | 1408 | style_set_current_feature("forum"); |
| 1409 | + cookie_read_parameter("n","forum-n"); | |
| 1407 | 1410 | style_header( "%s", isSearch ? "Forum Search Results" : "Forum" ); |
| 1408 | 1411 | style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx"); |
| 1409 | 1412 | if( g.perm.WrForum ){ |
| 1410 | 1413 | style_submenu_element("New Thread","%R/forumnew"); |
| 1411 | 1414 | }else{ |
| @@ -1423,11 +1426,23 @@ | ||
| 1423 | 1426 | style_submenu_element("Recent Threads","%R/forum"); |
| 1424 | 1427 | style_finish_page(); |
| 1425 | 1428 | return; |
| 1426 | 1429 | } |
| 1427 | 1430 | } |
| 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); | |
| 1429 | 1444 | iOfst = atoi(PD("x","0")); |
| 1430 | 1445 | iCnt = 0; |
| 1431 | 1446 | if( db_table_exists("repository","forumpost") ){ |
| 1432 | 1447 | db_prepare(&q, |
| 1433 | 1448 | "WITH thread(age,duration,cnt,root,last) AS (" |
| 1434 | 1449 |
| --- 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 |