Revision 9f4b866c
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/menu.pl | ||
---|---|---|
35 | 35 |
# 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de> |
36 | 36 |
####################################################################### |
37 | 37 |
|
38 |
$menufile = "menu.ini"; |
|
38 |
my $menufile = "menu.ini";
|
|
39 | 39 |
use SL::Menu; |
40 | 40 |
use Data::Dumper; |
41 | 41 |
use URI; |
42 | 42 |
|
43 |
use strict; |
|
44 |
|
|
45 |
my $framesize = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "190"; |
|
46 |
my $mainlevel; |
|
47 |
|
|
43 | 48 |
1; |
44 | 49 |
|
45 | 50 |
# end of main |
46 | 51 |
|
47 |
$framesize = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "190"; |
|
48 |
|
|
49 | 52 |
sub display { |
50 |
$lxdebug->enter_sub(); |
|
53 |
$main::lxdebug->enter_sub(); |
|
54 |
|
|
55 |
my $form = $main::form; |
|
51 | 56 |
|
52 | 57 |
my $callback = $form->unescape($form->{callback}); |
53 | 58 |
$callback = URI->new($callback)->rel($callback) if $callback; |
... | ... | |
69 | 74 |
</HTML> |
70 | 75 |
|; |
71 | 76 |
|
72 |
$lxdebug->leave_sub(); |
|
77 |
$main::lxdebug->leave_sub();
|
|
73 | 78 |
} |
74 | 79 |
|
75 | 80 |
sub acc_menu { |
76 |
$lxdebug->enter_sub(); |
|
81 |
$main::lxdebug->enter_sub(); |
|
82 |
|
|
83 |
my $form = $main::form; |
|
84 |
my $locale = $main::locale; |
|
85 |
|
|
77 | 86 |
$mainlevel = $form->{level}; |
78 | 87 |
$mainlevel =~ s/\Q$mainlevel\E--//g; |
79 | 88 |
my $menu = new Menu "$menufile"; |
... | ... | |
98 | 107 |
</html> |
99 | 108 |
|; |
100 | 109 |
|
101 |
$lxdebug->leave_sub(); |
|
110 |
$main::lxdebug->leave_sub();
|
|
102 | 111 |
} |
103 | 112 |
|
104 | 113 |
sub section_menu { |
105 |
$lxdebug->enter_sub(); |
|
114 |
$main::lxdebug->enter_sub();
|
|
106 | 115 |
my ($menu, $level) = @_; |
107 | 116 |
|
117 |
my $form = $main::form; |
|
118 |
my %myconfig = %main::myconfig; |
|
119 |
my $locale = $main::locale; |
|
120 |
|
|
121 |
my $zeige; |
|
122 |
|
|
108 | 123 |
# build tiered menus |
109 | 124 |
my @menuorder = $menu->access_control(\%myconfig, $level); |
110 | 125 |
while (@menuorder) { |
111 |
$item = shift @menuorder; |
|
112 |
$label = $item; |
|
113 |
$ml = $item; |
|
126 |
my $item = shift @menuorder;
|
|
127 |
my $label = $item;
|
|
128 |
my $ml = $item;
|
|
114 | 129 |
$label =~ s/\Q$level\E--//g; |
115 | 130 |
$ml =~ s/--.*//; |
116 | 131 |
if ($ml eq $mainlevel) { $zeige = 1; } |
117 | 132 |
else { $zeige = 0; } |
118 | 133 |
my $spacer = " " x (($item =~ s/--/--/g) * 1); |
119 | 134 |
$label =~ s/.*--//g; |
120 |
$label_icon = $label . ".gif"; |
|
121 |
$mlab = $label; |
|
135 |
my $label_icon = $label . ".gif";
|
|
136 |
my $mlab = $label;
|
|
122 | 137 |
$label = $locale->text($label); |
123 | 138 |
|
124 | 139 |
# multi line hack, sschoeling jul06 |
125 | 140 |
# if a label is too long, try to split it at whitespaces, then join it to chunks of less |
126 | 141 |
# than 20 chars and store it in an array. |
127 | 142 |
# use this array later instead of the -ed label |
128 |
@chunks = (); |
|
143 |
my @chunks = ();
|
|
129 | 144 |
my ($i,$l) = (-1, 20); |
130 | 145 |
map { |
131 | 146 |
if (($l += length $_) < 20) { |
... | ... | |
211 | 226 |
} |
212 | 227 |
} |
213 | 228 |
} |
214 |
$lxdebug->leave_sub(); |
|
229 |
$main::lxdebug->leave_sub();
|
|
215 | 230 |
} |
Auch abrufbar als: Unified diff
menu strict