-[%- USE T8 %]
-[% USE HTML %]<body class="admin">
+[%- USE HTML %][%- USE LxERP -%][%- USE L -%][%- USE JavaScript -%]
- <h2>[% title %]</h2>
- <p><a href="admin.pl?action=pg_database_administration">[% 'Back' | $T8 %]</a></p>
- <form method="post" action="admin.pl">
+[% INCLUDE 'common/flash.html' %]
- <p>[% 'You can only delete datasets that are not in use.' | $T8 %]
- [% 'If you want to delete such a dataset you have to edit the user(s) that are using the dataset in question and have them use another dataset.' | $T8 %]</p>
+<h1>[% HTML.escape(title) %]</h1>
- <p>[% 'Please seletct the dataset you want to delete:' | $T8 %]
- <select name="db">[% FOREACH row = DBSOURCES %]<option>[% HTML.escape(row.name) %]</option>[% END %]</select>
- </p>
+<p>
+ [% LxERP.t8('You can only delete datasets that are not in use.') %]
+ [% 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.') %]
+</p>
- <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
- <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
- <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
- <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
- <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
- <input type="hidden" name="dbdefault" value="[% HTML.escape(dbdefault) %]">
+[% IF SELF.all_dbsources.size %]
- <input name="callback" type="hidden" value="admin.pl?action=list_users">
+<form method="post" action="controller.pl">
+ <p>
+ [% LxERP.t8('Please select the dataset you want to delete:') %]
+ [% L.select_tag('db', SELF.all_dbsources, class="initial_focus") %]
+ </p>
+ [% L.hidden_tag("dbhost", FORM.dbhost) %]
+ [% L.hidden_tag("dbport", FORM.dbport) %]
+ [% L.hidden_tag("dbuser", FORM.dbuser) %]
+ [% L.hidden_tag("dbpasswd", FORM.dbpasswd) %]
+ [% L.hidden_tag("dbdefault", FORM.dbdefault) %]
+ [% L.hidden_tag("action", "Admin/do_delete_dataset") %]
- <input type="hidden" name="nextsub" value="dbdelete">
+ <div>
+ [% L.submit_tag('dummy', LxERP.t8('Delete Dataset'), id='submit') %]
+ </div>
- <p><input type="submit" class="submit" name="action" value="[% 'Continue' | $T8 %]"></p>
+</form>
- </form>
+<script type="text/javascript">
+ <!--
-</body>
-</html>
+var used_dbsources = {[% FOREACH client = SELF.all_clients %]
+ "[% JavaScript.escape(client.dbhost || 'localhost') %]:[% JavaScript.escape(client.dbport || '5432') %]:[% JavaScript.escape(client.dbname || 'localhost') %]": "[% JavaScript.escape(client.name) %]"[% UNLESS loop.last %],[% END %][% END %]
+};
+
+$(function() {
+ $('#submit').click(function() {
+ var client = used_dbsources[$('#dbhost').val() + ':' + $('#dbport').val() + ':' + $('#db').val()];
+ 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 ]);
+
+ return confirm(question);
+ });
+});
+
+ -->
+</script>
+
+[% END %]