Commit 20a59485 authored by Romain Courteaud's avatar Romain Courteaud

WIP [erp5_hal_json_style] xxx jump / redirect

webrjs break break

[erp5_ui_test] Jump action

erp5_ui_test fix jump

hal: use restried traverse

rjs_ui xxx

rjs_test up

rjs_test test 2 docs

rjs wip

erp5_web_renderjs_ui: change form_jump id

erp5_web_renderjs_ui: page_jump

erp5_web_renderjs_ui: change header/panel

erp5_web_renderjs_ui: speed up

erp5_web_renderjs_ui_test: more checks

erp5_web_renderjs_ui: use filter button

erp5_core: add message when jumping to a module

erp5_web_renderjs_ui: use correct router command

erp5_web_renderjs_ui: comment

erp5_hal_json_style: keep_items is never None

erp5_hal_json_style: comment

erp5_web_renderjs_ui_test: up

erp5_web_renderjs_ui: update appcache

erp5_web_renderjs_ui: missing dependency

erp5_web_renderjs_ui_test: up

erp5_core: object_jio_jump

erp5_hal_json_style: object_jio_jump

erp5_ui_test: object_jio_jump

erp5_web_renderjs_ui: object_jio_jump

erp5_xhtml_style: object_jio_jump

erp5_web_renderjs_ui_test: up

