]> code.citadel.org Git - citadel.git/blobdiff - webcit/mainmenu.c
* Repaired all my b0rken COLOR tags
[citadel.git] / webcit / mainmenu.c
index c780ef4ef666d9d34ddd25bdb153dd510fe2a2ac..850e10845755dbfbd44ecd2b45f3b7a3a191ff76 100644 (file)
@@ -1,24 +1,43 @@
 /* $Id$ */
 
+
+
+
+#include <ctype.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdio.h>
-#include <ctype.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"
-#include "child.h"
 
 
-/* 
- * menu of commands (just the menu html itself)
- */
 
-void embed_main_menu(void)
+/*
+ * The Main Menu
+ */
+void display_main_menu(void)
 {
-       wprintf("<CENTER><TABLE border=0><TR>");
+       output_headers(1);
+
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770077\"><TR><TD>"
+               "<SPAN CLASS=\"titlebar\">Basic commands</SPAN>\n"
+               "</TD></TR></TABLE>\n"
+               "<CENTER><TABLE border=0><TR>"
+       );
 
        wprintf("<TD>");        /* start of first column */
 
@@ -35,10 +54,10 @@ void embed_main_menu(void)
        wprintf("Skip to next room</B></A><BR>\n");
        wprintf("(come back here later)</LI>\n");
 
