From 2296667b6c9a9b2f56d9c8bfc29ce5d2a9618852 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 24 Feb 2008 15:13:49 +0000 Subject: [PATCH] * collect sender / read / unread information for calendar items * dislpay the sender in the bubbles * set the event Class depending on read / unread state * added some css classes to view this information --- webcit/calendar.c | 55 +++++++++++++++++++++++----------------- webcit/calendar_view.c | 54 ++++++++++++++++++++++++--------------- webcit/event.c | 14 +++++----- webcit/messages.c | 12 ++++----- webcit/notes.c | 2 +- webcit/static/webcit.css | 42 ++++++++++++++++++++++++++++-- webcit/summary.c | 4 +-- webcit/webcit.h | 13 ++++++---- 8 files changed, 129 insertions(+), 67 deletions(-) diff --git a/webcit/calendar.c b/webcit/calendar.c index d882ee770..3a78ac3d8 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -446,13 +446,16 @@ void handle_rsvp(void) { * \param cal Our calendar to process * \param msgnum number of the mesage in our db */ -void display_individual_cal(icalcomponent *cal, long msgnum) +void display_individual_cal(icalcomponent *cal, long msgnum, char *from, int unread) { struct wcsession *WCC = WC; /* stack this for faster access (WC is a function) */ WCC->num_cal += 1; WCC->disp_cal = realloc(WC->disp_cal, (sizeof(struct disp_cal) * WCC->num_cal) ); WCC->disp_cal[WCC->num_cal - 1].cal = icalcomponent_new_clone(cal); + WCC->disp_cal[WCC->num_cal - 1].unread = unread; + WCC->disp_cal[WCC->num_cal - 1].from = malloc (strlen(from) + 1); + strcpy (WCC->disp_cal[WCC->num_cal - 1].from, from); ical_dezonify(WCC->disp_cal[WCC->num_cal - 1].cal); WCC->disp_cal[WCC->num_cal - 1].cal_msgnum = msgnum; } @@ -465,7 +468,7 @@ void display_individual_cal(icalcomponent *cal, long msgnum) * \param supplied_vtodo the todo item we want to edit * \param msgnum number of the mesage in our db */ -void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) { +void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, char *from, int unread) { icalcomponent *vtodo; icalproperty *p; struct icaltimetype t; @@ -489,7 +492,9 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) { display_edit_individual_task( icalcomponent_get_first_component( vtodo, ICAL_VTODO_COMPONENT - ), msgnum + ), + msgnum, + from, unread ); return; } @@ -594,7 +599,7 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) { * \param supplied_vtodo the task to save * \param msgnum number of the mesage in our db */ -void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) { +void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from, int unread) { char buf[SIZ]; int delete_existing = 0; icalproperty *prop; @@ -617,8 +622,8 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) { if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) { save_individual_task( icalcomponent_get_first_component( - vtodo, ICAL_VTODO_COMPONENT - ), msgnum + vtodo, ICAL_VTODO_COMPONENT), + msgnum, from, unread ); return; } @@ -763,11 +768,12 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) { * \param callback a funcion \todo * */ -void display_using_handler(long msgnum, - icalcomponent_kind which_kind, - void (*callback)(icalcomponent *, long) +void display_using_handler(long msgnum, int unread, + icalcomponent_kind which_kind, + void (*callback)(icalcomponent *, long, char*, int) ) { char buf[1024]; + char from[128] = ""; char mime_partnum[256]; char mime_filename[256]; char mime_content_type[256]; @@ -798,6 +804,9 @@ void display_using_handler(long msgnum, strcpy(relevant_partnum, mime_partnum); } } + else if (!strncasecmp(buf, "from=", 4)) { + extract_token(from, buf, 1, '=', sizeof(from)); + } } if (!IsEmptyStr(relevant_partnum)) { @@ -811,7 +820,7 @@ void display_using_handler(long msgnum, /** Simple components of desired type */ if (icalcomponent_isa(cal) == which_kind) { - callback(cal, msgnum); + callback(cal, msgnum, from, unread); } /** Subcomponents of desired type */ @@ -820,7 +829,7 @@ void display_using_handler(long msgnum, (c != 0); c = icalcomponent_get_next_component(cal, which_kind)) { - callback(c, msgnum); + callback(c, msgnum, from, unread); } icalcomponent_free(cal); } @@ -834,8 +843,8 @@ void display_using_handler(long msgnum, * \brief display whole calendar * \param msgnum number of the mesage in our db */ -void display_calendar(long msgnum) { - display_using_handler(msgnum, +void display_calendar(long msgnum, int unread) { + display_using_handler(msgnum, unread, ICAL_VEVENT_COMPONENT, display_individual_cal); } @@ -844,8 +853,8 @@ void display_calendar(long msgnum) { * \brief display whole taksview * \param msgnum number of the mesage in our db */ -void display_task(long msgnum) { - display_using_handler(msgnum, +void display_task(long msgnum, int unread) { + display_using_handler(msgnum, unread, ICAL_VTODO_COMPONENT, display_individual_cal); } @@ -864,13 +873,13 @@ void display_edit_task(void) { msgnum = atol(bstr("msgnum")); if (msgnum > 0L) { /** existing task */ - display_using_handler(msgnum, + display_using_handler(msgnum, 0, ICAL_VTODO_COMPONENT, display_edit_individual_task); } else { /** new task */ - display_edit_individual_task(NULL, 0L); + display_edit_individual_task(NULL, 0L, "", 0); } } @@ -882,12 +891,12 @@ void save_task(void) { msgnum = atol(bstr("msgnum")); if (msgnum > 0L) { - display_using_handler(msgnum, + display_using_handler(msgnum, 0, ICAL_VTODO_COMPONENT, save_individual_task); } else { - save_individual_task(NULL, 0L); + save_individual_task(NULL, 0L, "", 0); } } @@ -900,13 +909,13 @@ void display_edit_event(void) { msgnum = atol(bstr("msgnum")); if (msgnum > 0L) { /* existing event */ - display_using_handler(msgnum, + display_using_handler(msgnum, 0, ICAL_VEVENT_COMPONENT, display_edit_individual_event); } else { /* new event */ - display_edit_individual_event(NULL, 0L); + display_edit_individual_event(NULL, 0L, "", 0); } } @@ -919,12 +928,12 @@ void save_event(void) { msgnum = atol(bstr("msgnum")); if (msgnum > 0L) { - display_using_handler(msgnum, + display_using_handler(msgnum, 0, ICAL_VEVENT_COMPONENT, save_individual_event); } else { - save_individual_event(NULL, 0L); + save_individual_event(NULL, 0L, "", 0); } } diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index b5525b1be..699d83e73 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -259,14 +259,16 @@ void calendar_month_view_display_events(int year, int month, int day) } wprintf("" - "unread)?"_unread":"_read", WC->disp_cal[i].cal_msgnum, year, month, day ); - wprintf("%s ", _("Summary:")); + wprintf("%s: %s
", _("From"), Cal->from); + wprintf("%s ", _("Summary:")); escputs((char *)icalproperty_get_comment(p)); wprintf("
"); @@ -356,12 +358,14 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) { 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 */ struct tm event_tms; struct tm event_tme; struct tm today_tm; icalproperty *p; icalproperty *e; struct icaltimetype t; + struct disp_cal *Cal; int month, day, year; int all_day_event = 0; char *timeformat; @@ -378,7 +382,8 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) { year = today_tm.tm_year + 1900; for (i=0; i<(WC->num_cal); ++i) { - p = icalcomponent_get_first_property(WC->disp_cal[i].cal, + Cal = &WCC->disp_cal[i]; + p = icalcomponent_get_first_property(Cal->cal, ICAL_DTSTART_PROPERTY); if (p != NULL) { t = icalproperty_get_dtstart(p); @@ -418,16 +423,17 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) { hours=(int)(difftime / 60); minutes=difftime % 60; wprintf("%i:%2i" - "" - "
", - daycolor, - hours, minutes, - daycolor, - WC->disp_cal[i].cal_msgnum, - bstr("year"), - bstr("month"), - bstr("day") - ); + "" + "", + daycolor, + hours, minutes, + (Cal->unread)?"_unread":"_read", + daycolor, + WC->disp_cal[i].cal_msgnum, + bstr("year"), + bstr("month"), + bstr("day") + ); escputs((char *) icalproperty_get_comment(p)); @@ -880,14 +886,16 @@ void calendar_day_view_display_events(time_t thetime, if (all_day_event && notime_events) { - wprintf("
  • " + wprintf("
  • " "unread)?"_unread":"_read", Cal->cal_msgnum, year, month, day); - wprintf("%s
    ", _("All day event")); - wprintf("%s ", _("Summary:")); + wprintf("%s
    ", _("All day event")); + wprintf("%s: %s
    ", _("From"), Cal->from); + wprintf("%s ", _("Summary:")); escputs((char *) icalproperty_get_comment(p)); wprintf("
    "); q = icalcomponent_get_first_property(Cal->cal,ICAL_LOCATION_PROPERTY); @@ -916,14 +924,16 @@ void calendar_day_view_display_events(time_t thetime, } else if (ongoing_event && notime_events) { - wprintf("
  • " + wprintf("
  • " "unread)?"_unread":"_read", Cal->cal_msgnum, year, month, day); - wprintf("%s
    ", _("Ongoing event")); - wprintf("%s ", _("Summary:")); + wprintf("%s
    ", _("Ongoing event")); + wprintf("%s: %s
    ", _("From"), Cal->from); + wprintf("%s ", _("Summary:")); escputs((char *) icalproperty_get_comment(p)); wprintf("
    "); q = icalcomponent_get_first_property(Cal->cal,ICAL_LOCATION_PROPERTY); @@ -989,10 +999,11 @@ void calendar_day_view_display_events(time_t thetime, /* should never get here */ } - wprintf("
    ", + (Cal->unread)?"_unread":"_read", top, (gap * 40), (bottom-top) ); wprintf("cal_msgnum, year, month, day, t.hour); - wprintf("%s ", _("Summary:")); + wprintf("%s: %s
    ", _("From"), Cal->from); + wprintf("%s ", _("Summary:")); escputs((char *) icalproperty_get_comment(p)); wprintf("
    "); q = icalcomponent_get_first_property(Cal->cal,ICAL_LOCATION_PROPERTY); diff --git a/webcit/event.c b/webcit/event.c index a67e44445..000e070f7 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -17,7 +17,7 @@ * \param supplied_vevent the event to edit * \param msgnum reference on the citserver */ -void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) { +void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, int unread) { icalcomponent *vevent; icalproperty *p; icalvalue *v; @@ -55,8 +55,8 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) { display_edit_individual_event( icalcomponent_get_first_component( - vevent, ICAL_VEVENT_COMPONENT - ), msgnum + vevent, ICAL_VEVENT_COMPONENT), + msgnum, from, unread ); return; } @@ -428,7 +428,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) * \param supplied_vevent the event to save * \param msgnum the index on the citserver */ -void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { +void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, int unread) { char buf[SIZ]; icalproperty *prop; icalcomponent *vevent, *encaps; @@ -457,8 +457,8 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) { save_individual_event( icalcomponent_get_first_component( - vevent, ICAL_VEVENT_COMPONENT - ), msgnum + vevent, ICAL_VEVENT_COMPONENT), + msgnum, from, unread ); return; } @@ -721,7 +721,7 @@ STARTOVER: for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDE check_attendee_availability(encaps); /** This displays the form again, with our annotations */ - display_edit_individual_event(encaps, msgnum); + display_edit_individual_event(encaps, msgnum, from, unread); icalcomponent_free(encaps); } diff --git a/webcit/messages.c b/webcit/messages.c index 8ecc80eae..76dd1ab0f 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -2346,7 +2346,7 @@ void readloop(char *oper) * new messages. */ strcpy(old_msgs, ""); - if (is_summary) { + if ((is_summary) || (WCC->wc_default_view == VIEW_CALENDAR)){ serv_puts("GTSN"); serv_getln(buf, sizeof buf); if (buf[0] == '2') { @@ -2358,7 +2358,7 @@ void readloop(char *oper) if (WCC->wc_default_view == VIEW_CALENDAR) { /**< calendar */ is_calendar = 1; - strcpy(cmd, "MSGS ALL"); + strcpy(cmd, "MSGS ALL|||1"); maxmsgs = 32767; } if (WCC->wc_default_view == VIEW_TASKS) { /**< tasks */ @@ -2395,7 +2395,7 @@ void readloop(char *oper) goto DONE; } - if (is_summary) { + if ((is_summary) || (WCC->wc_default_view == VIEW_CALENDAR)){ for (a = 0; a < nummsgs; ++a) { /** Are you a new message, or an old message? */ if (is_summary) { @@ -2638,13 +2638,13 @@ void readloop(char *oper) addrbook[num_ab-1].ab_msgnum = WCC->msgarr[a]; } else if (is_calendar) { - display_calendar(WCC->msgarr[a]); + display_calendar(WCC->msgarr[a], WCC->summ[a].is_new); } else if (is_tasks) { - display_task(WCC->msgarr[a]); + display_task(WCC->msgarr[a], WCC->summ[a].is_new); } else if (is_notes) { - display_note(WCC->msgarr[a]); + display_note(WCC->msgarr[a], WCC->summ[a].is_new); } else { if (displayed_msgs == NULL) { diff --git a/webcit/notes.c b/webcit/notes.c index 0d790ec7a..3896d11cf 100644 --- a/webcit/notes.c +++ b/webcit/notes.c @@ -14,7 +14,7 @@ * \brief display sticky notes * \param msgnum the citadel mesage number */ -void display_note(long msgnum) +void display_note(long msgnum, int unread) { char buf[SIZ]; char notetext[SIZ]; diff --git a/webcit/static/webcit.css b/webcit/static/webcit.css index 9f4980307..dc68ca10e 100644 --- a/webcit/static/webcit.css +++ b/webcit/static/webcit.css @@ -1230,7 +1230,7 @@ td.events_of_the_day { vertical-align: top; } -.event { +.event_framed_unread { filter:alpha(opacity=50); /* Internet Explorer 6 */ -moz-opacity:0.5; /* Mozilla 1.6 and prec. */ opacity: 0.5; /* CSS3 draft and Mozilla */ @@ -1241,7 +1241,45 @@ td.events_of_the_day { padding: 0 4px 0 4px; } -li.event span, a.event_title { +li.event_framed_unread span, a.event_title { + filter:alpha(opacity=100); + -moz-opacity:1.0; + opacity: 1.0; + font-size: 11px; +} + +.event_framed_read { + filter:alpha(opacity=50); /* Internet Explorer 6 */ + -moz-opacity:0.5; /* Mozilla 1.6 and prec. */ + opacity: 0.5; /* CSS3 draft and Mozilla */ + -moz-border-radius: 8px; /* CSS3 draft and Mozilla */ + border: solid 1px red; + background-color: yellow; + z-index: 10; + padding: 0 4px 0 4px; +} + +li.event_framed_read span, a.event_title { + filter:alpha(opacity=100); + -moz-opacity:1.0; + opacity: 1.0; + font-size: 11px; +} + +.event_read { +} + +li.event_read span, a.event_read_title { + filter:alpha(opacity=100); + -moz-opacity:1.0; + opacity: 1.0; + font-size: 11px; +} + +.event_unread { +} + +li.event_unread span, a.event_read_title { filter:alpha(opacity=100); -moz-opacity:1.0; opacity: 1.0; diff --git a/webcit/summary.c b/webcit/summary.c index e78399eab..06487fb9f 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -140,7 +140,7 @@ void tasks_section(void) { } else { for (i=0; imsgarr[i]); + display_task(WC->msgarr[i], 0); } } @@ -179,7 +179,7 @@ void calendar_section(void) { } else { for (i=0; imsgarr[i]); + display_calendar(WC->msgarr[i], 0); } calendar_summary_view(); } diff --git a/webcit/webcit.h b/webcit/webcit.h index cad424573..ab0f76696 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -390,6 +390,8 @@ struct wcsession { struct disp_cal { icalcomponent *cal; /**< cal items for display */ long cal_msgnum; /**< cal msgids for display */ + char *from; /**< owner of this component */ + int unread; /**< already seen by the user? */ } *disp_cal; int num_cal; /**< number of calendar items for display */ #endif @@ -650,9 +652,9 @@ void summary(void); void summary_inner_div(void); ssize_t write(int fd, const void *buf, size_t count); void cal_process_attachment(char *part_source, long msgnum, char *cal_partnum); -void display_calendar(long msgnum); -void display_task(long msgnum); -void display_note(long msgnum); +void display_calendar(long msgnum, int unread); +void display_task(long msgnum, int unread); +void display_note(long msgnum, int unread); void updatenote(void); void do_calendar_view(void); void do_tasks_view(void); @@ -690,6 +692,7 @@ void burn_folder_cache(time_t age); void list_all_rooms_by_floor(char *viewpref); void display_room_directory(void); void display_picture(void); +void display_pictureview(void); void download_file(char *); void upload_file(void); @@ -701,8 +704,8 @@ void save_event(void); void display_icaltimetype_as_webform(struct icaltimetype *, char *); void icaltime_from_webform(struct icaltimetype *result, char *prefix); void icaltime_from_webform_dateonly(struct icaltimetype *result, char *prefix); -void display_edit_individual_event(icalcomponent *supplied_vtodo, long msgnum); -void save_individual_event(icalcomponent *supplied_vtodo, long msgnum); +void display_edit_individual_event(icalcomponent *supplied_vtodo, long msgnum, char *from, int unread); +void save_individual_event(icalcomponent *supplied_vtodo, long msgnum, char *from, int unread); void respond_to_request(void); void handle_rsvp(void); void ical_dezonify(icalcomponent *cal); -- 2.30.2