1.1 --- a/imip_manager.py Sat Feb 07 00:47:14 2015 +0100
1.2 +++ b/imip_manager.py Sat Feb 07 17:16:48 2015 +0100
1.3 @@ -37,8 +37,8 @@
1.4 get_end_of_day, get_start_of_day, get_start_of_next_day, \
1.5 get_timestamp, ends_on_same_day, to_timezone
1.6 from imiptools.mail import Messenger
1.7 -from imiptools.period import add_day_start_points, add_slots, convert_periods, \
1.8 - get_freebusy_details, \
1.9 +from imiptools.period import add_day_start_points, add_empty_days, add_slots, \
1.10 + convert_periods, get_freebusy_details, \
1.11 get_scale, have_conflict, get_slots, get_spans, \
1.12 partition_by_day
1.13 from imiptools.profile import Preferences
1.14 @@ -854,11 +854,14 @@
1.15 # The positioning of the control, paragraph and table are important here.
1.16
1.17 page.input(name="hideslots", type="checkbox", value="hide", id="hideslots")
1.18 + page.input(name="hidedays", type="checkbox", value="hide", id="hidedays")
1.19 page.input(name="hidebusy", type="checkbox", value="hide", id="hidebusy")
1.20
1.21 page.p(class_="controls")
1.22 page.label("Hide busy time periods", for_="hidebusy", class_="hidebusy enable")
1.23 page.label("Show busy time periods", for_="hidebusy", class_="hidebusy disable")
1.24 + page.label("Hide empty days", for_="hidedays", class_="hidedays enable")
1.25 + page.label("Show empty days", for_="hidedays", class_="hidedays disable")
1.26 page.label("Hide unused time periods", for_="hideslots", class_="hideslots enable")
1.27 page.label("Show unused time periods", for_="hideslots", class_="hideslots disable")
1.28 page.p.close()
1.29 @@ -977,8 +980,16 @@
1.30 partitioned_group_types.append(group_type)
1.31 partitioned_group_sources.append(group_source)
1.32
1.33 + # Add empty days.
1.34 +
1.35 + add_empty_days(days, partitioned, tzid)
1.36 +
1.37 + # Show the controls permitting day selection.
1.38 +
1.39 self.show_calendar_day_controls(days)
1.40
1.41 + # Show the calendar itself.
1.42 +
1.43 page.table(cellspacing=5, cellpadding=5, class_="calendar")
1.44 self.show_calendar_participant_headings(partitioned_group_types, partitioned_group_sources, group_columns)
1.45 self.show_calendar_days(days, partitioned_groups, partitioned_group_types, group_columns)
1.46 @@ -1071,21 +1082,31 @@
1.47 # Produce a heading and time points for each day.
1.48
1.49 for day, intervals in all_days:
1.50 + groups_for_day = [partitioned.get(day) for partitioned in partitioned_groups]
1.51 + is_empty = True
1.52 +
1.53 + for slots in groups_for_day:
1.54 + if not slots:
1.55 + continue
1.56 +
1.57 + for active in slots.values():
1.58 + if active:
1.59 + is_empty = False
1.60 + break
1.61 +
1.62 page.thead()
1.63 - page.tr()
1.64 + page.tr(class_="separator%s" % (is_empty and " empty" or ""))
1.65 page.th(class_="dayheading container", colspan=all_columns+1)
1.66 self._day_heading(day)
1.67 page.th.close()
1.68 page.tr.close()
1.69 page.thead.close()
1.70
1.71 - groups_for_day = [partitioned.get(day) for partitioned in partitioned_groups]
1.72 -
1.73 page.tbody()
1.74 - self.show_calendar_points(intervals, groups_for_day, partitioned_group_types, group_columns)
1.75 + self.show_calendar_points(intervals, groups_for_day, partitioned_group_types, group_columns, is_empty)
1.76 page.tbody.close()
1.77
1.78 - def show_calendar_points(self, intervals, groups, group_types, group_columns):
1.79 + def show_calendar_points(self, intervals, groups, group_types, group_columns, is_empty):
1.80
1.81 """
1.82 Show the time 'intervals' along with period information from the given
1.83 @@ -1113,6 +1134,7 @@
1.84
1.85 css = " ".join(
1.86 ["slot"] +
1.87 + (is_empty and ["onlyslot"] or []) +
1.88 (have_active and ["busy"] or ["empty"]) +
1.89 (continuation and ["daystart"] or [])
1.90 )