]> code.citadel.org Git - citadel.git/blobdiff - webcit/roomops.c
* Merged Thierry's CSS changes
[citadel.git] / webcit / roomops.c
index 23bb57d2eafa22d0b734e8ddb115e5c83ff65da7..b79351d52e852178036527d1f250e5a0b830cc4a 100644 (file)
@@ -26,6 +26,26 @@ void initialize_viewdefs(void) {
        viewdefs[7] = _("Calendar List");
 }
 
+/**
+ * \brief      Determine which views are allowed as the default for creating a new room.
+ *
+ * \param      which_view      The view ID being queried.
+ */
+int is_view_allowed_as_default(int which_view)
+{
+       switch(which_view) {
+               case VIEW_BBS:          return(1);
+               case VIEW_MAILBOX:      return(1);
+               case VIEW_ADDRESSBOOK:  return(1);
+               case VIEW_CALENDAR:     return(1);
+               case VIEW_TASKS:        return(1);
+               case VIEW_NOTES:        return(1);
+               case VIEW_WIKI:         return(0);      /**< because it isn't finished yet */
+               case VIEW_CALBRIEF:     return(0);
+               default:                return(0);      /**< should never get here */
+       }
+}
+
 
 /**
  * \brief load the list of floors
@@ -50,6 +70,25 @@ void load_floorlist(void)
 }
 
 
+/**
+ * \brief      Free a session's march list
+ *
+ * \param      wcf             Pointer to session being cleared
+ */
+void free_march_list(struct wcsession *wcf)
+{
+       struct march *mptr;
+
+       while (wcf->march != NULL) {
+               mptr = wcf->march->next;
+               free(wcf->march);
+               wcf->march = mptr;
+       }
+
+}
+
+
+
 /**
  * \brief remove a room from the march list
  */
@@ -273,7 +312,7 @@ void embed_room_graphic(void) {
                        "\">"
                );
        }
