Commit 5402c662 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_corporate_identity&test: get firstly last slide through reference

parent c387f463
...@@ -140,14 +140,24 @@ def removeEmptyDetails(my_content): ...@@ -140,14 +140,24 @@ def removeEmptyDetails(my_content):
def addLastSlide(my_last_slide): def addLastSlide(my_last_slide):
# XXXX This condition is not accurate # XXXX This condition is not accurate
if my_last_slide.count("<div") != 2: if my_last_slide.count("<div") != 2:
last_slide_relative_url = pref.getPreferredCorporateIdentityTemplateSlideLastSlideRelativeUrl() last_slide=None
if last_slide_relative_url: # search first through web reference
# try: if doc_theme['theme']:
last_slide = doc.restrictedTraverse(last_slide_relative_url) last_slide_list = context.portal_catalog(
if last_slide is not None: portal_type='Web Page',
return last_slide.getTextContent() reference='%s-Marketing.Slideshow.Last.Slide' % doc_theme['theme'].upper(),
#except AttributeError: limit=1)
# last_slide_content = blank if last_slide_list:
last_slide=last_slide_list[0]
if not last_slide:
# get default one
last_slide_relative_url = pref.getPreferredCorporateIdentityTemplateSlideLastSlideRelativeUrl()
if last_slide_relative_url:
last_slide = doc.restrictedTraverse(last_slide_relative_url)
if last_slide:
return last_slide.getTextContent()
return blank return blank
# -------------------------- Setup --------------------------------------------- # -------------------------- Setup ---------------------------------------------
...@@ -169,6 +179,8 @@ override_source_organisation_title = kw.get("override_source_organisation_title" ...@@ -169,6 +179,8 @@ override_source_organisation_title = kw.get("override_source_organisation_title"
override_batch_mode = kw.get('batch_mode') override_batch_mode = kw.get('batch_mode')
override_source_person_title = None override_source_person_title = None
doc_theme = doc.Base_getThemeDict(doc_format=doc_format, css_path="template_css/slide", skin="Slide")
# --------------------- Convert any page into a slideshow ---------------------- # --------------------- Convert any page into a slideshow ----------------------
# Note: mileage varies depending on the cleanliness of the HTML page # Note: mileage varies depending on the cleanliness of the HTML page
if doc_is_slideshow is None: if doc_is_slideshow is None:
...@@ -250,7 +262,6 @@ if doc_reference is None: ...@@ -250,7 +262,6 @@ if doc_reference is None:
doc_full_reference = '-'.join([doc_reference, doc_version, doc_language]) doc_full_reference = '-'.join([doc_reference, doc_version, doc_language])
# --------------------------- Layout Parameters -------------------------------- # --------------------------- Layout Parameters --------------------------------
doc_theme = doc.Base_getThemeDict(doc_format=doc_format, css_path="template_css/slide", skin="Slide")
doc_css = ''.join(['.ci-slideshow-intro.present:not(.slide-background):before {', doc_css = ''.join(['.ci-slideshow-intro.present:not(.slide-background):before {',
'content: "%s";' % (doc_theme.get("theme_logo_description")), 'content: "%s";' % (doc_theme.get("theme_logo_description")),
'background: #FFF url("%s") center no-repeat;' % (doc.Base_setUrl(path=doc_theme.get("theme_logo_url"), display="medium")), 'background: #FFF url("%s") center no-repeat;' % (doc.Base_setUrl(path=doc_theme.get("theme_logo_url"), display="medium")),
......
...@@ -460,6 +460,24 @@ class TestCorporateIdentityTemplateList(ERP5TypeTestCase): ...@@ -460,6 +460,24 @@ class TestCorporateIdentityTemplateList(ERP5TypeTestCase):
) )
self.tic() self.tic()
@changeSkin('Slide')
def test_pdfAddLastSlideThroughReference(self):
self.portal.web_page_module.template_test_last_slide_html.edit(reference='DEFAULT-Marketing.Slideshow.Last.Slide')
self.tic()
self.runPdfTestPattern(
"template_test_convert_to_slideview",
"template_test_last_view_bmp",
"template_test_image_source_pdf",
**dict(
page_number=4,
use_skin="Slide",
test_method="WebPage_exportAsSlideshow",
format="pdf"
)
)
self.portal.web_page_module.template_test_last_slide_html.edit(reference='')
self.tic()
@changeSkin('Slide') @changeSkin('Slide')
def test_pdfSlideShowForAnonymous(self): def test_pdfSlideShowForAnonymous(self):
""" """
......
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