Fossil SCM
Fix the mimetype selector. Improved styling of the forum display.
Commit
837b1cb59b580a108bc3033013cb162b1cae5c083feedc30141a6bee82c179b6
Parent
c626d1c06cfd05d…
2 files changed
+19
-6
+11
-11
+19
-6
| --- src/default_css.txt | ||
| +++ src/default_css.txt | ||
| @@ -632,28 +632,41 @@ | ||
| 632 | 632 | vertical-align: top; |
| 633 | 633 | text-align: right; |
| 634 | 634 | padding: 0.2ex 1ex; |
| 635 | 635 | } |
| 636 | 636 | table.forum_post { |
| 637 | - top-margin: 1ex; | |
| 638 | - bottom-margin: 1ex; | |
| 639 | - left-margin: 0; | |
| 640 | - right-margin: 0; | |
| 637 | + margin-top: 1ex; | |
| 638 | + margin-bottom: 1ex; | |
| 639 | + margin-left: 0; | |
| 640 | + margin-right: 0; | |
| 641 | 641 | border-spacing: 0; |
| 642 | 642 | } |
| 643 | 643 | span.forum_author { |
| 644 | 644 | color: #888; |
| 645 | + font-size: 75%; | |
| 646 | +} | |
| 647 | +span.forum_author::after { | |
| 648 | + content: " | "; | |
| 645 | 649 | } |
| 646 | 650 | span.forum_age { |
| 647 | 651 | color: #888; |
| 648 | - font-size: 75%; | |
| 652 | + font-size: 85%; | |
| 649 | 653 | } |
| 650 | 654 | span.forum_buttons { |
| 651 | - font-size: 75%; | |
| 655 | + font-size: 85%; | |
| 656 | +} | |
| 657 | +span.forum_buttons::before { | |
| 658 | + color: #888; | |
| 659 | + content: " | "; | |
| 652 | 660 | } |
| 653 | 661 | span.forum_npost { |
| 654 | 662 | color: #888; |
| 655 | 663 | font-size: 75%; |
| 656 | 664 | } |
| 657 | 665 | table.forumeditform td { |
| 658 | 666 | vertical-align: top; |
| 667 | + border-collapse: collapse; | |
| 668 | + padding: 1px; | |
| 669 | +} | |
| 670 | +div.forum_body p { | |
| 671 | + margin-top: 0; | |
| 659 | 672 | } |
| 660 | 673 |
| --- src/default_css.txt | |
| +++ src/default_css.txt | |
| @@ -632,28 +632,41 @@ | |
| 632 | vertical-align: top; |
| 633 | text-align: right; |
| 634 | padding: 0.2ex 1ex; |
| 635 | } |
| 636 | table.forum_post { |
| 637 | top-margin: 1ex; |
| 638 | bottom-margin: 1ex; |
| 639 | left-margin: 0; |
| 640 | right-margin: 0; |
| 641 | border-spacing: 0; |
| 642 | } |
| 643 | span.forum_author { |
| 644 | color: #888; |
| 645 | } |
| 646 | span.forum_age { |
| 647 | color: #888; |
| 648 | font-size: 75%; |
| 649 | } |
| 650 | span.forum_buttons { |
| 651 | font-size: 75%; |
| 652 | } |
| 653 | span.forum_npost { |
| 654 | color: #888; |
| 655 | font-size: 75%; |
| 656 | } |
| 657 | table.forumeditform td { |
| 658 | vertical-align: top; |
| 659 | } |
| 660 |
| --- src/default_css.txt | |
| +++ src/default_css.txt | |
| @@ -632,28 +632,41 @@ | |
| 632 | vertical-align: top; |
| 633 | text-align: right; |
| 634 | padding: 0.2ex 1ex; |
| 635 | } |
| 636 | table.forum_post { |
| 637 | margin-top: 1ex; |
| 638 | margin-bottom: 1ex; |
| 639 | margin-left: 0; |
| 640 | margin-right: 0; |
| 641 | border-spacing: 0; |
| 642 | } |
| 643 | span.forum_author { |
| 644 | color: #888; |
| 645 | font-size: 75%; |
| 646 | } |
| 647 | span.forum_author::after { |
| 648 | content: " | "; |
| 649 | } |
| 650 | span.forum_age { |
| 651 | color: #888; |
| 652 | font-size: 85%; |
| 653 | } |
| 654 | span.forum_buttons { |
| 655 | font-size: 85%; |
| 656 | } |
| 657 | span.forum_buttons::before { |
| 658 | color: #888; |
| 659 | content: " | "; |
| 660 | } |
| 661 | span.forum_npost { |
| 662 | color: #888; |
| 663 | font-size: 75%; |
| 664 | } |
| 665 | table.forumeditform td { |
| 666 | vertical-align: top; |
| 667 | border-collapse: collapse; |
| 668 | padding: 1px; |
| 669 | } |
| 670 | div.forum_body p { |
| 671 | margin-top: 0; |
| 672 | } |
| 673 |
+11
-11
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -111,11 +111,11 @@ | ||
| 111 | 111 | char *zAge = db_timespan_name(rNow - rMTime); |
| 112 | 112 | Blob body; |
| 113 | 113 | @ <!-- Forum post %d(id) --> |
| 114 | 114 | @ <table class="forum_post"> |
| 115 | 115 | @ <tr> |
| 116 | - @ <td class="forum_margin" width="%d(iDepth*25)" rowspan="2"> | |
| 116 | + @ <td class="forum_margin" width="%d(iDepth*40)" rowspan="2"> | |
| 117 | 117 | @ <td><span class="forum_author">%h(zUser)</span> |
| 118 | 118 | @ <span class="forum_age">%s(zAge) ago</span> |
| 119 | 119 | sqlite3_free(zAge); |
| 120 | 120 | if( g.perm.WrForum ){ |
| 121 | 121 | @ <span class="forum_buttons"> |
| @@ -167,11 +167,11 @@ | ||
| 167 | 167 | style_footer(); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /* |
| 171 | 171 | ** Use content in CGI parameters "s" (subject), "b" (body), and |
| 172 | -** "m" (mimetype) to create a new forum entry. | |
| 172 | +** "mimetype" (mimetype) to create a new forum entry. | |
| 173 | 173 | ** Return the id of the new forum entry. |
| 174 | 174 | ** |
| 175 | 175 | ** If any problems occur, return 0 and set *pzErr to a description of |
| 176 | 176 | ** the problem. |
| 177 | 177 | ** |
| @@ -183,11 +183,11 @@ | ||
| 183 | 183 | */ |
| 184 | 184 | static int forum_post(int itemId, int parentId, char **pzErr){ |
| 185 | 185 | const char *zSubject = 0; |
| 186 | 186 | int threadId; |
| 187 | 187 | double rNow = db_double(0.0, "SELECT julianday('now')"); |
| 188 | - const char *zMime = wiki_filter_mimetypes(P("m")); | |
| 188 | + const char *zMime = wiki_filter_mimetypes(P("mimetype")); | |
| 189 | 189 | if( itemId==0 && parentId==0 ){ |
| 190 | 190 | /* Start a new thread. Subject required. */ |
| 191 | 191 | sqlite3_uint64 r1, r2; |
| 192 | 192 | zSubject = PT("s"); |
| 193 | 193 | if( zSubject==0 || zSubject[0]==0 ){ |
| @@ -196,11 +196,11 @@ | ||
| 196 | 196 | } |
| 197 | 197 | sqlite3_randomness(sizeof(r1), &r1); |
| 198 | 198 | sqlite3_randomness(sizeof(r2), &r2); |
| 199 | 199 | db_multi_exec( |
| 200 | 200 | "INSERT INTO forumthread(mthreadhash, mtitle, mtime, npost)" |
| 201 | - "VALUES(lower(hex(randomblob(32))),%Q,%!.17g,1)", | |
| 201 | + "VALUES(lower(hex(randomblob(28))),%Q,%!.17g,1)", | |
| 202 | 202 | zSubject, rNow |
| 203 | 203 | ); |
| 204 | 204 | threadId = db_last_insert_rowid(); |
| 205 | 205 | }else{ |
| 206 | 206 | threadId = db_int(0, "SELECT mthreadid FROM forumpost" |
| @@ -219,17 +219,17 @@ | ||
| 219 | 219 | " mtime=%!.17g," |
| 220 | 220 | " mimetype=%Q," |
| 221 | 221 | " ipaddr=%Q," |
| 222 | 222 | " mbody=%Q" |
| 223 | 223 | " WHERE mpostid=%d", |
| 224 | - rNow, PT("m"), P("REMOTE_ADDR"), PT("b"), itemId | |
| 224 | + rNow, PT("mimetype"), P("REMOTE_ADDR"), PT("b"), itemId | |
| 225 | 225 | ); |
| 226 | 226 | }else{ |
| 227 | 227 | db_multi_exec( |
| 228 | 228 | "INSERT INTO forumpost(mposthash,mthreadid,uname,mtime," |
| 229 | 229 | " mstatus,mimetype,ipaddr,inreplyto,mbody) VALUES" |
| 230 | - " (lower(hex(randomblob(32))),%d,%Q,%!.17g,%Q,%Q,%Q,nullif(%d,0),%Q)", | |
| 230 | + " (lower(hex(randomblob(28))),%d,%Q,%!.17g,%Q,%Q,%Q,nullif(%d,0),%Q)", | |
| 231 | 231 | threadId,g.zLogin,rNow,NULL,zMime,P("REMOTE_ADDR"),parentId,P("b")); |
| 232 | 232 | itemId = db_last_insert_rowid(); |
| 233 | 233 | } |
| 234 | 234 | if( zSubject==0 ){ |
| 235 | 235 | db_multi_exec( |
| @@ -275,25 +275,25 @@ | ||
| 275 | 275 | if( itemId ){ |
| 276 | 276 | cgi_redirectf("%R/forum?item=%d",itemId); |
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - if( itemId && (P("m")==0 || P("b")==0) ){ | |
| 280 | + if( itemId && (P("mimetype")==0 || P("b")==0) ){ | |
| 281 | 281 | Stmt q; |
| 282 | 282 | db_prepare(&q, "SELECT mimetype, mbody FROM forumpost" |
| 283 | 283 | " WHERE mpostid=%d", itemId); |
| 284 | 284 | if( db_step(&q)==SQLITE_ROW ){ |
| 285 | - if( P("m")==0 ){ | |
| 286 | - cgi_set_query_parameter("m", db_column_text(&q, 0)); | |
| 285 | + if( P("mimetype")==0 ){ | |
| 286 | + cgi_set_query_parameter("mimetype", db_column_text(&q, 0)); | |
| 287 | 287 | } |
| 288 | 288 | if( P("b")==0 ){ |
| 289 | 289 | cgi_set_query_parameter("b", db_column_text(&q, 1)); |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | db_finalize(&q); |
| 293 | 293 | } |
| 294 | - zMime = wiki_filter_mimetypes(P("m")); | |
| 294 | + zMime = wiki_filter_mimetypes(P("mimetype")); | |
| 295 | 295 | if( itemId>0 ){ |
| 296 | 296 | style_header("Edit Forum Post"); |
| 297 | 297 | }else if( parentId>0 ){ |
| 298 | 298 | style_header("Comment On Forum Post"); |
| 299 | 299 | }else{ |
| @@ -312,11 +312,11 @@ | ||
| 312 | 312 | if( P("s") ){ |
| 313 | 313 | @ <h1>%h(PT("s"))</h1> |
| 314 | 314 | } |
| 315 | 315 | @ <div class="forumpreviewbody"> |
| 316 | 316 | blob_init(&x, PT("b"), -1); |
| 317 | - wiki_render_by_mimetype(&x, PT("m")); | |
| 317 | + wiki_render_by_mimetype(&x, PT("mimetype")); | |
| 318 | 318 | blob_reset(&x); |
| 319 | 319 | @ </div> |
| 320 | 320 | @ </div> |
| 321 | 321 | @ <hr> |
| 322 | 322 | } |
| 323 | 323 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -111,11 +111,11 @@ | |
| 111 | char *zAge = db_timespan_name(rNow - rMTime); |
| 112 | Blob body; |
| 113 | @ <!-- Forum post %d(id) --> |
| 114 | @ <table class="forum_post"> |
| 115 | @ <tr> |
| 116 | @ <td class="forum_margin" width="%d(iDepth*25)" rowspan="2"> |
| 117 | @ <td><span class="forum_author">%h(zUser)</span> |
| 118 | @ <span class="forum_age">%s(zAge) ago</span> |
| 119 | sqlite3_free(zAge); |
| 120 | if( g.perm.WrForum ){ |
| 121 | @ <span class="forum_buttons"> |
| @@ -167,11 +167,11 @@ | |
| 167 | style_footer(); |
| 168 | } |
| 169 | |
| 170 | /* |
| 171 | ** Use content in CGI parameters "s" (subject), "b" (body), and |
| 172 | ** "m" (mimetype) to create a new forum entry. |
| 173 | ** Return the id of the new forum entry. |
| 174 | ** |
| 175 | ** If any problems occur, return 0 and set *pzErr to a description of |
| 176 | ** the problem. |
| 177 | ** |
| @@ -183,11 +183,11 @@ | |
| 183 | */ |
| 184 | static int forum_post(int itemId, int parentId, char **pzErr){ |
| 185 | const char *zSubject = 0; |
| 186 | int threadId; |
| 187 | double rNow = db_double(0.0, "SELECT julianday('now')"); |
| 188 | const char *zMime = wiki_filter_mimetypes(P("m")); |
| 189 | if( itemId==0 && parentId==0 ){ |
| 190 | /* Start a new thread. Subject required. */ |
| 191 | sqlite3_uint64 r1, r2; |
| 192 | zSubject = PT("s"); |
| 193 | if( zSubject==0 || zSubject[0]==0 ){ |
| @@ -196,11 +196,11 @@ | |
| 196 | } |
| 197 | sqlite3_randomness(sizeof(r1), &r1); |
| 198 | sqlite3_randomness(sizeof(r2), &r2); |
| 199 | db_multi_exec( |
| 200 | "INSERT INTO forumthread(mthreadhash, mtitle, mtime, npost)" |
| 201 | "VALUES(lower(hex(randomblob(32))),%Q,%!.17g,1)", |
| 202 | zSubject, rNow |
| 203 | ); |
| 204 | threadId = db_last_insert_rowid(); |
| 205 | }else{ |
| 206 | threadId = db_int(0, "SELECT mthreadid FROM forumpost" |
| @@ -219,17 +219,17 @@ | |
| 219 | " mtime=%!.17g," |
| 220 | " mimetype=%Q," |
| 221 | " ipaddr=%Q," |
| 222 | " mbody=%Q" |
| 223 | " WHERE mpostid=%d", |
| 224 | rNow, PT("m"), P("REMOTE_ADDR"), PT("b"), itemId |
| 225 | ); |
| 226 | }else{ |
| 227 | db_multi_exec( |
| 228 | "INSERT INTO forumpost(mposthash,mthreadid,uname,mtime," |
| 229 | " mstatus,mimetype,ipaddr,inreplyto,mbody) VALUES" |
| 230 | " (lower(hex(randomblob(32))),%d,%Q,%!.17g,%Q,%Q,%Q,nullif(%d,0),%Q)", |
| 231 | threadId,g.zLogin,rNow,NULL,zMime,P("REMOTE_ADDR"),parentId,P("b")); |
| 232 | itemId = db_last_insert_rowid(); |
| 233 | } |
| 234 | if( zSubject==0 ){ |
| 235 | db_multi_exec( |
| @@ -275,25 +275,25 @@ | |
| 275 | if( itemId ){ |
| 276 | cgi_redirectf("%R/forum?item=%d",itemId); |
| 277 | return; |
| 278 | } |
| 279 | } |
| 280 | if( itemId && (P("m")==0 || P("b")==0) ){ |
| 281 | Stmt q; |
| 282 | db_prepare(&q, "SELECT mimetype, mbody FROM forumpost" |
| 283 | " WHERE mpostid=%d", itemId); |
| 284 | if( db_step(&q)==SQLITE_ROW ){ |
| 285 | if( P("m")==0 ){ |
| 286 | cgi_set_query_parameter("m", db_column_text(&q, 0)); |
| 287 | } |
| 288 | if( P("b")==0 ){ |
| 289 | cgi_set_query_parameter("b", db_column_text(&q, 1)); |
| 290 | } |
| 291 | } |
| 292 | db_finalize(&q); |
| 293 | } |
| 294 | zMime = wiki_filter_mimetypes(P("m")); |
| 295 | if( itemId>0 ){ |
| 296 | style_header("Edit Forum Post"); |
| 297 | }else if( parentId>0 ){ |
| 298 | style_header("Comment On Forum Post"); |
| 299 | }else{ |
| @@ -312,11 +312,11 @@ | |
| 312 | if( P("s") ){ |
| 313 | @ <h1>%h(PT("s"))</h1> |
| 314 | } |
| 315 | @ <div class="forumpreviewbody"> |
| 316 | blob_init(&x, PT("b"), -1); |
| 317 | wiki_render_by_mimetype(&x, PT("m")); |
| 318 | blob_reset(&x); |
| 319 | @ </div> |
| 320 | @ </div> |
| 321 | @ <hr> |
| 322 | } |
| 323 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -111,11 +111,11 @@ | |
| 111 | char *zAge = db_timespan_name(rNow - rMTime); |
| 112 | Blob body; |
| 113 | @ <!-- Forum post %d(id) --> |
| 114 | @ <table class="forum_post"> |
| 115 | @ <tr> |
| 116 | @ <td class="forum_margin" width="%d(iDepth*40)" rowspan="2"> |
| 117 | @ <td><span class="forum_author">%h(zUser)</span> |
| 118 | @ <span class="forum_age">%s(zAge) ago</span> |
| 119 | sqlite3_free(zAge); |
| 120 | if( g.perm.WrForum ){ |
| 121 | @ <span class="forum_buttons"> |
| @@ -167,11 +167,11 @@ | |
| 167 | style_footer(); |
| 168 | } |
| 169 | |
| 170 | /* |
| 171 | ** Use content in CGI parameters "s" (subject), "b" (body), and |
| 172 | ** "mimetype" (mimetype) to create a new forum entry. |
| 173 | ** Return the id of the new forum entry. |
| 174 | ** |
| 175 | ** If any problems occur, return 0 and set *pzErr to a description of |
| 176 | ** the problem. |
| 177 | ** |
| @@ -183,11 +183,11 @@ | |
| 183 | */ |
| 184 | static int forum_post(int itemId, int parentId, char **pzErr){ |
| 185 | const char *zSubject = 0; |
| 186 | int threadId; |
| 187 | double rNow = db_double(0.0, "SELECT julianday('now')"); |
| 188 | const char *zMime = wiki_filter_mimetypes(P("mimetype")); |
| 189 | if( itemId==0 && parentId==0 ){ |
| 190 | /* Start a new thread. Subject required. */ |
| 191 | sqlite3_uint64 r1, r2; |
| 192 | zSubject = PT("s"); |
| 193 | if( zSubject==0 || zSubject[0]==0 ){ |
| @@ -196,11 +196,11 @@ | |
| 196 | } |
| 197 | sqlite3_randomness(sizeof(r1), &r1); |
| 198 | sqlite3_randomness(sizeof(r2), &r2); |
| 199 | db_multi_exec( |
| 200 | "INSERT INTO forumthread(mthreadhash, mtitle, mtime, npost)" |
| 201 | "VALUES(lower(hex(randomblob(28))),%Q,%!.17g,1)", |
| 202 | zSubject, rNow |
| 203 | ); |
| 204 | threadId = db_last_insert_rowid(); |
| 205 | }else{ |
| 206 | threadId = db_int(0, "SELECT mthreadid FROM forumpost" |
| @@ -219,17 +219,17 @@ | |
| 219 | " mtime=%!.17g," |
| 220 | " mimetype=%Q," |
| 221 | " ipaddr=%Q," |
| 222 | " mbody=%Q" |
| 223 | " WHERE mpostid=%d", |
| 224 | rNow, PT("mimetype"), P("REMOTE_ADDR"), PT("b"), itemId |
| 225 | ); |
| 226 | }else{ |
| 227 | db_multi_exec( |
| 228 | "INSERT INTO forumpost(mposthash,mthreadid,uname,mtime," |
| 229 | " mstatus,mimetype,ipaddr,inreplyto,mbody) VALUES" |
| 230 | " (lower(hex(randomblob(28))),%d,%Q,%!.17g,%Q,%Q,%Q,nullif(%d,0),%Q)", |
| 231 | threadId,g.zLogin,rNow,NULL,zMime,P("REMOTE_ADDR"),parentId,P("b")); |
| 232 | itemId = db_last_insert_rowid(); |
| 233 | } |
| 234 | if( zSubject==0 ){ |
| 235 | db_multi_exec( |
| @@ -275,25 +275,25 @@ | |
| 275 | if( itemId ){ |
| 276 | cgi_redirectf("%R/forum?item=%d",itemId); |
| 277 | return; |
| 278 | } |
| 279 | } |
| 280 | if( itemId && (P("mimetype")==0 || P("b")==0) ){ |
| 281 | Stmt q; |
| 282 | db_prepare(&q, "SELECT mimetype, mbody FROM forumpost" |
| 283 | " WHERE mpostid=%d", itemId); |
| 284 | if( db_step(&q)==SQLITE_ROW ){ |
| 285 | if( P("mimetype")==0 ){ |
| 286 | cgi_set_query_parameter("mimetype", db_column_text(&q, 0)); |
| 287 | } |
| 288 | if( P("b")==0 ){ |
| 289 | cgi_set_query_parameter("b", db_column_text(&q, 1)); |
| 290 | } |
| 291 | } |
| 292 | db_finalize(&q); |
| 293 | } |
| 294 | zMime = wiki_filter_mimetypes(P("mimetype")); |
| 295 | if( itemId>0 ){ |
| 296 | style_header("Edit Forum Post"); |
| 297 | }else if( parentId>0 ){ |
| 298 | style_header("Comment On Forum Post"); |
| 299 | }else{ |
| @@ -312,11 +312,11 @@ | |
| 312 | if( P("s") ){ |
| 313 | @ <h1>%h(PT("s"))</h1> |
| 314 | } |
| 315 | @ <div class="forumpreviewbody"> |
| 316 | blob_init(&x, PT("b"), -1); |
| 317 | wiki_render_by_mimetype(&x, PT("mimetype")); |
| 318 | blob_reset(&x); |
| 319 | @ </div> |
| 320 | @ </div> |
| 321 | @ <hr> |
| 322 | } |
| 323 |