Commit 745f70e1 authored by Sven Franck's avatar Sven Franck

erp5_ci_slideshow: add print layout including notes

parent 293043c8
"""
================================================================================
Presentation Layout ?portal_skin=CI_presentation
Presentation Layout ?portal_skin=CI_slideshow
================================================================================
"""
import re
def getSlideList(content):
return re.findall(r'<section[^>]*?>(.*?)</section>', content, re.S)
def getDetails(content):
return content.find("</details>") > -1
def getNestedSection(content):
return content.find("<section") > -1
def removeSlidesWithoutDetailsFromNotes(content):
slide_list = getSlideList(content)
# empty slide if no <detail>
for slide in slide_list:
if getNestedSection(slide) is False:
content = content.replace(slide, '')
# remove empty slides
content = content.replace('<section></section>','')
content = re.sub(r'<section class="[^"]*"></section>', '', content)
# remove empty slides with class
return content
def removeEmptyDetails(content):
return content.replace('<details open="open"></details>', '')
def getThemeFromFirstFollowUpProduct():
follow_up_list = context.getFollowUpValueList(
portal_type="Product",
......@@ -24,7 +48,7 @@ document = context
# wkhtmltopdf
document_output_type = document.REQUEST.form.get("output", default=None)
document_content = document.getTextContent()
document_content = removeEmptyDetails(document.getTextContent())
document_theme = getThemeFromFirstFollowUpProduct()
document_title = document.getTitle()
document_description = document.getDescription()
......@@ -42,7 +66,7 @@ document_contributor_list = ""
# <section> tags. this is done here
has_details = getDetails(document_content)
if has_details is True:
slide_list = re.findall(r'<section[^>]*?>(.*?)</section>', document_content, re.S)
slide_list = getSlideList(document_content)
for slide in slide_list:
if getDetails(slide) is True:
......@@ -186,6 +210,47 @@ if document_output_type == "content":
document_content
)
# handouts
if document_output_type == "details":
return """
<!Doctype html>
<html class="ci-%s">
<head>
<meta charset="utf-8">
<title>%s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<!-- fonts -->
<link rel="stylesheet" href="roboto/roboto.css" />
<link rel="stylesheet" href="roboto/roboto-condensed.css" />
<link rel="stylesheet" href="css/theme/white_custom.css?portal_skin=CI_slideshow" id="theme" />
<link rel="stylesheet" href="css/custom.css?portal_skin=CI_slideshow" />
<link rel="stylesheet" href="lib/css/zenburn.css?portal_skin=CI_slideshow" />
<link rel="stylesheet" href="css/custom_pdf.css?portal_skin=CI_slideshow" />
<link rel="stylesheet" href="css/custom_wkhtmltopdf.css?portal_skin=CI_slideshow" />
</head>
<body class="ci-presentation ci-handout">
<!-- <div class="reveal">
<div class="slides"> -->
<section>
<h1>Notes</h1>
</section>
%s
<!-- </div>
</div> -->
</body>
</html>
""" % (
document_theme,
document_title,
#document_content
removeSlidesWithoutDetailsFromNotes(document_content)
)
# DEFAULT WebPage_viewAsWeb
return """
......
......@@ -55,12 +55,6 @@ html .ci-presentation ul {
html .ci-presentation ul li {
font-size: 1.5em;
}
html .ci-presentation details ul {
margin-top: 5%;
}
html .ci-presentation details ul li {
font-size: 100%;
}
html .ci-presentation img + ul,
html .ci-presentation div + ul {
margin: 0;
......@@ -89,6 +83,20 @@ html .ci-presentation li code pre {
font-size: 100%;
}
/* details */
html .ci-presentation details {
text-align: justify;
-moz-text-align-last: left;
text-align-last: left;
}
html .ci-presentation details ul {
margin-top: 5%;
}
html .ci-presentation details ul li {
font-size: 100%;
}
/* footer */
html .ci-presentation .ci-presentation-footer {
position:absolute;
......@@ -123,10 +131,11 @@ html .ci-presentation .ci-presentation-container-right {
/* introductory slide */
html .ci-presentation .ci-presentation-intro.present {
width: 100%;
height: 80%;
height: 96% !important;
padding: 0 .5em;
top: 0 !important; /* overwrite reveal-js */
}
html .ci-presentation .ci-presentation-intro.present > h2 {
width: 100%;
}
......@@ -562,4 +571,4 @@ html .ci-presentation .ci-presentation-intro.present + .ci-presentation-header {
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
}
}
\ No newline at end of file
/* ========================================================================== */
/* CSS ci_presentation - wkhtmltopdf specific */
/* ========================================================================== */
/* NOTES ON OPTIONS */
/*
margin-bottom 8 show half, margin-bottom: 12 show full, but not displayed
reason stuff above is too large
*/
/* details */
.ci-presentation.ci-handout > section:first-child h1 {
position: relative;
top: 60mm;
}
.ci-presentation.ci-handout section:not(:first-child) {
-webkit-transform:scale(0.4);
-moz-transform:scale(0.4);
-ms-transform:scale(0.4);
transform:scale(0.4);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin-left: 0;
margin-right: 0;
width: 100%;
}
/* nothing works in wkhtmltopdf */
.ci-presentation.ci-handout section:not(:first-child) {
/*-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: url(grayscale.svg);
filter: gray;
*/
/* mask: url("https://nexedi.erp5.net/portal_skins/erp5_ci_slideshow/css/grayscale.svg#greyscale"); */
border: 1px solid #a1a1a1;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.ci-presentation.ci-handout > section {
position: relative;
top: -40mm;
}
.ci-presentation.ci-handout > section section {
-webkit-transform:none;
-moz-transform:none;
-ms-transform:none;
transform:none;
width: inherit;
}
.ci-presentation.ci-handout section {
height: initial;
}
.ci-presentation.ci-handout section img {
position: relative;
top: -20mm;
max-width: 80%;
}
.ci-presentation.ci-handout section pre {
max-width: 90%;
margin: 0 auto;
background:#F0F0F0;
}
.ci-presentation.ci-handout details {
display: block;
-webkit-transform:scale(1.5);
-moz-transform:scale(1.5);
-ms-transform:scale(1.5);
transform:scale(1.5);
}
details {
color: white;
display: block !important;
}
summary::-webkit-details-marker {
display: none;
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>custom_wkhtmltopdf.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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