-       if ((strlen(ugname) > 0) && (strcasecmp(ugname, wc_roomname))) {
+       if ((strlen(WC->ugname) > 0) && (strcasecmp(WC->ugname, WC->wc_roomname))) {
                wprintf("<LI><B><A HREF=\"/ungoto\">\n");
                wprintf("Ungoto</B></A><BR>\n");
-               wprintf("(oops! Back to %s)</LI>\n", ugname);
+               wprintf("(oops! Back to %s)</LI>\n", WC->ugname);
        }
        wprintf("</UL>\n");
 
@@ -58,42 +77,28 @@ void embed_main_menu(void)
        wprintf("</TD><TD>");   /* start of third column */
 
        wprintf("<UL>");
-       wprintf("<LI><B><A HREF=\"/whobbs\">\n");
-       wprintf("Who is online?</B></A><BR>(users <EM>currently</EM> logged on)</LI>\n");
+       wprintf("<LI><B><A HREF=\"/summary\">\n");
+       wprintf("Summary page</B></A><BR>Summary of my account</LI>\n");
 
        wprintf("<LI><B><A HREF=\"/userlist\">\n");
        wprintf("User list</B></A><BR>(all registered users)</LI>\n");
 
-       wprintf("<LI><B><A HREF=\"/advanced\">\n");
-       wprintf("Advanced options</B></A><BR>...and maintenance</LI>\n");
-
-       wprintf("<LI><B><A HREF=\"/termquit\">\n");
+       wprintf("<LI><B><A HREF=\"/termquit\" TARGET=\"_top\">\n");
        wprintf("Log off</B></A><BR>Bye!</LI>\n");
        wprintf("</UL>\n");
 
        wprintf("</TR></TABLE>\n");
 
-       wprintf("</CENTER>\n");
-}
-
-/*
- * advanced options
- */
-void embed_advanced_menu(void)
-{
-
-       wprintf("<TABLE WIDTH=100%><TR VALIGN=TOP><TD>");
-
+       wprintf("<TABLE WIDTH=100%%><TR VALIGN=TOP><TD>");
 
-       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
-       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-       wprintf("<B>Interaction</B>\n");
-       wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+       wprintf("<SPAN CLASS=\"titlebar\">Interaction</SPAN>\n");
+       wprintf("</TD></TR></TABLE>\n");
 
        wprintf("<UL>");
-       wprintf("<LI><A HREF=\"/display_page\">\n");
-       wprintf("Page another user</A>\n");
-
+       wprintf("<LI><A HREF=\"/whobbs\">\n");
+       wprintf("Who is online?</A><font size=-2> "
+               "(users <EM>currently</EM> logged on)</font>\n");
        wprintf("<LI><A HREF=\"/chat\">");
        wprintf("Chat with other online users</A>\n");
 
@@ -104,10 +109,9 @@ void embed_advanced_menu(void)
 
        wprintf("</TD><TD>");
 
-       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
-       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-       wprintf("<B>Your info</B>\n");
-       wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#007700\"><TR><TD>");
+       wprintf("<SPAN CLASS=\"titlebar\">Your info</SPAN>\n");
+       wprintf("</TD></TR></TABLE>\n");
 
        wprintf("<UL>");
        wprintf("<LI><A HREF=\"/display_editbio\">\n");
@@ -127,10 +131,9 @@ void embed_advanced_menu(void)
 
        wprintf("</TD></TR><TR VALIGN=TOP><TD>");
 
-       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
-       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-       wprintf("<B>Advanced room commands</B>\n");
-       wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#000077\"><TR><TD>");
+       wprintf("<SPAN CLASS=\"titlebar\">Advanced room commands</SPAN>\n");
+       wprintf("</TD></TR></TABLE>\n");
 
        wprintf("<UL>");
        wprintf("<LI><A HREF=\"/display_private\">\n");
@@ -140,7 +143,10 @@ void embed_advanced_menu(void)
        wprintf("Create a new room</A>\n");
 
        wprintf("<LI><A HREF=\"/display_zap\">");
-       wprintf("Zap (forget) this room (%s)</A>\n", wc_roomname);
+       wprintf("Zap (forget) this room (%s)</A>\n", WC->wc_roomname);
+
+        wprintf("<LI><A HREF=\"/display_whok\">\n");
+        wprintf("Access controls for this room</A>\n");
 
        wprintf("<LI><A HREF=\"/zapped_list\">");
        wprintf("List all forgotten rooms</A>\n");
@@ -149,72 +155,41 @@ void embed_advanced_menu(void)
 
        wprintf("</TD><TD>");
 
-       if ((axlevel >= 6) || (is_room_aide)) {
-               wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007777><TR><TD>");
-               wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-               wprintf("<B>Administrative functions</B>\n");
-               wprintf("</FONT></TD></TR></TABLE>\n");
+       if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
+               wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#007777\"><TR><TD>");
+               wprintf("<SPAN CLASS=\"titlebar\">Administrative functions</SPAN>\n");
+               wprintf("</TD></TR></TABLE>\n");
 
                wprintf("<UL>");
                wprintf("<LI><A HREF=\"/display_editroom\">\n");
-               wprintf("Edit this room</A>\n");
-
-               wprintf("<LI><A HREF=\"/confirm_delete_room\">\n");
-               wprintf("Delete this room</A>\n");
-
-               wprintf("<LI><A HREF=\"/display_editroompic\">\n");
-               wprintf("Set or change the graphic for this room's banner</A>\n");
-
-               wprintf("<LI><A HREF=\"/display_editinfo\">\n");
-               wprintf("Edit this room's Info file</A>\n");
+               wprintf("Edit or delete this room</A>\n");
 
                wprintf("<LI><A HREF=\"/display_siteconfig\">\n");
                wprintf("Edit site-wide configuration</A>\n");
 
-               if (axlevel >= 6) {
+               if (WC->axlevel >= 6) {
+                       wprintf("<LI><A HREF=\"/select_user_to_edit\">\n");
+                       wprintf("Add, change, delete user accounts</A>\n");
+
                        wprintf("<LI><A HREF=\"/validate\">\n");
                        wprintf("Validate new users</A>\n");
 
-                       wprintf("<LI><A HREF=\"/select_floor_to_edit_pic\">\n");
-                       wprintf("Set or change a floor label graphic</A>\n");
+                       wprintf("<LI><A HREF=\"/display_floorconfig\">\n");
+                       wprintf("Add, change, or delete floors</A>\n");
 
                        wprintf("<LI><A HREF=\"/display_netconf\">\n");
                        wprintf("Configure networking with other systems</A>\n");
+                       wprintf("<LI><A HREF=\"/static/colorpicker.html\">\n");
+                       wprintf("Reconfigure color scheme</A>\n");
                }
                wprintf("</UL>\n");
        }
        wprintf("</TD></TR></TABLE>");
-
-       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
-       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-       wprintf("<B>Basic commands</B>\n");
-       wprintf("</FONT></TD></TR></TABLE>\n");
-
-}
-
-
-
-
-/*
- * menu of commands (as a page)
- */
-void display_main_menu(void)
-{
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
-       embed_main_menu();
        wDumpContent(2);
 }
 
 
-void display_advanced_menu(void)
-{
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
-       embed_advanced_menu();
-       embed_main_menu();
-       wDumpContent(2);
-}
+
 
 
 /*
@@ -222,13 +197,11 @@ void display_advanced_menu(void)
  */
 void display_generic(void)
 {
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
+       output_headers(1);
 
-       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
-       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-       wprintf("<B>Enter a server command</B>\n");
-       wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770077\"><TR><TD>");
+       wprintf("<SPAN CLASS=\"titlebar\">Enter a server command</SPAN>\n");
+       wprintf("</TD></TR></TABLE>\n");
 
        wprintf("<CENTER>");
        wprintf("This screen allows you to enter Citadel server commands which are\n");
@@ -241,8 +214,10 @@ void display_generic(void)
        wprintf("<INPUT TYPE=\"text\" NAME=\"g_cmd\" SIZE=80 MAXLENGTH=\"250\"><BR>\n");
 
        wprintf("Command input (if requesting SEND_LISTING transfer mode):<BR>\n");
-       wprintf("<TEXTAREA NAME=\"g_input\" ROWS=10 COLS=80 WIDTH=80></TEXTAREA>\n");
+       wprintf("<TEXTAREA NAME=\"g_input\" ROWS=10 COLS=80 WIDTH=80></TEXTAREA><BR>\n");
 
+       wprintf("<FONT SIZE=-2>Detected host header is http://%s</FONT>\n",
+               WC->http_host);
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Send command\">");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
 
