From d1e4ee7951b4ea788fcfd6bf882865f1b2724966 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 1 Nov 2007 16:58:51 +0000 Subject: [PATCH] Auslagern des HTML-Codes aus login.pl in HTML-Vorlagen. --- SL/Template/Plugin/LxERP.pm | 9 + bin/mozilla/login.pl | 155 +++--------------- locale/de/all | 1 - locale/de/login | 8 - templates/webpages/login/company_logo_de.html | 48 ++++++ .../webpages/login/company_logo_master.html | 48 ++++++ templates/webpages/login/login_screen_de.html | 44 +++++ .../webpages/login/login_screen_master.html | 44 +++++ 8 files changed, 216 insertions(+), 141 deletions(-) create mode 100644 templates/webpages/login/company_logo_de.html create mode 100644 templates/webpages/login/company_logo_master.html create mode 100644 templates/webpages/login/login_screen_de.html create mode 100644 templates/webpages/login/login_screen_master.html diff --git a/SL/Template/Plugin/LxERP.pm b/SL/Template/Plugin/LxERP.pm index a97344af2..ed2287b42 100644 --- a/SL/Template/Plugin/LxERP.pm +++ b/SL/Template/Plugin/LxERP.pm @@ -23,5 +23,14 @@ sub format_percent { return $self->format_amount($var * 100, $places, $skip_zero); } +sub escape_br { + my ($self, $var) = @_; + + $var =~ s/\r//g; + $var =~ s/\n/
/g; + + return $var; +} + 1; diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 7623bff3e..b9a29c3ed 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -50,14 +50,14 @@ if (-f "bin/mozilla/$form->{login}_$form->{script}") { } # window title bar, user info -$form->{titlebar} = - "Lx-Office " . $locale->text('Version') . " $form->{version}"; +$form->{titlebar} = "Lx-Office " . $locale->text('Version') . " $form->{version}"; if ($form->{action}) { $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; call_sub($locale->findsub($form->{action})); + } else { - &login_screen; + login_screen(); } 1; @@ -72,59 +72,7 @@ sub login_screen { $form->{fokus} = "loginscreen.login"; $form->header; - print qq| - - - - -
-
-
- -
- - - - - - - - -|; + print $form->parse_html_template('login/login_screen'); $lxdebug->leave_sub(); } @@ -132,39 +80,30 @@ sub login_screen { sub login { $lxdebug->enter_sub(); - $form->error($locale->text('You did not enter a name!')) - unless ($form->{login}); + $form->error($locale->text('You did not enter a name!')) unless ($form->{login}); $user = new User $memberfile, $form->{login}; # if we get an error back, bale out - if (($errno = $user->login(\%$form, $userspath)) <= -1) { - $errno *= -1; - $err[1] = $err[3] = $locale->text('Incorrect username or password!'); - - if ($errno == 2) { + if (($result = $user->login(\%$form, $userspath)) <= -1) { + if ($result == -2) { exit; } - $form->error($err[$errno]); + $form->error($locale->text('Incorrect username or password!')); } + my %style_to_script_map = ( 'v3' => 'v3', + 'neu' => 'new', + 'xml' => 'XML', + ); + + my $menu_script = $style_to_script_map{$user->{menustyle}} || ''; + # made it this far, execute the menu - if ($user->{menustyle} eq "v3") { - $form->{callback} = - "menuv3.pl?login=$form->{login}&password=$form->{password}&action=display"; - } elsif ($user->{menustyle} eq "neu") { - $form->{callback} = - "menunew.pl?login=$form->{login}&password=$form->{password}&action=display"; - } elsif ($user->{menustyle} eq "xml") { - $form->{callback} = - "menuXML.pl?login=$form->{login}&password=$form->{password}&action=display"; - } else { - $form->{callback} = - "menu.pl?login=$form->{login}&password=$form->{password}&action=display"; - } + $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display'); - $form->redirect; + $form->redirect(); $lxdebug->leave_sub(); } @@ -185,64 +124,16 @@ sub company_logo { $lxdebug->enter_sub(); require "$userspath/$form->{login}.conf"; - $locale = new Locale $myconfig{countrycode}, "login" - unless ($language eq $myconfig{countrycode}); - $myconfig{address} =~ s/\\n/
/g; - $myconfig{dbhost} = $locale->text('localhost') unless $myconfig{dbhost}; + $locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode}); - $form->{stylesheet} = $myconfig{stylesheet}; - - $form->{title} = $locale->text('About'); + $form->{stylesheet} = $myconfig{stylesheet}; + $form->{title} = $locale->text('About'); # create the logo screen - $form->header unless $form->{noheader}; - - print qq| - -
- - - -| . $locale->text('Licensed to') . qq| -

- -$myconfig{company} -
$myconfig{address} -
- - -
- - - - - - - - - - - - - - - - - - - - - - - -
| . $locale->text('User') . qq|$myconfig{name}
| . $locale->text('Dataset') . qq|$myconfig{dbname}
| . $locale->text('Database Host') . qq|$myconfig{dbhost}
http://lx-office.org
info@lx-office.org
- -

