[Mpuls-commits] r283 - in wasko/trunk: . waskaweb/lib waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 23 10:55:52 CET 2009


Author: teichmann
Date: 2009-02-23 10:55:46 +0100 (Mon, 23 Feb 2009)
New Revision: 283

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/lib/renderer.py
   wasko/trunk/waskaweb/model/navigation.py
Log:
Added the beloved JavaScript modified field checks to renderer and navigation.


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-02-23 09:04:49 UTC (rev 282)
+++ wasko/trunk/ChangeLog.txt	2009-02-23 09:55:46 UTC (rev 283)
@@ -1,5 +1,16 @@
 2009-02-23	Sascha L. Teichmann <teichmann at intevation.de>
 
+	Added the beloved JavaScript modified field checks to renderer
+	and navigation.
+	
+	* waskaweb/model/navigation.py: added 
+	  'onclick="return checkModification();"' to links.
+
+	* waskaweb/lib/renderer.py: Added 'onchange="setModification();"' 
+	  to widgets.
+
+2009-02-23	Sascha L. Teichmann <teichmann at intevation.de>
+
 	* waskaweb/lib/helpers.py: Fixed bad commit.
 
 2009-02-22	Sascha L. Teichmann <teichmann at intevation.de>

Modified: wasko/trunk/waskaweb/lib/renderer.py
===================================================================
--- wasko/trunk/waskaweb/lib/renderer.py	2009-02-23 09:04:49 UTC (rev 282)
+++ wasko/trunk/waskaweb/lib/renderer.py	2009-02-23 09:55:46 UTC (rev 283)
@@ -42,12 +42,14 @@
 
 from datetime import date 
 
-import traceback
+#import traceback
 
 TARGET = re.compile(r"(\w+)(?:|:(.+))$")
 
 WEIGHTS = frozenset([15, 25, 30, 40, 45, 50, 55, 60, 75])
 
+SET_MODIFICATION = 'onchange="setModification();"'
+
 def is_required(flags):
     return flags.find("required:") >= 0
 
@@ -501,8 +503,9 @@
         elif warn: css_class.append('warning_box')    
 
         out.append(
-            '<select size="%s" class="%s" %s %s %s>\n' % (
-                size, " ".join(css_class), disabled, multiple, name))
+            '<select size="%s" class="%s" %s %s %s %s>\n' % (
+                size, " ".join(css_class), disabled, 
+                multiple, name, SET_MODIFICATION))
 
         self.stateStack.append(data)
         out.append(self._renderRecursive(choice, False))
@@ -563,8 +566,8 @@
         if name: id = u'id="%s"' % escape(name, True)
         else:    id = ""
         
-        out = u'<input type="radio" %s %s %s %s %s>\n' % (
-            oname, id, value, required, checked)
+        out = u'<input type="radio" %s %s %s %s %s %s>\n' % (
+            oname, id, value, required, checked, SET_MODIFICATION)
 
         return out
 
@@ -599,8 +602,9 @@
             css_class.append(disabled)
         else: disabled = ""
 
-        out = u'<input type="radio" class="%s" %s %s %s %s %s>%s\n' % (
-            u" ".join(css_class), disabled, oname, id, value, checked, label)
+        out = u'<input type="radio" class="%s" %s %s %s %s %s %s>%s\n' % (
+            u" ".join(css_class), disabled, oname, id, value, checked, 
+            SET_MODIFICATION, label)
 
         self.toTarget(Item(out), bool.getTarget())
 
@@ -630,8 +634,9 @@
             css_class.append('readonly')
         else: disabled = ""
 
-        out = '<input type="checkbox" class="%s" %s %s %s %s>%s' % (
-            " ".join(css_class), disabled, name, value, checked, label)
+        out = '<input type="checkbox" class="%s" %s %s %s %s %s>%s' % (
+            " ".join(css_class), disabled, name, value, checked, 
+            SET_MODIFICATION, label)
 
         self.toTarget(Item(out), bool.getTarget())
 
@@ -701,8 +706,9 @@
         elif warn: css_class.append('warning_box')    
 
         if not self.ro_mode: 
-            out.append('<textarea class="%s" %s %s %s>%s</textarea><br>\n' % (
-            " ".join(css_class), name, rows, cols, value))
+            out.append('<textarea class="%s" %s %s %s %s>%s</textarea><br>\n' % (
+            " ".join(css_class), name, rows, cols, 
+            SET_MODIFICATION, value))
         else:
             #disabled = "disabled"
             #css_class.append('readonly')
@@ -747,8 +753,9 @@
         if  error: css_class.append('error_box')    
         elif warn: css_class.append('warning_box')    
 
