Merge pull request #3310 from emanuelschuetze/new-logo

Added new logo placeholder for web interface header logo.
This commit is contained in:
Emanuel Schütze 2017-08-14 14:50:07 +02:00 committed by GitHub
commit 81f841d5e5
7 changed files with 148 additions and 40 deletions

View File

@ -51,8 +51,8 @@ Users:
Core: Core:
- No reload on logoff. OpenSlides is now a full single page - No reload on logoff. OpenSlides is now a full single page
application [#3172]. application [#3172].
- Adding support for choosing image files as logos for projector and - Adding support for choosing image files as logos for projector,
PDF [#3184, #3207, #3208]. PDF and web interface header [#3184, #3207, #3208, #3310].
- Fixing error when clearing empty chat [#3199]. - Fixing error when clearing empty chat [#3199].
- Added notify system [#3212]. - Added notify system [#3212].
- Enhanced performance esp. for server restart and first connection of all - Enhanced performance esp. for server restart and first connection of all

View File

@ -266,14 +266,46 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
]) ])
.factory('BallotContentProvider', [ .factory('BallotContentProvider', [
'$q',
'$filter', '$filter',
'gettextCatalog', 'gettextCatalog',
'PDFLayout', 'PDFLayout',
'Config', 'Config',
'User', 'User',
function($filter, gettextCatalog, PDFLayout, Config, User) { 'ImageConverter',
function($q, $filter, gettextCatalog, PDFLayout, Config, User, ImageConverter) {
var createInstance = function(assignment, poll, pollNumber) { var createInstance = function(assignment, poll, pollNumber) {
var logoBallotPaperUrl = Config.get('logo_pdf_ballot_paper').value.path;
var imageMap = {};
// PDF header
var header = function() {
var columns = [];
// logo
if (logoBallotPaperUrl) {
columns.push({
image: imageMap[logoBallotPaperUrl].data,
fit: [90,20],
width: '20%'
});
}
var text = Config.get('general_event_name').value;
columns.push({
text: text,
fontSize: 8,
alignment: 'right',
});
return {
color: '#555',
margin: [30, 10, 10, -10], // [left, top, right, bottom]
columns: columns,
columnGap: 10
};
};
// page title // page title
var createTitle = function() { var createTitle = function() {
return { return {
@ -351,20 +383,21 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
// since it is not possible to give a column a fixed height, we draw an "empty" column // since it is not possible to give a column a fixed height, we draw an "empty" column
// with a one px width and a fixed top-margin // with a one px width and a fixed top-margin
return { return {
columns : [ columns: [
{ {
width: 1, width: 1,
margin: [0, marginTop], margin: [0, marginTop],
text: "" text: '',
}, },
{ {
width: '*', width: '*',
stack: [ stack: [
header(),
createTitle(), createTitle(),
createPollHint(), createPollHint(),
createSelectionField(), createSelectionField(),
] ],
} },
] ]
}; };
}; };
@ -473,9 +506,17 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
return createContentTable(); return createContentTable();
}; };
return { return $q(function (resolve) {
getContent: getContent var imageSources = [
}; logoBallotPaperUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
imageMap = _imageMap;
resolve({
getContent: getContent
});
});
});
}; };
return { return {
@ -610,9 +651,10 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
} }
}); });
var filename = gettextCatalog.getString('Ballot') + '_' + pollNumber + '_' + assignment.title + '.pdf'; var filename = gettextCatalog.getString('Ballot') + '_' + pollNumber + '_' + assignment.title + '.pdf';
var ballotContentProvider = BallotContentProvider.createInstance(assignment, thePoll, pollNumber); BallotContentProvider.createInstance(assignment, thePoll, pollNumber).then(function (ballotContentProvider) {
var documentProvider = PdfMakeBallotPaperProvider.createInstance(ballotContentProvider); var documentProvider = PdfMakeBallotPaperProvider.createInstance(ballotContentProvider);
PdfCreate.download(documentProvider.getDocument(), filename); PdfCreate.download(documentProvider.getDocument(), filename);
});
}, },
}; };
} }

View File

@ -250,8 +250,10 @@ def get_config_variables():
default_value=[ default_value=[
'logo_projector_main', 'logo_projector_main',
'logo_projector_header', 'logo_projector_header',
'logo_web_header',
'logo_pdf_header', 'logo_pdf_header',
'logo_pdf_footer'], 'logo_pdf_footer',
'logo_pdf_ballot_paper'],
weight=300, weight=300,
group='Logo', group='Logo',
hidden=True) hidden=True)
@ -276,6 +278,16 @@ def get_config_variables():
group='Logo', group='Logo',
hidden=True) hidden=True)
yield ConfigVariable(
name='logo_web_header',
default_value={
'display_name': 'Web interface header logo',
'path': ''},
input_type='logo',
weight=303,
group='Logo',
hidden=True)
# PDF logos # PDF logos
yield ConfigVariable( yield ConfigVariable(
name='logo_pdf_header', name='logo_pdf_header',
@ -296,3 +308,13 @@ def get_config_variables():
weight=311, weight=311,
group='Logo', group='Logo',
hidden=True) hidden=True)
yield ConfigVariable(
name='logo_pdf_ballot_paper',
default_value={
'display_name': 'PDF ballot paper logo',
'path': ''},
input_type='logo',
weight=312,
group='Logo',
hidden=True)

View File

