[Erp5-report] r8469 - /erp5/trunk/products/ERP5Form/FormulatorPatch.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jul 18 13:10:22 CEST 2006


Author: kevin
Date: Tue Jul 18 13:10:18 2006
New Revision: 8469

URL: http://svn.erp5.org?rev=8469&view=rev
Log:
Patch the render_view of TextField to enclose the value within <span> html tags if css class defined

Modified:
    erp5/trunk/products/ERP5Form/FormulatorPatch.py

Modified: erp5/trunk/products/ERP5Form/FormulatorPatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/FormulatorPatch.py?rev=8469&r1=8468&r2=8469&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/FormulatorPatch.py (original)
+++ erp5/trunk/products/ERP5Form/FormulatorPatch.py Tue Jul 18 13:10:18 2006
@@ -324,6 +324,22 @@
 
 PatchedLinkWidgetInstance = PatchedLinkWidget()
 LinkField.widget = PatchedLinkWidgetInstance
+
+
+# Patch the render_view of TextField to enclose the value within <span> html tags if css class defined
+def TextWidget_patched_render_view(self, field, value):
+  """Render text as non-editable.
+  """
+  if value is None:
+    return ''
+  css_class = field.get_value('css_class')
+  if css_class not in ('', None):
+    return "<span class='%s'>%s</span>" % (css_class, value)
+  return value
+
+from Products.Formulator.Widget import TextWidget
+TextWidget.render_view = TextWidget_patched_render_view
+
 
 class IntegerWidget(TextWidget) :
   def render(self, field, key, value, REQUEST) :




More information about the Erp5-report mailing list