Added new config options to show logos on the right side in motion PDF.

This commit is contained in:
Sean Engelhardt 2018-06-22 14:51:28 +02:00 committed by Emanuel Schütze
parent d9d0c84a1a
commit a6ed54eb92
4 changed files with 100 additions and 24 deletions

View File

@ -13,6 +13,7 @@ Motions:
- New representation of amendments (paragraph based creation, new diff
and list views for amendments) [#3637].
- New feature to customize workflows and states [#3772].
- New config options to show logos on the right side in PDF [#3768].
Version 2.2 (2018-06-06)

View File

@ -256,8 +256,10 @@ def get_config_variables():
'logo_projector_main',
'logo_projector_header',
'logo_web_header',
'logo_pdf_header',
'logo_pdf_footer',
'logo_pdf_header_L',
'logo_pdf_header_R',
'logo_pdf_footer_L',
'logo_pdf_footer_R',
'logo_pdf_ballot_paper'],
weight=300,
group='Logo',
@ -295,9 +297,9 @@ def get_config_variables():
# PDF logos
yield ConfigVariable(
name='logo_pdf_header',
name='logo_pdf_header_L',
default_value={
'display_name': 'PDF header logo',
'display_name': 'PDF header logo (Left)',
'path': ''},
input_type='static',
weight=310,
@ -305,22 +307,42 @@ def get_config_variables():
hidden=True)
yield ConfigVariable(
name='logo_pdf_footer',
name='logo_pdf_header_R',
default_value={
'display_name': 'PDF footer logo',
'display_name': 'PDF header logo (Right)',
'path': ''},
input_type='static',
weight=311,
group='Logo',
hidden=True)
yield ConfigVariable(
name='logo_pdf_footer_L',
default_value={
'display_name': 'PDF footer logo (Left)',
'path': ''},
input_type='static',
weight=312,
group='Logo',
hidden=True)
yield ConfigVariable(
name='logo_pdf_footer_R',
default_value={
'display_name': 'PDF footer logo (Right)',
'path': ''},
input_type='static',
weight=313,
group='Logo',
hidden=True)
yield ConfigVariable(
name='logo_pdf_ballot_paper',
default_value={
'display_name': 'PDF ballot paper logo',
'path': ''},
input_type='static',
weight=312,
weight=314,
group='Logo',
hidden=True)

View File

@ -176,20 +176,22 @@ angular.module('OpenSlidesApp.core.pdf', [])
//images shall contain the the logos as URL: base64Str, just like the converter
var createInstance = function(contentProvider, noFooter) {
// Logo urls
var logoHeaderUrl = Config.get('logo_pdf_header').value.path,
logoFooterUrl = Config.get('logo_pdf_footer').value.path;
var logoHeaderLeftUrl = Config.get('logo_pdf_header_L').value.path,
logoHeaderRightUrl = Config.get('logo_pdf_header_R').value.path,
logoFooterLeftUrl = Config.get('logo_pdf_footer_L').value.path,
logoFooterRightUrl = Config.get('logo_pdf_footer_R').value.path;
var imageMap = contentProvider.getImageMap ? contentProvider.getImageMap() : {};
// PDF header
var getHeader = function() {
var columns = [];
if (logoHeaderUrl) {
if (logoHeaderUrl.indexOf('/') === 0) {
logoHeaderUrl = logoHeaderUrl.substr(1); // remove trailing /
if (logoHeaderLeftUrl) {
if (logoHeaderLeftUrl.indexOf('/') === 0) {
logoHeaderLeftUrl = logoHeaderLeftUrl.substr(1); // remove trailing /
}
columns.push({
image: logoHeaderUrl,
image: logoHeaderLeftUrl,
fit: [180, 40],
width: '20%'
});
@ -207,9 +209,21 @@ angular.module('OpenSlidesApp.core.pdf', [])
columns.push({
text: text,
fontSize: 10,
alignment: 'right',
alignment: logoHeaderRightUrl ? 'left' : 'right',
margin: [0, 10, 0, 0],
});
if (logoHeaderRightUrl) {
if (logoHeaderRightUrl.indexOf('/') === 0) {
logoHeaderRightUrl = logoHeaderRightUrl.substr(1); // remove trailing /
}
columns.push({
image: logoHeaderRightUrl,
fit: [180, 40],
width: '20%'
});
}
return {
color: '#555',
fontSize: 9,
@ -226,23 +240,59 @@ angular.module('OpenSlidesApp.core.pdf', [])
var getFooter = function() {
var columns = [];
if (logoFooterUrl) {
if (logoFooterUrl.indexOf('/') === 0) {
logoFooterUrl = logoFooterUrl.substr(1); // remove trailing /
// if there is a single logo, give it a lot of space
var logoContainerWidth;
var logoConteinerSize;
if (logoFooterLeftUrl && logoFooterRightUrl) {
logoContainerWidth = '20%';
logoConteinerSize = [180, 40];
} else {
logoContainerWidth = '80%';
logoConteinerSize = [400, 50];
}
// the position of the page number depends on the logos
var pageNumberPosition;
if (logoFooterLeftUrl && logoFooterRightUrl) {
pageNumberPosition = 'center';
} else if (logoFooterLeftUrl && (!logoFooterRightUrl)) {
pageNumberPosition = 'right';
} else if (logoFooterRightUrl && (!logoFooterLeftUrl)) {
pageNumberPosition = 'left';
} else {
pageNumberPosition = Config.get('general_export_pdf_pagenumber_alignment').value;
}
if (logoFooterLeftUrl) {
if (logoFooterLeftUrl.indexOf('/') === 0) {
logoFooterLeftUrl = logoFooterLeftUrl.substr(1); // remove trailing /
}
columns.push({
image: logoFooterUrl,
fit: [400,50],
width: '80%'
image: logoFooterLeftUrl,
fit: logoConteinerSize,
width: logoContainerWidth,
alignment: 'left',
});
}
columns.push({
text: '{{currentPage}} / {{pageCount}}',
color: '#555',
fontSize: 9,
alignment: Config.get('general_export_pdf_pagenumber_alignment').value,
alignment: pageNumberPosition,
margin: [0, 15, 0, 0],
});
if (logoFooterRightUrl) {
if (logoFooterRightUrl.indexOf('/') === 0) {
logoFooterRightUrl = logoFooterRightUrl.substr(1); // remove trailing /
}
columns.push({
image: logoFooterRightUrl,
fit: logoConteinerSize,
width: logoContainerWidth,
alignment: 'right',
});
}
return {
margin: [75, 0, 75, 10],
columns: columns,
@ -358,8 +408,10 @@ angular.module('OpenSlidesApp.core.pdf', [])
return $q(function (resolve, reject) {
var imageSources = [
logoHeaderUrl,
logoFooterUrl
logoHeaderLeftUrl,
logoHeaderRightUrl,
logoFooterLeftUrl,
logoFooterRightUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
_.forEach(_imageMap, function (data, path) {

View File

@ -2119,7 +2119,8 @@ angular.module('OpenSlidesApp.core.site', [
gettext('List of speakers overlay');
gettext('Projector logo');
gettext('Projector header image');
gettext('PDF header logo');
gettext('PDF header logo (Left)');
gettext('PDF header logo (Right)');
gettext('PDF footer logo');
gettext('Web interface header logo');
gettext('PDF ballot paper logo');