-        out.append( '<input type="text" size="10" maxlength="10" class="%s" %s %s %s><br>\n' % (
-            " ".join(css_class), disabled, name, value))
+        out.append( '<input type="text" size="10" maxlength="10" class="%s" %s %s %s %s><br>\n' % (
+            " ".join(css_class), disabled, name, 
+            value, SET_MODIFICATION))
 
         self.toTarget(Item("".join(out)), date.getTarget());
 
@@ -794,8 +801,9 @@
         if  error: css_class.append('error_box')    
         elif warn: css_class.append('warning_box')    
 
-        out.append(u'<input type="text" class="%s" %s %s %s %s %s><br>\n' % (
-            " ".join(css_class), disabled, size, length, name, value))
+        out.append(u'<input type="text" class="%s" %s %s %s %s %s %s><br>\n' % (
+            " ".join(css_class), disabled, size, length, name, 
+            value, SET_MODIFICATION))
 
         self.toTarget(Item("".join(out)), text.getTarget())
 
@@ -844,8 +852,9 @@
         if  error: css_class.append('error_box')    
         elif warn: css_class.append('warning_box')    
 
-        out.append(u'<input type="text" class="%s" %s %s %s %s %s><br>\n' % (
-            " ".join(css_class), disabled, size, name, value, id))
+        out.append(u'<input type="text" class="%s" %s %s %s %s %s %s><br>\n' % (
+            " ".join(css_class), disabled, size, name, value, 
+            id, SET_MODIFICATION))
 
         self.toTarget(Item("".join(out)), integer.getTarget())
 

Modified: wasko/trunk/waskaweb/model/navigation.py
===================================================================
--- wasko/trunk/waskaweb/model/navigation.py	2009-02-23 09:04:49 UTC (rev 282)
+++ wasko/trunk/waskaweb/model/navigation.py	2009-02-23 09:55:46 UTC (rev 283)
@@ -42,6 +42,8 @@
 CLOSE_BRANCH  = u"/navigation/close_branch/%s"
 OPEN_BRANCH   = u"/navigation/open_branch/%s"
 
+CHECK_MODIFICATION = u'onclick="return checkModification();"'
+
 class TreeItem:
 
     def __init__(self, name, description, children = None, parent = None):
@@ -85,7 +87,8 @@
 
             select_link = SELECT_ITEM % self.key
 
-            out.append(u'<a href="%s" class="navigation">' % select_link)
+            out.append(u'<a href="%s" class="navigation" %s>' % (
+                select_link, CHECK_MODIFICATION))
 
             if has_error:
                 out.append(get_image("/images/icons/formular_page_blue_error.gif",
@@ -97,8 +100,8 @@
                     u' border="0"'
                     u' alt="Formularseite" title="Seite öffnen"'))
 
-            out.append(u'</a> <a href="%s" class="navigation">%s</a></span>\n' % (
-                select_link, escape(self.description)))
+            out.append(u'</a> <a href="%s" class="navigation" %s>%s</a></span>\n' % (
+                select_link, CHECK_MODIFICATION, escape(self.description)))
         else:
             # when clicking on link select the first page in branch
             deepest = self.deepest_item()
@@ -108,7 +111,8 @@
             if self.is_open or has_error:
                 if not has_error:
                     action = CLOSE_BRANCH % self.key
-                    out.append(u'<a href="%s" class="navigation">' % action)
+                    out.append(u'<a href="%s" class="navigation" %s>' % (
+                        action, CHECK_MODIFICATION))
 
                 out.append(get_image("/images/icons/folder_closed_blue_2.gif",
                     u' border="0"'
@@ -119,8 +123,8 @@
 
                 out.append(has_error and u' ' or u'</a>')
 
-                out.append(u'<a href="%s" class="navigation">%s</a>' % (
-                    select_link, escape(self.description)))
+                out.append(u'<a href="%s" class="navigation" %s>%s</a>' % (
+                    select_link, CHECK_MODIFICATION, escape(self.description)))
 
                 out.append(u'</span>\n<ul>\n')
                 for child in self.children:
@@ -128,7 +132,8 @@
                 out.append(u'</ul>\n')
             else:
                 action = OPEN_BRANCH % self.key
-                out.append(u'<a href="%s" class="navigation">' % action)
+                out.append(u'<a href="%s" class="navigation" %s>' % (
+                    action, CHECK_MODIFICATION))
 
                 out.append(get_image("/images/icons/folder_closed_blue_2.gif",
                     u' border="0"'
@@ -136,8 +141,8 @@
                     
                 out.append(u'</a> ')
 
-                out.append(u'<a href="%s" class="navigation">%s</a></span>' % (
-                    select_link, escape(self.description)))
+                out.append(u'<a href="%s" class="navigation" %s>%s</a></span>' % (
+                    select_link, CHECK_MODIFICATION, escape(self.description)))
 
         out.append(u"</li>\n")
 



More information about the Mpuls-commits mailing list