From 12a7cea9c3434848878d1a7b023dd47482cbb9b4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 31 Jan 2008 08:19:48 +0000 Subject: [PATCH] =?utf8?q?Administration:=20Einen=20Button=20zum=20Testen?= =?utf8?q?=20der=20Datenbankeinstellung=20in=20der=20Maske=20zur=20Bearbei?= =?utf8?q?tung=20der=20Benutzerdaten=20eingef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/admin.pl | 16 +++++++++++ js/common.js | 6 ++++ locale/de/admin | 2 ++ locale/de/all | 5 ++++ templates/webpages/admin/edit_user_de.html | 24 +++++++++++++++- .../webpages/admin/edit_user_master.html | 24 +++++++++++++++- .../webpages/admin/test_db_connection_de.html | 27 ++++++++++++++++++ .../admin/test_db_connection_master.html | 28 +++++++++++++++++++ 8 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 templates/webpages/admin/test_db_connection_de.html create mode 100644 templates/webpages/admin/test_db_connection_master.html diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index bd8a53206..4248a9c12 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -635,6 +635,22 @@ sub dbselect_source { print $form->parse_html_template("admin/dbadmin"); } +sub test_db_connection { + $form->{dbdriver} = 'Pg'; + User::dbconnect_vars($form, $form->{dbname}); + + my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}); + + $form->{connection_ok} = $dbh ? 1 : 0; + $form->{errstr} = $DBI::errstr; + + $dbh->disconnect() if ($dbh); + + $form->{title} = $locale->text('Database Connection Test'); + $form->header(); + print $form->parse_html_template("admin/test_db_connection"); +} + sub continue { call_sub($form->{"nextsub"}); } diff --git a/js/common.js b/js/common.js index a89fa02be..953dac7fb 100644 --- a/js/common.js +++ b/js/common.js @@ -147,3 +147,9 @@ function show_alert_and_focus(input_name, errorMessage) { return false; } +function get_input_value(input_name) { + var the_input = document.getElementsByName(input_name); + if (the_input && the_input[0]) + return the_input[0].value; + return ''; +} diff --git a/locale/de/admin b/locale/de/admin index a78f616aa..ada2b4d45 100644 --- a/locale/de/admin +++ b/locale/de/admin @@ -47,6 +47,7 @@ $self->{texts} = { 'DELETED' => 'Gelöscht', 'DUNNING STARTED' => 'Mahnprozess gestartet', 'Database Administration' => 'Datenbankadministration', + 'Database Connection Test' => 'Test der Datenbankverbindung', 'Database User missing!' => 'Datenbankbenutzer fehlt!', 'Database backups and restorations are disabled in lx-erp.conf.' => 'Datenbanksicherungen und -wiederherstellungen sind in der lx-erp.conf deaktiviert.', 'Dataset missing!' => 'Datenbank fehlt!', @@ -250,6 +251,7 @@ $self->{subs} = { 'set_longdescription' => 'set_longdescription', 'show_history' => 'show_history', 'show_vc_details' => 'show_vc_details', + 'test_db_connection' => 'test_db_connection', 'unlock_system' => 'unlock_system', 'update_dataset' => 'update_dataset', 'user_migration_complete' => 'user_migration_complete', diff --git a/locale/de/all b/locale/de/all index a44e670d0..8e433cb68 100644 --- a/locale/de/all +++ b/locale/de/all @@ -403,6 +403,7 @@ aktualisieren wollen?', 'DUNS-Nr' => 'DUNS-Nr.', 'Database' => 'Datenbank', 'Database Administration' => 'Datenbankadministration', + 'Database Connection Test' => 'Test der Datenbankverbindung', 'Database Host' => 'Datenbankcomputer', 'Database User missing!' => 'Datenbankbenutzer fehlt!', 'Database backups and restorations are disabled in lx-erp.conf.' => 'Datenbanksicherungen und -wiederherstellungen sind in der lx-erp.conf deaktiviert.', @@ -591,6 +592,7 @@ aktualisieren wollen?', 'Error in position #1: You must either assign no stock at all or the full quantity of #2 #3.' => 'Fehler in Position #1: Sie müssen einer Position entweder gar keinen Lagereingang oder die vollständige im Lieferschein vermerkte Menge von #2 #3 zuweisen.', 'Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.' => 'Fehler in Position #1: Sie müssen einer Position entweder gar keinen Lagerausgang oder die vollständige im Lieferschein vermerkte Menge von #2 #3 zuweisen.', 'Error in row #1: The quantity you entered is bigger than the stocked quantity.' => 'Fehler in Zeile #1: Die angegebene Menge ist größer als die vorhandene Menge.', + 'Error message from the database driver:' => 'Fehlermeldung des Datenbanktreibers:', 'Error!' => 'Fehler!', 'Ertrag' => 'Ertrag', 'Ertrag prozentual' => 'Ertrag prozentual', @@ -1332,6 +1334,7 @@ aktualisieren wollen?', 'Template database' => 'Datenbankvorlage', 'Templates' => 'Vorlagen', 'Terms missing in row ' => '+Tage fehlen in Zeile ', + 'Test connection' => 'Verbindung testen', 'Text field' => 'Textfeld', 'Text field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the text field. They default to 30 and 5 respectively.' => 'Textfelder: \'WIDTH=w HEIGHT=h\' setzen die Breite und die Höhe des Textfeldes. Wenn nicht anders angegeben, so werden sie 30 Zeichen breit und fünf Zeichen hoch dargestellt.', 'Text variables: \'MAXLENGTH=n\' sets the maximum entry length to \'n\'.' => 'Textzeilen: \'MAXLENGTH=n\' setzt eine Maximallänge von n Zeichen.', @@ -1351,7 +1354,9 @@ aktualisieren wollen?', 'The config file "config/authentication.pl" was not found.' => 'Die Konfigurationsdatei "config/authentication.pl" wurde nicht gefunden.', 'The connection to the LDAP server cannot be encrypted (SSL/TLS startup failure). Please check config/authentication.pl.' => 'Die Verbindung zum LDAP-Server kann nicht verschlüsselt werden (Fehler bei SSL/TLS-Initialisierung). Bitte überprüfen Sie die Angaben in config/authentication.pl.', 'The connection to the authentication database failed:' => 'Die Verbindung zur Authentifizierungsdatenbank schlug fehl:', + 'The connection to the database could not be established.' => 'Die Verbindung zur Datenbank konnte nicht hergestellt werden.', 'The connection to the template database failed:' => 'Die Verbindung zur Vorlagendatenbank schlug fehl:', + 'The connection was established successfully.' => 'Die Verbindung zur Datenbank wurde erfolgreich hergestellt.', 'The creation of the authentication database failed:' => 'Das Anlegen der Authentifizierungsdatenbank schlug fehl:', 'The custom variable has been deleted.' => 'Die benutzerdefinierte Variable wurde gelöscht.', 'The custom variable has been saved.' => 'Die benutzerdefinierte Variable wurde gespeichert.', diff --git a/templates/webpages/admin/edit_user_de.html b/templates/webpages/admin/edit_user_de.html index 42fc9801c..6dd456d74 100644 --- a/templates/webpages/admin/edit_user_de.html +++ b/templates/webpages/admin/edit_user_de.html @@ -1,6 +1,24 @@ [% USE HTML %] -
+ + + +
[% title %]
@@ -187,6 +205,10 @@ Passwort + + + + diff --git a/templates/webpages/admin/edit_user_master.html b/templates/webpages/admin/edit_user_master.html index 1456c2d85..71fd28285 100644 --- a/templates/webpages/admin/edit_user_master.html +++ b/templates/webpages/admin/edit_user_master.html @@ -1,6 +1,24 @@ [% USE HTML %] - + + + +
[% title %]
@@ -187,6 +205,10 @@ Password + + + + diff --git a/templates/webpages/admin/test_db_connection_de.html b/templates/webpages/admin/test_db_connection_de.html new file mode 100644 index 000000000..ced5658fa --- /dev/null +++ b/templates/webpages/admin/test_db_connection_de.html @@ -0,0 +1,27 @@ +[% USE HTML %] + +
[% title %]
+ + [%- IF connection_ok %] + +

Die Verbindung zur Datenbank wurde erfolgreich hergestellt.

+ + [%- ELSE %] + +

+ Die Verbindung zur Datenbank konnte nicht hergestellt werden. + Fehlermeldung des Datenbanktreibers: +

+ +

[% HTML.escape(errstr) %]

+ + [%- END %] + +

+ + +

+

+ + + diff --git a/templates/webpages/admin/test_db_connection_master.html b/templates/webpages/admin/test_db_connection_master.html new file mode 100644 index 000000000..25dedacb0 --- /dev/null +++ b/templates/webpages/admin/test_db_connection_master.html @@ -0,0 +1,28 @@ +[% USE HTML %] + +
[% title %]
+ + [%- IF connection_ok %] + +

The connection was established successfully.

+ + [%- ELSE %] + +

+ The connection to the database could not be + established. + Error message from the database driver: +

+ +

[% HTML.escape(errstr) %]

+ + [%- END %] + +

+

+ +
+

+ + + -- 2.20.1