From: Sven Donath Date: Tue, 28 Sep 2010 13:20:30 +0000 (+0200) Subject: Zweiter Anlauf: Das (linksseitige) HTML-Menü komaptibel zum Textbrowser Links gemacht. X-Git-Tag: release-2.6.2beta1~112^2~3^2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=da80eb32dd2158bc959a15db82002e58628d8a32;p=kivitendo-erp.git Zweiter Anlauf: Das (linksseitige) HTML-Menü komaptibel zum Textbrowser Links gemacht. (siehe Commits d2d63d und 9d5514) Weiterhin werden die Bedienelemente (HTML-Links) im Kopf nur angezeigt, wenn nicht der Browser Links oder Links2 verwendet wird, da sie auf JavaScript basieren und somit keine Funktion hätten. Entgegen der zurück genommenen Version arbeitet es jetzt ohne globale Variable. Das Menü Ein-/Ausklappen ist jetzt voll JavaScript-basiert. --- diff --git a/bin/mozilla/kopf.pl b/bin/mozilla/kopf.pl index ac3935dd4..ed11e522b 100644 --- a/bin/mozilla/kopf.pl +++ b/bin/mozilla/kopf.pl @@ -107,23 +107,22 @@ window.onload=clockon |; -# -my $framesize = _calc_framesize(); # framesize calculation as in menu.pl is only a quick and dirty hack here - # it would be better to use a global or config variable - print qq| - - + |; + if ( !($ENV{HTTP_USER_AGENT} =~ /links/i) ) { # do not show the the links in case of "links" in HTTP_USER_AGENT + print qq| + |; + } + print qq| @@ -132,17 +131,6 @@ print qq| |; - -sub _calc_framesize { - my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i; - my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i; - my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i; - - return $is_mobile_browser && $is_mobile_style ? 130 - : $is_lynx_browser ? 240 - : 180; -} - } 1; diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index 115880df9..b119d7a59 100644 --- a/bin/mozilla/menu.pl +++ b/bin/mozilla/menu.pl @@ -33,7 +33,7 @@ # CHANGE LOG: # DS. 2002-03-25 Created # 2004-12-14 - New Optik - Marco Welter -# 2010-08-19 - Icons for sub entries and one click +# 2010-08-19 - Icons for sub entries and single click behavior, unlike XUL-Menu # JS switchable HTML-menu - Sven Donath ####################################################################### @@ -51,12 +51,12 @@ my $mainlevel; sub display { $main::lxdebug->enter_sub(); - my $form = $main::form; + my $form = $main::form; - my $callback = $form->unescape($form->{callback}); - $callback = URI->new($callback)->rel($callback) if $callback; - $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; - my $framesize = _calc_framesize(); + my $callback = $form->unescape($form->{callback}); + $callback = URI->new($callback)->rel($callback) if $callback; + $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; + my $framesize = _calc_framesize(); $form->header; @@ -82,7 +82,7 @@ sub acc_menu { my $form = $main::form; my $locale = $main::locale; - my $framesize = _calc_framesize(); # how to get it into kopf.pl or vice versa? + my $framesize = _calc_framesize(); $mainlevel = $form->{level}; $mainlevel =~ s/\Q$mainlevel\E--//g; @@ -94,10 +94,10 @@ sub acc_menu { print qq| - -|; + +|; print qq|
\n
- [| . $locale->text('Menu') . qq|] -  [| . $locale->text('New Win/Tab') . qq|] -  [| . $locale->text('Print') . qq|] -  [| . $locale->text('Back') . qq|] -  [| . $locale->text('Fwd') . qq|] - -
+ [| . $locale->text('Menu') . qq|] +  [| . $locale->text('New Win/Tab') . qq|] +  [| . $locale->text('Print') . qq|] +  [| . $locale->text('Back') . qq|] +  [| . $locale->text('Fwd') . qq|] + | . $login . $datum . qq|  
\n|; §ion_menu($menu); @@ -115,9 +115,11 @@ sub section_menu { $main::lxdebug->enter_sub(); my ($menu, $level) = @_; - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + my $is_links_browser = 1; + if ( _calc_framesize() eq 240) { $is_links_browser = 0; } my $zeige; @@ -199,18 +201,20 @@ sub section_menu { if ($zeige) { if (scalar @chunks <= 1) { print - qq|\n|; } else { @@ -231,7 +235,12 @@ sub section_menu { } else { my $ml_ = $form->escape($ml); print - qq|\n|; + qq|\n|; §ion_menu($menu, $item); print qq|\n|; @@ -248,7 +257,7 @@ sub _calc_framesize { return $is_mobile_browser && $is_mobile_style ? 130 : $is_lynx_browser ? 240 - : 180; + : 200; } 1; diff --git a/js/switchmenuframe.js b/js/switchmenuframe.js index 0399a2ebe..d0bf2ac2d 100644 --- a/js/switchmenuframe.js +++ b/js/switchmenuframe.js @@ -1,20 +1,20 @@ -/* This is used in bin/mozilla/kopf.pl to switch the HTML sidemenu on/off +/* This is used in bin/mozilla/kopf.pl to switch the HTML side menu on/off 2010, Sven Donath, lxo@dexo.de */ var vSwitch_Menu = 1; +var FrameSize = (parent.document.getElementById('menuframe').cols); -function Switch_Menu(framesize) +function Switch_Menu() { - if (vSwitch_Menu) - { - vSwitch_Menu=false; - parent.document.getElementById('menuframe').setAttribute('cols','30,*') - } - else - { - vSwitch_Menu=true; - framesize = framesize + ',*'; - parent.document.getElementById('menuframe').setAttribute('cols',framesize); + if (vSwitch_Menu) + { + vSwitch_Menu=false; + parent.document.getElementById('menuframe').setAttribute('cols','30,*'); } - return; + else + { + vSwitch_Menu=true; + parent.document.getElementById('menuframe').setAttribute('cols',FrameSize); + } + return; }
$spacer| + qq|
$spacer| . $menu->menuitem(\%myconfig, \%$form, $item, $level) ; - - if (-f "image/icons/16x16/$label_icon") - { print - qq|  | } + + if (-f "image/icons/16x16/$label_icon" && ($is_links_browser)) + { print + qq|  | } else { - print qq||; + if ($is_links_browser) { + print qq||; + } } - + print qq|$label
 $label    
+ |; + if ($is_links_browser) { + print qq||; + } + print qq| $label