]> code.citadel.org Git - citadel.git/commitdiff
* Reworked a lot of the structure, made more HTML "embeddable"
authorArt Cancro <ajc@citadel.org>
Mon, 19 Apr 1999 03:44:08 +0000 (03:44 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 19 Apr 1999 03:44:08 +0000 (03:44 +0000)
        * Changed the noframes mode to display "fake" frames using tables

webcit/ChangeLog
webcit/child.h
webcit/mainmenu.c
webcit/roomops.c
webcit/static/empty.html
webcit/static/frameset.html
webcit/static/menubar.html
webcit/webcit.c

index bfdc7753de6b1f5ec90b80316ea531619868d595..21d6dc443437ad8120a4de7aac9030a8ddd62c97 100644 (file)
@@ -1,3 +1,7 @@
+Sun Apr 18 23:42:54 EDT 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Reworked a lot of the structure, made more HTML "embeddable"
+       * Changed the noframes mode to display "fake" frames using tables
+
 Thu Apr 16 12:00:00 EDT 1999 Nick Grossman <nicl@ulster.net>
        Changed some output formatting (mainly <FONT> tags).
        Changed who.c to use urlescputs() rather than escputs()
index 78cc8d621680c3a4c29c60019c51d024e0202fed..ccdcd415c65dfc0ed26a51141ccaedb95cc9b703 100644 (file)
@@ -101,3 +101,5 @@ void siteconfig(void);
 void display_generic(void);
 void do_generic(void);
 int browser_braindamage_check(char *);
+void display_menubar(int);
+void embed_room_banner(char *);
index 5c216f25c896d1422040cd54a0168bb33c187fd7..d35460da9b037757a5a08c2b5138ebd4fa7efcfd 100644 (file)
@@ -309,3 +309,55 @@ void do_generic(void)
        wprintf("<A HREF=\"/display_advanced\">Return to menu</A>\n");
        wDumpContent(1);
 }
+
+
+
+
+/*
+ * Display the menubar.  Set as_single_page to 1 if we're inside a frameset
+ * and need 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];
+       int i;
+
+       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) {
+                       /* Sleazy hack to disable TARGET= directive */
+                       if (noframes) for (i=0; i<strlen(buf); ++i) {
+                               if (!strncasecmp(&buf[i], "TARGET", 6)) {
+                                       buf[i]='Q';
+                               }
+                       }
+                       wprintf("%s", buf);
+               }
+               fclose(menubar_body);
+       }
+               
+
+       if (as_single_page) {
+               wDumpContent(2);
+       }
+
+
+}
index 957ca4bde0bcd23a0a6d33e1219acb4eaef58283..1ea8b5e833dcc45f2293cabacfbfbf874445ee24 100644 (file)
@@ -314,6 +314,56 @@ void readinfo(int v)
 }
 
 
+
+void embed_room_banner(char *got) {
+       char buf[256];
+       char fakegot[256];
+
+       if (got == NULL) {
+               serv_printf("GOTO %s", wc_roomname);
+               serv_gets(fakegot);
+               got = fakegot;
+       }
+
+       wprintf("<CENTER><TABLE border=0><TR>");
+
+       if ((strlen(ugname) > 0) && (strcasecmp(ugname, wc_roomname))) {
+               wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
+               wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
+       }
+       wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><FONT SIZE=+2>%s</FONT><BR>", wc_roomname);
+       wprintf("%d new of %d messages</FONT></TD>\n",
+               extract_int(&got[4], 1),
+               extract_int(&got[4], 2));
+
+       /* Display room graphic.  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 
+        * another room.
+        */
+       serv_puts("OIMG _roompic_");
+       serv_gets(buf);
+       if (buf[0] == '2') {
+               wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
+               wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
+               escputs(wc_roomname);
+               wprintf("\"></FONT></TD>");
+               serv_puts("CLOS");
+               serv_gets(buf);
+       }
+       wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
+       readinfo(0);
+       wprintf("</FONT></TD>");
+
+       wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
+       wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
+       wprintf("</TR></TABLE></CENTER>\n");
+}
+
+
+
+
+
 /*
  * generic routine to take the session to a new room
  *
@@ -329,7 +379,10 @@ void gotoroom(char *gname, int display_name)
 
        if (display_name) {
                printf("HTTP/1.0 200 OK\n");
+                printf("Pragma: no-cache\n");
+                printf("Cache-Control: no-store\n");
                output_headers(0);
+
                wprintf("<HTML><HEAD></HEAD>\n<BODY ");
 
                /* automatically fire up a read-new-msgs in the bottom frame */
@@ -375,40 +428,7 @@ void gotoroom(char *gname, int display_name)
 
        /* Display the room banner */
        if (display_name) {
-               wprintf("<CENTER><TABLE border=0><TR>");
-
-               if ((strlen(ugname) > 0) && (strcasecmp(ugname, wc_roomname))) {
-                       wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
-                       wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
-               }
-               wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><FONT SIZE=+2>%s</FONT><BR>", wc_roomname);
-               wprintf("%d new of %d messages</FONT></TD>\n",
-                       extract_int(&buf[4], 1),
-                       extract_int(&buf[4], 2));
-
-               /* Display room graphic.  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 
-                * another room.
-                */
-               serv_puts("OIMG _roompic_");
-               serv_gets(buf);
-               if (buf[0] == '2') {
-                       wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
-                       wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
-                       escputs(wc_roomname);
-                       wprintf("\"></FONT></TD>");
-                       serv_puts("CLOS");
-                       serv_gets(buf);
-               }
-               wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
-               readinfo(0);
-               wprintf("</FONT></TD>");
-
-               wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
-               wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
-               wprintf("</TR></TABLE></CENTER>\n");
-
+               embed_room_banner(buf);
                wDumpContent(1);
        }
        strcpy(wc_roomname, wc_roomname);
