# HG changeset patch # User Paul Boddie # Date 1422568529 -3600 # Node ID 7e65d77e943e358dbd1cc6d1e886abcc2a59a32f # Parent bf345f30725727688db179808b0f35c61041c3bc Show periods crossing day boundaries more clearly. diff -r bf345f307257 -r 7e65d77e943e htdocs/styles.css --- a/htdocs/styles.css Thu Jan 29 20:34:56 2015 +0100 +++ b/htdocs/styles.css Thu Jan 29 22:55:29 2015 +0100 @@ -32,9 +32,17 @@ border: 2px solid #000; } +td.event.continued { + border-top: 2px dotted #000; +} + +td.event.continues { + border-bottom: 2px dotted #000; +} + td.event:target { background-color: #5f4; - border: 4px solid #000; + border-width: 4px; } td.event a { diff -r bf345f307257 -r 7e65d77e943e imip_manager.py --- a/imip_manager.py Thu Jan 29 20:34:56 2015 +0100 +++ b/imip_manager.py Thu Jan 29 22:55:29 2015 +0100 @@ -33,7 +33,7 @@ get_item, get_uri, get_utc_datetime, get_value, \ get_value_map, get_values, parse_object, to_part from imiptools.dates import format_datetime, get_datetime, get_start_of_day, \ - to_timezone + ends_on_same_day, to_timezone from imiptools.mail import Messenger from imiptools.period import add_day_start_points, add_slots, convert_periods, \ get_freebusy_details, \ @@ -772,12 +772,20 @@ if point == start or continuation: + has_continued = continuation and point != start + will_continue = not ends_on_same_day(point, end) + css = " ".join( + ["event"] + + (has_continued and ["continued"] or []) + + (will_continue and ["continues"] or []) + ) + # Only anchor the first cell of events. if point == start: - page.td(class_="event", rowspan=span, id="%s-%s" % (group_type, uid)) + page.td(class_=css, rowspan=span, id="%s-%s" % (group_type, uid)) else: - page.td(class_="event", rowspan=span) + page.td(class_=css, rowspan=span) obj = self._get_object(uid) diff -r bf345f307257 -r 7e65d77e943e imiptools/dates.py --- a/imiptools/dates.py Thu Jan 29 20:34:56 2015 +0100 +++ b/imiptools/dates.py Thu Jan 29 22:55:29 2015 +0100 @@ -19,7 +19,7 @@ this program. If not, see . """ -from datetime import date, datetime +from datetime import date, datetime, timedelta from pytz import timezone, UnknownTimeZoneError import re @@ -101,4 +101,13 @@ def get_start_of_day(dt): return datetime(dt.year, dt.month, dt.day, 0, 0, tzinfo=dt.tzinfo) +def get_end_of_day(dt): + return get_start_of_day(dt + timedelta(1)) + +def ends_on_same_day(dt, end): + return ( + dt.date() == end.date() or + end == get_end_of_day(dt) + ) + # vim: tabstop=4 expandtab shiftwidth=4