[Erp5-report] r37827 rafael - /erp5/trunk/products/ERP5Form/EditorField.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Aug 16 04:23:04 CEST 2010


Author: rafael
Date: Mon Aug 16 04:23:02 2010
New Revision: 37827

URL: http://svn.erp5.org?rev=37827&view=rev
Log:
Integrate Bespin Editor as one Experimental option of EditorField.

The usage of bespin editor depends of erp5_bespin bt5 installed and still experimental. If erp5_bespin is not installed, it render standard an standard editor field.

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

Modified: erp5/trunk/products/ERP5Form/EditorField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/EditorField.py?rev=37827&r1=37826&r2=37827&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/EditorField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/EditorField.py [utf8] Mon Aug 16 04:23:02 2010
@@ -69,7 +69,8 @@ class EditorWidget(Widget.TextAreaWidget
                                    required=1,
                                    size=1,
                                    items=[('Standard Text Area', 'text_area'),
-                                          ('FCK Editor', 'fck_editor')])
+                                          ('FCK Editor', 'fck_editor'), 
+                                          ('Bespin Editor', 'bespin')])
 
   def render(self, field, key, value, REQUEST, render_prefix=None):
     """
@@ -79,6 +80,19 @@ class EditorWidget(Widget.TextAreaWidget
     text_editor = field.get_value('text_editor')
     if text_editor == 'text_area':
       return Widget.TextAreaWidget.render(self, field, key, value, REQUEST)
+    elif text_editor == 'bespin':
+      # XXX The usage of bespin editor depends of erp5_bespin bt5
+      # installed and still experimental. If erp5_bespin is not installed, it 
+      # render standard an standard editor field.
+      bespin_support = getattr(here, 'bespin_support',None)
+      if bespin_support is None:
+        return Widget.TextAreaWidget.render(self, field, key, value, REQUEST)
+      return bespin_support.pt_render(
+           extra_context= {
+                          'field'      : field,
+                          'inputvalue' : value,
+                          'inputname'  : key
+                        })
     else:
       return here.fckeditor_wysiwyg_support.pt_render(
            extra_context= {




More information about the Erp5-report mailing list