#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
*/
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");
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';\">");
"<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 ")
);
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);
}
}
);
}
+
+// 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;
+ }
+}
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);