$Id$
+Mon Jan 2 22:46:02 EST 2006 ajc
+* Allow selection of tabs in multiple conversation mode.
+
Mon Jan 2 16:39:55 EST 2006 ajc
* The new AJAX-based instant messenger now handles sending messages, and
also multiple concurrent conversations.
/*
- *
+ * 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)
{
serv_puts("NOOP");
serv_getln(buf, sizeof buf);
if (buf[3] == '*') {
- if ((time(NULL) - WC->last_pager_check) > 120) {
+ if ((time(NULL) - WC->last_pager_check) > 60) {
wprintf("<script type=\"text/javascript\">"
" window.open('static/instant_messenger.html', 'CTDL_MESSENGER', "
" 'width=600,height=400');"
</head>
<body>
-<div id="main">
-The buttons to toggle between conversations will go here.
+<div id="tab_bar"></div>
<hr>
-</div>
+<div id="main"></div>
<script type="text/javascript">
return false;
}
+function TabSelect(which_div) {
+ if (shown_div != '') {
+ $(shown_div).style.display = 'none' ;
+ if ($('select_'+shown_div)) $('select_'+shown_div).style.fontWeight='normal';
+ }
+ shown_div = 'tab_' + which_div;
+ $(shown_div).style.display = 'block' ;
+ if ($('select_'+shown_div)) $('select_'+shown_div).style.fontWeight='bold';
+}
+
+
function ShowNewMsg(gexp_xmlresponse) {
// It isn't really XML. It's a Citadel server response.
gexp_divs[num_gexp_divs] = sender;
which_div = 'gexp' + num_gexp_divs;
++num_gexp_divs;
- $('main').innerHTML = $('main').innerHTML
+ $('main').innerHTML =
+ $('main').innerHTML
+ '<div id=\"tab_' + which_div + '\" style=\"display:none\">'
+ '<div id=\"' + which_div + '\"></div>'
+ '<div id=\"response_' + which_div + '\">'
+ '</form>'
+ '</div>'
+ '</div>\n';
+ $('tab_bar').innerHTML =
+ $('tab_bar').innerHTML
+ + '<span id=\"select_tab_' + which_div + '\" onClick=\"TabSelect(\'' + which_div + '\');\">'
+ + sender
+ + '</span> ';
+
+ // Raise the window in case it was buried
+ window.focus();
}
// Switch tabs
- if (shown_div != '') {
- $(shown_div).style.display = 'none' ;
- }
- shown_div = 'tab_' + which_div;
- $(shown_div).style.display = 'block' ;
+ TabSelect(which_div);
// Write it to the tab
$(which_div).innerHTML = $(which_div).innerHTML