* Enable a "make this my start page" link that works in lots of places.
authorArt Cancro <ajc@citadel.org>
Sat, 6 Jul 2002 03:10:26 +0000 (03:10 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 6 Jul 2002 03:10:26 +0000 (03:10 +0000)
  Configures a user's preference of where to go after login.

webcit/ChangeLog
webcit/auth.c
webcit/mainmenu.c
webcit/roomops.c
webcit/static/mainframeset.html
webcit/static/roombanner.html
webcit/webcit.c
webcit/webcit.h
webcit/who.c

index 3cccdd1f37220341c7384f731319e323acc8db35..f52a864efa73401527d7cc024c364aa41813172f 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 323.43  2002/07/06 03:10:26  ajc
+* Enable a "make this my start page" link that works in lots of places.
+  Configures a user's preference of where to go after login.
+
 Revision 323.42  2002/06/19 22:01:31  ajc
 * When editing another user's vCard, do a "transient goto" to their config
   room so you don't automatically gain access to their config room.
@@ -848,4 +852,3 @@ 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 bb863faf1ae93697ed4222cdb6b0cf8dd24ed5ca..c5c503bb4426c5898510f3712223c5e40fb76c07 100644 (file)
@@ -148,7 +148,18 @@ void do_login(void)
 
 void do_welcome(void)
 {
-       http_redirect("/static/mainframeset.html");
+       char startpage[SIZ];
+
+       get_preference("startpage", startpage);
+       if (strlen(startpage)==0) {
+               strcpy(startpage, "/dotskip&room=_BASEROOM_");
+               set_preference("startpage", startpage);
+       }
+
+        svprintf("STARTPAGE", WCS_STRING, startpage);
+
+        do_template("mainframeset");
+        clear_local_substs();
 }
 
 
index 65513869878ad5129763528ef91544c555aa597b..fb903dbe0b6235a98c26593b7a52c23e3e1b0a5d 100644 (file)
@@ -33,11 +33,13 @@ void display_main_menu(void)
 {
        output_headers(1);
 
-       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");
-       wprintf("<CENTER><TABLE border=0><TR>");
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770077><TR><TD>"
+               "<FONT SIZE=+1 COLOR=\"FFFFFF\""
+               "<B>Basic commands</B>\n"
+               "</FONT></TD>"
+               "</TD></TR></TABLE>\n"
+               "<CENTER><TABLE border=0><TR>"
+       );
 
        wprintf("<TD>");        /* start of first column */
 
index 8896b94992243390eae9070da5b43f2ad768eafa..104a5e7913ca47a5dd74263277075e9f984c66c6 100644 (file)
@@ -369,6 +369,13 @@ void embed_room_banner(char *got) {
                got = fakegot;
        }
 
+       /* If the user happens to select the "make this my start page" link,
+        * we want it to remember the URL as a "/dotskip" one instead of
+        * a "skip" or "gotonext" or something like that.
+        */
+       snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s",
+               WC->wc_roomname);
+
        /* Check for new mail. */
        WC->new_mail = extract_int(&got[4], 9);
        WC->wc_view = extract_int(&got[4], 11);
