Merge pull request #2810 from tsiegleauq/issue2665-qr-code-pdf

Add QR code in user access list pdf (fixes #2665)
This commit is contained in:
Norman Jäckel 2017-01-06 11:08:22 +01:00 committed by GitHub
commit c12d985ab6
4 changed files with 111 additions and 67 deletions

View File

@ -66,6 +66,7 @@ Users:
- Added new field 'is_committee' and new default group 'Committees'.
- Improved users CSV import (use group names instead of id).
- Added more multiselect actions.
- Added QR code in users access pdf.
Other:
- Django 1.10 is now supported. Dropped support for Django 1.8 and 1.9.

View File

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

View File

@ -128,10 +128,8 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
};
var createAccessDataContent = function(user) {
var accessDataColumns = {
columns: [
{
stack: [
// wlan access data
var columnWifi = [
{
text: gettextCatalog.getString("WLAN access data"),
style: 'userDataHeading'
@ -160,10 +158,30 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
text: Config.get('users_pdf_wlan_encryption').value || '-',
style: 'userDataValue'
},
]
{
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]
},
{
stack: [
text: gettextCatalog.getString("Scan this QR code to connect to WLAN."),
style: 'small'
}
);
}
// openslides access data
var columnOpenSlides = [
{
text: gettextCatalog.getString("OpenSlides access data"),
style: 'userDataHeading'
@ -193,10 +211,31 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
link: Config.get('users_pdf_url').value,
style: 'userDataValue'
},
]
{
text: "\n"
}
];
// 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]
};
return accessDataColumns;

View File

@ -681,7 +681,8 @@ angular.module('OpenSlidesApp.users.site', [
var userAccessDataListContentProvider = UserAccessDataListContentProvider.createInstance(
$scope.usersFiltered, $scope.groups, Config);
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
$scope.csvExport = function () {