* When displaying meeting invitations, only show date/time for VEVENT
authorArt Cancro <ajc@citadel.org>
Mon, 7 Oct 2002 04:10:38 +0000 (04:10 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 7 Oct 2002 04:10:38 +0000 (04:10 +0000)
  subcomponents.  Date/time for other subcomponents are irrelevant.
* Cleaned up HTML display of meeting invitations.

webcit/ChangeLog
webcit/calendar.c

index 4ee5c35f343dadbed596048817f13172c624bc0b..36fbf5b120c8ae0c314b5b82d7917fcd493aa6f8 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 400.34  2002/10/07 04:10:37  ajc
+* When displaying meeting invitations, only show date/time for VEVENT
+  subcomponents.  Date/time for other subcomponents are irrelevant.
+* Cleaned up HTML display of meeting invitations.
+
 Revision 400.33  2002/10/03 03:40:31  ajc
 * Worked on meeting accept/decline a little bit
 
@@ -1052,4 +1057,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 4f54c8105a0ee6b75c74d936ff56abcd0f69a019..006e4a0a864acff50c0661be60966ecd3fe792d4 100644 (file)
@@ -80,6 +80,12 @@ void cal_process_object(icalcomponent *cal,
        icalproperty *p;
        struct icaltimetype t;
        time_t tt;
+       char buf[SIZ];
+
+       /* Leading HTML for the display of this object */
+       if (recursion_level == 0) {
+               wprintf("<CENTER><TABLE border=0 cellpadding=5>\n");
+       }
 
        /* Look for a method */
        method = icalcomponent_get_first_property(cal, ICAL_METHOD_PROPERTY);
@@ -89,55 +95,70 @@ void cal_process_object(icalcomponent *cal,
                the_method = icalproperty_get_method(method);
                switch(the_method) {
                    case ICAL_METHOD_REQUEST:
-                       wprintf("<CENTER><IMG ALIGN=CENTER "
+                       wprintf("<TR><TD COLSPAN=2>\n"
+                               "<IMG ALIGN=CENTER "
                                "SRC=\"/static/vcalendar.gif\">"
                                "&nbsp;&nbsp;"  
-                               "<B>Meeting invitation</B></CENTER><BR>\n"
+                               "<B>Meeting invitation</B>
+                               </TD></TR>\n"
                        );
                        break;
                    default:
-                       wprintf("I don't know what to do with this.<BR>\n");
+                       wprintf("<TR><TD COLSPAN=2>"
+                               "I don't know what to do with this.</TD></TR>"
+                               "\n");
                        break;
                }
        }
 
        p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY);
         if (p != NULL) {
-               wprintf("<B>Summary:</B> ");
+               wprintf("<TR><TD><B>Summary:</B></TD><TD>");
                escputs((char *)icalproperty_get_comment(p));
-               wprintf("<BR>\n");
+               wprintf("</TD></TR>\n");
         }
 
        p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY);
         if (p != NULL) {
-               wprintf("<B>Location:</B> ");
+               wprintf("<TR><TD><B>Location:</B></TD><TD>");
                escputs((char *)icalproperty_get_comment(p));
-               wprintf("<BR>\n");
+               wprintf("</TD></TR>\n");
         }
 
-       p = icalcomponent_get_first_property(cal, ICAL_DTSTART_PROPERTY);
-        if (p != NULL) {
-               t = icalproperty_get_dtstart(p);
-               tt = icaltime_as_timet(t);
-               wprintf("<B>Starting date/time:</B> %s<BR>",
-                       asctime(localtime(&tt))
-               );
-       }
+       /*
+        * Only show start/end times if we're actually looking at the VEVENT
+        * component.  Otherwise it shows bogus dates for things like timezone.
+        */
+       if (icalcomponent_isa(cal) == ICAL_VEVENT_COMPONENT) {
+
+               p = icalcomponent_get_first_property(cal,
+                                               ICAL_DTSTART_PROPERTY);
+               if (p != NULL) {
+                       t = icalproperty_get_dtstart(p);
+                       tt = icaltime_as_timet(t);
+                       fmt_date(buf, tt);
+                       wprintf("<TR><TD><B>Starting date/time:</B></TD><TD>"
+                               "%s</TD></TR>", buf
+                       );
+               }
+       
+               p = icalcomponent_get_first_property(cal, ICAL_DTEND_PROPERTY);
+               if (p != NULL) {
+                       t = icalproperty_get_dtend(p);
+                       tt = icaltime_as_timet(t);
+                       fmt_date(buf, tt);
+                       wprintf("<TR><TD><B>Ending date/time:</B></TD><TD>"
+                               "%s</TD></TR>", buf
+                       );
+               }
 
-       p = icalcomponent_get_first_property(cal, ICAL_DTEND_PROPERTY);
-        if (p != NULL) {
-               t = icalproperty_get_dtstart(p);
-               tt = icaltime_as_timet(t);
-               wprintf("<B>Ending date/time:</B> %s<BR>",
-                       asctime(localtime(&tt))
-               );
        }
 
        p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY);
         if (p != NULL) {
-               wprintf("<B>Description:</B> ");
+               wprintf("<TR><TD><B>Description:</B></TD><TD>");
                escputs((char *)icalproperty_get_comment(p));
-               wprintf("<BR>\n");
+               wprintf("</TD></TR>\n");
         }
 
        /* If the component has subcomponents, recurse through them. */
@@ -148,15 +169,18 @@ void cal_process_object(icalcomponent *cal,
                cal_process_object(c, recursion_level+1);
        }
 
+       /* Trailing HTML for the display of this object */
        if (recursion_level == 0) {
-               wprintf("<CENTER><FORM METHOD=\"GET\" "
+               wprintf("<TR><TD COLSPAN=2>"
+                       "<FORM METHOD=\"GET\" "
                        "ACTION=\"/respond_to_request\">\n"
                        "<INPUT TYPE=\"submit\" NAME=\"sc\" "
                                "VALUE=\"Accept\">"
                        "&nbsp;&nbsp;"
                        "<INPUT TYPE=\"submit\" NAME=\"sc\" "
                                "VALUE=\"Decline\">"
-                       "</FORM></CENTER>\n"
+                       "</FORM>"
+                       "</TD></TR></TABLE></CENTER>\n"
                );
        }
 }