A single address book popup now supports multiple
authorArt Cancro <ajc@citadel.org>
Mon, 23 Apr 2007 14:56:13 +0000 (14:56 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 23 Apr 2007 14:56:13 +0000 (14:56 +0000)
targets (such as To: Cc: Bcc:).  Thanks to Ben for the idea.

webcit/addressbook_popup.c
webcit/messages.c
webcit/static/wclib.js

index 43f12032a83caf67870b4dd1b5c254468b48322b..2b3cd7f385ac42fde1f80766b046b9a8e26371a8 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * $Id:  $
- *//**
+ * $Id$
+ *
  * \defgroup AjaxAutoCompletion ajax-powered autocompletion...
  * \ingroup ClientPower
  */
@@ -83,6 +83,10 @@ void display_address_book_middle_div(void) {
 void display_address_book_inner_div() {
        char buf[256];
        char username[256];
+       int num_targets = 0;
+       char target_id[64];
+       char target_label[64];
+       int i;
 
        begin_ajax_response();
 
@@ -118,10 +122,22 @@ void display_address_book_inner_div() {
 
        wprintf("</select>\n");
 
-       wprintf("<INPUT TYPE=\"submit\" NAME=\"select_button\" VALUE=\"%s\" ", _("Select"));
-       wprintf("onClick=\"AddContactsToTarget($('%s'),$('whichaddr'));\">", bstr("target_input"));
+       wprintf("%s: ", _("Add"));
+
+       num_targets = num_tokens(bstr("target_input"), '|');
+       for (i=0; i<num_targets; i+=2) {
+               extract_token(target_id, bstr("target_input"), i, '|', sizeof target_id);
+               extract_token(target_label, bstr("target_input"), i+1, '|', sizeof target_label);
+               wprintf("<INPUT TYPE=\"submit\" NAME=\"select_button\" VALUE=\"%s\" ", target_label);
+               wprintf("onClick=\"AddContactsToTarget($('%s'),$('whichaddr'));\">", target_id);
+       }
+
+       /* This 'close window' button works.  Omitting it because we already have a close button
+        * in the upper right corner, and this one takes up space.
+        *
        wprintf("<INPUT TYPE=\"submit\" NAME=\"close_button\" VALUE=\"%s\" ", _("Close window"));
        wprintf("onclick=\"javascript:$('address_book_popup').style.display='none';\">");
+        */
 
        wprintf("</form></div>\n");
 
index db930c7230b05f611aa25b94398e76b396d380ad..fc380bf554d510e181f743748b99a6a5f14e4ef1 100644 (file)
@@ -3015,16 +3015,20 @@ void display_enter(void)
                escputs(bstr("recp"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"recp_name_choices\"></div>");
+               wprintf("</td><td rowspan=3>");
 
                /** Pop open an address book -- begin **/
                wprintf(
-                       "&nbsp;<a href=\"javascript:PopOpenAddressBook('recp_id');\" title=\"%s\">"
-                       "<img align=middle border=0 width=16 height=16 src=\"static/viewcontacts_16x.gif\">"
-                       "</a>", _("Contacts")
+                       "<a href=\"javascript:PopOpenAddressBook('recp_id|%s|cc_id|%s|bcc_id|%s');\" "
+                       "title=\"%s\">"
+                       "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
+                       "&nbsp;%s</a>",
+                       _("To:"), _("CC:"), _("BCC:"),
+                       _("Contacts"), _("Contacts")
                );
                /** Pop open an address book -- end **/
 
-               wprintf("</td><td></td></tr>\n");
+               wprintf("</td></tr>\n");
 
                wprintf("<tr><td>");
                wprintf("<font size=-1>");
@@ -3035,16 +3039,7 @@ void display_enter(void)
                escputs(bstr("cc"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"cc_name_choices\"></div>");
-
-               /** Pop open an address book -- begin **/
-               wprintf(
-                       "&nbsp;<a href=\"javascript:PopOpenAddressBook('cc_id');\" title=\"%s\">"
-                       "<img align=middle border=0 width=16 height=16 src=\"static/viewcontacts_16x.gif\">"
-                       "</a>", _("Contacts")
-               );
-               /** Pop open an address book -- end **/
-
-               wprintf("</td><td></td></tr>\n");
+               wprintf("</td></tr>\n");
 
                wprintf("<tr><td>");
                wprintf("<font size=-1>");
@@ -3055,15 +3050,7 @@ void display_enter(void)
                escputs(bstr("bcc"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"bcc_name_choices\"></div>");
-
-               /** Pop open an address book -- begin **/
-               wprintf(
-                       "&nbsp;<a href=\"javascript:PopOpenAddressBook('bcc_id');\" title=\"%s\">"
-                       "<img align=middle border=0 width=16 height=16 src=\"static/viewcontacts_16x.gif\">"
-                       "</a>", _("Contacts")
-               );
-               /** Pop open an address book -- end **/
-               wprintf("</td><td></td></tr>\n");
+               wprintf("</td></tr>\n");
 
                /** Initialize the autocomplete ajax helpers (found in wclib.js) */
                wprintf("<script type=\"text/javascript\">      \n"
index ac8c4284bf51fff23afc7fe3dbfebc5887050168..19557fd6496d5b13cb5f3d900acf98691d43abf2 100644 (file)
@@ -1,5 +1,5 @@
 //
-// $Id: wclib.js,v 625.2 2005/09/18 04:04:32 ajc Exp $
+// $Id$
 //
 // JavaScript function library for WebCit.
 //