erp5_hal_json_style: up test
parent bd8e2f4d
......@@ -60,10 +60,17 @@ result_dict = {
}
}
# Put the web site in the acquisition context
# this occurs when doing a .getObject from the catalog for example
if (not context.isWebMode()) and (context.REQUEST.get('web_section_value', None) is not None):
portal = context.getPortalObject()
web_section = portal.restrictedTraverse("/".join(context.REQUEST['web_section_value']))
context = web_section.restrictedTraverse(context.getRelativeUrl())
# 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', 'Base_viewFakeJumpForm']) and \
((form_id != 'view') or (keep_items)) and \
(form_id != previous_form_id) and \
(not form_id.startswith('http')) and \
(context.isWebMode()):
......
......@@ -1327,6 +1327,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# Try to embed the form in the result
if (view == view_action['id']):
current_action = parseActionUrl('%s' % view_action['url']) # current action/view being rendered
current_action['category_type'] = erp5_action_key
if view and (view != 'view') and (current_action.get('view_id', None) is None):
# XXX Allow to directly render a form
......@@ -1357,7 +1358,10 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# (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"):
view_instance = getattr(traversed_document, 'Base_viewFakePythonScriptActionForm')
if current_action.get('category_type', None) == 'object_jio_jump':
view_instance = getattr(traversed_document, 'Base_viewFakeJumpForm')
else:
view_instance = getattr(traversed_document, 'Base_viewFakePythonScriptActionForm')
if view_instance.pt == "form_dialog":
# If there is a "form_id" in the REQUEST then it means that last view was actually a form
......@@ -1371,7 +1375,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
renderForm(traversed_document, view_instance, embedded_dict,
selection_params=extra_param_json, extra_param_json=extra_param_json)
if view_instance.pt == "form_python_action":
if view_instance.pt in ["form_python_action", "form_jump"]:
for k, v in current_action['params'].items():
renderHiddenField(embedded_dict, k, v)
embedded_dict['_embedded']['form_definition']['group_list'][-1][1].append((k, {'meta_type': 'StringField'}))
......@@ -1406,7 +1410,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_jio_jump")
if (erp5_action_key == view_action_type or
erp5_action_key in global_action_type or
"_jio" in erp5_action_key):
......@@ -1432,31 +1436,6 @@ 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 'Base_jumpToRelatedObject?' in view_action['url']:
# Fetch the URL arguments
# XXX Correctly unquote arguments
argument_dict = dict([x.split('=') for x in view_action['url'].split('?', 1)[1].split("&")])
jump_portal_type = argument_dict.pop('portal_type', None)
if (jump_portal_type is not None):
jump_portal_type = jump_portal_type.replace('+', ' ')
final_argument_dict = {'portal_type': jump_portal_type}
jump_related = argument_dict.pop('related', 1)
if (jump_related):
jump_related_suffix = ''
else:
jump_related_suffix = 'related_'
jump_uid = portal.restrictedTraverse(argument_dict.pop('jump_from_relative_url', getRealRelativeUrl(traversed_document))).getUid()
final_argument_dict['default_%s_%suid' % (argument_dict.pop('base_category'), jump_related_suffix)] = jump_uid
erp5_action_list[-1]['href'] = url_template_dict["jio_search_template"] % {
"query": make_query({"query": sql_catalog.buildQuery(final_argument_dict).asSearchTextExpression(sql_catalog)})
}
else:
# XXX How to handle all custom jump actions?
erp5_action_list.pop(-1)
if erp5_action_list:
if len(erp5_action_list) == 1:
erp5_action_list = erp5_action_list[0]
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_viewFakeJumpForm</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Base_viewFakePythonScriptActionForm</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_jump</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -603,11 +603,12 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['action_workflow'][0]['title'], "Custom Action No Dialog")
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
self.assertEqual(result_dict['_links']['action_object_jump']['href'],
"urn:jio:allDocs?query=portal_type%%3A%%22Query%%22%%20AND%%20default_agent_uid%%3A%sL" %
document.getUid())
self.assertEqual(result_dict['_links']['action_object_jump']['title'], "Queries")
self.assertEqual(result_dict['_links']['action_object_jump']['name'], "jump_query")
self.assertEqual(result_dict['_links']['action_object_jio_jump']['href'],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0=" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_jio_jump']['title'], "Queries")
self.assertEqual(result_dict['_links']['action_object_jio_jump']['name'], "jump_query")
self.assertEqual(result_dict['_links']['portal']['href'], 'urn:jio:get:%s' % document.getPortalObject().getId())
self.assertEqual(result_dict['_links']['portal']['name'], document.getPortalObject().getTitle())
......@@ -959,11 +960,12 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['action_workflow'][0]['title'], "Custom Action No Dialog")
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
self.assertEqual(result_dict['_links']['action_object_jump']['href'],
"urn:jio:allDocs?query=portal_type%%3A%%22Query%%22%%20AND%%20default_agent_uid%%3A%sL" %
document.getUid())
self.assertEqual(result_dict['_links']['action_object_jump']['title'], "Queries")
self.assertEqual(result_dict['_links']['action_object_jump']['name'], "jump_query")
self.assertEqual(result_dict['_links']['action_object_jio_jump']['href'],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query&extra_param_json=eyJmb3JtX2lkIjogIkJhc2Vfdmlld01ldGFkYXRhIn0=" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_jio_jump']['title'], "Queries")
self.assertEqual(result_dict['_links']['action_object_jio_jump']['name'], "jump_query")
self.assertEqual(result_dict['_links']['portal']['href'], 'urn:jio:get:%s' % document.getPortalObject().getId())
self.assertEqual(result_dict['_links']['portal']['name'], document.getPortalObject().getTitle())
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_to_related_bar</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Related Bar</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=successor&portal_type=Bar
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Bar Module | multi_form_dialog
Bar Module | view
Bar | jump_to_related_bar
Bar | list
Bar | performance
Bar | view
......
......@@ -104,7 +104,7 @@
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
# generated on Thu, 19 Sep 2019 00:00:00 GMT+0100\n
# generated on Thu, 07 Jan 2020 00:00:00 GMT+0100\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -210,6 +210,8 @@ gadget_erp5_pt_embedded_form_render.html\n
gadget_erp5_pt_embedded_form_render.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_pt_form_jump.html\n
gadget_erp5_pt_form_jump.js\n
gadget_erp5_pt_form_python_action.html\n
gadget_erp5_pt_form_python_action.js\n
gadget_erp5_pt_form_list.html\n
......@@ -254,7 +256,8 @@ jiodev.js\n
renderjs.js\n
rsvp.js\n
NETWORK:\n
*</string> </value>
*\n
</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -303,114 +306,122 @@ NETWORK:\n
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1465381395.69</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1465381395.69</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>978.35229.31566.53742</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1568879864.85</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>981.438.11963.4386</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1578416140.21</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -5,36 +5,20 @@
<meta name="viewport" content="width=device-width" />
<title>ERP5 Page Jump</title>
<link rel="http://www.renderjs.org/rel/interface" href="interface_page.html">
<link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_form_content_provider.html">
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="jiodev.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_jump.js" type="text/javascript"></script>
<!-- XXX need theme here currently -->
<script id="table-template" type="text/x-handlebars-template">
<section class="ui-content-header-plain">
<h3 data-i18n="[last]{{definition_i18n}}">
<span class="ui-icon ui-icon-plane">&nbsp;</span>
{{definition_title}}
</h3>
</section>
<ul class="document-listview">
{{#each documentlist}}
<li><a data-i18n="{{i18n}}" href="{{link}}">{{title}}</a></li>
{{/each}}
</ul>
</script>
</head>
<body>
<div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="page_form"></div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, renderFormViewHeader, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, renderFormViewHeader, RSVP) {
"use strict";
var gadget_klass = rJS(window),
method_list = ['triggerSubmit', 'checkValidity', 'getContent'],
i;
function propagateMethod(method_name) {
return function callMethod() {
var argument_list = arguments;
return this.getDeclaredGadget('page_form')
.push(function (g) {
return g[method_name].apply(g, argument_list);
});
};
}
function disable() {
return;
}
for (i = 0; i < method_list.length; i += 1) {
gadget_klass.declareMethod(method_list[i], propagateMethod(method_list[i]));
}
gadget_klass
.declareMethod('render', function (options) {
var argument_list = arguments,
gadget = this;
return RSVP.all([
// Render the form_list...
gadget.getDeclaredGadget('page_form')
.push(function (g) {
return g.render.apply(g, argument_list);
}),
// But display the panel/header for the context document
gadget.jio_getAttachment(options.jio_key, 'links')
.push(function (erp5_document) {
return RSVP.all([
renderFormViewHeader(gadget, options.jio_key,
options.view,
erp5_document, true),
gadget.updatePanel({
display_workflow_list: true,
erp5_document: erp5_document,
editable: true,
jio_key: options.jio_key,
view: options.view
})
]);
})
]);
})
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod('isDesktopMedia', 'isDesktopMedia')
.declareAcquiredMethod('getUrlParameter', 'getUrlParameter')
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
// Disable the form_list header/panel
.allowPublicAcquisition("updateHeader", disable)
.allowPublicAcquisition("updatePanel", disable);
}(window, rJS, renderFormViewHeader, RSVP));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 PT Form Python Action</title>
<link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_page_template.html">
<link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_form_content_provider.html">
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_global.js" type="text/javascript"></script>
<script src="gadget_erp5_pt_form_jump.js" type="text/javascript"></script>
</head>
<body>
<form>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="erp5_form"
data-gadget-sandbox="public">
</div>
</form>
</body>
</html>
\ No newline at end of file
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, RSVP, calculatePageTitle */
(function (window, rJS, RSVP, calculatePageTitle) {
"use strict";
function checkValidity() {
return this.getDeclaredGadget("erp5_form")
.push(function (declared_gadget) {
return declared_gadget.checkValidity();
});
}
function getContent() {
return this.getDeclaredGadget("erp5_form")
.push(function (sub_gadget) {
return sub_gadget.getContent();
});
}
function submitDialog() {
var gadget = this;
return gadget.getDeclaredGadget("erp5_form")
.push(function (sub_gadget) {
return sub_gadget.getContent();
})
.push(function (data) {
return gadget.submitContent(
gadget.state.jio_key,
gadget.state.erp5_document._embedded._view._actions.put.href, // most likely points to Base_jumpToRelatedObject
data
);
})
.push(function (result) { // success redirect handler
var splitted_jio_key_list,
command,
result_dict = {};
if (!result.jio_key) {
return;
}
if (gadget.state.jio_key === result.jio_key) {
// don't update navigation history when not really redirecting
return gadget.redirect({command: 'cancel_dialog_with_history'});
}
splitted_jio_key_list = result.jio_key.split('/');
if (splitted_jio_key_list.length < 2) {
// When going to a module, stick to the current document context,
// ie, display current document panel/header, but display the module form_list
// This is implemented by the page "jump"
command = 'display_with_history';
result_dict.jio_key = gadget.state.jio_key;
result_dict.view = result.view;
result_dict.page = "jump";
} else {
command = 'push_history';
result_dict.jio_key = result.jio_key;
result_dict.view = result.view;
}
// forced document change thus we update history
return gadget.redirect({
command: command,
options: result_dict
});
});
}
var gadget_klass = rJS(window);
gadget_klass
/////////////////////////////////////////////////////////////////
// acquisition
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("submitContent", "submitContent")
.declareMethod('triggerSubmit', function () {
return;
})
.declareMethod('checkValidity', checkValidity, {mutex: 'changestate'})
.declareMethod('getContent', getContent, {mutex: 'changestate'})
.declareMethod('render', function render(options) {
return this.changeState({
jio_key: options.jio_key,
view: options.view,
erp5_document: options.erp5_document,
form_definition: options.form_definition,
erp5_form: options.erp5_form || {},
action_view: options.action_view
});
})
.declareJob('submit', function () {
return submitDialog.apply(this);
})
.onStateChange(function onStateChange() {
if (this.state.action_view) {
throw new Error('nutnut ' + this.state.action_view);
}
var form_gadget = this;
return new RSVP.Queue()
.push(function () {
// Render the erp5_from
return form_gadget.getDeclaredGadget("erp5_form");
})
.push(function (erp5_form) {
var form_options = form_gadget.state.erp5_form;
// pass own form options to the embedded form
form_options.erp5_document = form_gadget.state.erp5_document;
form_options.form_definition = form_gadget.state.form_definition;
form_options.view = form_gadget.state.view;
form_options.jio_key = form_gadget.state.jio_key;
form_options.editable = true; // dialog is always editable
return erp5_form.render(form_options);
})
.push(function () {
// Render the headers
return RSVP.all([
form_gadget.getUrlFor({command: 'cancel_dialog_with_history'}),
calculatePageTitle(form_gadget, form_gadget.state.erp5_document)
]);
})
.push(function (all_result) {
return form_gadget.updateHeader({
cancel_url: all_result[0],
page_title: all_result[1]
});
})
.push(function () {
return form_gadget.submit();
});
});
}(window, rJS, RSVP, calculatePageTitle));
/*global window, rJS, RSVP, Handlebars, URI, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars, URI, calculatePageTitle) {
"use strict";
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window),
source = gadget_klass.__template_element
.getElementById("table-template")
.innerHTML,
table_template = Handlebars.compile(source);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.ready(function (g) {
g.props = {};
})
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
});
})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this,
erp5_document,
result_list,
view_list;
return gadget.jio_getAttachment(options.jio_key, "links")
.push(function (result) {
var i,
promise_list = [
gadget.getUrlFor({command: 'cancel_dialog_with_history'})
];
erp5_document = result;
view_list = erp5_document._links.action_object_jump || [];
if (view_list.constructor !== Array) {
view_list = [view_list];
}
for (i = 0; i < view_list.length; i += 1) {
promise_list.push(gadget.getUrlFor({command: 'push_history', options: {
extended_search: new URI(view_list[i].href).query(true).query,
page: 'search'
}}));
}
return RSVP.all(promise_list);
})
.push(function (all_result) {
var i,
tab_list = [];
result_list = all_result;
for (i = 1; i < all_result.length; i += 1) {
tab_list.push({
title: view_list[i - 1].title,
link: all_result[i],
i18n: view_list[i - 1].title
});
}
return RSVP.all([
gadget.translateHtml(table_template({
definition_title: "Jumps",
documentlist: tab_list,
definition_i18n: "Jumps"
})),
calculatePageTitle(gadget, erp5_document)
]);
})
.push(function (last_result_list) {
gadget.props.element.innerHTML = last_result_list[0];
return gadget.updateHeader({
back_url: result_list[0],
page_title: last_result_list[1]
});
});
})
.declareMethod("triggerSubmit", function () {
return;
});
}(window, rJS, RSVP, Handlebars, URI, calculatePageTitle));
\ No newline at end of file
......@@ -93,7 +93,7 @@
promise_list = [];
erp5_document = result;
view_list = ensureArray(erp5_document._links.view);
jump_list = ensureArray(erp5_document._links.action_object_jump);
jump_list = ensureArray(erp5_document._links.action_object_jio_jump);
for (i = 0; i < view_list.length; i += 1) {
promise_list.push(gadget.getUrlFor({command: 'display_with_history', options: {
......@@ -104,9 +104,12 @@
}}));
}
for (i = 0; i < jump_list.length; i += 1) {
promise_list.push(gadget.getUrlFor({command: 'push_history', options: {
extended_search: new URI(jump_list[i].href).query(true).query,
page: 'search'
promise_list.push(gadget.getUrlFor({command: 'display_dialog_with_history', options: {
jio_key: gadget.state.jio_key,
view: jump_list[i].href,
page: undefined,//'jump' // Views in ERP5 must be forms but because of
// extended_search: new URI(jump_list[i].href).query(true).query,
// page: 'search'
}}));
}
promise_list.push(
......
......@@ -13,7 +13,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="check_configuration python: {'app_cache_reference': 'gadget_erp5.appcache',
'gadget_count': 64}">
'gadget_count': 65}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiInterface/macros/run_app_interface_check" />
</tal:block>
......
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPageJumpMenuAction</string> </value>
<value> <string>testFormJumpNoDocument</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Page Front</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block tal:define="jump_configuration python: {'jump_count': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiJump/macros/init" />
</tal:block>
<tr>
<td>assertTextPresent</td>
<td>Title 0</td>
<td></td>
</tr>
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'No Bar related.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPageJumpBackLink</string> </value>
<value> <string>testFormJumpOneDocument</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
......@@ -7,30 +7,23 @@
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Action Breadcrumb List</td></tr>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=jump</td>
<td></td>
</tr>
<tal:block tal:define="jump_configuration python: {'jump_count': 1}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiJump/macros/init" />
</tal:block>
<!-- Wait for gadget to be loaded -->
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Bar related to Bar : Title 0.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_jump.html']</td>
<td>assertTextPresent</td>
<td>Related 0</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<!-- Header has a menu button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/open_menu_panel" />
</tbody></table>
</body>
......
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPageJumpLinkList</string> </value>
<value> <string>testFormJumpTwoDocument</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
......@@ -7,50 +7,46 @@
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Action Back List</td></tr>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=jump</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="jump_configuration python: {'jump_count': 2}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiJump/macros/init" />
</tal:block>
<!-- Wait for gadget to be loaded -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_jump.html']</td>
<td></td>
</tr>
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Documents related to Bar : Title 0.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="pagination_configuration python: {'header': '(2)', 'footer': '2 Records'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block tal:define="parsed_query python: '';
search_query python: ''">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_search_in_form_list" />
</tal:block>
<tr>
<td>assertTextPresent</td>
<td>Title 1</td>
<td>Related 0</td>
<td></td>
</tr>
<!-- Generate back link -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!cancel_dialog_with_history')]</td>
<td>assertTextPresent</td>
<td>Related 1</td>
<td></td>
</tr>
<!-- Follow back link -->
<tal:block tal:define="click_configuration python: {'text': 'Foo: Title 1'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view.html']</td>
<td>assertTextPresent</td>
<td>Bar: Title 0</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Title 1</td>
<td>Custom Action No Dialog</td>
<td></td>
</tr>
......
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Page Front</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=jump</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_jump.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<!-- Generate links to parents -->
<tr>
<td>assertTextPresent</td>
<td>Jumps</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Queries' and contains(@href, '#!push_history') and contains(@href, 'n.page=search') and contains(@href, 'n.extended_search=portal_type')]</td>
<td></td>
</tr>
<!-- Follow one link -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='Queries' and contains(@href, '#!push_history') and contains(@href, 'n.page=search') and contains(@href, 'n.extended_search=portal_type')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_search.html']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[contains(@value, '( portal_type:&nbsp; "Query" AND default_agent_uid:&nbsp; ') and @type='hidden']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -9,25 +9,25 @@
<thead>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=tab</td>
<td>${base_url}/bar_module/BarModule_createObjects?num:int=1</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td>assertTextPresent</td>
<td>Created Successfully.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/bar_module/0?page=tab</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- Generate links to parents -->
<tr>
......@@ -38,19 +38,7 @@
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Queries' and contains(@href, '#!push_history') and contains(@href, 'n.page=search')]</td>
<td></td>
</tr>
<!-- Follow one link -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='Queries' and contains(@href, '#!push_history') and contains(@href, 'n.page=search')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_search.html']</td>
<td>//div[@data-gadget-scope='m']//a[text()='Related Bar' and contains(@href, '#!display_dialog_with_history')]</td>
<td></td>
</tr>
......
module = context.getParentValue()
for i in range(0, num):
module.newContent(title='Related %d' % i, portal_type='Bar', successor_value=context)
return 'Created Successfully.'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>num=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Bar_createRelatedObjects</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Objects</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>description</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>text</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Common Template for PTZuite, it will reuse parts of the Listbox Zuite</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_CommonTemplateForRenderjsUiJump</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>Common Template for All Trade Renderjs ui Zuite</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="init">
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/bar_module/BarModule_createObjects?num:int=1</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Created Successfully.</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b tal:content="python: 'Create %(jump_count)i related bar' % jump_configuration"></b></td>
</tr>
<tr>
<td>open</td>
<td tal:content="python: '${base_url}/bar_module/0/Bar_createRelatedObjects?num:int=%(jump_count)i' % jump_configuration"></td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Created Successfully.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/bar_module/0</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Related Bar'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
</tal:block>
</tal:block>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>object_jio_jump</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>object_jio_jump</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from ZTUtils import make_query
# from ZTUtils import make_query
portal = context.getPortalObject()
Base_translateString = portal.Base_translateString
checkPerm = portal.portal_membership.checkPermission
......@@ -29,10 +29,18 @@ if related:
module_id = portal.getDefaultModuleId(portal_type[0], None)
if module_id is not None:
module = portal.getDefaultModule(portal_type[0])
message = Base_translateString(
# first, try to get a full translated message with portal types
"Documents related to %s." % context.getPortalType(),
# if not found, fallback to generic translation
default=Base_translateString('Documents related to ${that_portal_type} : ${that_title}.',
mapping={"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
return module.Base_redirect(
'view', keep_items={'default_%s_uid' % base_category: relation.getUid(),
'ignore_hide_rows': 1,
'reset': 1})
'reset': 1,
'portal_status_message': message})
search_method = getattr(relation, 'get%sRelatedList' % getter_base_name)
else:
search_method = getattr(relation, 'get%sList' % getter_base_name)
......@@ -109,9 +117,17 @@ else:
relation_found = 0
else :
selection_uid_list = [x.getUid() for x in related_object_list]
message = Base_translateString(
# first, try to get a full translated message with portal types
"Documents related to %s." % context.getPortalType(),
# if not found, fallback to generic translation
default=Base_translateString('Documents related to ${that_portal_type} : ${that_title}.',
mapping={"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
return context.Base_redirect(relation_form_id,
keep_items=dict(reset=1,
uid=selection_uid_list))
uid=selection_uid_list,
portal_status_message=message))
query_params = dict(portal_status_message=message)
if selection_name and not relation_found:
......
......@@ -3,6 +3,8 @@ actions that does not provide one.
"""
from Products.PythonScripts.standard import url_quote
if dialog_category == 'object_jump':
return sorted(actions.get('object_jump', []) + actions.get('object_jio_jump', []), key=lambda x: x["priority"])
if dialog_category == 'object_report':
return sorted(actions.get('object_report', []) + actions.get('object_jio_report', []), key=lambda x: x["priority"])
elif dialog_category == 'object_exchange':
......
......@@ -7,7 +7,7 @@
onchange="submitAction(this.form,'Base_doJump')">
<option selected="selected" value=""
i18n:translate="" i18n:domain="ui">Jump...</option>
<tal:block tal:repeat="jump actions/object_jump | nothing">
<tal:block tal:repeat="jump python:here.Base_fixDialogActions(actions, 'object_jump') or []">
<option tal:attributes="value jump/url"
tal:content="jump/name" i18n:translate="" i18n:domain="ui" />
</tal:block>
......
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