Commit b98ac80d authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: use effective_date as document published date

Fallback to modification_date if a document does not have an effective_date.
parent 5ad2b222
...@@ -28,6 +28,7 @@ def generateDocumentListHTML(result_list, document_list): ...@@ -28,6 +28,7 @@ def generateDocumentListHTML(result_list, document_list):
if (document_list): if (document_list):
result_list.append('<aside id="document_list"><ul class="h-feed">') result_list.append('<aside id="document_list"><ul class="h-feed">')
for section in document_list: for section in document_list:
publication_date = section['effective_date'] or section['modification_date']
result_list.append(""" result_list.append("""
<li class="h-entry"> <li class="h-entry">
<div class="e-content"> <div class="e-content">
...@@ -41,8 +42,8 @@ def generateDocumentListHTML(result_list, document_list): ...@@ -41,8 +42,8 @@ def generateDocumentListHTML(result_list, document_list):
('<p class="p-summary">%s</p>' % _(section['description'])) if section.get('description') else '', ('<p class="p-summary">%s</p>' % _(section['description'])) if section.get('description') else '',
('<p class="p-author h-card">%s</p>' % _(section['document'].Document_getContributorTitleList()[0])), ('<p class="p-author h-card">%s</p>' % _(section['document'].Document_getContributorTitleList()[0])),
__(section['url']), __(section['url']),
__(section['modification_date'].HTML4()), __(publication_date.HTML4()),
_(section['modification_date'].rfc822()) _(publication_date.rfc822())
)) ))
result_list.append('</ul></aside>') result_list.append('</ul></aside>')
...@@ -75,6 +76,6 @@ result_list.append('</nav>') ...@@ -75,6 +76,6 @@ result_list.append('</nav>')
# Documents # Documents
if include_document: if include_document:
generateDocumentListHTML(result_list, web_section.WebSection_getSiteMapTree(include_subsection=False, exclude_default_document=True, depth=1, property_mapping=('translated_title', 'description', 'modification_date'))) generateDocumentListHTML(result_list, web_section.WebSection_getSiteMapTree(include_subsection=False, exclude_default_document=True, depth=1, property_mapping=('translated_title', 'description', 'effective_date', 'modification_date')))
return ''.join(result_list) return ''.join(result_list)
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//ul[@class="h-feed"]//li[@class="h-entry"]//a[@class="u-url" and @rel='permalink' and contains(@href, 'web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_contentpage')]//time[@class="dt-published" and contains(@datetime, 'T')]</td> <td>//aside[@id='document_list']//ul[@class="h-feed"]//li[@class="h-entry"]//a[@class="u-url" and @rel='permalink' and contains(@href, 'web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_contentpage')]//time[@class="dt-published" and text()='Tue, 13 Dec 2011 11:22:33 +0500' and @datetime='2011-12-13T06:22:33Z']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td> <td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -34,6 +34,8 @@ web_page_content_en_id = "erp5_web_js_style_test_contentpage_en" ...@@ -34,6 +34,8 @@ web_page_content_en_id = "erp5_web_js_style_test_contentpage_en"
web_page_content_fr_id = "erp5_web_js_style_test_contentpage_fr" web_page_content_fr_id = "erp5_web_js_style_test_contentpage_fr"
web_page_content_zh_id = "erp5_web_js_style_test_contentpage_zh" web_page_content_zh_id = "erp5_web_js_style_test_contentpage_zh"
publicate_date = DateTime('2011/12/13 11:22:33 GMT+5')
### English web page ### English web page
module = portal.getDefaultModule(web_page_portal_type) module = portal.getDefaultModule(web_page_portal_type)
if getattr(module, web_page_frontend_en_id, None) is not None: if getattr(module, web_page_frontend_en_id, None) is not None:
...@@ -43,6 +45,7 @@ web_page = module.newContent( ...@@ -43,6 +45,7 @@ web_page = module.newContent(
id=web_page_frontend_en_id, id=web_page_frontend_en_id,
reference=web_page_frontend_reference, reference=web_page_frontend_reference,
contributor_value=contributor, contributor_value=contributor,
effective_date=publicate_date,
language="en", language="en",
version="001", version="001",
text_content=""" text_content="""
...@@ -61,6 +64,7 @@ web_page = module.newContent( ...@@ -61,6 +64,7 @@ web_page = module.newContent(
id=web_page_content_en_id, id=web_page_content_en_id,
reference=web_page_content_reference, reference=web_page_content_reference,
contributor_value=contributor, contributor_value=contributor,
effective_date=publicate_date,
title="%s title" % web_page_content_reference, title="%s title" % web_page_content_reference,
description="%s description" % web_page_content_reference, description="%s description" % web_page_content_reference,
language="en", language="en",
...@@ -79,6 +83,7 @@ web_page = module.newContent( ...@@ -79,6 +83,7 @@ web_page = module.newContent(
id=web_page_frontend_fr_id, id=web_page_frontend_fr_id,
reference=web_page_frontend_reference, reference=web_page_frontend_reference,
contributor_value=contributor, contributor_value=contributor,
effective_date=publicate_date,
language="fr", language="fr",
version="001", version="001",
text_content=""" text_content="""
...@@ -97,6 +102,7 @@ web_page = module.newContent( ...@@ -97,6 +102,7 @@ web_page = module.newContent(
id=web_page_content_fr_id, id=web_page_content_fr_id,
reference=web_page_content_reference, reference=web_page_content_reference,
contributor_value=contributor, contributor_value=contributor,
effective_date=publicate_date,
title="%s title" % web_page_content_reference, title="%s title" % web_page_content_reference,
description="%s description" % web_page_content_reference, description="%s description" % web_page_content_reference,
language="fr", language="fr",
...@@ -115,6 +121,7 @@ web_page = module.newContent( ...@@ -115,6 +121,7 @@ web_page = module.newContent(
id=web_page_frontend_zh_id, id=web_page_frontend_zh_id,
reference=web_page_frontend_reference, reference=web_page_frontend_reference,
contributor_value=contributor, contributor_value=contributor,
effective_date=publicate_date,
language="zh", language="zh",
version="001", version="001",
text_content=""" text_content="""
...@@ -133,6 +140,7 @@ web_page = module.newContent( ...@@ -133,6 +140,7 @@ web_page = module.newContent(
id=web_page_content_zh_id, id=web_page_content_zh_id,
reference=web_page_content_reference, reference=web_page_content_reference,
contributor_value=contributor, contributor_value=contributor,
effective_date=publicate_date,
title="%s title" % web_page_content_reference, title="%s title" % web_page_content_reference,
description="%s description" % web_page_content_reference, description="%s description" % web_page_content_reference,
language="zh", language="zh",
......
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