* Set up a toggleable iconbar that can switch between the menu and a room
authorArt Cancro <ajc@citadel.org>
Tue, 22 Nov 2005 05:01:37 +0000 (05:01 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 22 Nov 2005 05:01:37 +0000 (05:01 +0000)
  list.  The room list is not yet implemented, so a simple placeholder is
  there instead.

webcit/ChangeLog
webcit/iconbar.c
webcit/static/wclib.js
webcit/webcit.c
webcit/webcit.h

index 14f774848166e056a9a817ac11999a11dff1e06c..dce9c3875b615db9b5e855034c8ddf9e4483a2f4 100644 (file)
@@ -1,5 +1,10 @@
 $Id$
 
+Tue Nov 22 00:00:46 EST 2005 ajc
+* Set up a toggleable iconbar that can switch between the menu and a room
+  list.  The room list is not yet implemented, so a simple placeholder is
+  there instead.
+
 Mon Nov 21 22:47:17 EST 2005 ajc
 * messages.c, webcit.css: message buttons (Reply, ReplyQuoted, etc.) are now
   in a smaller font (new style "msgbuttons" defined in the stylesheet)
index 78ea655b280ad082cd71b99e727871e9cb4ffb63..69803f4f6bc181de03e27df3b472e1291b637dc4 100644 (file)
@@ -12,6 +12,7 @@
 #define IB_PICONLY     1
 #define IB_TEXTONLY    2
 
+
 void do_iconbar(void) {
        char iconbar[SIZ];
        char buf[SIZ];
@@ -85,6 +86,7 @@ void do_iconbar(void) {
                _("CITADEL")
        );
 
+       wprintf("<li><a href=\"javascript:switch_to_room_list()\">switch to room list</a>\n");
 
        if (ib_summary) {
                wprintf("<li><a href=\"summary\" "
@@ -315,6 +317,77 @@ void do_iconbar(void) {
 }
 
 
+/*
+ * If the user has toggled the icon bar over to a room list, here's where
+ * we generate its innerHTML...
+ */
+void do_iconbar_roomlist(void) {
+       char iconbar[SIZ];
+       char buf[SIZ];
+       char key[SIZ], value[SIZ];
+       int i;
+
+       /* The initialized values of these variables also happen to
+        * specify the default values for users who haven't customized
+        * their iconbars.  These should probably be set in a master
+        * configuration somewhere.
+        */
+       int ib_displayas = 0;   /* pictures and text, pictures, text */
+       int ib_logo = 0;        /* Site logo */
+       int ib_citadel = 1;     /* 'Powered by Citadel' logo */
+       /*
+        */
+
+       get_preference("iconbar", iconbar, sizeof iconbar);
+       for (i=0; i<num_tokens(iconbar, ','); ++i) {
+               extract_token(buf, iconbar, i, ',', sizeof buf);
+               extract_token(key, buf, 0, '=', sizeof key);
+               extract_token(value, buf, 1, '=', sizeof value);
+
+               if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
+               if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
+               if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
+       }
+
+       wprintf("<div id=\"button\">\n"
+               "<ul>\n"
+       );
+
+       if (ib_logo) {
+               wprintf("<li>");
+               if (ib_displayas != IB_TEXTONLY) {
+                       wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
+                               "HEIGHT=\"32\" src=\"image&name=hello\" ALT=\"&nbsp;\">\n"
+                       );
+               }
+               wprintf("</li>\n");
+       }
+
+       if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
+               "<li><div align=\"center\">"
+               "<a href=\"http://www.citadel.org\" "
+               "title=\"%s\" target=\"aboutcit\">"
+               "<img border=\"0\" "
+               "src=\"static/citadel-logo.gif\" ALT=\"%s\"></a>"
+               "</div></li>\n",
+               _("Find out more about Citadel"),
+               _("CITADEL")
+       );
+
+       wprintf("<li><a href=\"javascript:switch_to_menu_buttons()\">back to menu...</a>");
+       
+       wprintf("</ul>\n");
+
+       wprintf("<br><br>Room list<br>will be<br>here<br><br>");
+
+       wprintf("<div id=\"dropstuff\" style=\"font-size:6pt\">");
+       wprintf("Drag to trash here...<br>");
+       wprintf("</div>");
+
+       wprintf("</div>\n");
+}
+
+
 
 void display_customize_iconbar(void) {
        char iconbar[SIZ];
@@ -657,3 +730,4 @@ void commit_iconbar(void) {
        wprintf("</td></tr></table>\n");
        wDumpContent(2);
 }
+
index 69c0183df81a09bf8cbaab638baa9afb9523edb1..1f10ec063328c4130a747d7309fb5a57571b8e88 100644 (file)
@@ -323,6 +323,8 @@ function CtdlMoveMsgMouseUp(evt) {
        r = parseInt($('dropstuff').offsetLeft) + parseInt($('dropstuff').offsetWidth);
        b = parseInt($('dropstuff').offsetTop) + parseInt($('dropstuff').offsetHeight);
 
+       // alert('Offsets are: ' + l + ' ' + t + ' ' + r + ' ' + b + '.');
+
        if ( (x >= l) && (x <= r) && (y >= t) && (y <= b) ) {
                // Yes, we dropped it on a hotspot.  Just delete for now... FIXME
                CtdlDeleteSelectedMessages(evt);
@@ -352,3 +354,14 @@ function ctdl_ts_getInnerText(el) {
        }
        return str;
 }
+
+
+// icon bar toggler tabs...
+
+function switch_to_room_list() {
+       new Ajax.Updater('iconbar', 'iconbar_ajax_rooms', { method: 'get' } );
+}
+
+function switch_to_menu_buttons() {
+       new Ajax.Updater('iconbar', 'iconbar_ajax_menu', { method: 'get' } );
+}
index 3644aca0f602c7d2ebe57cc85cfb79b1c3a9458b..c58876f9b473e6e2039101342def2018b5802803 100644 (file)
@@ -1270,6 +1270,14 @@ void session_loop(struct httprequest *req)
                begin_ajax_response();
                who_inner_div();
                end_ajax_response();
+       } else if (!strcasecmp(action, "iconbar_ajax_menu")) {
+               begin_ajax_response();
+               do_iconbar();
+               end_ajax_response();
+       } else if (!strcasecmp(action, "iconbar_ajax_rooms")) {
+               begin_ajax_response();
+               do_iconbar_roomlist();
+               end_ajax_response();
        } else if (!strcasecmp(action, "knrooms")) {
                knrooms();
        } else if (!strcasecmp(action, "gotonext")) {
@@ -1468,8 +1476,6 @@ void session_loop(struct httprequest *req)
                begin_ajax_response();
                summary_inner_div();
                end_ajax_response();
-       } else if (!strcasecmp(action, "iconbar")) {
-               do_iconbar();
        } else if (!strcasecmp(action, "display_customize_iconbar")) {
                display_customize_iconbar();
        } else if (!strcasecmp(action, "commit_iconbar")) {
index 7f61f0809bdf61b91a5da456bf7e926ce029716a..cbaa89b5fcefc166ec19e670893a3a804e2caefa 100644 (file)
@@ -582,6 +582,7 @@ void http_transmit_thing(char *thing, size_t length, char *content_type,
                         int is_static);
 void unescape_input(char *buf);
 void do_iconbar(void);
+void do_iconbar_roomlist(void);
 void display_customize_iconbar(void);
 void commit_iconbar(void);
 int CtdlDecodeQuotedPrintable(char *decoded, char *encoded, int sourcelen);