From 62310c83ae6d1b6f162a75732efb8896e8d0a6f5 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Thu, 2 Jun 2016 13:01:12 +0200 Subject: [PATCH] Limit selection of files to csv and txt (Fixed #2133) agenda, motions, users csv import --- AUTHORS | 1 + bower.json | 2 +- openslides/agenda/static/js/agenda/site.js | 2 ++ openslides/agenda/static/templates/agenda/item-import.html | 1 + openslides/motions/static/js/motions/site.js | 2 ++ openslides/motions/static/templates/motions/motion-import.html | 1 + openslides/users/static/js/users/site.js | 2 ++ openslides/users/static/templates/users/user-import.html | 1 + 8 files changed, 11 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 84ba80b4f..c633f61fc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,3 +19,4 @@ Authors of OpenSlides in chronological order of first contribution: Jörn Bensch (Template design) John Felipe Urrego Mejia (Spanish translation) Erik Steenman + Sean Engelhardt diff --git a/bower.json b/bower.json index a317e2b2d..4116dd8cb 100644 --- a/bower.json +++ b/bower.json @@ -8,7 +8,7 @@ "angular-bootstrap": "~0.14.3", "angular-bootstrap-colorpicker": "~3.0.24", "angular-chosen-localytics": "~1.4.0", - "angular-csv-import": "~0.0.27", + "angular-csv-import": "~0.0.29", "angular-formly": "~7.3.9", "angular-formly-templates-bootstrap": "~6.2.0", "angular-gettext": "~2.2.0", diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index ac14e1af3..4f31cff1e 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -417,6 +417,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) $scope.separator = ','; $scope.encoding = 'UTF-8'; $scope.encodingOptions = ['UTF-8', 'ISO-8859-1']; + $scope.accept = '.csv, .txt'; $scope.csv = { content: null, header: true, @@ -425,6 +426,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) separatorVisible: false, encoding: $scope.encoding, encodingVisible: false, + accept: $scope.accept, result: null }; // set csv file encoding diff --git a/openslides/agenda/static/templates/agenda/item-import.html b/openslides/agenda/static/templates/agenda/item-import.html index a5d77795e..72c094e75 100644 --- a/openslides/agenda/static/templates/agenda/item-import.html +++ b/openslides/agenda/static/templates/agenda/item-import.html @@ -59,6 +59,7 @@ Keep each item in a single line.

separator-visible="csv.separatorVisible" result="csv.result" encoding="csv.encoding" + accept="csv.accept" encoding-visible="csv.encodingVisible"> diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index bce883c97..f674b5bf1 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -824,6 +824,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) $scope.separator = ','; $scope.encoding = 'UTF-8'; $scope.encodingOptions = ['UTF-8', 'ISO-8859-1']; + $scope.accept = '.csv, .txt'; $scope.csv = { content: null, header: true, @@ -832,6 +833,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) separatorVisible: false, encoding: $scope.encoding, encodingVisible: false, + accept: $scope.accept, result: null }; // set csv file encoding diff --git a/openslides/motions/static/templates/motions/motion-import.html b/openslides/motions/static/templates/motions/motion-import.html index 6dec3882e..a5cf49078 100644 --- a/openslides/motions/static/templates/motions/motion-import.html +++ b/openslides/motions/static/templates/motions/motion-import.html @@ -31,6 +31,7 @@ separator-visible="csv.separatorVisible" result="csv.result" encoding="csv.encoding" + accept="csv.accept" encoding-visible="csv.encodingVisible"> diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 539ced2ba..12174a41a 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -688,6 +688,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) $scope.separator = ','; $scope.encoding = 'UTF-8'; $scope.encodingOptions = ['UTF-8', 'ISO-8859-1']; + $scope.accept = '.csv, .txt'; $scope.csv = { content: null, header: true, @@ -696,6 +697,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) separatorVisible: false, encoding: $scope.encoding, encodingVisible: false, + accept: $scope.accept, result: null }; // set csv file encoding diff --git a/openslides/users/static/templates/users/user-import.html b/openslides/users/static/templates/users/user-import.html index c3a81ee68..33cf78d55 100644 --- a/openslides/users/static/templates/users/user-import.html +++ b/openslides/users/static/templates/users/user-import.html @@ -59,6 +59,7 @@ separator="csv.separator" separator-visible="csv.separatorVisible" result="csv.result" + accept="csv.accept" encoding="csv.encoding" encoding-visible="csv.encodingVisible">