*/
/**
* \defgroup EditCal Editing calendar events.
- *
+ * \ingroup Calendaring
*/
/*@{*/
#include "webcit.h"
/** Begin output */
output_headers(1, 1, 2, 0, 0, 0);
wprintf("<div id=\"banner\">\n"
- "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+ "<TABLE class=\"event_banner\"><TR><TD>"
"<SPAN CLASS=\"titlebar\">");
wprintf(_("Add or edit an event"));
wprintf("</SPAN>"
wprintf("<div class=\"fix_scrollbar_bug\">"
- "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
+ "<table class=\"event_background\"><tr><td>\n");
/************************************************************
* Uncomment this to see the UID in calendar events for debugging
*************************************************************/
wprintf("<FORM NAME=\"EventForm\" METHOD=\"POST\" action=\"save_event\">\n");
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n",
msgnum);
* Determine who is the organizer of this event.
* We need to determine "me" or "not me."
*/
- organizer = icalcomponent_get_first_property(vevent,
- ICAL_ORGANIZER_PROPERTY);
+ organizer = icalcomponent_get_first_property(vevent, ICAL_ORGANIZER_PROPERTY);
if (organizer != NULL) {
strcpy(organizer_string, icalproperty_get_organizer(organizer));
if (!strncasecmp(organizer_string, "MAILTO:", 7)) {
strcpy(organizer_string, &organizer_string[7]);
striplt(organizer_string);
- lprintf(9, "ISME %s\n", organizer_string);
serv_printf("ISME %s", organizer_string);
serv_getln(buf, sizeof buf);
- lprintf(9, "%s\n", buf);
if (buf[0] == '2') {
organizer_is_me = 1;
}
wprintf("<TR><TD><B>");
wprintf(_("Attendees"));
wprintf("</B><br />"
- "<FONT SIZE=-2>");
+ "<font size=-2>");
wprintf(_("(One per line)"));
- wprintf("</FONT></TD><TD>"
- "<TEXTAREA %s NAME=\"attendees\" wrap=soft "
+ wprintf("</font>\n");
+
+ /** Pop open an address book -- begin **/
+ wprintf(
+ " <a href=\"javascript:PopOpenAddressBook('attendees_box|%s');\" "
+ "title=\"%s\">"
+ "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
+ "</a>",
+ _("Attendees"),
+ _("Contacts")
+ );
+ /** Pop open an address book -- end **/
+
+ wprintf("</TD><TD>"
+ "<TEXTAREA %s NAME=\"attendees\" id=\"attendees_box\" wrap=soft "
"ROWS=3 COLS=80 WIDTH=80>\n",
(organizer_is_me ? "" : "DISABLED ")
);
"grey_all_day();"
"</script>\n"
);
+
+ address_book_popup();
wDumpContent(1);
if (created_new_vevent) {
struct icaltimetype event_start, t;
icalproperty *attendee = NULL;
char attendee_string[SIZ];
- int i;
+ int i, j;
int foundit;
char form_attendees[SIZ];
char organizer_string[SIZ];
icalcomponent_remove_property(vevent, prop);
icalproperty_free(prop);
}
- icalcomponent_add_property(vevent,
- icalproperty_new_summary(bstr("summary")));
- while (prop = icalcomponent_get_first_property(vevent,
- ICAL_LOCATION_PROPERTY), prop != NULL) {
- icalcomponent_remove_property(vevent, prop);
- icalproperty_free(prop);
- }
- icalcomponent_add_property(vevent,
- icalproperty_new_location(bstr("location")));
-
- while (prop = icalcomponent_get_first_property(vevent,
- ICAL_DESCRIPTION_PROPERTY), prop != NULL) {
- icalcomponent_remove_property(vevent, prop);
- icalproperty_free(prop);
- }
- icalcomponent_add_property(vevent,
- icalproperty_new_description(bstr("description")));
+ if (strlen(bstr("summary")) > 0) {
+
+ icalcomponent_add_property(vevent,
+ icalproperty_new_summary(bstr("summary")));
+ } else {
+ icalcomponent_add_property(vevent,
+ icalproperty_new_summary("Untitled Event"));
+ }
+ while (prop = icalcomponent_get_first_property(vevent,
+ ICAL_LOCATION_PROPERTY), prop != NULL) {
+ icalcomponent_remove_property(vevent, prop);
+ icalproperty_free(prop);
+ }
+ if (strlen(bstr("location")) > 0) {
+ icalcomponent_add_property(vevent,
+ icalproperty_new_location(bstr("location")));
+ }
+ while (prop = icalcomponent_get_first_property(vevent,
+ ICAL_DESCRIPTION_PROPERTY), prop != NULL) {
+ icalcomponent_remove_property(vevent, prop);
+ icalproperty_free(prop);
+ }
+ if (strlen(bstr("description")) > 0) {
+ icalcomponent_add_property(vevent,
+ icalproperty_new_description(bstr("description")));
+ }
+
while (prop = icalcomponent_get_first_property(vevent,
ICAL_DTSTART_PROPERTY), prop != NULL) {
icalcomponent_remove_property(vevent, prop);
/** set new organizer */
sprintf(organizer_string, "MAILTO:%s", buf);
icalcomponent_add_property(vevent,
- icalproperty_new_organizer(organizer_string)
+ icalproperty_new_organizer(organizer_string)
);
}
strcpy(form_attendees, bstr("attendees"));
stripout(form_attendees, '(', ')');
+ /* Next, change any commas to newlines, because we want newline-separated attendees. */
+ j = strlen(form_attendees);
+ for (i=0; i<j; ++i) {
+ if (form_attendees[i] == ',') {
+ form_attendees[i] = '\n';
+ while (isspace(form_attendees[i+1])) {
+ strcpy(&form_attendees[i+1], &form_attendees[i+2]);
+ }
+ }
+ }
+
/** Now iterate! */
for (i=0; i<num_tokens(form_attendees, '\n'); ++i) {
extract_token(buf, form_attendees, i, '\n', sizeof buf);
lprintf(9, "Encapsulating into full VCALENDAR component\n");
encaps = ical_encapsulate_subcomponent(icalcomponent_new_clone(vevent));
+ /* Set the method to PUBLISH */
+ icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
+
/** If the user clicked 'Save' then save it to the server. */
lprintf(9, "Serializing it for saving\n");
if ( (encaps != NULL) && (strlen(bstr("save_button")) > 0) ) {
serv_puts(icalcomponent_as_ical_string(encaps));
serv_puts("000");
}
- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- lprintf(9, "ENT0 REPLY: %s\n", buf);
+ if ( (buf[0] == '8') || (buf[0] == '4') ) {
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ lprintf(9, "ENT0 REPLY: %s\n", buf);
+ }
+ }
+ if (buf[0] == '2') {
+ strcpy(WC->ImportantMessage, &buf[4]);
}
icalcomponent_free(encaps);
}
icalcomponent_free(vevent);
}
- /** If this was a save or deelete, go back to the calendar view. */
+ /** If this was a save or delete, go back to the calendar view. */
if (strlen(bstr("check_button")) == 0) {
readloop("readfwd");
}