@@ -252,8 +227,8 @@ void display_generic(void)
 
 void do_generic(void)
 {
-       char buf[256];
-       char gcontent[256];
+       char buf[SIZ];
+       char gcontent[SIZ];
        char *junk;
        size_t len;
 
@@ -261,15 +236,15 @@ void do_generic(void)
                display_main_menu();
                return;
        }
+
+       output_headers(1);
+
        serv_printf("%s", bstr("g_cmd"));
        serv_gets(buf);
 
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
-       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
-       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-       wprintf("<B>Server command results</B>\n");
-       wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770077\"><TR><TD>");
+       wprintf("<SPAN CLASS=\"titlebar\">Server command results</SPAN>\n");
+       wprintf("</TD></TR></TABLE>\n");
 
        wprintf("<TABLE border=0><TR><TD>Command:</TD><TD><TT>");
        escputs(bstr("g_cmd"));
@@ -288,7 +263,7 @@ void do_generic(void)
                wprintf("000");
        }
        if (buf[0] == '4') {
-               text_to_server(bstr("g_input"));
+               text_to_server(bstr("g_input"), 0);
                serv_puts("000");
        }
        if (buf[0] == '6') {
@@ -300,7 +275,7 @@ void do_generic(void)
        if (buf[0] == '7') {
                len = atol(&buf[4]);
                junk = malloc(len);
-               bzero(junk, len);
+               memset(junk, 0, len);
                serv_write(junk, len);
                free(junk);
        }
@@ -309,3 +284,36 @@ void do_generic(void)
        wprintf("<A HREF=\"/display_advanced\">Return to menu</A>\n");
        wDumpContent(1);
 }
+
+
+
+
+/*
+ * Display the menubar.  Set as_single_page to
+ * display HTML headers and footers -- otherwise it's assumed
+ * that the menubar is being embedded in another page.
+ */
+void display_menubar(int as_single_page) {
+
+       if (as_single_page) {
+               output_headers(0);
+               wprintf("<HTML>\n"
+                       "<HEAD>\n"
+                       "<TITLE>MenuBar</TITLE>\n"
+                       "<STYLE TYPE=\"text/css\">\n"
+                       "BODY   { text-decoration: none; }\n"
+                       "</STYLE>\n"
+                       "</HEAD>\n");
+               do_template("background");
+       }
+
+       do_template("menubar");
+
+       if (as_single_page) {
+               wDumpContent(2);
+       }
+
+
+}
+
+