]> code.citadel.org Git - citadel.git/blobdiff - webcit/event.c
* Moved to the new string tokenizer API
[citadel.git] / webcit / event.c
index 595f103aba7536dd120af2b635075e80b39b0c24..5634326efd64c866d17a7f960e74aca8aa7b573f 100644 (file)
@@ -50,7 +50,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
        int i;
        int sequence = 0;
 
-       now = time(NULL) % 60;          /* mod 60 to force :00 seconds */
+       now = time(NULL);
        strcpy(organizer_string, "");
        strcpy(attendee_string, "");
 
@@ -84,10 +84,16 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
        }
 
        /* Begin output */
-       output_headers(1, 1, 0, 0, 0, 0, 0);
-       do_template("beginbox_nt");
-       wprintf("<h3>&nbsp;<IMG ALIGN=CENTER SRC=\"/static/vcalendar.gif\">"
-               "&nbsp;Add or edit an event</h3>\n");
+       output_headers(1, 1, 2, 0, 0, 0, 0);
+       wprintf("<div id=\"banner\">\n"
+               "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+               "<SPAN CLASS=\"titlebar\">Add or edit an event</SPAN>"
+               "</TD></TR></TABLE>\n"
+               "</div>\n<div id=\"content\">\n"
+       );
+
+       wprintf("<div id=\"fix_scrollbar_bug\">"
+               "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
 
        /************************************************************
         * Uncomment this to see the UID in calendar events for debugging
@@ -146,9 +152,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
        }
        else {
                localtime_r(&now, &tm_now);
-               tm_now.tm_year = atoi(bstr("year")) - 1900;
-               tm_now.tm_mon = atoi(bstr("month")) - 1;
-               tm_now.tm_mday = atoi(bstr("day"));
+               if (strlen(bstr("year")) > 0) {
+                       tm_now.tm_year = atoi(bstr("year")) - 1900;
+                       tm_now.tm_mon = atoi(bstr("month")) - 1;
+                       tm_now.tm_mday = atoi(bstr("day"));
+               }
                if (strlen(bstr("hour")) > 0) {
                        tm_now.tm_hour = atoi(bstr("hour"));
                        tm_now.tm_min = atoi(bstr("minute"));
@@ -366,7 +374,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
 
        wprintf("</FORM>\n");
        
-       wprintf("<script language=\"javascript\">"
+       wprintf("<script type=\"text/javascript\">"
                "<!--"
                        "if (document.EventForm.alldayevent.checked) {"
                                "document.EventForm.dtstart_hour.value='0';"
@@ -394,7 +402,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum)
                "</script>\n"
        );
 
-       do_template("endbox");
+       wprintf("</td></tr></table></div>\n");
        wDumpContent(1);
 
        if (created_new_vevent) {
@@ -606,7 +614,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) {
 
                /* Now iterate! */
                for (i=0; i<num_tokens(form_attendees, '\n'); ++i) {
-                       extract_token(buf, form_attendees, i, '\n');
+                       extract_token(buf, form_attendees, i, '\n', sizeof buf);
                        striplt(buf);
                        if (strlen(buf) > 0) {
                                lprintf(9, "Attendee: <%s>\n", buf);
@@ -639,7 +647,7 @@ STARTOVER:  lprintf(9, "Remove unlisted attendees\n");
                                striplt(attendee_string);
                                foundit = 0;
                                for (i=0; i<num_tokens(form_attendees, '\n'); ++i) {
-                                       extract_token(buf, form_attendees, i, '\n');
+                                       extract_token(buf, form_attendees, i, '\n', sizeof buf);
                                        striplt(buf);
                                        if (!strcasecmp(buf, attendee_string)) ++foundit;
                                }
@@ -664,14 +672,17 @@ STARTOVER:        lprintf(9, "Remove unlisted attendees\n");
                /* If the user clicked 'Save' then save it to the server. */
                lprintf(9, "Serializing it for saving\n");
                if ( (encaps != NULL) && (!strcasecmp(bstr("sc"), "Save")) ) {
-                       serv_puts("ENT0 1|||4");
+                       serv_puts("ENT0 1|||4|||1|");
                        serv_gets(buf);
-                       if (buf[0] == '4') {
+                       if (buf[0] == '8') {
                                serv_puts("Content-type: text/calendar");
                                serv_puts("");
                                serv_puts(icalcomponent_as_ical_string(encaps));
                                serv_puts("000");
                        }
+                       while (serv_gets(buf), strcmp(buf, "000")) {
+                               lprintf(9, "ENT0 REPLY: %s\n", buf);
+                       }
                        icalcomponent_free(encaps);
                }