Commit 1456d6a7 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Allow to configure a global wallpaper

parent cfbc621b
......@@ -10,6 +10,7 @@
<meta name="description" content="${site_description}">
<meta name="keywords" content="${site_keywords}">
<link rel="stylesheet" href="${stylesheet_url}">
${extra_css_full_link_tag}
${webapp_manifest_full_link_tag}
<script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">${application_title}</script>
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.11932.10080.12339</string> </value>
<value> <string>975.34836.41174.41949</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1540475647.75</float>
<float>1557147532.09</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -89,6 +89,7 @@
<string>my_configuration_frontpage_gadget_url</string>
<string>my_configuration_default_jio_document_page_gadget_url</string>
<string>my_configuration_stylesheet_url</string>
<string>my_configuration_wallpaper_url</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_configuration_wallpaper_url</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_reference</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Wallpaper</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -58,11 +58,37 @@ if configuration_manifest_url is None:
mapping_dict["manifest_attribute"] = ''
else:
mapping_dict["manifest_attribute"] = 'manifest="%s"' % configuration_manifest_url
configuration_webapp_manifest_url = web_section.getLayoutProperty("configuration_webapp_manifest_url", default=None)
if configuration_webapp_manifest_url is None:
mapping_dict["webapp_manifest_full_link_tag"] = ''
else:
mapping_dict["webapp_manifest_full_link_tag"] = '<link rel="manifest" href="' + configuration_webapp_manifest_url + '">'
# Wallpaper
# It can not be done in Javascript, due to CSP protection.
# data- attribute can not be accessed outside the content property
# So, it is easier to insert a data URL for this functionnality
wallpaper_url = web_section.getLayoutProperty("configuration_wallpaper_url", default=None)
if wallpaper_url is None:
mapping_dict["extra_css_full_link_tag"] = ''
else:
from base64 import urlsafe_b64encode
mapping_dict["extra_css_full_link_tag"] = '<link rel="stylesheet" href="data:text/css;base64,%s">' % urlsafe_b64encode("""
html::after {
content: "";
opacity: 0.1;
top: 0;
left: 0;
width : 100%%;
height: 100%%;
position: fixed;
z-index: -1;
background-size: cover;
background-position: 0 0;
background-attachment: fixed;
background-image: url("%s");
}
""" % wallpaper_url);
return view_as_web_method(mapping_dict=mapping_dict)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment