Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c0994930

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID c09949305174b431c257d35b5506aacbdcdbab13
  • Vorgänger 32fc2e88
  • Nachfolger 50365526

Gruppenmitgliedschaft via multiselect2side bearbeiten & Cleanup

Conflicts:

locale/de/all
templates/webpages/admin/edit_group.html

Unterschiede anzeigen:

bin/mozilla/admin_groups.pl
73 73
  $form->isblank('name', $locale->text('The group name is missing.'));
74 74

  
75 75
  my $groups = $main::auth->read_groups();
76
  my %users  = map { ( $_->{id} => 1 ) } values %{ { $::auth->read_all_users() } };
76 77

  
77 78
  foreach my $group (values %{$groups}) {
78 79
    if (($form->{group_id} != $group->{id})
......
92 93

  
93 94
  $group->{name}        = $form->{name};
94 95
  $group->{description} = $form->{description};
95
  $group->{rights}      = {};
96

  
97
  map { $group->{rights}->{$_} = $form->{"${_}_granted"} ? 1 : 0 } SL::Auth::all_rights();
96
  $group->{rights}      = { map { ( $_ => $form->{"${_}_granted"} ? 1 : 0 ) } SL::Auth::all_rights() };
97
  $group->{members}     = [ grep { $users{$_} } @{ $form->{user_ids} || [] } ];
98 98

  
99 99
  my $is_new = !$form->{group_id};
100 100

  
......
124 124
    $form->show_generic_error($locale->text("No group has been selected, or the group does not exist anymore."));
125 125
  }
126 126

  
127
  my $group = $groups->{$form->{group_id}};
128

  
129
  my %all_users   = $main::auth->read_all_users();
130
  my %users_by_id = map { $_->{id} => $_ } values %all_users;
131

  
132
  my @members     = uniq sort { lc $a->{login} cmp lc $b->{login} } @users_by_id{ @{ $group->{members} } };
133

  
134
  my %grouped     = map { $_ => 1 } uniq @{ $group->{members} };
135
  my @non_members = sort { lc $a->{login} cmp lc $b->{login} } grep { !$grouped{$_->{id}} } values %all_users;
136

  
137
  my @rights = map {
127
  my $group     = $groups->{$form->{group_id}};
128
  my %all_users = $main::auth->read_all_users();
129
  my @rights    = map {
138 130
    { "right"       => $_->[0],
139 131
      "description" => $_->[1],
140 132
      "is_section"  => '--' eq substr($_->[0], 0, 2),
......
143 135
  } SL::Auth::all_rights_full();
144 136

  
145 137
  $form->header();
146
  print $form->parse_html_template("admin/edit_group", { "USERS_IN_GROUP"     => \@members,
147
                                                         "USERS_NOT_IN_GROUP" => \@non_members,
138
  print $form->parse_html_template("admin/edit_group", { ALL_USERS            => [ values %all_users ],
139
                                                         USER_IDS_IN_GROUP    => $group->{members},
148 140
                                                         "RIGHTS"             => \@rights,
149 141
                                                         "name"               => $group->{name},
150 142
                                                         "description"        => $group->{description} });
......
179 171
  $main::lxdebug->leave_sub();
180 172
}
181 173

  
182
sub add_to_group {
183
  $main::lxdebug->enter_sub();
184

  
185
  my $form     = $main::form;
186
  my $locale   = $main::locale;
187

  
188
  $form->isblank('user_id_not_in_group', $locale->text('No user has been selected.'));
189

  
190
  my $groups = $main::auth->read_groups();
191

  
192
  if (!$form->{group_id} || !$groups->{$form->{group_id}}) {
193
    $form->show_generic_error($locale->text('No group has been selected, or the group does not exist anymore.'));
194
  }
195

  
196
  my $group = $groups->{$form->{group_id}};
197
  $group->{members} = [ uniq @{ $group->{members} }, $form->{user_id_not_in_group} ];
198

  
199
  $main::auth->save_group($group);
200

  
201
  $form->{message} = $locale->text('The user has been added to this group.');
202
  edit_group();
203

  
204
  $main::lxdebug->leave_sub();
205
}
206

  
207
sub remove_from_group {
208
  $main::lxdebug->enter_sub();
209

  
210
  my $form     = $main::form;
211
  my $locale   = $main::locale;
212

  
213
  $form->isblank('user_id_in_group', $locale->text('No user has been selected.'));
214

  
215
  my $groups = $main::auth->read_groups();
216

  
217
  if (!$form->{group_id} || !$groups->{$form->{group_id}}) {
218
    $form->show_generic_error($locale->text('No group has been selected, or the group does not exist anymore.'));
219
  }
220

  
221
  my $group            = $groups->{$form->{group_id}};
222
  $group->{members} = [ uniq grep { $_ ne $form->{user_id_in_group} } @{ $group->{members} } ];
223

  
224
  $main::auth->save_group($group);
225

  
226
  $form->{message} = $locale->text('The user has been removed from this group.');
227
  edit_group();
228

  
229
  $main::lxdebug->leave_sub();
230
}
231

  
232 174
sub edit_group_membership {
233 175
  $main::lxdebug->enter_sub();
234 176

  
locale/de/all
169 169
  'All of the exports you have selected were already closed.' => 'Alle von Ihnen ausgewählten Exporte sind bereits abgeschlossen.',
170 170
  'All reports'                 => 'Alle Berichte (Kontenübersicht, Summen- u. Saldenliste, GuV, BWA, Bilanz, Projektbuchungen)',
171 171
  'All the selected exports have already been closed, or all of their items have already been executed.' => 'Alle ausgewählten Exporte sind als abgeschlossen markiert, oder für alle Einträge wurden bereits Zahlungen verbucht.',
172
  'All users'                   => 'Alle BenutzerInnen',
172 173
  'Allow access'                => 'Zugriff erlauben',
173 174
  'Allow the following users access to my follow-ups:' => 'Erlaube den folgenden Benutzern Zugriff auf meine Wiedervorlagen:',
174 175
  'Alternatively you can create a new part which will then be selected.' => 'Sie können auch einen neuen Artikel anlegen, der dann automatisch ausgewählt wird.',
......
667 668
  'Edit group '                 => 'Gruppe bearbeiten',
668 669
  'Edit group membership'       => 'Gruppenmitgliedschaften bearbeiten',
669 670
  'Edit groups'                 => 'Gruppen bearbeiten',
671
  'Edit membership'             => 'Mitgliedschaft bearbeiten',
670 672
  'Edit note'                   => 'Notiz bearbeiten',
671 673
  'Edit rights'                 => 'Rechte bearbeiten',
672 674
  'Edit templates'              => 'Vorlagen bearbeiten',
......
1089 1091
  'No transaction selected!'    => 'Keine Transaktion ausgewählt',
1090 1092
  'No transfers were executed in this export.' => 'In diesem SEPA-Export wurden keine Überweisungen ausgeführt.',
1091 1093
  'No unknown units where found.' => 'Es wurden keine unbekannten Einheiten gefunden.',
1092
  'No user has been selected.'  => 'Es wurde kein Benutzer ausgewählt.',
1093 1094
  'No valid number entered for pricegroup "#1".' => 'Für Preisgruppe "#1" wurde keine gültige Nummer eingegeben.',
1094 1095
  'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
1095 1096
  'No warehouse has been created yet or the quantity of the bins is not configured yet.' => 'Es wurde noch kein Lager angelegt, bzw. die dazugehörigen Lagerplätze sind noch nicht konfiguriert.',
......
1357 1358
  'Remove'                      => 'Entfernen',
1358 1359
  'Remove Draft'                => 'Entwurf löschen',
1359 1360
  'Remove draft when posting'   => 'Entwurf beim Buchen löschen',
1360
  'Remove from group'           => 'Aus Gruppe entfernen',
1361 1361
  'Removed spoolfiles!'         => 'Druckdateien entfernt!',
1362 1362
  'Removing marked entries from queue ...' => 'Markierte Einträge werden von der Warteschlange entfernt ...',
1363 1363
  'Rename the group'            => 'Gruppe umbenennen',
......
1697 1697
  'The unit in row %d has been deleted in the meantime.' => 'Die Einheit in Zeile %d ist in der Zwischentzeit gelöscht worden.',
1698 1698
  'The unit in row %d has been used in the meantime and cannot be changed anymore.' => 'Die Einheit in Zeile %d wurde in der Zwischenzeit benutzt und kann nicht mehr geändert werden.',
1699 1699
  'The units have been saved.'  => 'Die Einheiten wurden gespeichert.',
1700
  'The user has been added to this group.' => 'Der Benutzer wurde der Gruppe hinzugefügt.',
1701
  'The user has been removed from this group.' => 'Der Benutzer wurde aus der Gruppe entfernt.',
1702 1700
  'The user is a member in the following group(s):' => 'Der Benutzer ist Mitglied in den folgenden Gruppen:',
1703 1701
  'The user migration process is complete.' => 'Der Prozess der Benutzerdatenmigration ist abgeschlossen.',
1704 1702
  'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => 'Der Variablenname darf nur aus Zeichen (keine Umlaute), Ziffern und Unterstrichen bestehen. Er muss mit einem Buchstaben beginnen. Beispiel: weihnachtsgruss_verschicken',
......
1837 1835
  'User name'                   => 'Benutzername',
1838 1836
  'User saved!'                 => 'Benutzer gespeichert!',
1839 1837
  'Username'                    => 'Benutzername',
1838
  'Users in this group'         => 'BenutzerInnen in dieser Gruppe',
1840 1839
  'Ust-IDNr'                    => 'USt-IdNr.',
1841 1840
  'Valid from'                  => 'Gültig ab',
1842 1841
  'Valid until'                 => 'gültig bis',
templates/webpages/admin/edit_group.html
1
[%- USE T8 %]
2
[% USE HTML %]<body>
3
 <form name="Form" method="post" action="admin.pl">
4

  
5
  <input type="hidden" name="group_id" value="[% HTML.escape(group_id) %]">
6
  <input type="hidden" name="back_nextsub" value="edit_groups">
1
[% USE T8 %][% USE HTML %][% USE L %][% USE LxERP -%]
2
<body>
3
 [% L.stylesheet_tag('jquery.multiselect2side') %]
4
 [% L.javascript_tag('jquery.selectboxes', 'jquery.multiselect2side') %]
7 5

  
6
 <form name="Form" method="post" action="admin.pl">
8 7
  [% IF message %]
9 8
  <p class="message_ok">[% message %]</p>
10 9
  [% END %]
......
15 14

  
16 15
   <hr>
17 16

  
18
   <p class="listheading">[% 'Rename the group' | $T8 %]</p>
19
   <table>
20
     <tr><td><div style="">[% 'Name' | $T8 %]</th><td><input name="name" maxlength="50" value="[% HTML.escape(name) %]"></td></tr>
21
	 <tr><th>[% 'Description' | $T8 %]</th><td><input name="description" value="[% HTML.escape(description) %]"></td></tr>
22
   </table>
23
   <br>
24
     <input type="hidden" name="save_nextsub" value="save_group">
25
     <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
26

  
27
 <hr>
28
 <br>
29
 <div class="listtop">[% 'Group membership' | $T8 %]</div>
30
     <table>
31
      <tr>
32
       <td><p class="listheading">[% 'Members of' | $T8 %]<br>[% HTML.escape(name) %]</p></td>
33
       <td> </td>
34
       <td><p class="listheading">[% 'Members not of' | $T8 %]<br>[% HTML.escape(name) %]</p></td>
35
      </tr>
36

  
37
      <tr>
38
       <td valign="center">
39
        <select name="user_id_in_group" size="10">
40
         [% FOREACH user = USERS_IN_GROUP %]<option value="[% HTML.escape(user.id) %]">[% HTML.escape(user.login) %]</option>[% END %]
41
        </select>
42
       </td>
43

  
44
       <td valign="center">
45
        <input type="submit" class="submit" name="action" value="[% 'Add to group' | $T8 %]">
46
        <br>
47
        <br>
48
        <input type="submit" class="submit" name="action" value="[% 'Remove from group' | $T8 %]">
49
       </td>
50

  
51
       <td valign="center">
52
        <select name="user_id_not_in_group" size="10">
53
         [% FOREACH user = USERS_NOT_IN_GROUP %]<option value="[% HTML.escape(user.id) %]">[% HTML.escape(user.login) %]</option>[% END %]
54
        </select>
55
       </td>
56
      </tr>
57
     </table>
58
 <hr>
59
 <br>
60
    <div class="listtop">[% 'Edit rights' | $T8 %]</div>
61

  
62
      [% FOREACH right = RIGHTS %]
63

  
64
        [% IF right.is_section %]
65
        <br>
66
        <h4 style="border-bottom: solid; border-bottom-width: 1px; border-bottom-color: #ddd;">[% right.description %]</h4>
67
        [% ELSE %]
68
        <p style="/*font-size: 11px;*/ margin: 0;">
69
        <input type="checkbox" name="[% HTML.escape(right.right) %]_granted" id="[% HTML.escape(right.right) %]_granted" [% IF right.granted %]checked[% END %]>
70
        <label for="[% HTML.escape(right.right) %]_granted">[% IF right.description %][% right.description %][% ELSE %]<i>[% HTML.escape(right.right) %]</i>[% END %]</label>
71
         </p>
72
        [% END %]
73

  
74
      [% END %]
75

  
76
   <hr>
77
    <input type="hidden" name="save_nextsub" value="save_group">
78
    <input type="submit" class="submit" name="action" value="[% 'Back' | $T8 %]">
79
    <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
17
  <h3 class="listheading">[%- LxERP.t8('Edit membership') %]</h3>
18

  
19
  <div class="clearfix">
20
   [% L.select_tag("user_ids[]", L.options_for_select(ALL_USERS, value => 'id', title => 'login', default => USER_IDS_IN_GROUP), 'multiple' => 'multiple') %]
21
  </div>
22

  
23
  <h3 class="listheading">[% 'Edit rights' | $T8 %]</h3>
24

  
25
  <p>
26
   [% FOREACH right = RIGHTS %]
27
    [% IF right.is_section %]
28
     <i>[% right.description %]</i><br>
29
    [% ELSE %]
30
     <input type="checkbox" name="[% HTML.escape(right.right) %]_granted" id="[% HTML.escape(right.right) %]_granted" [% IF right.granted %]checked[% END %]>
31
     <label for="[% HTML.escape(right.right) %]_granted">[% IF right.description %][% right.description %][% ELSE %]<i>[% HTML.escape(right.right) %]</i>[% END %]</label>
32
     <br>
33
    [% END %]
34
   [% END %]
35
  </p>
36

  
37
  <h3 class="listheading">[% LxERP.t8('Rename the group') %]</h3>
38

  
39
  <table>
40
   <tr>
41
    <td>[% 'Name' | $T8 %]:</td>
42
    <td><input name="name" maxlength="50" value="[% HTML.escape(name) %]"></td>
43
   </tr>
44

  
45
   <tr>
46
    <td>[% 'Description' | $T8 %]:</td>
47
    <td><input name="description" value="[% HTML.escape(description) %]"></td>
48
   </tr>
49
  </table>
50

  
51
  <p>
52
   <input type="hidden" name="group_id" value="[% HTML.escape(group_id) %]">
53
   <input type="hidden" name="action" value="save_group">
54
   <input type="submit" class="submit" value="[% 'Save' | $T8 %]">
55
   &nbsp;
56
   <a href="admin.pl?action=edit_groups">[% 'Back' | $T8 %]</a>
57
  </p>
80 58
 </form>
59

  
60
 [% L.multiselect2side('user_ids_', labelsx => LxERP.t8('All users'), labeldx => LxERP.t8('Users in this group')) %]
81 61
</body>
82 62
</html>

Auch abrufbar als: Unified diff