X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fmenu.pl;h=85efc5c370af07d8616cd4ff20757fa1523e395c;hb=a143b82a56e889cfda60c2d42fe7d0bdaf73aa83;hp=e97fec3bd4ade006b20ed638fe9472106e10fb46;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index e97fec3bd..85efc5c37 100644 --- a/bin/mozilla/menu.pl +++ b/bin/mozilla/menu.pl @@ -37,6 +37,7 @@ $menufile = "menu.ini"; use SL::Menu; +use Data::Dumper; 1; @@ -50,7 +51,7 @@ sub display { $form->header; print qq| - + @@ -117,6 +118,24 @@ sub section_menu { $label_icon = $label . ".gif"; $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 ($i,$l) = (-1, 20); + map { + if (($l += length $_) < 20) { + $chunks[$i] .= " $_"; + } else { + $l = length $_; + $chunks[++$i] = $_; + } + } split / /, $label; + map { s/ / / } @chunks; + # end multi line + $label =~ s/ / /g; $menu->{$item}{target} = "main_window" unless $menu->{$item}{target}; @@ -159,10 +178,24 @@ sub section_menu { §ion_menu($menu, $item); } else { if ($zeige) { - print - qq|$spacer| - . $menu->menuitem(\%myconfig, \%$form, $item, $level) - . qq|$label\n|; + if (scalar @chunks <= 1) { + print + qq|$spacer| + . $menu->menuitem(\%myconfig, \%$form, $item, $level) + . qq|$label\n|; + } else { + my $tmpitem = $menu->menuitem(\%myconfig, \%$form, $item, $level); + print + qq|$spacer| + . $tmpitem + . qq|$chunks[0]\n|; + map { + print + qq|$spacer| + . $tmpitem + . qq|$chunks[$_]\n|; + } 1..$#chunks; + } } } } else {