Configures a user's preference of where to go after login.
$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.
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
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();
}
{
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 */
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);
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();
( !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")) {
<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">
<TD VALIGN=TOP BGCOLOR=444455>
<?VIEWOMATIC><BR>
<FONT SIZE=-1 COLOR=DDDDCC><?NEWMSGS> new of <?TOTALMSGS> messages</FONT>
+<BR><?START>
</TD>
</TR></TABLE></CENTER>
}
+
+
+/*
+ * 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);
}
+
+
/*
* Entry point for WebCit transaction
*/
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]))
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
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);
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 */
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,'|')
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);
wprintf("<IMG SRC=\"/static/users-icon.gif\" ALT=\" \" ALIGN=MIDDLE>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"> <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");