| | @@ -2038,11 +2038,10 @@ |
| 2038 | 2038 | */ |
| 2039 | 2039 | void forumnew_page(void){ |
| 2040 | 2040 | const char *zTitle = PDT("title",""); |
| 2041 | 2041 | const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 2042 | 2042 | const char *zContent = PDT("content",""); |
| 2043 | | - const int bNoJs = PB("nojs"); /* True for legacy HTML form */ |
| 2044 | 2043 | |
| 2045 | 2044 | login_check_credentials(); |
| 2046 | 2045 | if( !g.perm.WrForum ){ |
| 2047 | 2046 | login_needed(g.anon.WrForum); |
| 2048 | 2047 | return; |
| | @@ -2056,38 +2055,32 @@ |
| 2056 | 2055 | forum_render(zTitle, zMimetype, zContent, "forumEdit", 1); |
| 2057 | 2056 | } |
| 2058 | 2057 | style_set_current_feature("forum"); |
| 2059 | 2058 | style_header("New Forum Thread"); |
| 2060 | 2059 | |
| 2061 | | - if( !bNoJs ){ |
| 2062 | | - @ <noscript> |
| 2063 | | - } |
| 2064 | | - @ <form action="%R/forume1" method="POST"> |
| 2060 | + @ <form action="%R/forume1" method="POST" \ |
| 2061 | + @ class="remove-if-replaced"> |
| 2065 | 2062 | @ <h1>New Thread:</h1> |
| 2066 | 2063 | forum_from_line(); |
| 2067 | 2064 | forum_post_widget(zTitle, zMimetype, zContent); |
| 2068 | 2065 | @ <input type="submit" name="preview" value="Preview"> |
| 2069 | | - @ <input type="hidden" name="legacy" value="1"> |
| 2070 | 2066 | if( P("preview") && !fossil_all_whitespace(zContent) ){ |
| 2071 | 2067 | @ <input type="submit" name="submit" value="Submit"> |
| 2072 | 2068 | }else{ |
| 2073 | 2069 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 2074 | 2070 | } |
| 2075 | 2071 | forum_render_debug_options(); |
| 2076 | 2072 | login_insert_csrf_secret(); |
| 2077 | 2073 | @ </form> |
| 2074 | + /* When JS is disabled the block above will work. When it's |
| 2075 | + enabled, the above will be removed and JS will render the editor |
| 2076 | + form in the next element. */ |
| 2077 | + @ <div hidden id='forumnew-placeholder'> |
| 2078 | + @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2079 | + login_insert_csrf_secret(); |
| 2080 | + @ </div> |
| 2078 | 2081 | forum_render_attachment_notice(); |
| 2079 | | - if( !bNoJs ){ |
| 2080 | | - @ </noscript> |
| 2081 | | - /* When JS is disabled the block above will work. |
| 2082 | | - When it's enabled, the above won't do anything and |
| 2083 | | - JS will render the editor form in the next element. */ |
| 2084 | | - @ <div hidden id='forumnew-placeholder'> |
| 2085 | | - @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2086 | | - login_insert_csrf_secret(); |
| 2087 | | - @ </div> |
| 2088 | | - } |
| 2089 | 2082 | forum_emit_js(); |
| 2090 | 2083 | style_finish_page(); |
| 2091 | 2084 | } |
| 2092 | 2085 | |
| 2093 | 2086 | /* |
| | @@ -2106,11 +2099,10 @@ |
| 2106 | 2099 | const char *zMimetype = 0; |
| 2107 | 2100 | const char *zContent = 0; |
| 2108 | 2101 | const char *zTitle = 0; |
| 2109 | 2102 | char *zDate = 0; |
| 2110 | 2103 | const char *zFpid = PD("fpid",""); |
| 2111 | | - const int bNoJs = PB("nojs"); |
| 2112 | 2104 | int isCsrfSafe; |
| 2113 | 2105 | int isDelete = 0; |
| 2114 | 2106 | int iClosed = 0; |
| 2115 | 2107 | int bSameUser; /* True if author is also the reader */ |
| 2116 | 2108 | int bPreview; /* True in preview mode. */ |
| | @@ -2174,14 +2166,10 @@ |
| 2174 | 2166 | cgi_redirectf("%R/forum"); |
| 2175 | 2167 | } |
| 2176 | 2168 | return; |
| 2177 | 2169 | } |
| 2178 | 2170 | } |
| 2179 | | - if( !bNoJs ){ |
| 2180 | | - forumedit_page_v2(); |
| 2181 | | - return; |
| 2182 | | - } |
| 2183 | 2171 | style_set_current_feature("forum"); |
| 2184 | 2172 | isDelete = P("nullout")!=0; |
| 2185 | 2173 | if( P("submit") |
| 2186 | 2174 | && isCsrfSafe |
| 2187 | 2175 | && (zContent = PDT("content",""))!=0 |
| | @@ -2208,11 +2196,11 @@ |
| 2208 | 2196 | @ <h1>Original Post:</h1> |
| 2209 | 2197 | forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki, |
| 2210 | 2198 | "forumEdit", 1); |
| 2211 | 2199 | @ <h1>Change Into:</h1> |
| 2212 | 2200 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); |
| 2213 | | - @ <form action="%R/forume2" method="POST"> |
| 2201 | + @ <form action="%R/forume2" method="POST" class="remove-on-load"> |
| 2214 | 2202 | login_insert_csrf_secret(); |
| 2215 | 2203 | @ <input type="hidden" name="fpid" value="%h(P("fpid"))"> |
| 2216 | 2204 | @ <input type="hidden" name="nullout" value="1"> |
| 2217 | 2205 | @ <input type="hidden" name="mimetype" value="%h(zMimetype)"> |
| 2218 | 2206 | @ <input type="hidden" name="content" value="%h(zContent)"> |
| | @@ -2236,11 +2224,11 @@ |
| 2236 | 2224 | if( bPreview ){ |
| 2237 | 2225 | @ <h2>Preview of Edited Post:</h2> |
| 2238 | 2226 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); |
| 2239 | 2227 | } |
| 2240 | 2228 | @ <h2>Revised Message:</h2> |
| 2241 | | - @ <form action="%R/forume2" method="POST"> |
| 2229 | + @ <form action="%R/forume2" method="POST" class="remove-on-load"> |
| 2242 | 2230 | login_insert_csrf_secret(); |
| 2243 | 2231 | @ <input type="hidden" name="fpid" value="%h(P("fpid"))"> |
| 2244 | 2232 | @ <input type="hidden" name="edit" value="1"> |
| 2245 | 2233 | forum_from_line(); |
| 2246 | 2234 | forum_post_widget(zTitle, zMimetype, zContent); |
| | @@ -2291,37 +2279,10 @@ |
| 2291 | 2279 | forum_render_attachment_list(rid_to_uuid(fpid)); |
| 2292 | 2280 | } |
| 2293 | 2281 | forum_render_attachment_notice(); |
| 2294 | 2282 | forum_emit_js(); |
| 2295 | 2283 | style_finish_page(); |
| 2296 | | -} |
| 2297 | | - |
| 2298 | | -/* |
| 2299 | | -** WEBPAGE: forume2_v2 hidden |
| 2300 | | -** |
| 2301 | | -** A work in progress. |
| 2302 | | -*/ |
| 2303 | | -void forumedit_page_v2(void){ |
| 2304 | | - const char *zFpid = PD("fpid",""); |
| 2305 | | - |
| 2306 | | - login_check_credentials(); |
| 2307 | | - if( !g.perm.WrForum ){ |
| 2308 | | - login_needed(g.anon.WrForum); |
| 2309 | | - return; |
| 2310 | | - } |
| 2311 | | - style_set_current_feature("forum"); |
| 2312 | | - style_header("Edit Forum Post"); |
| 2313 | | - (void)zFpid; |
| 2314 | | - @ <div hidden id='forumedit-placeholder'> |
| 2315 | | -#if 0 |
| 2316 | | - @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2317 | | -#endif |
| 2318 | | - login_insert_csrf_secret(); |
| 2319 | | - @ </div> |
| 2320 | | - forum_emit_js(); |
| 2321 | | - style_finish_page(); |
| 2322 | | - |
| 2323 | 2284 | } |
| 2324 | 2285 | |
| 2325 | 2286 | /* |
| 2326 | 2287 | ** SETTING: forum-close-policy boolean default=off |
| 2327 | 2288 | ** If true, forum moderators may close/re-open forum posts, and reply |
| 2328 | 2289 | |