Fossil SCM
/forumnew?legacy forces use of the older static form, as a way of testing that the old form remains working through this upheaval.
Commit
354e82947a76efbf55c40faaf7a4adbefdd898544db9d8812663dfeaa98d917c
Parent
218cca5e9179c6e…
1 file changed
+15
-11
+15
-11
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -1984,11 +1984,11 @@ | ||
| 1984 | 1984 | */ |
| 1985 | 1985 | void forumnew_page(void){ |
| 1986 | 1986 | const char *zTitle = PDT("title",""); |
| 1987 | 1987 | const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 1988 | 1988 | const char *zContent = PDT("content",""); |
| 1989 | - | |
| 1989 | + const int bLegacy = PB("legacy"); /* True for legacy HTML form */ | |
| 1990 | 1990 | login_check_credentials(); |
| 1991 | 1991 | if( !g.perm.WrForum ){ |
| 1992 | 1992 | login_needed(g.anon.WrForum); |
| 1993 | 1993 | return; |
| 1994 | 1994 | } |
| @@ -2001,34 +2001,38 @@ | ||
| 2001 | 2001 | forum_render(zTitle, zMimetype, zContent, "forumEdit", 1); |
| 2002 | 2002 | } |
| 2003 | 2003 | style_set_current_feature("forum"); |
| 2004 | 2004 | style_header("New Forum Thread"); |
| 2005 | 2005 | |
| 2006 | - @ <noscript> | |
| 2006 | + if( !bLegacy ){ | |
| 2007 | + @ <noscript> | |
| 2008 | + } | |
| 2007 | 2009 | @ <form action="%R/forume1" method="POST"> |
| 2008 | 2010 | @ <h1>New Thread:</h1> |
| 2009 | 2011 | forum_from_line(); |
| 2010 | 2012 | forum_post_widget(zTitle, zMimetype, zContent); |
| 2011 | 2013 | @ <input type="submit" name="preview" value="Preview"> |
| 2014 | + @ <input type="hidden" name="legacy" value="1"> | |
| 2012 | 2015 | if( P("preview") && !whitespace_only(zContent) ){ |
| 2013 | 2016 | @ <input type="submit" name="submit" value="Submit"> |
| 2014 | 2017 | }else{ |
| 2015 | 2018 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 2016 | 2019 | } |
| 2017 | 2020 | forum_render_debug_options(); |
| 2018 | 2021 | login_insert_csrf_secret(); |
| 2019 | 2022 | @ </form> |
| 2020 | 2023 | forum_render_attachment_notice(); |
| 2021 | - @ </noscript> | |
| 2022 | - /* When JS is disabled the block above will work. | |
| 2023 | - When it's enabled, the above won't do anything and | |
| 2024 | - JS will render the editor form. */ | |
| 2025 | - | |
| 2026 | - @ <div hidden id='forumnew-placeholder'> | |
| 2027 | - @ <input type='hidden' name='title' value='%h(zTitle)'> | |
| 2028 | - login_insert_csrf_secret() /* the 2026 form */; | |
| 2029 | - @ </div> | |
| 2024 | + if( !bLegacy ){ | |
| 2025 | + @ </noscript> | |
| 2026 | + /* When JS is disabled the block above will work. | |
| 2027 | + When it's enabled, the above won't do anything and | |
| 2028 | + JS will render the editor form in the next element. */ | |
| 2029 | + @ <div hidden id='forumnew-placeholder'> | |
| 2030 | + @ <input type='hidden' name='title' value='%h(zTitle)'> | |
| 2031 | + login_insert_csrf_secret(); | |
| 2032 | + @ </div> | |
| 2033 | + } | |
| 2030 | 2034 | forum_emit_js(); |
| 2031 | 2035 | style_finish_page(); |
| 2032 | 2036 | } |
| 2033 | 2037 | |
| 2034 | 2038 | /* |
| 2035 | 2039 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -1984,11 +1984,11 @@ | |
| 1984 | */ |
| 1985 | void forumnew_page(void){ |
| 1986 | const char *zTitle = PDT("title",""); |
| 1987 | const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 1988 | const char *zContent = PDT("content",""); |
| 1989 | |
| 1990 | login_check_credentials(); |
| 1991 | if( !g.perm.WrForum ){ |
| 1992 | login_needed(g.anon.WrForum); |
| 1993 | return; |
| 1994 | } |
| @@ -2001,34 +2001,38 @@ | |
| 2001 | forum_render(zTitle, zMimetype, zContent, "forumEdit", 1); |
| 2002 | } |
| 2003 | style_set_current_feature("forum"); |
| 2004 | style_header("New Forum Thread"); |
| 2005 | |
| 2006 | @ <noscript> |
| 2007 | @ <form action="%R/forume1" method="POST"> |
| 2008 | @ <h1>New Thread:</h1> |
| 2009 | forum_from_line(); |
| 2010 | forum_post_widget(zTitle, zMimetype, zContent); |
| 2011 | @ <input type="submit" name="preview" value="Preview"> |
| 2012 | if( P("preview") && !whitespace_only(zContent) ){ |
| 2013 | @ <input type="submit" name="submit" value="Submit"> |
| 2014 | }else{ |
| 2015 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 2016 | } |
| 2017 | forum_render_debug_options(); |
| 2018 | login_insert_csrf_secret(); |
| 2019 | @ </form> |
| 2020 | forum_render_attachment_notice(); |
| 2021 | @ </noscript> |
| 2022 | /* When JS is disabled the block above will work. |
| 2023 | When it's enabled, the above won't do anything and |
| 2024 | JS will render the editor form. */ |
| 2025 | |
| 2026 | @ <div hidden id='forumnew-placeholder'> |
| 2027 | @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2028 | login_insert_csrf_secret() /* the 2026 form */; |
| 2029 | @ </div> |
| 2030 | forum_emit_js(); |
| 2031 | style_finish_page(); |
| 2032 | } |
| 2033 | |
| 2034 | /* |
| 2035 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -1984,11 +1984,11 @@ | |
| 1984 | */ |
| 1985 | void forumnew_page(void){ |
| 1986 | const char *zTitle = PDT("title",""); |
| 1987 | const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 1988 | const char *zContent = PDT("content",""); |
| 1989 | const int bLegacy = PB("legacy"); /* True for legacy HTML form */ |
| 1990 | login_check_credentials(); |
| 1991 | if( !g.perm.WrForum ){ |
| 1992 | login_needed(g.anon.WrForum); |
| 1993 | return; |
| 1994 | } |
| @@ -2001,34 +2001,38 @@ | |
| 2001 | forum_render(zTitle, zMimetype, zContent, "forumEdit", 1); |
| 2002 | } |
| 2003 | style_set_current_feature("forum"); |
| 2004 | style_header("New Forum Thread"); |
| 2005 | |
| 2006 | if( !bLegacy ){ |
| 2007 | @ <noscript> |
| 2008 | } |
| 2009 | @ <form action="%R/forume1" method="POST"> |
| 2010 | @ <h1>New Thread:</h1> |
| 2011 | forum_from_line(); |
| 2012 | forum_post_widget(zTitle, zMimetype, zContent); |
| 2013 | @ <input type="submit" name="preview" value="Preview"> |
| 2014 | @ <input type="hidden" name="legacy" value="1"> |
| 2015 | if( P("preview") && !whitespace_only(zContent) ){ |
| 2016 | @ <input type="submit" name="submit" value="Submit"> |
| 2017 | }else{ |
| 2018 | @ <input type="submit" name="submit" value="Submit" disabled> |
| 2019 | } |
| 2020 | forum_render_debug_options(); |
| 2021 | login_insert_csrf_secret(); |
| 2022 | @ </form> |
| 2023 | forum_render_attachment_notice(); |
| 2024 | if( !bLegacy ){ |
| 2025 | @ </noscript> |
| 2026 | /* When JS is disabled the block above will work. |
| 2027 | When it's enabled, the above won't do anything and |
| 2028 | JS will render the editor form in the next element. */ |
| 2029 | @ <div hidden id='forumnew-placeholder'> |
| 2030 | @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2031 | login_insert_csrf_secret(); |
| 2032 | @ </div> |
| 2033 | } |
| 2034 | forum_emit_js(); |
| 2035 | style_finish_page(); |
| 2036 | } |
| 2037 | |
| 2038 | /* |
| 2039 |