Das (linksseitige) HTML-MenĂ¼ komaptibel zum Textbrowser Links gemacht.
[kivitendo-erp.git] / bin / mozilla / kopf.pl
1 #!/usr/bin/perl
2 #
3
4 #$| = 1;
5
6 #use CGI::Carp qw(fatalsToBrowser);
7
8 use strict;
9
10 sub run {
11   my $session_result = shift;
12   %::myconfig = $::auth->read_user($::form->{login})  if  $::form->{login};
13   $::locale   = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
14
15 my $form     = $main::form;
16 my $locale   = $main::locale;
17
18 $form->header;
19 my $paramstring = $ENV{"QUERY_STRING"};
20 my @felder = split "&", $paramstring;
21 my ($name, $wert);
22 foreach (@felder) {
23   ($name, $wert) = split "=", $_;
24   $wert =~ tr/+/ /;
25   $name = $wert;
26 }
27 my $login =
28     "". $locale->text('User') . ": " . $form->{login}
29   . "  [<a href=\"login.pl?action=logout\" target=\"_top\" title=\"". $locale->text('Logout now') . "\">"
30   . $locale->text('Logout')
31   . "</a>] ";
32 my ($Sekunden, $Minuten,   $Stunden,   $Monatstag, $Monat,
33     $Jahr,     $Wochentag, $Jahrestag, $Sommerzeit)
34   = localtime(time);
35 my $CTIME_String = localtime(time);
36 $Monat     += 1;
37 $Jahrestag += 1;
38 $Monat     = $Monat < 10     ? $Monat     = "0" . $Monat     : $Monat;
39 $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
40 $Jahr += 1900;
41 my @Wochentage = ("Sonntag",    "Montag",  "Dienstag", "Mittwoch",
42                   "Donnerstag", "Freitag", "Samstag");
43 my @Monatsnamen = ("",       "Januar",    "Februar", "M&auml;rz",
44                    "April",  "Mai",       "Juni",    "Juli",
45                    "August", "September", "Oktober", "November",
46                    "Dezember");
47 my $datum =
48     $Wochentage[$Wochentag] . ", der "
49   . $Monatstag . "."
50   . $Monat . "."
51   . $Jahr . " - ";
52
53 #$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
54 my $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
55
56 print qq|
57 <script type="text/javascript">
58 <!--
59 var clockid=new Array()
60 var clockidoutside=new Array()
61 var i_clock=-1
62 var thistime= new Date()
63 var hours= | . $Stunden . qq|;
64 var minutes= | . $Minuten . qq|;
65 var seconds= | . $Sekunden . qq|;
66 if (eval(hours) <10) {hours="0"+hours}
67 if (eval(minutes) < 10) {minutes="0"+minutes}
68 if (seconds < 10) {seconds="0"+seconds}
69 //var thistime = hours+":"+minutes+":"+seconds
70 var thistime = hours+":"+minutes
71
72 function writeclock() {
73   i_clock++
74   if (document.all \|\| document.getElementById \|\| document.layers) {
75     clockid[i_clock]="clock"+i_clock
76     document.write("<font family=arial size=2><span id='"+clockid[i_clock]+"' style='position:relative'>"+thistime+"</span></font>")
77   }
78 }
79
80 function clockon() {
81   thistime= new Date()
82   hours=thistime.getHours()
83   minutes=thistime.getMinutes()
84   seconds=thistime.getSeconds()
85   if (eval(hours) <10) {hours="0"+hours}
86   if (eval(minutes) < 10) {minutes="0"+minutes}
87   if (seconds < 10) {seconds="0"+seconds}
88   //thistime = hours+":"+minutes+":"+seconds
89   thistime = hours+":"+minutes
90
91   if (document.all) {
92     for (i=0;i<=clockid.length-1;i++) {
93       var thisclock=eval(clockid[i])
94       thisclock.innerHTML=thistime
95     }
96   }
97
98   if (document.getElementById) {
99     for (i=0;i<=clockid.length-1;i++) {
100       document.getElementById(clockid[i]).innerHTML=thistime
101     }
102   }
103   var timer=setTimeout("clockon()",60000)
104 }
105 window.onload=clockon
106 //-->
107 </script>
108 |;
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 # is there any better solution then the JS-Link for Back? Possibly with the callback variable?
115
116 print qq|
117 <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;">
118 <script language='JavaScript' src='js/switchmenuframe.js'></script>
119 <table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
120   <tr>|;
121    if ($framesize ne 240) {    # only show the the links in case of "links" in $ENV{HTTP_USER_AGENT} (see sub _calc_framesize)
122       print qq|
123       <td  style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
124       [<a href="JavaScript:Switch_Menu(|.$framesize.qq|);" title="| . $locale->text('Switch Menu on / off') . qq|">| . $locale->text('Menu') . qq|</a>]
125       &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>]
126       &nbsp;[<a href="JavaScript:top.main_window.print();" title="| . $locale->text('Hardcopy') . qq|">| . $locale->text('Print') . qq|</a>]
127       &nbsp;[<a href="Javascript:top.main_window.history.back();" title="| . $locale->text('Go one step back') . qq|">| . $locale->text('Back') . qq|</a>]
128       &nbsp;[<a href="Javascript:top.main_window.history.forward();" title="| . $locale->text('Go one step forward') . qq|">| . $locale->text('Fwd') . qq|</a>]
129       </td>|;
130    }
131    print qq|
132     <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>|
133   . $login . $datum . qq| <script>writeclock()</script>&nbsp;
134     </td>
135   </tr>
136 </table>
137 </body>
138 </html>
139 |;
140
141 sub _calc_framesize {
142   my $is_lynx_browser   = $ENV{HTTP_USER_AGENT} =~ /links/i;
143   my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
144   my $is_mobile_style   = $::form->{stylesheet} =~ /mobile/i;
145
146   return  $is_mobile_browser && $is_mobile_style ?  130
147         : $is_lynx_browser                       ?  240
148         :                                           180;
149 }
150
151 }
152
153 1;
154
155 #