Commit b31ef918 authored by Romain Courteaud's avatar Romain Courteaud

Add a first prototype of Field Editor handling in dialog.

This is only compatible with FormBox for now.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20042 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 70e49e75
...@@ -148,6 +148,7 @@ if dialog_method == \'Folder_delete\':\n ...@@ -148,6 +148,7 @@ if dialog_method == \'Folder_delete\':\n
\n \n
\n \n
form = getattr(context, dialog_id)\n form = getattr(context, dialog_id)\n
\n
# form can be a python script that returns the form\n # form can be a python script that returns the form\n
if not hasattr(form, \'validate_all_to_request\'):\n if not hasattr(form, \'validate_all_to_request\'):\n
form = form()\n form = form()\n
...@@ -183,10 +184,18 @@ for field in form.get_fields():\n ...@@ -183,10 +184,18 @@ for field in form.get_fields():\n
listbox_id_list.append(k)\n listbox_id_list.append(k)\n
elif can_redirect and (v in (None, [], ()) or hasattr(v, \'read\')) : # If we cannot redirect, useless to test it again\n elif can_redirect and (v in (None, [], ()) or hasattr(v, \'read\')) : # If we cannot redirect, useless to test it again\n
can_redirect = 0\n can_redirect = 0\n
\n
# Cleanup my_ and your_ prefixes\n # Cleanup my_ and your_ prefixes\n
splitted = k.split(\'_\', 1)\n splitted = k.split(\'_\', 1)\n
if len(splitted) == 2 and splitted[0] in (\'my\', \'your\'):\n if len(splitted) == 2 and splitted[0] in (\'my\', \'your\'):\n
\n
if hasattr(v, \'as_dict\'):\n
# This is an encapsulated editor\n
# convert it\n
kw.update(v.as_dict())\n
else:\n
kw[splitted[1]] = request_form[splitted[1]] = v\n kw[splitted[1]] = request_form[splitted[1]] = v\n
\n
else:\n else:\n
kw[k] = request_form[k] = v\n kw[k] = request_form[k] = v\n
\n \n
...@@ -270,6 +279,7 @@ elif url_params_string != \'\':\n ...@@ -270,6 +279,7 @@ elif url_params_string != \'\':\n
, dialog_method\n , dialog_method\n
, url_params_string\n , url_params_string\n
)\n )\n
\n
else:\n else:\n
redirect_url = \'%s/%s\' % ( context.absolute_url()\n redirect_url = \'%s/%s\' % ( context.absolute_url()\n
, dialog_method\n , dialog_method\n
......
755 757
\ No newline at end of file \ No newline at end of file
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