* All OS-level includes are now included from webcit.h instead of from
[citadel.git] / webcit / roomops.c
index d859aa2bc12d4c1ee654943a365291e64b0efac6..c587381df3d28ea2697fc00d697c5f6b72d279fa 100644 (file)
@@ -4,25 +4,6 @@
  * Lots of different room-related operations.
  */
 
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <signal.h>
 #include "webcit.h"
 
 struct folder {
@@ -256,9 +237,9 @@ void readinfo(void)
 
 
 
-/* Display room graphic.  The server doesn't actually
+/* Display room banner icon.  The server doesn't actually
  * need the room name, but we supply it in order to
- * keep the browser from using a cached graphic from 
+ * keep the browser from using a cached icon from 
  * another room.
  */
 void embed_room_graphic(void) {
@@ -267,13 +248,48 @@ void embed_room_graphic(void) {
        serv_puts("OIMG _roompic_");
        serv_getln(buf, sizeof buf);
        if (buf[0] == '2') {
-               wprintf("<TD BGCOLOR=\"#444455\">");
                wprintf("<IMG HEIGHT=64 SRC=\"/image&name=_roompic_&room=");
                urlescputs(WC->wc_roomname);
-               wprintf("\"></TD>");
+               wprintf("\">");
                serv_puts("CLOS");
                serv_getln(buf, sizeof buf);
        }
+       else if (WC->wc_view == VIEW_ADDRESSBOOK) {
+               wprintf("<img height=48 width=48 src=\""
+                       "static/viewcontacts_48x.gif"
+                       "\">"
+               );
+       }
+       else if (WC->wc_view == VIEW_CALENDAR) {
+               wprintf("<img height=48 width=48 src=\""
+                       "static/calarea_48x.gif"
+                       "\">"
+               );
+       }
+       else if (WC->wc_view == VIEW_TASKS) {
+               wprintf("<img height=48 width=48 src=\""
+                       "static/taskmanag_48x.gif"
+                       "\">"
+               );
+       }
+       else if (WC->wc_view == VIEW_NOTES) {
+               wprintf("<img height=48 width=48 src=\""
+                       "static/storenotes_48x.gif"
+                       "\">"
+               );
+       }
+       else if (WC->wc_view == VIEW_MAILBOX) {
+               wprintf("<img height=48 width=48 src=\""
+                       "static/privatemess_48x.gif"
+                       "\">"
+               );
+       }
+       else {
+               wprintf("<img height=48 width=48 src=\""
+                       "static/chatrooms_48x.gif"
+                       "\">"
+               );
+       }
 
 }
 
@@ -300,7 +316,7 @@ void embed_newmail_button(void) {
 void embed_view_o_matic(void) {
        int i;
 
-       wprintf("<FORM NAME=\"viewomatic\">\n"
+       wprintf("<form name=\"viewomatic\" action=\"/changeview\">\n"
                "<span class=\"room_banner_new_messages\">View as: "
                "<SELECT NAME=\"newview\" SIZE=\"1\" "
                "STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif;"
@@ -369,13 +385,13 @@ void embed_room_banner(char *got, int navbar_style) {
        if (navbar_style != navbar_none) {
 
                wprintf("<div style=\"position:absolute; bottom:0px; left:0px\">\n"
-                       "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\"><tr>\n");
+                       "<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>\n");
 
 
                if (navbar_style == navbar_default) wprintf(
                        "<td>"
                        "<a href=\"/ungoto\">"
-                       "<img align=\"middle\" src=\"/static/back.gif\" border=\"0\">"
+                       "<img align=\"middle\" src=\"/static/ungoto2_24x.gif\" border=\"0\">"
                        "<span class=\"navbar_link\">Ungoto</span></A>"
                        "</td>\n"
                );
@@ -384,7 +400,7 @@ void embed_room_banner(char *got, int navbar_style) {
                        wprintf(
                                "<td>"
                                "<A HREF=\"/readnew\">"
-                               "<img align=\"middle\" src=\"/static/readmsgs.gif\" border=\"0\">"
+                               "<img align=\"middle\" src=\"/static/newmess2_24x.gif\" border=\"0\">"
                                "<span class=\"navbar_link\">Read new messages</span></A>"
                                "</td>\n"
                        );
@@ -396,7 +412,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd\">"
-                                               "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
+                                               "<img align=\"middle\" src=\"/static/viewcontacts_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "View contacts"
@@ -407,7 +423,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd?calview=day\">"
-                                               "<img align=\"middle\" src=\"/static/day_view.gif\" "
+                                               "<img align=\"middle\" src=\"/static/taskday2_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "Day view"
@@ -416,7 +432,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd?calview=month\">"
-                                               "<img align=\"middle\" src=\"/static/month_view.gif\" "
+                                               "<img align=\"middle\" src=\"/static/monthview2_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "Month view"
@@ -427,7 +443,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd\">"
-                                               "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
+                                               "<img align=\"middle\" src=\"/static/taskmanag_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "View tasks"
@@ -438,7 +454,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd\">"
-                                               "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
+                                               "<img align=\"middle\" src=\"/static/viewnotes_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "View notes"
@@ -449,7 +465,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd\">"
-                                               "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
+                                               "<img align=\"middle\" src=\"/static/readallmess3_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "View message list"
@@ -460,7 +476,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        wprintf(
                                                "<td>"
                                                "<A HREF=\"/readfwd\">"
-                                               "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
+                                               "<img align=\"middle\" src=\"/static/readallmess3_24x.gif\" "
                                                "border=\"0\">"
                                                "<span class=\"navbar_link\">"
                                                "Read all messages"
@@ -471,38 +487,61 @@ void embed_room_banner(char *got, int navbar_style) {
                }
 
                if (navbar_style == navbar_default) {
-                       wprintf(
-                               "<td>"
-                               "<A HREF=\"/display_enter\">"
-                               "<img align=\"middle\" src=\"/static/enter.gif\" border=\"0\">"
-                               "<span class=\"navbar_link\">"
-                       );
                        switch(WC->wc_view) {
                                case VIEW_ADDRESSBOOK:
-                                       wprintf("Add new contact");
+                                       wprintf(
+                                               "<td><A HREF=\"/display_enter\">"
+                                               "<img align=\"middle\" src=\"/static/addnewcontact_24x.gif\" "
+                                               "border=\"0\"><span class=\"navbar_link\">"
+                                               "Add new contact"
+                                               "</span></a></td>\n"
+                                       );
                                        break;
                                case VIEW_CALENDAR:
-                                       wprintf("Add new event");
+                                       wprintf(
+                                               "<td><A HREF=\"/display_enter\">"
+                                               "<img align=\"middle\" src=\"/static/addevent_24x.gif\" "
+                                               "border=\"0\"><span class=\"navbar_link\">"
+                                               "Add new event"
+                                               "</span></a></td>\n"
+                                       );
                                        break;
                                case VIEW_TASKS:
-                                       wprintf("Add new task");
+                                       wprintf(
+                                               "<td><A HREF=\"/display_enter\">"
+                                               "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
+                                               "border=\"0\"><span class=\"navbar_link\">"
+                                               "Add new task"
+                                               "</span></a></td>\n"
+                                       );
                                        break;
                                case VIEW_NOTES:
-                                       wprintf("Add new note");
+                                       wprintf(
+                                               "<td><A HREF=\"/display_enter\">"
+                                               "<img align=\"middle\" src=\"/static/enternewnote_24x.gif\" "
+                                               "border=\"0\"><span class=\"navbar_link\">"
+                                               "Add new note"
+                                               "</span></a></td>\n"
+                                       );
                                        break;
                                default:
-                                       wprintf("Enter a message");
+                                       wprintf(
+                                               "<td><A HREF=\"/display_enter\">"
+                                               "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
+                                               "border=\"0\"><span class=\"navbar_link\">"
+                                               "Enter a message"
+                                               "</span></a></td>\n"
+                                       );
                                        break;
                        }
-                       wprintf("</span></a></td>\n");
                }
 
                if (navbar_style == navbar_default) wprintf(
                        "<td>"
                        "<A HREF=\"/skip\" "
                        "TITLE=\"Leave all messages marked as unread, go to next room with unread messages\">"
-                       "<span class=\"navbar_link\">Skip this room</span>"
-                       "<img align=\"middle\" src=\"/static/forward.gif\" border=\"0\"></A>"
+                       "<img align=\"middle\" src=\"/static/skipthisroom_24x.gif\" border=\"0\">"
+                       "<span class=\"navbar_link\">Skip this room</span></a>"
                        "</td>\n"
                );
 
@@ -510,8 +549,8 @@ void embed_room_banner(char *got, int navbar_style) {
                        "<td>"
                        "<A HREF=\"/gotonext\" "
                        "TITLE=\"Mark all messages as read, go to next room with unread messages\">"
-                       "<span class=\"navbar_link\">Goto next room</span>"
-                       "<img align=\"middle\" src=\"/static/forward.gif\" border=\"0\"></A>"
+                       "<img align=\"middle\" src=\"/static/markngo_24x.gif\" border=\"0\">"
+                       "<span class=\"navbar_link\">Goto next room</span></a>"
                        "</td>\n"
                );
 
@@ -952,7 +991,7 @@ void display_editroom(void)
                        "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
                        "Delete this room</A>\n"
                        "<LI><A HREF=\"/display_editroompic\">\n"
-                       "Set or change the graphic for this room's banner</A>\n"
+                       "Set or change the icon for this room's banner</A>\n"
                        "<LI><A HREF=\"/display_editinfo\">\n"
                        "Edit this room's Info file</A>\n"
                        "</UL>");
@@ -1936,7 +1975,7 @@ void display_private(char *rname, int req_pass)
        wprintf("so you don't have to keep returning here.\n");
        wprintf("<br /><br />");
 
-       wprintf("<FORM METHOD=\"GET\" ACTION=\"/goto_private\">\n");
+       wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
 
        wprintf("<table border=\"0\" cellspacing=\"5\" "
                "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
@@ -2012,7 +2051,7 @@ void display_zap(void)
        wprintf("disappear from your room list.  Is this what you wish ");
        wprintf("to do?<br />\n");
 
-       wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
+       wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
        wprintf("&nbsp;");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
@@ -2272,7 +2311,7 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
                        wprintf("new Array(closedGif, openGif)");
                }
                else if (fold[i].view == VIEW_ADDRESSBOOK) {
-                       wprintf("'static/savecontact_16x.gif'");
+                       wprintf("'static/viewcontacts_16x.gif'");
                }
                else if (fold[i].view == VIEW_CALENDAR) {
                        wprintf("'static/calarea_16x.gif'");
@@ -2529,7 +2568,7 @@ void knrooms() {
        /* Determine whether the user is trying to change views */
        if (bstr("view") != NULL) {
                if (strlen(bstr("view")) > 0) {
-                       set_preference("roomlistview", bstr("view"));
+                       set_preference("roomlistview", bstr("view"), 1);
                }
        }