Focus in Admin-Masken setzen; DB-Super-User aus Auth-DB-Konfiguration vorbelegen
[kivitendo-erp.git] / templates / webpages / admin / edit_group.html
index 88ced6a..6313717 100644 (file)
-[%- USE T8 %]
-[% USE HTML %]<body>
- <form name="Form" method="post" action="admin.pl">
-
-  <input type="hidden" name="group_id" value="[% HTML.escape(group_id) %]">
-  <input type="hidden" name="back_nextsub" value="edit_groups">
-
-  [% IF message %]
-  <p class="message_ok">[% message %]</p>
-  [% END %]
-
-  <div class="listtop">[% 'Edit group ' | $T8 %]:  [% HTML.escape(name) %]</div>
-
-  <p><input type="submit" class="submit" name="action" value="[% 'Back' | $T8 %]"></p>
-
-   <hr>
-
-   <p class="listheading">[% 'Rename the group' | $T8 %]</p>
-   <table>
-     <tr><td><div style="">[% 'Name' | $T8 %]</th><td><input name="name" maxlength="50" value="[% HTML.escape(name) %]"></td></tr>
-        <tr><th>[% 'Description' | $T8 %]</th><td><input name="description" value="[% HTML.escape(description) %]"></td></tr>
-   </table>
-   <br>
-     <input type="hidden" name="save_nextsub" value="save_group">
-     <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
-
- <hr>
- <br>
- <div class="listtop">[% 'Group membership' | $T8 %]</div>
-     <table>
-      <tr>
-       <td><p class="listheading">[% 'Members of' | $T8 %]<br>[% HTML.escape(name) %]</p></td>
-       <td> </td>
-       <td><p class="listheading">[% 'Members not of' | $T8 %]<br>[% HTML.escape(name) %]</p></td>
-      </tr>
-
-      <tr>
-       <td valign="center">
-        <select name="user_id_in_group" size="10">
-         [% FOREACH user = USERS_IN_GROUP %]<option value="[% HTML.escape(user.id) %]">[% HTML.escape(user.login) %]</option>[% END %]
-        </select>
-       </td>
-
-       <td valign="center">
-        <input type="submit" class="submit" name="action" value="[% 'Add to group' | $T8 %]">
-        <br>
-        <br>
-        <input type="submit" class="submit" name="action" value="[% 'Remove from group' | $T8 %]">
-       </td>
-
-       <td valign="center">
-        <select name="user_id_not_in_group" size="10">
-         [% FOREACH user = USERS_NOT_IN_GROUP %]<option value="[% HTML.escape(user.id) %]">[% HTML.escape(user.login) %]</option>[% END %]
-        </select>
-       </td>
-      </tr>
-     </table>
- <hr>
- <br>
-    <div class="listtop">[% 'Edit rights' | $T8 %]</div>
-
-      [% FOREACH right = RIGHTS %]
-
-        [% IF right.is_section %]
-        <br>
-        <h4 style="border-bottom: solid; border-bottom-width: 1px; border-bottom-color: #ddd;">[% right.description %]</h4>
-        [% ELSE %]
-        <p style="/*font-size: 11px;*/ margin: 0;">
-        <input type="checkbox" name="[% HTML.escape(right.right) %]_granted" id="[% HTML.escape(right.right) %]_granted" [% IF right.granted %]checked[% END %]>
-        <label for="[% HTML.escape(right.right) %]_granted">[% IF right.description %][% right.description %][% ELSE %]<i>[% HTML.escape(right.right) %]</i>[% END %]</label>
-         </p>
-        [% END %]
-
-      [% END %]
-
-   <hr>
-    <input type="hidden" name="save_nextsub" value="save_group">
-    <input type="submit" class="submit" name="action" value="[% 'Back' | $T8 %]">
-    <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
- </form>
-</body>
-</html>
+[%- USE HTML %]
+[%- USE L %][%- USE LxERP -%]
+
+[%- INCLUDE 'common/flash.html' %]
+
+<h1>[% HTML.escape(title) %]</h1>
+
+<p>[% L.link(SELF.url_for(action="show"), LxERP.t8("Back")) %]</p>
+
+<form method="post" action="controller.pl" id="form">
+ [% L.hidden_tag("group.id", SELF.group.id) %]
+ [% L.hidden_tag("action", "") %]
+
+ <h2>[%- LxERP.t8("Settings") %]</h2>
+
+ <table>
+  <tr>
+   <th align="right">[% LxERP.t8('Name') %]</th>
+   <td>[% L.input_tag("group.name", SELF.group.name, class="initial_focus") %]</td>
+  </tr>
+
+  <tr>
+   <th align="right">[% LxERP.t8('Description') %]</th>
+   <td>[% L.input_tag("group.description", SELF.group.description) %]</td>
+  </tr>
+ </table>
+
+ <h2>[% LxERP.t8("Access rights") %]</h2>
+
+ [% SET granted_rights = SELF.group.rights_map %]
+
+ [%- FOREACH section = SELF.all_rights %]
+  [% SET section_number = loop.count %]
+  [% SET num_checked = 0 %]
+  [% FOREACH right = section.rights %][% SET name = right.name %][% IF granted_rights.$name %][% SET num_checked = num_checked + 1 %][% END %][% END %]
+  <h3>[% L.checkbox_tag('dummy' _ section_number, label=LxERP.t8('Section "#1"', section.description), checkall='[.checkallgroup' _ section_number _ ']', checked=(num_checked == section.rights.size)) %]</h3>
+
+  <div class="clearfix">
+   [% FOREACH right = section.rights %]
+    [% SET name = right.name %]
+    [% L.checkbox_tag("group.rights_map." _ name, label=right.description, checked=granted_rights.$name, class="checkallgroup" _ section_number) %]
+    <br>
+   [%- END %]
+  </div>
+ [%- END %]
+
+ <h2>[%- LxERP.t8("Group membership") %]</h2>
+
+[% IF SELF.all_users.size %]
+ <p>
+  [%- LxERP.t8("The following users are a member of this group") %]:
+ </p>
+
+ <div class="clearfix">
+  [% L.select_tag("group.users[]", SELF.all_users, id="group_users", title_key="login", default=SELF.group.users, default_value_key='id', multiple=1) %]
+  [% L.multiselect2side("group_users", labelsx => LxERP.t8("All users"), labeldx => LxERP.t8("Users that are a member in this group")) %]
+ </div>
+
+[%- ELSE %]
+ <p>
+  [% LxERP.t8("No users have been created yet.") %]
+ </p>
+[%- END %]
+
+ <h2>[%- LxERP.t8("Group assignment") %]</h2>
+
+[% IF SELF.all_clients.size %]
+ <p>
+  [%- LxERP.t8("This group is valid for the following clients") %]:
+ </p>
+
+ <div class="clearfix">
+  [% L.select_tag("group.clients[]", SELF.all_clients, id="group_clients", title_key="name", default=SELF.group.clients, default_value_key='id', multiple=1) %]
+  [% L.multiselect2side("group_clients", labelsx => LxERP.t8("All clients"), labeldx => LxERP.t8("Clients this Group is valid for")) %]
+ </div>
+
+[%- ELSE %]
+ <p>
+  [% LxERP.t8("No clients have been created yet.") %]
+ </p>
+[%- END %]
+
+<hr size="3" noshade>
+
+<p>
+ [% L.link(SELF.url_for(action="show"), LxERP.t8("Back")) %]
+
+ [% L.button_tag("submit_with_action('save_group')", LxERP.t8("Save")) %]
+ [% IF SELF.group.id %]
+  [% L.button_tag("save_as_new()", LxERP.t8("Save as new")) %]
+  [% L.button_tag("submit_with_action('delete_group')", LxERP.t8("Delete"), confirm=LxERP.t8("Are you sure?")) %]
+ [%- END %]
+</p>
+
+</form>
+
+<script type="text/javascript">
+ <!--
+  function submit_with_action(action) {
+    $("#action").val("Admin/" + action);
+    $("#form").submit();
+  }
+
+  function save_as_new() {
+    var new_group_name = prompt("[% LxERP.t8("Please enter the name for the new group.") %]", "");
+    if (!new_group_name)
+      return;
+
+    $("#group_name").val(new_group_name);
+    $("#group_id").val("");
+    submit_with_action("save_group");
+  }
+   -->
+</script>