jQuery-Selektoren für checkall & DB-Verbindungstest gefixt
[kivitendo-erp.git] / templates / webpages / admin / edit_client.html
1 [%- USE HTML %]
2 [%- USE L %][%- USE LxERP -%]
3
4 [%- INCLUDE 'common/flash.html' %]
5
6 <h1>[% HTML.escape(title) %]</h1>
7
8 <p>[% L.link(SELF.url_for(action="show"), LxERP.t8("Back")) %]</p>
9
10 <form method="post" action="controller.pl" id="form">
11  [% L.hidden_tag("client.id", SELF.client.id) %]
12  [% L.hidden_tag("action", "") %]
13
14  <h2>[%- LxERP.t8("Settings") %]</h2>
15
16  <table>
17 [%- IF SELF.client.id %]
18   <tr>
19    <th align="right">[% LxERP.t8('Database ID') %]</th>
20    <td>[%- HTML.escape(SELF.client.id) %]</td>
21   </tr>
22 [%- END %]
23
24   <tr>
25    <th align="right">[% LxERP.t8('Client name') %]</th>
26    <td>[% L.input_tag("client.name", SELF.client.name, class="initial_focus") %]</td>
27   </tr>
28
29   <tr>
30    <th align="right">[% LxERP.t8('Default client') %]</th>
31    <td>[% L.checkbox_tag("client.is_default", label=LxERP.t8('This is the client to be selected by default on the login screen.'), checked=SELF.client.is_default) %]</td>
32   </tr>
33
34   <tr>
35    <th align="right">[% LxERP.t8('Database name') %]</th>
36    <td>[% L.input_tag("client.dbname", SELF.client.dbname, class="contains_dbsettings") %]</td>
37   </tr>
38
39   <tr>
40    <th align="right">[% LxERP.t8('Database host and port') %]</th>
41    <td>
42     [% L.input_tag("client.dbhost", SELF.client.dbhost, class="contains_dbsettings") %]
43     [% L.input_tag("client.dbport", SELF.client.dbport, class="contains_dbsettings", size=6) %]
44    </td>
45   </tr>
46
47   <tr>
48    <th align="right">[% LxERP.t8('Database user and password') %]</th>
49    <td>
50     [% L.input_tag("client.dbuser",   SELF.client.dbuser, class="contains_dbsettings") %]
51     [% L.input_tag("client.dbpasswd", SELF.client.dbpasswd, class="contains_dbsettings") %]
52    </td>
53   </tr>
54  </table>
55
56  <div>
57   [% L.button_tag("test_database_connectivity()", LxERP.t8("Test database connectivity")) %]
58  </div>
59
60  <h2>[%- LxERP.t8("Access to clients") %]</h2>
61
62 [% IF SELF.all_users.size %]
63  <p>
64   [%- LxERP.t8("The following users will have access to this client") %]:
65  </p>
66
67  <div class="clearfix">
68   [% L.select_tag("client.users[]", SELF.all_users, id="client_users", title_key="login", default=SELF.client.users, default_value_key='id', multiple=1) %]
69   [% L.multiselect2side("client_users", labelsx => LxERP.t8("All users"), labeldx => LxERP.t8("Users that have access to this client")) %]
70  </div>
71
72 [%- ELSE %]
73  <p>
74   [% LxERP.t8("No users have been created yet.") %]
75  </p>
76 [%- END %]
77
78  <h2>[%- LxERP.t8("Group assignment") %]</h2>
79
80 [% IF SELF.all_groups.size %]
81  <p>
82   [%- LxERP.t8("The following groups are valid for this client") %]:
83  </p>
84
85  <div class="clearfix">
86   [% L.select_tag("client.groups[]", SELF.all_groups, id="client_groups", title_key="name", default=SELF.client.groups, default_value_key='id', multiple=1) %]
87   [% L.multiselect2side("client_groups", labelsx => LxERP.t8("All groups"), labeldx => LxERP.t8("Groups valid for this client")) %]
88  </div>
89
90 [%- ELSE %]
91  <p>
92   [% LxERP.t8("No groups have been created yet.") %]
93  </p>
94 [%- END %]
95
96 <hr size="3" noshade>
97
98 <p>
99  [% L.link(SELF.url_for(action="show"), LxERP.t8("Back")) %]
100
101  [% L.button_tag("submit_with_action('save_client')", LxERP.t8("Save")) %]
102  [% IF SELF.client.id %]
103   [% L.button_tag("save_as_new()", LxERP.t8("Save as new")) %]
104   [% L.button_tag("submit_with_action('delete_client')", LxERP.t8("Delete"), confirm=LxERP.t8("Are you sure?")) %]
105  [%- END %]
106 </p>
107
108 </form>
109
110 <script type="text/javascript">
111  <!--
112   function submit_with_action(action) {
113     $("#action").val("Admin/" + action);
114     $("#form").submit();
115   }
116
117   function save_as_new() {
118     var new_client_name = prompt("[% LxERP.t8("Please enter the name for the new client.") %]", "");
119     if (!new_client_name)
120       return;
121
122     $("#client_name").val(new_client_name);
123     $("#client_id").val("");
124     submit_with_action("save_client");
125   }
126
127   function test_database_connectivity() {
128     open_jqm_window({
129       url:  'controller.pl?action=Admin/test_database_connectivity',
130       data: $(".contains_dbsettings").serialize(),
131       type: 'POST',
132       id:   'test_db_connection_window'
133     });
134     return true;
135   }
136    -->
137 </script>