1.1 --- a/htdocs/styles.css Mon Oct 19 23:38:37 2015 +0200
1.2 +++ b/htdocs/styles.css Tue Oct 20 15:55:28 2015 +0200
1.3 @@ -1,3 +1,23 @@
1.4 +body,
1.5 +#participants,
1.6 +#pending-requests {
1.7 + background-color: #fff;
1.8 +}
1.9 +
1.10 +#participants {
1.11 + float: right;
1.12 +}
1.13 +
1.14 +#pending-requests {
1.15 + float: left;
1.16 +}
1.17 +
1.18 +#calendar-controls,
1.19 +#time-navigation,
1.20 +div.calendar {
1.21 + clear: both;
1.22 +}
1.23 +
1.24 /* Table styling. */
1.25
1.26 table.calendar {
2.1 --- a/imipweb/calendar.py Mon Oct 19 23:38:37 2015 +0200
2.2 +++ b/imipweb/calendar.py Tue Oct 20 15:55:28 2015 +0200
2.3 @@ -172,6 +172,29 @@
2.4 self.redirect(self.link_to(uid, args=self.get_time_navigation_args()))
2.5 return True
2.6
2.7 + def update_participants(self):
2.8 +
2.9 + "Update the participants used for scheduling purposes."
2.10 +
2.11 + args = self.env.get_args()
2.12 + participants = args.get("participants", [])
2.13 +
2.14 + try:
2.15 + for name, value in args.items():
2.16 + if name.startswith("remove-participant-"):
2.17 + i = int(name[len("remove-participant-"):])
2.18 + del participants[i]
2.19 + break
2.20 + except ValueError:
2.21 + pass
2.22 +
2.23 + # Trim empty participants.
2.24 +
2.25 + while participants and not participants[-1].strip():
2.26 + participants.pop()
2.27 +
2.28 + return participants
2.29 +
2.30 # Page fragment methods.
2.31
2.32 def show_requests_on_page(self):
2.33 @@ -206,27 +229,11 @@
2.34
2.35 page.div.close()
2.36
2.37 - def show_participants_on_page(self):
2.38 + def show_participants_on_page(self, participants):
2.39
2.40 "Show participants for scheduling purposes."
2.41
2.42 page = self.page
2.43 - args = self.env.get_args()
2.44 - participants = args.get("participants", [])
2.45 -
2.46 - try:
2.47 - for name, value in args.items():
2.48 - if name.startswith("remove-participant-"):
2.49 - i = int(name[len("remove-participant-"):])
2.50 - del participants[i]
2.51 - break
2.52 - except ValueError:
2.53 - pass
2.54 -
2.55 - # Trim empty participants.
2.56 -
2.57 - while participants and not participants[-1].strip():
2.58 - participants.pop()
2.59
2.60 # Show any specified participants together with controls to remove and
2.61 # add participants.
2.62 @@ -248,7 +255,29 @@
2.63
2.64 page.div.close()
2.65
2.66 - return participants
2.67 + def show_calendar_controls(self):
2.68 +
2.69 + """
2.70 + Show controls for hiding empty days and busy slots in the calendar.
2.71 +
2.72 + The positioning of the controls, paragraph and table are important here:
2.73 + the CSS file describes the relationship between them and the calendar
2.74 + tables.
2.75 + """
2.76 +
2.77 + page = self.page
2.78 +
2.79 + page.input(name="showdays", type="checkbox", value="show", id="showdays", accesskey="D")
2.80 + page.input(name="hidebusy", type="checkbox", value="hide", id="hidebusy", accesskey="B")
2.81 +
2.82 + page.p(class_="controls")
2.83 + page.span("Select days or periods for a new event.")
2.84 + page.label("Hide busy time periods", for_="hidebusy", class_="hidebusy enable")
2.85 + page.label("Show busy time periods", for_="hidebusy", class_="hidebusy disable")
2.86 + page.label("Show empty days", for_="showdays", class_="showdays disable")
2.87 + page.label("Hide empty days", for_="showdays", class_="showdays enable")
2.88 + page.input(name="reset", type="submit", value="Clear selections", id="reset")
2.89 + page.p.close()
2.90
2.91 def show_time_navigation(self, view_start, view_end, view_period=None):
2.92
2.93 @@ -260,7 +289,7 @@
2.94 page = self.page
2.95 view_period = view_period or timedelta(7)
2.96
2.97 - page.p()
2.98 + page.p(id_="time-navigation")
2.99
2.100 if view_start:
2.101 if view_end:
2.102 @@ -337,12 +366,14 @@
2.103 page.p("No events scheduled.")
2.104 return
2.105
2.106 + participants = self.update_participants()
2.107 +
2.108 # Form controls are used in various places on the calendar page.
2.109
2.110 page.form(method="POST")
2.111
2.112 self.show_requests_on_page()
2.113 - participants = self.show_participants_on_page()
2.114 + self.show_participants_on_page(participants)
2.115
2.116 # Obtain the user's timezone.
2.117
2.118 @@ -471,20 +502,9 @@
2.119
2.120 add_empty_days(days, tzid, view_start, view_end)
2.121
2.122 - # Show controls for hiding empty days and busy slots.
2.123 - # The positioning of the control, paragraph and table are important here.
2.124 -
2.125 - page.input(name="showdays", type="checkbox", value="show", id="showdays", accesskey="D")
2.126 - page.input(name="hidebusy", type="checkbox", value="hide", id="hidebusy", accesskey="B")
2.127 + # Show controls to change the calendar appearance.
2.128
2.129 - page.p(class_="controls")
2.130 - page.span("Select days or periods for a new event.")
2.131 - page.label("Hide busy time periods", for_="hidebusy", class_="hidebusy enable")
2.132 - page.label("Show busy time periods", for_="hidebusy", class_="hidebusy disable")
2.133 - page.label("Show empty days", for_="showdays", class_="showdays disable")
2.134 - page.label("Hide empty days", for_="showdays", class_="showdays enable")
2.135 - page.input(name="reset", type="submit", value="Clear selections", id="reset")
2.136 - page.p.close()
2.137 + self.show_calendar_controls()
2.138
2.139 # Show the calendar itself.
2.140