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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 20 10:51:00 CET 2009


Author: teichmann
Date: 2009-03-20 10:50:58 +0100 (Fri, 20 Mar 2009)
New Revision: 418

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/lib/renderer.py
Log:
Ported tab navigation index from offline client.



Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-20 09:43:29 UTC (rev 417)
+++ wasko/trunk/ChangeLog.txt	2009-03-20 09:50:58 UTC (rev 418)
@@ -1,3 +1,7 @@
+2009-03-20	Sascha L. Teichmann <teichmann at intevation.de>
+
+	* waskaweb/lib/renderer.py: Ported tab navigation index from offline client.
+
 2009-03-20	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 
 	New formedtree for issue 107

Modified: wasko/trunk/waskaweb/lib/renderer.py
===================================================================
--- wasko/trunk/waskaweb/lib/renderer.py	2009-03-20 09:43:29 UTC (rev 417)
+++ wasko/trunk/waskaweb/lib/renderer.py	2009-03-20 09:50:58 UTC (rev 418)
@@ -290,11 +290,19 @@
         self.containersStack = None
         self.ro_mode         = ro_mode
         self.items           = formdata.nc
+        self.tabindex        = 3
 
+    def next_tabindex(self):
+        tabindex = self.tabindex
+        self.tabindex += 1
+        return 'tabindex="%d"' % tabindex
+
     def renderView(self, name="", ds_id=None, showNext=True):
 
         if not self.items:
             return "No items given!"
+
+        self.tabindex = 3
        
         out = []
         if not self.ro_mode:
@@ -302,9 +310,10 @@
             # Add submitbutton at the top of the page too
             out.append('<div class="waska_form_element w100">')
             out.append('<input type="hidden" name="ds" value="%s">' % ds_id)
-            out.append('<input type="submit" value="&Uuml;bernehmen">\n')
+            out.append('<input type="submit" value="&Uuml;bernehmen" %s>\n' % self.next_tabindex())
             if showNext:
-                out.append('<input type="submit" value="&Uuml;bernehmen und weiter" name="__formular_next">\n')
+                out.append('<input type="submit" value="&Uuml;bernehmen und weiter" name="__formular_next" %s>\n' % \
+                    self.next_tabindex())
             out.append('</div>')
 
         self.stateStack = []
@@ -319,9 +328,10 @@
                 out.append('<input type="hidden" name="page" value=%s>\n' \
                     % quoteattr(name))
             out.append('<div class="waska_form_element w100">')
-            out.append('<input type="submit" value="&Uuml;bernehmen">\n')
+            out.append('<input type="submit" value="&Uuml;bernehmen" %s>\n' % self.next_tabindex())
             if showNext:
-                out.append('<input type="submit" value="&Uuml;bernehmen und weiter" name="__formular_next">\n')
+                out.append('<input type="submit" value="&Uuml;bernehmen und weiter" name="__formular_next" %s>\n' % \
+                    self.next_tabindex())
             out.append('</div>')
             out.append('</form>\n')
 
@@ -531,9 +541,9 @@
         elif warn: css_class.append('warning_box')    
 
         out.append(
-            '<select size="%s" class="%s" %s %s %s %s>\n' % (
+            '<select size="%s" class="%s" %s %s %s %s %s>\n' % (
                 size, " ".join(css_class), disabled, 
-                multiple, name, SET_MODIFICATION))
+                multiple, name, SET_MODIFICATION, self.next_tabindex()))
 
         self.stateStack.append(data)
         out.append(self._renderRecursive(choice, False))
@@ -593,8 +603,9 @@
 
         disabled = self.ro_mode and 'disabled' or ''
 
-        out = u'<input type="radio" %s %s %s %s %s %s>\n' % (
-            oname, value, required, checked, SET_MODIFICATION, disabled)
+        out = u'<input type="radio" %s %s %s %s %s %s %s>\n' % (
+            oname, value, required, checked, SET_MODIFICATION, 
+            disabled, self.next_tabindex())
 
         return out
 
@@ -613,7 +624,7 @@
         label = self._renderLabel(description, name, newline=False)
 
         if value:
-            value = 'value="%s"' % escape(value, True)
+            value = 'value=%s' % quoteattr(value)
         else:
             value = ""
 
