Allow multiple addresses to be selected.
authorArt Cancro <ajc@citadel.org>
Mon, 23 Apr 2007 13:40:22 +0000 (13:40 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 23 Apr 2007 13:40:22 +0000 (13:40 +0000)
webcit/addressbook_popup.c
webcit/event.c
webcit/messages.c
webcit/static/wclib.js
webcit/webcit.h

index 41753f33e1eba6e70185c850f3a9642a74524cd1..43f12032a83caf67870b4dd1b5c254468b48322b 100644 (file)
@@ -9,6 +9,20 @@
 #include "webcit.h"
 
 
+/**
+ * \brief Call this right before wDumpContent() on any page which requires the address book popup
+ */
+void address_book_popup(void) {
+       /* Open a new div, hidden initially, for address book popups. */
+       wprintf("</div>\n");    /* End of 'content' div */
+       wprintf("<div id=\"address_book_popup\" style=\"display:none;\">");
+       wprintf("<div id=\"address_book_popup_container_div\">");
+       wprintf("<div id=\"address_book_popup_middle_div\"></div>");
+       wprintf("<div id=\"address_book_inner_div\"></div>");
+       wprintf("</div>");
+       /* The 'address_book_popup' div will be closed by wDumpContent() */
+}
+
 /**
  * \brief Address book popup window
  */
@@ -73,7 +87,7 @@ void display_address_book_inner_div() {
        begin_ajax_response();
 
        wprintf("<div align=center><form onSubmit=\"return false;\">"
-               "<select name=\"whichaddr\" id=\"whichaddr\" size=\"15\">\n");
+               "<select multiple name=\"whichaddr\" id=\"whichaddr\" size=\"15\">\n");
 
        if (!strcasecmp(bstr("which_addr_book"), "__LOCAL_USERS__")) {
                serv_puts("LIST");
@@ -105,13 +119,7 @@ void display_address_book_inner_div() {
        wprintf("</select>\n");
 
        wprintf("<INPUT TYPE=\"submit\" NAME=\"select_button\" VALUE=\"%s\" ", _("Select"));
-       wprintf("onClick=\"if ($('%s').value.length > 0) { $('%s').value = $('%s').value + ', '; } $('%s').value=$('%s').value + $('whichaddr').value;\">",
-               bstr("target_input"),
-               bstr("target_input"),
-               bstr("target_input"),
-               bstr("target_input"),
-               bstr("target_input")
-       );
+       wprintf("onClick=\"AddContactsToTarget($('%s'),$('whichaddr'));\">", bstr("target_input"));
        wprintf("<INPUT TYPE=\"submit\" NAME=\"close_button\" VALUE=\"%s\" ", _("Close window"));
        wprintf("onclick=\"javascript:$('address_book_popup').style.display='none';\">");
 
index 9c283c6e4bc201d0880c50d6ce828e4d20bd9b84..3ac9e474838bb6af9088b8ecea305cf172a7fab7 100644 (file)
@@ -348,7 +348,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
                "<FONT SIZE=-2>");
        wprintf(_("(One per line)"));
        wprintf("</FONT></TD><TD>"
-               "<TEXTAREA %s NAME=\"attendees\" wrap=soft "
+               "<TEXTAREA %s NAME=\"attendees\" id=\"attendees_box\" wrap=soft "
                "ROWS=3 COLS=80 WIDTH=80>\n",
                (organizer_is_me ? "" : "DISABLED ")
        );
index 9e686029f55acc6075751e1446ee0a7065f357ad..db930c7230b05f611aa25b94398e76b396d380ad 100644 (file)
@@ -3225,19 +3225,8 @@ void display_enter(void)
        wprintf("</form>\n");
        wprintf("</td></tr></table></div>\n");
 
-       wprintf("</div>\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("<div id=\"address_book_popup\" style=\"display:none;\">");
-       wprintf("<div id=\"address_book_popup_container_div\">");
-       wprintf("<div id=\"address_book_popup_middle_div\"></div>");
-       wprintf("<div id=\"address_book_inner_div\"></div>");
-       wprintf("</div>");
-       /* The 'address_book_popup' div will be closed by wDumpContent() */
-DONE:  wDumpContent(1);
+DONE:  address_book_popup();
+       wDumpContent(1);
 }
 
 
index 7063f6e2440c383d018195fa916ec43530d3cc9d..ac8c4284bf51fff23afc7fe3dbfebc5887050168 100644 (file)
@@ -694,3 +694,16 @@ function PopulateAddressBookInnerDiv(which_addr_book, target_input) {
                }
        );
 }
+
+// What happens when a contact is selected from the address book popup
+// (populate the specified target)
+
+function AddContactsToTarget(target, whichaddr) {
+       while (whichaddr.selectedIndex != -1) {
+               if (target.value.length > 0) {
+                       target.value = target.value + ', ';
+               }
+               target.value = target.value + whichaddr.value;
+               whichaddr.options[whichaddr.selectedIndex].selected = false;
+       }
+}
index 40a5f7c9859305829e60531e5899eacd53c7a897..da0a6c450e384adb5a12a30d07317095b1368241 100644 (file)
@@ -638,6 +638,7 @@ void CtdlMakeTempFileName(char *, int);
 void display_preferences(void);
 void set_preferences(void);
 void recp_autocomplete(char *);
+void address_book_popup(void);
 void display_address_book_middle_div(void);
 void display_address_book_inner_div(void);
 void begin_ajax_response(void);