Fossil SCM
On the forum post reply page, add a link back to the original post and its source view, as discussed in [forum:/forumpost/cf716a7ff8 | forum post cf716a7ff8]. Changed the forum post link/source links to use %!S instead of %S to determine the links' hash lengths.
Commit
62f0ce8374f8a0b254ceab2f1c2700d31aeabe392c9d9a48fd8a7b5092a5bc5b
Parent
ba9e50de58b64e9…
1 file changed
+8
-4
+8
-4
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -546,16 +546,16 @@ | ||
| 546 | 546 | @ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a> |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /* Provide a link to select the individual post. */ |
| 550 | 550 | if( !bSelect ){ |
| 551 | - @ %z(href("%R/forumpost/%S?%s",p->zUuid,zQuery))[link]</a> | |
| 551 | + @ %z(href("%R/forumpost/%!S?%s",p->zUuid,zQuery))[link]</a> | |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | /* Provide a link to the raw source code. */ |
| 555 | 555 | if( !bUnf ){ |
| 556 | - @ %z(href("%R/forumpost/%S?raw",p->zUuid))[source]</a> | |
| 556 | + @ %z(href("%R/forumpost/%!S?raw",p->zUuid))[source]</a> | |
| 557 | 557 | } |
| 558 | 558 | @ </h3> |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | /* Check if this post is approved, also if it's by the current user. */ |
| @@ -1173,19 +1173,20 @@ | ||
| 1173 | 1173 | Manifest *pRootPost = 0; |
| 1174 | 1174 | const char *zMimetype = 0; |
| 1175 | 1175 | const char *zContent = 0; |
| 1176 | 1176 | const char *zTitle = 0; |
| 1177 | 1177 | char *zDate = 0; |
| 1178 | + const char *zFpid = PD("fpid",""); | |
| 1178 | 1179 | int isCsrfSafe; |
| 1179 | 1180 | int isDelete = 0; |
| 1180 | 1181 | |
| 1181 | 1182 | login_check_credentials(); |
| 1182 | 1183 | if( !g.perm.WrForum ){ |
| 1183 | 1184 | login_needed(g.anon.WrForum); |
| 1184 | 1185 | return; |
| 1185 | 1186 | } |
| 1186 | - fpid = symbolic_name_to_rid(PD("fpid",""), "f"); | |
| 1187 | + fpid = symbolic_name_to_rid(zFpid, "f"); | |
| 1187 | 1188 | if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ |
| 1188 | 1189 | webpage_error("Missing or invalid fpid query parameter"); |
| 1189 | 1190 | } |
| 1190 | 1191 | froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); |
| 1191 | 1192 | if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){ |
| @@ -1296,11 +1297,14 @@ | ||
| 1296 | 1297 | zContent = PDT("content",""); |
| 1297 | 1298 | style_header("Reply"); |
| 1298 | 1299 | if( pRootPost->zThreadTitle ){ |
| 1299 | 1300 | @ <h1>Thread: %h(pRootPost->zThreadTitle)</h1> |
| 1300 | 1301 | } |
| 1301 | - @ <h2>Replying To:</h2> | |
| 1302 | + @ <h2>Replying To: | |
| 1303 | + @ <a href="%R/forumpost/%!S(zFpid)" target="_blank">%S(zFpid)</a> | |
| 1304 | + @ <a href="%R/forumpost/%!S(zFpid)?raw" target="_blank">[source]</a> | |
| 1305 | + @ </h2> | |
| 1302 | 1306 | zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", pPost->rDate); |
| 1303 | 1307 | zDisplayName = display_name_from_login(pPost->zUser); |
| 1304 | 1308 | @ <h3 class='forumPostHdr'>By %s(zDisplayName) on %h(zDate)</h3> |
| 1305 | 1309 | fossil_free(zDisplayName); |
| 1306 | 1310 | fossil_free(zDate); |
| 1307 | 1311 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -546,16 +546,16 @@ | |
| 546 | @ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a> |
| 547 | } |
| 548 | |
| 549 | /* Provide a link to select the individual post. */ |
| 550 | if( !bSelect ){ |
| 551 | @ %z(href("%R/forumpost/%S?%s",p->zUuid,zQuery))[link]</a> |
| 552 | } |
| 553 | |
| 554 | /* Provide a link to the raw source code. */ |
| 555 | if( !bUnf ){ |
| 556 | @ %z(href("%R/forumpost/%S?raw",p->zUuid))[source]</a> |
| 557 | } |
| 558 | @ </h3> |
| 559 | } |
| 560 | |
| 561 | /* Check if this post is approved, also if it's by the current user. */ |
| @@ -1173,19 +1173,20 @@ | |
| 1173 | Manifest *pRootPost = 0; |
| 1174 | const char *zMimetype = 0; |
| 1175 | const char *zContent = 0; |
| 1176 | const char *zTitle = 0; |
| 1177 | char *zDate = 0; |
| 1178 | int isCsrfSafe; |
| 1179 | int isDelete = 0; |
| 1180 | |
| 1181 | login_check_credentials(); |
| 1182 | if( !g.perm.WrForum ){ |
| 1183 | login_needed(g.anon.WrForum); |
| 1184 | return; |
| 1185 | } |
| 1186 | fpid = symbolic_name_to_rid(PD("fpid",""), "f"); |
| 1187 | if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ |
| 1188 | webpage_error("Missing or invalid fpid query parameter"); |
| 1189 | } |
| 1190 | froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); |
| 1191 | if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){ |
| @@ -1296,11 +1297,14 @@ | |
| 1296 | zContent = PDT("content",""); |
| 1297 | style_header("Reply"); |
| 1298 | if( pRootPost->zThreadTitle ){ |
| 1299 | @ <h1>Thread: %h(pRootPost->zThreadTitle)</h1> |
| 1300 | } |
| 1301 | @ <h2>Replying To:</h2> |
| 1302 | zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", pPost->rDate); |
| 1303 | zDisplayName = display_name_from_login(pPost->zUser); |
| 1304 | @ <h3 class='forumPostHdr'>By %s(zDisplayName) on %h(zDate)</h3> |
| 1305 | fossil_free(zDisplayName); |
| 1306 | fossil_free(zDate); |
| 1307 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -546,16 +546,16 @@ | |
| 546 | @ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a> |
| 547 | } |
| 548 | |
| 549 | /* Provide a link to select the individual post. */ |
| 550 | if( !bSelect ){ |
| 551 | @ %z(href("%R/forumpost/%!S?%s",p->zUuid,zQuery))[link]</a> |
| 552 | } |
| 553 | |
| 554 | /* Provide a link to the raw source code. */ |
| 555 | if( !bUnf ){ |
| 556 | @ %z(href("%R/forumpost/%!S?raw",p->zUuid))[source]</a> |
| 557 | } |
| 558 | @ </h3> |
| 559 | } |
| 560 | |
| 561 | /* Check if this post is approved, also if it's by the current user. */ |
| @@ -1173,19 +1173,20 @@ | |
| 1173 | Manifest *pRootPost = 0; |
| 1174 | const char *zMimetype = 0; |
| 1175 | const char *zContent = 0; |
| 1176 | const char *zTitle = 0; |
| 1177 | char *zDate = 0; |
| 1178 | const char *zFpid = PD("fpid",""); |
| 1179 | int isCsrfSafe; |
| 1180 | int isDelete = 0; |
| 1181 | |
| 1182 | login_check_credentials(); |
| 1183 | if( !g.perm.WrForum ){ |
| 1184 | login_needed(g.anon.WrForum); |
| 1185 | return; |
| 1186 | } |
| 1187 | fpid = symbolic_name_to_rid(zFpid, "f"); |
| 1188 | if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ |
| 1189 | webpage_error("Missing or invalid fpid query parameter"); |
| 1190 | } |
| 1191 | froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); |
| 1192 | if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){ |
| @@ -1296,11 +1297,14 @@ | |
| 1297 | zContent = PDT("content",""); |
| 1298 | style_header("Reply"); |
| 1299 | if( pRootPost->zThreadTitle ){ |
| 1300 | @ <h1>Thread: %h(pRootPost->zThreadTitle)</h1> |
| 1301 | } |
| 1302 | @ <h2>Replying To: |
| 1303 | @ <a href="%R/forumpost/%!S(zFpid)" target="_blank">%S(zFpid)</a> |
| 1304 | @ <a href="%R/forumpost/%!S(zFpid)?raw" target="_blank">[source]</a> |
| 1305 | @ </h2> |
| 1306 | zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", pPost->rDate); |
| 1307 | zDisplayName = display_name_from_login(pPost->zUser); |
| 1308 | @ <h3 class='forumPostHdr'>By %s(zDisplayName) on %h(zDate)</h3> |
| 1309 | fossil_free(zDisplayName); |
| 1310 | fossil_free(zDate); |
| 1311 |