Fossil SCM
Minor cleanups. Add a 'Post as USERNAME' label to the forum editor, per suggestion in the forum.
Commit
73c5b76df7e89a339896cc9f499b245d86961b83c32dba7a15a9cc1a6667412d
Parent
4b1962b97fb859e…
4 files changed
+6
-3
+4
-4
+7
-1
+4
+6
-3
| --- src/builtin.c | ||
| +++ src/builtin.c | ||
| @@ -690,15 +690,17 @@ | ||
| 690 | 690 | if(i) CX(","); |
| 691 | 691 | CX("{label:%!j, value:%!j}", fs->zLabel, fs->zValue); |
| 692 | 692 | } |
| 693 | 693 | CX("];\n"); |
| 694 | 694 | } |
| 695 | +#define JBOOL(COND) ((COND) ? "true" : "false") | |
| 695 | 696 | CX("window.fossil.user = {"); |
| 696 | 697 | CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest"); |
| 697 | - CX("isAdmin: %s,", (g.perm.Admin || g.perm.Setup) ? "true" : "false"); | |
| 698 | - CX("mayAttachForum: %s,", g.perm.AttachForum ? "true" : "false"); | |
| 699 | - CX("enableDebug: %s", (g.perm.Debug || g.perm.Admin) ? "true" : "false"); | |
| 698 | + CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup)); | |
| 699 | + CX("mayAttachForum: %s,", JBOOL(g.perm.AttachForum)); | |
| 700 | + CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin)); | |
| 701 | + CX("isIndividual: %s", JBOOL(login_is_individual())); | |
| 700 | 702 | CX("};\n"/*fossil.user*/); |
| 701 | 703 | CX("if(fossil.config.skin.isDark) " |
| 702 | 704 | "document.body.classList.add('fossil-dark-style');\n"); |
| 703 | 705 | /* |
| 704 | 706 | ** fossil.page holds info about the current page. This is also |
| @@ -714,10 +716,11 @@ | ||
| 714 | 716 | } |
| 715 | 717 | /* The remaining window.fossil bootstrap code is not dependent on |
| 716 | 718 | ** C-runtime state... */ |
| 717 | 719 | builtin_request_js("fossil.bootstrap.js"); |
| 718 | 720 | } |
| 721 | +#undef JBOOL | |
| 719 | 722 | } |
| 720 | 723 | |
| 721 | 724 | /* |
| 722 | 725 | ** Given the NAME part of fossil.NAME.js, this function checks whether |
| 723 | 726 | ** that module has been emitted by this function before. If it has, |
| 724 | 727 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -690,15 +690,17 @@ | |
| 690 | if(i) CX(","); |
| 691 | CX("{label:%!j, value:%!j}", fs->zLabel, fs->zValue); |
| 692 | } |
| 693 | CX("];\n"); |
| 694 | } |
| 695 | CX("window.fossil.user = {"); |
| 696 | CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest"); |
| 697 | CX("isAdmin: %s,", (g.perm.Admin || g.perm.Setup) ? "true" : "false"); |
| 698 | CX("mayAttachForum: %s,", g.perm.AttachForum ? "true" : "false"); |
| 699 | CX("enableDebug: %s", (g.perm.Debug || g.perm.Admin) ? "true" : "false"); |
| 700 | CX("};\n"/*fossil.user*/); |
| 701 | CX("if(fossil.config.skin.isDark) " |
| 702 | "document.body.classList.add('fossil-dark-style');\n"); |
| 703 | /* |
| 704 | ** fossil.page holds info about the current page. This is also |
| @@ -714,10 +716,11 @@ | |
| 714 | } |
| 715 | /* The remaining window.fossil bootstrap code is not dependent on |
| 716 | ** C-runtime state... */ |
| 717 | builtin_request_js("fossil.bootstrap.js"); |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | /* |
| 722 | ** Given the NAME part of fossil.NAME.js, this function checks whether |
| 723 | ** that module has been emitted by this function before. If it has, |
| 724 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -690,15 +690,17 @@ | |
| 690 | if(i) CX(","); |
| 691 | CX("{label:%!j, value:%!j}", fs->zLabel, fs->zValue); |
| 692 | } |
| 693 | CX("];\n"); |
| 694 | } |
| 695 | #define JBOOL(COND) ((COND) ? "true" : "false") |
| 696 | CX("window.fossil.user = {"); |
| 697 | CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest"); |
| 698 | CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup)); |
| 699 | CX("mayAttachForum: %s,", JBOOL(g.perm.AttachForum)); |
| 700 | CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin)); |
| 701 | CX("isIndividual: %s", JBOOL(login_is_individual())); |
| 702 | CX("};\n"/*fossil.user*/); |
| 703 | CX("if(fossil.config.skin.isDark) " |
| 704 | "document.body.classList.add('fossil-dark-style');\n"); |
| 705 | /* |
| 706 | ** fossil.page holds info about the current page. This is also |
| @@ -714,10 +716,11 @@ | |
| 716 | } |
| 717 | /* The remaining window.fossil bootstrap code is not dependent on |
| 718 | ** C-runtime state... */ |
| 719 | builtin_request_js("fossil.bootstrap.js"); |
| 720 | } |
| 721 | #undef JBOOL |
| 722 | } |
| 723 | |
| 724 | /* |
| 725 | ** Given the NAME part of fossil.NAME.js, this function checks whether |
| 726 | ** that module has been emitted by this function before. If it has, |
| 727 |
+4
-4
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -2289,21 +2289,21 @@ | ||
| 2289 | 2289 | ** to closed posts. If false, only administrators may do so. Note that |
| 2290 | 2290 | ** this only affects the forum web UI, not post-closing tags which |
| 2291 | 2291 | ** arrive via the command-line or from synchronization with a remote. |
| 2292 | 2292 | ** This policy also determines whether moderators may delete forum |
| 2293 | 2293 | ** attachments. |
| 2294 | -*/ | |
| 2295 | -/* | |
| 2294 | +** | |
| 2296 | 2295 | ** SETTING: forum-title width=20 default=Forum |
| 2297 | 2296 | ** This is the name or "title" of the Forum for this repository. The |
| 2298 | 2297 | ** default is just "Forum". But in some setups, admins might want to |
| 2299 | 2298 | ** change it to "Developer Forum" or "User Forum" or whatever other name |
| 2300 | 2299 | ** seems more appropriate for the particular usage. |
| 2301 | 2300 | ** |
| 2302 | 2301 | ** SETTING: attachment-size-limit width=16 |
| 2303 | -** The maximum number of bytes for an attachment. The default (or 0) is | |
| 2304 | -** unlimited but a limit may be imposed by the web server or a proxy. | |
| 2302 | +** The maximum number of bytes for an attachment to a wiki page, | |
| 2303 | +** ticket, tech note, or forum post. The default (or 0) is unlimited | |
| 2304 | +** but a limit may be imposed by the web server or a proxy. | |
| 2305 | 2305 | ** |
| 2306 | 2306 | ** SETTING: forum-statuses width=40 block-text |
| 2307 | 2307 | ** This JSON5-formatted value defines an array of objects describing |
| 2308 | 2308 | ** the available statuses of forum posts. Each entry of the array must |
| 2309 | 2309 | ** be an object in the form {label:"X",value:"Y"}. |
| 2310 | 2310 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -2289,21 +2289,21 @@ | |
| 2289 | ** to closed posts. If false, only administrators may do so. Note that |
| 2290 | ** this only affects the forum web UI, not post-closing tags which |
| 2291 | ** arrive via the command-line or from synchronization with a remote. |
| 2292 | ** This policy also determines whether moderators may delete forum |
| 2293 | ** attachments. |
| 2294 | */ |
| 2295 | /* |
| 2296 | ** SETTING: forum-title width=20 default=Forum |
| 2297 | ** This is the name or "title" of the Forum for this repository. The |
| 2298 | ** default is just "Forum". But in some setups, admins might want to |
| 2299 | ** change it to "Developer Forum" or "User Forum" or whatever other name |
| 2300 | ** seems more appropriate for the particular usage. |
| 2301 | ** |
| 2302 | ** SETTING: attachment-size-limit width=16 |
| 2303 | ** The maximum number of bytes for an attachment. The default (or 0) is |
| 2304 | ** unlimited but a limit may be imposed by the web server or a proxy. |
| 2305 | ** |
| 2306 | ** SETTING: forum-statuses width=40 block-text |
| 2307 | ** This JSON5-formatted value defines an array of objects describing |
| 2308 | ** the available statuses of forum posts. Each entry of the array must |
| 2309 | ** be an object in the form {label:"X",value:"Y"}. |
| 2310 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -2289,21 +2289,21 @@ | |
| 2289 | ** to closed posts. If false, only administrators may do so. Note that |
| 2290 | ** this only affects the forum web UI, not post-closing tags which |
| 2291 | ** arrive via the command-line or from synchronization with a remote. |
| 2292 | ** This policy also determines whether moderators may delete forum |
| 2293 | ** attachments. |
| 2294 | ** |
| 2295 | ** SETTING: forum-title width=20 default=Forum |
| 2296 | ** This is the name or "title" of the Forum for this repository. The |
| 2297 | ** default is just "Forum". But in some setups, admins might want to |
| 2298 | ** change it to "Developer Forum" or "User Forum" or whatever other name |
| 2299 | ** seems more appropriate for the particular usage. |
| 2300 | ** |
| 2301 | ** SETTING: attachment-size-limit width=16 |
| 2302 | ** The maximum number of bytes for an attachment to a wiki page, |
| 2303 | ** ticket, tech note, or forum post. The default (or 0) is unlimited |
| 2304 | ** but a limit may be imposed by the web server or a proxy. |
| 2305 | ** |
| 2306 | ** SETTING: forum-statuses width=40 block-text |
| 2307 | ** This JSON5-formatted value defines an array of objects describing |
| 2308 | ** the available statuses of forum posts. Each entry of the array must |
| 2309 | ** be an object in the form {label:"X",value:"Y"}. |
| 2310 |
+7
-1
| --- src/fossil.page.forumpost.js | ||
| +++ src/fossil.page.forumpost.js | ||
| @@ -396,10 +396,16 @@ | ||
| 396 | 396 | et.classList.toggle('hidden'); |
| 397 | 397 | } |
| 398 | 398 | }); |
| 399 | 399 | e.buttons.append(e.button.toggleHeader); |
| 400 | 400 | } |
| 401 | + | |
| 402 | + { | |
| 403 | + const eLbl = D.label(false, "Posting as "+F.user.name) | |
| 404 | + eLbl.classList.add('logged-in-as'); | |
| 405 | + e.buttons.append(eLbl); | |
| 406 | + } | |
| 401 | 407 | |
| 402 | 408 | }/*constructor*/ |
| 403 | 409 | |
| 404 | 410 | /* |
| 405 | 411 | ** Removes this object from the DOM. It has no side effects if |
| @@ -523,11 +529,11 @@ | ||
| 523 | 529 | "WARNING: draft edits are keyed on the ID of the message they ", |
| 524 | 530 | "are editing or responding to. Attempting to edit or reply to ", |
| 525 | 531 | "the same post from multiple tabs will cause the most-recently-edited ", |
| 526 | 532 | "one to overwrite the draft slot for that post. In browsers which support ", |
| 527 | 533 | "Web Locks, a second attempt to edit or reply to a post will be blocked ", |
| 528 | - "and an error will be shown explaning the problem." | |
| 534 | + "and an error will be shown explaining the problem." | |
| 529 | 535 | ); |
| 530 | 536 | if( this.#e.status ){ |
| 531 | 537 | D.append( |
| 532 | 538 | D.li(list), |
| 533 | 539 | "Tip: changing just the status in the editor will change only that, ", |
| 534 | 540 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -396,10 +396,16 @@ | |
| 396 | et.classList.toggle('hidden'); |
| 397 | } |
| 398 | }); |
| 399 | e.buttons.append(e.button.toggleHeader); |
| 400 | } |
| 401 | |
| 402 | }/*constructor*/ |
| 403 | |
| 404 | /* |
| 405 | ** Removes this object from the DOM. It has no side effects if |
| @@ -523,11 +529,11 @@ | |
| 523 | "WARNING: draft edits are keyed on the ID of the message they ", |
| 524 | "are editing or responding to. Attempting to edit or reply to ", |
| 525 | "the same post from multiple tabs will cause the most-recently-edited ", |
| 526 | "one to overwrite the draft slot for that post. In browsers which support ", |
| 527 | "Web Locks, a second attempt to edit or reply to a post will be blocked ", |
| 528 | "and an error will be shown explaning the problem." |
| 529 | ); |
| 530 | if( this.#e.status ){ |
| 531 | D.append( |
| 532 | D.li(list), |
| 533 | "Tip: changing just the status in the editor will change only that, ", |
| 534 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -396,10 +396,16 @@ | |
| 396 | et.classList.toggle('hidden'); |
| 397 | } |
| 398 | }); |
| 399 | e.buttons.append(e.button.toggleHeader); |
| 400 | } |
| 401 | |
| 402 | { |
| 403 | const eLbl = D.label(false, "Posting as "+F.user.name) |
| 404 | eLbl.classList.add('logged-in-as'); |
| 405 | e.buttons.append(eLbl); |
| 406 | } |
| 407 | |
| 408 | }/*constructor*/ |
| 409 | |
| 410 | /* |
| 411 | ** Removes this object from the DOM. It has no side effects if |
| @@ -523,11 +529,11 @@ | |
| 529 | "WARNING: draft edits are keyed on the ID of the message they ", |
| 530 | "are editing or responding to. Attempting to edit or reply to ", |
| 531 | "the same post from multiple tabs will cause the most-recently-edited ", |
| 532 | "one to overwrite the draft slot for that post. In browsers which support ", |
| 533 | "Web Locks, a second attempt to edit or reply to a post will be blocked ", |
| 534 | "and an error will be shown explaining the problem." |
| 535 | ); |
| 536 | if( this.#e.status ){ |
| 537 | D.append( |
| 538 | D.li(list), |
| 539 | "Tip: changing just the status in the editor will change only that, ", |
| 540 |
+4
| --- src/style.forum.css | ||
| +++ src/style.forum.css | ||
| @@ -90,10 +90,14 @@ | ||
| 90 | 90 | align-items: last baseline; |
| 91 | 91 | cursor: pointer; |
| 92 | 92 | border: 1px inset rgba(128, 128, 128, 0.5); |
| 93 | 93 | border-radius: 0.25em; |
| 94 | 94 | padding: 0.1em; |
| 95 | +} | |
| 96 | +.ForumPostEditor > .buttons > label.logged-in-as { | |
| 97 | + cursor: initial; | |
| 98 | + white-space: nowrap; | |
| 95 | 99 | } |
| 96 | 100 | .ForumPostEditor > .buttons > label > input[type=checkbox]{ |
| 97 | 101 | cursor: pointer; |
| 98 | 102 | } |
| 99 | 103 | |
| 100 | 104 |
| --- src/style.forum.css | |
| +++ src/style.forum.css | |
| @@ -90,10 +90,14 @@ | |
| 90 | align-items: last baseline; |
| 91 | cursor: pointer; |
| 92 | border: 1px inset rgba(128, 128, 128, 0.5); |
| 93 | border-radius: 0.25em; |
| 94 | padding: 0.1em; |
| 95 | } |
| 96 | .ForumPostEditor > .buttons > label > input[type=checkbox]{ |
| 97 | cursor: pointer; |
| 98 | } |
| 99 | |
| 100 |
| --- src/style.forum.css | |
| +++ src/style.forum.css | |
| @@ -90,10 +90,14 @@ | |
| 90 | align-items: last baseline; |
| 91 | cursor: pointer; |
| 92 | border: 1px inset rgba(128, 128, 128, 0.5); |
| 93 | border-radius: 0.25em; |
| 94 | padding: 0.1em; |
| 95 | } |
| 96 | .ForumPostEditor > .buttons > label.logged-in-as { |
| 97 | cursor: initial; |
| 98 | white-space: nowrap; |
| 99 | } |
| 100 | .ForumPostEditor > .buttons > label > input[type=checkbox]{ |
| 101 | cursor: pointer; |
| 102 | } |
| 103 | |
| 104 |