- - - -|; + $form->header() unless $form->{noheader}; + + print $form->parse_html_template('login/company_logo'); $lxdebug->leave_sub(); } diff --git a/locale/de/all b/locale/de/all index 1e3c86c58..a5c34093d 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1341,7 +1341,6 @@ aktualisieren wollen?', 'list_of_payments' => 'zahlungsausgaenge', 'list_of_receipts' => 'zahlungseingaenge', 'list_of_transactions' => 'buchungsliste', - 'localhost' => 'lokaler Rechner', 'logout' => 'abmelden', 'mark as paid' => 'als bezahlt markieren', 'month' => 'Monatliche Abgabe', diff --git a/locale/de/login b/locale/de/login index 369113ab1..cbcfd02b7 100644 --- a/locale/de/login +++ b/locale/de/login @@ -13,8 +13,6 @@ $self->{texts} = { 'Customer details' => 'Kundendetails', 'DELETED' => 'Gelöscht', 'DUNNING STARTED' => 'Mahnprozess gestartet', - 'Database Host' => 'Datenbankcomputer', - 'Dataset' => 'Datenbank', 'Dataset upgrade' => 'Datenbankaktualisierung', 'Date' => 'Datum', 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:', @@ -26,9 +24,6 @@ $self->{texts} = { 'History' => 'Historie', 'Incorrect username or password!' => 'Ungültiger Benutzername oder falsches Passwort!', 'Invoice' => 'Rechnung', - 'Licensed to' => 'Lizensiert für', - 'Login' => 'Anmeldung', - 'Login Name' => 'Benutzername', 'MAILED' => 'Gesendet', 'Mark as paid?' => 'Als bezahlt markieren?', 'Marked as paid' => 'Als bezahlt markiert', @@ -52,7 +47,6 @@ $self->{texts} = { 'Packing List' => 'Lieferschein', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', - 'Password' => 'Passwort', 'Pick List' => 'Sammelliste', 'Please enter values' => 'Bitte Werte eingeben', 'Proforma Invoice' => 'Proformarechnung', @@ -76,7 +70,6 @@ $self->{texts} = { 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.', 'Unit' => 'Einheit', 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.', - 'User' => 'Benutzer', 'Value' => 'Wert', 'Variable' => 'Variable', 'Vendor details' => 'Lieferantendetails', @@ -86,7 +79,6 @@ $self->{texts} = { '[email]' => '[email]', 'bin_list' => 'Lagerliste', 'invoice' => 'Rechnung', - 'localhost' => 'lokaler Rechner', 'no' => 'nein', 'packing_list' => 'Versandliste', 'pick_list' => 'Entnahmeliste', diff --git a/templates/webpages/login/company_logo_de.html b/templates/webpages/login/company_logo_de.html new file mode 100644 index 000000000..6934db9f5 --- /dev/null +++ b/templates/webpages/login/company_logo_de.html @@ -0,0 +1,48 @@ +[% USE HTML %][% USE LxERP %] + [%- DEFAULT myconfig_dbhost = 'localhost' %] + +
+ + + + +

Lizensiert für

+ +

+ + [% HTML.escape(myconfig_company) %] +
+ [% HTML.escape(myconfig_address).replace('\\\\n', '
') %] +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Benutzer[% HTML.escape(myconfig_name) %]
Datenbank[% HTML.escape(myconfig_dbname) %]
Datenbankcomputer[% HTML.escape(myconfig_dbhost) %]
http://lx-office.org
info@lx-office.org
+ +

+ + + diff --git a/templates/webpages/login/company_logo_master.html b/templates/webpages/login/company_logo_master.html new file mode 100644 index 000000000..4af1057b8 --- /dev/null +++ b/templates/webpages/login/company_logo_master.html @@ -0,0 +1,48 @@ +[% USE HTML %][% USE LxERP %] + [%- DEFAULT myconfig_dbhost = 'localhost' %] + +
+ + + + +

Licensed to

+ +

+ + [% HTML.escape(myconfig_company) %] +
+ [% HTML.escape(myconfig_address).replace('\\\\n', '
') %] +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
User[% HTML.escape(myconfig_name) %]
Dataset[% HTML.escape(myconfig_dbname) %]
Database Host[% HTML.escape(myconfig_dbhost) %]
http://lx-office.org
info@lx-office.org
+ +

+ + + diff --git a/templates/webpages/login/login_screen_de.html b/templates/webpages/login/login_screen_de.html new file mode 100644 index 000000000..400036250 --- /dev/null +++ b/templates/webpages/login/login_screen_de.html @@ -0,0 +1,44 @@ +[% USE HTML %] + +
+ + + + + + + + diff --git a/templates/webpages/login/login_screen_master.html b/templates/webpages/login/login_screen_master.html new file mode 100644 index 000000000..db6eb83dd --- /dev/null +++ b/templates/webpages/login/login_screen_master.html @@ -0,0 +1,44 @@ +[% USE HTML %] + +
+ + + + + + + + -- 2.20.1