Show qr codes in access data pdf only if config fields are set.

Disable footer with page numbers.
This commit is contained in:
Emanuel Schütze 2017-01-04 22:43:17 +01:00
parent 9abf9d5d57
commit 388e6353cc
3 changed files with 110 additions and 88 deletions

View File

@ -203,7 +203,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
}; };
}; };
// Generates the document(definition) for pdfMake // Generates the document(definition) for pdfMake
var getDocument = function() { var getDocument = function(noFooter) {
var content = contentProvider.getContent(); var content = contentProvider.getContent();
return { return {
pageSize: 'A4', pageSize: 'A4',
@ -213,7 +213,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
fontSize: 10 fontSize: 10
}, },
header: header, header: header,
footer: footer, footer: noFooter ? '' : footer,
content: content, content: content,
styles: { styles: {
title: { title: {
@ -296,6 +296,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
}, },
bold: { bold: {
bold: true, bold: true,
},
small: {
fontSize: 8,
} }
} }
}; };

View File

@ -128,13 +128,8 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
}; };
var createAccessDataContent = function(user) { var createAccessDataContent = function(user) {
var wifiQrCode = "WIFI:S:" + Config.get('users_pdf_wlan_ssid').value + // wlan access data
";T:" + Config.get('users_pdf_wlan_encryption').value + var columnWifi = [
";P:" + Config.get('users_pdf_wlan_password').value + ";;";
var accessDataColumns = {
columns: [
{
stack: [
{ {
text: gettextCatalog.getString("WLAN access data"), text: gettextCatalog.getString("WLAN access data"),
style: 'userDataHeading' style: 'userDataHeading'
@ -165,17 +160,28 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
}, },
{ {
text: "\n" text: "\n"
}
];
// wifi qr code
if (Config.get('users_pdf_wlan_ssid').value && Config.get('users_pdf_wlan_encryption').value) {
var wifiQrCode = "WIFI:S:" + Config.get('users_pdf_wlan_ssid').value +
";T:" + Config.get('users_pdf_wlan_encryption').value +
";P:" + Config.get('users_pdf_wlan_password').value + ";;";
columnWifi.push(
{
qr: wifiQrCode,
fit: 120,
margin: [0, 0, 0, 8]
}, },
{ {
qr: wifiQrCode text: gettextCatalog.getString("Scan this QR code to connect to WLAN."),
}, style: 'small'
{ }
text: gettextCatalog.getString("scan QR code to connect to WLAN") );
}, }
]
}, // openslides access data
{ var columnOpenSlides = [
stack: [
{ {
text: gettextCatalog.getString("OpenSlides access data"), text: gettextCatalog.getString("OpenSlides access data"),
style: 'userDataHeading' style: 'userDataHeading'
@ -207,15 +213,27 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
}, },
{ {
text: "\n" text: "\n"
},
{
qr: Config.get('users_pdf_url').value
},
{
text: gettextCatalog.getString("scan QR code to open the URL")
},
]
} }
];
// url qr code
if (Config.get('users_pdf_url').value) {
columnOpenSlides.push(
{
qr: Config.get('users_pdf_url').value,
fit: 120,
margin: [0, 0, 0, 8]
},
{
text: gettextCatalog.getString("Scan this QR code to open URL."),
style: 'small'
}
);
}
var accessDataColumns = {
columns: [
columnWifi,
columnOpenSlides,
], ],
margin: [0, 20] margin: [0, 20]
}; };

View File

@ -681,7 +681,8 @@ angular.module('OpenSlidesApp.users.site', [
var userAccessDataListContentProvider = UserAccessDataListContentProvider.createInstance( var userAccessDataListContentProvider = UserAccessDataListContentProvider.createInstance(
$scope.usersFiltered, $scope.groups, Config); $scope.usersFiltered, $scope.groups, Config);
var documentProvider = PdfMakeDocumentProvider.createInstance(userAccessDataListContentProvider); var documentProvider = PdfMakeDocumentProvider.createInstance(userAccessDataListContentProvider);
pdfMake.createPdf(documentProvider.getDocument()).download(filename); var noFooter = true;
pdfMake.createPdf(documentProvider.getDocument(noFooter)).download(filename);
}; };
// Export as a csv file // Export as a csv file
$scope.csvExport = function () { $scope.csvExport = function () {