# HG changeset patch # User Paul Boddie # Date 1422570678 -3600 # Node ID d04da7398c2a300695715694695e5b404c269162 # Parent 7e65d77e943e358dbd1cc6d1e886abcc2a59a32f Added hidden radio buttons and pop-up labels selecting them, so that the start time of a new event can be defined. diff -r 7e65d77e943e -r d04da7398c2a htdocs/styles.css --- a/htdocs/styles.css Thu Jan 29 22:55:29 2015 +0100 +++ b/htdocs/styles.css Thu Jan 29 23:31:18 2015 +0100 @@ -48,3 +48,31 @@ td.event a { color: #009; } + +input.newevent { + display: none; +} + +.container { + position: relative; +} + +.popup { + display: none; + position: absolute; + top: 0; + left: 0; +} + +.container:hover .popup, +.container:focus .popup { + display: block; + border: 1px solid #000; + padding: 4px; + background-color: #fff; +} + +input.newevent:checked ~ .timepoint { + background-color: #af8; + text-decoration: underline; +} diff -r 7e65d77e943e -r d04da7398c2a imip_manager.py --- a/imip_manager.py Thu Jan 29 22:55:29 2015 +0100 +++ b/imip_manager.py Thu Jan 29 23:31:18 2015 +0100 @@ -490,8 +490,6 @@ self.page.div(id="participants") - self.page.form(method="POST") - self.page.p("Participants for scheduling:") for i, participant in enumerate(participants): @@ -505,8 +503,6 @@ self.page.input(name="add-participant", type="submit", value="Add") self.page.p.close() - self.page.form.close() - self.page.div.close() return participants @@ -544,9 +540,19 @@ self.new_page(title="Calendar") page = self.page + # Form controls are used in various places on the calendar page. + + page.form(method="POST") + self.show_requests_on_page() participants = self.show_participants_on_page() + # Show a button for scheduling a new event. + + page.p() + page.input(name="newevent", type="submit", value="New event", id="newevent") + page.p.close() + freebusy = self.store.get_freebusy(self.user) if not freebusy: @@ -655,6 +661,10 @@ self.show_calendar_days(days, partitioned_groups, partitioned_group_types, group_columns) page.table.close() + # End the form region. + + page.form.close() + def show_calendar_participant_headings(self, group_types, group_sources, group_columns): """ @@ -740,7 +750,8 @@ page.tr() page.th(class_="timeslot") - page.add(self.format_time(point, "long")) + self._time_point(point) + page.span(self.format_time(point, "long"), class_="timepoint") page.th.close() # Obtain slots for the time point from each group. @@ -753,7 +764,9 @@ # the colspan is adjusted to be 1, not 0. if not active: - page.td("", class_="empty", colspan=max(columns, 1)) + page.td(class_="empty container", colspan=max(columns, 1)) + self._empty_slot(point) + page.td.close() continue slots = slots.items() @@ -806,17 +819,30 @@ page.td.close() else: - page.td("", class_="empty") + page.td(class_="empty container") + self._empty_slot(point) + page.td.close() # Pad with empty columns. i = columns - len(active) while i > 0: i -= 1 - page.td("", class_="empty") + page.td(class_="empty container") + self._empty_slot(point) + page.td.close() page.tr.close() + def _time_point(self, point): + pointstr = format_datetime(point) + self.page.input(name="start", type="radio", value=pointstr, id="start-%s" % pointstr, class_="newevent") + + def _empty_slot(self, point): + page = self.page + pointstr = format_datetime(point) + page.label("Start a new event at this time", class_="newevent popup", for_="start-%s" % pointstr) + def select_action(self): "Select the desired action and show the result."