From d987a1138d2cc2a8e89aaf60a0f7872a2bbded0b Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 28 Nov 2015 19:59:58 +0100 Subject: [PATCH] Added motion csv import (Fixes #1675) using pre-import checks and preview table. --- bower.json | 2 +- extras/csv-examples/motions-demo_de.csv | 42 ++--- extras/csv-examples/motions-demo_en.csv | 43 ++--- openslides/agenda/static/js/agenda/site.js | 3 +- openslides/core/static/css/app.css | 24 +++ openslides/motions/static/js/motions/site.js | 174 +++++++++++++++++- .../templates/motions/category-list.html | 7 +- .../templates/motions/motion-import.html | 140 ++++++++++++++ .../static/templates/motions/motion-list.html | 10 +- openslides/users/static/js/users/site.js | 3 +- .../static/templates/users/user-list.html | 4 +- 11 files changed, 375 insertions(+), 77 deletions(-) create mode 100644 openslides/motions/static/templates/motions/motion-import.html diff --git a/bower.json b/bower.json index bc7667e17..083640cb6 100644 --- a/bower.json +++ b/bower.json @@ -11,7 +11,7 @@ "angular-animate": "~1.4.7", "angular-sanitize": "~1.4.7", "angular-bootstrap": "~0.14.3", - "angular-csv-import": "~0.0.26", + "angular-csv-import": "~0.0.27", "angular-formly-templates-bootstrap": "~6.1.5", "angular-formly": "~7.3.2", "angular-loading-bar": "~0.8.0", diff --git a/extras/csv-examples/motions-demo_de.csv b/extras/csv-examples/motions-demo_de.csv index fc08e5a43..9081304bc 100644 --- a/extras/csv-examples/motions-demo_de.csv +++ b/extras/csv-examples/motions-demo_de.csv @@ -1,28 +1,16 @@ -"Bezeichner";"Titel";"Text";"Begründung";"Antragsteller";"Sachgebiet" -1;"Entlastung des Vorstandes";"Die Versammlung möge beschließen, den Vorstand für seine letzte Legislaturperiode zu entlasten.";"Bericht erfolgt mündlich.";"Vorstand"; -"SA 1";"Satzungsänderung § 2 Abs. 3";"

Die Versammlung möge beschließen, die Satzung in § 2 Abs. 3 wie folgt zu ändern:

-

Es wird vor dem Wort ""Zweck"" das Wort ""gemeinnütziger"" eingefügt.

";"Die Änderung der Satzung ist aufgrund der letzten Erfahrungen eine sinnvolle Maßnahme, weil ...";"Harry Holland";"Satzungsanträge" -"SA 2";"Einführung von elektronischen Abstimmungen mit OpenSlides";"Die Versammlung möge beschließen, die Satzung so zu ändern, dass öffentliche Abstimmungen künftig elektronisch mit OpenSlides durchgeführt werden können.";"Elektronische Abstimmungen beschleunigen den Ablauf. OpenSlides wird bereits bei uns eingesetzt und bietet ein zusätzliches Plugin, um mit Keypads für jeden Teilnehmer elektronisch abzustimmen. Die Ergebnisse werden direkt in OpenSlides gespeichert. Details gibts über den professional Support auf http://openslides.org.";"Dr. Max Mustermann";"Satzungsanträge" -"B 1";"Bildungspolitik 1 (HTML)";"

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

-

List:

- -

Onec pede just

-
0 1 2 3
-4 5 6 7
-

Bringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.

-

Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi.

";"

Nam eget dui.

+identifier,title,text,reason,submitter,category +1,Entlastung des Vorstandes,"Die Versammlung möge beschließen, den Vorstand für seine letzte Legislaturperiode zu entlasten.",Bericht erfolgt mündlich.,Vorstand, +SA 1,Satzungsänderung § 2 Abs. 3,"

Die Versammlung möge beschließen, die Satzung in § 2 Abs. 3 wie folgt zu ändern:

+

Es wird vor dem Wort ""Zweck"" das Wort ""gemeinnütziger"" eingefügt.

","Die Änderung der Satzung ist aufgrund der letzten Erfahrungen eine sinnvolle Maßnahme, weil ...",Harry Holland,Satzungsanträge +SA 2,Einführung von elektronischen Abstimmungen mit OpenSlides,"Die Versammlung möge beschließen, die Satzung so zu ändern, dass öffentliche Abstimmungen künftig elektronisch mit OpenSlides durchgeführt werden können.","Elektronische Abstimmungen beschleunigen den Ablauf. OpenSlides wird bereits bei uns eingesetzt und bietet ein zusätzliches Plugin, um mit Keypads für jeden Teilnehmer elektronisch abzustimmen. Die Ergebnisse werden direkt in OpenSlides gespeichert. Details gibts über den professional Support auf http://openslides.org.",Dr. Max Mustermann,Satzungsanträge +B 1,Bildungspolitik 1 (HTML),"

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

+

Ende.

","

Nam eget dui.

  1. Etiam rhoncus.
  2. Maecenas tempus
  3. tellus eget condimentum rhoncus
-

Sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.

";"Gipsz Jakab";"Bildung" -"B 2";"Bildungspolitik 2 (Plain)";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.";"Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.";"Fred Nurk";"Bildung" -"N 1";"OpenSlides für alle";"

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

- -

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

- -

Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?

";"www.openslides.org";"John Doe";"Netzpolitik" -"W 1";"Antrag zur Wirtschaftspolitik";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.";"But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?";"Mario Rossi";"Wirtschaft" -"W 2";"Finanzen";"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.";;"Otto Normalverbraucher";"Wirtschaft" -;"Soziale Fragen";"

The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack.

- -

Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! ""Now fax quiz Jack! "" my brave ghost pled.

";;"Otto Normalverbraucher";"Soziales" -;"Umweltpolitischer Leitantrag";"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.";"Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pro.";"Harry Holland";"Umwelt" -"B 3";"Bildung stärken";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.";;"Morten Meinigmand";"Bildung" +

Sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.

",Gipsz Jakab,Bildung +B 2,Bildungspolitik 2 (Plain),"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.","Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.",Fred Nurk,Bildung +N 1,OpenSlides für alle,"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",www.openslides.org,John Doe,Netzpolitik +W 1,Antrag zur Wirtschaftspolitik,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.","But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?",Mario Rossi,Wirtschaft +W 2,Finanzen,"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.",,Otto Normalverbraucher,Wirtschaft +,Soziale Fragen,"The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack.",,Otto Normalverbraucher,Soziales +,Umweltpolitischer Leitantrag,"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.","Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pro.",Harry Holland,Umwelt +B 3,Bildung stärken,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.",,Morten Meinigmand,Bildung diff --git a/extras/csv-examples/motions-demo_en.csv b/extras/csv-examples/motions-demo_en.csv index 6b60a09ce..288bc52f9 100644 --- a/extras/csv-examples/motions-demo_en.csv +++ b/extras/csv-examples/motions-demo_en.csv @@ -1,29 +1,16 @@ -"Identifier";"Title";"Text";"Reason";"Submitter";"Category" -1;"Discharge of the Executive Board";"The assembly may decide: discharge the Executive Board.";"Report will be oral.";"Executive board"; -"SA 1";"Statutory change § 2 Abs. 3";"

The assembly may decide: change statue § 2, 3 as follows:

-

It is inserted the word ""profit"" before the word ""purpose"".

";" -The changes of the articles is based on the last experience a meaningful measure because ...";"Harry Holland";"Statute" -"SA 2";"Introduction of electronic voting OpenSlides";"The Assembly may decide to amend the statute so that public votings can be conducted electronically with OpenSlides.";"Electronic votings increase the speed of meetings. OpenSlides is already used by us and offers an additional plugin to vote electronically with keypads for each participant. The results are stored directly in OpenSlides. See details about the professional support to http://openslides.org.";"Dr. Max Mustermann";"Statute" -"B 1";"Educational policy 1 (HTML)";"

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

-

List:

- -

Onec pede just

-
0 1 2 3
-4 5 6 7
-

Bringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.

-

Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi.

";"

Nam eget dui.

+identifier,title,text,reason,submitter,category +1,Discharge of the Executive Board,The assembly may decide: discharge the Executive Board.,Report will be oral.,Executive board, +SA 1,Statutory change § 2 Abs. 3,"The assembly may decide: change statue § 2, 3 as follows: It is inserted the word ""profit"" before the word ""purpose""."," +The changes of the articles is based on the last experience a meaningful measure because ...",Harry Holland,Statute +SA 2,Introduction of electronic voting OpenSlides,The Assembly may decide to amend the statute so that public votings can be conducted electronically with OpenSlides.,Electronic votings increase the speed of meetings. OpenSlides is already used by us and offers an additional plugin to vote electronically with keypads for each participant. The results are stored directly in OpenSlides. See details about the professional support to http://openslides.org.,Dr. Max Mustermann,Statute +B 1,Educational policy 1 (HTML),"

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

+

End.

","

Nam eget dui.

  1. Etiam rhoncus.
  2. Maecenas tempus
  3. tellus eget condimentum rhoncus
-

Sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.

";"Gipsz Jakab";"Education" -"B 2";"Educational policy 2 (Plain)";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.";"Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.";"Fred Nurk";"Education" -"N 1";"OpenSlides for everyone";"

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

- -

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

- -

Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?

";"www.openslides.org";"John Doe";"Network policy" -"W 1";"Motion about economic policy";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.";"But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?";"Mario Rossi";"Economy" -"W 2";"Finances";"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.";;"Otto Normalverbraucher";"Economy" -;"Social issues";"

The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack.

- -

Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! ""Now fax quiz Jack! "" my brave ghost pled.

";;"Otto Normalverbraucher";"Social" -;"Environmental executive report ";"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.";"Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pro.";"Harry Holland";"Environment" -"B 3";"Strengthen education";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.";;"Morten Meinigmand";"Education" +

Sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.

",Gipsz Jakab,Education +B 2,Educational policy 2 (Plain),"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.","Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.",Fred Nurk,Education +N 1,OpenSlides for everyone,"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",www.openslides.org,John Doe,Network policy +W 1,Motion about economic policy,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.","But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?",Mario Rossi,Economy +W 2,Finances,"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.",,Otto Normalverbraucher,Economy +,Social issues,"The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack.",,Otto Normalverbraucher,Social +,Environmental executive report ,"Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.","Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pro.",Harry Holland,Environment +B 3,Strengthen education,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.",,Morten Meinigmand,Education diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 4cb399c9b..42f6766d4 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -276,10 +276,9 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) .controller('AgendaImportCtrl', [ '$scope', - '$state', 'Agenda', 'Customslide', - function($scope, $state, Agenda, Customslide) { + function($scope, Agenda, Customslide) { // import from textarea $scope.importByLine = function () { $scope.items = $scope.itemlist[0].split("\n"); diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index 7c4c3abd9..8b061cc67 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -47,6 +47,11 @@ h3 { padding-bottom: 14px; } +h4 { + font-size: 18px; + color: #222; +} + p { padding-bottom: 14px; @@ -621,6 +626,24 @@ img { margin-bottom: 0; } +/* for angular-csv-import form */ +.import { + margin-left: 15px; +} + +.import .label { + color: #333 !important; + font-size: 100%; + font-weight: normal; + width: 100px; + text-align: left; + display: inline-block; +} + +.import .label::after { + content: ': '; +} + /* voting results */ .result_label { margin-top: 5px; @@ -639,6 +662,7 @@ img { padding: 0 10px 10px 10px; z-index: 99; } + #chatbox-text { overflow-y: scroll; height: 190px; diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 9d8c16e7c..e81d88df0 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -75,9 +75,20 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) }); }] }) - .state('motions.motion.csv-import', { - url: '/csv-import', - controller: 'MotionCSVImportCtrl', + .state('motions.motion.import', { + url: '/import', + controller: 'MotionImportCtrl', + resolve: { + motions: function(Motion) { + return Motion.findAll(); + }, + categories: function(Category) { + return Category.findAll(); + }, + users: function(User) { + return User.findAll(); + } + } }) // categories .state('motions.category', { @@ -560,9 +571,160 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) } ]) -.controller('MotionCSVImportCtrl', function($scope, Motion) { - // TODO -}) +.controller('MotionImportCtrl', [ + '$scope', + 'gettext', + 'Category', + 'Motion', + 'User', + function($scope, gettext, Category, Motion, User) { + // set initial data for csv import + $scope.motions = [] + $scope.separator = ','; + $scope.encoding = 'UTF-8'; + $scope.encodingOptions = ['UTF-8', 'ISO-8859-1']; + $scope.csv = { + content: null, + header: true, + headerVisible: false, + separator: $scope.separator, + separatorVisible: false, + encoding: $scope.encoding, + encodingVisible: false, + result: null + }; + // set csv file encoding + $scope.setEncoding = function () { + $scope.csv.encoding = $scope.encoding; + }; + // set csv file encoding + $scope.setSeparator = function () { + $scope.csv.separator = $scope.separator; + }; + // detect if csv file is loaded + $scope.$watch('csv.result', function () { + $scope.motions = []; + var quotionRe = /^"(.*)"$/; + angular.forEach($scope.csv.result, function (motion) { + if (motion.identifier) { + motion.identifier = motion.identifier.replace(quotionRe, '$1'); + if (motion.identifier != '') { + // All motion objects are already loaded via the resolve statement from ui-router. + var motions = Motion.getAll(); + if (_.find(motions, function (item) { + return item.identifier == motion.identifier; + })) { + motion.importerror = true; + motion.identifier_error = gettext('Error: Identifier already exists.'); + } + } + } + // title + if (motion.title) { + motion.title = motion.title.replace(quotionRe, '$1'); + } + if (!motion.title) { + motion.importerror = true; + motion.title_error = gettext('Error: Title is required.'); + } + // text + if (motion.text) { + motion.text = motion.text.replace(quotionRe, '$1'); + } + if (!motion.text) { + motion.importerror = true; + motion.text_error = gettext('Error: Text is required.'); + } + // reason + if (motion.reason) { + motion.reason = motion.reason.replace(quotionRe, '$1'); + } + // submitter + if (motion.submitter) { + motion.submitter = motion.submitter.replace(quotionRe, '$1'); + if (motion.submitter != '') { + // All user objects are already loaded via the resolve statement from ui-router. + var users = User.getAll(); + angular.forEach(users, function (user) { + if (user.short_name == motion.submitter) { + motion.submitters_id = [user.id]; + motion.submitter = User.get(user.id).full_name; + } + }); + } + } + if (motion.submitter && motion.submitter != '' && !motion.submitters_id) { + motion.submitter_create = gettext('New participant will be created.'); + } + // category + if (motion.category) { + motion.category = motion.category.replace(quotionRe, '$1'); + if (motion.category != '') { + // All categore objects are already loaded via the resolve statement from ui-router. + var categories = Category.getAll(); + angular.forEach(categories, function (category) { + // search for existing category + if (category.name == motion.category) { + motion.category_id = category.id; + motion.category = Category.get(category.id).name; + } + }); + } + } + if (motion.category && motion.category != '' && !motion.category_id) { + motion.category_create = gettext('New category will be created.'); + } + $scope.motions.push(motion); + }); + }); + + // import from csv file + $scope.import = function () { + $scope.csvImporting = true; + angular.forEach($scope.motions, function (motion) { + if (!motion.importerror) { + // create new user if not exist + if (!motion.submitters_id) { + var index = motion.submitter.indexOf(' '); + var user = { + first_name: motion.submitter.substr(0, index), + last_name: motion.submitter.substr(index+1), + groups: [] + } + User.create(user).then( + function(success) { + // set new user id + motion.submitters_id = [success.id]; + } + ); + } + // create new category if not exist + if (!motion.category_id) { + var category = { + name: motion.category, + prefix: motion.category.charAt(0) + } + Category.create(category).then( + function(success) { + // set new category id + motion.category_id = [success.id]; + } + ); + } + Motion.create(motion).then( + function(success) { + motion.imported = true; + } + ); + } + }); + $scope.csvimported = true; + }; + $scope.clear = function () { + $scope.csv.result = null; + }; + } +]) .controller('CategoryListCtrl', function($scope, Category) { Category.bindAll({}, $scope, 'categories'); diff --git a/openslides/motions/static/templates/motions/category-list.html b/openslides/motions/static/templates/motions/category-list.html index ad9234361..e7e5851ac 100644 --- a/openslides/motions/static/templates/motions/category-list.html +++ b/openslides/motions/static/templates/motions/category-list.html @@ -38,12 +38,7 @@ {{ category.prefix }} {{ category.name }} - - - - - + +
+ +

Import motions

+
+ + +
+ +
+
+

Select a CSV file +

+
+ + +
+ + + +
+
+ +

Please note:

+ + +
+

Preview

+ + + + + + +
+ # + Identifier + Title + Text + Reason + Submitter + Category
+ + + + + + + + + + + {{ $index + 1 }} + + + + + {{ motion.identifier }} + + + + + {{ motion.title }} + + + + + {{ motion.text | limitTo:80 }}{{ motion.text.length > 80 ? '...' : '' }} + {{ motion.reason | limitTo:80 }}{{ motion.reason.length > 80 ? '...' : '' }} + + + + + {{ motion.submitter }} + + + + + {{ motion.category }} +
+ +
+
+ + {{ motionsFailed.length }} + motions will be not imported. +
+
+
+ + {{ motions.length - motionsFailed.length }} + motions will be imported. +
+
+
+
+ + {{ motionsImported.length }} + motions were successfully imported. +
+ +
+ + +
+ +
+
diff --git a/openslides/motions/static/templates/motions/motion-list.html b/openslides/motions/static/templates/motions/motion-list.html index ae87a1e33..6b4058713 100644 --- a/openslides/motions/static/templates/motions/motion-list.html +++ b/openslides/motions/static/templates/motions/motion-list.html @@ -13,6 +13,10 @@ Tags + + + Import + PDF @@ -62,10 +66,10 @@
- Delete selected items + Delete selected motions
@@ -153,7 +157,7 @@ -

{{ motion.getTitle() }} – Quick Edit

+

{{ motion.getTitle() }} QuickEdit

{{alert.msg}} diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 525427782..e03313d8c 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -552,9 +552,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) .controller('UserImportCtrl', [ '$scope', - '$state', 'User', - function($scope, $state, User) { + function($scope, User) { // import from textarea $scope.importByLine = function () { $scope.users = $scope.userlist[0].split("\n"); diff --git a/openslides/users/static/templates/users/user-list.html b/openslides/users/static/templates/users/user-list.html index 861140ba6..7fd9ef00a 100644 --- a/openslides/users/static/templates/users/user-list.html +++ b/openslides/users/static/templates/users/user-list.html @@ -74,10 +74,10 @@
- Delete selected items + Delete selected participants