@@ -380,6 +387,7 @@ void embed_room_banner(char *got) {
        svcallback("ROOMINFO", readinfo);
        svcallback("YOUHAVEMAIL", embed_newmail_button);
        svcallback("VIEWOMATIC", embed_view_o_matic);
+       svcallback("START", offer_start_page);
 
        do_template("roombanner");
        clear_local_substs();
@@ -1820,8 +1828,9 @@ void knrooms() {
                ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
        );
 
-       wprintf("</SELECT></FORM></TD>\n"
-               "</TR></TABLE><BR>\n");
+       wprintf("</SELECT></FORM></TD><TD>\n");
+       offer_start_page();
+       wprintf("</TD></TR></TABLE><BR>\n");
 
        /* Display the room list in the user's preferred format */
        if (!strcasecmp(listviewpref, "folders")) {
index dcc4e18d7a96dcea75dc77499058394229a3d4b9..4ed44ef6b810168ba5f61fa54c58c7a0dfcfdc7b 100644 (file)
@@ -6,7 +6,7 @@
        <FRAMESET COLS="80, *" FRAMESPACING=0 BORDER="FALSE" FRAMEBORDER=0>
                <FRAME NAME="left" SRC="/static/iconbar.html" SCROLLING="no">
                <FRAMESET ROWS="*, 45" FRAMESPACING=0 BORDER="FALSE" FRAMEBORDER=0>
-                       <FRAME NAME="workspace" SRC="/dotskip&room=_BASEROOM_">
+                       <FRAME NAME="workspace" SRC="<?STARTPAGE>">
                        <FRAMESET COLS="*, 1" FRAMESPACING=0 BORDER="FALSE" FRAMEBORDER=0>
                                <FRAME NAME="bottom" SRC="/static/navbar.html" SCROLLING="no">
                                <FRAME NAME="ka" SRC="/blank" SCROLLING="no">
index 6a109574f208d029516219b2b109e5b6c1ffaadc..8f308b2950d273aa2e3717aa874152ae9e73c45f 100644 (file)
@@ -21,6 +21,7 @@
 <TD VALIGN=TOP BGCOLOR=444455>
 <?VIEWOMATIC><BR>
 <FONT SIZE=-1 COLOR=DDDDCC><?NEWMSGS> new of <?TOTALMSGS> messages</FONT>
+<BR><?START>
 </TD>
 
 </TR></TABLE></CENTER>
index c20a98b07aa9f0fe85ccab26b13bb9a14f247eb1..71df42ecae109c486b7043049b0e165ba3926e4b 100644 (file)
@@ -643,6 +643,55 @@ void blank_page(void) {
 }
 
 
+
+
+/*
+ * Offer to make any page the user's "start page."
+ */
+void offer_start_page(void) {
+       wprintf("<A HREF=\"/change_start_page?startpage=");
+       urlescputs(WC->this_page);
+       wprintf("\">"
+               "<FONT SIZE=-2 COLOR=#AAAAAA>Make this my start page</FONT>"
+               "</A>"
+       );
+}
+
+
+/* 
+ * Change the user's start page
+ */
+void change_start_page(void) {
+
+       if (bstr("startpage") == NULL) {
+               display_error("startpage set to null");
+               return;
+       }
+
+       set_preference("startpage", bstr("startpage"));
+
+       output_headers(3);
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
+       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
+       wprintf("<B>New start page</B>\n");
+       wprintf("</FONT></TD></TR></TABLE>\n");
+
+       wprintf("<CENTER>"
+               "<font size=+2>Your start page has been changed.</font>"
+               "<BR><BR>\n"
+               "<I>(Note: this does not change your browser's home page. "
+               "It changes the page you begin on when you log on to ");
+       escputs(serv_info.serv_humannode);
+       wprintf(".)</I><BR><BR>"
+               "<a href = \"javascript:history.back()\">Back...</a>"
+               "</CENTER>");
+
+       wDumpContent(1);
+}
+
+
+
+
 void display_error(char *errormessage)
 {
        convenience_page("770000", "Error", errormessage);
@@ -714,6 +763,8 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
 }
 
 
+
+
 /*
  * Entry point for WebCit transaction
  */
@@ -809,8 +860,13 @@ void session_loop(struct httprequest *req)
                content = NULL;
        }
 
+       /* make a note of where we are in case the user wants to save it */
+       safestrncpy(WC->this_page, cmd, sizeof(WC->this_page));
+       remove_token(WC->this_page, 2, ' ');
+       remove_token(WC->this_page, 0, ' ');
+
        /* If there are variables in the URL, we must grab them now */
-       for (a = 0; a < strlen(cmd); ++a)
+       for (a = 0; a < strlen(cmd); ++a) {
                if ((cmd[a] == '?') || (cmd[a] == '&')) {
                        for (b = a; b < strlen(cmd); ++b)
                                if (isspace(cmd[b]))
@@ -818,6 +874,8 @@ void session_loop(struct httprequest *req)
                        addurls(&cmd[a + 1]);
                        cmd[a] = 0;
                }
+       }
+
        /*
         * If we're not connected to a Citadel server, try to hook up the
         * connection now.  Preference is given to the host and port specified
@@ -1066,6 +1124,8 @@ void session_loop(struct httprequest *req)
                folders();
        } else if (!strcasecmp(action, "do_stuff_to_msgs")) {
                do_stuff_to_msgs();
+       } else if (!strcasecmp(action, "change_start_page")) {
+               change_start_page();
        } else if (!strcasecmp(action, "diagnostics")) {
                output_headers(1);
 
index 0fcbdee32ee1d41a58b38873d6cad0d8c7f95a1f..38b079edfcf0430bad8547e497b1c9640c509dcb 100644 (file)
@@ -144,7 +144,7 @@ struct wcsession {
         time_t lastreq;                        /* Timestamp of most recent HTTP */
        int killthis;                   /* Nonzero == purge this session */
        struct march *march;            /* march mode room list */
-       char reply_to[512];             /* reply-to address */
+       char reply_to[SIZ];             /* reply-to address */
        long msgarr[1024];              /* for read operations */
        int fake_frames;
        int is_wap;                     /* Client is a WAP gateway */
@@ -152,6 +152,7 @@ struct wcsession {
        int HaveExpressMessages;        /* Nonzero if incoming msgs exist */
        struct wcsubst *vars;
        char *preferences;
+       char this_page[SIZ];            /* address of current page */
 };
 
 #define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')
@@ -311,3 +312,5 @@ void knrooms(void);
 int is_msg_in_mset(char *mset, long msgnum);
 char *safestrncpy(char *dest, const char *src, size_t n);
 void display_addressbook(long msgnum, char alpha);
+void offer_start_page(void);
+void change_start_page(void);
index c2690f936dcb5a5e1f40ffacfd080de8a7da12ec..a1b2ca13b538a3c8629a4ade68eec20dde1b9310 100644 (file)
@@ -47,7 +47,9 @@ void whobbs(void)
        wprintf("<IMG SRC=\"/static/users-icon.gif\" ALT=\" \" ALIGN=MIDDLE>");
        wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\">&nbsp;&nbsp;<B>Users currently on ");
        escputs(serv_info.serv_humannode);
-       wprintf("</B></FONT></TD></TR></TABLE>\n");
+       wprintf("</B></FONT></TD><TD>");
+       offer_start_page();
+       wprintf("</TD></TR></TABLE>\n");
 
        wprintf("<CENTER><TABLE BORDER=1 WIDTH=100%%>\n<TR>\n");
        wprintf("<TH>Session ID</TH>\n");