Commit a1699b92 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: reduce page reload

See merge request nexedi/erp5!1457
parents ee411a73 52b7898c
Pipeline #16415 failed with stage
in 0 seconds
......@@ -79,6 +79,7 @@
<key> <string>left</string> </key>
<value>
<list>
<string>my_configuration_relative_url_base</string>
<string>my_configuration_style_gadget_url</string>
<string>my_configuration_favicon_url</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="RadioField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_configuration_relative_url_base</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>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list>
<tuple>
<string>Acquired</string>
<string></string>
</tuple>
<tuple>
<string>Web Section</string>
<string>web_section</string>
</tuple>
<tuple>
<string>Web Site Language</string>
<string>web_site_language</string>
</tuple>
<tuple>
<string>Web Site</string>
<string>web_site</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string>vertical</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Relative URL Base</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
web_section = context
layout_property_value = web_section.getLayoutProperty(layout_property, default='')
# If nothing defined, nothing to change
if layout_property_value == '':
return layout_property_value
relative_url_prefix = web_section.WebSection_generateRelativeUrlPrefix()
if relative_url_prefix and ('/' in layout_property_value):
raise NotImplementedError('Add correct URL calculation if gadget is not a reference')
return relative_url_prefix + layout_property_value
<?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>layout_property</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_generateLayoutPropertyUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
import cgi
import re
web_site = context
web_section = context
web_site = web_section.getWebSiteValue()
def _(string_to_escape):
return cgi.escape("%s" % string_to_escape, quote=False)
......@@ -17,12 +18,20 @@ def generateSectionListHTML(result_list, section_list):
for section in section_list:
# Add missing / suffix to get correct relative url generation
# XXX Fix WebSection_getSiteMapTree instead, but no idea what would be the site effects
result_list.append('<li><a href="%s/">%s</a>' % (_(section['url']), __(section['translated_title'])))
result_list.append('<li><a href="%s">%s</a>' % (__(section['url'] + '/'), _(section['translated_title'])))
generateSectionListHTML(result_list, section['subsection'])
result_list.append('</li>')
result_list.append('</ul>')
def generateDocumentListHTML(result_list, document_list):
if (document_list):
result_list.append('<aside id="document_list"><ul>')
for section in document_list:
result_list.append('<li><a href="%s">%s</a></li>' % (__(section['url']), _(section['translated_title'])))
result_list.append('</ul></aside>')
# Language
result_list = ['<nav id="language"><ul>']
......@@ -40,13 +49,16 @@ for language in available_language_set:
website_url_set[language] = re.sub(website_url_pattern, r'%s/%s/\1' % (root_website_url, language), web_site.absolute_url())
for language, url in website_url_set.items():
result_list += '<li><a href="%s" hreflang="%s"><abbr lang="%s">%s</abbr></a></li>' % (__(url), _(language), _(language), __(language))
result_list += '<li><a href="%s" hreflang="%s"><abbr lang="%s">%s</abbr></a></li>' % (__(url), __(language), __(language), _(language))
result_list.append('</ul></nav>')
# Sitemap
result_list.append('<nav id="sitemap">')
result_list.append('<a href="%s">%s</a>' % (_(web_site.absolute_url()), __(web_site.getTranslatedTitle())))
generateSectionListHTML(result_list, web_site.WebSection_getSiteMapTree(depth=99, include_subsection=1))
result_list.append('<a href="%s">%s</a>' % (__(web_site.absolute_url()), _(web_site.getTranslatedTitle())))
generateSectionListHTML(result_list, web_site.WebSection_getSiteMapTree(include_document=False, depth=99))
result_list.append('</nav>')
# Documents
generateDocumentListHTML(result_list, web_section.WebSection_getSiteMapTree(include_subsection=False, exclude_default_document=True, depth=1))
return ''.join(result_list)
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_generateNavigationHTML</string> </value>
<value> <string>WebSection_generateNavigationHTML</string> </value>
</item>
</dictionary>
</pickle>
......
web_section = context
relative_url_base = web_section.getLayoutProperty('configuration_relative_url_base', default='web_section')
if relative_url_base == 'web_section':
return ''
web_site = web_section.getWebSiteValue()
root_web_site = web_site.getOriginalDocument()
# raise NotImplementedError('%s %s %s' % (web_section.getRelativeUrl(), web_site.getRelativeUrl(), root_web_site.getRelativeUrl()))
if relative_url_base == 'web_site_language':
web_site_relative_url = web_site.getRelativeUrl()
elif relative_url_base == 'web_site':
web_site_relative_url = root_web_site.getRelativeUrl()
else:
raise ValueError('Not supported relative url base: %s' % relative_url_base)
count = len(web_section.getRelativeUrl()[len(web_site_relative_url):].split('/'))
return '../' * (count - 1)
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_generateRelativeUrlPrefix</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,30 +10,34 @@
dialog_category python: '';
web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue();
no_style_gadget_url python: web_site.getLayoutProperty('configuration_style_gadget_url', default='');
relative_url_prefix python: web_section.WebSection_generateRelativeUrlPrefix();
no_style_gadget_url python: web_section.WebSection_generateLayoutPropertyUrl('configuration_style_gadget_url');
no_style_css_url python: relative_url_prefix + 'jsstyle.css';
favicon_url python: web_section.WebSection_generateLayoutPropertyUrl('configuration_favicon_url');
global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" />
<html>
<head>
<base tal:attributes="href python: '%s/' % web_section.absolute_url()" />
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" />
<title tal:content="python: here.getTranslatedTitle() or web_site.getTranslatedTitle()"></title>
<title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title>
<noscript>
<link rel="stylesheet" href="jsstyle.css">
<link rel="stylesheet" tal-attributes="href no_style_css_url">
</noscript>
<tal:block tal:define="favicon_url python: web_site.getLayoutProperty('configuration_favicon_url', default='')" tal:condition="favicon_url">
<tal:block tal:condition="favicon_url">
<link rel="icon" tal:attributes="href favicon_url" />
</tal:block>
<!-- Prevent conflicts with Web Page reference provided by erp5_web_renderjs_ui -->
<script src="portal_skins/erp5_xhtml_style/rsvp.js"></script>
<script src="portal_skins/erp5_xhtml_style/renderjs.js"></script>
<script src="jsstyle.js"></script>
<script tal:attributes="src python: relative_url_prefix + 'portal_skins/erp5_xhtml_style/rsvp.js'"></script>
<script tal:attributes="src python: relative_url_prefix + 'portal_skins/erp5_xhtml_style/renderjs.js'"></script>
<script tal:attributes="src python: relative_url_prefix + 'jsstyle.js'"></script>
<tal:block tal:condition="python: no_style_gadget_url != ''">
<link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block>
</head>
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url">
<tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block>
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url">
<tal:block tal:content="structure python: web_section.WebSection_generateNavigationHTML()"></tal:block>
<main>
<p tal:content="request/portal_status_message | nothing" id="portal_status_message"/>
......
body {
display: grid;
grid-template-raws: repeat(3, 1fr);
grid-gap: 1em;
grid-template-areas: "header" "content" "sidebar" "footer";
}
@media only screen and (min-width: 50em) {
body {
grid-template-areas: "header header header" "content content sidebar" "footer footer footer";
}
}
body > nav#sitemap {
grid-row: 1;
grid-area: header;
background-color: #DDD;
display: flex;
flex-wrap: wrap;
......@@ -31,7 +37,7 @@ body > nav#sitemap a:not(:first-child) {
padding: 0 1em;
}
body main {
grid-row: 2;
grid-area: content;
}
body main fieldset {
border: none;
......@@ -45,8 +51,12 @@ body main fieldset > div > label {
font-weight: bold;
min-width: 10%;
}
body > aside#document_list {
grid-area: sidebar;
background-color: #DDD;
}
body > nav#language {
grid-row: 3;
grid-area: footer;
background-color: #DDD;
display: flex;
flex-wrap: wrap;
......
......@@ -109,6 +109,24 @@
return sitemap;
}
function parseDocumentListElement(document_list_element) {
var document_list = [],
li_list,
i;
if (document_list_element === null) {
return document_list;
}
li_list = document_list_element.querySelectorAll('a');
for (i = 0; i < li_list.length; i += 1) {
document_list.push({
href: li_list[i].href,
text: li_list[i].textContent
});
}
return document_list;
}
function parseFormElement(form_element) {
if (form_element !== null) {
return form_element.outerHTML;
......@@ -127,7 +145,32 @@
return result;
}
function parsePageContent(body_element) {
function parsePageContent(body_element, base_uri) {
var i,
element,
element_list,
j,
url_attribute_list = ['src', 'href', 'srcset', 'action'],
url_attribute;
if (base_uri !== undefined) {
// Rewrite relative url (copied from renderjs)
for (j = 0; j < url_attribute_list.length; j += 1) {
url_attribute = url_attribute_list[j];
element_list = body_element.querySelectorAll(
'[' + url_attribute + ']'
);
for (i = 0; i < element_list.length; i += 1) {
element = element_list[i];
element.setAttribute(url_attribute, new URL(
element.getAttribute(url_attribute),
base_uri
).href);
}
}
}
return {
original_content: body_element.innerHTML,
html_content: body_element.querySelector('main').innerHTML,
......@@ -137,6 +180,9 @@
sitemap: parseSitemapElement(
body_element.querySelector('nav#sitemap')
),
document_list: parseDocumentListElement(
body_element.querySelector('aside#document_list')
),
form_html_content: parseFormElement(
body_element.querySelector('form#main_form')
),
......@@ -157,7 +203,19 @@
result_dict.xhr.responseText,
'text/html'
),
parsed_content = parsePageContent(dom_parser.body);
parsed_content;
if (gadget.style_gadget_url !== new URL(
dom_parser.body
.getAttribute("data-nostyle-gadget-url"),
dom_parser.baseURI
).href
) {
// If the HTML is not supposed to be rendered
// with the same js style gadget,
// consider this must be reloaded
throw new Error('Trigger an error to force reload');
}
parsed_content = parsePageContent(dom_parser.body, dom_parser.baseURI);
gadget.parsed_content = parsed_content;
parsed_content.page_title = dom_parser.title;
return result_dict.style_gadget.render(parsed_content.html_content,
......@@ -168,32 +226,6 @@
});
}
function isAnotherSitemapLocation(sitemap, url1, url2) {
var is_url1_matching = (url1.indexOf(sitemap.href) === 0),
is_child_another_location,
i;
if (is_url1_matching && (url2.indexOf(sitemap.href) !== 0)) {
return true;
}
if (!is_url1_matching) {
// Both url do not match
return false;
}
// If both match, check sub urls
for (i = 0; i < sitemap.child_list.length; i += 1) {
is_child_another_location = isAnotherSitemapLocation(
sitemap.child_list[i],
url1,
url2
);
if (is_child_another_location) {
return true;
}
}
return false;
}
function listenURLChange() {
var gadget = this;
......@@ -209,9 +241,7 @@
function handleClick(evt) {
var target_element = evt.target.closest('a'),
base_uri = document.baseURI,
link_url,
matching_language_count = 0,
matching_language_base_uri_count = 0;
link_url;
if (!target_element) {
// Only handle link
......@@ -224,34 +254,10 @@
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) {
return;
}
link_url = new URL(target_element.href, base_uri);
if (link_url.href.indexOf(base_uri) !== 0) {
// Only handle sub path of the base url
// Meaning it will also reload when going from a non default language
// to the default one
return;
}
// Check if going from the default language to another one
// Check if url is suburl from 2 languages (default + the expected one)
gadget.parsed_content.language_list.map(function (language) {
if (link_url.href.indexOf(language.href) === 0) {
matching_language_count += 1;
}
// Ensure current url is in the default language
if (base_uri.indexOf(language.href) === 0) {
matching_language_base_uri_count += 1;
}
});
if ((1 < matching_language_count) &&
(matching_language_base_uri_count === 1)) {
return;
}
// Check if going from a section to a child one
if (isAnotherSitemapLocation(gadget.parsed_content.sitemap,
link_url.href, base_uri)) {
if (base_uri.indexOf(link_url.origin) !== 0) {
// No need to query from another domain
return;
}
......@@ -271,7 +277,8 @@
// to ensure popstate listener is correctly working
// when the user will click on back/forward browser buttons
history.pushState(null, null, target_element.href);
}, function () {
}, function (error) {
console.warn('Cant render the page', error);
// Implement support for managed error
// (like URL is not an HTML document parsable)
// and redirect in such case
......@@ -297,16 +304,19 @@
style_gadget,
body = gadget.element,
style_gadget_url = body.getAttribute("data-nostyle-gadget-url"),
style_css_url = body.getAttribute("data-nostyle-css-url"),
parsed_content;
if (!style_gadget_url) {
// No style configured, use backend only rendering
return rJS.declareCSS("jsstyle.css", document.head);
return rJS.declareCSS(style_css_url, document.head);
}
parsed_content = parsePageContent(gadget.element);
gadget.parsed_content = parsed_content;
parsed_content.page_title = document.title;
gadget.style_gadget_url =
new URL(style_gadget_url, document.baseURI).href;
// Clear the DOM
while (body.firstChild) {
body.firstChild.remove();
......@@ -329,7 +339,7 @@
});
}, function (error) {
console.warn('Cant load the style gadget', error);
return new RSVP.Queue(rJS.declareCSS("jsstyle.css", document.head))
return new RSVP.Queue(rJS.declareCSS(style_css_url, document.head))
.push(function () {
// Set again the page content after the css is loaded
// to prevent ugly rendering
......
......@@ -30,16 +30,28 @@
body {
display: grid;
grid-template-raws: repeat(3, 1fr);
grid-gap: 1em;
grid-template-areas:
"header"
"content"
"sidebar"
"footer";
@media only screen and (min-width: 50em) {
grid-template-areas:
"header header header"
"content content sidebar"
"footer footer footer";
}
> nav#sitemap {
grid-row: 1;
grid-area: header;
.flattenNav();
}
main {
grid-row: 2;
grid-area: content;
fieldset {
border: none;
......@@ -55,8 +67,13 @@ body {
}
}
> aside#document_list {
grid-area: sidebar;
background-color: #DDD;
}
> nav#language {
grid-row: 3;
grid-area: footer;
.flattenNav();
}
......
......@@ -9,30 +9,34 @@
dummy python: request.set('editable_mode', False);
web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue();
no_style_gadget_url python: web_site.getLayoutProperty('configuration_style_gadget_url', default='');
relative_url_prefix python: web_section.WebSection_generateRelativeUrlPrefix();
no_style_gadget_url python: web_section.WebSection_generateLayoutPropertyUrl('configuration_style_gadget_url');
no_style_css_url python: relative_url_prefix + 'jsstyle.css';
favicon_url python: web_section.WebSection_generateLayoutPropertyUrl('configuration_favicon_url');
global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" />
<html>
<head>
<base tal:attributes="href python: '%s/' % web_section.absolute_url()" />
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" />
<title tal:content="python: here.getTranslatedTitle() or web_site.getTranslatedTitle()"></title>
<title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title>
<noscript>
<link rel="stylesheet" href="jsstyle.css">
<link rel="stylesheet" tal-attributes="href no_style_css_url">
</noscript>
<tal:block tal:define="favicon_url python: web_site.getLayoutProperty('configuration_favicon_url', default='')" tal:condition="favicon_url">
<tal:block tal:condition="favicon_url">
<link rel="icon" tal:attributes="href favicon_url" />
</tal:block>
<!-- Prevent conflicts with Web Page reference provided by erp5_web_renderjs_ui -->
<script src="portal_skins/erp5_xhtml_style/rsvp.js"></script>
<script src="portal_skins/erp5_xhtml_style/renderjs.js"></script>
<script src="jsstyle.js"></script>
<script tal:attributes="src python: relative_url_prefix + 'portal_skins/erp5_xhtml_style/rsvp.js'"></script>
<script tal:attributes="src python: relative_url_prefix + 'portal_skins/erp5_xhtml_style/renderjs.js'"></script>
<script tal:attributes="src python: relative_url_prefix + 'jsstyle.js'"></script>
<tal:block tal:condition="python: no_style_gadget_url != ''">
<link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block>
</head>
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url">
<tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block>
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url">
<tal:block tal:content="structure python: web_section.WebSection_generateNavigationHTML()"></tal:block>
<p tal:content="request/portal_status_message | nothing" id="portal_status_message"/>
<main><tal:block metal:define-slot="main"/></main>
......
......@@ -67,6 +67,12 @@
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//a[text()='erp5_web_js_style_test_contentpage']</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//div[@class='input']/span[@class='headline' and text()='Demo Style']</td>
......
......@@ -61,6 +61,12 @@
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//a[text()='erp5_web_js_style_test_contentpage']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@class='input']/span[@class='headline' and text()='No Style']</td>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleRelativeLinkHandling</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=language_with_web_site_base</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check that the content link are not modified during first loading</b></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='base link' and @href='.']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='erp5_web_js_style_test_contentpage' and @href='erp5_web_js_style_test_contentpage']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Go to a child path</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 11']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '2')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '2')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check that the content link are calculated from Demo Section 11</b></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='base link' and @href='${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/erp5_web_js_style_test_section_11/']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='erp5_web_js_style_test_contentpage' and @href='${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/erp5_web_js_style_test_section_11/erp5_web_js_style_test_contentpage']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Go to a parent path</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Style With Language']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '3')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '3')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check that the content link are calculated from Web Site</b></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='base link' and @href='${base_url}/web_site_module/erp5_web_js_style_test_site/']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='erp5_web_js_style_test_contentpage' and @href='${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_contentpage']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Go to the original path</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 1']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '4')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '4')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check that the content link are calculated from Demo Section 1</b></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='base link' and @href='${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//a[text()='erp5_web_js_style_test_contentpage' and @href='${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/erp5_web_js_style_test_contentpage']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSectionForm</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=form</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_form/</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//head/link[@rel='prerender' and @href='jsstyle_demo.html']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web site</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//form</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//form</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/erp5_web_js_style_test_section_form/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>field_your_id</td>
<td>erp5_web_js_style_test_section_form</td>
</tr>
<tr>
<td>assertValue</td>
<td>field_your_title</td>
<td>Demo Section Form</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//button[@id='dialog_submit_button']//span[text()='Do It']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='portal_status_message' and contains(text(), '')]</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//head/link[@rel='icon']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the form validation</b></td>
</tr>
<tr>
<td>type</td>
<td>field_your_id</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//form</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//form</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/erp5_web_js_style_test_section_form/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>field_your_id</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>field_your_title</td>
<td>Demo Section Form</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='portal_status_message' and contains(text(), 'Input data has errors. Please look at the error messages below.')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//span[@class='error' and contains(text(), 'Input is required but no input given.')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the form submission</b></td>
</tr>
<tr>
<td>type</td>
<td>field_your_id</td>
<td>a</td>
</tr>
<tr>
<td>type</td>
<td>field_your_title</td>
<td>b</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//form</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//form</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/erp5_web_js_style_test_section_form/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>field_your_id</td>
<td>erp5_web_js_style_test_section_form</td>
</tr>
<tr>
<td>assertValue</td>
<td>field_your_title</td>
<td>Demo Section Form</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='portal_status_message' and contains(text(), 'Submitted a b')]</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//span[@class='error' and contains(text(), 'Input is required but no input given.')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSectionWithLanguageBaseUrl</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=language_with_web_site_language_base</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check from a different language</b></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/fr/erp5_web_js_style_test_section_1/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (fr)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/fr/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSectionWithWebSiteBaseUrl</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=language_with_web_site_base</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_section_1/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check from a different language</b></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/fr/erp5_web_js_style_test_section_1/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (fr)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSiteBrowseSitemapWithLanguageBaseUrl</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=language_with_web_site_language_base</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web site</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to one subsection</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 1']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web section 1</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '2')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '2')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to second level subsection</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 11']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web section 11</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '3')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '3')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to parent subsection</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 1']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web section 1</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '4')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '4')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to one sibling</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 2']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web section 2</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '5')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '5')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to one web site</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='sitemap']//a[text()='Demo Style With Language']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web site</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '6')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '6')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSiteChangeLanguageWithLanguageBaseUrl</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=language_with_web_site_language_base</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to the not default language</b></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//nav[@id='language']//a[text()='fr']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the second language (fr)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/fr/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to the second not default language</b></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//nav[@id='language']//a[text()='zh']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the third language (zh)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()="主页内容"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()="主页内容"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/zh/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to the default language</b></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//nav[@id='language']//a[text()='en']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSiteChangeLanguageWithWebSiteBaseUrl</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=language_with_web_site_base</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to the not default language</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='language']//a[text()='fr']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the second language (fr)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()="Contenu de la page d'accueil"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '2')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to the second not default language</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='language']//a[text()='zh']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the third language (zh)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()="主页内容"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()="主页内容"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '3')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Change to the default language</b></td>
</tr>
<tr>
<td>click</td>
<td>//nav[@id='language']//a[text()='en']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the default language (en)</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main//p[text()='Frontpage content']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '4')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsStyleWebSiteEmptySitemap</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test JS Style Demo Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test JS Style Demo Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=empty_sitemap</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Web Site created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check the page content uses the web site</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//main[text()='Empty Sitemap']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//p[@id='render_count'][contains(text(), '1')]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check that sitemap is empty</b></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//nav[@id='sitemap']//a[text()='Empty Sitemap']</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 1']</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//nav[@id='sitemap']//a[text()='Demo Section 11']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -119,28 +119,34 @@ portal.portal_workflow.doActionFor(web_page, 'publish_action')
configuration_dict = {
'nostyle': {
'title': 'No Style'
'title': 'No Style',
'site_map_section_parent': True
},
'nostyleform': {
'title': "No Style Form",
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog'
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog',
'site_map_section_parent': True
},
'section': {
'configuration_style_gadget_url': "jsstyle_demo.html",
'title': "Demo Style",
'site_map_section_parent': True
},
'not_loading': {
'configuration_style_gadget_url': "jsstyle_demo_not_loading.html",
'title': "Not Loading Style",
'site_map_section_parent': True
},
'favicon': {
'title': 'Favicon',
'configuration_favicon_url': "favicon.ico"
'configuration_favicon_url': "favicon.ico",
'site_map_section_parent': True
},
'faviconform':{
'title': 'Favicon Form',
'configuration_favicon_url': "favicon.ico",
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog'
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog',
'site_map_section_parent': True
},
'language': {
'configuration_style_gadget_url': "jsstyle_demo.html",
......@@ -149,12 +155,38 @@ configuration_dict = {
'language': "en",
'aggregate_value': module.restrictedTraverse(web_page_frontend_en_id),
'title': "Demo Style With Language",
'site_map_section_parent': True
},
'language_with_web_site_language_base': {
'configuration_relative_url_base': 'web_site_language',
'configuration_style_gadget_url': "jsstyle_demo.html",
'available_language_list': ['en', 'fr', 'zh'],
'static_language_selection': True,
'language': "en",
'aggregate_value': module.restrictedTraverse(web_page_frontend_en_id),
'title': "Demo Style With Language",
'site_map_section_parent': True
},
'language_with_web_site_base': {
'configuration_relative_url_base': 'web_site',
'configuration_style_gadget_url': "jsstyle_demo.html",
'available_language_list': ['en', 'fr', 'zh'],
'static_language_selection': True,
'language': "en",
'aggregate_value': module.restrictedTraverse(web_page_frontend_en_id),
'title': "Demo Style With Language",
'site_map_section_parent': True
},
'form': {
'configuration_style_gadget_url': "jsstyle_demo.html",
'title': "Demo Form",
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog'
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog',
'site_map_section_parent': True
},
'empty_sitemap': {
'title': 'Empty Sitemap',
'configuration_style_gadget_url': "jsstyle_demo.html"
}
}
### Web site
......@@ -166,14 +198,19 @@ web_site = module.newContent(
id=web_site_id,
skin_selection_name="Jsstyle",
layout_configuration_form_id="WebSection_viewJsstylePreference",
site_map_document_parent=True,
criterion_property_list=('title',),
**configuration_dict[configuration]
)
web_site.setCriterion('title', identity='erp5_web_js_style_test_contentpage')
web_section = web_site.newContent(
portal_type=web_section_portal_type,
id='%s1' % web_section_id_prefix,
aggregate_value=web_site.getAggregateValue(),
title="Demo Section 1",
visible=True
visible=True,
site_map_section_parent=True
)
web_section.newContent(
portal_type=web_section_portal_type,
......@@ -190,4 +227,12 @@ web_site.newContent(
visible=True
)
if configuration == 'form':
web_site.newContent(
portal_type=web_section_portal_type,
id='%sform' % web_section_id_prefix,
title="Demo Section Form",
custom_render_method_id='WebSite_viewJSStyleTestDialog'
)
return "Web Site created."
......@@ -13,6 +13,7 @@
<p id="portal_status_message"></p>
<nav id="language"></nav>
<nav id="sitemap"></nav>
<aside id="document_list"></aside>
<main></main>
</body>
</html>
\ No newline at end of file
......@@ -35,6 +35,7 @@
})
.declareMethod("render", function (html_content, parsed_content) {
var state = {
document_list: JSON.stringify(parsed_content.document_list || []),
language_list: JSON.stringify(parsed_content.language_list || []),
sitemap: JSON.stringify(parsed_content.sitemap || {}),
page_title: parsed_content.page_title || "",
......@@ -49,6 +50,7 @@
.onStateChange(function (modification_dict) {
var gadget = this,
language_list,
document_list,
child_list,
i;
......@@ -97,6 +99,18 @@
domsugar(gadget.element.querySelector('nav#language'),
[domsugar('ul', child_list)]);
}
if (modification_dict.hasOwnProperty('document_list')) {
document_list = JSON.parse(gadget.state.document_list);
child_list = [];
for (i = 0; i < document_list.length; i += 1) {
child_list.push(domsugar('li', [domsugar('a', {
text: document_list[i].text,
href: document_list[i].href
})]));
}
domsugar(gadget.element.querySelector('aside#document_list'),
[domsugar('ul', child_list)]);
}
if (modification_dict.hasOwnProperty('sitemap')) {
renderSitemap(JSON.parse(gadget.state.sitemap),
gadget.element.querySelector('nav#sitemap'));
......
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