Revision 3e8a8c57
Von Sven Schöling vor mehr als 13 Jahren hinzugefügt
SL/Controller/DebugMenu.pm | ||
---|---|---|
1 |
package SL::Controller::DebugMenu; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::Base); |
|
5 |
|
|
6 |
# safety |
|
7 |
__PACKAGE__->run_before(sub { die 'not allowed in config' unless $::lx_office_conf{debug}{show_debug_menu}; }); |
|
8 |
|
|
9 |
sub action_reload { |
|
10 |
my ($self, %params) = @_; |
|
11 |
|
|
12 |
print $::cgi->redirect('kopf.pl'); |
|
13 |
exit; |
|
14 |
} |
|
15 |
|
|
16 |
sub action_toggle { |
|
17 |
my ($self, %params) = @_; |
|
18 |
|
|
19 |
$::lxdebug->level_by_name($::form->{level}, !$::lxdebug->level_by_name($::form->{level})); |
|
20 |
print $::cgi->redirect('kopf.pl'); |
|
21 |
return; |
|
22 |
} |
|
23 |
|
|
24 |
1; |
SL/LXDebug.pm | ||
---|---|---|
296 | 296 |
@_ == 2 ? $_[0]->{file} = $_[1] : $_[0]->{file}; |
297 | 297 |
} |
298 | 298 |
|
299 |
sub _by_name { |
|
300 |
my ($self, $level) = @_; |
|
301 |
my $meth = $self->can(uc $level); |
|
302 |
die 'unknown level' unless $meth; |
|
303 |
$meth->(); |
|
304 |
} |
|
305 |
|
|
306 |
sub level_by_name { |
|
307 |
my ($self, $level, $val) = @_; |
|
308 |
if (@_ == 3) { |
|
309 |
$global_level |= $self->_by_name($level) if $val; |
|
310 |
$global_level &= ~$self->_by_name($level) if !$val; |
|
311 |
} |
|
312 |
return $global_level & $self->_by_name($level); |
|
313 |
} |
|
314 |
|
|
299 | 315 |
1; |
bin/mozilla/kopf.pl | ||
---|---|---|
1 | 1 |
#!/usr/bin/perl |
2 |
# |
|
3 |
|
|
4 |
#$| = 1; |
|
5 |
|
|
6 |
#use CGI::Carp qw(fatalsToBrowser); |
|
7 | 2 |
|
8 | 3 |
use strict; |
4 |
use DateTime; |
|
9 | 5 |
|
10 | 6 |
sub run { |
11 | 7 |
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ä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 | 8 |
|
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 |
|; |
|
9 |
%::myconfig = $::auth->read_user($::form->{login}) if $::form->{login}; |
|
10 |
$::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode}; |
|
109 | 11 |
|
110 |
print qq| |
|
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;"> |
|
112 |
<script language='JavaScript' src='js/switchmenuframe.js'></script> |
|
113 |
<table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0"> |
|
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 |
[<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 |
[<a href="JavaScript:top.main_window.print();" title="| . $locale->text('Hardcopy') . qq|">| . $locale->text('Print') . qq|</a>] |
|
121 |
[<a href="Javascript:top.main_window.history.back();" title="| . $locale->text('Go one step back') . qq|">| . $locale->text('Back') . qq|</a>] |
|
122 |
[<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| |
|
126 |
<td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>| |
|
127 |
. $login . $datum . qq| <script>writeclock()</script> |
|
128 |
</td> |
|
129 |
</tr> |
|
130 |
</table> |
|
131 |
</body> |
|
132 |
</html> |
|
133 |
|; |
|
12 |
$::form->header; |
|
13 |
print $::form->parse_html_template('menu/header', { |
|
14 |
now => DateTime->now, |
|
15 |
show_debug => $::lx_office_conf{debug}{show_debug_menu}, |
|
16 |
lxdebug => $::lxdebug, |
|
17 |
is_links => ($ENV{HTTP_USER_AGENT} =~ /links/i), |
|
18 |
}); |
|
134 | 19 |
} |
135 | 20 |
|
136 | 21 |
1; |
config/lx_office.conf.default | ||
---|---|---|
222 | 222 |
# default. |
223 | 223 |
watch_form = 0 |
224 | 224 |
|
225 |
# Im HTML Menü ein Hilfsmenü zur Debugsteuerung zeigen. |
|
226 |
show_debug_menu = 0 |
|
227 |
|
|
225 | 228 |
# If you want to debug the creation of LaTeX files then set this to 1. |
226 | 229 |
# That way the temporary LaTeX files created during PDF creation are |
227 | 230 |
# not removed and remain in the "users" directory. |
templates/webpages/menu/header.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
<style type='text/css'> |
|
3 |
body { margin: 0; color: white; background: url('image/fade.png') repeat-x; } |
|
4 |
a:link, a:visited, a:hover, a:active { color:white } |
|
5 |
body > * { font-size: 12px; font-family:verdana,arial,sans-serif; vertical-align:middle; } |
|
6 |
table { border:0; width: 100%; background: url('image/bg_titel.gif'); border-spacing:0; } |
|
7 |
td { padding: 0 } |
|
8 |
</style> |
|
9 |
<script language='javascript' src='js/switchmenuframe.js'></script> |
|
10 |
<body> |
|
11 |
<table> |
|
12 |
<tr> |
|
13 |
[% UNLESS is_links %] |
|
14 |
<td nowrap> |
|
15 |
[<a href="JavaScript:Switch_Menu();" title="[% 'Switch Menu on / off' | $T8 %]">[% 'Menu' | $T8 %]</a>] |
|
16 |
[<a HREF="login.pl" target="_blank" title="[% 'Open a further Lx-Office Window or Tab' | $T8 %]">[% 'New Win/Tab' | $T8 %]</a>] |
|
17 |
[<a href="JavaScript:top.main_window.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>] |
|
18 |
[<a href="Javascript:top.main_window.history.back();" title="[% 'Go one step back' | $T8 %]">[% 'Back' | $T8 %]</a>] |
|
19 |
[<a href="Javascript:top.main_window.history.forward();" title="[% 'Go one step forward' | $T8 %]">[% 'Fwd' | $T8 %]</a>] |
|
20 |
</td> |
|
21 |
[%- END %] |
|
22 |
[% IF show_debug %] |
|
23 |
<td align='center' nowrap> |
|
24 |
Debug: |
|
25 |
[<a href='controller.pl?action=DebugMenu/reload']>FCGI Reload</a>] |
|
26 |
[<a href='controller.pl?action=DebugMenu/toggle&level=request_timer'>[% IF lxdebug.level_by_name('request_timer') %]<b>Timing</b>[% ELSE %]Timing[% END %]</a>] |
|
27 |
[<a href='controller.pl?action=DebugMenu/toggle&level=trace'>[% IF lxdebug.level_by_name('trace') %]<b>Trace</b>[% ELSE %]Trace[% END %]</a>] |
|
28 |
[<a href='controller.pl?action=DebugMenu/toggle&level=query'>[% IF lxdebug.level_by_name('query') %]<b>Query</b>[% ELSE %]Query[% END %]</a>] |
|
29 |
</td> |
|
30 |
[%- END %] |
|
31 |
<td align="right" nowrap> |
|
32 |
[% 'User' | $T8 %]: |
|
33 |
[% login %] |
|
34 |
[<a href="login.pl?action=logout" target="_top" title="[% 'Logout now' | $T8 %]">[% 'Logout' | $T8 %]</a>] |
|
35 |
[% now.to_lxoffice %] - |
|
36 |
[% now.hms %] |
|
37 |
</td> |
|
38 |
</tr> |
|
39 |
</table> |
|
40 |
</body> |
|
41 |
</html> |
Auch abrufbar als: Unified diff
Debug Menü im HTML Menü. FCGI Entwicklung leicht gemacht.