[Mpuls-commits] r706 - in waska/trunk: . waskaweb/lib waskaweb/public/styles

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 25 18:16:40 CET 2009


Author: torsten
Date: 2009-11-25 18:16:38 +0100 (Wed, 25 Nov 2009)
New Revision: 706

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/lib/renderer.py
   waska/trunk/waskaweb/public/styles/all.css
Log:
Added disabled mode rendering


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2009-11-25 16:39:42 UTC (rev 705)
+++ waska/trunk/ChangeLog.txt	2009-11-25 17:16:38 UTC (rev 706)
@@ -5,6 +5,9 @@
 	* formed/formedtree_web.xml: Fixed name in phase rule. -> lead to
 	  exception in inconsistency search
 
+	* waskaweb/lib/renderer.py,
+	  waskaweb/public/styles/all.css: Add disabled mode rendering.
+
 2009-11-16	Sascha L. Teichmann	<sascha.teichmann at intevation.de>
 
 	* waskaweb/templates/casemanagement/selectParts.mako: Added section

Modified: waska/trunk/waskaweb/lib/renderer.py
===================================================================
--- waska/trunk/waskaweb/lib/renderer.py	2009-11-25 16:39:42 UTC (rev 705)
+++ waska/trunk/waskaweb/lib/renderer.py	2009-11-25 17:16:38 UTC (rev 706)
@@ -364,11 +364,12 @@
 
 class ViewRenderer:
 
-    def __init__(self, formdata=FormData(), ro_mode=True):
+    def __init__(self, formdata=FormData(), ro_mode=True, disabled_mode=False):
         self.formdata        = formdata
         self.stateStack      = None
         self.containersStack = None
         self.ro_mode         = ro_mode
+        self.disabled_mode   = disabled_mode
         self.items           = formdata.nc
 
 
@@ -470,11 +471,11 @@
         if expr and not self.formdata.evaluate(expr):
             ro = not conditional.isInvisible()
             if ro:
-                old_ro = self.ro_mode
-                self.ro_mode = True
+                old_ro = self.disabled_mode
+                self.disabled_mode = True
                 for child in conditional.children:
                     self._renderChild(child)
-                self.ro_mode = old_ro
+                self.disabled_mode = old_ro
             else:
                 self.toTarget(Text(""), conditional.getTarget())
         else:
@@ -525,14 +526,9 @@
         else:
             name = ""
 
-        # Do not render choicelists in disabled mode as IE can not cope with
-        # css on disabled list elements. Instead just render the selected
-        # option within the list (ChoiceBool)
-        disabled = ""
-        #if self.ro_mode: 
-        #    disabled = 'disabled="disabled"'
-        #    css_class.append('readonly')
-        #else: disabled = ""
+        display_mode = ""
+        if self.disabled_mode:
+            display_mode = "disabled"
 
         multiple = multiple and "multiple" or ""
 
@@ -545,7 +541,7 @@
 
         out.append(
             '<select size="%s" class="%s" %s %s %s %s>\n' % (
-                size, " ".join(css_class), disabled, multiple, name, SET_MODIFICATION))
+                size, " ".join(css_class), display_mode, multiple, name, SET_MODIFICATION))
 
         self.stateStack.append(data)
         out.append(self._renderRecursive(choice, False))
@@ -713,16 +709,19 @@
         if error:
             css_class.append('error')    
 
-        if not self.ro_mode: 
+        if self.disabled_mode:
+            css_class.append("disabled")
+        elif self.ro_mode:
+            css_class.append("readonly")
+
+        if not self.ro_mode and not self.disabled_mode: 
             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')
             value = value.replace('\r\n', '<br>')
             value = value.replace('\n', '<br>')
             value = value.replace('\r', '<br>')
-            out.append('<p class="readonly">%s</p>' % F.NA(value))
+            out.append('<p class="%s">%s</p>' % (" ".join(css_class),F.NA(value)))
 
         self.toTarget(Item("".join(out)), text.getTarget())
 
@@ -747,16 +746,19 @@
         else:
             name = ""
 
+        display_mode = ""
         if self.ro_mode: 
-            disabled = "readonly"
-            css_class.append('readonly')
-        else: disabled = ""
+            if not self.disabled_mode: css_class.append('readonly')
+            display_mode = "readonly"
 
+        if self.disabled_mode:
+            display_mode = "disabled"
+
         if error:
             css_class.append('error_box')
 
         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))
+            " ".join(css_class), display_mode, name, value, SET_MODIFICATION))
 
         self.toTarget(Item("".join(out)), date.getTarget());
 
@@ -780,11 +782,14 @@
         if length: length = 'maxlength="%s"' % escape(length, True)
         else:      length = ""
 
+        display_mode = ""
         if self.ro_mode: 
-            css_class.append('readonly')
-            disabled = "readonly"
-        else: disabled = ""
+            if not self.disabled_mode: css_class.append('readonly')
+            display_mode = "readonly"
 
+        if self.disabled_mode:
+            display_mode = "disabled"
+
         out = [ self._renderLabel(description, name, help=help) ]
 
         if name:
@@ -798,7 +803,7 @@
             css_class.append('error_box')
 
         out.append('<input type="text" class="%s" %s %s %s %s %s %s><br>\n' % (
-            " ".join(css_class), disabled, size, length, name, value, SET_MODIFICATION))
+            " ".join(css_class), display_mode, size, length, name, value, SET_MODIFICATION))
 
         self.toTarget(Item("".join(out)), text.getTarget())
 

Modified: waska/trunk/waskaweb/public/styles/all.css
===================================================================
--- waska/trunk/waskaweb/public/styles/all.css	2009-11-25 16:39:42 UTC (rev 705)
+++ waska/trunk/waskaweb/public/styles/all.css	2009-11-25 17:16:38 UTC (rev 706)
@@ -271,6 +271,13 @@
 	border-color: #e6e4de;
 	border-style: groove none none groove;
 }
+p.disabled{
+	padding: 1pt;
+	border-color: #e6e4de;
+	border-style: groove none none groove;
+	background: #eeebe7;
+	color: #757575;
+}
 
 /*---------------------*/
 /*   3.1 User	       */



More information about the Mpuls-commits mailing list