* Better alignment of system messages
authorArt Cancro <ajc@citadel.org>
Sat, 21 Jun 2003 05:17:24 +0000 (05:17 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 21 Jun 2003 05:17:24 +0000 (05:17 +0000)
* Exterminated display_error() and replaced it with WC->ImportantMessage
  which is displayed in a bubble on top of whatever page you're on next.
* Small cosmetic changes
* Fixed some nesting problems in output_headers()

16 files changed:
webcit/ChangeLog
webcit/auth.c
webcit/graphics.c
webcit/messages.c
webcit/netconf.c
webcit/paging.c
webcit/roomops.c
webcit/serv_func.c
webcit/siteconfig.c
webcit/static/login.html
webcit/static/style.css
webcit/subst.c
webcit/sysmsgs.c
webcit/userlist.c
webcit/webcit.c
webcit/webcit.h

index 310b013a640a1feca591cddd1f48709247a647ef..30036251d738832881eb710ada81ad98f2ef0657 100644 (file)
@@ -1,4 +1,11 @@
 $Log$
+Revision 500.3  2003/06/21 05:17:21  ajc
+* Better alignment of system messages
+* Exterminated display_error() and replaced it with WC->ImportantMessage
+  which is displayed in a bubble on top of whatever page you're on next.
+* Small cosmetic changes
+* Fixed some nesting problems in output_headers()
+
 Revision 500.2  2003/06/20 03:39:27  ajc
 * Optimization to floor layout in box view
 
@@ -1492,3 +1499,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index 04f755e2bafc7e34bbce6cd8dbcb92a4ac0963e4..5f44773948daf0d5df5d4e6b1c52fb9e3c1cb890 100644 (file)
@@ -191,7 +191,7 @@ void do_logout(void)
 
        if (WC->serv_sock >= 0) {
                if (buf[0] == '1') {
-                       fmout(NULL);
+                       fmout(NULL, "CENTER");
                } else {
                        wprintf("Goodbye\n");
                }
@@ -337,7 +337,7 @@ void display_changepw(void)
        serv_puts("MESG changepw");
        serv_gets(buf);
        if (buf[0] == '1') {
-               fmout(NULL);
+               fmout(NULL, "CENTER");
        }
 
        wprintf("<FORM ACTION=\"changepw\" METHOD=\"POST\">\n");
@@ -366,20 +366,22 @@ void changepw(void)
        char newpass1[32], newpass2[32];
 
        if (strcmp(bstr("action"), "Change")) {
-               display_error("Cancelled.  Password was not changed.");
+               strcpy(WC->ImportantMessage, 
+                       "Cancelled.  Password was not changed.");
+               display_main_menu();
                return;
        }
        strcpy(newpass1, bstr("newpass1"));
        strcpy(newpass2, bstr("newpass2"));
 
        if (strcasecmp(newpass1, newpass2)) {
-               display_error("They don't match.  Password was not changed.");
+               strcpy(WC->ImportantMessage, 
+                       "They don't match.  Password was not changed.");
+               display_main_menu();
                return;
        }
        serv_printf("SETP %s", newpass1);
        serv_gets(buf);
-       if (buf[0] == '2')
-               display_success(&buf[4]);
-       else
-               display_error(&buf[4]);
+       strcpy(WC->ImportantMessage, &buf[4]);
+       display_main_menu();
 }
index 9922e1dbf0e796aedc394d642321a8d1693c5805..3cfb9533cb630d6250eca351524001886b5248cb 100644 (file)
@@ -27,7 +27,8 @@ void display_graphics_upload(char *description, char *check_cmd, char *uplurl)
        serv_puts(check_cmd);
        serv_gets(buf);
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        output_headers(3);
@@ -68,18 +69,23 @@ void do_graphics_upload(char *upl_cmd)
        int thisblock;
 
        if (!strcasecmp(bstr("sc"), "Cancel")) {
+               strcpy(WC->ImportantMessage,
+                       "Graphics upload cancelled.");
                display_main_menu();
                return;
        }
 
        if (WC->upload_length == 0) {
-               display_error("You didn't upload a file.\n");
+               strcpy(WC->ImportantMessage,
+                       "You didn't upload a file.");
+               display_main_menu();
                return;
        }
        serv_puts(upl_cmd);
        serv_gets(buf);
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        bytes_remaining = WC->upload_length;
@@ -88,9 +94,10 @@ void do_graphics_upload(char *upl_cmd)
                serv_printf("WRIT %d", thisblock);
                serv_gets(buf);
                if (buf[0] != '7') {
-                       display_error(&buf[4]);
+                       strcpy(WC->ImportantMessage, &buf[4]);
                        serv_puts("UCLS 0");
                        serv_gets(buf);
+                       display_main_menu();
                        return;
                }
                thisblock = extract_int(&buf[4], 0);
index 3f2762f197fa0f41a532715a86dbf22c24f4fda6..5988a9599d87ceb348b89311e8e9dc6f7073a3dc 100644 (file)
@@ -364,10 +364,13 @@ void read_message(long msgnum) {
        wprintf("<TD ALIGN=RIGHT>\n"
                "<TABLE BORDER=0><TR>\n");
 
-       wprintf("<TD BGCOLOR=\"#AAAADD\">"
-               "<A HREF=\"/readfwd?startmsg=%ld", msgnum);
-       wprintf("&maxmsgs=1&summary=0\">Read</A>"
-               "</TD>\n", msgnum);
+       /***  "Read" button is now superfluous
+        ***
+        ***wprintf("<TD BGCOLOR=\"#AAAADD\">"
+        ***    "<A HREF=\"/readfwd?startmsg=%ld", msgnum);
+        ***wprintf("&maxmsgs=1&summary=0\">Read</A>"
+        ***    "</TD>\n", msgnum);
+        ***/
 
        wprintf("<TD BGCOLOR=\"#AAAADD\">"
                "<A HREF=\"/display_enter?recp=");
@@ -424,7 +427,7 @@ void read_message(long msgnum) {
 
        /* Messages in legacy Citadel variformat get handled thusly... */
        if (!strcasecmp(mime_content_type, "text/x-citadel-variformat")) {
-               fmout(NULL);
+               fmout(NULL, "JUSTIFY");
        }
 
        /* Boring old 80-column fixed format text gets handled this way... */
@@ -1088,13 +1091,13 @@ void post_message(void)
                return;
        }
 
-       output_headers(1);
-
        if (strcasecmp(bstr("sc"), "Save message")) {
-               wprintf("Cancelled.  Message was not posted.<BR>\n");
+               sprintf(WC->ImportantMessage, 
+                       "Cancelled.  Message was not posted.");
        } else if (atol(bstr("postseq")) == dont_post) {
-               wprintf("Automatically cancelled because you have already "
-                       "saved this message.<BR>\n");
+               sprintf(WC->ImportantMessage, 
+                       "Automatically cancelled because you have already "
+                       "saved this message.");
        } else {
                sprintf(buf, "ENT0 1|%s|0|4|%s",
                        bstr("recp"),
@@ -1103,15 +1106,17 @@ void post_message(void)
                serv_gets(buf);
                if (buf[0] == '4') {
                        post_mime_to_server();
-                       wprintf("Message has been posted.<BR>\n");
+                       sprintf(WC->ImportantMessage, 
+                               "Message has been posted.\n");
                        dont_post = atol(bstr("postseq"));
                } else {
-                       wprintf("<EM>%s</EM><BR>\n", &buf[4]);
+                       sprintf(WC->ImportantMessage, 
+                               "%s", &buf[4]);
                }
        }
 
-       wDumpContent(1);
        free_attachments(WC);
+       readloop("readnew");
 }
 
 
index 211c2ef18e8b8bf9873722f7c77f891a32f38074..0131447cfb38e5307b3fc70c82a1b1cb0c844d8f 100644 (file)
@@ -274,7 +274,8 @@ void add_node(void)
                        wprintf("<A HREF=\"/display_netconf\">Back to menu</A>\n");
                        wDumpContent(1);
                } else {
-                       display_error(&buf[4]);
+                       strcpy(WC->ImportantMessage, &buf[4]);
+                       display_netconf();
                }
        }
 }
