X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fcalendar_tools.c;h=3d875c307bdbc738c73b86a7072cf5b0ab5a55f1;hb=HEAD;hp=24af40dd69a14c94dd3415b12ea37f45589102ab;hpb=79446540dc9252f6bac460e9f20664377964549b;p=citadel.git
diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c
index 24af40dd6..488296ca7 100644
--- a/webcit/calendar_tools.c
+++ b/webcit/calendar_tools.c
@@ -1,14 +1,23 @@
/*
- * $Id$
- */
-/**
- * \defgroup MiscCal Miscellaneous functions which handle calendar components.
+ * Miscellaneous functions which handle calendar components.
+ *
+ * Copyright (c) 1996-2012 by the citadel.org team
+ *
+ * This program is open source software. You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*/
-/*@{*/
+
#include "webcit.h"
-#include "webserver.h"
-/** Hour strings */
+#include "time.h"
+#include "calendar.h"
+
+/* Hour strings */
char *hourname[] = {
"12am", "1am", "2am", "3am", "4am", "5am", "6am",
"7am", "8am", "9am", "10am", "11am", "12pm",
@@ -16,10 +25,7 @@ char *hourname[] = {
"7pm", "8pm", "9pm", "10pm", "11pm"
};
-#ifdef WEBCIT_WITH_CALENDAR_SERVICE
-
-/**
- * \brief display and edit date/time
+/*
* The display_icaltimetype_as_webform() and icaltime_from_webform() functions
* handle the display and editing of date/time properties in web pages. The
* first one converts an icaltimetype into valid HTML markup -- a series of form
@@ -30,31 +36,27 @@ char *hourname[] = {
* property (for example, a start and end time) by ensuring the field names are
* unique within the form.
*
- * \todo NOTE: These functions assume that the icaltimetype being edited is in UTC, and
+ * NOTE: These functions assume that the icaltimetype being edited is in UTC, and
* will convert to/from local time for editing. "local" in this case is assumed
* to be the time zone in which the WebCit server is running. A future improvement
* might be to allow the user to specify his/her timezone.
- * \param t the time we want to parse
- * \param prefix ???? \todo
*/
-
-void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
+void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int date_only) {
+ wcsession *WCC = WC;
int i;
time_t now;
struct tm tm_now;
- int this_year;
time_t tt;
struct tm tm;
- const int span = 10;
int all_day_event = 0;
- char calhourformat[16];
-
- get_preference("calhourformat", calhourformat, sizeof calhourformat);
+ int time_format;
+ char timebuf[32];
+
+ time_format = get_time_format_cached ();
now = time(NULL);
localtime_r(&now, &tm_now);
- this_year = tm_now.tm_year + 1900;
if (t == NULL) return;
if (t->is_date) all_day_event = 1;
@@ -66,129 +68,114 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
localtime_r(&tt, &tm);
}
- wprintf(_("Month: "));
- wprintf("\n");
-
- wprintf(_("Day: "));
- wprintf("\n");
-
- wprintf(_("Year: "));
- wprintf("