X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fmenu.pl;h=fe2c731da6f7116ff0e2891b7bc680c336633ac8;hb=0925bc9f366038b578167a1837098ebe837012c1;hp=e97fec3bd4ade006b20ed638fe9472106e10fb46;hpb=ee072e4f077213bf6f8792ca8f0a1afebbb6282f;p=kivitendo-erp.git diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index e97fec3bd..fe2c731da 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,11 +51,11 @@ sub display { $form->header; print qq| - - + + - - + + You need a browser that can read frames to see this page. @@ -71,9 +72,6 @@ sub acc_menu { $mainlevel = $form->{level}; $mainlevel =~ s/$mainlevel--//g; my $menu = new Menu "$menufile"; - $menu = new Menu "custom_$menufile" if (-f "custom_$menufile"); - $menu = new Menu "$form->{login}_$menufile" - if (-f "$form->{login}_$menufile"); $form->{title} = $locale->text('Accounting Menu'); @@ -117,6 +115,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 &nbsp;-ed label + @chunks = (); + my ($i,$l) = (-1, 20); + map { + if (($l += length $_) < 20) { + $chunks[$i] .= " $_"; + } else { + $l = length $_; + $chunks[++$i] = $_; + } + } split / /, $label; + map { s/ /&nbsp;/ } @chunks; + # end multi line + $label =~ s/ /&nbsp;/g; $menu->{$item}{target} = "main_window" unless $menu->{$item}{target}; @@ -159,16 +175,30 @@ sub section_menu { &section_menu($menu, $item); } else { if ($zeige) { - print - qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">| - . $menu->menuitem(\%myconfig, \%$form, $item, $level) - . qq|$label</a></td></tr>\n|; + if (scalar @chunks <= 1) { + print + qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">| + . $menu->menuitem(\%myconfig, \%$form, $item, $level) + . qq|$label</a></td></tr>\n|; + } else { + my $tmpitem = $menu->menuitem(\%myconfig, \%$form, $item, $level); + print + qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">| + . $tmpitem + . qq|$chunks[0]</a></td></tr>\n|; + map { + print + qq|<tr style="vertical-align:top""><td class="hover">$spacer<img src="image/unterpunkt.png" style="visibility:hidden; width:23; height=2;">| + . $tmpitem + . qq|$chunks[$_]</a></td></tr>\n|; + } 1..$#chunks; + } } } } else { my $ml_ = $form->escape($ml); print - qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle">&nbsp;<a href="menu.pl?path=bin/mozilla&action=acc_menu&level=$ml_&login=$form->{login}&password=$form->{password}" class="nohover">$label</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n|; + qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle">&nbsp;<a href="menu.pl?action=acc_menu&level=$ml_&login=$form->{login}&password=$form->{password}" class="nohover">$label</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n|; &section_menu($menu, $item); #print qq|<br>\n|;