* instant_messenger.html: learn my own screen name from the server,
authorArt Cancro <ajc@citadel.org>
Wed, 11 Jan 2006 04:57:11 +0000 (04:57 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 11 Jan 2006 04:57:11 +0000 (04:57 +0000)
  also some CSS changes

webcit/ChangeLog
webcit/static/instant_messenger.html

index 0e1706e3014e492a89ae315d356e54f5ef9f561c..8620e873b6b0c6b9e53ba68431d8368ae2c06717 100644 (file)
@@ -1,5 +1,9 @@
 $Id$
 
+Tue Jan 10 23:56:59 EST 2006 ajc
+* instant_messenger.html: learn my own screen name from the server,
+  also some CSS changes
+
 Mon Jan  9 13:01:48 EST 2006 ajc
 * siteconfig.c: new "Indexing/Journaling" tab now contains the options
   to enable the full text index, and to enable message journaling.
index ac971a42c2bbc97cef6117baa607972d5d94ce4a..c2aebf9dd603ae7b4de1e77cac6b0d8b83b640c9 100644 (file)
@@ -6,16 +6,20 @@
 </head>
 <body>
 
-<div id="spacer1" style="background: #aaaaaa"><br></div>
-<div id="tab_bar" style="background: #aaaaaa">&nbsp;&nbsp;</div>
-<div id="spacer2" style="background: #aaaaaa"><br></div>
-<div id="main"></div>
+<div id="thetop" style="position:fixed;width:100%;height:15%;top:0%;left:0%">
+<div id="spacer1" style="background:#aaaaaa"><br></div>
+<div id="tab_bar" style="background:#aaaaaa">&nbsp;&nbsp;</div>
+<div id="spacer2" style="background:#aaaaaa"><br></div>
+</div>
+
+<div id="main" style="position:fixed;width:100%;height:85%;top:15%;left:0%;overflow:auto;background:#ffffff"></div>
 
 <script type="text/javascript">
 
 var gexp_divs = new Array();
 var num_gexp_divs = 0;
 var shown_div = '';
+var my_name = '';
 
 function SendSomething(which_div, sendform, recipient) {
        thetext = document.forms[sendform].elements['sendthis'].value;
@@ -32,7 +36,7 @@ function SendSomething(which_div, sendform, recipient) {
        $(which_div).innerHTML = $(which_div).innerHTML
                                + '<b>'
                                + '<font color=\"#FF0000\">'
-                               + 'Me (FIXME)'
+                               + my_name
                                + '</font>'
                                + ':</b> '
                                + thetext
@@ -103,7 +107,8 @@ function ShowNewMsg(gexp_xmlresponse) {
                $('main').innerHTML =
                          $('main').innerHTML
                        + '<div id=\"tab_' + which_div + '\" style=\"display:none;cursor:pointer\">'
-                       + '<div id=\"' + which_div + '\"></div>'
+                       + '<div id=\"' + which_div + '\">'
+                       + '</div>'
                        + '<div id=\"response_' + which_div + '\">'
                        + '<br><form method=\"post\" action=\"null\" name=\"sendform_' + which_div + '\" '
                        + 'onSubmit=\"return SendSomething(\'' + which_div + '\', \'sendform_'
@@ -134,6 +139,9 @@ function ShowNewMsg(gexp_xmlresponse) {
                                + ':</b> '
                                + the_message
                                + '<br />\n';
+
+       // Scroll to the bottom of the tab
+       $(which_div).scrolltop = $(which_div).scrollHeight - $(which_div).clientHeight;
 }
 
 // This is called periodically to check for new incoming messages
@@ -148,7 +156,34 @@ function FetchNewMsgs() {
        );
 }
 
-// ...and here's how we cause it to be called periodically.
+// Perform some initialization.
+parms = 'g_cmd=GREG _SELF_&r=' + Math.random();
+new Ajax.Request('../ajax_servcmd',
+       {
+               method: 'get',
+               parameters: parms,
+               onSuccess: GrabMyName
+       }
+);
+
+// Learn my name.
+function GrabMyName(greg_xmlresponse) {
+
+       // It isn't really XML.  It's a Citadel server response.
+       greg_response = greg_xmlresponse.responseText;
+
+       if (greg_response.substring(0, 1) != '1') {
+               return;
+       }
+
+       // Extract fields...
+       breakpos = greg_response.indexOf('\n');
+       result = greg_response.substring(0, breakpos);
+       my_name = result.substring(4);
+}
+
+
+// Cause FetchNewMsgs() to be called periodically.
 new PeriodicalExecuter(FetchNewMsgs, 3);
 
 </script>