| | @@ -1761,20 +1761,35 @@ |
| 1761 | 1761 | @ </form> |
| 1762 | 1762 | forum_emit_js(); |
| 1763 | 1763 | style_finish_page(); |
| 1764 | 1764 | } |
| 1765 | 1765 | |
| 1766 | +/* |
| 1767 | +** SETTING: forum-close-policy boolean default=off |
| 1768 | +** If true, forum moderators may close/re-open forum posts, and reply |
| 1769 | +** to closed posts. If false, only administrators may do so. Note that |
| 1770 | +** this only affects the forum web UI, not post-closing tags which |
| 1771 | +** arrive via the command-line or from synchronization with a remote. |
| 1772 | +*/ |
| 1773 | +/* |
| 1774 | +** SETTING: forum-title width=20 default=Forum |
| 1775 | +** This is the name or "title" of the Forum for this repository. The |
| 1776 | +** default is just "Forum". But in some setups, admins might want to |
| 1777 | +** change it to "Developer Forum" or "User Forum" or whatever other name |
| 1778 | +** seems more appropriate for the particular usage. |
| 1779 | +*/ |
| 1780 | + |
| 1766 | 1781 | /* |
| 1767 | 1782 | ** WEBPAGE: setup_forum |
| 1768 | 1783 | ** |
| 1769 | 1784 | ** Forum configuration and metrics. |
| 1770 | 1785 | */ |
| 1771 | 1786 | void forum_setup(void){ |
| 1772 | 1787 | /* boolean config settings specific to the forum. */ |
| 1773 | | - const char * zSettingsBool[] = { |
| 1774 | | - "forum-close-policy", |
| 1775 | | - NULL /* sentinel entry */ |
| 1788 | + static const char *azForumSettings[] = { |
| 1789 | + "forum-close-policy", |
| 1790 | + "forum-title", |
| 1776 | 1791 | }; |
| 1777 | 1792 | |
| 1778 | 1793 | login_check_credentials(); |
| 1779 | 1794 | if( !g.perm.Setup ){ |
| 1780 | 1795 | login_needed(g.anon.Setup); |
| | @@ -1850,32 +1865,55 @@ |
| 1850 | 1865 | |
| 1851 | 1866 | @ <h2>Settings</h2> |
| 1852 | 1867 | @ <p>Configuration settings specific to the forum.</p> |
| 1853 | 1868 | if( P("submit") && cgi_csrf_safe(2) ){ |
| 1854 | 1869 | int i = 0; |
| 1855 | | - const char *zSetting; |
| 1856 | 1870 | db_begin_transaction(); |
| 1857 | | - while( (zSetting = zSettingsBool[i++]) ){ |
| 1858 | | - const char *z = P(zSetting); |
| 1859 | | - if( !z || !z[0] ) z = "off"; |
| 1860 | | - db_set(zSetting/*works-like:"x"*/, z, 0); |
| 1871 | + for(i=0; i<ArraySize(azForumSettings); i++){ |
| 1872 | + char zQP[4]; |
| 1873 | + const char *z; |
| 1874 | + const Setting *pSetting = setting_find(azForumSettings[i]); |
| 1875 | + if( pSetting==0 ) continue; |
| 1876 | + zQP[0] = 'a'+i; |
| 1877 | + zQP[1] = zQP[0]; |
| 1878 | + zQP[2] = 0; |
| 1879 | + z = P(zQP); |
| 1880 | + if( z==0 || z[0]==0 ) continue; |
| 1881 | + db_set(pSetting->name/*works-like:"x"*/, z, 0); |
| 1861 | 1882 | } |
| 1862 | 1883 | db_end_transaction(0); |
| 1863 | 1884 | @ <p><em>Settings saved.</em></p> |
| 1864 | 1885 | } |
| 1865 | 1886 | { |
| 1866 | 1887 | int i = 0; |
| 1867 | | - const char *zSetting; |
| 1868 | 1888 | @ <form action="%R/setup_forum" method="post"> |
| 1869 | 1889 | login_insert_csrf_secret(); |
| 1870 | 1890 | @ <table class='forum-settings-list'><tbody> |
| 1871 | | - while( (zSetting = zSettingsBool[i++]) ){ |
| 1872 | | - @ <tr><td> |
| 1873 | | - onoff_attribute("", zSetting, zSetting/*works-like:"x"*/, 0, 0); |
| 1874 | | - @ </td><td> |
| 1875 | | - @ <a href='%R/help?cmd=%h(zSetting)'>%h(zSetting)</a> |
| 1876 | | - @ </td></tr> |
| 1891 | + for(i=0; i<ArraySize(azForumSettings); i++){ |
| 1892 | + char zQP[4]; |
| 1893 | + const Setting *pSetting = setting_find(azForumSettings[i]); |
| 1894 | + if( pSetting==0 ) continue; |
| 1895 | + zQP[0] = 'a'+i; |
| 1896 | + zQP[1] = zQP[0]; |
| 1897 | + zQP[2] = 0; |
| 1898 | + if( pSetting->width==0 ){ |
| 1899 | + /* Boolean setting */ |
| 1900 | + @ <tr><td> <td width="5"> |
| 1901 | + onoff_attribute("", zQP, pSetting->name/*works-like:"x"*/, 0, 0); |
| 1902 | + @ </td><td> |
| 1903 | + @ <a href='%R/help?cmd=%h(pSetting->name)'>%h(pSetting->name)</a> |
| 1904 | + @ </td> |
| 1905 | + @ <td> </td></tr> |
| 1906 | + }else{ |
| 1907 | + /* Text value setting */ |
| 1908 | + @ <tr><td colspan="2"> |
| 1909 | + entry_attribute("", 25, pSetting->name, zQP/*works-like:""*/, |
| 1910 | + pSetting->def, 0); |
| 1911 | + @ </td><td> |
| 1912 | + @ <a href='%R/help?cmd=%h(pSetting->name)'>%h(pSetting->name)</a> |
| 1913 | + @ </td></tr> |
| 1914 | + } |
| 1877 | 1915 | } |
| 1878 | 1916 | @ </tbody></table> |
| 1879 | 1917 | @ <input type='submit' name='submit' value='Apply changes'> |
| 1880 | 1918 | @ </form> |
| 1881 | 1919 | } |
| | @@ -1910,11 +1948,12 @@ |
| 1910 | 1948 | login_needed(g.anon.RdForum); |
| 1911 | 1949 | return; |
| 1912 | 1950 | } |
| 1913 | 1951 | cgi_check_for_malice(); |
| 1914 | 1952 | style_set_current_feature("forum"); |
| 1915 | | - style_header( "%s", isSearch ? "Forum Search Results" : "Forum" ); |
| 1953 | + style_header("%s%s", db_get("forum-title","Forum"), |
| 1954 | + isSearch ? " Search Results" : ""); |
| 1916 | 1955 | style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx"); |
| 1917 | 1956 | if( g.perm.WrForum ){ |
| 1918 | 1957 | style_submenu_element("New Thread","%R/forumnew"); |
| 1919 | 1958 | }else{ |
| 1920 | 1959 | /* Can't combine this with previous case using the ternary operator |
| 1921 | 1960 | |