Fossil SCM

Make forum posts visible to object_description(). Add new diagnostics visible to users with the new "D" capability.

drh 2018-07-25 13:48 forum-v2
Commit 2883fb80cf155f493a111d7e57b4963665b0c49d7aa316793941956469860f70
--- src/default_css.txt
+++ src/default_css.txt
@@ -672,5 +672,9 @@
672672
}
673673
td.form_label {
674674
vertical-align: top;
675675
text-align: right;
676676
}
677
+.debug {
678
+ background-color: #ffc;
679
+ border: 2px solid #ff0;
680
+}
677681
--- src/default_css.txt
+++ src/default_css.txt
@@ -672,5 +672,9 @@
672 }
673 td.form_label {
674 vertical-align: top;
675 text-align: right;
676 }
 
 
 
 
677
--- src/default_css.txt
+++ src/default_css.txt
@@ -672,5 +672,9 @@
672 }
673 td.form_label {
674 vertical-align: top;
675 text-align: right;
676 }
677 .debug {
678 background-color: #ffc;
679 border: 2px solid #ff0;
680 }
681
+21 -12
--- src/forum.c
+++ src/forum.c
@@ -55,16 +55,20 @@
5555
}
5656
i++;
5757
if( pPost->zThreadTitle ){
5858
@ <h1>%h(pPost->zThreadTitle)</h1>
5959
}
60
- @ <p>By %h(pPost->zUser) on %h(zDate)
60
+ @ <p>By %h(pPost->zUser) on %h(zDate) (%d(fpid))
6161
if( fprev ){
62
- @ edit of %d(fprev) %h(pPost->azParent[0])
62
+ @ edit of %d(fprev)
6363
}
6464
if( firt ){
65
- @ in reply to %d(firt) %h(pPost->zInReplyTo)
65
+ @ reply to %d(firt)
66
+ }
67
+ if( g.perm.Debug ){
68
+ @ <span class="debug">\
69
+ @ <a href="%R/artifact/%h(zUuid)">raw artifact</a></span>
6670
}
6771
forum_render(pPost->zMimetype, pPost->zWiki);
6872
if( g.perm.WrForum ){
6973
int sameUser = login_is_individual()
7074
&& fossil_strcmp(pPost->zUser, g.zLogin)==0;
@@ -232,15 +236,12 @@
232236
@ rows="25" wrap="virtual">%h(zContent)</textarea><br>
233237
}
234238
235239
/*
236240
** WEBPAGE: forumnew
237
-** WEBPAGE: test-forumnew
238241
**
239
-** Start a new forum thread. The /test-forumnew works just like
240
-** /forumnew except that it provides additional controls for testing
241
-** and debugging.
242
+** Start a new forum thread.
242243
*/
243244
void forumnew_page(void){
244245
const char *zTitle = PDT("title","");
245246
const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
246247
const char *zContent = PDT("content","");
@@ -264,16 +265,18 @@
264265
if( P("preview") ){
265266
@ <input type="submit" name="submit" value="Submit">
266267
}else{
267268
@ <input type="submit" name="submit" value="Submit" disabled>
268269
}
269
- if( g.zPath[0]=='t' ){
270
+ if( g.perm.Debug ){
270271
/* For the test-forumnew page add these extra debugging controls */
271
- @ <br><label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \
272
+ @ <div class="debug">
273
+ @ <label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \
272274
@ Dry run</label>
273275
@ <br><label><input type="checkbox" name="domod" %s(PCK("domod"))> \
274276
@ Require moderator approval</label>
277
+ @ </div>
275278
}
276279
@ </form>
277280
style_footer();
278281
}
279282
@@ -360,13 +363,19 @@
360363
@ <input type="hidden" name="reply" value="1">
361364
forum_entry_widget(0, zMimetype, zContent);
362365
@ <input type="submit" name="preview" value="Preview">
363366
if( P("preview") ){
364367
@ <input type="submit" name="submit" value="Submit">
365
- if( g.perm.Setup ){
366
- @ <input type="submit" name="submitdryrun" value="Dry Run">
367
- }
368
+ }
369
+ if( g.perm.Debug ){
370
+ /* For the test-forumnew page add these extra debugging controls */
371
+ @ <div class="debug">
372
+ @ <label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \
373
+ @ Dry run</label>
374
+ @ <br><label><input type="checkbox" name="domod" %s(PCK("domod"))> \
375
+ @ Require moderator approval</label>
376
+ @ </div>
368377
}
369378
@ </form>
370379
}
371380
style_footer();
372381
}
373382
--- src/forum.c
+++ src/forum.c
@@ -55,16 +55,20 @@
55 }
56 i++;
57 if( pPost->zThreadTitle ){
58 @ <h1>%h(pPost->zThreadTitle)</h1>
59 }
60 @ <p>By %h(pPost->zUser) on %h(zDate)
61 if( fprev ){
62 @ edit of %d(fprev) %h(pPost->azParent[0])
63 }
64 if( firt ){
65 @ in reply to %d(firt) %h(pPost->zInReplyTo)
 
 
 
 
66 }
67 forum_render(pPost->zMimetype, pPost->zWiki);
68 if( g.perm.WrForum ){
69 int sameUser = login_is_individual()
70 && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@@ -232,15 +236,12 @@
232 @ rows="25" wrap="virtual">%h(zContent)</textarea><br>
233 }
234
235 /*
236 ** WEBPAGE: forumnew
237 ** WEBPAGE: test-forumnew
238 **
239 ** Start a new forum thread. The /test-forumnew works just like
240 ** /forumnew except that it provides additional controls for testing
241 ** and debugging.
242 */
243 void forumnew_page(void){
244 const char *zTitle = PDT("title","");
245 const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
246 const char *zContent = PDT("content","");
@@ -264,16 +265,18 @@
264 if( P("preview") ){
265 @ <input type="submit" name="submit" value="Submit">
266 }else{
267 @ <input type="submit" name="submit" value="Submit" disabled>
268 }
269 if( g.zPath[0]=='t' ){
270 /* For the test-forumnew page add these extra debugging controls */
271 @ <br><label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \
 
272 @ Dry run</label>
273 @ <br><label><input type="checkbox" name="domod" %s(PCK("domod"))> \
274 @ Require moderator approval</label>
 
275 }
276 @ </form>
277 style_footer();
278 }
279
@@ -360,13 +363,19 @@
360 @ <input type="hidden" name="reply" value="1">
361 forum_entry_widget(0, zMimetype, zContent);
362 @ <input type="submit" name="preview" value="Preview">
363 if( P("preview") ){
364 @ <input type="submit" name="submit" value="Submit">
365 if( g.perm.Setup ){
366 @ <input type="submit" name="submitdryrun" value="Dry Run">
367 }
 
 
 
 
 
 
368 }
369 @ </form>
370 }
371 style_footer();
372 }
373
--- src/forum.c
+++ src/forum.c
@@ -55,16 +55,20 @@
55 }
56 i++;
57 if( pPost->zThreadTitle ){
58 @ <h1>%h(pPost->zThreadTitle)</h1>
59 }
60 @ <p>By %h(pPost->zUser) on %h(zDate) (%d(fpid))
61 if( fprev ){
62 @ edit of %d(fprev)
63 }
64 if( firt ){
65 @ reply to %d(firt)
66 }
67 if( g.perm.Debug ){
68 @ <span class="debug">\
69 @ <a href="%R/artifact/%h(zUuid)">raw artifact</a></span>
70 }
71 forum_render(pPost->zMimetype, pPost->zWiki);
72 if( g.perm.WrForum ){
73 int sameUser = login_is_individual()
74 && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@@ -232,15 +236,12 @@
236 @ rows="25" wrap="virtual">%h(zContent)</textarea><br>
237 }
238
239 /*
240 ** WEBPAGE: forumnew
 
241 **
242 ** Start a new forum thread.
 
 
243 */
244 void forumnew_page(void){
245 const char *zTitle = PDT("title","");
246 const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
247 const char *zContent = PDT("content","");
@@ -264,16 +265,18 @@
265 if( P("preview") ){
266 @ <input type="submit" name="submit" value="Submit">
267 }else{
268 @ <input type="submit" name="submit" value="Submit" disabled>
269 }
270 if( g.perm.Debug ){
271 /* For the test-forumnew page add these extra debugging controls */
272 @ <div class="debug">
273 @ <label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \
274 @ Dry run</label>
275 @ <br><label><input type="checkbox" name="domod" %s(PCK("domod"))> \
276 @ Require moderator approval</label>
277 @ </div>
278 }
279 @ </form>
280 style_footer();
281 }
282
@@ -360,13 +363,19 @@
363 @ <input type="hidden" name="reply" value="1">
364 forum_entry_widget(0, zMimetype, zContent);
365 @ <input type="submit" name="preview" value="Preview">
366 if( P("preview") ){
367 @ <input type="submit" name="submit" value="Submit">
368 }
369 if( g.perm.Debug ){
370 /* For the test-forumnew page add these extra debugging controls */
371 @ <div class="debug">
372 @ <label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \
373 @ Dry run</label>
374 @ <br><label><input type="checkbox" name="domod" %s(PCK("domod"))> \
375 @ Require moderator approval</label>
376 @ </div>
377 }
378 @ </form>
379 }
380 style_footer();
381 }
382
+4
--- src/info.c
+++ src/info.c
@@ -1231,10 +1231,11 @@
12311231
#define OBJTYPE_ATTACHMENT 0x0010
12321232
#define OBJTYPE_EVENT 0x0020
12331233
#define OBJTYPE_TAG 0x0040
12341234
#define OBJTYPE_SYMLINK 0x0080
12351235
#define OBJTYPE_EXE 0x0100
1236
+#define OBJTYPE_FORUM 0x0200
12361237
12371238
/*
12381239
** Possible flags for the second parameter to
12391240
** object_description()
12401241
*/
@@ -1423,10 +1424,13 @@
14231424
objType |= OBJTYPE_EVENT;
14241425
hyperlink_to_event_tagid(db_column_int(&q, 5));
14251426
}else{
14261427
@ Attachment to technote
14271428
}
1429
+ }else if( zType[0]=='f' ){
1430
+ objType |= OBJTYPE_FORUM;
1431
+ @ Forum post
14281432
}else{
14291433
@ Tag referencing
14301434
}
14311435
if( zType[0]!='e' || eventTagId == 0){
14321436
hyperlink_to_uuid(zUuid);
14331437
--- src/info.c
+++ src/info.c
@@ -1231,10 +1231,11 @@
1231 #define OBJTYPE_ATTACHMENT 0x0010
1232 #define OBJTYPE_EVENT 0x0020
1233 #define OBJTYPE_TAG 0x0040
1234 #define OBJTYPE_SYMLINK 0x0080
1235 #define OBJTYPE_EXE 0x0100
 
1236
1237 /*
1238 ** Possible flags for the second parameter to
1239 ** object_description()
1240 */
@@ -1423,10 +1424,13 @@
1423 objType |= OBJTYPE_EVENT;
1424 hyperlink_to_event_tagid(db_column_int(&q, 5));
1425 }else{
1426 @ Attachment to technote
1427 }
 
 
 
