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
Levin Zimmermann
erp5
Commits
1eb631ca
Commit
1eb631ca
authored
Jul 08, 2014
by
Romain Courteaud
Committed by
Cédric de Saint Martin
Oct 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP erp5_hal_json_style.
This bt5 will provide API for JIO access. (cherry picked from commit
3f897e91
)
parent
ab4b44b6
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
2885 additions
and
0 deletions
+2885
-0
bt5/erp5_hal_json_style/ExtensionTemplateItem/HalStyle.py
bt5/erp5_hal_json_style/ExtensionTemplateItem/HalStyle.py
+10
-0
bt5/erp5_hal_json_style/PathTemplateItem/web_site_module/hateoas.xml
...l_json_style/PathTemplateItem/web_site_module/hateoas.xml
+894
-0
bt5/erp5_hal_json_style/PortalTypeTemplateItem/portal_types/ERP5%20Form.xml
...style/PortalTypeTemplateItem/portal_types/ERP5%20Form.xml
+56
-0
bt5/erp5_hal_json_style/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml
...edSkinSelectionTemplateItem/registered_skin_selection.xml
+10
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style.xml
...yle/SkinTemplateItem/portal_skins/erp5_hal_json_style.xml
+47
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_edit.xml
...mplateItem/portal_skins/erp5_hal_json_style/Base_edit.xml
+350
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getRequestBody.xml
.../portal_skins/erp5_hal_json_style/Base_getRequestBody.xml
+72
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getRequestHeader.xml
...ortal_skins/erp5_hal_json_style/Base_getRequestHeader.xml
+72
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getRequestUrl.xml
...m/portal_skins/erp5_hal_json_style/Base_getRequestUrl.xml
+72
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_handleAcceptHeader.xml
...tal_skins/erp5_hal_json_style/Base_handleAcceptHeader.xml
+83
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_prepareCorsResponse.xml
...al_skins/erp5_hal_json_style/Base_prepareCorsResponse.xml
+75
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
...teItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
+105
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+725
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Site_reindexSkinList.xml
...al_skins/erp5_hal_json_style/ERP5Site_reindexSkinList.xml
+73
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Listbox_getListMethodName.xml
...l_skins/erp5_hal_json_style/Listbox_getListMethodName.xml
+28
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/form_dialog.xml
...lateItem/portal_skins/erp5_hal_json_style/form_dialog.xml
+66
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/form_list.xml
...mplateItem/portal_skins/erp5_hal_json_style/form_list.xml
+66
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/form_view.xml
...mplateItem/portal_skins/erp5_hal_json_style/form_view.xml
+66
-0
bt5/erp5_hal_json_style/bt/dependency_list
bt5/erp5_hal_json_style/bt/dependency_list
+2
-0
bt5/erp5_hal_json_style/bt/license
bt5/erp5_hal_json_style/bt/license
+1
-0
bt5/erp5_hal_json_style/bt/revision
bt5/erp5_hal_json_style/bt/revision
+1
-0
bt5/erp5_hal_json_style/bt/template_extension_id_list
bt5/erp5_hal_json_style/bt/template_extension_id_list
+1
-0
bt5/erp5_hal_json_style/bt/template_format_version
bt5/erp5_hal_json_style/bt/template_format_version
+1
-0
bt5/erp5_hal_json_style/bt/template_keep_workflow_path_list
bt5/erp5_hal_json_style/bt/template_keep_workflow_path_list
+1
-0
bt5/erp5_hal_json_style/bt/template_path_list
bt5/erp5_hal_json_style/bt/template_path_list
+2
-0
bt5/erp5_hal_json_style/bt/template_portal_type_id_list
bt5/erp5_hal_json_style/bt/template_portal_type_id_list
+1
-0
bt5/erp5_hal_json_style/bt/template_registered_skin_selection_list
...hal_json_style/bt/template_registered_skin_selection_list
+2
-0
bt5/erp5_hal_json_style/bt/template_skin_id_list
bt5/erp5_hal_json_style/bt/template_skin_id_list
+1
-0
bt5/erp5_hal_json_style/bt/title
bt5/erp5_hal_json_style/bt/title
+1
-0
bt5/erp5_hal_json_style/bt/version
bt5/erp5_hal_json_style/bt/version
+1
-0
No files found.
bt5/erp5_hal_json_style/ExtensionTemplateItem/HalStyle.py
0 → 100644
View file @
1eb631ca
def
Listbox_getListMethodName
(
self
,
field
):
""" XXXX"""
list_method
=
field
.
get_value
(
'list_method'
)
try
:
list_method_name
=
getattr
(
list_method
,
'method_name'
)
except
AttributeError
:
list_method_name
=
list_method
return
list_method_name
bt5/erp5_hal_json_style/PathTemplateItem/web_site_module/hateoas.xml
0 → 100644
View file @
1eb631ca
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Site"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Authenticated
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Member
</string>
<string>
Owner
</string>
<string>
Reviewer
</string>
</tuple>
</value>
</item>
<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>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Authenticated
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Member
</string>
<string>
Owner
</string>
<string>
Reviewer
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
__before_publishing_traverse__
</string>
</key>
<value>
<object>
<klass>
<global
name=
"MultiHook"
module=
"ZPublisher.BeforeTraverse"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_defined_in_class
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
_hookname
</string>
</key>
<value>
<string>
__before_publishing_traverse__
</string>
</value>
</item>
<item>
<key>
<string>
_list
</string>
</key>
<value>
<list>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</list>
</value>
</item>
<item>
<key>
<string>
_prior
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
__before_traverse__
</string>
</key>
<value>
<dictionary>
<item>
<key>
<tuple>
<int>
99
</int>
<string>
ERP5 Web Site/hateoas
</string>
</tuple>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
available_language
</string>
</key>
<value>
<tuple>
<string>
en
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
container_layout
</string>
</key>
<value>
<string>
ERP5Document_getHateoas
</string>
</value>
</item>
<item>
<key>
<string>
content_layout
</string>
</key>
<value>
<string>
ERP5Document_getHateoas
</string>
</value>
</item>
<item>
<key>
<string>
custom_render_method_id
</string>
</key>
<value>
<string>
ERP5Document_getHateoas
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
hateoas
</string>
</value>
</item>
<item>
<key>
<string>
layout_configuration_form_id
</string>
</key>
<value>
<string>
WebSection_viewDefaultThemeConfiguration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Site
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
skin_selection_name
</string>
</key>
<value>
<string>
Hal
</string>
</value>
</item>
<item>
<key>
<string>
static_language_selection
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Hateoas
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAU=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"WebSiteTraversalHook"
module=
"Products.ERP5.Document.WebSite"
/>
</pickle>
<pickle>
<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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<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=
"5"
aka=
"AAAAAAAAAAU="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
category_publication_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAY=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
edit_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAc=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"6"
aka=
"AAAAAAAAAAY="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<none/>
</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
id=
"6.1"
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389184989.74
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
embedded
</string>
</value>
</item>
</dictionary>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
publish
</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>
<reference
id=
"6.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389189442.06
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
published
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record
id=
"7"
aka=
"AAAAAAAAAAc="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</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>
<string></string>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
0.0.0.0
</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
id=
"7.1"
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389184989.76
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64347.10874.21742
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389185048.01
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64348.8944.3754
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389188952.06
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64413.13210.41147
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389189094.15
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64415.37368.5734
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389189246.84
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64418.7534.16605
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389189258.78
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64418.20526.19592
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389189270.11
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64418.32911.29252
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389189338.87
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
931.64421.24176.45243
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389263264.87
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
932.115.50753.2764
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389263536.53
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
<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>
932.120.18159.59989
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<reference
id=
"7.1"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1389263689.67
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/PortalTypeTemplateItem/portal_types/ERP5%20Form.xml
0 → 100644
View file @
1eb631ca
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Base Type"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
content_icon
</string>
</key>
<value>
<string>
folder_icon.gif
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
ERP5 Form
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5 Form
</string>
</value>
</item>
<item>
<key>
<string>
init_script
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
permission
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Base Type
</string>
</value>
</item>
<item>
<key>
<string>
type_class
</string>
</key>
<value>
<string>
ERP5Form
</string>
</value>
</item>
<item>
<key>
<string>
type_interface
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
type_mixin
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml
0 → 100644
View file @
1eb631ca
<registered_skin_selection>
<skin_folder_selection>
<skin_folder>
erp5_hal_json_style
</skin_folder>
<skin_selection>
Hal
</skin_selection>
</skin_folder_selection>
<skin_folder_selection>
<skin_folder>
erp5_xhtml_style
</skin_folder>
<skin_selection>
Hal
</skin_selection>
</skin_folder_selection>
</registered_skin_selection>
\ No newline at end of file
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style.xml
0 → 100644
View file @
1eb631ca
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
business_template_skin_layer_priority
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
float
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
business_template_skin_layer_priority
</string>
</key>
<value>
<float>
99.0
</float>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
erp5_hal_json_style
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_edit.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"""\n
This script validates a form to the current REQUEST,\n
processes the REQUEST to extract form data and editors,\n
then updates the current context with the form data\n
by calling edit on it or by invoking editors.\n
\n
TODO: split the generic form validation logic\n
from the context update logic\n
"""\n
from Products.Formulator.Errors import FormValidationError\n
from Products.CMFActivity.Errors import ActivityPendingError\n
\n
request=container.REQUEST\n
portal = context.getPortalObject()\n
Base_translateString = portal.Base_translateString\n
\n
# Extra security\n
if request.get(\'field_prefix\', None):\n
field_prefix = \'my_\' # Prevent changing the prefix through publisher\n
\n
# Use dialog_id if present, otherwise fall back on form_id.\n
if dialog_id not in (\'\', None):\n
form_id = dialog_id\n
\n
# Prevent users who don\'t have rights to edit the object from\n
# editing it by calling the Base_edit script with correct\n
# parameters directly.\n
if not silent_mode and not request.AUTHENTICATED_USER.has_permission(\'Modify portal content\', context) :\n
msg = Base_translateString("You do not have the permissions to edit the object.")\n
redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&%s\' % (context.absolute_url(), form_id, selection_index, selection_name, \'portal_status_message=%s\' % msg)\n
# return request[\'RESPONSE\'].redirect(redirect_url)\n
return context.Base_redirect(redirect_url)\n
\n
# Get the form\n
form = getattr(context,form_id)\n
edit_order = form.edit_order\n
\n
try:\n
# Validate\n
form.validate_all_to_request(request, key_prefix=key_prefix)\n
except FormValidationError, validation_errors:\n
# Pack errors into the request\n
field_errors = form.ErrorFields(validation_errors)\n
request.set(\'field_errors\', field_errors)\n
# Make sure editors are pushed back as values into the REQUEST object\n
for f in form.get_fields():\n
field_id = f.id\n
if request.has_key(field_id):\n
value = request.get(field_id)\n
if callable(value):\n
value(request)\n
if silent_mode: return form(request), \'form\'\n
return form(request)\n
\n
def editListBox(listbox_field, listbox):\n
""" Function called to edit a listbox\n
"""\n
if listbox is not None:\n
gv = {}\n
if listbox_field.has_value(\'global_attributes\'):\n
hidden_attributes = map(lambda x:x[0], listbox_field.get_value(\'global_attributes\'))\n
for k in hidden_attributes:\n
gv[k] = getattr(request, k, None)\n
for url, v in listbox.items():\n
v.update(gv)\n
# Form: \'\' ->
ERP5: None\n
cleaned_v = v.copy()\n
for key, value in cleaned_v.items():\n
if value == \'\':\n
cleaned_v[key] = None\n
if listbox_edit is None:\n
context.restrictedTraverse(url).edit(edit_order=edit_order, **cleaned_v)\n
else:\n
listbox_edit(url, edit_order, cleaned_v)\n
\n
def editMatrixBox(matrixbox_field, matrixbox):\n
""" Function called to edit a Matrix box\n
"""\n
if matrixbox is not None:\n
cell_base_id = matrixbox_field.get_value(\'cell_base_id\')\n
portal_type = matrixbox_field.get_value(\'cell_portal_type\')\n
getter_method = matrixbox_field.get_value(\'getter_method\')\n
if getter_method not in (None, \'\'):\n
matrix_context = getattr(context,getter_method)()\n
else:\n
matrix_context = context\n
if matrix_context is not None:\n
kd = {}\n
kd[\'portal_type\'] = portal_type\n
kd[\'base_id\'] = cell_base_id\n
gv = {}\n
if matrixbox_field.has_value(\'global_attributes\'):\n
hidden_attributes = [x[0] for x in matrixbox_field.get_value(\'global_attributes\')]\n
for k in hidden_attributes:\n
gv[k] = getattr(request, k, None)\n
if matrixbox_field.get_value(\'update_cell_range\'):\n
as_cell_range_script_id = matrixbox_field.get_value(\n
\'as_cell_range_script_id\')\n
lines = []\n
columns = []\n
tabs = []\n
extra_dimension_list_list = []\n
if as_cell_range_script_id:\n
cell_range = getattr(matrix_context,\n
as_cell_range_script_id)(matrixbox=True, base_id=cell_base_id)\n
if len(cell_range) == 1:\n
lines, = cell_range\n
elif len(cell_range) == 2:\n
lines, columns = cell_range\n
elif len(cell_range) == 3:\n
lines, columns, tabs = cell_range\n
elif len(cell_range) > 3:\n
lines = cell_range[0]\n
columns = cell_range[1]\n
tabs = cell_range[2]\n
extra_dimension_list_list = cell_range[3:]\n
else:\n
lines = matrixbox_field.get_value(\'lines\')\n
columns = matrixbox_field.get_value(\'columns\')\n
tabs = matrixbox_field.get_value(\'tabs\')\n
\n
column_ids = map(lambda x: x[0], columns)\n
line_ids = map(lambda x: x[0], lines)\n
tab_ids = map(lambda x: x[0], tabs)\n
extra_dimension_category_list_list = [[category for category, label in dimension_list] for dimension_list in extra_dimension_list_list]\n
\n
# There are 3 cases\n
# Case 1: we do 1 dimensional matrix\n
# Case 2: we do 2 dimensional matrix\n
# Case 3: we do 2 dimensional matrix + tabs\n
# Case 4: we do 2 dimensional matrix + tabs + extra\n
cell_range = matrix_context.getCellRange(base_id = cell_base_id)\n
if (len(column_ids) == 0) or (column_ids[0] is None):\n
matrixbox_cell_range = [line_ids]\n
if cell_range != matrixbox_cell_range:\n
matrix_context.setCellRange(line_ids, base_id=cell_base_id)\n
\n
elif (len(tab_ids) == 0) or (tab_ids[0] is None):\n
matrixbox_cell_range = [line_ids, column_ids]\n
if cell_range != matrixbox_cell_range:\n
matrix_context.setCellRange(line_ids, column_ids, base_id=cell_base_id)\n
\n
else:\n
matrixbox_cell_range = [line_ids, column_ids, tab_ids]\n
if extra_dimension_category_list_list:\n
matrixbox_cell_range = matrixbox_cell_range + extra_dimension_category_list_list\n
if cell_range != matrixbox_cell_range:\n
matrix_context.setCellRange(base_id=cell_base_id, *matrixbox_cell_range)\n
\n
for k,v in matrixbox.items():\n
# Only update cells which still exist\n
if matrix_context.hasInRange(*k, **kd):\n
c = matrix_context.newCell(*k, **kd)\n
if c is not None:\n
c.edit(edit_order=edit_order, **gv) # First update globals which include the def. of property_list\n
if v.has_key(\'variated_property\'):\n
# For Variated Properties\n
value = v[\'variated_property\']\n
del v[\'variated_property\']\n
if gv.has_key(\'mapped_value_property_list\'):\n
# Change the property which is defined by the\n
# first element of mapped_value_property_list\n
# XXX May require some changes with Sets\n
key = gv[\'mapped_value_property_list\'][0]\n
v[key] = value\n
# Form: \'\' -> ERP5: None\n
cleaned_v = v.copy()\n
for key, value in cleaned_v.items():\n
if value == \'\':\n
cleaned_v[key] = None\n
c.edit(edit_order=edit_order, **cleaned_v) # and update the cell specific values\n
else:\n
return "Could not create cell %s" % str(k)\n
else:\n
return "Cell %s does not exist" % str(k)\n
\n
field_prefix_len = len(field_prefix)\n
\n
def parseField(f):\n
"""\n
Parse given form field, to put them in\n
kw or in encapsulated_editor_list\n
"""\n
k = f.id\n
if f.has_value(\'alternate_name\'):\n
k = f.get_value(\'alternate_name\') or f.id\n
v = getattr(request, k, MARKER)\n
if hasattr(v, \'edit\'):\n
# This is an encapsulated editor\n
# call it\n
encapsulated_editor_list.append(v)\n
elif v is not MARKER:\n
if k.startswith(field_prefix):\n
# We only take into account\n
# the object attributes\n
k = k[field_prefix_len:]\n
# Form: \'\' -> ERP5: None\n
if v == \'\':\n
v = None\n
kw[k] = v\n
\n
# Some initilizations\n
kw = {}\n
encapsulated_editor_list = []\n
MARKER = []\n
message = Base_translateString("Data updated.")\n
\n
try:\n
# We process all the field in form and\n
# we check if they are in the request,\n
# then we edit them\n
for field in form.get_fields():\n
parseField(field)\n
\n
## XXX We need to find a way not to use meta_type.\n
field_meta_type = field.meta_type\n
if field_meta_type == \'ProxyField\':\n
field_meta_type = field.getRecursiveTemplateField().meta_type\n
\n
if(field_meta_type == \'ListBox\'):\n
editListBox(field, request.get(field.id))\n
elif(field_meta_type == \'MatrixBox\'):\n
editMatrixBox(field, request.get(field.id))\n
\n
# Return parsed values \n
if silent_mode: return (kw, encapsulated_editor_list), \'edit\'\n
\n
# Maybe we should build a list of objects we need\n
# Update basic attributes\n
context.edit(REQUEST=request, edit_order=edit_order, **kw)\n
for encapsulated_editor in encapsulated_editor_list:\n
encapsulated_editor.edit(context)\n
except ActivityPendingError,e:\n
message = Base_translateString("%s" % e)\n
\n
ignore_layout = int(ignore_layout)\n
try:\n
editable_mode = int(editable_mode)\n
except TypeError:\n
raise TypeError(str(editable_mode))\n
spp = context.getPhysicalPath()\n
spp =list(spp)\n
s_url = request["SERVER_URL"]\n
spp.insert(0,s_url)\n
#calculate direct the url instead of using absolute_url\n
new_url = \'/\'.join(spp)\n
\n
# for web mode, we should use \'view\' instead of passed form_id\n
# after \'Save
&
View\'.\n
if context.REQUEST.get(\'is_web_mode\', False) and \\\n
not editable_mode:\n
form_id = \'view\'\n
\n
if not selection_index:\n
# redirect_url = \'%s/%s?ignore_layout:int=%s
&
editable_mode:int=%s
&
portal_status_message=%s\' % (\n
# context.absolute_url(),\n
redirect_url = \'%s?ignore_layout:int=%s
&
editable_mode:int=%s
&
portal_status_message=%s\' % (\n
form_id,\n
ignore_layout,\n
editable_mode,\n
message)\n
\n
\n
else:\n
# redirect_url = \'%s/%s?selection_index=%s
&
selection_name=%s
&
ignore_layout:int=%s
&
editable_mode=%s
&
portal_status_message=%s\' % (\n
# context.absolute_url(),\n
redirect_url = \'%s?selection_index=%s
&
selection_name=%s
&
ignore_layout:int=%s
&
editable_mode=%s
&
portal_status_message=%s\' % (\n
form_id,\n
selection_index,\n
selection_name,\n
ignore_layout,\n
editable_mode,\n
message)\n
\n
\n
# result = request[\'RESPONSE\'].redirect(redirect_url) \n
\n
if silent_mode: return result, \'redirect\'\n
return context.Base_redirect(redirect_url)\n
# return result\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id, selection_index=0, selection_name=\'\', dialog_id=\'\', ignore_layout=0, editable_mode=1, silent_mode=0, field_prefix=\'my_\', key_prefix=None, listbox_edit=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getRequestBody.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
# XXX requested to simulate in unit test for now\n
return context.REQUEST.get(\'BODY\')\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getRequestBody
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getRequestHeader.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
# XXX requested to simulate in unit test for now\n
return context.REQUEST.getHeader(name, default)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
name, default=None, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getRequestHeader
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getRequestUrl.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
# XXX requested to simulate in unit test for now\n
return context.REQUEST.getURL()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getRequestUrl
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_handleAcceptHeader.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
result = None\n
accept = context.Base_getRequestHeader(\'Accept\', default=\'\')\n
for accepted_type in accepted_type_list:\n
if accepted_type in accept:\n
# XXX Really simple and stupid matching.\n
# Better test to ensure best matching type\n
result = accepted_type\n
break\n
\n
if (result is None) and (\'*/*\' in accept):\n
result = accepted_type_list[0]\n
\n
return result\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
accepted_type_list, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_handleAcceptHeader
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_prepareCorsResponse.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
RESPONSE.setHeader("Access-Control-Allow-Credentials", "true")\n
RESPONSE.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")\n
RESPONSE.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS, HEAD, DELETE, PUT, POST")\n
RESPONSE.setHeader("Access-Control-Allow-Origin", context.Base_getRequestHeader("Origin"))\n
RESPONSE.setHeader("Access-Control-Expose-Headers", "Content-Type, Content-Length, WWW-Authenticate, X-Location")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, RESPONSE=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_prepareCorsResponse
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"""\n
This script factorises code required to redirect to the appropriate\n
page from a script. It should probably be extended, reviewed and documented\n
so that less code is copied and pasted in dialog scripts.\n
\n
TODO: improve API and extensively document. ERP5Site_redirect may \n
be redundant.\n
"""\n
from ZTUtils import make_query\n
request_form = context.REQUEST.form\n
request_form.update(kw)\n
request_form = context.ERP5Site_filterParameterList(request_form)\n
request_form.update(keep_items)\n
\n
if form_id == \'view\':\n
redirect_url = "%s/ERP5Document_getHateoas" % context.absolute_url()\n
else:\n
redirect_url = \'%s/%s\' % (context.absolute_url(), form_id)\n
\n
parameters = make_query(dict([(k, v) for k, v in request_form.items() if k and v is not None]))\n
if len(parameters):\n
if \'?\' in redirect_url:\n
separator = \'&\'\n
else:\n
separator = \'?\'\n
redirect_url = \'%s%s%s\' % (redirect_url, separator, parameters)\n
\n
\n
# XXX Allow CORS\n
response = context.REQUEST.RESPONSE\n
context.Base_prepareCorsResponse(RESPONSE=response)\n
# http://en.wikipedia.org/wiki/Post/Redirect/Get\n
response.setStatus(201)\n
response.setHeader("X-Location", "urn:jio:get:%s" % context.getRelativeUrl())\n
return\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id=\'view\', keep_items={}, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_redirect
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from zExceptions import Unauthorized\n
from AccessControl import getSecurityManager\n
from ZTUtils import make_query\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
import json\n
if REQUEST is None:\n
REQUEST = context.REQUEST\n
# raise Unauthorized\n
if response is None:\n
response = REQUEST.RESPONSE\n
\n
url_template_dict = {\n
"form_action": "%(traversed_document_url)s/%(action_id)s",\n
"traverse_template": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"{&relative_url,view}",\n
"search_template": "%(root_url)s/%(script_id)s?mode=search" + \\\n
"{&query,select_list*,limit*}",\n
"new_content_action": "%(root_url)s/%(script_id)s?mode=newContent",\n
# XXX View is set by default to empty\n
"document_hal": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"&relative_url=%(relative_url)s",\n
"jio_get_template": "urn:jio:get:%(relative_url)s",\n
"jio_search_template": "urn:jio:allDocs?%(query)s",\n
}\n
\n
default_document_uri_template = url_template_dict["jio_get_template"]\n
\n
def getFormRelativeUrl(form):\n
return portal.portal_catalog(\n
portal_type="ERP5 Form",\n
uid=form.getUid(),\n
id=form.getId(),\n
limit=1,\n
select_dict={\'relative_url\': None}\n
)[0].relative_url\n
\n
def renderField(field, meta_type=None):\n
if meta_type is None:\n
meta_type = field.meta_type\n
\n
if meta_type == "ProxyField":\n
result = renderField(field, meta_type=field.getRecursiveTemplateField().meta_type)\n
elif meta_type in ("ListField", "ParallelListField", "MultiListField"):\n
result = {\n
"type": meta_type,\n
"key": field.generate_field_key(),\n
"default": field.get_value("default"),\n
"editable": field.get_value("editable"),\n
"css_class": field.get_value("css_class"),\n
"hidden": field.get_value("hidden"),\n
"description": field.get_value("description"),\n
"title": field.get_value("title"),\n
"required": field.get_value("required"),\n
# XXX Message can not be converted to json as is\n
"items": field.get_value("items"),\n
}\n
elif meta_type in ("StringField", "FloatField", "RelationStringField",\n
"MultiRelationStringField", "EmailField", "TextAreaField",\n
"LinesField", "ImageField", "FileField", "IntegerField",\n
"PasswordField"):\n
result = {\n
"type": meta_type,\n
"key": field.generate_field_key(),\n
"default": field.get_value("default"),\n
"editable": field.get_value("editable"),\n
"css_class": field.get_value("css_class"),\n
"hidden": field.get_value("hidden"),\n
"description": field.get_value("description"),\n
"title": field.get_value("title"),\n
"required": field.get_value("required"),\n
}\n
elif meta_type == "ListBox":\n
# XXX Not implemented\n
columns = field.get_value("columns")\n
\n
# XXX \n
# list_method = getattr(traversed_document, traversed_document.Listbox_getListMethodName(field))\n
# portal_types = [x[1] for x in field.get_value(\'portal_types\')]\n
portal_types = field.get_value(\'portal_types\')\n
default_params = dict(field.get_value(\'default_params\'))\n
# How to implement pagination?\n
# default_params.update(REQUEST.form)\n
lines = field.get_value(\'lines\')\n
list_method_name = traversed_document.Listbox_getListMethodName(field)\n
list_method_query_dict = dict(\n
portal_type=[x[1] for x in portal_types], **default_params\n
)\n
\n
if (list_method_name == "portal_catalog"):\n
pass\n
elif (list_method_name in ("searchFolder", "objectValues")):\n
list_method_query_dict["parent_uid"] = traversed_document.getUid()\n
# XXX How to handle script queries?\n
# else:\n
# raise NotImplementedError("Unsupported list method %s" % list_method_name)\n
\n
\n
\n
# row_list = list_method(limit=lines, portal_type=portal_types,\n
# **default_params)\n
# line_list = []\n
# for row in row_list:\n
# document = row.getObject()\n
# line = {\n
# "url": url_template_dict["document_hal"] % {\n
# "root_url": site_root.absolute_url(),\n
# "relative_url": document.getRelativeUrl(),\n
# "script_id": script.id\n
# }\n
# }\n
# for property, title in columns:\n
# prop = document.getProperty(property)\n
# if same_type(prop, DateTime()):\n
# prop = "XXX Serialize DateTime" \n
# line[title] = prop\n
# line["_relative_url"] = document.getRelativeUrl()\n
# line_list.append(line)\n
\n
result = {\n
"type": meta_type,\n
# "column_list": [x[1] for x in columns],\n
"column_list": columns,\n
# "line_list": line_list,\n
"title": field.get_value("title"),\n
"key": field.generate_field_key(),\n
"portal_type": portal_types,\n
"lines": lines,\n
"default_params": default_params,\n
"list_method": list_method_name,\n
"query": url_template_dict["jio_search_template"] % {\n
"query": make_query({"query": sql_catalog.buildQuery(\n
list_method_query_dict\n
).asSearchTextExpression(sql_catalog)})\n
}\n
}\n
else:\n
# XXX Not implemented\n
result = {\n
"type": meta_type,\n
"_debug": "Unsupported field type",\n
"title": field.get_value("title"),\n
"key": field.generate_field_key(),\n
}\n
return result\n
\n
\n
def renderForm(form, response_dict):\n
REQUEST.set(\'here\', traversed_document)\n
\n
# Form action\n
response_dict[\'_actions\'] = {\n
\'put\': {\n
"href": url_template_dict["form_action"] % {\n
"traversed_document_url": traversed_document.absolute_url(),\n
"action_id": form.action\n
},\n
"method": form.method,\n
}\n
}\n
# Form traversed_document\n
response_dict[\'_links\'][\'traversed_document\'] = {\n
"href": default_document_uri_template % {\n
"root_url": site_root.absolute_url(),\n
"relative_url": traversed_document.getRelativeUrl(),\n
"script_id": script.id\n
},\n
"name": traversed_document.getRelativeUrl(),\n
"title": traversed_document.getTitle()\n
}\n
\n
response_dict[\'_links\'][\'form_definition\'] = {\n
# "href": default_document_uri_template % {\n
# "root_url": site_root.absolute_url(),\n
# "script_id": script.id,\n
# "relative_url": getFormRelativeUrl(form)\n
# },\n
"href": default_document_uri_template % {\n
"relative_url": getFormRelativeUrl(form)\n
},\n
\'name\': form.id\n
}\n
\n
group_list = []\n
for group in form.Form_getGroupTitleAndId():\n
\n
if group[\'gid\'].find(\'hidden\') < 0:\n
# field_list = []\n
for field in form.get_fields_in_group(group[\'goid\']):\n
# field_list.append((field.id, renderRawField(field)))\n
if field.get_value("enabled"):\n
response_dict[field.id] = renderField(field)\n
\n
# for field_group in field.form.get_groups():\n
# traversed_document.log("Field group: " + field_group)\n
# traversed_document.log(field_group)\n
# for field_property in field.form.get_fields_in_group(field_group):\n
# # traversed_document.log("Field attribute: " + field_property.id)\n
# # field.get_value(field_property.id)\n
# traversed_document.log(field_property)\n
\n
# group_list.append((group[\'gid\'], field_list))\n
\n
response_dict["form_id"] = {\n
"type": "StringField",\n
"key": "form_id",\n
"default": form.id,\n
"editable": 0,\n
"css_class": "",\n
"hidden": 1,\n
"description": "",\n
"title": "form_id",\n
"required": 1,\n
}\n
\n
# response_dict["group_list"] = group_list\n
# rendered_response_dict["_embedded"] = {\n
# "form": raw_response_dict\n
# }\n
\n
\n
# XXX form action update, etc\n
def renderRawField(field):\n
meta_type = field.meta_type\n
\n
return {\n
"meta_type": field.meta_type\n
}\n
\n
\n
if meta_type == "MethodField":\n
result = {\n
"meta_type": field.meta_type\n
}\n
else:\n
result = {\n
"meta_type": field.meta_type,\n
"_values": field.values,\n
# XXX TALES expression is not JSON serializable by default\n
# "_tales": field.tales\n
"_overrides": field.overrides\n
}\n
if meta_type == "ProxyField":\n
result[\'_delegated_list\'] = field.delegated_list\n
# try:\n
# result[\'_delegated_list\'].pop(\'list_method\')\n
# except KeyError:\n
# pass\n
\n
# XXX ListMethod is not JSON serialized by default\n
try:\n
result[\'_values\'].pop(\'list_method\')\n
except KeyError:\n
pass\n
try:\n
result[\'_overrides\'].pop(\'list_method\')\n
except KeyError:\n
pass\n
return result\n
\n
\n
def renderFormDefinition(form, response_dict):\n
group_list = []\n
for group in form.Form_getGroupTitleAndId():\n
\n
if group[\'gid\'].find(\'hidden\') < 0:\n
field_list = []\n
\n
for field in form.get_fields_in_group(group[\'goid\']):\n
field_list.append((field.id, renderRawField(field)))\n
\n
group_list.append((group[\'gid\'], field_list))\n
response_dict["group_list"] = group_list\n
\n
\n
context.Base_prepareCorsResponse(RESPONSE=response)\n
\n
mime_type = \'application/hal+json\'\n
portal = context.getPortalObject()\n
sql_catalog = portal.portal_catalog.getSQLCatalog()\n
\n
# Calculate the site root to prevent unexpected browsing\n
is_web_mode = (context.REQUEST.get(\'current_web_section\', None) is not None) or context.isWebMode()\n
# is_web_mode = traversed_document.isWebMode()\n
if is_web_mode:\n
site_root = context.getWebSiteValue()\n
else:\n
site_root = portal\n
\n
# Check if traversed_document is the site_root\n
if relative_url:\n
traversed_document = site_root.restrictedTraverse(relative_url)\n
else:\n
traversed_document = context\n
is_site_root = (traversed_document.getPath() == site_root.getPath())\n
is_portal = (traversed_document.getPath() == portal.getPath())\n
\n
result_dict = {\n
\'_debug\': mode,\n
\'_links\': {\n
"self": {\n
# XXX Include query parameters\n
"href": traversed_document.Base_getRequestUrl()\n
},\n
# Always inform about site root\n
"site_root": {\n
"href": default_document_uri_template % {\n
"root_url": site_root.absolute_url(),\n
"relative_url": site_root.getRelativeUrl(),\n
"script_id": script.id\n
},\n
"name": site_root.getTitle(),\n
},\n
# Always inform about portal\n
"portal": {\n
"href": default_document_uri_template % {\n
"root_url": portal.absolute_url(),\n
# XXX the portal has an empty getRelativeUrl. Make it still compatible\n
# with restrictedTraverse\n
"relative_url": portal.getId(),\n
"script_id": script.id\n
},\n
"name": portal.getTitle(),\n
}\n
}\n
}\n
\n
\n
if mime_type != traversed_document.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n
return ""\n
\n
\n
elif (mode == \'root\') or (mode == \'traverse\'):\n
#################################################\n
# Raw document\n
#################################################\n
if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n
return ""\n
# Default properties shared by all ERP5 Document and Site\n
action_dict = {}\n
# result_dict[\'_relative_url\'] = traversed_document.getRelativeUrl()\n
\n
# Add a link to the portal type if possible\n
if not is_portal:\n
result_dict[\'_links\'][\'type\'] = {\n
"href": default_document_uri_template % {\n
"root_url": site_root.absolute_url(),\n
"relative_url": portal.portal_types[traversed_document.getPortalType()]\\\n
.getRelativeUrl(), \n
"script_id": script.id\n
},\n
"name": traversed_document.getPortalType(),\n
}\n
\n
# XXX Loop on form rendering\n
erp5_action_dict = portal.Base_filterDuplicateActions(\n
portal.portal_actions.listFilteredActionsFor(traversed_document))\n
\n
embedded_url = None\n
embedded_action_key = None\n
# XXX See ERP5Type.getDefaultViewFor\n
for erp5_action_key in erp5_action_dict.keys():\n
erp5_action_list = []\n
for view_action in erp5_action_dict[erp5_action_key]:\n
# Action condition is probably checked in Base_filterDuplicateActions\n
erp5_action_list.append({\n
\'href\': \'%s\' % view_action[\'url\'],\n
\'name\': view_action[\'id\'],\n
\'title\': view_action[\'title\']\n
})\n
# Try to embed the form in the result\n
if (view == view_action[\'id\']):\n
embedded_url = \'%s\' % view_action[\'url\']\n
embedded_action_key = "action_" + erp5_action_key\n
\n
if erp5_action_list:\n
if len(erp5_action_list) == 1:\n
erp5_action_list = erp5_action_list[0]\n
# XXX Put a prefix to prevent conflict\n
result_dict[\'_links\']["action_" + erp5_action_key] = erp5_action_list\n
\n
# for view_action in erp5_action_dict.get(\'object_view\', []):\n
# traversed_document.log(view_action)\n
# # XXX Check the action condition\n
# # if (view is None) or (view != view_action[\'name\']):\n
# object_view_list.append({\n
# \'href\': \'%s\' % view_action[\'url\'],\n
# \'name\': view_action[\'name\']\n
# })\n
\n
# # XXX Check that traversed_document is not the portal\n
# if (traversed_document.getRelativeUrl() != portal.getRelativeUrl()) and (traversed_document.getRelativeUrl() != site_root.getRelativeUrl()):\n
# parent = traversed_document.getParentValue()\n
# if (is_web_mode and (parent.getRelativeUrl() != portal.getRelativeUrl())):\n
# result_dict[\'_links\'][\'parent\'] = {\n
# \'href\': \'%s\' % parent.absolute_url(),\n
# \'name\': parent.getTitle()\n
# }\n
# \n
# if (renderer_form is not None):\n
# traversed_document_property_dict, renderer_form_json = traversed_document.Base_renderFormAsSomething(renderer_form)\n
# result_dict[\'_embedded\'] = {\n
# \'object_view\': renderer_form_json\n
# }\n
# result_dict.update(traversed_document_property_dict)\n
\n
# XXX XXX XXX XXX\n
if (embedded_url is not None):\n
# XXX Try to fetch the form in the traversed_document of the document\n
# Of course, this code will completely crash in many cases (page template\n
# instead of form, unexpected action TALES expression). Happy debugging.\n
# renderer_form_relative_url = view_action[\'url\'][len(portal.absolute_url()):]\n
form_id = embedded_url.split(\'?\', 1)[0].split("/")[-1]\n
# XXX Drop (or do something else...) all query parameters (?reset:int=1)\n
# renderer_form = traversed_document.restrictedTraverse(form_id, None)\n
# XXX Proxy field are not correctly handled in traversed_document of web site\n
renderer_form = getattr(traversed_document, form_id)\n
# traversed_document.log(form_id)\n
if (renderer_form is not None):\n
embedded_dict = {\n
\'_links\': {\n
\'self\': {\n
\'href\': embedded_url\n
}\n
}\n
}\n
renderForm(renderer_form, embedded_dict)\n
result_dict[\'_embedded\'] = {\n
\'_view\': embedded_dict\n
# embedded_action_key: embedded_dict\n
}\n
# result_dict[\'_links\']["_view"] = {"href": embedded_url}\n
\n
# Include properties in document JSON\n
# XXX Extract from renderer form?\n
for group in renderer_form.Form_getGroupTitleAndId():\n
for field in renderer_form.get_fields_in_group(group[\'goid\']):\n
field_id = field.id\n
# traversed_document.log(field_id)\n
if field_id.startswith(\'my_\'):\n
property_name = field_id[len(\'my_\'):]\n
# traversed_document.log(property_name)\n
property_value = traversed_document.getProperty(property_name, d=None)\n
if (property_value is not None):\n
if same_type(property_value, DateTime()):\n
# Serialize DateTime\n
property_value = rfc822()\n
result_dict[property_name] = property_value \n
\n
##############\n
# XXX Custom slapos code\n
##############\n
if is_site_root:\n
# Global action users for the jIO plugin\n
# XXX Would be better to not hardcode them but put them as portal type\n
# "actions" (search could be on portal_catalog document, traverse on all\n
# documents, newContent on all, etc)\n
# result_dict[\'_links\'][\'object_search\'] = {\n
# \'href\': \'%s/ERP5Site_viewSearchForm?portal_skin=Hal\' % absolute_url,\n
# \'name\': \'Global Search\'\n
# }\n
result_dict[\'_links\'][\'raw_search\'] = {\n
"href": url_template_dict["search_template"] % {\n
"root_url": site_root.absolute_url(),\n
"script_id": script.id\n
},\n
\'name\': \'Raw Search\',\n
\'templated\': True\n
}\n
result_dict[\'_links\'][\'traverse\'] = {\n
"href": url_template_dict["traverse_template"] % {\n
"root_url": site_root.absolute_url(),\n
"script_id": script.id\n
},\n
\'name\': \'Traverse\',\n
\'templated\': True\n
}\n
action_dict[\'add\'] = {\n
"href": url_template_dict["new_content_action"] % {\n
"root_url": site_root.absolute_url(),\n
"script_id": script.id\n
},\n
\'method\': \'POST\',\n
\'name\': \'New Content\',\n
}\n
\n
# Handle also other kind of users: instance, computer, master\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
if person is not None:\n
result_dict[\'_links\'][\'me\'] = {\n
"href": default_document_uri_template % {\n
"root_url": site_root.absolute_url(),\n
"relative_url": person.getRelativeUrl(), \n
"script_id": script.id\n
},\n
# \'_relative_url\': person.getRelativeUrl()\n
}\n
\n
else:\n
traversed_document_portal_type = traversed_document.getPortalType()\n
if traversed_document_portal_type == "ERP5 Form":\n
renderFormDefinition(traversed_document, result_dict)\n
\n
# Define document action\n
if action_dict:\n
result_dict[\'_actions\'] = action_dict\n
\n
\n
elif mode == \'search\':\n
#################################################\n
# Portal catalog search\n
#################################################\n
if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n
return ""\n
\n
if query == "__root__":\n
# XXX Hardcoded behaviour to get root object with jIO\n
sql_list = [site_root]\n
\n
elif query == "__portal__":\n
# XXX Hardcoded behaviour to get portal object with jIO\n
sql_list = [portal]\n
\n
# document = site_root\n
# document_result = {\n
# # \'_relative_url\': site_root.getRelativeUrl(),\n
# \'_links\': {\n
# \'self\': {\n
# "href": default_document_uri_template % {\n
# "root_url": site_root.absolute_url(),\n
# "relative_url": document.getRelativeUrl(), \n
# "script_id": script.id\n
# },\n
# },\n
# }\n
# }\n
# for select in select_list:\n
# document_result[select] = document.getProperty(select, d=None)\n
# result_dict[\'_embedded\'] = {"contents": [document_result]}\n
else:\n
# raise NotImplementedError("Unsupported query: %s" % query)\n
\n
\n
# # XXX\n
# length = len(\'/%s/\' % portal.getId())\n
# # context.log(portal.portal_catalog(full_text=query, limit=limit, src__=1))\n
# context.log(query)\n
if query:\n
sql_list = portal.portal_catalog(full_text=query, limit=limit)\n
else:\n
sql_list = portal.portal_catalog(limit=limit)\n
\n
result_list = []\n
\n
# if (select_list is None):\n
# # Only include links\n
# for sql_document in sql_list:\n
# document = sql_document.getObject()\n
# result_list.append({\n
# "href": default_document_uri_template % {\n
# "root_url": site_root.absolute_url(),\n
# "relative_url": document.getRelativeUrl(), \n
# "script_id": script.id\n
# },\n
# })\n
# result_dict[\'_links\'][\'contents\'] = result_list\n
# \n
# else:\n
\n
# Cast to list if only one element is provided\n
if same_type(select_list, ""):\n
select_list = [select_list]\n
\n
for sql_document in sql_list:\n
try:\n
document = sql_document.getObject()\n
except AttributeError:\n
# XXX ERP5 Site is not an ERP5 document\n
document = sql_document\n
document_result = {\n
# \'_relative_url\': sql_document.path[length:],\n
\'_links\': {\n
\'self\': {\n
"href": default_document_uri_template % {\n
"root_url": site_root.absolute_url(),\n
# XXX ERP5 Site is not an ERP5 document\n
"relative_url": document.getRelativeUrl() or document.getId(), \n
"script_id": script.id\n
},\n
},\n
}\n
}\n
for select in select_list:\n
property_value = document.getProperty(select, d=None)\n
if property_value is not None:\n
document_result[select] = property_value\n
result_list.append(document_result)\n
result_dict[\'_embedded\'] = {"contents": result_list}\n
\n
result_dict[\'_query\'] = query\n
result_dict[\'_limit\'] = limit\n
result_dict[\'_select_list\'] = select_list\n
\n
\n
elif mode == \'newContent\':\n
#################################################\n
# Create new document\n
#################################################\n
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
portal_type = REQUEST.form["portal_type"]\n
module = portal.getDefaultModule(portal_type=portal_type)\n
document = module.newContent(\n
portal_type=portal_type\n
)\n
# http://en.wikipedia.org/wiki/Post/Redirect/Get\n
response.setStatus(201)\n
response.setHeader("X-Location",\n
default_document_uri_template % {\n
"root_url": site_root.absolute_url(),\n
"relative_url": document.getRelativeUrl(),\n
"script_id": script.id\n
})\n
return \'\'\n
\n
elif mode == \'form\':\n
#################################################\n
# Calculate form value\n
#################################################\n
if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n
return ""\n
\n
renderForm(form, result_dict)\n
\n
\n
# elif mode == \'form_definition\':\n
# #################################################\n
# # Get raw form definitions\n
# #################################################\n
# if REQUEST.other[\'method\'] != "GET":\n
# response.setStatus(405)\n
# return ""\n
# \n
# form = getattr(portal, skin_id)\n
# renderFormDefinition(form, result_dict)\n
\n
else:\n
raise NotImplementedError, "Unsupported mode %s" % mode\n
\n
response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict, indent=2)\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=None, form=None, relative_url=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Document_getHateoas
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Site_reindexSkinList.xml
0 → 100644
View file @
1eb631ca
<?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>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
skin_tool = portal.portal_skins\n
for skin_folder in portal.portal_skins.objectValues():\n
for skin_document in skin_folder.objectValues():\n
if skin_document.meta_type == "ERP5 Form":\n
# skin_document.setUid(None)\n
skin_document.reindexObject()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
sql_catalog_id=None, additional_priority=0, final_activity_tag=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_reindexSkinList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Listbox_getListMethodName.xml
0 → 100644
View file @
1eb631ca
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Listbox_getListMethodName
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
HalStyle
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Listbox_getListMethodName
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/form_dialog.xml
0 → 100644
View file @
1eb631ca
<?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>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<tal:block tal:content="python: here.ERP5Document_getHateoas(form=form, REQUEST=request, mode=\'form\')" />
]]>
</unicode>
</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>
form_dialog
</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_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/form_list.xml
0 → 100644
View file @
1eb631ca
<?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>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<tal:block tal:content="python: here.ERP5Document_getHateoas(form=form, REQUEST=request, mode=\'form\')" />
]]>
</unicode>
</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>
form_list
</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_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/form_view.xml
0 → 100644
View file @
1eb631ca
<?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>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<tal:block tal:content="python: here.ERP5Document_getHateoas(form=form, REQUEST=request, mode=\'form\')" />
]]>
</unicode>
</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>
form_view
</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_hal_json_style/bt/dependency_list
0 → 100644
View file @
1eb631ca
erp5_xhtml_style
erp5_web
\ No newline at end of file
bt5/erp5_hal_json_style/bt/license
0 → 100644
View file @
1eb631ca
GPL
\ No newline at end of file
bt5/erp5_hal_json_style/bt/revision
0 → 100644
View file @
1eb631ca
17
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_extension_id_list
0 → 100644
View file @
1eb631ca
HalStyle
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_format_version
0 → 100644
View file @
1eb631ca
1
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_keep_workflow_path_list
0 → 100644
View file @
1eb631ca
web_site_module/hateoas
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_path_list
0 → 100644
View file @
1eb631ca
web_site_module/hateoas
web_site_module/hateoas/**
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_portal_type_id_list
0 → 100644
View file @
1eb631ca
ERP5 Form
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_registered_skin_selection_list
0 → 100644
View file @
1eb631ca
erp5_hal_json_style | Hal
erp5_xhtml_style | Hal
\ No newline at end of file
bt5/erp5_hal_json_style/bt/template_skin_id_list
0 → 100644
View file @
1eb631ca
erp5_hal_json_style
\ No newline at end of file
bt5/erp5_hal_json_style/bt/title
0 → 100644
View file @
1eb631ca
erp5_hal_json_style
\ No newline at end of file
bt5/erp5_hal_json_style/bt/version
0 → 100644
View file @
1eb631ca
0.1
\ No newline at end of file
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