Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision da80eb32

Von Sven Donath vor etwa 14 Jahren hinzugefügt

  • ID da80eb32dd2158bc959a15db82002e58628d8a32
  • Vorgänger 9d551488
  • Nachfolger 48c946bd

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.

Unterschiede anzeigen:

bin/mozilla/kopf.pl
107 107
</script>
108 108
|;
109 109

  
110
#
111
my $framesize = _calc_framesize(); # framesize calculation as in menu.pl is only a quick and dirty hack here
112
                                   # it would be better to use a global or config variable
113

  
114 110
print qq|
115 111
<body bgcolor="#ffffff" text="#ffffff" link="#ffffff" vlink="#ffffff" alink="#ffffff" topmargin="0" leftmargin="0"  marginwidth="0" marginheight="0" style="background-image: url('image/fade.png'); background-repeat:repeat-x;">
116 112
<script language='JavaScript' src='js/switchmenuframe.js'></script>
117 113
<table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
118
  <tr>
119
    <td  style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
120
      [<a href="JavaScript:Switch_Menu(|.$framesize.qq|);" title="| . $locale->text('Switch Menu on / off') . qq|">| . $locale->text('Menu') . qq|</a>]
121
      &nbsp;[<a HREF="login.pl" target="_blank" title="| . $locale->text('Open a further Lx-Office Window or Tab') . qq|">| . $locale->text('New Win/Tab') . qq|</a>]
122
      &nbsp;[<a href="JavaScript:top.main_window.print();" title="| . $locale->text('Hardcopy') . qq|">| . $locale->text('Print') . qq|</a>]
123
      &nbsp;[<a href="Javascript:top.main_window.history.back();" title="| . $locale->text('Go one step back') . qq|">| . $locale->text('Back') . qq|</a>]
124
      &nbsp;[<a href="Javascript:top.main_window.history.forward();" title="| . $locale->text('Go one step forward') . qq|">| . $locale->text('Fwd') . qq|</a>]
125
      <!-- is there any better solution for Back? Possibly with the callback variable? -->
126
    </td>
114
  <tr>|;
115
   if ( !($ENV{HTTP_USER_AGENT} =~ /links/i) ) {    # do not show the the links in case of "links" in HTTP_USER_AGENT
116
      print qq|
117
       <td  style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
118
       [<a href="JavaScript:Switch_Menu();" title="| . $locale->text('Switch Menu on / off') . qq|">| . $locale->text('Menu') . qq|</a>]
119
       &nbsp;[<a HREF="login.pl" target="_blank" title="| . $locale->text('Open a further Lx-Office Window or Tab') . qq|">| . $locale->text('New Win/Tab') . qq|</a>]
120
       &nbsp;[<a href="JavaScript:top.main_window.print();" title="| . $locale->text('Hardcopy') . qq|">| . $locale->text('Print') . qq|</a>]
121
       &nbsp;[<a href="Javascript:top.main_window.history.back();" title="| . $locale->text('Go one step back') . qq|">| . $locale->text('Back') . qq|</a>]
122
       &nbsp;[<a href="Javascript:top.main_window.history.forward();" title="| . $locale->text('Go one step forward') . qq|">| . $locale->text('Fwd') . qq|</a>]
123
      </td>|;
124
   }
125
   print qq|
127 126
    <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>|
128 127
  . $login . $datum . qq| <script>writeclock()</script>&nbsp;
129 128
    </td>
