* Handle incoming RSVP's for meetings. (Note: this will not actually work
authorArt Cancro <ajc@citadel.org>
Sat, 7 Dec 2002 22:12:59 +0000 (22:12 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 7 Dec 2002 22:12:59 +0000 (22:12 +0000)
  until I implement the Citadel server function which it calls.)

webcit/ChangeLog
webcit/calendar.c
webcit/webcit.c
webcit/webcit.h

index 53850d3945a333338c6c0819b00d3ba8bb43fe7d..b88f0b2eb54cfe52a830db1c50549538a5d94043 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 400.61  2002/12/07 22:12:59  ajc
+* Handle incoming RSVP's for meetings.  (Note: this will not actually work
+  until I implement the Citadel server function which it calls.)
+
 Revision 400.60  2002/11/30 21:34:51  ajc
 * Submit organizer in a hidden field, in case the server needs it
 
@@ -1157,3 +1161,4 @@ 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 7c436ccad6c336c3280216838134343f2bfa6b9c..c6950e8b4977bf497ec98a58857418f682b85e02 100644 (file)
@@ -107,6 +107,15 @@ void cal_process_object(icalcomponent *cal,
                                </TD></TR>\n"
                        );
                        break;
+                   case ICAL_METHOD_REPLY:
+                       wprintf("<TR><TD COLSPAN=2>\n"
+                               "<IMG ALIGN=CENTER "
+                               "SRC=\"/static/vcalendar.gif\">"
+                               "&nbsp;&nbsp;"  
+                               "<B>Attendee's reply to your invitation</B>
+                               </TD></TR>\n"
+                       );
+                       break;
                    case ICAL_METHOD_PUBLISH:
                        wprintf("<TR><TD COLSPAN=2>\n"
                                "<IMG ALIGN=CENTER "
@@ -186,6 +195,13 @@ void cal_process_object(icalcomponent *cal,
                wprintf("</TD></TR>\n");
        }
 
+       /* If the component has attendees, iterate through them. */
+       for (p = icalcomponent_get_first_property(cal, ICAL_ATTENDEE_PROPERTY); (p != NULL); p = icalcomponent_get_next_property(cal, ICAL_ATTENDEE_PROPERTY)) {
+               wprintf("<TR><TD><B>Attendee:</B></TD><TD>");
+               escputs("FIXME display attendee");
+               wprintf("</TD></TR>\n");
+       }
+
        /* If the component has subcomponents, recurse through them. */
        for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
            (c != 0);
@@ -250,6 +266,39 @@ void cal_process_object(icalcomponent *cal,
 
        }
 
+       /* If this is a REPLY, display update button */
+       if (the_method == ICAL_METHOD_REPLY) {
+
+               /***********
+                * In the future, if we want to validate this object before
+                * continuing, we can do it this way:
+               serv_printf("ICAL whatever|%ld|%s|", msgnum, cal_partnum);
+               serv_gets(buf);
+               }
+                ***********/
+
+               /* Display the update buttons */
+               wprintf("<TR><TD COLSPAN=2>"
+                       "Click <i>Update</i> to accept this reply and "
+                       "update your calendar."
+                       "<FORM METHOD=\"GET\" "
+                       "ACTION=\"/handle_rsvp\">\n"
+                       "<INPUT TYPE=\"submit\" NAME=\"sc\" "
+                               "VALUE=\"Update\">\n"
+                       "&nbsp;&nbsp;"
+                       "<INPUT TYPE=\"submit\" NAME=\"sc\" "
+                               "VALUE=\"Ignore\">\n"
+                       "<INPUT TYPE=\"hidden\" NAME=\"msgnum\" "
+                               "VALUE=\"%ld\">"
+                       "<INPUT TYPE=\"hidden\" NAME=\"cal_partnum\" "
+                               "VALUE=\"%s\">"
+                       "</FORM>"
+                       "</TD></TR>\n",
+                       msgnum, cal_partnum
+               );
+
+       }
+
        /* Trailing HTML for the display of this object */
        if (recursion_level == 0) {
 
@@ -331,7 +380,58 @@ void respond_to_request(void) {
 
        wprintf("<A HREF=\"/dotskip?room=");
        urlescputs(WC->wc_roomname);
-       wprintf("\">Return to messages</A><BR>\n");
+       wprintf("\"><BR>Return to messages</A><BR>\n");
+
+       wDumpContent(1);
+}
+
+
+
+/*
+ * Handle an incoming RSVP
+ */
+void handle_rsvp(void) {
+       char buf[SIZ];
+
+       output_headers(3);
+
+       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
+               "<FONT SIZE=+1 COLOR=\"FFFFFF\""
+               "<B>Update your calendar with this RSVP</B>"
+               "</FONT></TD></TR></TABLE><BR>\n"
+       );
+
+       serv_printf("ICAL handle_rsvp|%s|%s|%s|",
+               bstr("msgnum"),
+               bstr("cal_partnum"),
+               bstr("sc")
+       );
+       serv_gets(buf);
+
+       if (buf[0] == '2') {
+               wprintf("<TABLE BORDER=0><TR><TD>"
+                       "<IMG SRC=\"static/vcalendar.gif\" ALIGN=CENTER>"
+                       "</TD><TD>"
+               );
+               if (!strcasecmp(bstr("sc"), "update")) {
+                       wprintf("Your calendar has been updated "
+                               "to reflect this RSVP."
+                       );
+               } else if (!strcasecmp(bstr("sc"), "ignore")) {
+                       wprintf("You have chosen to ignore this RSVP. "
+                               "Your calendar has <b>not</b> been updated."
+                       );
+               }
+               wprintf("</TD></TR></TABLE>\n"
+               );
+       } else {
+               wprintf("<IMG SRC=\"static/error.gif\" ALIGN=CENTER>"
+                       "%s\n", &buf[4]);
+       }
+
+       wprintf("<A HREF=\"/dotskip?room=");
+       urlescputs(WC->wc_roomname);
+       wprintf("\"><BR>Return to messages</A><BR>\n");
 
        wDumpContent(1);
 }
index 481a1fbb413a506a1ea8cfa7a1b0ee6207976d4d..d1927a4a26f01496bf4c4ab64619372561370e25 100644 (file)
@@ -1161,6 +1161,8 @@ void session_loop(struct httprequest *req)
                save_event();
        } else if (!strcasecmp(action, "respond_to_request")) {
                respond_to_request();
+       } else if (!strcasecmp(action, "handle_rsvp")) {
+               handle_rsvp();
 #endif
        } else if (!strcasecmp(action, "summary")) {
                summary();
index e2c6ff1b9a53bf1193be87fc9fc7be6d850057b3..da4f078f7329205b4672be34bc5b21f570aa9d41 100644 (file)
@@ -365,6 +365,7 @@ void display_edit_individual_event(icalcomponent *supplied_vtodo, long msgnum);
 void save_individual_event(icalcomponent *supplied_vtodo, long msgnum);
 void generate_new_uid(char *);
 void respond_to_request(void);
+void handle_rsvp(void);
 #endif
 
 extern char *months[];