]> code.citadel.org Git - citadel.git/blobdiff - webcit/calendar.c
* Integrated the first batch of new icons.
[citadel.git] / webcit / calendar.c
index 46e00bdadc99751c59ac873a4a46a3f446a63380..e127778090bd5924fb6ae41746e396934bfe5e10 100644 (file)
@@ -102,7 +102,7 @@ void cal_process_object(icalcomponent *cal,
                    case ICAL_METHOD_REQUEST:
                        wprintf("<TR><TD COLSPAN=2>\n"
                                "<IMG ALIGN=CENTER "
-                               "SRC=\"/static/vcalendar.gif\">"
+                               "SRC=\"/static/calarea_48x.gif\">"
                                "&nbsp;&nbsp;"  
                                "<B>Meeting invitation</B>"
                                "</TD></TR>\n"
@@ -111,7 +111,7 @@ void cal_process_object(icalcomponent *cal,
                    case ICAL_METHOD_REPLY:
                        wprintf("<TR><TD COLSPAN=2>\n"
                                "<IMG ALIGN=CENTER "
-                               "SRC=\"/static/vcalendar.gif\">"
+                               "SRC=\"/static/calarea_48x.gif\">"
                                "&nbsp;&nbsp;"  
                                "<B>Attendee's reply to your invitation</B>"
                                "</TD></TR>\n"
@@ -120,7 +120,7 @@ void cal_process_object(icalcomponent *cal,
                    case ICAL_METHOD_PUBLISH:
                        wprintf("<TR><TD COLSPAN=2>\n"
                                "<IMG ALIGN=CENTER "
-                               "SRC=\"/static/vcalendar.gif\">"
+                               "SRC=\"/static/calarea_48x.gif\">"
                                "&nbsp;&nbsp;"  
                                "<B>Published event</B>"
                                "</TD></TR>\n"
@@ -169,7 +169,7 @@ void cal_process_object(icalcomponent *cal,
                        }
                        else {
                                tt = icaltime_as_timet(t);
-                               fmt_date(buf, tt);
+                               fmt_date(buf, tt, 0);
                                wprintf("<TR><TD><B>Starting date/time:"
                                        "</B></TD><TD>"
                                        "%s</TD></TR>", buf
@@ -181,7 +181,7 @@ void cal_process_object(icalcomponent *cal,
                if (p != NULL) {
                        t = icalproperty_get_dtend(p);
                        tt = icaltime_as_timet(t);
-                       fmt_date(buf, tt);
+                       fmt_date(buf, tt, 0);
                        wprintf("<TR><TD><B>Ending date/time:</B></TD><TD>"
                                "%s</TD></TR>", buf
                        );
@@ -229,10 +229,10 @@ void cal_process_object(icalcomponent *cal,
                /* Check for conflicts */
                lprintf(9, "Checking server calendar for conflicts...\n");
                serv_printf("ICAL conflicts|%ld|%s|", msgnum, cal_partnum);
-               serv_gets(buf);
+               serv_getln(buf, sizeof buf);
                if (buf[0] == '1') {
-                       while (serv_gets(buf), strcmp(buf, "000")) {
-                               extract(conflict_name, buf, 3);
+                       while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+                               extract_token(conflict_name, buf, 3, '|', sizeof conflict_name);
                                is_update = extract_int(buf, 4);
                                wprintf("<TR><TD><B><I>%s</I></B></TD>"
                                        "<TD>"
@@ -259,23 +259,16 @@ void cal_process_object(icalcomponent *cal,
                lprintf(9, "...done.\n");
 
                /* Display the Accept/Decline buttons */
-               wprintf("<TR><TD COLSPAN=2>"
-                       "<FORM METHOD=\"GET\" "
-                       "ACTION=\"/respond_to_request\">\n"
-                       "<INPUT TYPE=\"submit\" NAME=\"sc\" "
-                               "VALUE=\"Accept\">\n"
-                       "&nbsp;&nbsp;"
-                       "<INPUT TYPE=\"submit\" NAME=\"sc\" "
-                               "VALUE=\"Tentative\">\n"
-                       "&nbsp;&nbsp;"
-                       "<INPUT TYPE=\"submit\" NAME=\"sc\" "
-                               "VALUE=\"Decline\">\n"
-                       "<INPUT TYPE=\"hidden\" NAME=\"msgnum\" "
-                               "VALUE=\"%ld\">"
-                       "<INPUT TYPE=\"hidden\" NAME=\"cal_partnum\" "
-                               "VALUE=\"%s\">"
-                       "</FORM>"
-                       "</TD></TR>\n",
+               wprintf("<TR><TD>How would you like to respond to this invitation?</td>"
+                       "<td><FONT SIZE=+1>"
+                       "<A HREF=\"/respond_to_request?msgnum=%ld&cal_partnum=%s&sc=Accept\">Accept</a>"
+                       " | "
+                       "<A HREF=\"/respond_to_request?msgnum=%ld&cal_partnum=%s&sc=Tentative\">Tentative</a>"
+                       " | "
+                       "<A HREF=\"/respond_to_request?msgnum=%ld&cal_partnum=%s&sc=Decline\">Decline</a>"
+                       "</FONT></TD></TR>\n",
+                       msgnum, cal_partnum,
+                       msgnum, cal_partnum,
                        msgnum, cal_partnum
                );
 
@@ -288,27 +281,21 @@ void cal_process_object(icalcomponent *cal,
                 * 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);
+               serv_getln(buf, sizeof buf);
                }
                 ***********/
 
                /* Display the update buttons */
-               wprintf("<TR><TD COLSPAN=2>"
+               wprintf("<TR><TD>"
                        "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><td><font size=+1>"
+                       "<a href=\"/handle_rsvp?msgnum=%ld&cal_partnum=%s&sc=Update\">Update</a>"
+                       " | "
+                       "<a href=\"/handle_rsvp?msgnum=%ld&cal_partnum=%s&sc=Ignore\">Ignore</a>"
+                       "</font>"
                        "</TD></TR>\n",
+                       msgnum, cal_partnum,
                        msgnum, cal_partnum
                );
 
@@ -366,11 +353,11 @@ void respond_to_request(void) {
                bstr("cal_partnum"),
                bstr("sc")
        );
-       serv_gets(buf);
+       serv_getln(buf, sizeof buf);
 
        if (buf[0] == '2') {
                wprintf("<TABLE BORDER=0><TR><TD>"
-                       "<IMG SRC=\"static/vcalendar.gif\" ALIGN=CENTER>"
+                       "<IMG SRC=\"static/calarea_48x.gif\" ALIGN=CENTER>"
                        "</TD><TD>"
                );
                if (!strcasecmp(bstr("sc"), "accept")) {
@@ -424,11 +411,11 @@ void handle_rsvp(void) {
                bstr("cal_partnum"),
                bstr("sc")
        );
-       serv_gets(buf);
+       serv_getln(buf, sizeof buf);
 
        if (buf[0] == '2') {
                wprintf("<TABLE BORDER=0><TR><TD>"
-                       "<IMG SRC=\"static/vcalendar.gif\" ALIGN=CENTER>"
+                       "<IMG SRC=\"static/calarea_48x.gif\" ALIGN=CENTER>"
                        "</TD><TD>"
                );
                if (!strcasecmp(bstr("sc"), "update")) {
@@ -528,9 +515,10 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
                "</TD></TR></TABLE>\n"
                "</div>\n<div id=\"content\">\n"
        );
-       
-       do_template("beginbox_nt");
 
+       wprintf("<div id=\"fix_scrollbar_bug\">"
+               "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
+       
        wprintf("<FORM METHOD=\"POST\" ACTION=\"/save_task\">\n");
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n",
                msgnum);
@@ -588,7 +576,7 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
 
        wprintf("</FORM>\n");
 
-       do_template("endbox");
+       wprintf("</td></tr></table></div>\n");
        wDumpContent(1);
 
        if (created_new_vtodo) {
@@ -712,7 +700,7 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
 
                /* Serialize it and save it to the message base */
                serv_puts("ENT0 1|||4");
-               serv_gets(buf);
+               serv_getln(buf, sizeof buf);
                if (buf[0] == '4') {
                        serv_puts("Content-type: text/calendar");
                        serv_puts("");
@@ -737,7 +725,7 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
 
        if ( (delete_existing) && (msgnum > 0L) ) {
                serv_printf("DELE %ld", atol(bstr("msgnum")));
-               serv_gets(buf);
+               serv_getln(buf, sizeof buf);
        }
 
        if (created_new_vtodo) {
@@ -774,15 +762,15 @@ void display_using_handler(long msgnum,
 
        sprintf(buf, "MSG0 %ld|1", msgnum);     /* ask for headers only */
        serv_puts(buf);
-       serv_gets(buf);
+       serv_getln(buf, sizeof buf);
        if (buf[0] != '1') return;
 
-       while (serv_gets(buf), strcmp(buf, "000")) {
+       while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                if (!strncasecmp(buf, "part=", 5)) {
-                       extract(mime_filename, &buf[5], 1);
-                       extract(mime_partnum, &buf[5], 2);
-                       extract(mime_disposition, &buf[5], 3);
-                       extract(mime_content_type, &buf[5], 4);
+                       extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+                       extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+                       extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+                       extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
                        mime_length = extract_int(&buf[5], 5);
 
                        if (!strcasecmp(mime_content_type, "text/calendar")) {
@@ -912,7 +900,7 @@ void do_freebusy(char *req) {
        char buf[SIZ];
        char *fb;
 
-       extract_token(who, req, 1, ' ');
+       extract_token(who, req, 1, ' ', sizeof who);
        if (!strncasecmp(who, "/freebusy/", 10)) {
                strcpy(who, &who[10]);
        }
@@ -925,13 +913,13 @@ void do_freebusy(char *req) {
 
        lprintf(9, "freebusy requested for <%s>\n", who);
        serv_printf("ICAL freebusy|%s", who);
-       serv_gets(buf);
+       serv_getln(buf, sizeof buf);
 
        if (buf[0] != '1') {
                wprintf("HTTP/1.0 404 %s\n", &buf[4]);
                output_headers(0, 0, 0, 0, 0, 0, 0);
-               wprintf("Content-Type: text/plain\n");
-               wprintf("\n");
+               wprintf("Content-Type: text/plain\r\n");
+               wprintf("\r\n");
                wprintf("%s\n", &buf[4]);
                return;
        }