-       else if (WC->wc_view == VIEW_CALENDAR) {
+       else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
                wprintf("<img height=48 width=48 src=\""
                        "static/calarea_48x.gif"
                        "\">"
@@ -331,10 +370,10 @@ void embed_view_o_matic(void) {
                 */
                if (
                        (i == WC->wc_view)
-                       ||      (i == WC->wc_default_view) /**< default */
-                       ||      ( (i == 0) && (WC->wc_default_view == 1) ) /**< mail or bulletin */
-                       ||      ( (i == 1) && (WC->wc_default_view == 0) ) /**< mail or bulletin */
-                       ||  ( (i == 7) && (WC->wc_default_view == 3) ) /**< calendar */
+                       ||      (i == WC->wc_default_view)                      /**< default */
+                       ||      ( (i == 0) && (WC->wc_default_view == 1) )      /**< mail or bulletin */
+                       ||      ( (i == 1) && (WC->wc_default_view == 0) )      /**< mail or bulletin */
+                       /** ||  ( (i == 7) && (WC->wc_default_view == 3) )      (calendar list temporarily disabled) */
                ) {
 
                        wprintf("<OPTION %s VALUE=\"changeview?view=%d\">",
@@ -349,9 +388,26 @@ void embed_view_o_matic(void) {
 
 
 /**
- * \brief view room banner
- * \param got what???
- * \param navbar_style
+ * \brief Display a search box
+ */
+void embed_search_o_matic(void) {
+       wprintf("<form name=\"searchomatic\" action=\"do_search\">\n"
+               "<span class=\"room_banner_new_messages\">");
+       wprintf(_("Search: "));
+       wprintf("<input "
+               "type=\"text\" name=\"query\" size=\"20\" maxlength=\"128\" "
+               "style=\"font-size: 7pt; background: #444455; color: #ddddcc;\">\n"
+       );
+       wprintf("</select></span></form>\n");
+}
+
+
+/**
+ * \brief              Embed the room banner
+ *
+ * \param got          The information returned from a GOTO server command
+ * \param navbar_style         Determines which navigation buttons to display
+ *
  */
 void embed_room_banner(char *got, int navbar_style) {
        char buf[256];
@@ -394,6 +450,7 @@ void embed_room_banner(char *got, int navbar_style) {
        svcallback("ROOMPIC", embed_room_graphic);
        svcallback("ROOMINFO", readinfo);
        svcallback("VIEWOMATIC", embed_view_o_matic);
+       svcallback("SEARCHOMATIC", embed_search_o_matic);
        svcallback("START", offer_start_page);
 
        do_template("roombanner");
@@ -454,6 +511,17 @@ void embed_room_banner(char *got, int navbar_style) {
                                                "</span></a></td>\n", _("Month view")
                                        );
                                        break;
+                               case VIEW_CALBRIEF:
+                                       wprintf(
+                                               "<td>"
+                                               "<a href=\"readfwd?calview=month\">"
+                                               "<img align=\"middle\" src=\"static/monthview2_24x.gif\" "
+                                               "border=\"0\">"
+                                               "<span class=\"navbar_link\">"
+                                               "%s"
+                                               "</span></a></td>\n", _("Calendar list")
+                                       );
+                                       break;
                                case VIEW_TASKS:
                                        wprintf(
                                                "<td>"
@@ -524,8 +592,12 @@ void embed_room_banner(char *got, int navbar_style) {
                                        );
                                        break;
                                case VIEW_CALENDAR:
-                                       wprintf(
-                                               "<td><a href=\"display_enter\">"
+                               case VIEW_CALBRIEF:
+                                       wprintf("<td><a href=\"display_enter");
+                                       if (strlen(bstr("year")) > 0) wprintf("?year=%s", bstr("year"));
+                                       if (strlen(bstr("month")) > 0) wprintf("?month=%s", bstr("month"));
+                                       if (strlen(bstr("day")) > 0) wprintf("?day=%s", bstr("day"));
+                                       wprintf("\">"
                                                "<img align=\"middle\" src=\"static/addevent_24x.gif\" "
                                                "border=\"0\"><span class=\"navbar_link\">"
                                                "%s"
@@ -710,7 +782,7 @@ char *pop_march(int desired_floor)
  */
 void gotonext(void)
 {
-       char buf[SIZ];
+       char buf[256];
        struct march *mptr, *mptr2;
        char next_room[128];
 
@@ -786,15 +858,10 @@ void smart_goto(char *next_room) {
  */
 void slrp_highest(void)
 {
-       char buf[SIZ];
+       char buf[256];
 
-       /* set pointer */
        serv_puts("SLRP HIGHEST");
        serv_getln(buf, sizeof buf);
-       if (buf[0] != '2') {
-               wprintf("<EM>%s</EM><br />\n", &buf[4]);
-               return;
-       }
 }
 
 
@@ -943,10 +1010,10 @@ void display_editroom(void)
                "<TD>&nbsp;</TD>\n");
 
        if (!strcmp(tab, "admin")) {
-               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+               wprintf("<TD class=\"roomops_cell_label\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#CCCCCC\"><a href=\"display_editroom&tab=admin\">");
+               wprintf("<TD class=\"roomops_cell_edit\"><a href=\"display_editroom&tab=admin\">");
        }
        wprintf(_("Administration"));
        if (!strcmp(tab, "admin")) {
@@ -959,10 +1026,10 @@ void display_editroom(void)
        wprintf("<TD>&nbsp;</TD>\n");
 
        if (!strcmp(tab, "config")) {
-               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+               wprintf("<TD class=\"roomops_cell_label\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#CCCCCC\"><a href=\"display_editroom&tab=config\">");
+               wprintf("<TD class=\"roomops_cell_edit\"><a href=\"display_editroom&tab=config\">");
        }
        wprintf(_("Configuration"));
        if (!strcmp(tab, "config")) {
@@ -975,10 +1042,10 @@ void display_editroom(void)
        wprintf("<TD>&nbsp;</TD>\n");
 
        if (!strcmp(tab, "expire")) {
-               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+               wprintf("<TD class=\"roomops_cell_label\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#CCCCCC\"><a href=\"display_editroom&tab=expire\">");
+               wprintf("<TD class=\"roomops_cell_edit\"><a href=\"display_editroom&tab=expire\">");
        }
        wprintf(_("Message expire policy"));
        if (!strcmp(tab, "expire")) {
@@ -991,10 +1058,10 @@ void display_editroom(void)
        wprintf("<TD>&nbsp;</TD>\n");
 
        if (!strcmp(tab, "access")) {
-               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+               wprintf("<TD class=\"roomops_cell_label\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#CCCCCC\"><a href=\"display_editroom&tab=access\">");
+               wprintf("<TD class=\"roomops_cell_edit\"><a href=\"display_editroom&tab=access\">");
        }
        wprintf(_("Access controls"));
        if (!strcmp(tab, "access")) {
@@ -1007,10 +1074,10 @@ void display_editroom(void)
        wprintf("<TD>&nbsp;</TD>\n");
 
        if (!strcmp(tab, "sharing")) {
-               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+               wprintf("<TD class=\"roomops_cell_label\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#CCCCCC\"><a href=\"display_editroom&tab=sharing\">");
+               wprintf("<TD class=\"roomops_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
        }
        wprintf(_("Sharing"));
        if (!strcmp(tab, "sharing")) {
@@ -1023,10 +1090,10 @@ void display_editroom(void)
        wprintf("<TD>&nbsp;</TD>\n");
 
        if (!strcmp(tab, "listserv")) {
-               wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
+               wprintf("<TD class=\"roomops_cell_label\"><SPAN CLASS=\"tablabel\">");
        }
        else {
-               wprintf("<TD BGCOLOR=\"#CCCCCC\"><a href=\"display_editroom&tab=listserv\">");
+               wprintf("<TD class=\"roomops_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
        }
        wprintf(_("Mailing list service"));
        if (!strcmp(tab, "listserv")) {
@@ -1043,7 +1110,7 @@ void display_editroom(void)
 
        /** begin content of whatever tab is open now */
        wprintf("<div class=\"fix_scrollbar_bug\">"
-               "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
+               "<TABLE class=\"roomops_background\">\n"
                "<TR><TD>\n");
 
        if (!strcmp(tab, "admin")) {
@@ -1218,7 +1285,7 @@ void display_editroom(void)
                serv_puts("GETA");
                serv_getln(buf, sizeof buf);
                if (buf[0] != '2') {
-                       wprintf("<EM>%s</EM>\n", &buf[4]);
+                       wprintf("<em>%s</em>\n", &buf[4]);
                } else {
                        extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
                        wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
@@ -1293,7 +1360,7 @@ void display_editroom(void)
                wprintf("</I></B></TD></TR>\n"
                        "<TR><TD VALIGN=TOP>\n");
 
-               wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\"><TD>");
+               wprintf("<TABLE border=0 cellpadding=5><TR class=\"roomops_cell\"><TD>");
                wprintf(_("Remote node name"));
                wprintf("</TD><TD>");
                wprintf(_("Remote room name"));
@@ -1338,7 +1405,7 @@ void display_editroom(void)
 
                wprintf("</TABLE>\n");
                wprintf("</TD><TD VALIGN=TOP>\n");
-               wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\"><TD>");
+               wprintf("<TABLE border=0 cellpadding=5><TR class=\"roomops_cell\"><TD>");
                wprintf(_("Remote node name"));
                wprintf("</TD><TD>");
                wprintf(_("Remote room name"));
@@ -1886,7 +1953,7 @@ void display_entroom(void)
 
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n"
-               "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+               "<TABLE class=\"roomops_banner\"><TR><TD>"
                "<SPAN CLASS=\"titlebar\">");
        wprintf(_("Create a new room"));
        wprintf("</SPAN>"
@@ -1895,7 +1962,7 @@ void display_entroom(void)
        );
 
        wprintf("<div class=\"fix_scrollbar_bug\">"
-               "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
+               "<table class=\"roomops_background\"><tr><td>\n");
 
        wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
 
@@ -1936,10 +2003,12 @@ void display_entroom(void)
                "       }                                               "
                "\">\n");
        for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
-               wprintf("<OPTION %s VALUE=\"%d\">",
-                       ((i == 0) ? "SELECTED" : ""), i );
-               escputs(viewdefs[i]);
-               wprintf("</OPTION>\n");
+               if (is_view_allowed_as_default(i)) {
+                       wprintf("<OPTION %s VALUE=\"%d\">",
+                               ((i == 0) ? "SELECTED" : ""), i );
+                       escputs(viewdefs[i]);
+                       wprintf("</OPTION>\n");
+               }
        }
        wprintf("</SELECT>\n");
 
@@ -2097,7 +2166,7 @@ void display_private(char *rname, int req_pass)
 {
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n"
-               "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+               "<TABLE class=\"roomops_banner\"><TR><TD>"
                "<SPAN CLASS=\"titlebar\">");
        wprintf(_("Go to a hidden room"));
        wprintf("</SPAN>"
@@ -2189,7 +2258,7 @@ void display_zap(void)
        output_headers(1, 1, 2, 0, 0, 0);
 
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+       wprintf("<TABLE class=\"roomops_zap\"><TR><TD>");
        wprintf("<SPAN CLASS=\"titlebar\">");
        wprintf(_("Zap (forget/unsubscribe) the current room"));
        wprintf("</SPAN>\n");
@@ -2474,6 +2543,9 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
                else if (fold[i].view == VIEW_CALENDAR) {
                        wprintf("'static/calarea_16x.gif'");
                }
+               else if (fold[i].view == VIEW_CALBRIEF) {
+                       wprintf("'static/calarea_16x.gif'");
+               }
                else if (fold[i].view == VIEW_TASKS) {
                        wprintf("'static/taskmanag_16x.gif'");
                }
@@ -2681,6 +2753,9 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
                        else if (fold[i].view == VIEW_CALENDAR) {
                                icon = "calarea_16x.gif" ;
                        }
+                       else if (fold[i].view == VIEW_CALBRIEF) {
+                               icon = "calarea_16x.gif" ;
+                       }
                        else if (fold[i].view == VIEW_TASKS) {
                                icon = "taskmanag_16x.gif" ;
                        }
@@ -2921,7 +2996,7 @@ void knrooms(void)
 
        /** title bar */
        wprintf("<div id=\"banner\">\n"
-               "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+               "<TABLE class=\"roomops_banner\"><TR><TD>"
                "<SPAN CLASS=\"titlebar\">"
        );
        if (!strcasecmp(listviewpref, "rooms")) {