Commit f36260d2 authored by Julien Muchembled's avatar Julien Muchembled

Code clean up in ListBox & EditorField

parent 4d1b9357
......@@ -94,15 +94,10 @@ for f in form.get_fields():\n
listbox = request.get(\'listbox\') # XXX: hardcoded field name\n
if listbox is not None:\n
listbox_line_list = []\n
listbox = getattr(request,\'listbox\',None) # XXX: hardcoded field name\n
listbox_keys = listbox.keys()\n
listbox_keys.sort()\n
for key in listbox_keys:\n
listbox_line = listbox[key]\n
listbox_line[\'listbox_key\'] = key\n
listbox_line_list.append(listbox[key])\n
listbox_line_list = tuple(listbox_line_list)\n
doaction_param_list[\'listbox\'] = listbox_line_list # XXX: hardcoded field name\n
for key, value in sorted(listbox.iteritems()):\n
value[\'listbox_key\'] = key\n
listbox_line_list.append(value)\n
doaction_param_list[\'listbox\'] = tuple(listbox_line_list)\n
\n
try:\n
context.portal_workflow.doActionFor(\n
......
......@@ -83,15 +83,12 @@ class EditorWidget(Widget.TextAreaWidget):
"""
here = REQUEST['here']
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':
if 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)
if bespin_support is not None:
return bespin_support.pt_render(
extra_context= {
'field' : field,
......@@ -100,8 +97,7 @@ class EditorWidget(Widget.TextAreaWidget):
})
elif text_editor == "xinha":
xinha_support = getattr(here, 'xinha_support', None)
if xinha_support is None:
return Widget.TextAreaWidget.render(self, field, key, value, REQUEST)
if xinha_support is not None:
return xinha_support.pt_render(
extra_context= {
'field' : field,
......@@ -110,27 +106,25 @@ class EditorWidget(Widget.TextAreaWidget):
})
elif text_editor == "svg_editor":
svg_editor_support = getattr(here, 'svg_editor_support', None)
if svg_editor_support is None:
return Widget.TextAreaWidget.render(self, field, key, value, REQUEST)
if svg_editor_support is not None:
return svg_editor_support.pt_render()
elif text_editor == "spreadsheet_editor":
sheet_editor_support = getattr(here, 'sheet_editor_support', None)
if sheet_editor_support is None:
return Widget.TextAreaWidget.render(self, field, key, value, REQUEST)
if sheet_editor_support is not None:
return sheet_editor_support.pt_render()
elif text_editor == 'ace':
ace_editor_support = getattr(here, 'ace_editor_support', None)
if ace_editor_support is None:
return Widget.TextAreaWidth.render(self, field, key, value, REQUEST)
if ace_editor_support is not None:
return ace_editor_support.pt_render(extra_context={'field': field,
'content': value,
'id': key})
else:
elif text_editor != 'text_area':
return here.fckeditor_wysiwyg_support.pt_render(
extra_context= {
'inputvalue' : value,
'inputname' : key
})
return Widget.TextAreaWidget.render(self, field, key, value, REQUEST)
def render_view(self, field, value, REQUEST=None, render_prefix=None):
"""
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment