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>
<html manifest="${application_appcache}">
<html manifest="WebSection_renderOfficeJSRedirectAppCache">
<body>
<script language="JavaScript">
function redirect_version() {
document.location.href="${latest_version}/"
document.location.replace("${latest_version}/")
};
window.applicationCache.addEventListener('cached',redirect_version);
window.applicationCache.addEventListener('noupdate',redirect_version);
window.applicationCache.addEventListener('error',redirect_version);
window.applicationCache.addEventListener('updateready', function(){window.location.reload()});
// XXX This is a hack for when the network is too slow.
window.setTimeout(redirect_version, 10000);
......
......@@ -66,9 +66,7 @@
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -109,9 +107,7 @@
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value>
<none/>
</value>
<value> <string>WebPage_getRenderJSSubstitutionMappingDict</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -232,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -246,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.21401.8615.61559</string> </value>
<value> <string>959.46591.59882.45141</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1493976571.58</float>
<float>1496147551.92</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -177,9 +177,7 @@
<key> <string>available_language</string> </key>
<value>
<tuple>
<string>fr</string>
<string>en</string>
<string>zh</string>
</tuple>
</value>
</item>
......@@ -392,7 +390,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -406,7 +404,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.30571.40365.35123</string> </value>
<value> <string>959.37733.21524.40755</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -424,7 +422,7 @@
</tuple>
<state>
<tuple>
<float>1495185352.08</float>
<float>1495615158.02</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -120,6 +120,33 @@
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</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>
<key> <string>_mt_index</string> </key>
<value>
......@@ -147,6 +174,26 @@
</tuple>
</value>
</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>
<key> <string>description</string> </key>
<value> <string>Template used to create WebSite</string> </value>
......@@ -165,6 +212,10 @@
<none/>
</value>
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewOfficeJSApplicationPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Section</string> </value>
......@@ -175,9 +226,13 @@
<none/>
</value>
</item>
<item>
<key> <string>skin_selection_name</string> </key>
<value> <string>RJS</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Template</string> </value>
<value> <string>Template Redirect</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -350,12 +405,12 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent>
<none/>
</value>
</item>
<item>
......@@ -364,7 +419,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
<value> <string>959.46472.13801.63641</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -382,7 +437,7 @@
</tuple>
<state>
<tuple>
<float>1495185385.46</float>
<float>1496149454.25</float>
<string>UTC</string>
</tuple>
</state>
......@@ -394,36 +449,4 @@
</tuple>
</pickle>
</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>
......@@ -98,7 +98,7 @@
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Section/template</string>
<string>ERP5 Web Section/template_static</string>
</tuple>
</key>
<value>
......@@ -209,7 +209,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>template</string> </value>
<value> <string>template_static</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
......@@ -441,7 +441,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.36391.8144.11332</string> </value>
<value> <string>959.46640.35795.61969</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -459,7 +459,7 @@
</tuple>
<state>
<tuple>
<float>1495618943.32</float>
<float>1496149488.71</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,7 +11,11 @@ context.log("%s" % web_site.getRelativeUrl())
try:
web_section = web_site.restrictedTraverse(version)
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(
id=version,
title=software_release.getVersion(),
......@@ -26,6 +30,7 @@ web_section.setCriterionPropertyList([
web_section.setCriterion('version', version[:10])
web_section.setMembershipCriterionBaseCategoryList(['follow_up'])
web_section.setMembershipCriterionCategoryList(['follow_up/' + context.getRelativeUrl()])
web_site.edit(configuration_latest_version=web_section.getId())
if not default_page:
# 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>
......@@ -3,4 +3,6 @@ web_site_module/officejs_appstore
web_site_module/officejs_appstore/**
web_site_module/application-list
web_site_module/application-list/template
web_site_module/application-list/template/**
\ No newline at end of file
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
......@@ -3,4 +3,6 @@ web_site_module/officejs_appstore
web_site_module/officejs_appstore/**
web_site_module/application-list
web_site_module/application-list/template
web_site_module/application-list/template/**
\ No newline at end of file
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_*
web_site_module/application-list
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/**
\ 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