1.1 --- a/imipweb/calendar.py Sun Sep 27 01:26:05 2015 +0200
1.2 +++ b/imipweb/calendar.py Sun Sep 27 02:19:42 2015 +0200
1.3 @@ -409,10 +409,7 @@
1.4
1.5 # Show the calendar itself.
1.6
1.7 - page.table(cellspacing=5, cellpadding=5, class_="calendar")
1.8 - self.show_calendar_participant_headings(partitioned_group_types, partitioned_group_sources, group_columns)
1.9 - self.show_calendar_days(days, partitioned_groups, partitioned_group_types, group_columns)
1.10 - page.table.close()
1.11 + self.show_calendar_days(days, partitioned_groups, partitioned_group_types, partitioned_group_sources, group_columns)
1.12
1.13 # End the form region.
1.14
1.15 @@ -443,8 +440,8 @@
1.16 for day in days:
1.17 daystr, dayid = self._day_value_and_identifier(day)
1.18 l.append("""\
1.19 -input.newevent.selector#%s:checked ~ table thead#region-%s label.day,
1.20 -input.newevent.selector#%s:checked ~ table tbody#region-%s label.timepoint""" % (dayid, dayid, dayid, dayid))
1.21 +input.newevent.selector#%s:checked ~ div div#region-%s label.day,
1.22 +input.newevent.selector#%s:checked ~ div div#region-%s label.timepoint""" % (dayid, dayid, dayid, dayid))
1.23
1.24 page.add(",\n".join(l))
1.25 page.add(""" {
1.26 @@ -480,7 +477,7 @@
1.27 for point, endpoint in intervals:
1.28 timestr, timeid = self._slot_value_and_identifier(point, endpoint)
1.29 l.append("""\
1.30 -input.newevent.selector#%s:checked ~ table th#region-%s label.timepoint""" % (timeid, timeid))
1.31 +input.newevent.selector#%s:checked ~ div div#region-%s label.timepoint""" % (timeid, timeid))
1.32
1.33 page.add(",\n".join(l))
1.34 page.add(""" {
1.35 @@ -491,7 +488,7 @@
1.36
1.37 page.style.close()
1.38
1.39 - def show_calendar_participant_headings(self, group_types, group_sources, group_columns):
1.40 + def show_calendar_participant_headings(self, group_types, group_sources, group_columns, is_empty):
1.41
1.42 """
1.43 Show headings for the participants and other scheduling contributors,
1.44 @@ -500,24 +497,20 @@
1.45
1.46 page = self.page
1.47
1.48 - page.colgroup(span=1, id="columns-timeslot")
1.49 -
1.50 - for group_type, columns in zip(group_types, group_columns):
1.51 - page.colgroup(span=max(columns, 1), id="columns-%s" % group_type)
1.52 -
1.53 - page.thead()
1.54 - page.tr()
1.55 - page.th("", class_="emptyheading")
1.56 + page.div(class_="tableheading%s" % (is_empty and " empty" or ""))
1.57 + page.div(class_="tablerow")
1.58 + page.div("", class_="tablecell emptyheading")
1.59
1.60 for group_type, source, columns in zip(group_types, group_sources, group_columns):
1.61 - page.th(source,
1.62 - class_=(group_type == "request" and "requestheading" or "participantheading"),
1.63 - colspan=max(columns, 1))
1.64 + page.div(source,
1.65 + class_="tablecell %s" % (group_type == "request" and "requestheading" or "participantheading"))
1.66 + for i in range(1, max(columns, 1)):
1.67 + page.div("", class_="tablecell %s" % (group_type == "request" and "requestheading" or "participantheading"))
1.68
1.69 - page.tr.close()
1.70 - page.thead.close()
1.71 + page.div.close()
1.72 + page.div.close()
1.73
1.74 - def show_calendar_days(self, days, partitioned_groups, partitioned_group_types, group_columns):
1.75 + def show_calendar_days(self, days, partitioned_groups, partitioned_group_types, partitioned_group_sources, group_columns):
1.76
1.77 """
1.78 Show calendar days, defined by a collection of 'days', the contributing
1.79 @@ -556,17 +549,18 @@
1.80
1.81 daystr, dayid = self._day_value_and_identifier(day)
1.82
1.83 - page.thead(class_="separator%s" % (is_empty and " empty" or ""), id="region-%s" % dayid)
1.84 - page.tr()
1.85 - page.th(class_="dayheading container", colspan=all_columns+1)
1.86 + page.div(class_="calendar")
1.87 +
1.88 + page.div(class_="dayheading container separator%s" % (is_empty and " empty" or ""), id="region-%s" % dayid)
1.89 self._day_heading(day)
1.90 - page.th.close()
1.91 - page.tr.close()
1.92 - page.thead.close()
1.93 + page.div.close()
1.94 +
1.95 + self.show_calendar_participant_headings(partitioned_group_types, partitioned_group_sources, group_columns, is_empty)
1.96
1.97 - page.tbody(class_="points%s" % (is_empty and " empty" or ""), id="region-%s" % dayid)
1.98 + page.div(class_="tablebody points%s" % (is_empty and " empty" or ""), id="region-%s" % dayid)
1.99 self.show_calendar_points(intervals, groups_for_day, partitioned_group_types, group_columns)
1.100 - page.tbody.close()
1.101 + page.div.close()
1.102 + page.div.close()
1.103
1.104 def show_calendar_points(self, intervals, groups, group_types, group_columns):
1.105
1.106 @@ -612,14 +606,14 @@
1.107 continuation and "daystart" or ""
1.108 ])
1.109
1.110 - page.tr(class_=css)
1.111 + page.div(class_="tablerow %s" % css)
1.112 if point.indicator == Point.PRINCIPAL:
1.113 timestr, timeid = self._slot_value_and_identifier(point, endpoint)
1.114 - page.th(class_="timeslot", id="region-%s" % timeid)
1.115 + page.div(class_="tablecell timeslot", id="region-%s" % timeid)
1.116 self._time_point(point, endpoint)
1.117 else:
1.118 - page.th()
1.119 - page.th.close()
1.120 + page.div(class_="tablecell")
1.121 + page.div.close()
1.122
1.123 # Obtain slots for the time point from each group.
1.124
1.125 @@ -662,47 +656,56 @@
1.126 # Points defining the ends of instant events should
1.127 # never define the start of new events.
1.128
1.129 - if point.indicator == Point.PRINCIPAL and (point.point == p.get_start() or continuation):
1.130 + first_cell_in_group = point.indicator == Point.PRINCIPAL and (point.point == p.get_start() or continuation)
1.131
1.132 - has_continued = continuation and point.point != p.get_start()
1.133 - will_continue = not ends_on_same_day(point.point, p.get_end(), tzid)
1.134 - is_organiser = p.organiser == self.user
1.135 + has_continued = continuation and point.point != p.get_start()
1.136 + will_continue = not endpoint and not ends_on_same_day(point.point, p.get_end(), tzid)
1.137 + is_organiser = p.organiser == self.user
1.138 +
1.139 + last_cell = not will_continue and (not endpoint or endpoint.point == p.get_end())
1.140
1.141 - css = " ".join([
1.142 - "event",
1.143 - has_continued and "continued" or "",
1.144 - will_continue and "continues" or "",
1.145 - p.transp == "ORG" and "only-organising" or is_organiser and "organising" or "attending",
1.146 - self._have_request(p.uid, p.recurrenceid, "COUNTER", True) and "counter" or "",
1.147 - ])
1.148 + css = " ".join([
1.149 + "event",
1.150 + has_continued and "continued" or "",
1.151 + will_continue and "continues" or "",
1.152 + last_cell and "ends" or "",
1.153 + p.transp == "ORG" and "only-organising" or is_organiser and "organising" or "attending",
1.154 + self._have_request(p.uid, p.recurrenceid, "COUNTER", True) and "counter" or "",
1.155 + ])
1.156
1.157 - # Only anchor the first cell of events.
1.158 - # Need to only anchor the first period for a recurring
1.159 - # event.
1.160 + # Only anchor the first cell of events.
1.161 + # Need to only anchor the first period for a recurring
1.162 + # event.
1.163
1.164 - html_id = "%s-%s-%s" % (group_type, p.uid, p.recurrenceid or "")
1.165 + html_id = "%s-%s-%s" % (group_type, p.uid, p.recurrenceid or "")
1.166
1.167 - if point.point == p.get_start() and html_id not in self.html_ids:
1.168 - page.td(class_=css, rowspan=span, id=html_id)
1.169 - self.html_ids.add(html_id)
1.170 - else:
1.171 - page.td(class_=css, rowspan=span)
1.172 + if point.point == p.get_start() and html_id not in self.html_ids:
1.173 + page.div(class_="tablecell %s" % css, id=html_id)
1.174 + self.html_ids.add(html_id)
1.175 + else:
1.176 + page.div(class_="tablecell %s" % css)
1.177
1.178 - # Only link to events if they are not being updated
1.179 - # by requests.
1.180 + # Continue event spans using empty cells.
1.181 +
1.182 + if not first_cell_in_group:
1.183 + pass
1.184 +
1.185 + # Only link to events if they are not being updated
1.186 + # by requests.
1.187
1.188 - if not p.summary or \
1.189 - group_type != "request" and self._have_request(p.uid, p.recurrenceid, None, True):
1.190 + elif not p.summary or \
1.191 + group_type != "request" and self._have_request(p.uid, p.recurrenceid, None, True):
1.192
1.193 - page.span(p.summary or "(Participant is busy)")
1.194 + page.span(p.summary or "(Participant is busy)")
1.195
1.196 - # Link to requests and events (including ones for
1.197 - # which counter-proposals exist).
1.198 + # Link to requests and events (including ones for
1.199 + # which counter-proposals exist).
1.200
1.201 - else:
1.202 - page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid))
1.203 + else:
1.204 + page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid))
1.205
1.206 - page.td.close()
1.207 + page.div.close()
1.208 +
1.209 else:
1.210 empty += 1
1.211
1.212 @@ -713,7 +716,7 @@
1.213 if empty:
1.214 self._empty_slot(point, endpoint, empty)
1.215
1.216 - page.tr.close()
1.217 + page.div.close()
1.218
1.219 def _day_heading(self, day):
1.220
1.221 @@ -767,11 +770,13 @@
1.222 """
1.223
1.224 page = self.page
1.225 - page.td(class_="empty%s" % (point.indicator == Point.PRINCIPAL and " container" or ""), colspan=colspan)
1.226 - if point.indicator == Point.PRINCIPAL:
1.227 - value, identifier = self._slot_value_and_identifier(point, endpoint)
1.228 - page.label("Select/deselect period", class_="newevent popup", for_=identifier)
1.229 - page.td.close()
1.230 +
1.231 + for i in range(0, colspan):
1.232 + page.div(class_="tablecell empty%s" % (point.indicator == Point.PRINCIPAL and " container" or ""))
1.233 + if point.indicator == Point.PRINCIPAL:
1.234 + value, identifier = self._slot_value_and_identifier(point, endpoint)
1.235 + page.label("Select/deselect period", class_="newevent popup", for_=identifier)
1.236 + page.div.close()
1.237
1.238 def _day_value_and_identifier(self, day):
1.239