Commit 256e1ba4 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_hal_json_style] Merge latest erp5_core Base_edit changes

parent 67873979
...@@ -82,7 +82,6 @@ if dialog_id not in (\'\', None):\n ...@@ -82,7 +82,6 @@ if dialog_id not in (\'\', None):\n
if not silent_mode and not request.AUTHENTICATED_USER.has_permission(\'Modify portal content\', context) :\n if not silent_mode and not request.AUTHENTICATED_USER.has_permission(\'Modify portal content\', context) :\n
msg = Base_translateString("You do not have the permissions to edit the object.")\n msg = Base_translateString("You do not have the permissions to edit the object.")\n
redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&%s\' % (context.absolute_url(), form_id, selection_index, selection_name, \'portal_status_message=%s\' % msg)\n redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&%s\' % (context.absolute_url(), form_id, selection_index, selection_name, \'portal_status_message=%s\' % msg)\n
# return request[\'RESPONSE\'].redirect(redirect_url)\n
return context.Base_redirect(redirect_url)\n return context.Base_redirect(redirect_url)\n
\n \n
# Get the form\n # Get the form\n
...@@ -119,14 +118,25 @@ def editListBox(listbox_field, listbox):\n ...@@ -119,14 +118,25 @@ def editListBox(listbox_field, listbox):\n
for url, v in listbox.items():\n for url, v in listbox.items():\n
v.update(gv)\n v.update(gv)\n
# Form: \'\' -> ERP5: None\n # Form: \'\' -> ERP5: None\n
cleaned_v = v.copy()\n encapsulated_editor_list = []\n
for key, value in cleaned_v.items():\n cleaned_v = {}\n
if value == \'\':\n for key, value in v.items():\n
cleaned_v[key] = None\n if hasattr(value, \'edit\'):\n
if listbox_edit is None:\n encapsulated_editor_list.append(value)\n
context.restrictedTraverse(url).edit(edit_order=edit_order, **cleaned_v)\n else:\n
else:\n if value == \'\': \n
listbox_edit(url, edit_order, cleaned_v)\n value = None\n
cleaned_v[key] = value\n
\n
if cleaned_v:\n
if listbox_edit is None:\n
obj = context.restrictedTraverse(url)\n
obj.edit(edit_order=edit_order, **cleaned_v)\n
else:\n
listbox_edit(url, edit_order, cleaned_v)\n
\n
for encapsulated_editor in encapsulated_editor_list:\n
encapsulated_editor.edit(obj)\n
\n \n
def editMatrixBox(matrixbox_field, matrixbox):\n def editMatrixBox(matrixbox_field, matrixbox):\n
""" Function called to edit a Matrix box\n """ Function called to edit a Matrix box\n
...@@ -288,11 +298,11 @@ try:\n ...@@ -288,11 +298,11 @@ try:\n
except ActivityPendingError,e:\n except ActivityPendingError,e:\n
message = Base_translateString("%s" % e)\n message = Base_translateString("%s" % e)\n
\n \n
if message_only:\n
return message\n
\n
ignore_layout = int(ignore_layout)\n ignore_layout = int(ignore_layout)\n
try:\n editable_mode = int(editable_mode)\n
editable_mode = int(editable_mode)\n
except TypeError:\n
raise TypeError(str(editable_mode))\n
spp = context.getPhysicalPath()\n spp = context.getPhysicalPath()\n
spp =list(spp)\n spp =list(spp)\n
s_url = request["SERVER_URL"]\n s_url = request["SERVER_URL"]\n
...@@ -307,8 +317,6 @@ if context.REQUEST.get(\'is_web_mode\', False) and \\\n ...@@ -307,8 +317,6 @@ if context.REQUEST.get(\'is_web_mode\', False) and \\\n
form_id = \'view\'\n form_id = \'view\'\n
\n \n
if not selection_index:\n if not selection_index:\n
# redirect_url = \'%s/%s?ignore_layout:int=%s&editable_mode:int=%s&portal_status_message=%s\' % (\n
# context.absolute_url(),\n
redirect_url = \'%s?ignore_layout:int=%s&editable_mode:int=%s&portal_status_message=%s\' % (\n redirect_url = \'%s?ignore_layout:int=%s&editable_mode:int=%s&portal_status_message=%s\' % (\n
form_id,\n form_id,\n
ignore_layout,\n ignore_layout,\n
...@@ -317,8 +325,6 @@ if not selection_index:\n ...@@ -317,8 +325,6 @@ if not selection_index:\n
\n \n
\n \n
else:\n else:\n
# redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&ignore_layout:int=%s&editable_mode=%s&portal_status_message=%s\' % (\n
# context.absolute_url(),\n
redirect_url = \'%s?selection_index=%s&selection_name=%s&ignore_layout:int=%s&editable_mode=%s&portal_status_message=%s\' % (\n redirect_url = \'%s?selection_index=%s&selection_name=%s&ignore_layout:int=%s&editable_mode=%s&portal_status_message=%s\' % (\n
form_id,\n form_id,\n
selection_index,\n selection_index,\n
...@@ -328,18 +334,15 @@ else:\n ...@@ -328,18 +334,15 @@ else:\n
message)\n message)\n
\n \n
\n \n
# result = request[\'RESPONSE\'].redirect(redirect_url) \n
\n
if silent_mode: return result, \'redirect\'\n if silent_mode: return result, \'redirect\'\n
return context.Base_redirect(redirect_url)\n return context.Base_redirect(redirect_url)\n
# return result\n
]]></string> </value> ]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id, selection_index=0, selection_name=\'\', dialog_id=\'\', ignore_layout=0, editable_mode=1, silent_mode=0, field_prefix=\'my_\', key_prefix=None, listbox_edit=None</string> </value> <value> <string>form_id, selection_index=0, selection_name=\'\', dialog_id=\'\', ignore_layout=0, editable_mode=1, silent_mode=0, field_prefix=\'my_\', key_prefix=None, listbox_edit=None, message_only=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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