1428 }else{
1429 @ Tag referencing
1430 }
1431 if( zType[0]!='e' || eventTagId == 0){
1432 hyperlink_to_uuid(zUuid);
1433
--- src/info.c
+++ src/info.c
@@ -1231,10 +1231,11 @@
1231 #define OBJTYPE_ATTACHMENT 0x0010
1232 #define OBJTYPE_EVENT 0x0020
1233 #define OBJTYPE_TAG 0x0040
1234 #define OBJTYPE_SYMLINK 0x0080
1235 #define OBJTYPE_EXE 0x0100
1236 #define OBJTYPE_FORUM 0x0200
1237
1238 /*
1239 ** Possible flags for the second parameter to
1240 ** object_description()
1241 */
@@ -1423,10 +1424,13 @@
1424 objType |= OBJTYPE_EVENT;
1425 hyperlink_to_event_tagid(db_column_int(&q, 5));
1426 }else{
1427 @ Attachment to technote
1428 }
1429 }else if( zType[0]=='f' ){
1430 objType |= OBJTYPE_FORUM;
1431 @ Forum post
1432 }else{
1433 @ Tag referencing
1434 }
1435 if( zType[0]!='e' || eventTagId == 0){
1436 hyperlink_to_uuid(zUuid);
1437

Keyboard Shortcuts

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