From e98e20941b580769e3f4e6e2bcac60a679b7e06b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 16 Jan 2007 09:30:19 +0000 Subject: [PATCH] =?utf8?q?Ein=20oben=20angedocktes,=20auf=20CSS=20basieren?= =?utf8?q?des=20Men=C3=BC=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 3 +- SL/Menu.pm | 67 ++++++++++- bin/mozilla/admin.pl | 4 +- bin/mozilla/am.pl | 4 +- bin/mozilla/login.pl | 5 +- bin/mozilla/menuv3.pl | 250 ++++++++++++++++++++++++++++++++++++++++++ css/csshover.htc | 121 ++++++++++++++++++++ css/menuv3.css | 132 ++++++++++++++++++++++ image/expand3.gif | Bin 0 -> 67 bytes locale/de/admin | 1 + locale/de/all | 1 + locale/de/am | 1 + locale/de/menuv3 | 12 ++ makesymlinks | 2 +- 14 files changed, 595 insertions(+), 8 deletions(-) create mode 100644 bin/mozilla/menuv3.pl create mode 100644 css/csshover.htc create mode 100644 css/menuv3.css create mode 100644 image/expand3.gif create mode 100644 locale/de/menuv3 diff --git a/SL/Form.pm b/SL/Form.pm index 9b3a67ca6..4bea5f094 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -349,7 +349,7 @@ sub isblank { sub header { $main::lxdebug->enter_sub(); - my ($self) = @_; + my ($self, $extra_code) = @_; if ($self->{header}) { $main::lxdebug->leave_sub(); @@ -439,6 +439,7 @@ function fokus(){document.$self->{fokus}.focus();} + $extra_code |; diff --git a/SL/Menu.pm b/SL/Menu.pm index 5da42e64a..b3ffd0f94 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -83,7 +83,7 @@ sub menuitem { # add other params foreach my $key (keys %{ $self->{$item} }) { $str .= "&" . $form->escape($key, 1) . "="; - ($value, $conf) = split /=/, $self->{$item}{$key}, 2; + ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); $value = $myconfig->{$value} . "/$conf" if ($conf); $str .= $form->escape($value, 1); } @@ -99,6 +99,67 @@ sub menuitem { return $str; } +sub menuitem_v3 { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form, $item, $other) = @_; + + my $module = $form->{script}; + my $action = "section_menu"; + my $target = ""; + + if ($self->{$item}{module}) { + $module = $self->{$item}{module}; + } + if ($self->{$item}{action}) { + $action = $self->{$item}{action}; + } + if ($self->{$item}{target}) { + $target = $self->{$item}{target}; + } + + my $level = $form->escape($item); + + my $str = qq|escape($key, 1) . "="; + ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); + $value = $myconfig->{$value} . "/$conf" if ($conf); + $str .= $form->escape($value, 1); + } + + $str .= '"'; + + if ($target) { + $str .= qq| target="| . $form->quote($target) . qq|"|; + } + + if ($other) { + foreach my $key (keys(%{$other})) { + $str .= qq| ${key}="| . $form->quote($other->{$key}) . qq|"|; + } + } + + $str .= ">"; + + $main::lxdebug->leave_sub(); + + return $str; +} + sub menuitemNew { my ($self, $myconfig, $form, $item) = @_; @@ -128,7 +189,7 @@ sub menuitemNew { # add other params foreach my $key (keys %{ $self->{$item} }) { $str .= "&" . $form->escape($key, 1) . "="; - ($value, $conf) = split /=/, $self->{$item}{$key}, 2; + ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); $value = $myconfig->{$value} . "/$conf" if ($conf); $str .= $form->escape($value, 1); } @@ -150,7 +211,7 @@ sub access_control { @menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} }; } - my @a = split /;/, $myconfig->{acs}; + my @a = split(/;/, $myconfig->{acs}); my $excl = (); # remove --AR, --AP from array diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index cd08e3f9f..2eb53876c 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -601,7 +601,9 @@ sub form_header { | . $locale->text('Setup Menu') . qq| -  | . +  | . + $locale->text("Top (CSS)") . qq| +  | . $locale->text("Top (Javascript)") . qq|  | . $locale->text("Old (on the side)") . qq| diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 86b4eb20a..1fe78205c 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -3074,7 +3074,9 @@ sub config { | . $locale->text('Setup Menu') . qq| -  | . +  | . + $locale->text("Top (CSS)") . qq| +  | . $locale->text("Top (Javascript)") . qq|  | . $locale->text("Old (on the side)") . qq| diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 770df5ce3..9541684aa 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -149,7 +149,10 @@ sub login { } # made it this far, execute the menu - if ($user->{menustyle} eq "neu") { + if ($user->{menustyle} eq "v3") { + $form->{callback} = + "menuv3.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}&action=display"; + } elsif ($user->{menustyle} eq "neu") { $form->{callback} = "menunew.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}&action=display"; } else { diff --git a/bin/mozilla/menuv3.pl b/bin/mozilla/menuv3.pl new file mode 100644 index 000000000..807db3597 --- /dev/null +++ b/bin/mozilla/menuv3.pl @@ -0,0 +1,250 @@ +#===================================================================== +# LX-Office ERP +# Copyright (C) 2004 +# Based on SQL-Ledger Version 2.1.9 +# Web http://www.lx-office.org +# +###################################################################### +# SQL-Ledger Accounting +# Copyright (c) 1998-2002 +# +# Author: Dieter Simader +# Email: dsimader@sql-ledger.org +# Web: http://www.sql-ledger.org +# +# Contributors: Christopher Browne +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +####################################################################### +# +# thre frame layout with refractured menu +# +####################################################################### + +$menufile = "menu.ini"; +use SL::Menu; + +1; + +# end of main + +sub display { + $form->header(qq||); + + print(qq|\n|); + + clock_line(); + + print qq| + + + +
+ + + + + +|; + +} + +sub clock_line { + + $login = "[" + . $form->{login} + . " -
{"path"} + . "&password=" + . $form->{"password"} + . "&action=logout\" target=\"_top\">" + . $locale->text('Logout') + . "] "; + my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, + $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) + = localtime(time); + my $CTIME_String = localtime(time); + $Monat += 1; + $Jahrestag += 1; + $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat; + $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag; + $Jahr += 1900; + my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch", + "Donnerstag", "Freitag", "Samstag"); + my @Monatsnamen = ("", "Januar", "Februar", "März", + "April", "Mai", "Juni", "Juli", + "August", "September", "Oktober", "November", + "Dezember"); + $datum = + $Wochentage[$Wochentag] . ", der " + . $Monatstag . "." + . $Monat . "." + . $Jahr . " - "; + + #$zeit="
".$Stunden.":".$Minuten.":".$Sekunden."
"; + $zeit = "
" . $Stunden . ":" . $Minuten . "
"; + print qq| + + + + + + +
  [drucken]| + . $login . $datum . qq|   +
+|; +} + +sub acc_menu { + $locale = Locale->new($language, "menu"); + + $mainlevel = $form->{level}; + $mainlevel =~ s/$mainlevel--//g; + my $menu = new Menu "$menufile"; + $menu = new Menu "custom_$menufile" if (-f "custom_$menufile"); + $menu = new Menu "$form->{login}_$menufile" + if (-f "$form->{login}_$menufile"); + + $| = 1; + + return print_menu($menu); +} + +sub my_length { + my ($s) = @_; + my $len = 0; + my $i; + my $skip = 0; + + for ($i = 0; $i < length($s); $i++) { + my $c = substr($s, $i, 1); + if ($skip && ($c eq ";")) { + $skip = 0; + } elsif ($skip) { + next; + } elsif ($c eq "&") { + $skip = 1; + $len++; + } else { + $len++; + } + } + + return $len; +} + +sub print_menu { + my ($menu, $parent, $depth) = @_; + my $html; + + die if ($depth * 1 > 5); + + my @menuorder; + + @menuorder = $menu->access_control(\%myconfig, $parent); + + $parent .= "--" if ($parent); + + foreach my $item (@menuorder) { + substr($item, 0, length($parent)) = ""; + next if (($item eq "") || ($item =~ /--/)); + + my $menu_item = $menu->{"${parent}${item}"}; + my $menu_title = $locale->text($item); + my $menu_text = $menu_title; + + $menu_text =~ s/ /
/ if ($parent && (my_length($menu_text) >= 17)); + + my $target = "main_window"; + $target = $menu_item->{"target"} if ($menu_item->{"target"}); + + if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) || + ($menu_item->{"module"} eq "menu.pl")) { + + my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1); + if (!$parent) { + $html .= qq||; + } else { + $html .= qq|
  • ${menu_text}
  • |; + } + } else { + $html .= qq|
  • |; + $html .= $menu->menuitem_v3(\%myconfig, $form, "${parent}$item", + { "title" => $menu_title, + "target" => $target }); + $html .= qq|${menu_text}
  • |; + } + } + + return $html; +} diff --git a/css/csshover.htc b/css/csshover.htc new file mode 100644 index 000000000..e2dcced3e --- /dev/null +++ b/css/csshover.htc @@ -0,0 +1,121 @@ + + \ No newline at end of file diff --git a/css/menuv3.css b/css/menuv3.css new file mode 100644 index 000000000..cbb2d6609 --- /dev/null +++ b/css/menuv3.css @@ -0,0 +1,132 @@ +body { +behavior:url("css/csshover.htc"); +} + +#menu{ +width:100%; +float:left; +} + +#menu a, #menu h2, #menu div.x { +font:11px/16px arial,helvetica,sans-serif; +display:block; +border-width:1px; +border-style:solid; +border-color:#ccc #888 #555 #bbb; +white-space:nowrap; +margin:0; +padding:1px 0 1px 3px; +} + +#menu h2{ +color:#fff; +background:#000 url(../image/expand3.gif) no-repeat 100% 100%; +} + +#menu a{ +background:#eee; +text-decoration:none; +} + +#menu a, #menu a:visited{ +color:#000; +} + +#menu a:hover{ +color:#a00; +background:#ddd; +} + +#menu a:active{ +color:#060; +background:#ccc; +} + +#menu ul{ +list-style:none; +margin:0; +padding:0; +float:left; +width:9em; +} + +#menu li{ +position:relative; +} + +#menu ul ul{ +position:absolute; +z-index:500; +top:auto; +display:none; +} + +#menu ul ul ul{ +top:0; +left:100%; +} + +/* Begin non-anchor hover selectors */ + +/* Enter the more specific element (div) selector +on non-anchor hovers for IE5.x to comply with the +older version of csshover.htc - V1.21.041022. It +improves IE's performance speed to use the older +file and this method */ + +div#menu h2:hover{ +background:#000 url(../image/expand3.gif) no-repeat -999px -9999px; +} + +div#menu li:hover{ +cursor:pointer; +z-index:100; +} + +div#menu li:hover ul ul, +div#menu li li:hover ul ul, +div#menu li li li:hover ul ul, +div#menu li li li li:hover ul ul +{display:none;} + +div#menu li:hover ul, +div#menu li li:hover ul, +div#menu li li li:hover ul, +div#menu li li li li:hover ul +{display:block;} + +/* End of non-anchor hover selectors */ + +/* Styling for Expand */ + +#menu a.x, #menu a.x:visited{ +/*font-weight:bold;*/ +color:#000; +background:#eee url(../image/expand3.gif) no-repeat 100% 100%; +} + +#menu a.x:hover{ +color:#fff; +background:#000; +} + +#menu a.x:active{ +color:#060; +background:#ccc; +} + +#menu div.x, #menu div.x:visited{ +/*font-weight:bold;*/ +color:#000; +background:#eee url(../image/expand3.gif) no-repeat 100% 100%; +} + +#menu div.x:hover{ +color:#fff; +background:#000; +} + +#menu div.x:active{ +color:#060; +background:#ccc; +} diff --git a/image/expand3.gif b/image/expand3.gif new file mode 100644 index 0000000000000000000000000000000000000000..2c46f4ef33a420c587f051c383e666bd3d76bc0c GIT binary patch literal 67 zcmZ?wbhEHb{texts} = { 'The passwords do not match.' => 'Die Passwörter stimmen nicht überein.', 'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!' => 'In diesem Schritt werden bestehende Datenbanken gesucht. Es werden noch keine Änderungen vorgenommen!', 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Zugriffsnamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.', + 'Top (CSS)' => 'Oben (mit CSS)', 'Top (Javascript)' => 'Oben (mit Javascript)', 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.', 'Unlock System' => 'System entsperren', diff --git a/locale/de/all b/locale/de/all index fe074be9b..6e6162edd 100644 --- a/locale/de/all +++ b/locale/de/all @@ -993,6 +993,7 @@ gestartet', 'Title' => 'Titel', 'To' => 'An', 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Zugriffsnamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.', + 'Top (CSS)' => 'Oben (mit CSS)', 'Top (Javascript)' => 'Oben (mit Javascript)', 'Top 100' => 'Top 100', 'Top 100 hinzufuegen' => 'Top 100 hinzufügen', diff --git a/locale/de/am b/locale/de/am index 68bfc155c..eb7aef1f6 100644 --- a/locale/de/am +++ b/locale/de/am @@ -224,6 +224,7 @@ $self->{texts} = { 'The unit in row %d has been deleted in the meantime.' => 'Die Einheit in Zeile %d ist in der Zwischentzeit gelöscht worden.', 'The unit in row %d has been used in the meantime and cannot be changed anymore.' => 'Die Einheit in Zeile %d wurde in der Zwischenzeit benutzt und kann nicht mehr geändert werden.', 'The units have been saved.' => 'Die Einheiten wurden gespeichert.', + 'Top (CSS)' => 'Oben (mit CSS)', 'Top (Javascript)' => 'Oben (mit Javascript)', 'Transaction reversal enforced for all dates' => 'Fehleintragungen müssen für jeden Zeitraum mit einer Kontraeintragung ausgebessert werden', 'Transaction reversal enforced up to' => 'Fehleintragungen können bis zu dem angegebenen Zeitraum nur mit einer Kontraeintragung ausgebessert werden!', diff --git a/locale/de/menuv3 b/locale/de/menuv3 new file mode 100644 index 000000000..281bb6721 --- /dev/null +++ b/locale/de/menuv3 @@ -0,0 +1,12 @@ +$self->{texts} = { + 'Logout' => 'Abmeldung', +}; + +$self->{subs} = { + 'acc_menu' => 'acc_menu', + 'clock_line' => 'clock_line', + 'display' => 'display', + 'section_menu' => 'section_menu', +}; + +1; diff --git a/makesymlinks b/makesymlinks index b5c0b0461..25f95e71e 100755 --- a/makesymlinks +++ b/makesymlinks @@ -3,7 +3,7 @@ # Erstellt die benotigten Symlinks ln -vsf login.pl admin.pl -for i in ap ar bp ca cp ct cn dn gl ic ir is menu oe pe rc rp datev licenses fa ustva menunew common; do +for i in ap ar bp ca cp ct cn dn gl ic ir is menu oe pe rc rp datev licenses fa ustva menunew common menuv3; do ln -vsf am.pl $i.pl done -- 2.20.1