From: Moritz Bunkus Date: Fri, 28 Dec 2012 12:44:39 +0000 (+0100) Subject: Menu-V3-Code: Css.pm nach V3.pm gemerget X-Git-Tag: release-3.1.0beta1~766 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2a5e8973583d3e6dec80d291124bcee9baaf781e;p=kivitendo-erp.git Menu-V3-Code: Css.pm nach V3.pm gemerget Css.pm war noch nötigt, als es gemeinsamen Code für V3.pm und V4.pm enthielt. Letzteres gibt es inzwischen nicht mehr. --- diff --git a/SL/Layout/Css.pm b/SL/Layout/Css.pm deleted file mode 100644 index dc0bf057f..000000000 --- a/SL/Layout/Css.pm +++ /dev/null @@ -1,128 +0,0 @@ -package SL::Layout::Css; - -use strict; - -use List::Util qw(max); -use Exporter qw(import); - -our @EXPORT = qw(clock_line print_menu menuitem_v3); - -sub clock_line { - my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, - $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) - = 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"); - return - $Wochentage[$Wochentag] . ", der " - . $Monatstag . "." - . $Monat . "." - . $Jahr . " - "; -} - -sub print_menu { - my ($self, $parent, $depth) = @_; - - my $html; - - die if ($depth * 1 > 5); - - my @menuorder; - my $menu = $self->menu; - - @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; - - if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) && !defined($menu_item->{href})) { - - my $h = $self->print_menu("${parent}${item}", $depth * 1 + 1)."\n"; - if (!$parent) { - $html .= qq|\n|; - } else { - $html .= qq|
  • ${menu_text}
  • \n|; - } - } else { - if ($self->{sub_class} && $depth > 1) { - $html .= qq|
  • |; - } else { - $html .= qq|
  • |; - } - $html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title }); - $html .= qq|${menu_text}
  • \n|; - } - } - - return $html; -} - -sub menuitem_v3 { - $main::lxdebug->enter_sub(); - - my ($self, $item, $other) = @_; - my $menuitem = $self->menu->{$item}; - - my $action = "section_menu"; - my $module; - - if ($menuitem->{module}) { - $module = $menuitem->{module}; - } - if ($menuitem->{action}) { - $action = $menuitem->{action}; - } - - my $level = $::form->escape($item); - - my $str = qq|{href}|; - @vars = qw(module target href); - } - - map { delete $menuitem->{$_} } @vars; - - # add other params - foreach my $key (keys %{ $menuitem }) { - $str .= "&" . $::form->escape($key, 1) . "="; - my ($value, $conf) = split(/=/, $menuitem->{$key}, 2); - $value = $::myconfig{$value} . "/$conf" if ($conf); - $str .= $::form->escape($value, 1); - } - - $str .= '"'; - - if ($other) { - foreach my $key (keys(%{$other})) { - $str .= qq| ${key}="| . $::form->quote($other->{$key}) . qq|"|; - } - } - - $str .= ">"; - - $main::lxdebug->leave_sub(); - - return $str; -} - -1; diff --git a/SL/Layout/V3.pm b/SL/Layout/V3.pm index cc281673b..713764f60 100644 --- a/SL/Layout/V3.pm +++ b/SL/Layout/V3.pm @@ -2,10 +2,127 @@ package SL::Layout::V3; use strict; use parent qw(SL::Layout::Base); -use SL::Layout::Css; use URI; +sub clock_line { + my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, + $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) + = 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"); + return + $Wochentage[$Wochentag] . ", der " + . $Monatstag . "." + . $Monat . "." + . $Jahr . " - "; +} + +sub print_menu { + my ($self, $parent, $depth) = @_; + + my $html; + + die if ($depth * 1 > 5); + + my @menuorder; + my $menu = $self->menu; + + @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; + + if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) && !defined($menu_item->{href})) { + + my $h = $self->print_menu("${parent}${item}", $depth * 1 + 1)."\n"; + if (!$parent) { + $html .= qq|\n|; + } else { + $html .= qq|
  • ${menu_text}
      ${h}
  • \n|; + } + } else { + if ($self->{sub_class} && $depth > 1) { + $html .= qq|
  • |; + } else { + $html .= qq|
  • |; + } + $html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title }); + $html .= qq|${menu_text}
  • \n|; + } + } + + return $html; +} + +sub menuitem_v3 { + $main::lxdebug->enter_sub(); + + my ($self, $item, $other) = @_; + my $menuitem = $self->menu->{$item}; + + my $action = "section_menu"; + my $module; + + if ($menuitem->{module}) { + $module = $menuitem->{module}; + } + if ($menuitem->{action}) { + $action = $menuitem->{action}; + } + + my $level = $::form->escape($item); + + my $str = qq|{href}|; + @vars = qw(module target href); + } + + map { delete $menuitem->{$_} } @vars; + + # add other params + foreach my $key (keys %{ $menuitem }) { + $str .= "&" . $::form->escape($key, 1) . "="; + my ($value, $conf) = split(/=/, $menuitem->{$key}, 2); + $value = $::myconfig{$value} . "/$conf" if ($conf); + $str .= $::form->escape($value, 1); + } + + $str .= '"'; + + if ($other) { + foreach my $key (keys(%{$other})) { + $str .= qq| ${key}="| . $::form->quote($other->{$key}) . qq|"|; + } + } + + $str .= ">"; + + $main::lxdebug->leave_sub(); + + return $str; +} + sub init_sub_layouts { [ SL::Layout::None->new ] }