* Room info popup now uses Scriptactulous appear and fade effects
authorArt Cancro <ajc@citadel.org>
Sat, 7 Apr 2007 03:16:12 +0000 (03:16 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 7 Apr 2007 03:16:12 +0000 (03:16 +0000)
* Added in the javascript/ajax underpinnings for a pop-up address book
  to be used for selecting mail recipients and calendar event
  participants.  The window appears and fades but there is not yet
  any useful content in the window.

webcit/Makefile.in
webcit/addressbook_popup.c [new file with mode: 0644]
webcit/messages.c
webcit/roomops.c
webcit/static/wclib.js
webcit/static/webcit.css
webcit/webcit.c
webcit/webcit.h

index 96f11f3cd0c2e3e65467e0f7f13c31980af6f45d..855be3b85f2246dc2301384dc6cae122cd2bb2d5 100644 (file)
@@ -52,7 +52,7 @@ webserver: webserver.o context_loop.o tools.o ical_dezonify.o \
        groupdav_main.o groupdav_get.o groupdav_propfind.o fmt_date.o \
        groupdav_options.o autocompletion.o gettext.o tabs.o sieve.o \
        groupdav_delete.o groupdav_put.o http_datestring.o setup_wizard.o \
-       downloads.o  \
+       downloads.o  addressbook_popup.o \
        $(LIBOBJS)
        $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
        webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o listsub.o \
@@ -64,7 +64,7 @@ webserver: webserver.o context_loop.o tools.o ical_dezonify.o \
        groupdav_main.o groupdav_get.o groupdav_propfind.o groupdav_delete.o \
        groupdav_options.o autocompletion.o tabs.o smtpqueue.o sieve.o \
        groupdav_put.o http_datestring.o setup_wizard.o fmt_date.o \
-       gettext.o downloads.o \
+       gettext.o downloads.o addressbook_popup.o \
        $(LIBOBJS) $(LIBS) $(LDFLAGS) -o webserver
 
 .c.o:
diff --git a/webcit/addressbook_popup.c b/webcit/addressbook_popup.c
new file mode 100644 (file)
index 0000000..38308ee
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * $Id:  $
+ *//**
+ * \defgroup AjaxAutoCompletion ajax-powered autocompletion...
+ * \ingroup ClientPower
+ */
+
+/*@{*/
+#include "webcit.h"
+
+/**
+ * \brief Address book popup results
+ */
+void display_address_book_inner_div(void) {
+       begin_ajax_response();
+
+       wprintf("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam sed dui. Donec in nibh id orci viverra auctor. Pellentesque elementum, orci eu lacinia pulvinar, odio lorem consectetuer augue, sed rhoncus est sem tempus nibh. Ut hendrerit rhoncus lectus. Nam sit amet augue. Vestibulum pulvinar, urna a condimentum gravida, dolor dolor congue metus, vel ultrices elit nisl a lorem. Morbi aliquam mauris at enim. Integer tristique. Vestibulum et est. Vestibulum tellus massa, fringilla et, porttitor quis, fringilla sit amet, massa.  Proin neque.");
+
+       end_ajax_response();
+}
+
+
+/** @} */
index edcd544994613a5abded640aa4d255b6d3699df5..cfcf8ff94d3f2af60e6ccf9dc034fd03a48f24a8 100644 (file)
@@ -32,7 +32,7 @@ struct addrbookent {
 /**
  * \brief      Wrapper around iconv_open()
  *             Our version adds aliases for non-standard Microsoft charsets
- *              such as 'MS950', aliasing them to names like 'CP950'
+ *           such as 'MS950', aliasing them to names like 'CP950'
  *
  * \param      tocode          Target encoding
  * \param      fromcode        Source encoding
@@ -1271,7 +1271,7 @@ void display_headers(char *msgnum_as_string) {
 
 /**
  * \brief Read message in simple, JavaScript-embeddable form for 'forward'
- *        or 'reply quoted' operations.
+ *     or 'reply quoted' operations.
  *
  * NOTE: it is VITALLY IMPORTANT that we output no single-quotes or linebreaks
  *       in this function.  Doing so would throw a JavaScript error in the
@@ -3007,6 +3007,17 @@ void display_enter(void)
                escputs(bstr("recp"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"recp_name_choices\"></div>");
+
+               /** Pop open an address book -- begin **/
+
+               wprintf(
+                       "<a href=\"javascript:PopOpenAddressBook();\" title=\"FIXME\">"
+                       "<img border=0 width=16 height=16 src=\"static/viewcontacts_16x.gif\">"
+                       "</a>"
+               );
+
+               /** Pop open an address book -- end **/
+
                wprintf("</td><td></td></tr>\n");
 
                wprintf("<tr><td>");
@@ -3186,6 +3197,23 @@ void display_enter(void)
        wprintf("</form>\n");
 
        wprintf("</td></tr></table></div>\n");
+
+       /* Close the main div, now open a new one, hidden initially, for address book popups.
+        * Remember: the popup 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
+        * calendar too.
+        */
+       wprintf("</div><div id=\"address_book_popup\" style=\"display:none;\">");
+       svprintf("BOXTITLE", WCS_STRING,  _("Contacts") );
+       do_template("beginbox");
+       wprintf("<div id=\"address_book_inner_div\"></div>");
+       wprintf("<div align=center><p class=\"close_popup\" "
+               "onclick=\"javascript:Effect.Fade('address_book_popup', { duration: 0.5 });\" "
+               ">");
+               wprintf(_("Close window"));
+               wprintf("</p></div>");
+       do_template("endbox");
+
 DONE:  wDumpContent(1);
 }
 
index 6c7adfd35b9b12412bb5465b4555f32128848ed3..5cee8c9f21012816ca6b76aa303147fe42346f85 100644 (file)
@@ -278,12 +278,12 @@ void readinfo(void)
        serv_getln(buf, sizeof buf);
        if (buf[0] == '1') {
                 wprintf("<div class=\"infos\" "
-                "onclick=\"javascript:document.getElementById('room_infos').style.display='block';\" "
+                "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
                 ">");
                 wprintf(_("Room info"));
-                wprintf("</div><div id=\"room_infos\" "
+                wprintf("</div><div id=\"room_infos\" style=\"display:none;\">"
                 "<p class=\"close_infos\" "
-                "onclick=\"javascript:document.getElementById('room_infos').style.display='none';\" "
+                "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
                 ">");
                wprintf(_("Close window"));
                wprintf("</p>");
index 7f4100a4fed7dc367821c31b1f2ecb9772b3a444..9deeec67843f70d2173188cc0ee05fab06ed400c 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");
@@ -627,27 +630,41 @@ function CtdlLoadScreen(elementid) {
 var elem = document.getElementById(elementid);
 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' } );
-}
-}
-catch(err){
-return true;
+       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;
 }
-return false;
+
+
+// Pop open the address book
+function PopOpenAddressBook() {
+       $('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>";
+       Effect.Appear('address_book_popup', { duration: 0.5 } );
+       new Ajax.Updater(
+               'address_book_inner_div',
+               'display_address_book_inner_div',
+               { method: 'get', parameters: Math.random() }
+       );
 }
index e4fd4ccb2d0aac912ea5cee8addfd5974ca7b447..ecb79e36af36594bc3b8731b89e6a4ddafd48f03 100644 (file)
@@ -98,7 +98,6 @@ body {
 }
 
 #room_infos {
-        display: none;
         position: absolute;
         top: 0px;
         left: 50%;
@@ -859,3 +858,25 @@ div.auto_complete ul strong.highlight {
         text-align: left;
 }
 
+#address_book_popup {
+        position: absolute;
+        top: 100px;
+        left: 25%;
+        width: 320px;
+       height: 320px;
+        padding: 11px;
+        margin: 0px;
+        z-index: 100;
+        color: #666;
+        background: white;
+}
+
+#address_book_popup .close_popup {
+       cursor: pointer;
+        font-size: 8pt;
+       color: black;
+        text-align: right;
+        padding: 2px;
+       margin-top: 5px;
+}
+
index 92ee595e69e04eef55474142f1b14ef2815372af..ab21eaab8d9eecf51c635b02c3e1e8e87bb95fa3 100644 (file)
@@ -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_inner_div")) {
+               display_address_book_inner_div();
        } else if (!strcasecmp(action, "set_floordiv_expanded")) {
                set_floordiv_expanded(index[1]);
        } else if (!strcasecmp(action, "diagnostics")) {
index 37a401f8e1404a3c5e3c8fc2e3170a2cc3c9606f..446c00ef1d0b0c7cccfc57835e5b9db8601a2342 100644 (file)
@@ -638,6 +638,7 @@ void CtdlMakeTempFileName(char *, int);
 void display_preferences(void);
 void set_preferences(void);
 void recp_autocomplete(char *);
+void display_address_book_inner_div(void);
 void begin_ajax_response(void);
 void end_ajax_response(void);
 void initialize_viewdefs(void);