@ -59,12 +59,6 @@ var replacePlaceholder = function (content) {
hLineWidth: function(i, node) { hLineWidth: function(i, node) {
if (i === 0){ if (i === 0){
return 0; return 0;
} else if (i === node.table.body.length) {
if (node.rowsperpage && node.rowsperpage > i) {
return 0.5;
} else {
return 0;
}
} else { } else {
return 0.5; return 0.5;
} }

View File

@ -1898,6 +1898,8 @@ angular.module('OpenSlidesApp.core.site', [
gettext('Projector header image'); gettext('Projector header image');
gettext('PDF header logo'); gettext('PDF header logo');
gettext('PDF footer logo'); gettext('PDF footer logo');
gettext('Web interface header logo');
gettext('PDF ballot paper logo');
// Mark the string 'Default projector' here, because it does not appear in the templates. // Mark the string 'Default projector' here, because it does not appear in the templates.
gettext('Default projector'); gettext('Default projector');

View File

@ -29,7 +29,8 @@
<!-- Logo --> <!-- Logo -->
<div class="title"> <div class="title">
<a ui-sref="home"> <a ui-sref="home">
<img src="/static/img/openslides-logo-dark.png" alt="Logo" height="35"> <img src="/static/img/openslides-logo-dark.png" alt="OpenSlides Logo" height="35">
<img ng-if="config('logo_web_header').path" ng-src="{{ config('logo_web_header').path }}" alt="OpenSlides Logo" height="35">
</a> </a>
</div> </div>

View File

@ -540,11 +540,13 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
]) ])
.factory('PollContentProvider', [ .factory('PollContentProvider', [
'$q',
'PDFLayout', 'PDFLayout',
'gettextCatalog', 'gettextCatalog',
'Config', 'Config',
'User', 'User',
function(PDFLayout, gettextCatalog, Config, User) { 'ImageConverter',
function($q, PDFLayout, gettextCatalog, Config, User, ImageConverter) {
/** /**
* Generates a content provider for polls * Generates a content provider for polls
* @constructor * @constructor
@ -553,25 +555,61 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
*/ */
var createInstance = function(title, id) { var createInstance = function(title, id) {
var logoBallotPaperUrl = Config.get('logo_pdf_ballot_paper').value.path;
var imageMap = {};
// PDF header
var header = function() {
var columns = [];
var text = Config.get('general_event_name').value;
columns.push({
text: text,
fontSize: 8,
alignment: 'left',
width: '60%'
});
// logo
if (logoBallotPaperUrl) {
columns.push({
image: imageMap[logoBallotPaperUrl].data,
fit: [90,25],
alignment: 'right',
width: '40%'
});
}
return {
color: '#555',
fontSize: 10,
margin: [30, 10, 10, -10], // [left, top, right, bottom]
columns: columns,
columnGap: 5
};
};
/** /**
* Returns a single section on the ballot paper * Returns a single section on the ballot paper
* @function * @function
*/ */
var createSection = function() { var createSection = function() {
var sheetend = 75; var sheetend = 40;
return { return {
stack: [{ stack: [
text: gettextCatalog.getString("Motion") + " " + id, header(),
style: 'title', {
}, { text: gettextCatalog.getString('Motion') + ' ' + id,
text: title, style: 'title',
style: 'description' },
}, {
PDFLayout.createBallotEntry(gettextCatalog.getString("Yes")), text: title,
PDFLayout.createBallotEntry(gettextCatalog.getString("No")), style: 'description'
PDFLayout.createBallotEntry(gettextCatalog.getString("Abstain")), },
PDFLayout.createBallotEntry(gettextCatalog.getString('Yes')),
PDFLayout.createBallotEntry(gettextCatalog.getString('No')),
PDFLayout.createBallotEntry(gettextCatalog.getString('Abstain')),
], ],
margin: [0, 0, 0, sheetend] margin: [0, 0, 0, sheetend],
}; };
}; };
@ -642,9 +680,17 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
return content; return content;
}; };
return { return $q(function (resolve) {
getContent: getContent, var imageSources = [
}; logoBallotPaperUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
imageMap = _imageMap;
resolve({
getContent: getContent
});
});
});
}; };
return { return {
createInstance: createInstance createInstance: createInstance
@ -944,9 +990,10 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
var id = motion.identifier.replace(' ', ''); var id = motion.identifier.replace(' ', '');
var title = motion.getTitle(version); var title = motion.getTitle(version);
var filename = gettextCatalog.getString('Motion') + '-' + id + '-' + gettextCatalog.getString('ballot-paper') + '.pdf'; var filename = gettextCatalog.getString('Motion') + '-' + id + '-' + gettextCatalog.getString('ballot-paper') + '.pdf';
var pollContentProvider = PollContentProvider.createInstance(title, id); PollContentProvider.createInstance(title, id).then(function (pollContentProvider) {
var documentProvider = PdfMakeBallotPaperProvider.createInstance(pollContentProvider); var documentProvider = PdfMakeBallotPaperProvider.createInstance(pollContentProvider);
PdfCreate.download(documentProvider.getDocument(), filename); PdfCreate.download(documentProvider.getDocument(), filename);
});
}, },
exportPersonalNote: function (motion, filename) { exportPersonalNote: function (motion, filename) {
var personalNote = PersonalNoteManager.getNote(motion); var personalNote = PersonalNoteManager.getNote(motion);