Merge pull request #2989 from emanuelschuetze/users-csv-import

Allowed to export/import initial user password.
This commit is contained in:
Emanuel Schütze 2017-02-22 16:57:44 +01:00 committed by GitHub
commit 7fb7bff7b1
4 changed files with 17 additions and 10 deletions

View File

@ -91,6 +91,7 @@ Users:
- Added new field for participant number. - Added new field for participant number.
- Added new field 'is_committee' and new default group 'Committees'. - Added new field 'is_committee' and new default group 'Committees'.
- Improved users CSV import (use group names instead of id). - Improved users CSV import (use group names instead of id).
- Allowed to import/export initial user password.
- Added more multiselect actions. - Added more multiselect actions.
- Added QR code in users access pdf. - Added QR code in users access pdf.

View File

@ -5,13 +5,14 @@
angular.module('OpenSlidesApp.users.csv', []) angular.module('OpenSlidesApp.users.csv', [])
.factory('UserCsvExport', [ .factory('UserCsvExport', [
'$filter',
'Group', 'Group',
'gettextCatalog', 'gettextCatalog',
'CsvDownload', 'CsvDownload',
function (Group, gettextCatalog, CsvDownload) { function ($filter, Group, gettextCatalog, CsvDownload) {
var makeHeaderline = function () { var makeHeaderline = function () {
var headerline = ['Title', 'Given name', 'Surname', 'Structure level', 'Participant number', 'Groups', var headerline = ['Title', 'Given name', 'Surname', 'Structure level', 'Participant number', 'Groups',
'Comment', 'Is active', 'Is present', 'Is a committee']; 'Comment', 'Is active', 'Is present', 'Is a committee', 'Initial password'];
return _.map(headerline, function (entry) { return _.map(headerline, function (entry) {
return gettextCatalog.getString(entry); return gettextCatalog.getString(entry);
}); });
@ -36,6 +37,7 @@ angular.module('OpenSlidesApp.users.csv', [])
row.push(user.is_active ? '1' : '0'); row.push(user.is_active ? '1' : '0');
row.push(user.is_present ? '1' : '0'); row.push(user.is_present ? '1' : '0');
row.push(user.is_committee ? '1' : '0'); row.push(user.is_committee ? '1' : '0');
row.push('"' + user.default_password + '"');
csvRows.push(row); csvRows.push(row);
}); });
CsvDownload(csvRows, 'users-export.csv'); CsvDownload(csvRows, 'users-export.csv');
@ -43,7 +45,7 @@ angular.module('OpenSlidesApp.users.csv', [])
downloadExample: function () { downloadExample: function () {
// try to get an example with two groups and one with one group // try to get an example with two groups and one with one group
var groups = Group.getAll(); var groups = $filter('orderBy')(Group.getAll(), 'id');
var csvGroups = ''; var csvGroups = '';
var csvGroup = ''; var csvGroup = '';
if (groups.length >= 3) { // do not pick groups[0], this is the default group if (groups.length >= 3) { // do not pick groups[0], this is the default group
@ -56,10 +58,10 @@ angular.module('OpenSlidesApp.users.csv', [])
var csvRows = [makeHeaderline(), var csvRows = [makeHeaderline(),
// example entries // example entries
['Dr.', 'Max', 'Mustermann', 'Berlin','1234567890', csvGroups, 'xyz', '1', '1', ''], ['Dr.', 'Max', 'Mustermann', 'Berlin','1234567890', csvGroups, 'xyz', '1', '1', '', ''],
['', 'John', 'Doe', 'Washington','75/99/8-2', csvGroup, 'abc', '1', '1', ''], ['', 'John', 'Doe', 'Washington','75/99/8-2', csvGroup, 'abc', '1', '1', '', ''],
['', 'Fred', 'Bloggs', 'London', '', '', '', '', '', ''], ['', 'Fred', 'Bloggs', 'London', '', '', '', '', '', '', ''],
['', '', 'Executive Board', '', '', '', '', '', '', '1'], ['', '', 'Executive Board', '', '', '', '', '', '', '1', ''],
]; ];
CsvDownload(csvRows, 'users-example.csv'); CsvDownload(csvRows, 'users-example.csv');

View File

@ -1029,7 +1029,7 @@ angular.module('OpenSlidesApp.users.site', [
}; };
var FIELDS = ['title', 'first_name', 'last_name', 'structure_level', 'number', var FIELDS = ['title', 'first_name', 'last_name', 'structure_level', 'number',
'groups', 'comment', 'is_active', 'is_present', 'is_committee']; 'groups', 'comment', 'is_active', 'is_present', 'is_committee', 'default_password'];
$scope.users = []; $scope.users = [];
$scope.onCsvChange = function (csv) { $scope.onCsvChange = function (csv) {
// All user objects are already loaded via the resolve statement from ui-router. // All user objects are already loaded via the resolve statement from ui-router.

View File

@ -57,7 +57,8 @@
<translate>Comment</translate>, <translate>Comment</translate>,
<translate>Is active</translate>, <translate>Is active</translate>,
<translate>Is present</translate>, <translate>Is present</translate>,
<translate>Is committee</translate> <translate>Is committee</translate>,
<translate>Initial password</translate>
</code> </code>
<li translate>At least given name or surname have to be filled in. All <li translate>At least given name or surname have to be filled in. All
other fields are optional and may be empty. other fields are optional and may be empty.
@ -82,7 +83,8 @@
<th translate>Comment <th translate>Comment
<th translate>Is active <th translate>Is active
<th translate>Is present <th translate>Is present
<th translate>Is committee</th> <th translate>Is committee
<th translate>Initial password</th>
<th ng-if="duplicates > 0"> <th ng-if="duplicates > 0">
<i class="fa fa-exclamation-triangle text-danger"></i> <i class="fa fa-exclamation-triangle text-danger"></i>
<strong class="text-danger" ng-if="duplicates == 1">1 <translate>duplicate</translate></strong> <strong class="text-danger" ng-if="duplicates == 1">1 <translate>duplicate</translate></strong>
@ -155,6 +157,8 @@
<td> <td>
<i class="fa pointer" ng-class="user.is_committee ? 'fa-check-square-o' : 'fa-square-o'" <i class="fa pointer" ng-class="user.is_committee ? 'fa-check-square-o' : 'fa-square-o'"
ng-click="user.is_committee = !user.is_committee"></i> ng-click="user.is_committee = !user.is_committee"></i>
<td>
{{ user.default_password }}
<td ng-if="duplicates > 0"> <td ng-if="duplicates > 0">
<div ng-if="user.duplicate" uib-tooltip="{{ user.duplicate_info }}" uib-dropdown> <div ng-if="user.duplicate" uib-tooltip="{{ user.duplicate_info }}" uib-dropdown>
<button id="UserAction{{ $index }}" type="button" class="btn btn-default btn-sm" <button id="UserAction{{ $index }}" type="button" class="btn btn-default btn-sm"