Commit a9585cf6 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_officejs_appstore_base] Fix redirect websection generation

Fix web section templates.
Fix appcache for the redirect app.
parent 9a188fd1
<!DOCTYPE html> <!DOCTYPE html>
<html manifest="${application_appcache}"> <html manifest="WebSection_renderOfficeJSRedirectAppCache">
<body> <body>
<script language="JavaScript"> <script language="JavaScript">
function redirect_version() { function redirect_version() {
document.location.href="${latest_version}/" document.location.replace("${latest_version}/")
}; };
window.applicationCache.addEventListener('cached',redirect_version); window.applicationCache.addEventListener('cached',redirect_version);
window.applicationCache.addEventListener('noupdate',redirect_version); window.applicationCache.addEventListener('noupdate',redirect_version);
window.applicationCache.addEventListener('error',redirect_version);
window.applicationCache.addEventListener('updateready', function(){window.location.reload()}); window.applicationCache.addEventListener('updateready', function(){window.location.reload()});
// XXX This is a hack for when the network is too slow. // XXX This is a hack for when the network is too slow.
window.setTimeout(redirect_version, 10000); window.setTimeout(redirect_version, 10000);
......
...@@ -66,9 +66,7 @@ ...@@ -66,9 +66,7 @@
<item> <item>
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple/>
<string>contributor/person_module/1</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -109,9 +107,7 @@ ...@@ -109,9 +107,7 @@
</item> </item>
<item> <item>
<key> <string>text_content_substitution_mapping_method_id</string> </key> <key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <value> <string>WebPage_getRenderJSSubstitutionMappingDict</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -232,7 +228,7 @@ ...@@ -232,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -246,7 +242,7 @@ ...@@ -246,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.21401.8615.61559</string> </value> <value> <string>959.46591.59882.45141</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,7 +260,7 @@ ...@@ -264,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1493976571.58</float> <float>1496147551.92</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -177,9 +177,7 @@ ...@@ -177,9 +177,7 @@
<key> <string>available_language</string> </key> <key> <string>available_language</string> </key>
<value> <value>
<tuple> <tuple>
<string>fr</string>
<string>en</string> <string>en</string>
<string>zh</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -392,7 +390,7 @@ ...@@ -392,7 +390,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -406,7 +404,7 @@ ...@@ -406,7 +404,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.30571.40365.35123</string> </value> <value> <string>959.37733.21524.40755</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -424,7 +422,7 @@ ...@@ -424,7 +422,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1495185352.08</float> <float>1495615158.02</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -120,6 +120,33 @@ ...@@ -120,6 +120,33 @@
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_x_frame_options</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_content_security_policy</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item> <item>
<key> <string>_mt_index</string> </key> <key> <string>_mt_index</string> </key>
<value> <value>
...@@ -147,6 +174,26 @@ ...@@ -147,6 +174,26 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; script-src \'unsafe-inline\';</string> </value>
</item>
<item>
<key> <string>configuration_x_frame_options</string> </key>
<value> <string>SAMEORIGIN</string> </value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>WebSection_renderOfficeJSApplicationPage</string> </value>
</item>
<item>
<key> <string>content_layout</string> </key>
<value> <string>WebSection_renderOfficeJSApplicationPage</string> </value>
</item>
<item>
<key> <string>custom_render_method_id</string> </key>
<value> <string>WebSection_renderOfficeJSApplicationPage</string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Template used to create WebSite</string> </value> <value> <string>Template used to create WebSite</string> </value>
...@@ -165,6 +212,10 @@ ...@@ -165,6 +212,10 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewOfficeJSApplicationPreference</string> </value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Section</string> </value> <value> <string>Web Section</string> </value>
...@@ -175,9 +226,13 @@ ...@@ -175,9 +226,13 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>skin_selection_name</string> </key>
<value> <string>RJS</string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Template</string> </value> <value> <string>Template Redirect</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -350,12 +405,12 @@ ...@@ -350,12 +405,12 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent> <none/>
</value> </value>
</item> </item>
<item> <item>
...@@ -364,7 +419,7 @@ ...@@ -364,7 +419,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value> <value> <string>959.46472.13801.63641</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -382,7 +437,7 @@ ...@@ -382,7 +437,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1495185385.46</float> <float>1496149454.25</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -394,36 +449,4 @@ ...@@ -394,36 +449,4 @@
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
<record id="11" aka="AAAAAAAAAAs=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/web_site_module/application-list-old/template</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<key> <key>
<tuple> <tuple>
<int>99</int> <int>99</int>
<string>ERP5 Web Section/template</string> <string>ERP5 Web Section/template_static</string>
</tuple> </tuple>
</key> </key>
<value> <value>
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>template</string> </value> <value> <string>template_static</string> </value>
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
...@@ -441,7 +441,7 @@ ...@@ -441,7 +441,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.36391.8144.11332</string> </value> <value> <string>959.46640.35795.61969</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -459,7 +459,7 @@ ...@@ -459,7 +459,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1495618943.32</float> <float>1496149488.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,7 +11,11 @@ context.log("%s" % web_site.getRelativeUrl()) ...@@ -11,7 +11,11 @@ context.log("%s" % web_site.getRelativeUrl())
try: try:
web_section = web_site.restrictedTraverse(version) web_section = web_site.restrictedTraverse(version)
except KeyError: except KeyError:
web_section = web_site.template.Base_createCloneDocument(batch_mode=True) clipboard = web_site.getParentValue().manage_copyObjects(ids=['template_static'])
context.REQUEST.set('__cp', clipboard) # CopySupport is using this to set
# tracebility information in edit_workflow history
paste_result = web_site.manage_pasteObjects(cb_copy_data=clipboard)
web_section = web_site[paste_result[0]['new_id']]
web_section.edit( web_section.edit(
id=version, id=version,
title=software_release.getVersion(), title=software_release.getVersion(),
...@@ -26,6 +30,7 @@ web_section.setCriterionPropertyList([ ...@@ -26,6 +30,7 @@ web_section.setCriterionPropertyList([
web_section.setCriterion('version', version[:10]) web_section.setCriterion('version', version[:10])
web_section.setMembershipCriterionBaseCategoryList(['follow_up']) web_section.setMembershipCriterionBaseCategoryList(['follow_up'])
web_section.setMembershipCriterionCategoryList(['follow_up/' + context.getRelativeUrl()]) web_section.setMembershipCriterionCategoryList(['follow_up/' + context.getRelativeUrl()])
web_site.edit(configuration_latest_version=web_section.getId())
if not default_page: if not default_page:
# Update default page for development version. # Update default page for development version.
......
if REQUEST is None:
REQUEST = context.REQUEST
if response is None:
response = REQUEST.RESPONSE
web_section = context
if REQUEST.getHeader('If-Modified-Since', '') == web_section.getModificationDate().rfc822():
response.setStatus(304)
return ""
response.setHeader('Content-Type', 'text/cache-manifest')
response.setHeader('Cache-Control', 'max-age=0, public, must-revalidate')
return """CACHE MANIFEST
# %s""" % context.getLayoutProperty("configuration_latest_version", default="development")
<?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>_Cacheable__manager_id</string> </key>
<value>
<none/>
</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>REQUEST=None, response=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_renderOfficeJSRedirectAppCache</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -4,3 +4,5 @@ web_site_module/officejs_appstore/** ...@@ -4,3 +4,5 @@ web_site_module/officejs_appstore/**
web_site_module/application-list web_site_module/application-list
web_site_module/application-list/template web_site_module/application-list/template
web_site_module/application-list/template/** web_site_module/application-list/template/**
web_site_module/application-list/template_static
web_site_module/application-list/template_static/**
\ No newline at end of file
...@@ -4,3 +4,5 @@ web_site_module/officejs_appstore/** ...@@ -4,3 +4,5 @@ web_site_module/officejs_appstore/**
web_site_module/application-list web_site_module/application-list
web_site_module/application-list/template web_site_module/application-list/template
web_site_module/application-list/template/** web_site_module/application-list/template/**
web_site_module/application-list/template_static
web_site_module/application-list/template_static/**
\ No newline at end of file
...@@ -7,5 +7,7 @@ web_page_module/gadget_ojs_* ...@@ -7,5 +7,7 @@ web_page_module/gadget_ojs_*
web_site_module/application-list web_site_module/application-list
web_site_module/application-list/template web_site_module/application-list/template
web_site_module/application-list/template/** web_site_module/application-list/template/**
web_site_module/application-list/template_static
web_site_module/application-list/template_static/**
web_site_module/officejs_appstore web_site_module/officejs_appstore
web_site_module/officejs_appstore/** web_site_module/officejs_appstore/**
\ No newline at end of file
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