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
146
Merge Requests
146
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
01565a5c
Commit
01565a5c
authored
Aug 06, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: more debug info in bootloader error display
parent
2def06cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
266 additions
and
0 deletions
+266
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_presentation_js.js
...page_module/gadget_officejs_bootloader_presentation_js.js
+90
-0
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getDocumentValue.py
..._web_redirect_assist/StaticWebSection_getDocumentValue.py
+20
-0
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getDocumentValue.xml
...web_redirect_assist/StaticWebSection_getDocumentValue.xml
+62
-0
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getRedirectSourceUrl.py
..._redirect_assist/StaticWebSection_getRedirectSourceUrl.py
+32
-0
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getRedirectSourceUrl.xml
...redirect_assist/StaticWebSection_getRedirectSourceUrl.xml
+62
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_presentation_js.js
View file @
01565a5c
...
...
@@ -3,6 +3,91 @@
(
function
(
window
,
rJS
)
{
"
use strict
"
;
function
displayErrorContent
(
gadget
,
original_error
)
{
var
error_list
=
[
original_error
],
i
,
error
,
error_text
=
""
;
// Do not break the application in case of errors.
// Display it to the user for now,
// and allow user to go back to the frontpage
// Add error handling stack
error_list
.
push
(
new
Error
(
'
stopping ERP5JS
'
));
for
(
i
=
0
;
i
<
error_list
.
length
;
i
+=
1
)
{
error
=
error_list
[
i
];
if
(
error
instanceof
Event
)
{
error
=
{
string
:
error
.
toString
(),
message
:
error
.
message
,
type
:
error
.
type
,
target
:
error
.
target
};
if
(
error
.
target
!==
undefined
)
{
error_list
.
splice
(
i
+
1
,
0
,
error
.
target
);
}
}
if
(
error
instanceof
XMLHttpRequest
)
{
error
=
{
message
:
error
.
toString
(),
readyState
:
error
.
readyState
,
status
:
error
.
status
,
statusText
:
error
.
statusText
,
response
:
error
.
response
,
responseUrl
:
error
.
responseUrl
,
response_headers
:
error
.
getAllResponseHeaders
()
};
}
if
(
error
.
constructor
===
Array
||
error
.
constructor
===
String
||
error
.
constructor
===
Object
)
{
try
{
error
=
JSON
.
stringify
(
error
);
}
catch
(
ignore
)
{
}
}
error_text
+=
error
.
message
||
error
;
error_text
+=
'
\n
'
;
if
(
error
.
fileName
!==
undefined
)
{
error_text
+=
'
File:
'
+
error
.
fileName
+
'
:
'
+
error
.
lineNumber
+
'
\n
'
;
}
if
(
error
.
stack
!==
undefined
)
{
error_text
+=
'
Stack:
'
+
error
.
stack
+
'
\n
'
;
}
error_text
+=
'
---
\n
'
;
}
console
.
error
(
original_error
);
if
(
original_error
instanceof
Error
)
{
console
.
error
(
original_error
.
stack
);
}
console
.
log
(
"
generated error_text:
"
);
console
.
log
(
error_text
);
return
error_text
;
/*if (gadget.props === undefined) {
// Gadget has not yet been correctly initialized
throw error;
}
return gadget.changeState({
error_text: error_text,
url: undefined
});*/
}
function
displayError
(
gadget
,
error
)
{
if
(
error
instanceof
RSVP
.
CancellationError
)
{
return
"
RSVP cancelation error
"
;
}
return
displayErrorContent
(
gadget
,
error
);
}
rJS
(
window
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
(
options
);
...
...
@@ -23,6 +108,10 @@
if
(
modification_dict
.
error
)
{
error_div
=
gadget
.
element
.
querySelector
(
"
.error-message
"
);
message
=
"
Last Error:
"
;
console
.
log
(
"
CALLING DISPLAY ERROR...
"
);
var
error_text
=
displayError
(
gadget
,
gadget
.
state
.
error
);
if
(
gadget
.
state
.
error
.
message
)
{
message
+=
gadget
.
state
.
error
.
message
;
}
else
{
...
...
@@ -34,6 +123,7 @@
}
else
{
message
+=
"
"
+
modification_dict
.
error
;
}
message
+=
"
- ERROR TEXT:
"
+
error_text
;
error_div
.
textContent
=
message
;
}
if
(
modification_dict
.
redirect_url
)
{
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getDocumentValue.py
0 → 100644
View file @
01565a5c
"""
================================================================================
Proxy of StaticWebSection_getDocumentValue to allow redirection
================================================================================
"""
# parameters
# ------------------------------------------------------------------------------
# name main_template
# this script will be cloned into a new one. If the request arrives here, it's because it's using the static web section for hateoas URLs
# so name should be the relative_url (e.g. portal_types/Web%20Page/jio_view)
# that relative_url should be use to call ERP5Document_getHateoas script
# with query: ?mode=traverse&relative_url=portal_types%2FWeb%20Page%2Fjio_view&view=definition_view
# catch KeyError on source_path with urls "", "?", "/?", "...&"
try
:
context
.
REQUEST
.
other
[
'source_path'
]
=
name
except
KeyError
:
return
context
return
context
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getDocumentValue.xml
0 → 100644
View file @
01565a5c
<?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>
name, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
StaticWebSection_getDocumentValue
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getRedirectSourceUrl.py
0 → 100644
View file @
01565a5c
"""
================================================================================
Redirect to domain specified as layout property on website
================================================================================
"""
# parameters
# ------------------------------------------------------------------------------
INDEX
=
"index.html"
REQUEST
=
context
.
REQUEST
query_string
=
REQUEST
[
"QUERY_STRING"
]
redirect_domain
=
context
.
getLayoutProperty
(
"redirect_domain"
)
redirect_url
=
redirect_domain
status_code
=
301
if
context
.
getLayoutProperty
(
"use_moved_temporarily"
):
status_code
=
302
try
:
source_path
=
REQUEST
.
other
[
"source_path"
]
redirect_url
=
"/"
.
join
([
redirect_url
,
source_path
])
except
(
KeyError
):
redirect_url
=
redirect_url
+
"/"
if
query_string
:
redirect_url
=
'?'
.
join
([
redirect_url
,
query_string
])
if
redirect_url
.
find
(
INDEX
)
>
-
1
and
not
redirect_url
.
endswith
(
INDEX
):
redirect_url
=
redirect_url
.
replace
(
INDEX
,
''
)
if
redirect_url
.
find
(
INDEX
)
>
-
1
and
REQUEST
[
'ACTUAL_URL'
].
find
(
INDEX
)
==
-
1
:
redirect_url
=
redirect_url
.
replace
(
INDEX
,
''
)
return
context
.
Base_redirect
(
redirect_url
,
status_code
=
status_code
)
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/StaticWebSection_getRedirectSourceUrl.xml
0 → 100644
View file @
01565a5c
<?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>
StaticWebSection_getRedirectSourceUrl
</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