* Smooth transition between "list tasks" & "edit task" screens
authorArt Cancro <ajc@citadel.org>
Fri, 20 Sep 2002 20:28:08 +0000 (20:28 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 20 Sep 2002 20:28:08 +0000 (20:28 +0000)
webcit/ChangeLog
webcit/calendar.c
webcit/webcit.c
webcit/webcit.h

index 483ca7bc29a1c00a02ea64bbd63a630d75f88673..a31ffbb88ae568f7e716bda017476ef1d8aae369 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 400.19  2002/09/20 20:28:08  ajc
+* Smooth transition between "list tasks" & "edit task" screens
+
 Revision 400.18  2002/09/20 03:54:44  ajc
 * Display the "Tasks" view as a bulleted list with each task clickable
 * Clicking brings up an (unfinished) "edit task" screen
@@ -1001,3 +1004,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 999191a8a9c4867890d3c74da873edea04f5c735..033d7952cbedd5a2b438d70f81a0c1b456b5f09c 100644 (file)
@@ -58,6 +58,8 @@ void display_task(long msgnum) {
 #else /* HAVE_ICAL_H */
 
 
+/******   End of handler stubs.  Everything below this line is real.   ******/
+
 
 /*
  * Process a single calendar component.
@@ -245,14 +247,14 @@ void display_individual_task(icalcomponent *vtodo, long msgnum) {
 
        p = icalcomponent_get_first_property(vtodo, ICAL_SUMMARY_PROPERTY);
        wprintf("<LI><A HREF=\"/display_edit_task?msgnum=%ld\">", msgnum);
-       if (p != NULL) escputs(icalproperty_get_comment(p));
+       if (p != NULL) escputs((char *)icalproperty_get_comment(p));
        wprintf("</A>\n");
        icalproperty_free(p);
 }
 
 
 /*
- * Display/edit a task by itself FIXME
+ * Display a task by itself (for editing)
  */
 void display_edit_individual_task(icalcomponent *vtodo, long msgnum) {
        icalproperty *p;
@@ -264,7 +266,7 @@ void display_edit_individual_task(icalcomponent *vtodo, long msgnum) {
                "</FONT></TD></TR></TABLE><BR>\n"
        );
 
-       wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_task\">\n");
+       wprintf("<FORM METHOD=\"POST\" ACTION=\"/save_task\">\n");
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n",
                msgnum);
 
@@ -272,19 +274,56 @@ void display_edit_individual_task(icalcomponent *vtodo, long msgnum) {
                "<INPUT TYPE=\"text\" NAME=\"summary\" "
                "MAXLENGTH=\"64\" SIZE=\"64\" VALUE=\"");
        p = icalcomponent_get_first_property(vtodo, ICAL_SUMMARY_PROPERTY);
-       if (p != NULL) escputs(icalproperty_get_comment(p));
+       if (p != NULL) escputs((char *)icalproperty_get_comment(p));
        icalproperty_free(p);
-       wprintf("\">\n");
+       wprintf("\"><BR>\n");
 
-       wprintf("</FORM>\n");
+       wprintf("Start date: FIXME <BR>\n");
 
-       wprintf("<BR><BR>\n"
-               "<A HREF=\"/readfwd\">"
-               "Back to task list</A>\n"
+       wprintf("Due date: FIXME <BR>\n");
+
+       wprintf("<CENTER><TEXTAREA NAME=\"msgtext\" wrap=soft "
+               "ROWS=10 COLS=80 WIDTH=80>\n"
        );
+       p = icalcomponent_get_first_property(vtodo, ICAL_DESCRIPTION_PROPERTY);
+       if (p != NULL) escputs((char *)icalproperty_get_comment(p));
+       icalproperty_free(p);
+       wprintf("</TEXTAREA><BR>\n");
+
+        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save\">"
+               "&nbsp;&nbsp;"
+               "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">\n"
+               "</CENTER>\n"
+       );
+
+       wprintf("</FORM>\n");
+
        wDumpContent(1);
 }
 
+/*
+ * Save an edited task
+ */
+void edit_individual_task(icalcomponent *vtodo, long msgnum) {
+
+       if (!strcasecmp(bstr("sc"), "Save")) {
+
+               /* FIXME
+                       1. Replace property values with ones from the form
+                       2. Serialize the task
+                       3. Make a message out of it
+                       4. Delete the existing message (msgnum)
+                       5. Save the new message
+               */
+
+       }
+
+       /* Go back to the task list */
+       readloop("readfwd");
+}
+
+
+
 /*
  * Code common to all display handlers.  Given a message number and a MIME
  * type, we load the message and hunt for that MIME type.  If found, we load
@@ -369,4 +408,13 @@ void display_edit_task(void) {
                                display_edit_individual_task);
 }
 
+void save_task(void) {
+       long msgnum = 0L;
+
+       msgnum = atol(bstr("msgnum"));
+       display_using_handler(msgnum, "text/calendar",
+                               ICAL_VTODO_COMPONENT,
+                               edit_individual_task);
+}
+
 #endif /* HAVE_ICAL_H */
index de3370150ea7d57389c714a6e5ac7fd09085114e..e2f084ec5f11de33cfc38cc634017cea098d86f7 100644 (file)
@@ -1240,6 +1240,8 @@ void session_loop(struct httprequest *req, int gzip)
 #ifdef HAVE_ICAL_H
        } else if (!strcasecmp(action, "display_edit_task")) {
                display_edit_task();
+       } else if (!strcasecmp(action, "save_task")) {
+               save_task();
 #endif
        } else if (!strcasecmp(action, "summary")) {
                summary();
index 97ac8f347c8143abb4ba102e84f04f4ce9e400ed..06db86fb1cbd1b533c8c58d6602f6016bd22d404 100644 (file)
@@ -347,4 +347,5 @@ void display_task(long msgnum);
 
 #ifdef HAVE_ICAL_H
 void display_edit_task(void);
+void save_task(void);
 #endif