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
1
Issues
1
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
Roque
erp5
Commits
6d511aa1
Commit
6d511aa1
authored
Jul 12, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_connector: erp5 form with raw fields definition script
parent
fc0cef42
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
149 additions
and
6 deletions
+149
-6
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/ERP5Form_viewAsDefinition.xml
...erp5_officejs_jio_connector/ERP5Form_viewAsDefinition.xml
+2
-2
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/ERP5Form_viewAsDefinition/my_fields_raw_properties.xml
...or/ERP5Form_viewAsDefinition/my_fields_raw_properties.xml
+19
-4
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/Form_getFieldsRawProperties.py
...rp5_officejs_jio_connector/Form_getFieldsRawProperties.py
+66
-0
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/Form_getFieldsRawProperties.xml
...p5_officejs_jio_connector/Form_getFieldsRawProperties.xml
+62
-0
No files found.
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/ERP5Form_viewAs
Jio
.xml
→
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/ERP5Form_viewAs
Definition
.xml
View file @
6d511aa1
...
...
@@ -72,7 +72,7 @@
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_f
orm_definition
</string>
<string>
my_f
ields_raw_properties
</string>
</list>
</value>
</item>
...
...
@@ -87,7 +87,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Form_viewAs
Jio
</string>
</value>
<value>
<string>
ERP5Form_viewAs
Definition
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
...
...
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/ERP5Form_viewAs
Jio/my_form_definition
.xml
→
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/ERP5Form_viewAs
Definition/my_fields_raw_properties
.xml
View file @
6d511aa1
...
...
@@ -8,7 +8,7 @@
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_f
orm_definition
</string>
</value>
<value>
<string>
my_f
ields_raw_properties
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
...
...
@@ -122,7 +122,9 @@
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -217,7 +219,7 @@
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
...
...
@@ -249,7 +251,7 @@
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
F
orm definition
</string>
</value>
<value>
<string>
F
ields raw properties
</string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
...
...
@@ -269,4 +271,17 @@
</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.Form_getFieldsRawProperties(REQUEST)
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/Form_getFieldsRawProperties.py
0 → 100644
View file @
6d511aa1
def
getFieldRawProperties
(
field
,
meta_type
=
None
,
key
=
None
,
key_prefix
=
None
):
""" Return the raw properties of the field """
if
meta_type
is
None
:
meta_type
=
field
.
meta_type
if
key
is
None
:
key
=
field
.
generate_field_key
(
key_prefix
=
key_prefix
)
if
meta_type
==
"ProxyField"
:
meta_type
=
field
.
getRecursiveTemplateField
().
meta_type
result
=
{
"type"
:
meta_type
,
"key"
:
key
,
"values"
:
{},
"tales"
:
{},
"overrides"
:
field
.
overrides
,
"message_values"
:
field
.
message_values
}
# these patchs change the field property names as are required by js rendering
form_list_patch
=
False
gadget_field_patch
=
False
for
key
in
field
.
values
.
keys
():
# sometimes, field.values returns a key as string and also as a tuple
if
type
(
key
)
is
str
:
result
[
"values"
][
key
]
=
field
.
values
[
key
]
if
key
==
"columns"
:
form_list_patch
=
True
if
key
==
"gadget_url"
:
gadget_field_patch
=
True
if
form_list_patch
:
try
:
result
[
"values"
][
"column_list"
]
=
result
[
"values"
][
"columns"
]
result
[
"values"
][
"sort_column_list"
]
=
result
[
"values"
][
"sort_columns"
]
result
[
"values"
][
"search_column_list"
]
=
result
[
"values"
][
"search_columns"
]
portal_type
=
result
[
"values"
][
"portal_types"
][
0
][
0
]
if
"portal_types"
in
result
[
"values"
]
else
False
if
not
portal_type
:
portal_type
=
result
[
"values"
][
"portal_type"
][
0
][
0
]
if
"portal_type"
in
result
[
"values"
]
else
False
query
=
"portal_type%3A%22"
+
portal_type
+
"%22"
if
portal_type
else
""
full_query
=
"urn:jio:allDocs?query="
+
query
result
[
"values"
][
"query"
]
=
full_query
except
KeyError
:
log
(
"error while patching form list definition"
)
if
gadget_field_patch
:
try
:
result
[
"values"
][
"url"
]
=
result
[
"values"
][
"gadget_url"
]
result
[
"values"
][
"renderjs_extra"
]
=
result
[
"values"
][
"renderjs_extra"
][
0
][
0
]
except
KeyError
:
log
(
"error while patching form gadget list definition"
)
for
key
in
field
.
tales
.
keys
():
if
field
.
tales
[
key
]:
result
[
"tales"
][
key
]
=
str
(
field
.
tales
[
key
])
return
result
if
REQUEST
.
get
(
"view"
)
==
"definition_view"
:
traversed_document
=
context
traversed_document_portal_type
=
traversed_document
.
getPortalType
()
if
traversed_document_portal_type
in
(
"ERP5 Form"
,
"ERP5 Report"
):
fields_raw_properties
=
{}
for
group
in
traversed_document
.
Form_getGroupTitleAndId
():
if
'hidden'
in
group
[
"gid"
]:
for
field
in
traversed_document
.
get_fields_in_group
(
group
[
"goid"
]):
if
field
.
id
==
"gadget_field_action_js_script"
:
fields_raw_properties
[
field
.
id
]
=
getFieldRawProperties
(
field
,
key_prefix
=
None
)
continue
for
field
in
traversed_document
.
get_fields_in_group
(
group
[
"goid"
]):
fields_raw_properties
[
field
.
id
]
=
getFieldRawProperties
(
field
,
key_prefix
=
None
)
if
fields_raw_properties
:
return
fields_raw_properties
bt5/erp5_officejs_connector/SkinTemplateItem/portal_skins/erp5_officejs_jio_connector/Form_getFieldsRawProperties.xml
0 → 100644
View file @
6d511aa1
<?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>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Form_getFieldsRawProperties
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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