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
Carlos Ramos Carreño
erp5
Commits
85f5ef66
Commit
85f5ef66
authored
Nov 27, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: add compatibility with other bt5 by calling same method names
parent
443df1d5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
266 deletions
+28
-266
bt5/erp5_web_renderjs_ui/ActionTemplateItem/portal_types/Web%20Manifest/web_view.xml
...tionTemplateItem/portal_types/Web%20Manifest/web_view.xml
+1
-1
bt5/erp5_web_renderjs_ui/ActionTemplateItem/portal_types/Web%20Script/web_view.xml
...ActionTemplateItem/portal_types/Web%20Script/web_view.xml
+1
-1
bt5/erp5_web_renderjs_ui/ActionTemplateItem/portal_types/Web%20Style/web_view.xml
.../ActionTemplateItem/portal_types/Web%20Style/web_view.xml
+1
-1
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebManifest_viewAsWeb.xml
...rtal_skins/erp5_web_renderjs_ui/WebManifest_viewAsWeb.xml
+0
-84
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebPage_viewAsWeb.xml
...m/portal_skins/erp5_web_renderjs_ui/WebPage_viewAsWeb.xml
+24
-11
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_viewAsWeb.xml
...portal_skins/erp5_web_renderjs_ui/WebScript_viewAsWeb.xml
+0
-84
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml
..._web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml
+1
-1
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebStyle_viewAsWeb.xml
.../portal_skins/erp5_web_renderjs_ui/WebStyle_viewAsWeb.xml
+0
-83
No files found.
bt5/erp5_web_renderjs_ui/ActionTemplateItem/portal_types/Web%20Manifest/web_view.xml
View file @
85f5ef66
...
...
@@ -75,7 +75,7 @@
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/Web
Manifest
_viewAsWeb
</string>
</value>
<value>
<string>
string:${object_url}/Web
Page
_viewAsWeb
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_web_renderjs_ui/ActionTemplateItem/portal_types/Web%20Script/web_view.xml
View file @
85f5ef66
...
...
@@ -75,7 +75,7 @@
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/Web
Script
_viewAsWeb
</string>
</value>
<value>
<string>
string:${object_url}/Web
Page
_viewAsWeb
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_web_renderjs_ui/ActionTemplateItem/portal_types/Web%20Style/web_view.xml
View file @
85f5ef66
...
...
@@ -75,7 +75,7 @@
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/Web
Styl
e_viewAsWeb
</string>
</value>
<value>
<string>
string:${object_url}/Web
Pag
e_viewAsWeb
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebManifest_viewAsWeb.xml
deleted
100644 → 0
View file @
443df1d5
<?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 DateTime import DateTime\n
if REQUEST is None:\n
REQUEST = context.REQUEST\n
if response is None:\n
response = REQUEST.RESPONSE\n
\n
web_script = context\n
\n
modified_header = REQUEST.getHeader(\'If-Modified-Since\', \'\')\n
\n
if (modified_header != "") and (web_script.getModificationDate().rfc822() == DateTime(modified_header).rfc822()):\n
response.setStatus(304)\n
return ""\n
\n
js_content = web_script.getTextContent()\n
\n
response.setHeader(\'Content-Type\', \'text/cache-manifest\')\n
return js_content\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>
WebManifest_viewAsWeb
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebPage_viewAs
Gadget
.xml
→
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebPage_viewAs
Web
.xml
View file @
85f5ef66
...
...
@@ -55,23 +55,36 @@
if response is None:\n
response = REQUEST.RESPONSE\n
\n
web_
script
= context\n
web_
page
= context\n
\n
if REQUEST.getHeader(\'If-Modified-Since\', \'\') == web_
script
.getModificationDate().rfc822():\n
if REQUEST.getHeader(\'If-Modified-Since\', \'\') == web_
page
.getModificationDate().rfc822():\n
response.setStatus(304)\n
return ""\n
\n
js_content = web_script.getTextContent()\n
portal_type = web_page.getPortalType()\n
web_content = web_page.getTextContent()\n
\n
#
Do not allow to put inside an iframe
\n
response.setHeader("X-Frame-Options", "SAMEORIGIN")
\n
response.setHeader("X-Content-Type-Options", "nosniff"
)\n
#
set headers depending on type of script
\n
if (portal_type == "Web Script"):
\n
response.setHeader(\'Content-Type\', \'application/javascript\'
)\n
\n
# Only fetch code (html, js, css, image) and data from this ERP5, to prevent any data leak as the web site do not control the gadget\'s code
\n
response.setHeader("Content-Security-Policy", "default-src \'none\'; img-src \'self\' data:; media-src \'self\'; connect-src \'self\'; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data:"
)\n
elif (portal_type == "Web Style"):
\n
response.setHeader(\'Content-Type\', \'text/css\'
)\n
\n
response.setHeader(\'Content-Type\', \'text/html\')\n
return js_content\n
elif (portal_type == "Web Manifest"):\n
response.setHeader(\'Content-Type\', \'text/cache-manifest\')\n
\n
else:\n
# Do not allow to put inside an iframe\n
response.setHeader("X-Frame-Options", "SAMEORIGIN")\n
response.setHeader("X-Content-Type-Options", "nosniff")\n
\n
# Only fetch code (html, js, css, image) and data from this ERP5, to prevent any data leak as the web site do not control the gadget\'s code\n
response.setHeader("Content-Security-Policy", "default-src \'none\'; img-src \'self\' data:; media-src \'self\'; connect-src \'self\'; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data:")\n
\n
response.setHeader(\'Content-Type\', \'text/html\')\n
\n
return web_content\n
</string>
</value>
</item>
<item>
...
...
@@ -80,7 +93,7 @@ return js_content\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebPage_viewAs
Gadget
</string>
</value>
<value>
<string>
WebPage_viewAs
Web
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_viewAsWeb.xml
deleted
100644 → 0
View file @
443df1d5
<?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 DateTime import DateTime\n
if REQUEST is None:\n
REQUEST = context.REQUEST\n
if response is None:\n
response = REQUEST.RESPONSE\n
\n
web_script = context\n
\n
modified_header = REQUEST.getHeader(\'If-Modified-Since\', \'\')\n
\n
if (modified_header != "") and (web_script.getModificationDate().rfc822() == DateTime(modified_header).rfc822()):\n
response.setStatus(304)\n
return ""\n
\n
js_content = web_script.getTextContent()\n
\n
response.setHeader(\'Content-Type\', \'application/javascript\')\n
return js_content\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>
WebScript_viewAsWeb
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml
View file @
85f5ef66
...
...
@@ -58,7 +58,7 @@ if response is None:\n
web_section = context\n
default_web_page = web_section.getDefaultDocumentValue()\n
\n
return default_web_page.WebPage_viewAs
Gadget
()\n
return default_web_page.WebPage_viewAs
Web
()\n
</string>
</value>
</item>
<item>
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebStyle_viewAsWeb.xml
deleted
100644 → 0
View file @
443df1d5
<?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>
if REQUEST is None:\n
REQUEST = context.REQUEST\n
if response is None:\n
response = REQUEST.RESPONSE\n
\n
web_script = context\n
\n
modified_header = REQUEST.getHeader(\'If-Modified-Since\', \'\')\n
\n
if (modified_header != "") and (web_script.getModificationDate().rfc822() == DateTime(modified_header).rfc822()):\n
response.setStatus(304)\n
return ""\n
\n
js_content = web_script.getTextContent()\n
\n
response.setHeader(\'Content-Type\', \'text/css\')\n
return js_content\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>
WebStyle_viewAsWeb
</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