index 45514d5457c903db50494424535d2c918bcc61e0..690aa6db12558230a0d13820467601be4736ed64 100644 (file)
@@ -161,7 +161,7 @@ void page_popup(void)
                escputs(pagefrom);
                wprintf("</SPAN></TD></TR></TABLE>\n");
                
-               fmout(NULL);
+               fmout(NULL, "LEFT");
        }
 
        wprintf("<CENTER>");
index aaac83ae69380bfc01df194204ba459bf38a7b55..8f580df660c3fbe37214289de3fa88dbe52f78b3 100644 (file)
@@ -301,7 +301,7 @@ void readinfo(void)
        serv_puts("RINF");
        serv_gets(buf);
        if (buf[0] == '1') {
-               fmout(NULL);
+               fmout(NULL, "CENTER");
        }
 }
 
@@ -743,7 +743,8 @@ void display_editroom(void)
        serv_gets(buf);
 
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        extract(er_name, &buf[4], 0);
@@ -1178,14 +1179,17 @@ void editroom(void)
 
 
        if (strcmp(bstr("sc"), "OK")) {
-               display_error("Cancelled.  Changes were not saved.");
+               strcpy(WC->ImportantMessage,
+                       "Cancelled.  Changes were not saved.");
+               display_main_menu();
                return;
        }
        serv_puts("GETR");
        serv_gets(buf);
 
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        extract(er_name, &buf[4], 0);
@@ -1291,7 +1295,8 @@ void editroom(void)
        serv_puts(buf);
        serv_gets(buf);
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        gotoroom(er_name, 0);
@@ -1301,7 +1306,8 @@ void editroom(void)
                serv_puts(buf);
                serv_gets(buf);
                if (buf[0] != '2') {
-                       display_error(&buf[4]);
+                       strcpy(WC->ImportantMessage, &buf[4]);
+                       display_main_menu();
                        return;
                }
        }
