]> code.citadel.org Git - citadel.git/blobdiff - webcit/mainmenu.c
* Started moving all of the global variables into a struct, to facilitate
[citadel.git] / webcit / mainmenu.c
index c780ef4ef666d9d34ddd25bdb153dd510fe2a2ac..8713620f46809bc4f9b270c6f9c48d69182f4aa8 100644 (file)
@@ -35,10 +35,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");
 
@@ -140,7 +140,7 @@ 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=\"/zapped_list\">");
        wprintf("List all forgotten rooms</A>\n");
@@ -149,7 +149,7 @@ void embed_advanced_menu(void)
 
        wprintf("</TD><TD>");
 
-       if ((axlevel >= 6) || (is_room_aide)) {
+       if ((WC->axlevel >= 6) || (WC->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");
@@ -157,21 +157,12 @@ void embed_advanced_menu(void)
 
                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=\"/validate\">\n");
                        wprintf("Validate new users</A>\n");
 
@@ -201,7 +192,7 @@ void embed_advanced_menu(void)
 void display_main_menu(void)
 {
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
+       output_headers(1);
        embed_main_menu();
        wDumpContent(2);
 }
@@ -210,7 +201,7 @@ void display_main_menu(void)
 void display_advanced_menu(void)
 {
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
+       output_headers(1);
        embed_advanced_menu();
        embed_main_menu();
        wDumpContent(2);
@@ -223,7 +214,7 @@ 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\"");
@@ -261,11 +252,13 @@ void do_generic(void)
                display_main_menu();
                return;
        }
+
+       printf("HTTP/1.0 200 OK\n");
+       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");
@@ -309,3 +302,48 @@ 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) {
+       FILE *menubar_body;
+       char buf[256];
+
+       if (as_single_page) {
+               printf("HTTP/1.0 200 OK\n");
+               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"
+                       "<BODY BACKGROUND=\"/image&name=background\" "
+                       "TEXT=\"#000000\" LINK=\"#FFFFFF\" "
+                       "ALINK=\"#FFFFFF\" VLINK=\"#FFFFFF\">\n");
+       }
+
+       menubar_body = fopen("static/menubar.html", "r");
+       if (menubar_body == NULL) {
+               wprintf("menubar<BR>%s", strerror(errno));
+       } else {
+               while (fgets(buf, sizeof(buf), menubar_body) != NULL) {
+                       wprintf("%s", buf);
+               }
+               fclose(menubar_body);
+       }
+               
+
+       if (as_single_page) {
+               wDumpContent(2);
+       }
+
+
+}