-/*
- * Display a task by itself (for editing)
- */
-void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, char *from,
- int unread, struct calview *calv)
-{
- icalcomponent *vtodo;
- icalproperty *p;
- struct icaltimetype IcalTime;
- time_t now;
- int created_new_vtodo = 0;
- icalproperty_status todoStatus;
-
- now = time(NULL);
-
- if (supplied_vtodo != NULL) {
- vtodo = supplied_vtodo;
-
- /*
- * It's safe to convert to UTC here because there are no recurrences to worry about.
- */
- ical_dezonify(vtodo);
-
- /*
- * If we're looking at a fully encapsulated VCALENDAR
- * rather than a VTODO component, attempt to use the first
- * relevant VTODO subcomponent. If there is none, the
- * NULL returned by icalcomponent_get_first_component() will
- * tell the next iteration of this function to create a
- * new one.
- */
- if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
- display_edit_individual_task(
- icalcomponent_get_first_component(
- vtodo, ICAL_VTODO_COMPONENT
- ),
- msgnum, from, unread, calv
- );
- return;
- }
- }
- else {
- vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT);
- created_new_vtodo = 1;
- }
-
- /* TODO: Can we take all this and move it into a template? */
- output_headers(1, 1, 1, 0, 0, 0);
- wprintf("<!-- start task edit form -->");
- p = icalcomponent_get_first_property(vtodo, ICAL_SUMMARY_PROPERTY);
- /* Get summary early for title */
- wprintf("<div class=\"box\">\n");
- wprintf("<div class=\"boxlabel\">");
- wprintf(_("Edit task"));
- wprintf("- ");
- if (p != NULL) {
- escputs((char *)icalproperty_get_comment(p));
- }
- wprintf("</div>");
-
- wprintf("<div class=\"boxcontent\">\n");
- wprintf("<FORM METHOD=\"POST\" action=\"save_task\">\n");
- wprintf("<div style=\"display: none;\">\n ");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
- wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n", msgnum);
- wprintf("<INPUT TYPE=\"hidden\" NAME=\"return_to_summary\" VALUE=\"%d\">\n",
- ibstr("return_to_summary"));
- wprintf("</div>");
- wprintf("<table class=\"calendar_background\"><tr><td>");
- wprintf("<TABLE STYLE=\"border: none;\">\n");
-
- wprintf("<TR><TD>");
- wprintf(_("Summary:"));
- wprintf("</TD><TD>"
- "<INPUT TYPE=\"text\" NAME=\"summary\" "
- "MAXLENGTH=\"64\" SIZE=\"64\" VALUE=\"");
- p = icalcomponent_get_first_property(vtodo, ICAL_SUMMARY_PROPERTY);
- if (p != NULL) {
- escputs((char *)icalproperty_get_comment(p));
- }
- wprintf("\"></TD></TR>\n");
-
- wprintf("<TR><TD>");
- wprintf(_("Start date:"));
- wprintf("</TD><TD>");
- p = icalcomponent_get_first_property(vtodo, ICAL_DTSTART_PROPERTY);
- wprintf("<INPUT TYPE=\"CHECKBOX\" NAME=\"nodtstart\" ID=\"nodtstart\" VALUE=\"NODTSTART\" ");
- if (p == NULL) {
- wprintf("CHECKED=\"CHECKED\"");
- }
- wprintf(">");
- wprintf(_("No date"));
-
- wprintf(" ");
- wprintf("<span ID=\"dtstart_date\">");
- wprintf(_("or"));
- wprintf(" ");
- if (p != NULL) {
- IcalTime = icalproperty_get_dtstart(p);
- }
- else
- IcalTime = icaltime_current_time_with_zone(get_default_icaltimezone());
- display_icaltimetype_as_webform(&IcalTime, "dtstart", 0);
-
- wprintf("<INPUT TYPE=\"CHECKBOX\" NAME=\"dtstart_time_assoc\" ID=\"dtstart_time_assoc\" VALUE=\"yes\"");
- if (!IcalTime.is_date) {
- wprintf("CHECKED=\"CHECKED\"");
- }
- wprintf(">");
- wprintf(_("Time associated"));
- wprintf("</span></TD></TR>\n");
-
- wprintf("<TR><TD>");
- wprintf(_("Due date:"));
- wprintf("</TD><TD>");
- p = icalcomponent_get_first_property(vtodo, ICAL_DUE_PROPERTY);
- wprintf("<INPUT TYPE=\"CHECKBOX\" NAME=\"nodue\" ID=\"nodue\" VALUE=\"NODUE\"");
- if (p == NULL) {
- wprintf("CHECKED=\"CHECKED\"");
- }
- wprintf(">");
- wprintf(_("No date"));
- wprintf(" ");
- wprintf("<span ID=\"due_date\">\n");
- wprintf(_("or"));
- wprintf(" ");
- if (p != NULL) {
- IcalTime = icalproperty_get_due(p);
- }
- else
- IcalTime = icaltime_current_time_with_zone(get_default_icaltimezone());
- display_icaltimetype_as_webform(&IcalTime, "due", 0);