Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
erp5
Commits
bd9af427
Commit
bd9af427
authored
Feb 27, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: WIP on moving form definition to hateoas script
parent
3b15ad3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
27 deletions
+33
-27
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+30
-23
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
...e_module/gadget_officejs_controller_page_controller_js.js
+1
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
..._module/gadget_officejs_controller_page_controller_js.xml
+2
-2
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
bd9af427
...
...
@@ -66,6 +66,7 @@ from Products.ERP5Type.Utils import UpperCase
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
ComplexQuery
from
collections
import
OrderedDict
log
(
"################################################################"
)
log
(
"[DEBUG] ERP5Document_getHateoas script was called!!!!!!"
)
MARKER
=
[]
...
...
@@ -953,7 +954,12 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
# Go through all groups ("left", "bottom", "hidden" etc.) and add fields from
# them into form.
for
group
in
form
.
Form_getGroupTitleAndId
():
group_list
=
[]
try
:
form_groups
=
form
.
Form_getGroupTitleAndId
()
except
:
form_groups
=
[]
for
group
in
form_groups
:
#form.Form_getGroupTitleAndId():
# Skipping hidden group could be problematic but see MatrixBox Field above
if
'hidden'
in
group
[
'gid'
]:
continue
...
...
@@ -1091,7 +1097,11 @@ def renderFormDefinition(form, response_dict):
Dialog Form such as dialog_id.
"""
group_list
=
[]
for
group
in
form
.
Form_getGroupTitleAndId
():
try
:
form_groups
=
form
.
Form_getGroupTitleAndId
()
except
:
form_groups
=
[]
for
group
in
form_groups
:
#form.Form_getGroupTitleAndId():
if
group
[
'gid'
].
find
(
'hidden'
)
<
0
:
field_list
=
[]
...
...
@@ -1294,29 +1304,25 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if
(
view
==
view_action
[
'id'
]):
current_action
=
parseActionUrl
(
'%s'
%
view_action
[
'url'
])
# current action/view being rendered
if
current_action
.
get
(
'view_id'
,
None
)
is
not
None
:
log
(
"[DEBUG] current_action['view_id'] after iterate on Base_filterDuplicateActions"
)
log
(
"[DEBUG] "
+
str
(
current_action
[
'view_id'
]))
if
is_context_appcache
:
current_action
[
'url'
]
=
'https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/portal_skins/erp5_officejs_jio_connector/HTMLPost_viewAsJio/ERP5Form_viewAsJio'
current_action
[
'view_id'
]
=
"ERP5Form_viewAsJio"
current_action
[
'params'
]
=
{}
log
(
"[DEBUG] current_action['view_id'] after hardcoded is_context_appcache"
)
log
(
"[DEBUG] "
+
str
(
current_action
[
'view_id'
]))
log
(
"[DEBUG] current_action and view_id stuff with current_action: "
)
log
(
current_action
)
#if is_context_appcache:
# current_action['url'] = 'https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/portal_skins/erp5_officejs_jio_connector/HTMLPost_viewAsJio/ERP5Form_viewAsJio'
# current_action['view_id'] = "ERP5Form_viewAsJio"
# current_action['params'] = {}
if
view
and
(
view
!=
'view'
)
and
(
current_action
.
get
(
'view_id'
,
None
)
is
None
):
# XXX Allow to directly render a form
current_action
[
'view_id'
]
=
view
current_action
[
'url'
]
=
'%s/%s'
%
(
traversed_document
.
getRelativeUrl
(),
view
)
current_action
[
'params'
]
=
{}
log
(
"[DEBUG] current_action['view_id'] after assign view"
)
log
(
"[DEBUG] "
+
str
(
current_action
[
'view_id'
]))
if
current_action
.
get
(
'view_id'
,
None
)
is
not
None
:
log
(
"[DEBUG] FINAL current_action['view_id']"
)
log
(
"[DEBUG] "
+
str
(
current_action
[
'view_id'
]))
if
is_context_appcache
:
current_action
[
'view_id'
]
=
"ERP5Form_viewAsJio"
log
(
"[DEBUG] FINAL current_action['view_id']: "
+
str
(
current_action
[
'view_id'
]))
log
(
""
)
# If we have current action definition we are able to render embedded view
# which should be a "ERP5 Form" but in reality can be anything
...
...
@@ -1447,7 +1453,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
##############
# XXX Custom slapos code
##############
##############
a
if
is_site_root
:
result_dict
[
'default_view'
]
=
'view'
...
...
@@ -2181,11 +2187,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
}
return result_dict
log(" ")
log("[DEBUG] beggining of script -sentences after function definition-")
log(" ")
mime_type = '
application
/
hal
+
json
'
portal = context.getPortalObject()
sql_catalog = portal.portal_catalog.getSQLCatalog()
...
...
@@ -2202,6 +2203,7 @@ else:
context.Base_prepareCorsResponse(RESPONSE=response)
# Check if traversed_document is the site_root
if relative_url:
temp_traversed_document = site_root.restrictedTraverse(relative_url, None)
...
...
@@ -2217,6 +2219,11 @@ temp_is_portal = (temp_traversed_document.getPath() == portal.getPath())
response.setHeader('
Content
-
Type
', mime_type)
log(" ")
log("[DEBUG] relative_url: " + str(relative_url))
log("[DEBUG] temp_traversed_document: " + str(temp_traversed_document))
log("[DEBUG] temp_traversed_document.getPath(): " + temp_traversed_document.getPath())
log("[DEBUG] site_root.getPath(): " + site_root.getPath())
log("[DEBUG] portal.getPath(): " + portal.getPath())
log("[DEBUG] calling calculateHateoas method from beggining")
log(" ")
hateoas = calculateHateoas(is_portal=temp_is_portal, is_site_root=temp_is_site_root,
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
View file @
bd9af427
...
...
@@ -29,7 +29,6 @@
gadget
.
getSetting
(
'
hateoas_url
'
),
gadget
.
getSetting
(
'
default_view_reference
'
),
gadget
.
jio_get
(
jio_key
)
//gadget.jio_get("portal_skins/erp5_hal_json_style/roquetest")
]);
})
.
push
(
function
(
setting_list
)
{
...
...
@@ -76,7 +75,7 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
xmlHttp
=
new
XMLHttpRequest
(),
url
=
"
https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/app/portal_skins/erp5_hal_json_style/
roquetest
"
;
url
=
"
https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/app/portal_skins/erp5_hal_json_style/
ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view
"
;
xmlHttp
.
open
(
"
GET
"
,
url
,
false
);
// false for synchronous request
xmlHttp
.
send
(
null
);
return
xmlHttp
.
responseText
;
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
View file @
bd9af427
...
...
@@ -225,7 +225,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.6
0782.51516.51131
</string>
</value>
<value>
<string>
973.6
2473.36343.1126
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>
1551
184466.38
</float>
<float>
1551
285840.61
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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