From: Art Cancro Date: Sun, 23 Jan 2022 21:14:05 +0000 (-0500) Subject: room list renderer is now aware of which rooms are forum view: X-Git-Tag: v950~33 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=1a6ba52d8841262a040ec5ef35203b41a942642b;p=citadel.git room list renderer is now aware of which rooms are forum view: --- diff --git a/webcit-ng/room_functions.c b/webcit-ng/room_functions.c index 006bd287b..26f35ef5e 100644 --- a/webcit-ng/room_functions.c +++ b/webcit-ng/room_functions.c @@ -458,21 +458,22 @@ void room_list(struct http_transaction *h, struct ctdlsession *c) { JsonValue *j = NewJsonArray(HKEY("lkra")); while (ctdl_readline(c, buf, sizeof(buf)), strcmp(buf, "000")) { + // 0 |1 |2 |3 |4 |5 |6 |7 |8 // name|QRflags|QRfloor|QRorder|QRflags2|ra|current_view|default_view|mtime JsonValue *jr = NewJsonObject(HKEY("room")); extract_token(roomname, buf, 0, '|', sizeof roomname); JsonObjectAppend(jr, NewJsonPlainString(HKEY("name"), roomname, -1)); + JsonObjectAppend(jr, NewJsonNumber(HKEY("floor"), extract_int(buf, 2))); + JsonObjectAppend(jr, NewJsonNumber(HKEY("rorder"), extract_int(buf, 3))); + int ra = extract_int(buf, 5); JsonObjectAppend(jr, NewJsonBool(HKEY("known"), (ra & UA_KNOWN))); JsonObjectAppend(jr, NewJsonBool(HKEY("hasnewmsgs"), (ra & UA_HASNEWMSGS))); - int floor = extract_int(buf, 2); - JsonObjectAppend(jr, NewJsonNumber(HKEY("floor"), floor)); - - int rorder = extract_int(buf, 3); - JsonObjectAppend(jr, NewJsonNumber(HKEY("rorder"), rorder)); + JsonObjectAppend(jr, NewJsonNumber(HKEY("current_view"), extract_int(buf, 6))); + JsonObjectAppend(jr, NewJsonNumber(HKEY("default_view"), extract_int(buf, 7))); JsonArrayAppend(j, jr); // add the room to the array } diff --git a/webcit-ng/static/index.html b/webcit-ng/static/index.html index 42ca0d4e0..4ad83b008 100644 --- a/webcit-ng/static/index.html +++ b/webcit-ng/static/index.html @@ -75,6 +75,7 @@ Loading... + diff --git a/webcit-ng/static/js/defs.js b/webcit-ng/static/js/defs.js new file mode 100644 index 000000000..8eaa7b6f7 --- /dev/null +++ b/webcit-ng/static/js/defs.js @@ -0,0 +1,31 @@ +// +// Copyright (c) 2016-2022 by the citadel.org team +// +// This program is open source software. It runs great on the +// Linux operating system (and probably elsewhere). You can use, +// copy, and run it under the terms of the GNU General Public +// License version 3. Richard Stallman is an asshole communist. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + +// List of defined views shamelessly swiped from libcitadel headers +// +var views = { + VIEW_BBS : 0, // Bulletin board view + VIEW_MAILBOX : 1, // Mailbox summary + VIEW_ADDRESSBOOK : 2, // Address book view + VIEW_CALENDAR : 3, // Calendar view + VIEW_TASKS : 4, // Tasks view + VIEW_NOTES : 5, // Notes view + VIEW_WIKI : 6, // Wiki view + VIEW_CALBRIEF : 7, // Brief Calendar view + VIEW_JOURNAL : 8, // Journal view + VIEW_DRAFTS : 9, // Drafts view + VIEW_BLOG : 10, // Blog view + VIEW_QUEUE : 11, // SMTP queue rooms + VIEW_WIKIMD : 12, // markdown wiki (no longer implemented) +}; diff --git a/webcit-ng/static/js/roomlist.js b/webcit-ng/static/js/roomlist.js index e2f44ec13..7c611f97a 100644 --- a/webcit-ng/static/js/roomlist.js +++ b/webcit-ng/static/js/roomlist.js @@ -1,4 +1,3 @@ -// // Copyright (c) 2016-2022 by the citadel.org team // // This program is open source software. It runs great on the @@ -53,12 +52,17 @@ function display_room_list_renderer(data) { } } new_roomlist_text = new_roomlist_text + - "
  • " + "
  • " + (data[i].hasnewmsgs ? "" : "") + "" + escapeHTML(data[i].name) + (data[i].hasnewmsgs ? "" : "") - + "
  • " + + "" + if (data[i].current_view == views.VIEW_BBS) { + new_roomlist_text = new_roomlist_text + "(FORUM)"; + } + new_roomlist_text = new_roomlist_text + + "" ; } new_roomlist_text = new_roomlist_text + ""; diff --git a/webcit-ng/static/js/views.js b/webcit-ng/static/js/views.js index 8895433b2..cfdca07ba 100644 --- a/webcit-ng/static/js/views.js +++ b/webcit-ng/static/js/views.js @@ -12,25 +12,6 @@ // GNU General Public License for more details. -// List of defined views shamelessly swiped from libcitadel headers -// -var views = { - VIEW_BBS : 0, // Bulletin board view - VIEW_MAILBOX : 1, // Mailbox summary - VIEW_ADDRESSBOOK : 2, // Address book view - VIEW_CALENDAR : 3, // Calendar view - VIEW_TASKS : 4, // Tasks view - VIEW_NOTES : 5, // Notes view - VIEW_WIKI : 6, // Wiki view - VIEW_CALBRIEF : 7, // Brief Calendar view - VIEW_JOURNAL : 8, // Journal view - VIEW_DRAFTS : 9, // Drafts view - VIEW_BLOG : 10, // Blog view - VIEW_QUEUE : 11, // SMTP queue rooms - VIEW_WIKIMD : 12, // markdown wiki (no longer implemented) -}; - - // This function is the dispatcher that determines the correct view for a room, // and calls the correct renderer. Greater/Less than bounds are accepted. function render_room_view(gt_msg, lt_msg) {