]> code.citadel.org Git - citadel.git/commitdiff
* When adding new events to the calendar, default to the month [and day]
authorArt Cancro <ajc@citadel.org>
Sat, 16 Nov 2002 05:40:54 +0000 (05:40 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 16 Nov 2002 05:40:54 +0000 (05:40 +0000)
  currently being viewed.
* Hotlink each hour of the day view to an add-new-event for that day/hour.

webcit/ChangeLog
webcit/calendar_view.c
webcit/event.c

index 53c8a7533a4daa30fd0402756cfe69b343729cc3..74ccdba1282423beaadfac04b6bc207aaf3af478 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 400.52  2002/11/16 05:40:54  ajc
+* When adding new events to the calendar, default to the month [and day]
+  currently being viewed.
+* Hotlink each hour of the day view to an add-new-event for that day/hour.
+
 Revision 400.51  2002/11/15 05:05:47  ajc
 * Put in back/forward (yesterday/tomorrow) links in calendar day view
 
@@ -1121,4 +1126,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index ee3d5301b5f4e02a832326990b0593a95e8edfe8..56005f92cdfb57bbfb086ab5fba229a33cf90561 100644 (file)
@@ -145,9 +145,12 @@ void calendar_month_view(int year, int month, int day) {
 
        wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0>"
                "<TR><TD align=left><font color=#FFFFFF>"
-               "&nbsp;<A HREF=\"/display_edit_event?msgnum=0\">"
+               "&nbsp;<A HREF=\"/display_edit_event?msgnum=0"
+               "&year=%d&month=%d&day=%d\">"
                "Add new calendar event</A>"
-               "</font></TD>\n");
+               "</font></TD>\n",
+               year, month, day
+       );
 
        wprintf("<TD><CENTER><H3>");
 
@@ -330,13 +333,17 @@ void calendar_day_view(int year, int month, int day) {
        wprintf("<A HREF=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
                tomorrow.year, tomorrow.month, tomorrow.day
        );
-       wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/forward.gif\" BORDER=0></A>\n");
+       wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/forward.gif\""
+               " BORDER=0></A>\n");
        wprintf("</H3></CENTER>\n");
 
        wprintf("<CENTER><font color=#FFFFFF>"
-               "&nbsp;<A HREF=\"/display_edit_event?msgnum=0\">"
+               "&nbsp;<A HREF=\"/display_edit_event?msgnum=0"
+               "&year=%d&month=%d&day=%d\">"
                "Add new calendar event</A>"
-               "<BR><BR>\n");
+               "<BR><BR>\n",
+               year, month, day
+       );
 
        wprintf("<A HREF=\"readfwd?calview=month&year=%d&month=%d&day=1\">"
                "Back to month view</A>\n", year, month);
@@ -360,7 +367,11 @@ void calendar_day_view(int year, int month, int day) {
        /* Now the middle of the day... */      
        for (hour = 8; hour <= 17; ++hour) {    /* could do HEIGHT=xx */
                wprintf("<TR><TD BGCOLOR=FFFFFF VALIGN=TOP>");
-               wprintf("%d:00%s ",
+               wprintf("<A HREF=\"/display_edit_event?msgnum=0"
+                       "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
+                       year, month, day, hour
+               );
+               wprintf("%d:00%s</A> ",
                        (hour <= 12 ? hour : hour-12),
                        (hour < 12 ? "am" : "pm")
                );
index 7daf5ea347bdd5a93b7d6703bc6e0ae61a675577..50a6ed655d2ed3fe7fcd4a3e803f40aff639cdc1 100644 (file)
@@ -113,7 +113,19 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
                }
        }
        else {
-               t_start = icaltime_from_timet(now, 0);
+               memset(&t_start, 0, sizeof t_start);
+               t_start.year = atoi(bstr("year"));
+               t_start.month = atoi(bstr("month"));
+               t_start.day = atoi(bstr("day"));
+               if (strlen(bstr("hour")) > 0) {
+                       t_start.hour = atoi(bstr("hour"));
+                       t_start.minute = atoi(bstr("minute"));
+               }
+               else {
+                       t_start.hour = 9;
+                       t_start.minute = 0;
+               }
+               /* t_start = icaltime_from_timet(now, 0); */
        }
        display_icaltimetype_as_webform(&t_start, "dtstart");
 
@@ -165,7 +177,14 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
                        t_end = icalproperty_get_dtend(p);
                }
                else {
-                       t_end = icaltime_from_timet(now, 0);
+                       /* If this is not an all-day event and there is no
+                        * end time specified, make the default one hour
+                        * from the start time.
+                        */
+                       t_end = t_start;
+                       t_end.hour += 1;
+                       t_end = icaltime_normalize(t_end);
+                       /* t_end = icaltime_from_timet(now, 0); */
                }
        }
        display_icaltimetype_as_webform(&t_end, "dtend");