......
132 131
</body>
133 132
</html>
134 133
|;
135

  
136
sub _calc_framesize {
137
  my $is_lynx_browser   = $ENV{HTTP_USER_AGENT} =~ /links/i;
138
  my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
139
  my $is_mobile_style   = $::form->{stylesheet} =~ /mobile/i;
140

  
141
  return  $is_mobile_browser && $is_mobile_style ?  130
142
        : $is_lynx_browser                       ?  240
143
        :                                           180;
144
}
145

  
146 134
}
147 135

  
148 136
1;
bin/mozilla/menu.pl
33 33
# CHANGE LOG:
34 34
#   DS. 2002-03-25  Created
35 35
#  2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
36
#  2010-08-19 - Icons for sub entries and one click 
36
#  2010-08-19 - Icons for sub entries and single click behavior, unlike XUL-Menu
37 37
#               JS switchable HTML-menu - Sven Donath <lxo@dexo.de>
38 38
#######################################################################
39 39

  
......
51 51
sub display {
52 52
  $main::lxdebug->enter_sub();
53 53

  
54
  my $form     = $main::form;
54
  my $form      = $main::form;
55 55

  
56
  my $callback   = $form->unescape($form->{callback});
57
  $callback      = URI->new($callback)->rel($callback) if $callback;
58
  $callback      = "login.pl?action=company_logo"      if $callback =~ /^(\.\/)?$/;
59
  my $framesize  = _calc_framesize();
56
  my $callback  = $form->unescape($form->{callback});
57
  $callback     = URI->new($callback)->rel($callback) if $callback;
58
  $callback     = "login.pl?action=company_logo"      if $callback =~ /^(\.\/)?$/;
59
  my $framesize = _calc_framesize();
60 60

  
61 61
  $form->header;
62 62

  
......
82 82

  
83 83
  my $form      = $main::form;
84 84
  my $locale    = $main::locale;
85
  my $framesize = _calc_framesize(); # how to get it into kopf.pl or vice versa?
85
  my $framesize = _calc_framesize();
86 86

  
87 87
  $mainlevel = $form->{level};
88 88
  $mainlevel =~ s/\Q$mainlevel\E--//g;
......
94 94

  
95 95
  print qq|
96 96
<body class="menu">
97

  
98
|;
97
 
98
|; 
99 99
  print qq|<div align="left">\n<table width="|
100
    . $framesize
100
    . ($framesize-2)
101 101
    . qq|" border="0">\n|;
102 102

  
103 103
  &section_menu($menu);
......
115 115
  $main::lxdebug->enter_sub();
116 116
  my ($menu, $level) = @_;
117 117

  
118
  my $form     = $main::form;
119
  my %myconfig = %main::myconfig;
120
  my $locale   = $main::locale;
118
  my $form      = $main::form;
119
  my %myconfig  = %main::myconfig;
120
  my $locale    = $main::locale;
121
  my $is_links_browser = 1;
122
  if ( _calc_framesize() eq 240) { $is_links_browser = 0; }
121 123

  
122 124
  my $zeige;
123 125

  
......
199 201
          if ($zeige) {
200 202
            if (scalar @chunks <= 1) {
201 203
              print
202
                qq|<tr><td class="hover" height="16" >$spacer| 
204
                qq|<tr><td class="hover" height="16" >$spacer|
203 205
                . $menu->menuitem(\%myconfig, \%$form, $item, $level) ;
204
              
205
            if (-f "image/icons/16x16/$label_icon")
206
             { print 
207
                qq|<img src="image/icons/16x16/$label_icon" border="0" style="vertical-align:text-top" title="| 
208
                . $label 
209
                . qq|">&nbsp;&nbsp;| } 
206

  
207
            if (-f "image/icons/16x16/$label_icon" && ($is_links_browser))
208
             { print
209
                qq|<img src="image/icons/16x16/$label_icon" border="0" style="vertical-align:text-top" title="|
210
                . $label
211
                . qq|">&nbsp;&nbsp;| }
210 212
            else {
211
               print qq|<img src="image/unterpunkt.png" border="0" style="vertical-align:text-top">|;   
213
                   if ($is_links_browser) {
214
                    print qq|<img src="image/unterpunkt.png" border="0" style="vertical-align:text-top">|;
215
                   }
212 216
                }
213
                
217

  
214 218
               print
215 219
                 qq|$label</a></td></tr>\n|;
216 220
            } else {
......
231 235
      } else {
232 236
        my $ml_ = $form->escape($ml);
233 237
        print
234
          qq|<tr><td class="bg" height="24" align="left" valign="middle"><a href="menu.pl?action=acc_menu&level=$ml_" class="nohover" title="$label"><img src="image/icons/24x24/$item.png" border="0" style="vertical-align:middle" title="$label">&nbsp;$label</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n|;
238
          qq|<tr><td class="bg" height="24" align="left" valign="middle">
239
          <a href="menu.pl?action=acc_menu&level=$ml_" class="nohover" title="$label">|;
240
              if ($is_links_browser) {
241
                  print qq|<img src="image/icons/24x24/$item.png" border="0" style="vertical-align:middle" title="$label">|;
242
              }
243
          print qq|&nbsp;$label</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n|;
235 244
        &section_menu($menu, $item);
236 245

  
237 246
        print qq|\n|;
......
248 257

  
249 258
  return  $is_mobile_browser && $is_mobile_style ?  130
250 259
        : $is_lynx_browser                       ?  240
251
        :                                           180;
260
        :                                           200;
252 261
}
253 262

  
254 263
1;
js/switchmenuframe.js
1
/* This is used in bin/mozilla/kopf.pl to switch the HTML sidemenu on/off
1
/* This is used in bin/mozilla/kopf.pl to switch the HTML side menu on/off
2 2
   2010, Sven Donath, lxo@dexo.de  */
3 3

  
4 4
var vSwitch_Menu = 1;
5
var FrameSize = (parent.document.getElementById('menuframe').cols);
5 6

  
6
function Switch_Menu(framesize)
7
function Switch_Menu()
7 8
{
8
	if (vSwitch_Menu)
9
	{
10
		vSwitch_Menu=false;
11
                parent.document.getElementById('menuframe').setAttribute('cols','30,*')
12
	}
13
	else
14
	{
15
		vSwitch_Menu=true;
16
				framesize = framesize + ',*';
17
                parent.document.getElementById('menuframe').setAttribute('cols',framesize);
9
    if (vSwitch_Menu)
10
    {
11
        vSwitch_Menu=false;
12
                parent.document.getElementById('menuframe').setAttribute('cols','30,*');
18 13
    }
19
	return;
14
    else
15
    {
16
        vSwitch_Menu=true;
17
                parent.document.getElementById('menuframe').setAttribute('cols',FrameSize);
18
    }
19
    return;
20 20
}

Auch abrufbar als: Unified diff