-
-
-/*
- * do the whole task view stuff
- */
-void do_tasks_view(void) {
- long hklen;
- const char *HashKey;
- void *vCal;
- disp_cal *Cal;
- HashPos *Pos;
- int nItems;
- time_t due;
- char buf[SIZ];
- icalproperty *p;
- wcsession *WCC = WC;
-
- wprintf("<div class=\"fix_scrollbar_bug\">"
- "<table class=\"calendar_view_background\"><tbody id=\"taskview\">\n<tr>\n"
- "<th>");
- wprintf(_("Completed?"));
- wprintf("</th><th>");
- wprintf(_("Name of task"));
- wprintf("</th><th>");
- wprintf(_("Date due"));
- wprintf("</th><th>");
- wprintf(_("Category"));
- wprintf(" (<select id=\"selectcategory\"><option value=\"showall\">%s</option></select>)</th></tr>\n",
- _("Show All"));
-
- nItems = GetCount(WC->disp_cal_items);
-
- /* Sort them if necessary
- if (nItems > 1) {
- SortByPayload(WC->disp_cal_items, task_due_cmp);
- }
- * this shouldn't be neccessary, since we sort by the start time.
- */
-
- /* And then again, by completed */
- if (nItems > 1) {
- SortByPayload(WC->disp_cal_items,
- task_completed_cmp);
- }
-
- Pos = GetNewHashPos(WCC->disp_cal_items, 0);
- while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
- icalproperty_status todoStatus;
-
- Cal = (disp_cal*)vCal;
- wprintf("<tr><td>");
- todoStatus = icalcomponent_get_status(Cal->cal);
- wprintf("<input type=\"checkbox\" name=\"completed\" value=\"completed\" ");
- if (todoStatus == ICAL_STATUS_COMPLETED) {
- wprintf("checked=\"checked\" ");
- }
- wprintf("disabled=\"disabled\">\n</td><td>");
- p = icalcomponent_get_first_property(Cal->cal,
- ICAL_SUMMARY_PROPERTY);
- wprintf("<a href=\"display_edit_task?msgnum=%ld?taskrm=", Cal->cal_msgnum);
- urlescputs(ChrPtr(WC->wc_roomname));
- wprintf("\">");
- /* wprintf("<img align=middle "
- "src=\"static/taskmanag_16x.gif\" border=0> "); */
- if (p != NULL) {
- escputs((char *)icalproperty_get_comment(p));
- }
- wprintf("</a>\n");
- wprintf("</td>\n");
-
- due = get_task_due_date(Cal->cal);
- wprintf("<td><span");
- if (due > 0) {
- webcit_fmt_date(buf, due, 0);
- wprintf(">%s",buf);
- }
- else {
- wprintf(">");
- }
- wprintf("</span></td>");
- wprintf("<td>");
- p = icalcomponent_get_first_property(Cal->cal,
- ICAL_CATEGORIES_PROPERTY);
- if (p != NULL) {
- escputs((char *)icalproperty_get_categories(p));
- }
- wprintf("</td>");
- wprintf("</tr>");
- }
-
- wprintf("</tbody></table></div>\n");
-
- /* Free the list */
- DeleteHash(&WC->disp_cal_items);
- DeleteHashPos(&Pos);