Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Initial version of the /setup_forum page. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | forumpost-locking |
| Files: | files | file ages | folders |
| SHA3-256: |
b370c189bcad53d60649309c576c39d6 |
| User & Date: | stephan 2023-06-07 12:07:30.733 |
Context
|
2023-06-10
| ||
| 09:16 | Add ability to "close" forum posts. check-in: 673dc38ffb user: stephan tags: trunk | |
|
2023-06-07
| ||
| 12:07 | Initial version of the /setup_forum page. Closed-Leaf check-in: b370c189bc user: stephan tags: forumpost-locking | |
|
2023-06-06
| ||
| 19:38 | Add the forum-close-policy boolean config setting. If true, forum moderators may close/re-open forum posts, as well as reply to closed posts. check-in: 162fc1e6aa user: stephan tags: forumpost-locking | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
4650 4651 4652 4653 4654 4655 4656 | ** to obtain a check-in lock during auto-sync, the server will ** send the "pragma avoid-delta-manifests" statement in its reply, ** which will cause the client to avoid generating a delta ** manifest. */ /* ** SETTING: forum-close-policy boolean default=off | | | | | | 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 | ** to obtain a check-in lock during auto-sync, the server will ** send the "pragma avoid-delta-manifests" statement in its reply, ** which will cause the client to avoid generating a delta ** manifest. */ /* ** SETTING: forum-close-policy boolean default=off ** If true, forum moderators may close/re-open forum posts, and reply ** to closed posts. If false, only administrators may do so. Note that ** this only affects the forum web UI, not post-closing tags which ** arrive via the command-line or from synchronization with a remote. */ /* ** SETTING: gdiff-command width=40 default=gdiff sensitive ** The value is an external command to run when performing a graphical ** diff. If undefined, text diff will be used. */ /* |
| ︙ | ︙ |
Changes to src/default.css.
| ︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 |
div.forumSel {
background-color: #cef;
}
div.forumObs {
color: #bbb;
}
#capabilitySummary {
text-align: center;
}
#capabilitySummary td {
padding-left: 3ex;
padding-right: 3ex;
| > > > > > > > > > > > > > > > > > > > > | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 |
div.forumSel {
background-color: #cef;
}
div.forumObs {
color: #bbb;
}
div.setup_forum-column {
display: flex;
flex-direction: column;
}
body.cpage-setup_forum > .content table {
margin-bottom: 1em;
}
body.cpage-setup_forum > .content table.bordered {
border: 1px solid;
border-radius: 0.25em;
}
body.cpage-setup_forum > .content table td,
body.cpage-setup_forum > .content table th {
text-align: left;
}
body.cpage-setup_forum table.forum-settings-list > tbody > tr > td {
min-width: 2em;
}
#capabilitySummary {
text-align: center;
}
#capabilitySummary td {
padding-left: 3ex;
padding-right: 3ex;
|
| ︙ | ︙ |
Changes to src/forum.c.
| ︙ | ︙ | |||
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 |
@ <input type="submit" name="submit" value="Submit">
}
}
forum_render_debug_options();
@ </form>
forum_emit_js();
forumpost_emit_closed_state(fpid, iClosed);
style_finish_page();
}
/*
** WEBPAGE: forummain
** WEBPAGE: forum
**
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 |
@ <input type="submit" name="submit" value="Submit">
}
}
forum_render_debug_options();
@ </form>
forum_emit_js();
forumpost_emit_closed_state(fpid, iClosed);
style_finish_page();
}
/*
** WEBPAGE: setup_forum
**
** Forum configuration and metrics.
*/
void forum_setup(void){
/* boolean config settings specific to the forum. */
const char * zSettingsBool[] = {
"forum-close-policy",
NULL /* sentinel entry */
};
login_check_credentials();
if( !g.perm.Setup ){
login_needed(g.anon.Setup);
return;
}
style_set_current_feature("forum");
style_header("Forum Setup");
@ <h2>Metrics</h2>
{
int nPosts = db_int(0, "SELECT COUNT(*) FROM event WHERE type='f'");
@ <p><a href='%R/forum'>Forum posts</a>:
@ <a href='%R/timeline?y=f'>%d(nPosts)</a></p>
}
@ <h2>Supervisors</h2>
@ <p>Users with capabilities 's', 'a', or '6'.</p>
{
Stmt q = empty_Stmt;
int nRows = 0;
db_prepare(&q, "SELECT uid, login, cap FROM user "
"WHERE cap GLOB '*[as6]*' ORDER BY login");
@ <table class='bordered'>
@ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
@ <tbody>
while( SQLITE_ROW==db_step(&q) ){
const int iUid = db_column_int(&q, 0);
const char *zUser = db_column_text(&q, 1);
const char *zCap = db_column_text(&q, 2);
++nRows;
@ <tr>
@ <td><a href='%R/setup_uedit?id=%d(iUid)'>%h(zUser)</a></td>
@ <td>(%h(zCap))</td>
@ </tr>
}
db_finalize(&q);
@</tbody></table>
if( 0==nRows ){
@ No supervisors
}else{
@ %d(nRows) supervisor(s)
}
}
@ <h2>Moderators</h2>
@ <p>Users with capability '5'.</p>
{
Stmt q = empty_Stmt;
int nRows = 0;
db_prepare(&q, "SELECT uid, login, cap FROM user "
"WHERE cap GLOB '*5*' ORDER BY login");
@ <table class='bordered'>
@ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
@ <tbody>
while( SQLITE_ROW==db_step(&q) ){
const int iUid = db_column_int(&q, 0);
const char *zUser = db_column_text(&q, 1);
const char *zCap = db_column_text(&q, 2);
++nRows;
@ <tr>
@ <td><a href='%R/setup_uedit?id=%d(iUid)'>%h(zUser)</a></td>
@ <td>(%h(zCap))</td>
@ </tr>
}
db_finalize(&q);
@ </tbody></table>
if( 0==nRows ){
@ No non-supervisor moderators
}else{
@ %d(nRows) moderator(s)
}
}
@ <h2>Settings</h2>
@ <p>Configuration settings specific to the forum.</p>
if( P("submit") && cgi_csrf_safe(1) ){
int i = 0;
const char *zSetting;
login_verify_csrf_secret();
db_begin_transaction();
while( (zSetting = zSettingsBool[i++]) ){
const char *z = P(zSetting);
if( !z || !z[0] ) z = "off";
db_set(zSetting/*works-like:"x"*/, z, 0);
}
db_end_transaction(0);
@ <p><em>Settings saved.</em></p>
}
{
int i = 0;
const char *zSetting;
@ <form action="%R/setup_forum" method="post">
login_insert_csrf_secret();
@ <table class='forum-settings-list'><tbody>
while( (zSetting = zSettingsBool[i++]) ){
@ <tr><td>
onoff_attribute("", zSetting, zSetting/*works-like:"x"*/, 0, 0);
@ </td><td>
@ <a href='%R/help?cmd=%h(zSetting)'>%h(zSetting)</a>
@ </td></tr>
}
@ </tbody></table>
@ <input type='submit' name='submit' value='Apply changes'>
@ </form>
}
style_finish_page();
}
/*
** WEBPAGE: forummain
** WEBPAGE: forum
**
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("Wiki", "setup_wiki",
"Configure the wiki for this repository");
setup_menu_entry("Interwiki Map", "intermap",
"Mapping keywords for interwiki links");
setup_menu_entry("Chat", "setup_chat",
"Configure the chatroom");
}
setup_menu_entry("Search","srchsetup",
"Configure the built-in search engine");
setup_menu_entry("URL Aliases", "waliassetup",
"Configure URL aliases");
if( setup_user ){
setup_menu_entry("Notification", "setup_notification",
| > > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("Wiki", "setup_wiki",
"Configure the wiki for this repository");
setup_menu_entry("Interwiki Map", "intermap",
"Mapping keywords for interwiki links");
setup_menu_entry("Chat", "setup_chat",
"Configure the chatroom");
setup_menu_entry("Forum", "setup_forum",
"Forum config and metrics");
}
setup_menu_entry("Search","srchsetup",
"Configure the built-in search engine");
setup_menu_entry("URL Aliases", "waliassetup",
"Configure URL aliases");
if( setup_user ){
setup_menu_entry("Notification", "setup_notification",
|
| ︙ | ︙ |