Datenbank löschen: auch benutzte auswählbar, dann aber mit Sonderwarnung
[kivitendo-erp.git] / templates / webpages / admin / delete_dataset.html
1 [%- USE HTML %][%- USE LxERP -%][%- USE L -%][%- USE JavaScript -%]
2
3 [% INCLUDE 'common/flash.html' %]
4
5 <h1>[% HTML.escape(title) %]</h1>
6
7 <p><a href="controller.pl?action=Admin/database_administration">[% LxERP.t8('Back') %]</a></p>
8
9 <p>
10  [% LxERP.t8('You can only delete datasets that are not in use.') %]
11  [% LxERP.t8('If you want to delete such a dataset you have to edit the client(s) that are using the dataset in question and have them use another dataset.') %]
12 </p>
13
14 [% IF SELF.all_dbsources.size %]
15
16 <form method="post" action="controller.pl">
17  <p>
18   [% LxERP.t8('Please select the dataset you want to delete:') %]
19   [% L.select_tag('db', SELF.all_dbsources, class="initial_focus") %]
20  </p>
21
22  [% L.hidden_tag("dbhost", FORM.dbhost) %]
23  [% L.hidden_tag("dbport", FORM.dbport) %]
24  [% L.hidden_tag("dbuser", FORM.dbuser) %]
25  [% L.hidden_tag("dbpasswd", FORM.dbpasswd) %]
26  [% L.hidden_tag("dbdefault", FORM.dbdefault) %]
27  [% L.hidden_tag("action", "Admin/do_delete_dataset") %]
28
29  <div>
30   [% L.submit_tag('dummy', LxERP.t8('Delete Dataset'), id='submit') %]
31  </div>
32
33 </form>
34
35 <script type="text/javascript">
36  <!--
37
38 var used_dbsources = {[% FOREACH client = SELF.all_clients %]
39   "[% JavaScript.escape(client.dbhost || 'localhost') %]:[% JavaScript.escape(client.dbport || '5432') %]:[% JavaScript.escape(client.dbname || 'localhost') %]": "[% JavaScript.escape(client.name) %]"[% UNLESS loop.last %],[% END %][% END %]
40 };
41
42 $(function() {
43   $('#submit').click(function() {
44     var client   = used_dbsources[$('#dbhost').val() + ':' + $('#dbport').val() + ':' + $('#db').val()];
45     var question = !client ? kivi.t8('Are you sure?') : kivi.t8('The selected database is still configured for client "#1". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?', [ client ]);
46
47     return confirm(question);
48   });
49 });
50
51    -->
52 </script>
53
54 [% END %]