X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fmenu.pl;h=c51596dbb02573602c019e2c615dd33ce9596b60;hb=6dc16826718038718653bb07b130299fe2366e45;hp=e97fec3bd4ade006b20ed638fe9472106e10fb46;hpb=ee072e4f077213bf6f8792ca8f0a1afebbb6282f;p=kivitendo-erp.git diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index e97fec3bd..c51596dbb 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,21 @@ 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 { + $l += length $_; + if ($l < 20) { $chunks[$i] .= " $_"; + } else { $l =length $_; $chunks[++$i] = $_; } + } split / /, $label; + map { $chunks[$_] =~ s/ / / } 0..$#chunks; + # end multi line + $label =~ s/ / /g; $menu->{$item}{target} = "main_window" unless $menu->{$item}{target}; @@ -159,10 +175,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 {