aaaaaaaaaaaaaaaaahhhhh more recurrence editor
authorArt Cancro <ajc@citadel.org>
Fri, 17 Oct 2008 02:07:54 +0000 (02:07 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 17 Oct 2008 02:07:54 +0000 (02:07 +0000)
webcit/calendar.c
webcit/event.c
webcit/tabs.c

index ed5c4bc59272ae3c3af03d4c62dc418c29315fa5..4bef7441dff6879c146891514c7e159e4bfa8986 100644 (file)
@@ -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)); */
 
 }
index f073f47b58492719f8bfce4553c334cd3c53fde3..61b389f136dc55cc3175a46b45aa2dc99971a042 100644 (file)
@@ -524,6 +524,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<div id=\"monthday_selector\">");      /* begin 'monthday_selector' div */
 
        wprintf("<input type=\"radio\" name=\"rrmonthtype\" id=\"rrmonthtype_mday\" "
+               "value=\"rrmonthtype_mday\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((which_rrmonthtype_is_preselected == 0) ? "checked" : "")
        );
@@ -550,6 +551,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<br />\n");
 
        wprintf("<input type=\"radio\" name=\"rrmonthtype\" id=\"rrmonthtype_wday\" "
+               "value=\"rrmonthtype_wday\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((which_rrmonthtype_is_preselected == 1) ? "checked" : "")
        );
@@ -600,6 +602,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<div id=\"yearday_selector\">");       /* begin 'yearday_selector' div */
 
        wprintf("<input type=\"radio\" name=\"rryeartype\" id=\"rryeartype_ymday\" "
+               "value=\"rryeartype_ymday\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((which_rryeartype_is_preselected == 0) ? "checked" : "")
        );
@@ -607,6 +610,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<span id=\"ymday\">%s</span><br />", _("year on this date"));
 
        wprintf("<input type=\"radio\" name=\"rryeartype\" id=\"rryeartype_ywday\" "
+               "value=\"rryeartype_ywday\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((which_rryeartype_is_preselected == 1) ? "checked" : "")
        );
@@ -663,12 +667,14 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("</b></td><td>\n");
 
        wprintf("<input type=\"radio\" name=\"rrend\" id=\"rrend_none\" "
+               "value=\"rrend_none\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((which_rrend_is_preselected == 0) ? "checked" : "")
        );
        wprintf("%s<br />\n", _("No ending date"));
 
        wprintf("<input type=\"radio\" name=\"rrend\" id=\"rrend_count\" "
+               "value=\"rrend_count\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((which_rrend_is_preselected == 1) ? "checked" : "")
        );
@@ -679,6 +685,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<br />\n");
 
        wprintf("<input type=\"radio\" name=\"rrend\" id=\"rrend_until\" "
+               "value=\"rrend_until\" "
                "%s onChange=\"RecurrenceShowHide();\">",
                ((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")) {
index c9d1e60a8acf803432a8c3a8a45d956d82ae7c93..a0cb7a6eb4fef63d9a6f691c259821fc36d7314b 100644 (file)
@@ -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("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"