1.1 --- a/imipweb/event.py Wed May 13 14:18:07 2015 +0200
1.2 +++ b/imipweb/event.py Wed May 13 14:59:30 2015 +0200
1.3 @@ -464,27 +464,27 @@
1.4 page.p("An action is required for this request:")
1.5
1.6 page.p()
1.7 - page.input(name="reply", type="submit", value="Send reply")
1.8 + self._control("reply", "submit", "Send reply")
1.9 page.add(" ")
1.10 - page.input(name="discard", type="submit", value="Discard event")
1.11 + self._control("discard", "submit", "Discard event")
1.12 page.add(" ")
1.13 - page.input(name="ignore", type="submit", value="Do nothing for now")
1.14 + self._control("ignore", "submit", "Do nothing for now")
1.15 page.p.close()
1.16
1.17 if self.is_organiser(obj):
1.18 page.p("As organiser, you can perform the following:")
1.19
1.20 page.p()
1.21 - page.input(name="create", type="submit", value=(sequence is None and "Create event" or "Update event"))
1.22 + self._control("create", "submit", sequence is None and "Create event" or "Update event")
1.23 page.add(" ")
1.24
1.25 if sequence is not None and not is_request:
1.26 - page.input(name="cancel", type="submit", value="Cancel event")
1.27 + self._control("cancel", "submit", "Cancel event")
1.28 else:
1.29 - page.input(name="discard", type="submit", value="Discard event")
1.30 + self._control("discard", "submit", "Discard event")
1.31
1.32 page.add(" ")
1.33 - page.input(name="save", type="submit", value="Save without sending")
1.34 + self._control("save", "submit", "Save without sending")
1.35 page.p.close()
1.36
1.37 def show_object_on_page(self, uid, obj, errors=None):
1.38 @@ -498,7 +498,7 @@
1.39 page = self.page
1.40 page.form(method="POST")
1.41
1.42 - page.input(name="editing", type="hidden", value="true")
1.43 + self._control("editing", "hidden", "true")
1.44
1.45 args = self.env.get_args()
1.46
1.47 @@ -574,7 +574,7 @@
1.48
1.49 page.td(class_="objectvalue summary")
1.50 if self.is_organiser(obj):
1.51 - page.input(name="summary", type="text", value=value, size=80)
1.52 + self._control("summary", "text", value, size=80)
1.53 else:
1.54 page.add(value)
1.55 page.td.close()
1.56 @@ -604,7 +604,7 @@
1.57 page.tr()
1.58
1.59 page.td()
1.60 - page.input(name="add", type="submit", value="add", id="add", class_="add")
1.61 + self._control("add", "submit", "add", id="add", class_="add")
1.62 page.label("Add attendee", for_="add", class_="add")
1.63 page.td.close()
1.64 page.tr.close()
1.65 @@ -653,9 +653,9 @@
1.66 # Show a form control as organiser for new attendees.
1.67
1.68 if self.is_organiser(obj) and (not existing or sequence is None):
1.69 - page.input(name="attendee", type="value", value=attendee, size="40")
1.70 + self._control("attendee", "value", attendee, size="40")
1.71 else:
1.72 - page.input(name="attendee", type="hidden", value=attendee)
1.73 + self._control("attendee", "hidden", attendee)
1.74 page.add(attendee)
1.75 page.add(" ")
1.76
1.77 @@ -669,7 +669,7 @@
1.78 # the current user, if indicated.
1.79
1.80 elif self.is_organiser(obj) and not existing:
1.81 - page.input(name="partstat-refresh", type="submit", value="refresh", id="partstat-%d" % i, class_="refresh")
1.82 + self._control("partstat-refresh", "submit", "refresh", id="partstat-%d" % i, class_="refresh")
1.83 page.label(dict(self.partstat_items).get(partstat, ""), for_="partstat-%s" % i, class_="partstat")
1.84 else:
1.85 page.span(dict(self.partstat_items).get(partstat, ""), class_="partstat")
1.86 @@ -996,7 +996,7 @@
1.87
1.88 # Put the origin somewhere.
1.89
1.90 - page.input(name="recur-origin", type="hidden", value=p.origin or "")
1.91 + self._control("recur-origin", "hidden", p.origin or "")
1.92
1.93 else:
1.94 page.div(class_="dt disabled")
1.95 @@ -1071,7 +1071,7 @@
1.96
1.97 # Utility methods.
1.98
1.99 - def _control(self, name, type, value, selected, **kw):
1.100 + def _control(self, name, type, value, selected=False, **kw):
1.101
1.102 """
1.103 Show a control with the given 'name', 'type' and 'value', with
1.104 @@ -1142,7 +1142,7 @@
1.105 # Show a date label with a hidden field if read-only.
1.106
1.107 if read_only:
1.108 - page.input(name="%s-date" % name, type="hidden", value=format_datetime(base))
1.109 + self._control("%s-date" % name, "hidden", format_datetime(base))
1.110 page.span(self.format_date(base, "long"))
1.111
1.112 # Show dates for up to one week around the current date.
1.113 @@ -1160,15 +1160,15 @@
1.114
1.115 if read_only:
1.116 page.span("%s:%s:%s" % (default.get_hour(), default.get_minute(), default.get_second()))
1.117 - page.input(name="%s-hour" % name, type="hidden", value=default.get_hour())
1.118 - page.input(name="%s-minute" % name, type="hidden", value=default.get_minute())
1.119 - page.input(name="%s-second" % name, type="hidden", value=default.get_second())
1.120 + self._control("%s-hour" % name, "hidden", default.get_hour())
1.121 + self._control("%s-minute" % name, "hidden", default.get_minute())
1.122 + self._control("%s-second" % name, "hidden", default.get_second())
1.123 else:
1.124 - page.input(name="%s-hour" % name, type="text", value=default.get_hour(), maxlength=2, size=2)
1.125 + self._control("%s-hour" % name, "text", default.get_hour(), maxlength=2, size=2)
1.126 page.add(":")
1.127 - page.input(name="%s-minute" % name, type="text", value=default.get_minute(), maxlength=2, size=2)
1.128 + self._control("%s-minute" % name, "text", default.get_minute(), maxlength=2, size=2)
1.129 page.add(":")
1.130 - page.input(name="%s-second" % name, type="text", value=default.get_second(), maxlength=2, size=2)
1.131 + self._control("%s-second" % name, "text", default.get_second(), maxlength=2, size=2)
1.132
1.133 # Show time zone details.
1.134
1.135 @@ -1179,7 +1179,7 @@
1.136 # Show a label if read-only or a menu otherwise.
1.137
1.138 if read_only:
1.139 - page.input(name="%s-tzid" % name, type="hidden", value=tzid)
1.140 + self._control("%s-tzid" % name, "hidden", tzid)
1.141 page.span(tzid)
1.142 else:
1.143 self._show_timezone_menu("%s-tzid" % name, tzid, index)