From 1948ce480274346dad1ccda96899c3dab318a2d9 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 17 Oct 2008 02:07:54 +0000 Subject: [PATCH] aaaaaaaaaaaaaaaaahhhhh more recurrence editor --- webcit/calendar.c | 1 + webcit/event.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ webcit/tabs.c | 22 +++++++++--------- 3 files changed, 71 insertions(+), 11 deletions(-) diff --git a/webcit/calendar.c b/webcit/calendar.c index ed5c4bc59..4bef7441d 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -547,6 +547,7 @@ void display_individual_cal(icalcomponent *cal, long msgnum, char *from, int unr if (final_recurrence > calv->upper_bound) stop_rr = 1; } } + icalrecur_iterator_free(ritr); /* lprintf(9, "Performed %d recurrences; final one is %s", num_recur, ctime(&final_recurrence)); */ } diff --git a/webcit/event.c b/webcit/event.c index f073f47b5..61b389f13 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -524,6 +524,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("
"); /* begin 'monthday_selector' div */ wprintf("", ((which_rrmonthtype_is_preselected == 0) ? "checked" : "") ); @@ -550,6 +551,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("
\n"); wprintf("", ((which_rrmonthtype_is_preselected == 1) ? "checked" : "") ); @@ -600,6 +602,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("
"); /* begin 'yearday_selector' div */ wprintf("", ((which_rryeartype_is_preselected == 0) ? "checked" : "") ); @@ -607,6 +610,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("%s
", _("year on this date")); wprintf("", ((which_rryeartype_is_preselected == 1) ? "checked" : "") ); @@ -663,12 +667,14 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("\n"); wprintf("", ((which_rrend_is_preselected == 0) ? "checked" : "") ); wprintf("%s
\n", _("No ending date")); wprintf("", ((which_rrend_is_preselected == 1) ? "checked" : "") ); @@ -679,6 +685,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("
\n"); wprintf("", ((which_rrend_is_preselected == 2) ? "checked" : "") ); @@ -872,6 +879,58 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr ); } + /* recurrence rules -- begin */ + + /* remove any existing rule */ + while (prop = icalcomponent_get_first_property(vevent, ICAL_RRULE_PROPERTY), prop != NULL) { + icalcomponent_remove_property(vevent, prop); + icalproperty_free(prop); + } + + if (yesbstr("is_recur")) { + struct icalrecurrencetype recur; + icalrecurrencetype_clear(&recur); + + recur.interval = atoi(bstr("interval")); + recur.freq = atoi(bstr("freq")); + + switch(recur.freq) { + + /* These can't happen; they're disabled. */ + case ICAL_SECONDLY_RECURRENCE: + break; + case ICAL_MINUTELY_RECURRENCE: + break; + case ICAL_HOURLY_RECURRENCE: + break; + + /* These are the real options. */ + case ICAL_DAILY_RECURRENCE: + break; + case ICAL_WEEKLY_RECURRENCE: + break; + case ICAL_MONTHLY_RECURRENCE: + break; + case ICAL_YEARLY_RECURRENCE: + break; + + /* This one can't happen either. */ + case ICAL_NO_RECURRENCE: + break; + } + + if (!strcasecmp(bstr("rrend"), "rrend_count")) { + recur.count = atoi(bstr("rrcount")); + } + else if (!strcasecmp(bstr("rrend"), "rrend_until")) { + icaltime_from_webform_dateonly(&recur.until, "rruntil"); + } + + icalcomponent_add_property(vevent, icalproperty_new_rrule(recur)); + } + + /* recurrence rules -- end */ + /* See if transparency is indicated */ if (havebstr("transp")) { if (!strcasecmp(bstr("transp"), "opaque")) { diff --git a/webcit/tabs.c b/webcit/tabs.c index c9d1e60a8..a0cb7a6eb 100644 --- a/webcit/tabs.c +++ b/webcit/tabs.c @@ -13,17 +13,17 @@ void tabbed_dialog(int num_tabs, char *tabnames[]) { int i; StrBufAppendPrintf(WC->trailing_javascript, - "var previously_selected_tab = '0'; " - "function tabsel(which_tab) { " - " if (which_tab == previously_selected_tab) { " - " return; " - " } " - " $('tabdiv'+previously_selected_tab).style.display = 'none'; " - " $('tabdiv'+which_tab).style.display = 'block'; " - " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; " - " $('tabtd'+which_tab).className = 'tab_cell_label'; " - " previously_selected_tab = which_tab; " - "} " + "var previously_selected_tab = '0'; \n" + "function tabsel(which_tab) { \n" + " if (which_tab == previously_selected_tab) { \n" + " return; \n" + " } \n" + " $('tabdiv'+previously_selected_tab).style.display = 'none'; \n" + " $('tabdiv'+which_tab).style.display = 'block'; \n" + " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; \n" + " $('tabtd'+which_tab).className = 'tab_cell_label'; \n" + " previously_selected_tab = which_tab; \n" + "} \n" ); wprintf("" -- 2.30.2