Commit 5225bf78 authored by Romain Courteaud's avatar Romain Courteaud

WIP [erp5_hal_json_style] xxx jump / redirect

parent a281b433
......@@ -60,10 +60,23 @@ result_dict = {
}
}
# web_section_value = context.getWebSectionValue()
# web_section_value = context.REQUEST.get('current_web_section', None)
# web_section_url = web_section_value.absolute_url()
# raise NotImplementedError(web_section_url)
# Drop the automatically added VirtualHostMonster object ID
if (not context.isWebMode()) and (context.REQUEST.get('web_section_value', None) is not None):
portal = context.getPortalObject()
# raise NotImplementedError(context.REQUEST['web_section_value'])
web_section = portal.restrictedTraverse("/".join(context.REQUEST['web_section_value']))
context = getattr(web_section, context.getRelativeUrl())
# raise NotImplementedError(context)
# form_id = 'view' means use default document view. Let the JS handle it
# In case of dialog submit, if redirecting to the original form, let the JS handle the navigation history
if (form_id is not None) and \
(form_id not in ['view', 'Base_viewFakePythonScriptActionForm']) and \
if (form_id not in [None, 'Base_viewFakePythonScriptActionForm']) and \
((form_id != 'view') or (keep_items is not None)) and \
(form_id != previous_form_id) and \
(not form_id.startswith('http')) and \
(context.isWebMode()):
......
......@@ -1352,7 +1352,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# If our "form" is actually a Script (nothing is sure in ERP5) or anything else than Form
# (e.g. function or bound class method will) not have .meta_type thus be considered a Script
# then we execute it directly
if "Script" in getattr(view_instance, "meta_type", "Script"):
if ("Script" in getattr(view_instance, "meta_type", "Script")) or ():
view_instance = getattr(traversed_document, 'Base_viewFakePythonScriptActionForm')
if view_instance.pt == "form_dialog":
......@@ -1402,7 +1402,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
global_action_type = ("view", "workflow", "object_new_content_action",
"object_clone_action", "object_delete_action",
"object_list_action")
"object_list_action", "object_jump")
if (erp5_action_key == view_action_type or
erp5_action_key in global_action_type or
"_jio" in erp5_action_key):
......@@ -1428,7 +1428,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
"extra_param_json": urlsafe_b64encode(json.dumps(ensureSerializable(extra_param_json)))
}
if erp5_action_key == 'object_jump':
if erp5_action_key == 'object_jumpX':
# XXX couscous
if 'Base_jumpToRelatedObject?' in view_action['url']:
# Fetch the URL arguments
# XXX Correctly unquote arguments
......
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