Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
erp5
Commits
09d90500
Commit
09d90500
authored
Apr 23, 2021
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Form: support internal path in HyperLinkField.
parent
2de7f10d
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
687 additions
and
4 deletions
+687
-4
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+1
-0
bt5/erp5_ui_test/PathTemplateItem/portal_tests/hyper_link_field_zuite.xml
.../PathTemplateItem/portal_tests/hyper_link_field_zuite.xml
+26
-0
bt5/erp5_ui_test/PathTemplateItem/portal_tests/hyper_link_field_zuite/testRelativeHyperLinkField.xml
...sts/hyper_link_field_zuite/testRelativeHyperLinkField.xml
+58
-0
bt5/erp5_ui_test/PathTemplateItem/portal_tests/hyper_link_field_zuite/testRelativeHyperLinkField.zpt
...sts/hyper_link_field_zuite/testRelativeHyperLinkField.zpt
+55
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view.xml
...t/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view.xml
+1
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view/my_relative_hyper_link_field.xml
...ns/erp5_ui_test/Foo_view/my_relative_hyper_link_field.xml
+178
-0
bt5/erp5_ui_test/bt/template_path_list
bt5/erp5_ui_test/bt/template_path_list
+2
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_hyperlinkfield_js.js
...Item/web_page_module/rjs_gadget_erp5_hyperlinkfield_js.js
+14
-1
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_hyper_link_field_zuite.xml
...eItem/portal_tests/renderjs_ui_hyper_link_field_zuite.xml
+26
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_hyper_link_field_zuite/testRelativeHyperLinkField.xml
..._ui_hyper_link_field_zuite/testRelativeHyperLinkField.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_hyper_link_field_zuite/testRelativeHyperLinkField.zpt
..._ui_hyper_link_field_zuite/testRelativeHyperLinkField.zpt
+78
-0
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSHyperLinkField.py
...l_components/test.erp5.testFunctionalRJSHyperLinkField.py
+48
-0
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSHyperLinkField.xml
..._components/test.erp5.testFunctionalRJSHyperLinkField.xml
+127
-0
bt5/erp5_web_renderjs_ui_test/bt/template_path_list
bt5/erp5_web_renderjs_ui_test/bt/template_path_list
+2
-0
bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list
bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list
+2
-1
product/ERP5Form/HyperLinkField.py
product/ERP5Form/HyperLinkField.py
+11
-2
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
09d90500
...
@@ -558,6 +558,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -558,6 +558,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
result
.
update
({
result
.
update
({
"extra"
:
field
.
get_value
(
"extra"
),
"extra"
:
field
.
get_value
(
"extra"
),
"href"
:
field
.
get_value
(
"href"
),
"href"
:
field
.
get_value
(
"href"
),
"is_internal_path"
:
field
.
get_value
(
"is_internal_path"
),
})
})
if
meta_type
==
"ImageField"
:
if
meta_type
==
"ImageField"
:
options
=
{
options
=
{
...
...
bt5/erp5_ui_test/PathTemplateItem/portal_tests/hyper_link_field_zuite.xml
0 → 100644
View file @
09d90500
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Zuite"
module=
"Products.Zelenium.zuite"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
hyper_link_field_zuite
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/PathTemplateItem/portal_tests/hyper_link_field_zuite/testRelativeHyperLinkField.xml
0 → 100644
View file @
09d90500
<?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>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testRelativeHyperLinkField
</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></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/PathTemplateItem/portal_tests/hyper_link_field_zuite/testRelativeHyperLinkField.zpt
0 → 100644
View file @
09d90500
<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 Relative Hyperlink
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
</thead><tbody>
<tal:block
metal:use-macro=
"here/ListBoxZuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/foo_module/FooModule_createObjects?num:int=1
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Created Successfully.
</td>
<td></td>
</tr>
<tr>
<td>
open
</td>
<td>
${base_url}/foo_module/Zuite_waitForActivities
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Done.
</td>
<td></td>
</tr>
<tr>
<td>
open
</td>
<td>
${base_url}/foo_module/0
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@class='input']/a[text()='Parent']
</td>
<td></td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//div[@class='input']/a[text()='Parent']
</td>
<td></td>
</tr>
<tr>
<td>
assertLocation
</td>
<td>
${base_url}/foo_module
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view.xml
View file @
09d90500
...
@@ -109,6 +109,7 @@
...
@@ -109,6 +109,7 @@
<string>
my_fake_category_title
</string>
<string>
my_fake_category_title
</string>
<string>
my_foo_big_category_title
</string>
<string>
my_foo_big_category_title
</string>
<string>
my_local_title
</string>
<string>
my_local_title
</string>
<string>
my_relative_hyper_link_field
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view/my_relative_hyper_link_field.xml
0 → 100644
View file @
09d90500
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"HyperLinkField"
module=
"Products.ERP5Form.HyperLinkField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_relative_hyper_link_field
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
href
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
is_internal_path
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
href
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
is_internal_path
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string>
Parent
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
href
</string>
</key>
<value>
<string>
(see TALES)
</string>
</value>
</item>
<item>
<key>
<string>
is_internal_path
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Relative Hyperlink
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.getParentValue().getRelativeUrl()
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/bt/template_path_list
View file @
09d90500
...
@@ -19,6 +19,8 @@ portal_tests/form_box_zuite
...
@@ -19,6 +19,8 @@ portal_tests/form_box_zuite
portal_tests/form_box_zuite/**
portal_tests/form_box_zuite/**
portal_tests/gadget_field_zuite
portal_tests/gadget_field_zuite
portal_tests/gadget_field_zuite/**
portal_tests/gadget_field_zuite/**
portal_tests/hyper_link_field_zuite
portal_tests/hyper_link_field_zuite/**
portal_tests/integer_field_zuite
portal_tests/integer_field_zuite
portal_tests/integer_field_zuite/**
portal_tests/integer_field_zuite/**
portal_tests/lines_field_zuite
portal_tests/lines_field_zuite
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_hyperlinkfield_js.js
View file @
09d90500
...
@@ -4,8 +4,21 @@
...
@@ -4,8 +4,21 @@
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
field_json
=
options
.
field_json
||
{};
var
gadget
=
this
,
field_json
=
options
.
field_json
||
{};
if
(
field_json
.
is_internal_path
)
{
return
gadget
.
getUrlFor
({
command
:
'
push_history
'
,
options
:
{
jio_key
:
field_json
.
href
}})
.
push
(
function
(
href
)
{
return
gadget
.
changeState
({
text
:
field_json
.
value
||
field_json
.
default
||
""
,
extra
:
field_json
.
extra
||
""
,
href
:
href
});
});
}
return
this
.
changeState
({
return
this
.
changeState
({
text
:
field_json
.
value
||
field_json
.
default
||
""
,
text
:
field_json
.
value
||
field_json
.
default
||
""
,
extra
:
field_json
.
extra
||
""
,
extra
:
field_json
.
extra
||
""
,
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_hyper_link_field_zuite.xml
0 → 100644
View file @
09d90500
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Zuite"
module=
"Products.Zelenium.zuite"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
renderjs_ui_hyper_link_field_zuite
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_hyper_link_field_zuite/testRelativeHyperLinkField.xml
0 → 100644
View file @
09d90500
<?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>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testRelativeHyperLinkField
</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></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_hyper_link_field_zuite/testRelativeHyperLinkField.zpt
0 → 100644
View file @
09d90500
<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 RenderJS UI Relative Hyperlink
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test int:0 in items and as default
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<!-- Clean Up -->
<tr>
<td>
open
</td>
<td>
${base_url}/bar_module/ListBoxZuite_reset
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Reset Successfully.
</td>
<td></td>
</tr>
<tr>
<td>
open
</td>
<td>
${base_url}/foo_module/Foo_createObjects?num:int=1
&
start:int=1
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Created Successfully.
</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/foo_module/1
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded"
/>
<tr><td
colspan=
"3"
>
Click relative HyperLinkField
</td></tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, "gadget_erp5_field_hyperlink.html")]/a[text()='Parent']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//div[contains(@data-gadget-url, "gadget_erp5_field_hyperlink.html")]/a[text()='Parent']
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr><td
colspan=
"3"
>
Back to the previous page
</td></tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//h1/a[text()='Foos']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//h1/a[text()='Foos']
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, "gadget_erp5_field_hyperlink.html")]/a[text()='Parent']
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSHyperLinkField.py
0 → 100644
View file @
09d90500
##############################################################################
#
# Copyright (c) 2011 Nexedi SARL and Contributors. All Rights Reserved.
# Kazuhiko <kazuhiko@nexedi.com>
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
unittest
from
Products.ERP5Type.tests.ERP5TypeFunctionalTestCase
import
ERP5TypeFunctionalTestCase
class
TestRenderJSUIHyperLinkField
(
ERP5TypeFunctionalTestCase
):
foreground
=
0
run_only
=
"renderjs_ui_hyper_link_field_zuite"
def
getBusinessTemplateList
(
self
):
return
(
'erp5_web_renderjs_ui'
,
'erp5_web_renderjs_ui_test'
,
'erp5_ui_test_core'
,
'erp5_test_result'
,
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestRenderJSUIHyperLinkField
))
return
suite
\ No newline at end of file
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSHyperLinkField.xml
0 → 100644
View file @
09d90500
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testFunctionalRJSHyperLinkField
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testFunctionalRJSHyperLinkField
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui_test/bt/template_path_list
View file @
09d90500
...
@@ -12,6 +12,8 @@ portal_tests/renderjs_ui_float_field_zuite
...
@@ -12,6 +12,8 @@ portal_tests/renderjs_ui_float_field_zuite
portal_tests/renderjs_ui_float_field_zuite/**
portal_tests/renderjs_ui_float_field_zuite/**
portal_tests/renderjs_ui_form_box_zuite
portal_tests/renderjs_ui_form_box_zuite
portal_tests/renderjs_ui_form_box_zuite/**
portal_tests/renderjs_ui_form_box_zuite/**
portal_tests/renderjs_ui_hyper_link_field_zuite
portal_tests/renderjs_ui_hyper_link_field_zuite/**
portal_tests/renderjs_ui_interface_validator_zuite
portal_tests/renderjs_ui_interface_validator_zuite
portal_tests/renderjs_ui_interface_validator_zuite/**
portal_tests/renderjs_ui_interface_validator_zuite/**
portal_tests/renderjs_ui_label_field_zuite
portal_tests/renderjs_ui_label_field_zuite
...
...
bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list
View file @
09d90500
...
@@ -27,4 +27,5 @@ test.erp5.testFunctionalRJSDms
...
@@ -27,4 +27,5 @@ test.erp5.testFunctionalRJSDms
test.erp5.testRJSPortalType
test.erp5.testRJSPortalType
test.erp5.testRJSUpgrader
test.erp5.testRJSUpgrader
test.erp5.testFunctionalRJSServiceWorker
test.erp5.testFunctionalRJSServiceWorker
test.erp5.testFunctionalRJSParallelListField
test.erp5.testFunctionalRJSParallelListField
\ No newline at end of file
test.erp5.testFunctionalRJSHyperLinkField
\ No newline at end of file
product/ERP5Form/HyperLinkField.py
View file @
09d90500
...
@@ -6,7 +6,7 @@ from Products.Formulator.DummyField import fields
...
@@ -6,7 +6,7 @@ from Products.Formulator.DummyField import fields
from
Products.Formulator
import
Validator
from
Products.Formulator
import
Validator
class
HyperLinkWidget
(
LabelWidget
):
class
HyperLinkWidget
(
LabelWidget
):
property_names
=
LabelWidget
.
property_names
+
[
'href'
]
property_names
=
LabelWidget
.
property_names
+
[
'href'
]
+
[
'is_internal_path'
]
href
=
fields
.
LinkField
(
'href'
,
href
=
fields
.
LinkField
(
'href'
,
title
=
'Href'
,
title
=
'Href'
,
...
@@ -14,12 +14,21 @@ class HyperLinkWidget(LabelWidget):
...
@@ -14,12 +14,21 @@ class HyperLinkWidget(LabelWidget):
default
=
""
,
default
=
""
,
required
=
1
)
required
=
1
)
is_internal_path
=
fields
.
CheckBoxField
(
'is_internal_path'
,
title
=
'Internal Path ?'
,
description
=
'Check if Href value is the relative path of an ERP5 object from the portal'
,
default
=
0
,
required
=
0
)
def
render
(
self
,
field
,
key
,
value
,
REQUEST
,
render_prefix
=
None
):
def
render
(
self
,
field
,
key
,
value
,
REQUEST
,
render_prefix
=
None
):
return
self
.
render_view
(
field
,
value
,
REQUEST
,
render_prefix
)
return
self
.
render_view
(
field
,
value
,
REQUEST
,
render_prefix
)
def
render_view
(
self
,
field
,
value
,
REQUEST
=
None
,
render_prefix
=
None
):
def
render_view
(
self
,
field
,
value
,
REQUEST
=
None
,
render_prefix
=
None
):
href
=
field
.
get_value
(
'href'
)
if
field
.
get_value
(
'is_internal_path'
):
href
=
field
.
getPortalObject
().
unrestrictedTraverse
(
href
).
absolute_url
()
return
render_element
(
"a"
,
return
render_element
(
"a"
,
href
=
field
.
get_value
(
'href'
)
,
href
=
href
,
css_class
=
field
.
get_value
(
'css_class'
),
css_class
=
field
.
get_value
(
'css_class'
),
contents
=
field
.
get_value
(
'default'
),
contents
=
field
.
get_value
(
'default'
),
extra
=
field
.
get_value
(
'extra'
))
extra
=
field
.
get_value
(
'extra'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment