[Mpuls-commits] r4268 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 26 13:25:28 CET 2010


Author: bh
Date: 2010-11-26 13:25:25 +0100 (Fri, 26 Nov 2010)
New Revision: 4268

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (SET_MODIFICATION_ATTRS): Add onchange
attribute to reactivate the check for modifications in the form
when the usr switches to another page without saving first.
Remove the old commented out SET_MODIFICATION.
(ViewRenderer._renderText, ViewRenderer._renderDate)
(ViewRenderer._renderInt, ViewRenderer._renderNumeric)
(ViewRenderer._renderTextArea): Add the SET_MODIFICATION_ATTRS to
the form elements.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-11-26 10:17:37 UTC (rev 4267)
+++ base/trunk/ChangeLog	2010-11-26 12:25:25 UTC (rev 4268)
@@ -1,3 +1,14 @@
+2010-11-26  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (SET_MODIFICATION_ATTRS): Add onchange
+	attribute to reactivate the check for modifications in the form
+	when the usr switches to another page without saving first.
+	Remove the old commented out SET_MODIFICATION.
+	(ViewRenderer._renderText, ViewRenderer._renderDate)
+	(ViewRenderer._renderInt, ViewRenderer._renderNumeric)
+	(ViewRenderer._renderTextArea): Add the SET_MODIFICATION_ATTRS to
+	the form elements.
+
 2010-11-26  Roland Geider <roland.geider at intevation.de>
 
 	* mpulsweb/public/images/icons/validity-1-22.png: Change icon size to

Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-11-26 10:17:37 UTC (rev 4267)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-11-26 12:25:25 UTC (rev 4268)
@@ -48,8 +48,7 @@
 
 TARGET = re.compile(r"(\w+)(?:|:(.+))$")
 WEIGHTS = frozenset([15, 25, 30, 40, 45, 50, 55, 60, 75])
-#SET_MODIFICATION = 'onchange="setModification();"'
-SET_MODIFICATION_ATTRS = {}
+SET_MODIFICATION_ATTRS = {"onchange": "setModification();"}
 
 def is_required(flags):
     return flags.find("required:") >= 0
@@ -542,7 +541,8 @@
         out.append('<br>')
         out.append(tag("input", name=id, id=id, value=node.getValue(),
                        type="text", size=meta.getSize(),
-                       maxlength=meta.getMaxLength(), disabled=self.ro_mode))
+                       maxlength=meta.getMaxLength(), disabled=self.ro_mode,
+                       **SET_MODIFICATION_ATTRS))
         out.append('<br>')
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
@@ -567,7 +567,8 @@
         out.append(tag("input", name=id, id=id,
                        value=uformat_date(format_date(value)),
                        type="text", size=size, maxlength=maxlength,
-                       disabled=self.ro_mode, class_="datefield"))
+                       disabled=self.ro_mode, class_="datefield",
+                       **SET_MODIFICATION_ATTRS))
         out.append('<br>')
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
@@ -587,7 +588,8 @@
         out.append('<br>')
         out.append(tag("input", name=id, id=id,
                        value=uformat_int(node.getValue()),
-                       type="text", disabled=self.ro_mode))
+                       type="text", disabled=self.ro_mode,
+                       **SET_MODIFICATION_ATTRS))
         out.append('<br>')
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
@@ -607,7 +609,8 @@
         out.append('<br>')
         out.append(tag("input", name=id, id=id,
                        value=uformat_numeric(node.getValue()),
-                       type="text", disabled=self.ro_mode))
+                       type="text", disabled=self.ro_mode,
+                       **SET_MODIFICATION_ATTRS))
         out.append('<br>')
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
@@ -624,7 +627,8 @@
         out.append('<br>')
 
         if not self.ro_mode:
-            out.append(tag("textarea", id=id, name=id, rows=rows, cols=cols))
+            out.append(tag("textarea", id=id, name=id, rows=rows, cols=cols,
+                           **SET_MODIFICATION_ATTRS))
             out.append(escape(value))
             out.append("</textarea>")
             out.append("<br>\n")



More information about the Mpuls-commits mailing list