Allow selection of tabs in multiple conversation mode.
authorArt Cancro <ajc@citadel.org>
Tue, 3 Jan 2006 03:46:41 +0000 (03:46 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 3 Jan 2006 03:46:41 +0000 (03:46 +0000)
webcit/ChangeLog
webcit/paging.c
webcit/static/instant_messenger.html

index c3c7258063690f8f434b2f6947970334dc045f0d..b4dff7e8b6a9bbb64e5a3498a353a05a105495ea 100644 (file)
@@ -1,5 +1,8 @@
 $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.
index ba9c056f82c683bdf60ce361d8d41ae8e3cf15f2..a72dba26bcff1e5346f1126d9188acdd33703426 100644 (file)
@@ -149,7 +149,8 @@ void do_chat(void)
 
 
 /*
- *
+ * 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)
 {
@@ -158,7 +159,7 @@ 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');"
index f8d3fdcb0a035d12fcd576376a30f51cf25b92d5..3d4c8dc7771c299967ef8b1f5aa3373b68440537 100644 (file)
@@ -6,10 +6,9 @@
 </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">
 
@@ -52,6 +51,17 @@ function SendSomething(which_div, sendform, recipient) {
        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.
@@ -83,7 +93,8 @@ function ShowNewMsg(gexp_xmlresponse) {
                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 + '\">'
@@ -94,14 +105,18 @@ function ShowNewMsg(gexp_xmlresponse) {
                        + '</form>'
                        + '</div>'
                        + '</div>\n';
+               $('tab_bar').innerHTML =
+                         $('tab_bar').innerHTML
+                       + '<span id=\"select_tab_' + which_div + '\" onClick=\"TabSelect(\'' + which_div + '\');\">'
+                       + sender
+                       + '</span>&nbsp;&nbsp;&nbsp;';
+
+               // 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