1 package SL::Layout::Javascript;
4 use parent qw(SL::Layout::Base);
6 use List::Util qw(max);
10 my ($class, @slurp) = @_;
12 my $self = $class->SUPER::new(@slurp);
14 $self->add_sub_layouts([
15 SL::Layout::None->new,
26 "<div id='content'>\n";
35 my $form = $main::form;
37 my $callback = $form->unescape($form->{callback});
38 $callback = URI->new($callback)->rel($callback) if $callback;
39 $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
41 $self->render("menu/menunew", { partial => 1, no_output => 1 },
43 date => $self->clock_line,
44 menu_items => $self->acc_menu,
45 callback => $callback,
50 my $form = $main::form;
52 my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
53 $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
57 $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
58 $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
60 my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
61 "Donnerstag", "Freitag", "Samstag");
62 my @Monatsnamen = ("", "Januar", "Februar", "März",
63 "April", "Mai", "Juni", "Juli",
64 "August", "September", "Oktober", "November",
67 $Wochentage[$Wochentag] . ", der "
76 my $menu = $self->menu;
79 $self->create_menu($menu, $all_items);
81 my $item = { 'subitems' => $all_items };
82 calculate_width($item);
90 $item->{max_width} = max map { length $_->{title} } @{ $item->{subitems} };
92 foreach my $subitem (@{ $item->{subitems} }) {
93 calculate_width($subitem) if ($subitem->{subitems});
98 my ($self, $menu, $all_items, $parent, $depth) = @_;
101 my $form = $main::form;
102 my %myconfig = %main::myconfig;
104 die if ($depth * 1 > 5);
106 my @menuorder = $menu->access_control(\%myconfig, $parent);
107 $parent .= "--" if ($parent);
109 foreach my $name (@menuorder) {
110 substr($name, 0, length($parent), "");
111 next if (($name eq "") || ($name =~ /--/));
113 my $menu_item = $menu->{"${parent}${name}"};
114 my $item = { 'title' => $::locale->text($name) };
115 push @{ $all_items }, $item;
117 if ($menu_item->{submenu} || !defined($menu_item->{module}) || ($menu_item->{module} eq "menu.pl")) {
118 $item->{subitems} = [];
119 $item->{image} = _icon_path("$name.png");
120 $self->create_menu($menu, $item->{subitems}, "${parent}${name}", $depth * 1 + 1);
123 $item->{image} = _icon_path("${parent}${name}.png");
124 $menu->menuitem_new("${parent}${name}", $item);
130 my ($label, $size) = @_;
134 my $img = "image/icons/${size}x${size}/$label";
136 return unless -f $img;