Fossil SCM
When replying to a Forum Post or Reply, show additional information to provide additional context
Commit
c6dfb5580251648383af20f3eab81465232e8e44ed1352568285954e0ad27ec6
Parent
820d70512aaf58b…
1 file changed
+13
+13
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -833,14 +833,17 @@ | ||
| 833 | 833 | ** |
| 834 | 834 | ** fpid=X Hash of the post to be editted. REQUIRED |
| 835 | 835 | */ |
| 836 | 836 | void forumedit_page(void){ |
| 837 | 837 | int fpid; |
| 838 | + int froot; | |
| 838 | 839 | Manifest *pPost = 0; |
| 840 | + Manifest *pRootPost = 0; | |
| 839 | 841 | const char *zMimetype = 0; |
| 840 | 842 | const char *zContent = 0; |
| 841 | 843 | const char *zTitle = 0; |
| 844 | + char *zDate = 0; | |
| 842 | 845 | int isCsrfSafe; |
| 843 | 846 | int isDelete = 0; |
| 844 | 847 | |
| 845 | 848 | login_check_credentials(); |
| 846 | 849 | if( !g.perm.WrForum ){ |
| @@ -849,10 +852,14 @@ | ||
| 849 | 852 | } |
| 850 | 853 | fpid = symbolic_name_to_rid(PD("fpid",""), "f"); |
| 851 | 854 | if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ |
| 852 | 855 | webpage_error("Missing or invalid fpid query parameter"); |
| 853 | 856 | } |
| 857 | + froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); | |
| 858 | + if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){ | |
| 859 | + webpage_error("fpid does not appear to be a forum post: \"%d\"", fpid); | |
| 860 | + } | |
| 854 | 861 | if( P("cancel") ){ |
| 855 | 862 | cgi_redirectf("%R/forumpost/%S",P("fpid")); |
| 856 | 863 | return; |
| 857 | 864 | } |
| 858 | 865 | isCsrfSafe = cgi_csrf_safe(1); |
| @@ -947,10 +954,16 @@ | ||
| 947 | 954 | /* Reply */ |
| 948 | 955 | zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 949 | 956 | zContent = PDT("content",""); |
| 950 | 957 | style_header("Reply"); |
| 951 | 958 | @ <h1>Replying To:</h1> |
| 959 | + if( pRootPost->zThreadTitle ){ | |
| 960 | + @ <h3>%h(pRootPost->zThreadTitle)</h3> | |
| 961 | + } | |
| 962 | + zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate); | |
| 963 | + @ <p>%h(pPost->zThreadTitle ? "Post" : "Reply") by %h(pPost->zUser) on %h(zDate) | |
| 964 | + fossil_free(zDate); | |
| 952 | 965 | forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit"); |
| 953 | 966 | if( P("preview") ){ |
| 954 | 967 | @ <h1>Preview:</h1> |
| 955 | 968 | forum_render(0, zMimetype,zContent, "forumEdit"); |
| 956 | 969 | } |
| 957 | 970 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -833,14 +833,17 @@ | |
| 833 | ** |
| 834 | ** fpid=X Hash of the post to be editted. REQUIRED |
| 835 | */ |
| 836 | void forumedit_page(void){ |
| 837 | int fpid; |
| 838 | Manifest *pPost = 0; |
| 839 | const char *zMimetype = 0; |
| 840 | const char *zContent = 0; |
| 841 | const char *zTitle = 0; |
| 842 | int isCsrfSafe; |
| 843 | int isDelete = 0; |
| 844 | |
| 845 | login_check_credentials(); |
| 846 | if( !g.perm.WrForum ){ |
| @@ -849,10 +852,14 @@ | |
| 849 | } |
| 850 | fpid = symbolic_name_to_rid(PD("fpid",""), "f"); |
| 851 | if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ |
| 852 | webpage_error("Missing or invalid fpid query parameter"); |
| 853 | } |
| 854 | if( P("cancel") ){ |
| 855 | cgi_redirectf("%R/forumpost/%S",P("fpid")); |
| 856 | return; |
| 857 | } |
| 858 | isCsrfSafe = cgi_csrf_safe(1); |
| @@ -947,10 +954,16 @@ | |
| 947 | /* Reply */ |
| 948 | zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 949 | zContent = PDT("content",""); |
| 950 | style_header("Reply"); |
| 951 | @ <h1>Replying To:</h1> |
| 952 | forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit"); |
| 953 | if( P("preview") ){ |
| 954 | @ <h1>Preview:</h1> |
| 955 | forum_render(0, zMimetype,zContent, "forumEdit"); |
| 956 | } |
| 957 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -833,14 +833,17 @@ | |
| 833 | ** |
| 834 | ** fpid=X Hash of the post to be editted. REQUIRED |
| 835 | */ |
| 836 | void forumedit_page(void){ |
| 837 | int fpid; |
| 838 | int froot; |
| 839 | Manifest *pPost = 0; |
| 840 | Manifest *pRootPost = 0; |
| 841 | const char *zMimetype = 0; |
| 842 | const char *zContent = 0; |
| 843 | const char *zTitle = 0; |
| 844 | char *zDate = 0; |
| 845 | int isCsrfSafe; |
| 846 | int isDelete = 0; |
| 847 | |
| 848 | login_check_credentials(); |
| 849 | if( !g.perm.WrForum ){ |
| @@ -849,10 +852,14 @@ | |
| 852 | } |
| 853 | fpid = symbolic_name_to_rid(PD("fpid",""), "f"); |
| 854 | if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ |
| 855 | webpage_error("Missing or invalid fpid query parameter"); |
| 856 | } |
| 857 | froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); |
| 858 | if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){ |
| 859 | webpage_error("fpid does not appear to be a forum post: \"%d\"", fpid); |
| 860 | } |
| 861 | if( P("cancel") ){ |
| 862 | cgi_redirectf("%R/forumpost/%S",P("fpid")); |
| 863 | return; |
| 864 | } |
| 865 | isCsrfSafe = cgi_csrf_safe(1); |
| @@ -947,10 +954,16 @@ | |
| 954 | /* Reply */ |
| 955 | zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 956 | zContent = PDT("content",""); |
| 957 | style_header("Reply"); |
| 958 | @ <h1>Replying To:</h1> |
| 959 | if( pRootPost->zThreadTitle ){ |
| 960 | @ <h3>%h(pRootPost->zThreadTitle)</h3> |
| 961 | } |
| 962 | zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate); |
| 963 | @ <p>%h(pPost->zThreadTitle ? "Post" : "Reply") by %h(pPost->zUser) on %h(zDate) |
| 964 | fossil_free(zDate); |
| 965 | forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit"); |
| 966 | if( P("preview") ){ |
| 967 | @ <h1>Preview:</h1> |
| 968 | forum_render(0, zMimetype,zContent, "forumEdit"); |
| 969 | } |
| 970 |