@@ -1319,28 +1325,24 @@ void display_whok(void)
         serv_gets(buf);
 
         if (buf[0] != '2') {
-                display_error(&buf[4]);
-                return;
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
+               return;
         }
         extract(room, &buf[4], 0);
 
         strcpy(username, bstr("username"));
 
-        output_headers(1);
-       stresc(buf, WC->wc_roomname, 1);
-       svprintf("BOXTITLE", WCS_STRING, "Access control list for %s", buf);
-       do_template("beginbox");
-
         if(!strcmp(bstr("sc"), "Kick")) {
                 sprintf(buf, "KICK %s", username);
                 serv_puts(buf);
                 serv_gets(buf);
 
                 if (buf[0] != '2') {
-                        display_error(&buf[4]);
-                        return;
+                        strcpy(WC->ImportantMessage, &buf[4]);
                 } else {
-                        wprintf("<B><I>User %s kicked out of room %s.</I></B>\n", 
+                        sprintf(WC->ImportantMessage,
+                               "<B><I>User %s kicked out of room %s.</I></B>\n", 
                                 username, room);
                 }
         } else if(!strcmp(bstr("sc"), "Invite")) {
@@ -1349,15 +1351,18 @@ void display_whok(void)
                 serv_gets(buf);
 
                 if (buf[0] != '2') {
-                        display_error(&buf[4]);
-                        return;
+                        strcpy(WC->ImportantMessage, &buf[4]);
                 } else {
-                        wprintf("<B><I>User %s invited to room %s.</I></B>\n", 
+                        sprintf(WC->ImportantMessage,
+                               "<B><I>User %s invited to room %s.</I></B>\n", 
                                 username, room);
                 }
         }
         
-
+        output_headers(1);
+       stresc(buf, WC->wc_roomname, 1);
+       svprintf("BOXTITLE", WCS_STRING, "Access control list for %s", buf);
+       do_template("beginbox");
 
        wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
                "<TD>The users listed below have access to this room.  "
@@ -1411,7 +1416,8 @@ void display_entroom(void)
        serv_gets(buf);
 
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        output_headers(3);
@@ -1464,7 +1470,7 @@ void display_entroom(void)
        serv_printf("MESG roomaccess");
        serv_gets(buf);
        if (buf[0] == '1') {
-               fmout(NULL);
+               fmout(NULL, "CENTER");
        }
        do_template("endbox");
        wDumpContent(1);
@@ -1485,7 +1491,9 @@ void entroom(void)
        int er_num_type;
 
        if (strcmp(bstr("sc"), "OK")) {
-               display_error("Cancelled.  No new room was created.");
+               strcpy(WC->ImportantMessage,
+                       "Cancelled.  No new room was created.");
+               display_main_menu();
                return;
        }
        strcpy(er_name, bstr("er_name"));
@@ -1508,7 +1516,8 @@ void entroom(void)
        serv_puts(buf);
        serv_gets(buf);
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        smart_goto(er_name);
@@ -1660,7 +1669,8 @@ void confirm_delete_room(void)
        serv_puts("KILL 0");
        serv_gets(buf);
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        output_headers(1);
@@ -1694,13 +1704,17 @@ void delete_room(void)
        strcpy(sc, bstr("sc"));
 
        if (strcasecmp(sc, "Delete")) {
-               display_error("Cancelled.  This room was not deleted.");
+               strcpy(WC->ImportantMessage,
+                       "Cancelled.  This room was not deleted.");
+               display_main_menu();
                return;
        }
        serv_puts("KILL 1");
        serv_gets(buf);
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
+               return;
        } else {
                smart_goto("_BASEROOM_");
        }
index 40b91153479b43201c18da5a3149281cf1d69a51..e99037e0828d56f4da2d2f6ced708e11ba379c86 100644 (file)
@@ -100,14 +100,14 @@ void get_serv_info(char *browser_host, char *user_agent)
  * If fp is non-null, it is considered to be the file handle to read the
  * text from.  Otherwise, text is read from the server.
  */
-void fmout(FILE * fp)
+void fmout(FILE *fp, char *align)
 {
 
        int intext = 0;
        int bq = 0;
        char buf[SIZ];
 
-       wprintf("<DIV ALIGN=JUSTIFY>\n");
+       wprintf("<DIV ALIGN=%s>\n", align);
        while (1) {
                if (fp == NULL)
                        serv_gets(buf);
index dbe743ecf84b042c2b1ab369e434101180389e52..239efb0571249dadddad14148d661fc86f3ff15e 100644 (file)
@@ -225,7 +225,8 @@ void siteconfig(void)
        serv_printf("CONF set");
        serv_gets(buf);
        if (buf[0] != '4') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        serv_printf("%s", bstr("c_nodename"));
index d80cf91b6a963f76a5f48052ec08ec3ff5cba7cb..7fc2a9aaeaebf696dffe6183a9f9c42ed765a4a7 100644 (file)
@@ -4,7 +4,7 @@
 <TABLE border=0>
 <TR>
 <td align=center>
-       <p><?HELLO></p>
+       <?HELLO>
        <form action="/login" method="POST">
 
        <table border="0" cellspacing="5" cellpadding="5" BGCOLOR="#EEEEEE">
index d34f52cae4838c052e60a3b23eec54aa2c80293b..82bfc3b8db4620d398f0c86083f872004231d489 100644 (file)
@@ -1,15 +1,15 @@
 a:link {
-  color: #FF0000;
+  color: #0000FF;
   text-decoration: none;
 }
 
 a:visited {
-  color: #800080;
+  color: #0000FF;
   text-decoration: none;
 }
 
 a:active {
-  color: #00FF00;
+  color: #0000FF;
   text-decoration: none;
 }
 
@@ -241,8 +241,6 @@ dt a {
   background: none
 }
 
-.example { margin-left: 10% }
-
 dfn {
   font-style: normal;
   font-weight: bolder
index 97d00ed6fc9bbcf4365fd0e6ead8df1b91a2b833..87441c5e240d01434fda35c5854dc6f19df5d6c3 100644 (file)
@@ -122,7 +122,7 @@ void pvo_do_cmd(char *servcmd) {
                        wprintf("%s\n", &buf[4]);
                        break;
                case '1':
-                       fmout(NULL);
+                       fmout(NULL, "CENTER");
                        break;
                case '4':
                        wprintf("%s\n", &buf[4]);
index 029bd0e456cec386138f315c7ff4254c3a4e97e0..d4b6545d444a8300aea2d52f37acf6623cc338f3 100644 (file)
@@ -40,7 +40,8 @@ void display_edit(char *description, char *check_cmd,
        serv_gets(buf);
 
        if (buf[0] != '2') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        output_headers(headers_type);
@@ -78,15 +79,16 @@ void save_edit(char *description, char *enter_cmd, int regoto)
        char buf[SIZ];
 
        if (strcmp(bstr("sc"), "Save")) {
-               output_headers(1);
-               wprintf("Cancelled.  %s was not saved.<BR>\n", description);
-               wDumpContent(1);
+               sprintf(WC->ImportantMessage,
+                       "Cancelled.  %s was not saved.\n", description);
+               display_main_menu();
                return;
        }
        serv_puts(enter_cmd);
        serv_gets(buf);
        if (buf[0] != '4') {
-               display_error(&buf[4]);
+               strcpy(WC->ImportantMessage, &buf[4]);
+               display_main_menu();
                return;
        }
        text_to_server(bstr("msgtext"), 0);
@@ -95,8 +97,9 @@ void save_edit(char *description, char *enter_cmd, int regoto)
        if (regoto) {
                smart_goto(WC->wc_roomname);
        } else {
-               output_headers(1);
-               wprintf("%s has been saved.\n", description);
-               wDumpContent(1);
+               sprintf(WC->ImportantMessage,
+                       "%s has been saved.\n", description);
+               display_main_menu();
+               return;
        }
 }
index 62190c1bb3ecd0ec3863d43292b5e795365901af..a20028c029766ba6587867c0f41947928ca3a611 100644 (file)
@@ -141,7 +141,7 @@ void showuser(void)
        serv_printf("RBIO %s", who);
        serv_gets(buf);
        if (buf[0] == '1') {
-               fmout(NULL);
+               fmout(NULL, "JUSTIFY");
        }
        wprintf("<BR><A HREF=\"/display_page&recp=");
        urlescputs(who);
index 58f4f5e6304e7f58b6ec314d3f42ee3fc5e0c36c..0335f5802984c41038464d44bf1029cd65533e6f 100644 (file)
@@ -304,8 +304,10 @@ void output_headers(int controlcode)
                        "Cache-Control: no-store\n"
                );
        }
+
        stuff_to_cookie(cookie, WC->wc_session, WC->wc_username,
                        WC->wc_password, WC->wc_roomname);
+
        if (print_standard_html_head == 2) {
                wprintf("Set-cookie: webcit=%s\n", unset);
        } else {
@@ -346,14 +348,20 @@ void output_headers(int controlcode)
 
                do_template("background");
                clear_local_substs();
+       }
 
        if (print_standard_html_head == 1) {
                wprintf("<A NAME=\"TheTop\"></A>");
-
                embed_room_banner(NULL);
-
-               }
        }
+
+       if (strlen(WC->ImportantMessage) > 0) {
+               do_template("beginbox_nt");
+               wprintf("<SPAN CLASS=\"errormsg\">"
+                       "%s</SPAN><BR>\n", WC->ImportantMessage);
+               do_template("endbox");
+               strcpy(WC->ImportantMessage, "");
+       }       
 }
 
 
@@ -628,7 +636,9 @@ void offer_start_page(void) {
 void change_start_page(void) {
 
        if (bstr("startpage") == NULL) {
-               display_error("startpage set to null");
+               strcpy(WC->ImportantMessage,
+                       "startpage set to null");
+               display_main_menu();
                return;
        }
 
@@ -642,11 +652,6 @@ void change_start_page(void) {
 
 
 
-void display_error(char *errormessage)
-{
-       convenience_page("770000", "Error", errormessage);
-}
-
 void display_success(char *successmessage)
 {
        convenience_page("007700", "OK", successmessage);
@@ -693,9 +698,6 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
 {
        struct urlcontent *u;
 
-       lprintf(5, "Upload handler called: %s, %ld bytes\n",
-               cbtype, (long)length);
-
        /* Form fields */
        if ( (length > 0) && (strlen(cbtype) == 0) ) {
                u = (struct urlcontent *) malloc(sizeof(struct urlcontent));
@@ -719,8 +721,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
                        memcpy(WC->upload, content, length);
                }
                else {
-                       lprintf(9, "malloc() failed: %s\n",
-                               strerror(errno));
+                       lprintf(3, "malloc() failed: %s\n", strerror(errno));
                }
        }
 
@@ -782,11 +783,9 @@ void session_loop(struct httprequest *req)
                                      c_username, c_password, c_roomname);
                }
                else if (!strncasecmp(buf, "Content-length: ", 16)) {
-                       lprintf(9, "%s\n", buf);
                        ContentLength = atoi(&buf[16]);
                }
                else if (!strncasecmp(buf, "Content-type: ", 14)) {
-                       lprintf(9, "%s\n", buf);
                        safestrncpy(ContentType, &buf[14], sizeof ContentType);
                }
                else if (!strncasecmp(buf, "User-agent: ", 12)) {
@@ -822,7 +821,6 @@ void session_loop(struct httprequest *req)
                        addurls(&content[body_start]);
                } else if (!strncasecmp(ContentType, "multipart", 9)) {
                        content_end = content + ContentLength + body_start;
-                       lprintf(9, "Calling MIME parser\n");
                        mime_parser(content, content_end, *upload_handler,
                                        NULL, NULL, NULL, 0);
                }
index 39a5d39c87e73a04f927975cc06d19f28104f7bf..f7a712bce6a3adfc3ba8c78fc18517fa14a4b265 100644 (file)
@@ -213,6 +213,7 @@ struct wcsession {
        int num_cal;
 #endif
        struct wc_attachment *first_attachment;
+       char ImportantMessage[SIZ];
 };
 
 #define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')
@@ -251,7 +252,7 @@ int tcp_connectsock(char *, char *);
 void serv_gets(char *strbuf);
 void serv_puts(char *string);
 void whobbs(void);
-void fmout(FILE * fp);
+void fmout(FILE *fp, char *align);
 void wDumpContent(int);
 void serv_printf(const char *format,...);
 char *bstr(char *key);
@@ -289,7 +290,6 @@ void goto_private(void);
 void zapped_list(void);
 void display_zap(void);
 void zap(void);
-void display_error(char *);
 void display_success(char *);
 void display_entroom(void);
 void entroom(void);