"</div>\n<div id=\"content\">\n"
);
- wprintf("<div id=\"fix_scrollbar_bug\">"
+ wprintf("<div class=\"fix_scrollbar_bug\">"
"<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
wprintf(_("Send an instant message to: "));
escputs(recp);
wprintf("<br>\n");
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/page_user\">\n");
+ wprintf("<FORM METHOD=\"POST\" action=\"page_user\">\n");
wprintf("<TABLE border=0 width=100%%><TR><TD>\n");
wprintf("</TD></TR></TABLE><br />\n");
wprintf("<INPUT TYPE=\"submit\" NAME=\"send_button\" VALUE=\"%s\">", _("Send message"));
- wprintf("<br /><A HREF=\"javascript:window.close();\"%s</A>\n", _("Cancel"));
+ wprintf("<br /><a href=\"javascript:window.close();\"%s</A>\n", _("Cancel"));
wprintf("</FORM></CENTER>\n");
wprintf("</td></tr></table></div>\n");
}
if (!strcasecmp(closewin, "yes")) {
- wprintf("<CENTER><A HREF=\"javascript:window.close();\">");
+ wprintf("<CENTER><a href=\"javascript:window.close();\">");
wprintf(_("[ close window ]"));
wprintf("</A></CENTER>\n");
}
}
/* WebCit Chat works by having transmit, receive, and refresh
- * frames. Load the frameset.
+ * frames. Load the frameset. (This isn't AJAX but the headers
+ * output by begin_ajax_response() happen to be the ones we need.)
*/
+ begin_ajax_response();
do_template("chatframeset");
+ end_ajax_response();
return;
}
/*
- *
+ * If there are instant messages waiting, and we notice that we haven't checked them in
+ * a while, it probably means that we need to open the instant messenger window.
*/
void page_popup(void)
{
char buf[SIZ];
- char pagefrom[SIZ];
-
- while (serv_puts("GEXP"), serv_getln(buf, sizeof buf), buf[0]=='1') {
- extract_token(pagefrom, &buf[4], 3, '|', sizeof pagefrom);
-
- wprintf("<table border=1 bgcolor=\"#880000\"><tr><td>");
- wprintf("<span class=\"titlebar\">");
- wprintf(_("Instant message from "));
- escputs(pagefrom);
- wprintf("</span></td></tr><tr><td><font color=\"#FFFFFF\">");
- fmout("LEFT");
- wprintf("</font></td></tr>"
- "<tr><td><div align=center><font color=\"#FFFFFF\">"
- "<a href=\"javascript:hide_page_popup()\">");
- wprintf(_("[ close window ]"));
- wprintf("</a>"
- "</font></div>"
- "</td></tr>"
- "</table>\n");
+ /* First, do the check as part of our page load. */
+ serv_puts("NOOP");
+ serv_getln(buf, sizeof buf);
+ if (buf[3] == '*') {
+ if ((time(NULL) - WC->last_pager_check) > 60) {
+ wprintf("<script type=\"text/javascript\">"
+ " window.open('static/instant_messenger.html', 'CTDL_MESSENGER', "
+ " 'width=700,height=400');"
+ "</script>"
+ );
+ }
}
- WC->HaveInstantMessages = 0;
+ /* Then schedule it to happen again a minute from now if the user is idle. */
+ wprintf("<script type=\"text/javascript\"> \n"
+ " function HandleSslp(sslg_xmlresponse) { \n"
+ " sslg_response = sslg_xmlresponse.responseText.substr(0, 1); \n"
+ " if (sslg_response == 'Y') { \n"
+ " window.open('static/instant_messenger.html', 'CTDL_MESSENGER', \n"
+ " 'width=700,height=400'); \n"
+ " } \n"
+ " } \n"
+ " function CheckPager() { \n"
+ " new Ajax.Request('sslg', { method: 'get', parameters: Math.random(), \n"
+ " onSuccess: HandleSslp } ); \n"
+ " } \n"
+ " new PeriodicalExecuter(CheckPager, 30); \n"
+ "</script> \n"
+ );
}
if (end_chat_now) {
close(WC->chat_sock);
WC->chat_sock = (-1);
- wprintf("<IMG SRC=\"/static/blank.gif\" onLoad=\"parent.window.close();\">\n");
+ wprintf("<img src=\"static/blank.gif\" onLoad=\"parent.window.close();\">\n");
}
if (strlen(output_data) > 0) {
}
/* Output our fun to the other frame. */
- wprintf("<IMG SRC=\"/static/blank.gif\" WIDTH=1 HEIGHT=1\n"
+ wprintf("<img src=\"static/blank.gif\" WIDTH=1 HEIGHT=1\n"
"onLoad=\" \n"
);
if (strcasecmp(cl_user, WC->last_chat_user)) {
wprintf("<B>");
- if (!strcasecmp(cl_user, WC->wc_username)) {
+ if (!strcasecmp(cl_user, WC->wc_fullname)) {
wprintf("<FONT COLOR="#FF0000">");
}
else {
WC->serv_sock = WC->chat_sock;
WC->chat_sock = i;
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/chat_send\" NAME=\"chatsendform\">\n");
+ wprintf("<FORM METHOD=\"POST\" action=\"chat_send\" NAME=\"chatsendform\">\n");
wprintf("<INPUT TYPE=\"text\" SIZE=\"80\" MAXLENGTH=\"%d\" "
"NAME=\"send_this\">\n", SIZ-10);
wprintf("<br />");
wDumpContent(0);
}
-