imip-agent

Changeset

852:7411013e727e
2015-10-16 Paul Boddie raw files shortlog changelog graph Switched to presenting replaced recurrences using read-only date controls, thus keeping the form handling happy.
imipweb/resource.py (file)
     1.1 --- a/imipweb/resource.py	Fri Oct 16 18:45:36 2015 +0200
     1.2 +++ b/imipweb/resource.py	Fri Oct 16 19:26:32 2015 +0200
     1.3 @@ -419,7 +419,7 @@
     1.4  
     1.5          page = self.page
     1.6          if type in ("checkbox", "radio") and selected:
     1.7 -            page.input(name=name, type=type, value=value, checked=selected, **kw)
     1.8 +            page.input(name=name, type=type, value=value, checked="checked", **kw)
     1.9          else:
    1.10              page.input(name=name, type=type, value=value, **kw)
    1.11  
    1.12 @@ -708,12 +708,13 @@
    1.13          # Show label as attendee.
    1.14  
    1.15          else:
    1.16 -            self.show_recurrence_label(p, recurrenceid, recurrenceids, show_start)
    1.17 +            self.show_recurrence_label(index, period, recurrenceid, recurrenceids, show_start)
    1.18  
    1.19 -    def show_recurrence_label(self, period, recurrenceid, recurrenceids, show_start):
    1.20 +    def show_recurrence_label(self, index, period, recurrenceid, recurrenceids, show_start):
    1.21  
    1.22          """
    1.23 -        Show datetime details for the given 'period', employing any
    1.24 +        Show datetime details from the current object for the recurrence having
    1.25 +        the given 'index', for the given recurrence 'period', employing any
    1.26          'recurrenceid' and 'recurrenceids' for the object to configure the
    1.27          displayed information.
    1.28  
    1.29 @@ -722,6 +723,7 @@
    1.30          """
    1.31  
    1.32          page = self.page
    1.33 +        _name = self.element_name
    1.34  
    1.35          try:
    1.36              p = event_period_from_period(period)
    1.37 @@ -744,7 +746,13 @@
    1.38          formdate = show_start and period.get_form_start() or period.get_form_end()
    1.39          dt = formdate.as_datetime()
    1.40          if dt:
    1.41 -            page.td(self.format_datetime(dt, "long"), class_=css)
    1.42 +            page.td(class_=css)
    1.43 +            if show_start:
    1.44 +                self.date_controls(_name("dtstart", "recur", index), period.get_form_start(), index=index, read_only=True)
    1.45 +                self.control("recur-origin", "hidden", period.origin or "")
    1.46 +            else:
    1.47 +                self.date_controls(_name("dtend", "recur", index), period.get_form_end(), index=index, show_tzid=False, read_only=True)
    1.48 +            page.td.close()
    1.49          else:
    1.50              page.td("(Unrecognised date)")
    1.51