From da80eb32dd2158bc959a15db82002e58628d8a32 Mon Sep 17 00:00:00 2001 From: Sven Donath Date: Tue, 28 Sep 2010 15:20:30 +0200 Subject: [PATCH] =?utf8?q?Zweiter=20Anlauf:=20Das=20(linksseitige)=20HTML-?= =?utf8?q?Men=C3=BC=20komaptibel=20zum=20Textbrowser=20Links=20gemacht.=20?= =?utf8?q?(siehe=20Commits=20d2d63d=20und=209d5514)=20Weiterhin=20werden?= =?utf8?q?=20die=20Bedienelemente=20(HTML-Links)=20im=20Kopf=20nur=20angez?= =?utf8?q?eigt,=20wenn=20nicht=20der=20Browser=20Links=20oder=20Links2=20v?= =?utf8?q?erwendet=20wird,=20da=20sie=20auf=20JavaScript=20basieren=20und?= =?utf8?q?=20somit=20keine=20Funktion=20h=C3=A4tten.=20Entgegen=20der=20zu?= =?utf8?q?r=C3=BCck=20genommenen=20Version=20arbeitet=20es=20jetzt=20ohne?= =?utf8?q?=20globale=20Variable.=20Das=20Men=C3=BC=20Ein-/Ausklappen=20ist?= =?utf8?q?=20jetzt=20voll=20JavaScript-basiert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/kopf.pl | 36 +++++++++------------------ bin/mozilla/menu.pl | 57 +++++++++++++++++++++++++------------------ js/switchmenuframe.js | 26 ++++++++++---------- 3 files changed, 58 insertions(+), 61 deletions(-) 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; } -- 2.20.1
$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