]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/wclib.js
Address book popup is now rendered using an ajax refresh
[citadel.git] / webcit / static / wclib.js
index fbe50fde5a673aa3f427d4940b7ebee76a730c04..a93f357dadf57769f7a512ec5cd1f1667128b95c 100644 (file)
@@ -580,6 +580,7 @@ customnav.setAttribute("class","floatcustomnav");
 floatwindow("headerscreen","pre",customnav);
 rawSwitch822(msgnum);
 }
+
 function rawSwitch822(msgnum) {
 CtdlLoadScreen("headerscreen");
 new Ajax.Updater("headerscreen", 
@@ -587,6 +588,7 @@ new Ajax.Updater("headerscreen",
  { method: 'post',parameters: 'g_cmd=MSG2 ' +msgnum  } );
 
 }
+
 function rawSwitchCitadel(msgnum) {
 CtdlLoadScreen("headerscreen");
 new Ajax.Updater("headerscreen", 
@@ -594,6 +596,7 @@ new Ajax.Updater("headerscreen",
  { method: 'post',parameters: 'g_cmd=MSG0 ' +msgnum  } );
 
 }
+
 function floatwindow(newdivid,contentelementtype,customnav) {
 var windiv = document.createElement("div");
 windiv.setAttribute("class","floatwindow");
@@ -625,29 +628,59 @@ fwindow.parentNode.removeChild(fwindow);
 // Place a gradient loadscreen on an element, e.g to use before Ajax.updater
 function CtdlLoadScreen(elementid) {
 var elem = document.getElementById(elementid);
-elem.innerHTML = "<b>Loading....</b> <img src=\"/static/gradientanim.gif\"/>";
+elem.innerHTML = "<div align=center><br><table border=0 cellpadding=10 bgcolor=\"#ffffff\"><tr><td><img src=\"static/throbber.gif\" /><font color=\"#AAAAAA\">&nbsp;&nbsp;Loading....</font></td></tr></table><br /></div>";
 }
+
+
 // Show info for a user, basically replaces showuser()
 // matt@comalies is to blame for this poorly coded masterpiece. 
 function CtdlShowUserInfoPopup(Element) {
-try {
-// hopefully no one needs to use the class attribute... could be better done 
-// with xmlns though..
-var user = Element.getAttribute("class");
-var updname = "biospace_"+user;
-if (document.getElementById(updname) == null) {
-// insert a space for the bio
-var pNode = Element.parentNode;
-var newdiv = document.createElement("div");
-newdiv.id = updname;
-newdiv.innerHTML = "Getting user info....";
-pNode.appendChild(newdiv);
-CtdlLoadScreen(updname);
-new Ajax.Updater(updname, 'showuser_ajax?who='+user, { method: 'get' } );
-}
+       try {
+               // hopefully no one needs to use the class attribute... could be better done 
+               // with xmlns though..
+               var user = Element.getAttribute("class");
+               var updname = "biospace_"+user;
+               if (document.getElementById(updname) == null) {
+                       // insert a space for the bio
+                       var pNode = Element.parentNode;
+                       var newdiv = document.createElement("div");
+                       newdiv.id = updname;
+                       newdiv.innerHTML = "Getting user info....";
+                       pNode.appendChild(newdiv);
+                       CtdlLoadScreen(updname);
+                       new Ajax.Updater(updname, 'showuser_ajax?who='+user, { method: 'get' } );
+               }
+       }
+       catch(err) {
+               return true;
+       }
+       return false;
 }
-catch(err){
-return true;
+
+
+// Pop open the address book
+function PopOpenAddressBook() {
+       $('address_book_popup').style.display = 'block';
+       new Ajax.Updater(
+               'address_book_popup_middle_div',
+               'display_address_book_middle_div',
+               {
+                       method: 'get',
+                       parameters: Math.random(),
+                       onComplete: PopulateAddressBookInnerDiv()
+               }
+       );
+       Nifty('div#address_book_popup_container_div','big transparent');
 }
-return false;
+
+function PopulateAddressBookInnerDiv() {
+       $('address_book_inner_div').innerHTML = "<div align=center><br><table border=0 cellpadding=10 bgcolor=\"#ffffff\"><tr><td><img src=\"static/throbber.gif\" /><font color=\"#AAAAAA\">&nbsp;&nbsp;Loading....</font></td></tr></table><br /></div>";
+       new Ajax.Updater(
+               'address_book_inner_div',
+               'display_address_book_inner_div',
+               {
+                       method: 'get',
+                       parameters: Math.random()
+               }
+       );
 }