@@ -515,7 +535,20 @@ void gotonext(void)
        } else {
                strcpy(next_room, "_BASEROOM_");
        }
-       gotoroom(next_room, 1);
+
+       /* In noframes mode, we goto the room silently, then do a
+        * read-new-messages which causes the banner to show up anyway.
+        */
+       if (noframes) {
+               gotoroom(next_room, 0);
+               readloop("readnew");
+       } else {
+       /* In frames mode, we let gotoroom() bring up the banner, which then
+        * uses JavaScript to bring up the new-messages display in the
+        * bottom frame.
+        */
+               gotoroom(next_room, 1);
+       }
 }
 
 
index 7b0576a457dcd50dd6cde4977a3f2c1d4fa21bc0..8d64ae1faeec189b4a4b5d8f8ec63c5784f92144 100644 (file)
@@ -2,4 +2,4 @@
 <HEAD><TITLE>Empty Page</TITLE></HEAD>
 <BODY>
 </BODY>
-</HTML
+</HTML>
index bac38422d98f67e0521ae4b3fa2f6bc45aed168d..a4fdbc3f2cee91d47b7b140f9cdad6900b794576 100644 (file)
@@ -4,7 +4,7 @@
        </HEAD>
        <FRAMESET COLS="155, *" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
 
-               <FRAME NAME="left" SRC="/static/menubar.html">
+               <FRAME NAME="left" SRC="/display_menubar">
                <FRAMESET ROWS="100, *">
                        <FRAME NAME="top" SRC="/dotgoto&room=_BASEROOM_">
                        <FRAME NAME="bottom" SRC="/static/blankpage.html">
index 272e8996aa0960e5d24feb574bc4267d16d1625a..88c4704c505ef1b0674a4635d93a2dacd7b7bebe 100644 (file)
@@ -1,12 +1,3 @@
-<HTML>
-<HEAD>
-       <TITLE>MenuBar</TITLE>
-       <STYLE TYPE="text/css">
-               BODY    { text-decoration: none; }
-       </STYLE>
-</HEAD>
-<BODY BACKGROUND="/image&name=background" TEXT="#000000" LINK="#ffffff" ALINK="#ff0000" VLINK="#ffffff">
-
 <CENTER>
 <IMG SRC="/image&name=hello"><BR><BR>
 
@@ -87,6 +78,3 @@ P O W E R E D&nbsp;&nbsp;B Y<BR></FONT>
 <IMG SRC="/static/citadel-logo.jpg" WIDTH=75 HEIGHT=76 BORDER=0 ALT="Citadel/UX"></A>
 
 </CENTER>
-
-</BODY>
-</HTML>
index 953e28595486e983fc55853d1fb6054cd514c30e..82eaa9541198bcd068bff546c59b4f5fbadf6a32 100644 (file)
@@ -22,6 +22,8 @@
 #include "child.h"
 #include "mime_parser.h"
 
+int fake_frames = 0;
+
 int wc_session;
 char wc_username[256];
 char wc_password[256];
@@ -204,10 +206,15 @@ void wDumpContent(int print_standard_html_footer)
 {
        struct webcontent *wptr;
 
+       if (fake_frames) {
+               wprintf("</TD></TR></TABLE></TABLE>\n");
+               fake_frames = 0;
+               }
+
        if (print_standard_html_footer) {
                if ((noframes) && (print_standard_html_footer != 2)) {
                        wprintf("<BR>");
-                       embed_main_menu();
+                       /* embed_main_menu(); */  /* not any more */
                }
                wprintf("</BODY></HTML>\n");
        }
@@ -368,12 +375,32 @@ void output_headers(int print_standard_html_head)
                        ExpressMessages = NULL;
                }
                wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
+       
+       
+       if ((print_standard_html_head == 1) && (noframes == 1)) {
+               wprintf("<TABLE border=0 width=100%>");
+               wprintf("<TR ALIGN=TOP><TD>");
+
+               display_menubar(0);
+
+               wprintf("</TD><TD ALIGN=TOP>"
+                       "<TABLE border=0 width=100%><TR ALIGN=TOP>"
+                       "<TD>\n");
+
+               embed_room_banner(NULL);
+
+               wprintf("</TD></TR><TR ALIGN=TOP><TD>\n");
+               
+
+               fake_frames = 1;
+               }
        }
 }
 
 
 
 
+
 void check_for_express_messages()
 {
        char buf[256];
@@ -858,6 +885,8 @@ void session_loop(char *browser_host)
                display_generic();
        } else if (!strcasecmp(action, "do_generic")) {
                do_generic();
+       } else if (!strcasecmp(action, "display_menubar")) {
+               display_menubar(1);
        }
        /* When all else fails... */
        else {