Revision 2a5e8973
Von Moritz Bunkus vor fast 12 Jahren hinzugefügt
SL/Layout/V3.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(SL::Layout::Base); |
5 |
use SL::Layout::Css; |
|
6 | 5 |
|
7 | 6 |
use URI; |
8 | 7 |
|
8 |
sub clock_line { |
|
9 |
my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, |
|
10 |
$Jahr, $Wochentag, $Jahrestag, $Sommerzeit) |
|
11 |
= localtime(time); |
|
12 |
$Monat += 1; |
|
13 |
$Jahrestag += 1; |
|
14 |
$Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat; |
|
15 |
$Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag; |
|
16 |
$Jahr += 1900; |
|
17 |
my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch", |
|
18 |
"Donnerstag", "Freitag", "Samstag"); |
|
19 |
my @Monatsnamen = ("", "Januar", "Februar", "März", |
|
20 |
"April", "Mai", "Juni", "Juli", |
|
21 |
"August", "September", "Oktober", "November", |
|
22 |
"Dezember"); |
|
23 |
return |
|
24 |
$Wochentage[$Wochentag] . ", der " |
|
25 |
. $Monatstag . "." |
|
26 |
. $Monat . "." |
|
27 |
. $Jahr . " - "; |
|
28 |
} |
|
29 |
|
|
30 |
sub print_menu { |
|
31 |
my ($self, $parent, $depth) = @_; |
|
32 |
|
|
33 |
my $html; |
|
34 |
|
|
35 |
die if ($depth * 1 > 5); |
|
36 |
|
|
37 |
my @menuorder; |
|
38 |
my $menu = $self->menu; |
|
39 |
|
|
40 |
@menuorder = $menu->access_control(\%::myconfig, $parent); |
|
41 |
|
|
42 |
$parent .= "--" if ($parent); |
|
43 |
|
|
44 |
foreach my $item (@menuorder) { |
|
45 |
substr($item, 0, length($parent)) = ""; |
|
46 |
next if (($item eq "") || ($item =~ /--/)); |
|
47 |
|
|
48 |
my $menu_item = $menu->{"${parent}${item}"}; |
|
49 |
my $menu_title = $::locale->text($item); |
|
50 |
my $menu_text = $menu_title; |
|
51 |
|
|
52 |
if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) && !defined($menu_item->{href})) { |
|
53 |
|
|
54 |
my $h = $self->print_menu("${parent}${item}", $depth * 1 + 1)."\n"; |
|
55 |
if (!$parent) { |
|
56 |
$html .= qq|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>\n|; |
|
57 |
} else { |
|
58 |
$html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|; |
|
59 |
} |
|
60 |
} else { |
|
61 |
if ($self->{sub_class} && $depth > 1) { |
|
62 |
$html .= qq|<li class='sub'>|; |
|
63 |
} else { |
|
64 |
$html .= qq|<li>|; |
|
65 |
} |
|
66 |
$html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title }); |
|
67 |
$html .= qq|${menu_text}</a></li>\n|; |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
return $html; |
|
72 |
} |
|
73 |
|
|
74 |
sub menuitem_v3 { |
|
75 |
$main::lxdebug->enter_sub(); |
|
76 |
|
|
77 |
my ($self, $item, $other) = @_; |
|
78 |
my $menuitem = $self->menu->{$item}; |
|
79 |
|
|
80 |
my $action = "section_menu"; |
|
81 |
my $module; |
|
82 |
|
|
83 |
if ($menuitem->{module}) { |
|
84 |
$module = $menuitem->{module}; |
|
85 |
} |
|
86 |
if ($menuitem->{action}) { |
|
87 |
$action = $menuitem->{action}; |
|
88 |
} |
|
89 |
|
|
90 |
my $level = $::form->escape($item); |
|
91 |
|
|
92 |
my $str = qq|<a href="$module?action=| . $::form->escape($action) . qq|&level=| . $::form->escape($level); |
|
93 |
|
|
94 |
my @vars = qw(module action target href); |
|
95 |
|
|
96 |
if ($menuitem->{href}) { |
|
97 |
$str = qq|<a href="$menuitem->{href}|; |
|
98 |
@vars = qw(module target href); |
|
99 |
} |
|
100 |
|
|
101 |
map { delete $menuitem->{$_} } @vars; |
|
102 |
|
|
103 |
# add other params |
|
104 |
foreach my $key (keys %{ $menuitem }) { |
|
105 |
$str .= "&" . $::form->escape($key, 1) . "="; |
|
106 |
my ($value, $conf) = split(/=/, $menuitem->{$key}, 2); |
|
107 |
$value = $::myconfig{$value} . "/$conf" if ($conf); |
|
108 |
$str .= $::form->escape($value, 1); |
|
109 |
} |
|
110 |
|
|
111 |
$str .= '"'; |
|
112 |
|
|
113 |
if ($other) { |
|
114 |
foreach my $key (keys(%{$other})) { |
|
115 |
$str .= qq| ${key}="| . $::form->quote($other->{$key}) . qq|"|; |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
$str .= ">"; |
|
120 |
|
|
121 |
$main::lxdebug->leave_sub(); |
|
122 |
|
|
123 |
return $str; |
|
124 |
} |
|
125 |
|
|
9 | 126 |
sub init_sub_layouts { |
10 | 127 |
[ SL::Layout::None->new ] |
11 | 128 |
} |
Auch abrufbar als: Unified diff
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.