int all_day_event = 0;
int show_event = 0;
char buf[256];
- struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
+ wcsession *WCC = WC;
time_t tt;
if (GetCount(WCC->disp_cal_items) == 0) {
/*
* Now loop through our list of events to see which ones occur today.
*/
- Pos = GetNewHashPos();
+ Pos = GetNewHashPos(WCC->disp_cal_items, 0);
while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
Cal = (disp_cal*)vCal;
all_day_event = 0;
time_t event_tt;
time_t event_tts;
time_t event_tte;
- struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
+ wcsession *WCC = WC;
struct tm event_tms;
struct tm event_tme;
struct tm today_tm;
day = today_tm.tm_mday;
year = today_tm.tm_year + 1900;
- Pos = GetNewHashPos();
+ Pos = GetNewHashPos(WCC->disp_cal_items, 0);
while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
Cal = (disp_cal*)vCal;
p = icalcomponent_get_first_property(Cal->cal, ICAL_DTSTART_PROPERTY);
time_t colheader_time;
struct tm colheader_tm;
char colheader_label[32];
- int chg_month = 0;
long weekstart = 0;
/*
/* Now do 35 or 42 days */
- for (i = 0; i < 42; ++i) {
- localtime_r(&thetime, &tm);
-
- if ((i < 35) || (chg_month == 0)) {
-
- if ((i > 27) && ((tm.tm_mday == 1) || (tm.tm_mday == 31))) {
- chg_month = 1;
- }
- if (i > 35) {
- chg_month = 0;
- }
-
- /* Before displaying the first day of the week, start a new row */
- if ((i % 7) == 0) {
- wprintf("<tr>");
- }
+ localtime_r(&thetime, &tm);
+ for (i = 0; i<42; ++i) {
- wprintf("<td class=\"cal%s\"><div class=\"day\">",
- ((tm.tm_mon != month-1) ? "out" :
- ((tm.tm_wday==0 || tm.tm_wday==6) ? "weekend" :
- "day"))
- );
- if ((i==0) || (tm.tm_mday == 1)) {
- wc_strftime(colheader_label, sizeof colheader_label, "%B", &tm);
- wprintf("%s ", colheader_label);
- }
- wprintf("<a href=\"readfwd?calview=day?year=%d?month=%d?day=%d\">"
- "%d</a></div>",
- tm.tm_year + 1900,
- tm.tm_mon + 1,
- tm.tm_mday,
- tm.tm_mday);
-
- /* put the data here, stupid */
- calendar_month_view_display_events(
- tm.tm_year + 1900,
- tm.tm_mon + 1,
- tm.tm_mday
- );
+ /* Before displaying the first day of the week, start a new row */
+ if ((i % 7) == 0) {
+ wprintf("<tr>");
+ }
- wprintf("</td>");
+ wprintf("<td class=\"cal%s\"><div class=\"day\">",
+ ((tm.tm_mon != month-1) ? "out" :
+ ((tm.tm_wday==0 || tm.tm_wday==6) ? "weekend" :
+ "day"))
+ );
+ if ((i==0) || (tm.tm_mday == 1)) {
+ wc_strftime(colheader_label, sizeof colheader_label, "%B", &tm);
+ wprintf("%s ", colheader_label);
+ }
+ wprintf("<a href=\"readfwd?calview=day?year=%d?month=%d?day=%d\">"
+ "%d</a></div>",
+ tm.tm_year + 1900,
+ tm.tm_mon + 1,
+ tm.tm_mday,
+ tm.tm_mday);
+
+ /* put the data here, stupid */
+ calendar_month_view_display_events(
+ tm.tm_year + 1900,
+ tm.tm_mon + 1,
+ tm.tm_mday
+ );
- /* After displaying the last day of the week, end the row */
- if ((i % 7) == 6) {
- wprintf("</tr>\n");
- }
+ wprintf("</td>");
+ /* After displaying the last day of the week, end the row */
+ if ((i % 7) == 6) {
+ wprintf("</tr>\n");
}
thetime += (time_t)86400; /* ahead 24 hours */
+ localtime_r(&thetime, &tm);
+
+ if ( ((i % 7) == 6) && (tm.tm_mon != month-1) && (tm.tm_mday < 15) ) {
+ i = 100; /* break out of the loop */
+ }
}
wprintf("</table>" /* end of inner table */
int show_event = 0;
int all_day_event = 0;
int ongoing_event = 0;
- struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
+ wcsession *WCC = WC;
disp_cal *Cal;
struct icaltimetype t;
struct icaltimetype end_t;
/* Now loop through our list of events to see which ones occur today.
*/
- Pos = GetNewHashPos();
+ Pos = GetNewHashPos(WCC->disp_cal_items, 0);
while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
Cal = (disp_cal*)vCal;
time_t now;
int all_day_event = 0;
char timestring[SIZ];
- struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
+ wcsession *WCC = WC;
if (GetCount(WC->disp_cal_items) == 0) {
return;
now = time(NULL);
localtime_r(&now, &today_tm);
- Pos = GetNewHashPos();
+ Pos = GetNewHashPos(WCC->disp_cal_items, 0);
while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
Cal = (disp_cal*)vCal;
- p = icalcomponent_get_first_property(Cal->cal,
- ICAL_DTSTART_PROPERTY);
+ p = icalcomponent_get_first_property(Cal->cal, ICAL_DTSTART_PROPERTY);
if (p != NULL) {
t = icalproperty_get_dtstart(p);
event_tt = icaltime_as_timet(t);
if ( (event_tm.tm_year == today_tm.tm_year)
&& (event_tm.tm_mon == today_tm.tm_mon)
- && (event_tm.tm_mday == today_tm.tm_mday)
+ && (event_tm.tm_mday == today_tm.tm_mday)
) {
+ p = icalcomponent_get_first_property(Cal->cal, ICAL_SUMMARY_PROPERTY);
+ if (p != NULL) {
- p = icalcomponent_get_first_property(
- Cal->cal,
- ICAL_SUMMARY_PROPERTY);
- if (p != NULL) {
- escputs((char *)
- icalproperty_get_comment(p));
- wprintf(" (%s)<br />\n", timestring);
- }
+
+ if (WCC->wc_view == VIEW_TASKS) {
+ wprintf("<a href=\"display_edit_task"
+ "?msgnum=%ld"
+ "?return_to_summary=1"
+ "?gotofirst=",
+ Cal->cal_msgnum
+ );
+ escputs(ChrPtr(WCC->wc_roomname));
+ wprintf("\">");
+ }
+ else {
+ wprintf("<a href=\"display_edit_event"
+ "?msgnum=%ld"
+ "?calview=summary"
+ "?year=%d"
+ "?month=%d"
+ "?day=%d"
+ "?gotofirst=",
+ Cal->cal_msgnum,
+ today_tm.tm_year + 1900,
+ today_tm.tm_mon + 1,
+ today_tm.tm_mday
+ );
+ escputs(ChrPtr(WCC->wc_roomname));
+ wprintf("\">");
+ }
+ escputs((char *) icalproperty_get_comment(p));
+ wprintf(" (%s)</a><br />\n", timestring);
+ }
}
}
}
DeleteHash(&WC->disp_cal_items);
}
-
/*
* Parse the URL variables in order to determine the scope and display of a calendar view
*/
time_t now;
struct tm tm;
char calview[32];
+ int span = 3888000;
/* In case no date was specified, go with today */
now = time(NULL);
else if (!strcasecmp(calview, "week")) {
c->view = calview_week;
}
+ else if (!strcasecmp(calview, "summary")) { /* shouldn't ever happen, but just in case */
+ c->view = calview_day;
+ }
else {
if (WC->wc_view == VIEW_CALBRIEF) {
c->view = calview_brief;
tm.tm_mday = c->day;
now = mktime(&tm);
- int span = 3888000;
if (c->view == calview_month) span = 3888000;
if (c->view == calview_brief) span = 3888000;
if (c->view == calview_week) span = 604800;
if (c->view == calview_day) span = 86400;
+ if (c->view == calview_summary) span = 86400;
c->lower_bound = now - span;
c->upper_bound = now + span;
*/
int task_completed_cmp(const void *vtask1, const void *vtask2) {
disp_cal * Task1 = (disp_cal *)GetSearchPayload(vtask1);
-// disp_cal * Task2 = (disp_cal *)GetSearchPayload(vtask2);
+/* disp_cal * Task2 = (disp_cal *)GetSearchPayload(vtask2); */
icalproperty_status t1 = icalcomponent_get_status((Task1)->cal);
- // icalproperty_status t2 = icalcomponent_get_status(((struct disp_cal *)task2)->cal);
+ /* icalproperty_status t2 = icalcomponent_get_status(((struct disp_cal *)task2)->cal); */
if (t1 == ICAL_STATUS_COMPLETED)
return 1;
time_t due;
char buf[SIZ];
icalproperty *p;
- struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
+ wcsession *WCC = WC;
wprintf("<div class=\"fix_scrollbar_bug\">"
"<table class=\"calendar_view_background\"><tbody id=\"taskview\">\n<tr>\n"
task_completed_cmp);
}
- Pos = GetNewHashPos();
+ 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>");
- icalproperty_status todoStatus = icalcomponent_get_status(Cal->cal);
+ 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(WC->wc_roomname);
+ 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> "); */