]> code.citadel.org Git - citadel.git/blobdiff - webcit/event.c
annotated some places where code needs to be added
[citadel.git] / webcit / event.c
index eb016a2754158a748ae3542d0f4999f4480f160d..041e5b83301084961117802b288a7fccd0ad1cfb 100644 (file)
@@ -529,10 +529,16 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                ((which_rrmonthtype_is_preselected == 0) ? "checked" : "")
        );
 
-       char mdaybox[256];
-       int rrmday = 1;                                 /* FIXME default to same as event start */
-       int rrmweek = 1;                                /* FIXME default to same as event start */
-       int rrmweekday = 1;                             /* FIXME default to same as event start */
+       int rrmday = t_start.day;
+       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;
@@ -544,10 +550,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                rrmweekday = icalrecurrencetype_day_day_of_week(recur.by_day[0]) - 1;
        }
 
-       snprintf(mdaybox, sizeof mdaybox,
-               "<input type=\"text\" name=\"rrmday\" id=\"rrmday\" maxlength=\"2\" size=\"2\" "
-               "value=\"%d\">", rrmday);
-       wprintf(_("on day %s of the month"), mdaybox);
+       wprintf(_("on day %s%d%s of the month"), "<span id=\"rrmday\">", rrmday, "</span>");
        wprintf("<br />\n");
 
        wprintf("<input type=\"radio\" name=\"rrmonthtype\" id=\"rrmonthtype_wday\" "
@@ -585,9 +588,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("</div>\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;
 
@@ -921,9 +926,18 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr
                                        break;
 
                                case ICAL_MONTHLY_RECURRENCE:
+                                       if (!strcasecmp(bstr("rrmonthtype"), "rrmonthtype_mday")) {
+                                               recur.by_month_day[0] = event_start.day;
+                                               recur.by_month_day[1] = ICAL_RECURRENCE_ARRAY_MAX;
+                                       }
+                                       else if (!strcasecmp(bstr("rrmonthtype"), "rrmonthtype_wday")) {
+                                               lprintf(9, "MONTHLY BY WDAY\n");
+                                               /* FIXME implement this */
+                                       }
                                        break;
 
                                case ICAL_YEARLY_RECURRENCE:
+                                       /* FIXME implement this */
                                        break;
 
                                /* This one can't happen either. */