Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Futher viewing enhancements for larger forum posts. The default CSS now limits the maximum height to 25em (because that amount fits nicely on a single screen on an iPhone) and all messages have a "source" link which shows the fully expanded text without scrollbars. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
46dd6963027259f1ee479a022ebb91f7 |
| User & Date: | drh 2020-04-06 15:44:58.894 |
Context
|
2020-04-06
| ||
| 15:54 | Prevent ridicuously wide forum posts display with the "vfx" query parameter on /timeline. ... (check-in: da7d816201 user: drh tags: trunk) | |
| 15:44 | Futher viewing enhancements for larger forum posts. The default CSS now limits the maximum height to 25em (because that amount fits nicely on a single screen on an iPhone) and all messages have a "source" link which shows the fully expanded text without scrollbars. ... (check-in: 46dd696302 user: drh tags: trunk) | |
| 15:03 | Limit the displayed length of a forum-post to 50em using CSS. Longer posts scroll. ... (check-in: 421955cdf7 user: drh tags: trunk) | |
Changes
Changes to src/default_css.txt.
| ︙ | ︙ | |||
757 758 759 760 761 762 763 |
div.forumHier, div.forumTime {
border: 1px solid black;
padding-left: 1ex;
padding-right: 1ex;
margin-top: 1ex;
}
div.forumPostBody {
| | | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
div.forumHier, div.forumTime {
border: 1px solid black;
padding-left: 1ex;
padding-right: 1ex;
margin-top: 1ex;
}
div.forumPostBody {
max-height: 25em;
overflow: auto;
}
div.forumSel {
background-color: #cef;
}
div.forumObs {
color: #bbb;
|
| ︙ | ︙ |
Changes to src/forum.c.
| ︙ | ︙ | |||
307 308 309 310 311 312 313 | /* ** Render a forum post for display */ void forum_render( const char *zTitle, /* The title. Might be NULL for no title */ const char *zMimetype, /* Mimetype of the message */ const char *zContent, /* Content of the message */ | | > > | > > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
/*
** Render a forum post for display
*/
void forum_render(
const char *zTitle, /* The title. Might be NULL for no title */
const char *zMimetype, /* Mimetype of the message */
const char *zContent, /* Content of the message */
const char *zClass, /* Put in a <div> if not NULL */
int bScroll /* Large message content scrolls if true */
){
if( zClass ){
@ <div class='%s(zClass)'>
}
if( zTitle ){
if( zTitle[0] ){
@ <h1>%h(zTitle)</h1>
}else{
@ <h1><i>Deleted</i></h1>
}
}
if( zContent && zContent[0] ){
Blob x;
if( bScroll ){
@ <div class='forumPostBody'>
}else{
@ <div class='forumPostFullBody'>
}
blob_init(&x, 0, 0);
blob_append(&x, zContent, -1);
wiki_render_by_mimetype(&x, zMimetype);
blob_reset(&x);
@ </div>
}else{
@ <i>Deleted</i>
|
| ︙ | ︙ | |||
444 445 446 447 448 449 450 |
@ updated by %z(href("%R/forumpost/%S?t=%c",p->pLeaf->zUuid,cMode))\
@ %d(p->pLeaf->sid)</a>
zUuid = p->pLeaf->zUuid;
}
if( p->fpid!=target ){
@ %z(href("%R/forumpost/%S?t=%c",zUuid,cMode))[link]</a>
}
| | | > | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
@ updated by %z(href("%R/forumpost/%S?t=%c",p->pLeaf->zUuid,cMode))\
@ %d(p->pLeaf->sid)</a>
zUuid = p->pLeaf->zUuid;
}
if( p->fpid!=target ){
@ %z(href("%R/forumpost/%S?t=%c",zUuid,cMode))[link]</a>
}
if( !bRawMode ){
@ %z(href("%R/forumpost/%S?raw",zUuid))[source]</a>
}
isPrivate = content_is_private(p->fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@ </h3>
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, bRawMode?"text/plain":pPost->zMimetype, pPost->zWiki,
0, 1);
}
if( g.perm.WrForum && p->pLeaf==0 ){
int sameUser = login_is_individual()
&& fossil_strcmp(pPost->zUser, g.zLogin)==0;
@ <p><form action="%R/forumedit" method="POST">
@ <input type="hidden" name="fpid" value="%s(p->zUuid)">
if( !isPrivate ){
|
| ︙ | ︙ | |||
565 566 567 568 569 570 571 |
@ <a href="%R/artifact/%h(p->pLeaf->zUuid)">(artifact)</a></span>
}
manifest_destroy(pOPost);
}
if( fpid!=target ){
@ %z(href("%R/forumpost/%S",zUuid))[link]</a>
}
| < | < | | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 |
@ <a href="%R/artifact/%h(p->pLeaf->zUuid)">(artifact)</a></span>
}
manifest_destroy(pOPost);
}
if( fpid!=target ){
@ %z(href("%R/forumpost/%S",zUuid))[link]</a>
}
@ %z(href("%R/forumpost/%S?raw",zUuid))[source]</a>
if( p->firt ){
ForumEntry *pIrt = p->pPrev;
while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev;
if( pIrt ){
@ in reply to %z(href("%R/forumpost/%S?t=h",pIrt->zUuid))\
@ %d(pIrt->sid)</a>
}
}
@ </h3>
isPrivate = content_is_private(fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, pPost->zMimetype, pPost->zWiki, 0, 1);
}
if( g.perm.WrForum ){
@ <p><form action="%R/forumedit" method="POST">
@ <input type="hidden" name="fpid" value="%s(zUuid)">
if( !isPrivate ){
/* Reply and Edit are only available if the post has already
** been approved */
|
| ︙ | ︙ | |||
717 718 719 720 721 722 723 |
}else{
int isPrivate = content_is_private(fpid);
int notAnon = login_is_individual();
int sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
| | | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
}else{
int isPrivate = content_is_private(fpid);
int notAnon = login_is_individual();
int sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, "text/plain", pPost->zWiki, 0, 0);
}
manifest_destroy(pPost);
}
}else if( zMode[0]=='c' ){
style_submenu_element("Hierarchical", "%R/%s/%s?t=h", g.zPath, zName);
style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName);
forum_display_chronological(froot, fpid, 0);
|
| ︙ | ︙ | |||
949 950 951 952 953 954 955 |
return;
}
if( P("submit") ){
if( forum_post(zTitle, 0, 0, 0, zMimetype, zContent) ) return;
}
if( P("preview") ){
@ <h1>Preview:</h1>
| | | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 |
return;
}
if( P("submit") ){
if( forum_post(zTitle, 0, 0, 0, zMimetype, zContent) ) return;
}
if( P("preview") ){
@ <h1>Preview:</h1>
forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
}
style_header("New Forum Thread");
@ <form action="%R/forume1" method="POST">
@ <h1>New Thread:</h1>
forum_from_line();
forum_entry_widget(zTitle, zMimetype, zContent);
@ <input type="submit" name="preview" value="Preview">
|
| ︙ | ︙ | |||
1067 1068 1069 1070 1071 1072 1073 |
if( isDelete ){
zMimetype = "text/x-fossil-wiki";
zContent = "";
if( pPost->zThreadTitle ) zTitle = "";
style_header("Delete %s", zTitle ? "Post" : "Reply");
@ <h1>Original Post:</h1>
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
| | | | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
if( isDelete ){
zMimetype = "text/x-fossil-wiki";
zContent = "";
if( pPost->zThreadTitle ) zTitle = "";
style_header("Delete %s", zTitle ? "Post" : "Reply");
@ <h1>Original Post:</h1>
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
"forumEdit", 1);
@ <h1>Change Into:</h1>
forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
@ <form action="%R/forume2" method="POST">
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
@ <input type="hidden" name="nullout" value="1">
@ <input type="hidden" name="mimetype" value="%h(zMimetype)">
@ <input type="hidden" name="content" value="%h(zContent)">
if( zTitle ){
@ <input type="hidden" name="title" value="%h(zTitle)">
|
| ︙ | ︙ | |||
1091 1092 1093 1094 1095 1096 1097 |
if( zMimetype==0 ) zMimetype = fossil_strdup(pPost->zMimetype);
if( zTitle==0 && pPost->zThreadTitle!=0 ){
zTitle = fossil_strdup(pPost->zThreadTitle);
}
style_header("Edit %s", zTitle ? "Post" : "Reply");
@ <h2>Original Post:</h2>
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
| | | | 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
if( zMimetype==0 ) zMimetype = fossil_strdup(pPost->zMimetype);
if( zTitle==0 && pPost->zThreadTitle!=0 ){
zTitle = fossil_strdup(pPost->zThreadTitle);
}
style_header("Edit %s", zTitle ? "Post" : "Reply");
@ <h2>Original Post:</h2>
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
"forumEdit", 1);
if( P("preview") ){
@ <h2>Preview of Edited Post:</h2>
forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
}
@ <h2>Revised Message:</h2>
@ <form action="%R/forume2" method="POST">
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
@ <input type="hidden" name="edit" value="1">
forum_from_line();
forum_entry_widget(zTitle, zMimetype, zContent);
|
| ︙ | ︙ | |||
1117 1118 1119 1120 1121 1122 1123 |
}
@ <h2>Replying To:</h2>
zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
zDisplayName = display_name_from_login(pPost->zUser);
@ <h3 class='forumPostHdr'>By %h(zDisplayName) on %h(zDate)</h3>
fossil_free(zDisplayName);
fossil_free(zDate);
| | | | 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 |
}
@ <h2>Replying To:</h2>
zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
zDisplayName = display_name_from_login(pPost->zUser);
@ <h3 class='forumPostHdr'>By %h(zDisplayName) on %h(zDate)</h3>
fossil_free(zDisplayName);
fossil_free(zDate);
forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit", 1);
if( P("preview") ){
@ <h2>Preview:</h2>
forum_render(0, zMimetype,zContent, "forumEdit", 1);
}
@ <h2>Enter Reply:</h2>
@ <form action="%R/forume2" method="POST">
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
@ <input type="hidden" name="reply" value="1">
forum_from_line();
forum_entry_widget(0, zMimetype, zContent);
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
796 797 798 799 800 801 802 |
){
Manifest *pPost = manifest_get(rid, CFTYPE_FORUM, 0);
if( pPost ){
const char *zClass = "forumTimeline";
if( forum_rid_has_been_edited(rid) ){
zClass = "forumTimeline forumObs";
}
| | | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
){
Manifest *pPost = manifest_get(rid, CFTYPE_FORUM, 0);
if( pPost ){
const char *zClass = "forumTimeline";
if( forum_rid_has_been_edited(rid) ){
zClass = "forumTimeline forumObs";
}
forum_render(0, pPost->zMimetype, pPost->zWiki, zClass, 1);
manifest_destroy(pPost);
}
}
}
if( suppressCnt ){
@ <span class="timelineDisabled">... %d(suppressCnt) similar
@ event%s(suppressCnt>1?"s":"") omitted.</span>
|
| ︙ | ︙ |