From: Art Cancro Date: Fri, 13 Apr 2007 21:55:30 +0000 (+0000) Subject: Address book popup is now rendered using an ajax refresh X-Git-Tag: v7.86~3437 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=e813fb1d99a656203ddd21253b7ddc99a6fde1f4 Address book popup is now rendered using an ajax refresh when it is called up, eliminating the need to render it even when it has not been requested. --- diff --git a/webcit/addressbook_popup.c b/webcit/addressbook_popup.c index 5d90844dd..6d479b3f0 100644 --- a/webcit/addressbook_popup.c +++ b/webcit/addressbook_popup.c @@ -8,6 +8,46 @@ /*@{*/ #include "webcit.h" + +/** + * \brief Address book popup window + */ +void display_address_book_middle_div(void) { + char buf[256]; + char ebuf[256]; + + begin_ajax_response(); + + wprintf(""); + wprintf(""); + wprintf(""); + wprintf("
"); + + wprintf("
"); + + wprintf("
"); + wprintf("
"); + + end_ajax_response(); +} + + + /** * \brief Address book popup results */ diff --git a/webcit/messages.c b/webcit/messages.c index b481a979f..4a4b116e8 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -3203,42 +3203,20 @@ void display_enter(void) } wprintf("\n"); - wprintf("\n"); - /* Close the main div, now open a new one, hidden initially, for address book popups. - * Remember: the final div will be closed by wDumpContent, which will think it's merely - * closing the main div. FIXME put this in its own function so we can use it from the + wprintf("\n"); /* End of 'content' div */ + + /* Open a new div, hidden initially, for address book popups. + * FIXME put this in its own function so we can use it from the * calendar too. */ - wprintf("
"); - wprintf("
"); - wprintf(""); - wprintf(""); - wprintf(""); - wprintf("
"); - - wprintf("
"); - - wprintf("
"); - wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf("
"); wprintf("
"); wprintf("
"); + /* The 'address_book_popup' div will be closed by wDumpContent() */ DONE: wDumpContent(1); } diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index 11156a33f..a93f357da 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -660,9 +660,21 @@ function CtdlShowUserInfoPopup(Element) { // Pop open the address book function PopOpenAddressBook() { - $('address_book_inner_div').innerHTML = "

  Loading....

"; $('address_book_popup').style.display = 'block'; - Nifty('div#address_book_popup_middle_div','big transparent'); + 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'); +} + +function PopulateAddressBookInnerDiv() { + $('address_book_inner_div').innerHTML = "

  Loading....

"; new Ajax.Updater( 'address_book_inner_div', 'display_address_book_inner_div', diff --git a/webcit/static/webcit.css b/webcit/static/webcit.css index c18ef5997..8247a1549 100644 --- a/webcit/static/webcit.css +++ b/webcit/static/webcit.css @@ -870,13 +870,18 @@ div.auto_complete ul strong.highlight { display: none; } -#address_book_popup_middle_div { +#address_book_popup_container_div { position: relative; width: 100%; height: 100%; background-color: #ffd; } +#address_book_popup_middle_div { + position: relative; + background-color: #ffd; +} + #address_book_inner_div { margin: 5px; } diff --git a/webcit/webcit.c b/webcit/webcit.c index ab21eaab8..6ffb08a75 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1637,6 +1637,8 @@ void session_loop(struct httprequest *req) recp_autocomplete(bstr("cc")); } else if (!strcasecmp(action, "bcc_autocomplete")) { recp_autocomplete(bstr("bcc")); + } else if (!strcasecmp(action, "display_address_book_middle_div")) { + display_address_book_middle_div(); } else if (!strcasecmp(action, "display_address_book_inner_div")) { display_address_book_inner_div(); } else if (!strcasecmp(action, "set_floordiv_expanded")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index 446c00ef1..f390de2ba 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -638,6 +638,7 @@ void CtdlMakeTempFileName(char *, int); void display_preferences(void); void set_preferences(void); void recp_autocomplete(char *); +void display_address_book_middle_div(void); void display_address_book_inner_div(void); void begin_ajax_response(void); void end_ajax_response(void);