@@ -621,7 +632,7 @@
         elif  name: oname = u'name=%s' % quoteattr(name)
         else:       oname = u''
 
-        if name: id = u'id="%s"' % quoteattr(name)
+        if name: id = u'id=%s' % quoteattr(name)
         else:    id = ""
         
         if self.ro_mode: 
@@ -629,9 +640,9 @@
             css_class.append(disabled)
         else: disabled = ""
 
-        out = u'<input type="radio" class="%s" %s %s %s %s %s %s>%s\n' % (
+        out = u'<input type="radio" class="%s" %s %s %s %s %s %s %s>%s\n' % (
             u" ".join(css_class), disabled, oname, id, value, checked, 
-            SET_MODIFICATION, label)
+            SET_MODIFICATION, self.next_tabindex(), label)
 
         self.toTarget(Item(out), bool.getTarget())
 
@@ -661,9 +672,9 @@
             css_class.append('readonly')
         else: disabled = ""
 
-        out = '<input type="checkbox" class="%s" %s %s %s %s %s>%s' % (
+        out = '<input type="checkbox" class="%s" %s %s %s %s %s %s>%s' % (
             " ".join(css_class), disabled, name, value, checked, 
-            SET_MODIFICATION, label)
+            SET_MODIFICATION, self.next_tabindex(), label)
 
         self.toTarget(Item(out), bool.getTarget())
 
@@ -679,19 +690,20 @@
         else:       newline = ""
 
         if description:
+            description = escape(description)
             if name:
                 if error:
                     return u'<label for=%s class="error_font"><a name="f_%s">%s</a> %s</label>%s\n' % ( 
-                    quoteattr(name), escape(name), escape(description), helpmsg, newline)
+                    quoteattr(name), escape(name), description, helpmsg, newline)
 
                 if warn:
                     return u'<label for=%s class="warning_font"><a name="f_%s">%s</a> %s</label>%s\n' % ( 
-                    quoteattr(name), escape(name), escape(description), helpmsg, newline)
+                    quoteattr(name), escape(name), description, helpmsg, newline)
 
                 return u'<label for=%s><a name="f_%s">%s</a> %s</label>%s\n' % ( 
-                    quoteattr(name), escape(name), escape(description), helpmsg, newline)
+                    quoteattr(name), escape(name), description, helpmsg, newline)
                     
-            return u"%s " % escape(description)
+            return u"%s " % description
         return ""
 
     def _renderTextArea(self, text):
@@ -733,9 +745,9 @@
         elif warn: css_class.append('warning_box')    
 
         if not self.ro_mode: 
-            out.append('<textarea class="%s" %s %s %s %s>%s</textarea><br>\n' % (
+            out.append('<textarea class="%s" %s %s %s %s %s>%s</textarea><br>\n' % (
             " ".join(css_class), name, rows, cols, 
-            SET_MODIFICATION, value))
+            SET_MODIFICATION, self.next_tabindex(), value))
         else:
             #disabled = "disabled"
             #css_class.append('readonly')
@@ -780,9 +792,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 %s><br>\n' % (
+        out.append( '<input type="text" size="10" maxlength="10" class="%s" %s %s %s %s %s><br>\n' % (
             " ".join(css_class), disabled, name, 
-            value, SET_MODIFICATION))
+            value, SET_MODIFICATION, self.next_tabindex()))
 
         self.toTarget(Item("".join(out)), date.getTarget());
 
@@ -827,9 +839,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 %s><br>\n' % (
+        out.append(u'<input type="text" class="%s" %s %s %s %s %s %s %s><br>\n' % (
             " ".join(css_class), disabled, size, length, name, 
-            value, SET_MODIFICATION))
+            value, SET_MODIFICATION, self.next_tabindex()))
 
         self.toTarget(Item("".join(out)), text.getTarget())
 
@@ -878,9 +890,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 %s><br>\n' % (
+        out.append(u'<input type="text" class="%s" %s %s %s %s %s %s %s><br>\n' % (
             " ".join(css_class), disabled, size, name, value, 
-            id, SET_MODIFICATION))
+            id, SET_MODIFICATION, self.next_tabindex()))
 
         self.toTarget(Item("".join(out)), integer.getTarget())
 



More information about the Mpuls-commits mailing list