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
Labels
Merge Requests
144
Merge Requests
144
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e2a51a97
Commit
e2a51a97
authored
Aug 09, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: more common config elements
parent
81159a7e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
662 additions
and
0 deletions
+662
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/ERP5Form_viewAsDefinition.xml
...rtal_skins/erp5_text_editor/ERP5Form_viewAsDefinition.xml
+131
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/ERP5Form_viewAsDefinition/my_fields_raw_properties.xml
...or/ERP5Form_viewAsDefinition/my_fields_raw_properties.xml
+287
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/Form_getFieldsRawProperties.py
...tal_skins/erp5_text_editor/Form_getFieldsRawProperties.py
+82
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/Form_getFieldsRawProperties.xml
...al_skins/erp5_text_editor/Form_getFieldsRawProperties.xml
+62
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
...aticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
+38
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.xml
...ticWebSite_getRedirectSourceUrlForOfficeJSApplication.xml
+62
-0
No files found.
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/ERP5Form_viewAsDefinition.xml
0 → 100644
View file @
e2a51a97
<?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>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Base ERP5 Form view for rendering in renderjs UI
</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>
<string>
my_fields_raw_properties
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Form_viewAsDefinition
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
ERP5Form_viewAsJio
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_view
</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>
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/ERP5Form_viewAsDefinition/my_fields_raw_properties.xml
0 → 100644
View file @
e2a51a97
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/Form_getFieldsRawProperties.py
0 → 100644
View file @
e2a51a97
from
Products.ERP5Type.Log
import
log
def
getRealRelativeUrl
(
document
):
return
'/'
.
join
(
context
.
getPortalObject
().
portal_url
.
getRelativeContentPath
(
document
))
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"
:
{},
"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
(
ValueError
,
KeyError
,
IndexError
):
log
(
"error while patching form gadget list definition"
)
return
result
if
REQUEST
.
get
(
"view"
)
==
"definition_view"
:
traversed_document
=
context
traversed_document_portal_type
=
traversed_document
.
getPortalType
()
fields_raw_properties
=
{}
if
traversed_document_portal_type
in
(
"ERP5 Form"
,
"ERP5 Report"
):
custom_action_script
=
False
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"
:
custom_action_script
=
True
fields_raw_properties
[
field
.
id
]
=
getFieldRawProperties
(
field
,
key_prefix
=
None
)
continue
for
field
in
traversed_document
.
get_fields_in_group
(
group
[
"goid"
]):
if
field
.
id
==
"gadget_field_action_js_script"
:
custom_action_script
=
True
fields_raw_properties
[
field
.
id
]
=
getFieldRawProperties
(
field
,
key_prefix
=
None
)
if
custom_action_script
:
fields_raw_properties
[
'_actions'
]
=
{
'put'
:
{
"href"
:
"%(traversed_document_url)s/%(action_id)s"
%
{
"traversed_document_url"
:
context
.
getPortalObject
().
absolute_url
()
+
"/"
+
getRealRelativeUrl
(
traversed_document
),
"action_id"
:
"Base_edit"
},
"action"
:
"Base_edit"
,
"method"
:
"POST"
,
}
}
if
fields_raw_properties
:
return
fields_raw_properties
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/Form_getFieldsRawProperties.xml
0 → 100644
View file @
e2a51a97
<?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>
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
0 → 100644
View file @
e2a51a97
"""
================================================================================
Redirect to domain specified as layout property on website
================================================================================
"""
# parameters
# ------------------------------------------------------------------------------
import
binascii
import
base64
result_dict
=
{
"error"
:
"url missing definition view path"
}
base_64
=
False
try
:
name
=
context
.
REQUEST
.
other
[
'source_path'
]
except
KeyError
:
return
result_dict
try
:
encoded
=
name
.
replace
(
"definition_view/"
,
""
,
1
)
name
=
base64
.
decodestring
(
encoded
)
base_64
=
True
except
binascii
.
Error
:
pass
if
name
.
startswith
(
"definition_view/"
)
or
name
.
startswith
(
"portal_types/"
)
or
base_64
:
relative_url
=
name
.
replace
(
"%2F"
,
"/"
).
replace
(
"%20"
,
" "
)
relative_url
=
relative_url
.
replace
(
"definition_view/"
,
""
,
1
)
context
.
REQUEST
.
set
(
"view"
,
"definition_view"
)
context
.
REQUEST
.
set
(
"current_web_section"
,
None
)
try
:
result_dict
=
context
.
getPortalObject
().
ERP5Document_getHateoas
(
mode
=
"traverse"
,
relative_url
=
relative_url
,
view
=
"definition_view"
)
except
Exception
as
e
:
result_dict
=
{
"error"
:
"error while getting hateoas script for relative_url %s: %s"
%
(
relative_url
,
str
(
e
))}
return
result_dict
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_text_editor/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.xml
0 → 100644
View file @
e2a51a97
<?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>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
StaticWebSite_getRedirectSourceUrlForOfficeJSApplication
</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