From cb88dc45bd418f3426f3ad47c63e2bcdcf6209d6 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 30 Sep 2008 14:48:22 +0000 Subject: [PATCH] More recurrence editor code --- webcit/calendar.c | 4 ++-- webcit/calendar_tools.c | 14 +++++++++++++- webcit/event.c | 20 +++++++++++++------- webcit/static/wclib.js | 14 ++++++++++++++ webcit/webcit.h | 2 +- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/webcit/calendar.c b/webcit/calendar.c index b966c264b..b3200fcb2 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -637,7 +637,7 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch } else IcalTime = icaltime_current_time_with_zone(get_default_icaltimezone()); - display_icaltimetype_as_webform(&IcalTime, "dtstart"); + display_icaltimetype_as_webform(&IcalTime, "dtstart", 0); wprintf("\n"); wprintf(""); @@ -658,7 +658,7 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch } else IcalTime = icaltime_current_time_with_zone(get_default_icaltimezone()); - display_icaltimetype_as_webform(&IcalTime, "due"); + display_icaltimetype_as_webform(&IcalTime, "due", 0); wprintf("\n"); todoStatus = icalcomponent_get_status(vtodo); diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index 1a9f9c99a..3e946d945 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -33,7 +33,7 @@ char *hourname[] = { * might be to allow the user to specify his/her timezone. */ -void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) { +void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int date_only) { int i; time_t now; struct tm tm_now; @@ -73,6 +73,14 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) { wprintf(prefix); wprintf("', '%s');\n", get_selected_language()); wprintf(""); + + /* If we're editing a date only, we still generate the time boxes, but we hide them. + * This keeps the data model consistent. + */ + if (date_only) { + wprintf("
"); + } + wprintf(_("Hour: ")); wprintf("\n"); + + if (date_only) { + wprintf("
"); + } } /* diff --git a/webcit/event.c b/webcit/event.c index 2ac698259..86014aaba 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -191,7 +191,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, t_start.is_utc = 1; } - display_icaltimetype_as_webform(&t_start, "dtstart"); + display_icaltimetype_as_webform(&t_start, "dtstart", 0); wprintf("\n"); wprintf(""); @@ -492,7 +492,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, - + // FIXME preselect the correct radio button wprintf(""); wprintf(_("Recurrence range")); @@ -508,15 +508,21 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, "%s onChange=\"RecurrenceShowHide();\">", (0 ? "checked" : "") ); - wprintf(_("Repeat this event %d times"), 0); - wprintf("
\n"); + wprintf(_("Repeat this event")); + wprintf(" "); + wprintf(" ", recur.count); + wprintf(_("times")); + wprintf("
\n"); wprintf("", (0 ? "checked" : "") ); - wprintf(_("Repeat this event until %s"), "FIXME"); - wprintf("
\n"); + wprintf(_("Repeat this event until ")); + wprintf(""); + display_icaltimetype_as_webform(&recur.until, "rruntil", 1); + wprintf("
\n"); wprintf("\n"); diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index 2ba65152d..09a1fb59e 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -1004,4 +1004,18 @@ function RecurrenceShowHide() { $('weekday_selector').style.display = 'none'; } + if ($('rrend_count').checked) { + $('rrcount').disabled = false; + } + else { + $('rrcount').disabled = true; + } + + if ($('rrend_until').checked) { + $('rruntil').disabled = false; + } + else { + $('rruntil').disabled = true; + } + } diff --git a/webcit/webcit.h b/webcit/webcit.h index 06a2e66b2..0e9c1338c 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -772,7 +772,7 @@ void display_pictureview(void); void display_edit_task(void); void display_edit_event(void); icaltimezone *get_default_icaltimezone(void); -void display_icaltimetype_as_webform(struct icaltimetype *, char *); +void display_icaltimetype_as_webform(struct icaltimetype *, char *, int); void icaltime_from_webform(struct icaltimetype *result, char *prefix); void icaltime_from_webform_dateonly(struct icaltimetype *result, char *prefix); void display_edit_individual_event(icalcomponent *supplied_vtodo, long msgnum, char *from, int unread); -- 2.30.2