Commit e9b98429 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_corporate_identity: display correct logo

parent a9f0c444
...@@ -39,6 +39,16 @@ Creates the Book header. ...@@ -39,6 +39,16 @@ Creates the Book header.
var y = document.getElementsByClassName(x[i]); var y = document.getElementsByClassName(x[i]);
for (var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; for (var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
} }
var z = document.getElementsByClassName("hack");
for (var k=0; k<z.length; ++k) {
var pic = z[k];
if (pic.naturalWidth / pic.naturalHeight <= 1) {
pic.style.width = "auto";
pic.style.maxWidth = "28mm";
pic.style.maxHeight = "28mm"
pic.style.height = "auto";
}
}
} }
</script> </script>
</head> </head>
...@@ -55,7 +65,7 @@ Creates the Book header. ...@@ -55,7 +65,7 @@ Creates the Book header.
<tr> <tr>
<td> <td>
<div class="ci-book-header-image-wkhtmltopdf-image-wrapper"> <div class="ci-book-header-image-wkhtmltopdf-image-wrapper">
<img tal:attributes="src python: book_logo_url; alt python: book_logo_title"/> <img class="hack" tal:attributes="src python: book_logo_url; alt python: book_logo_title"/>
</div> </div>
</td> </td>
<td> <td>
......
...@@ -89,6 +89,9 @@ book_title = html_quote(override_document_title) if override_document_title else ...@@ -89,6 +89,9 @@ book_title = html_quote(override_document_title) if override_document_title else
if isinstance(book_content, unicode): if isinstance(book_content, unicode):
book_content = book_content.encode("UTF-8") book_content = book_content.encode("UTF-8")
# backcompat
#book_history_section_list = re.findall('<section*?>.+?</section>', book_content, re.S)
# override for tests # override for tests
if override_batch_mode: if override_batch_mode:
book_modification_date = DateTime("1976-11-04") book_modification_date = DateTime("1976-11-04")
...@@ -126,6 +129,9 @@ book_image_list = [] ...@@ -126,6 +129,9 @@ book_image_list = []
book_table_list = [] book_table_list = []
book_table_of_content = blank book_table_of_content = blank
# backcompat
# book_content = book_content.replace("${WebPage_insertTableOfReferences}", blank)
# XXX: not done # XXX: not done
if book_include_history_table: if book_include_history_table:
book_signature_list = [] book_signature_list = []
...@@ -182,6 +188,13 @@ if book_include_reference_table: ...@@ -182,6 +188,13 @@ if book_include_reference_table:
) )
#if book_format == 'html' or book_format == 'mhtml': #if book_format == 'html' or book_format == 'mhtml':
# book_references = book_references.encode('UTF-8').strip() # book_references = book_references.encode('UTF-8').strip()
# backcompat for manual history tables at the beginning of documents
# NOTE: assumes <section>s are not used elsewhere!
#if len(book_history_section_list) > 0:
# book_content = book_content.replace(book_history_section_list[-1], (book_history_section_list[-1] + book_references.encode('UTF-8').strip()))
#else:
# book_content = book_content.replace("${WebPage_insertTableOfReferences}", book_references.encode('UTF-8').strip())
book_content = book_content.replace("${WebPage_insertTableOfReferences}", book_references.encode('UTF-8').strip()) book_content = book_content.replace("${WebPage_insertTableOfReferences}", book_references.encode('UTF-8').strip())
else: else:
book_content = book_content.replace("${WebPage_insertTableOfReferences}", blank) book_content = book_content.replace("${WebPage_insertTableOfReferences}", blank)
...@@ -231,7 +244,7 @@ if book_format == "html" or book_format == "mhtml": ...@@ -231,7 +244,7 @@ if book_format == "html" or book_format == "mhtml":
book_signature_list=book_signature_list, book_signature_list=book_signature_list,
book_version_list=book_version_list, book_version_list=book_version_list,
book_distribution_list=book_distribution_list, book_distribution_list=book_distribution_list,
book_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display=None), book_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display="small"),
book_logo_title=book_theme.get("theme_logo_description"), book_logo_title=book_theme.get("theme_logo_description"),
book_reference=book_reference, book_reference=book_reference,
book_revision=book_revision, book_revision=book_revision,
...@@ -280,7 +293,7 @@ if book_format == "pdf": ...@@ -280,7 +293,7 @@ if book_format == "pdf":
book_language=book_language, book_language=book_language,
book_theme_css_font_list=book_theme.get("theme_css_font_list"), book_theme_css_font_list=book_theme.get("theme_css_font_list"),
book_theme_css_url=book_theme.get("theme_css_url"), book_theme_css_url=book_theme.get("theme_css_url"),
book_theme_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display=None), book_theme_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display="small"),
book_theme_logo_alt=book_theme.get("theme_logo_alt"), book_theme_logo_alt=book_theme.get("theme_logo_alt"),
book_template_css_url=book_theme.get("template_css_url"), book_template_css_url=book_theme.get("template_css_url"),
book_include_history=book_include_history_table, book_include_history=book_include_history_table,
...@@ -290,7 +303,6 @@ if book_format == "pdf": ...@@ -290,7 +303,6 @@ if book_format == "pdf":
) )
# book_references created and added above # book_references created and added above
book_content = book.WebPage_createBookContent( book_content = book.WebPage_createBookContent(
book_format=book_format, book_format=book_format,
book_rendering_fix=book_rendering_fix, book_rendering_fix=book_rendering_fix,
...@@ -311,7 +323,7 @@ if book_format == "pdf": ...@@ -311,7 +323,7 @@ if book_format == "pdf":
book_theme_css_font_list=book_theme.get("theme_css_font_list"), book_theme_css_font_list=book_theme.get("theme_css_font_list"),
book_theme_css_url=book_theme.get("theme_css_url"), book_theme_css_url=book_theme.get("theme_css_url"),
book_template_css_url=book_theme.get("template_css_url"), book_template_css_url=book_theme.get("template_css_url"),
book_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display=None), book_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display="small"),
book_logo_title=book_theme.get("theme_logo_description"), book_logo_title=book_theme.get("theme_logo_description"),
book_short_title=book_short_title, book_short_title=book_short_title,
book_reference=book_reference, book_reference=book_reference,
...@@ -326,7 +338,7 @@ if book_format == "pdf": ...@@ -326,7 +338,7 @@ if book_format == "pdf":
book_language=book_language, book_language=book_language,
book_theme_css_font_list=book_theme.get("theme_css_font_list"), book_theme_css_font_list=book_theme.get("theme_css_font_list"),
book_theme_css_url=book_theme.get("theme_css_url"), book_theme_css_url=book_theme.get("theme_css_url"),
book_theme_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display=None), book_theme_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url"), display="small"),
book_theme_logo_alt=book_theme.get("theme_logo_description"), book_theme_logo_alt=book_theme.get("theme_logo_description"),
book_template_css_url=book_theme.get("template_css_url"), book_template_css_url=book_theme.get("template_css_url"),
book_full_reference=book_full_reference, book_full_reference=book_full_reference,
...@@ -365,7 +377,6 @@ if book_format == "pdf": ...@@ -365,7 +377,6 @@ if book_format == "pdf":
footer_spacing=3, footer_spacing=3,
) )
) )
return book.WebPage_finishPdfCreation( return book.WebPage_finishPdfCreation(
doc_download=book_download, doc_download=book_download,
doc_save=book_save, doc_save=book_save,
......
...@@ -245,11 +245,24 @@ ...@@ -245,11 +245,24 @@
display: inline; display: inline;
vertical-align: middle; vertical-align: middle;
} }
/* BACKUP:
fits all logos, unless you have to use a really wiiiiide logo like Nexedi
*/
.ci-book .ci-book-header .ci-book-header-image-wkhtmltopdf-image-wrapper img { .ci-book .ci-book-header .ci-book-header-image-wkhtmltopdf-image-wrapper img {
height: auto; height: auto;
display: inline-block; display: inline-block;
width: auto; width: auto;
} }
/* hardcode here we go.
NOTE: logos will disappear in wkhtmltopdf if they go beyond the available space
.ci-book .ci-book-header .ci-book-header-image-wkhtmltopdf-image-wrapper img {
height: auto;
display: inline-block;
width: 60%;
vertical-align: -webkit-baseline-middle;
}
*/
/* header spec section */ /* header spec section */
.ci-book .ci-book-header td:last-child { .ci-book .ci-book-header td:last-child {
text-align: left; text-align: left;
...@@ -979,4 +992,4 @@ div.ci-document-box-offer-milestone { ...@@ -979,4 +992,4 @@ div.ci-document-box-offer-milestone {
/* backcompat */ /* backcompat */
.ci-document-box-end + .ci-document-box-resources { .ci-document-box-end + .ci-document-box-resources {
margin-left: 20%; margin-left: 20%;
} }
\ No newline at end of file
...@@ -258,17 +258,25 @@ ...@@ -258,17 +258,25 @@
width: 100%; width: 100%;
line-height: 25mm; line-height: 25mm;
} }
/* BACKUP:
fits all logos, unless you have to use a really wiiiiide logo like Nexedi
*/
.ci-book .ci-book-header .ci-book-header-image-wkhtmltopdf-image-wrapper img { .ci-book .ci-book-header .ci-book-header-image-wkhtmltopdf-image-wrapper img {
/*
display: inline-block;
width: auto;
height: auto;
*/
max-width: 28mm;
height: auto; height: auto;
vertical-align: middle;
max-height: 14mm; max-height: 14mm;
}
/* hardcode here we go.
NOTE: logos will disappear in wkhtmltopdf if they go beyond the available space
.ci-book .ci-book-header .ci-book-header-image-wkhtmltopdf-image-wrapper img {
height: auto;
vertical-align: middle; vertical-align: middle;
display: inline-block;
width: 60%;
object-fit: contain;
} }
*/
/* header spec section */ /* header spec section */
.ci-book .ci-book-header td:last-child { .ci-book .ci-book-header td:last-child {
text-align: left; text-align: left;
......
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