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.

stephan 2021-06-11 09:27 trunk
Commit 62f0ce8374f8a0b254ceab2f1c2700d31aeabe392c9d9a48fd8a7b5092a5bc5b
1 file changed +8 -4
+8 -4
--- src/forum.c
+++ src/forum.c
@@ -546,16 +546,16 @@
546546
@ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a>
547547
}
548548
549549
/* Provide a link to select the individual post. */
550550
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>
552552
}
553553
554554
/* Provide a link to the raw source code. */
555555
if( !bUnf ){
556
- @ %z(href("%R/forumpost/%S?raw",p->zUuid))[source]</a>
556
+ @ %z(href("%R/forumpost/%!S?raw",p->zUuid))[source]</a>
557557
}
558558
@ </h3>
559559
}
560560
561561
/* Check if this post is approved, also if it's by the current user. */
@@ -1173,19 +1173,20 @@
11731173
Manifest *pRootPost = 0;
11741174
const char *zMimetype = 0;
11751175
const char *zContent = 0;
11761176
const char *zTitle = 0;
11771177
char *zDate = 0;
1178
+ const char *zFpid = PD("fpid","");
11781179
int isCsrfSafe;
11791180
int isDelete = 0;
11801181
11811182
login_check_credentials();
11821183
if( !g.perm.WrForum ){
11831184
login_needed(g.anon.WrForum);
11841185
return;
11851186
}
1186
- fpid = symbolic_name_to_rid(PD("fpid",""), "f");
1187
+ fpid = symbolic_name_to_rid(zFpid, "f");
11871188
if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){
11881189
webpage_error("Missing or invalid fpid query parameter");
11891190
}
11901191
froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid);
11911192
if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){
@@ -1296,11 +1297,14 @@
12961297
zContent = PDT("content","");
12971298
style_header("Reply");
12981299
if( pRootPost->zThreadTitle ){
12991300
@ <h1>Thread: %h(pRootPost->zThreadTitle)</h1>
13001301
}
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>
13021306
zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", pPost->rDate);
13031307
zDisplayName = display_name_from_login(pPost->zUser);
13041308
@ <h3 class='forumPostHdr'>By %s(zDisplayName) on %h(zDate)</h3>
13051309
fossil_free(zDisplayName);
13061310
fossil_free(zDate);
13071311
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button