From 5781ffcd1cafce9a8f8e1100bea65495a5c593d3 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 21 Oct 2008 21:41:13 +0000 Subject: [PATCH] more work on the recurrence editor --- webcit/event.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/webcit/event.c b/webcit/event.c index 2d942aba4..82da8f453 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -530,9 +530,16 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, ); int rrmday = t_start.day; - int rrmweek = 1; /* FIXME default to same as event start */ int rrmweekday = icaltime_day_of_week(t_start) - 1; + /* Figure out what week of the month we're in */ + icaltimetype day1 = t_start; + day1.day = 1; + int weekbase = icaltime_week_number(day1); + int rrmweek = icaltime_week_number(t_start) - weekbase + 1; + + /* Are we going by day of the month or week/day? */ + if (recur.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { which_rrmonthtype_is_preselected = 0; rrmday = recur.by_month_day[0]; @@ -581,9 +588,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("\n"); /* end 'monthday_selector' div */ - int rrymweek = 1; /* FIXME default to same as event start */ - int rrymweekday = 1; /* FIXME default to same as event start */ - int rrymonth = 1; /* FIXME default to same as event start */ + int rrymweek = rrmweek; + int rrymweekday = rrmweekday; + int rrymonth = t_start.month; + + lprintf(9, "FIXME: RRYMWEEK %d, RRYMWEEKDAY %d, RRYMONTH %d\n", rrymweek, rrymweekday, rrymonth); int which_rryeartype_is_preselected = 0; -- 2.39.2