From 9f4b866c65b51555ef22174ceb35d570e9b3a8c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 23 Oct 2009 10:37:01 +0200 Subject: [PATCH] menu strict --- bin/mozilla/menu.pl | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index a8b46973a..07ad1108e 100644 --- a/bin/mozilla/menu.pl +++ b/bin/mozilla/menu.pl @@ -35,19 +35,24 @@ # 2004-12-14 - New Optik - Marco Welter ####################################################################### -$menufile = "menu.ini"; +my $menufile = "menu.ini"; use SL::Menu; use Data::Dumper; use URI; +use strict; + +my $framesize = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "190"; +my $mainlevel; + 1; # end of main -$framesize = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "190"; - sub display { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; my $callback = $form->unescape($form->{callback}); $callback = URI->new($callback)->rel($callback) if $callback; @@ -69,11 +74,15 @@ sub display { |; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub acc_menu { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; + $mainlevel = $form->{level}; $mainlevel =~ s/\Q$mainlevel\E--//g; my $menu = new Menu "$menufile"; @@ -98,34 +107,40 @@ sub acc_menu { |; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub section_menu { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); my ($menu, $level) = @_; + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my $zeige; + # build tiered menus my @menuorder = $menu->access_control(\%myconfig, $level); while (@menuorder) { - $item = shift @menuorder; - $label = $item; - $ml = $item; + my $item = shift @menuorder; + my $label = $item; + my $ml = $item; $label =~ s/\Q$level\E--//g; $ml =~ s/--.*//; if ($ml eq $mainlevel) { $zeige = 1; } else { $zeige = 0; } my $spacer = " " x (($item =~ s/--/--/g) * 1); $label =~ s/.*--//g; - $label_icon = $label . ".gif"; - $mlab = $label; + my $label_icon = $label . ".gif"; + my $mlab = $label; $label = $locale->text($label); # multi line hack, sschoeling jul06 # if a label is too long, try to split it at whitespaces, then join it to chunks of less # than 20 chars and store it in an array. # use this array later instead of the  -ed label - @chunks = (); + my @chunks = (); my ($i,$l) = (-1, 20); map { if (($l += length $_) < 20) { @@ -211,5 +226,5 @@ sub section_menu { } } } - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } -- 2.20.1