From 6fb7bcc9f1e00bc068a4514a3c7fa599119e6e06 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 13 May 2011 15:30:23 +0200 Subject: [PATCH] kopf.pl auf Controller umgestellt --- SL/Controller/DebugMenu.pm | 4 ++-- SL/Controller/FrameHeader.pm | 17 +++++++++++++++++ SL/Dispatcher.pm | 2 +- SL/Form.pm | 24 +++++++++++++++++------- bin/mozilla/am.pl | 2 +- bin/mozilla/kopf.pl | 23 ----------------------- bin/mozilla/menu.pl | 2 +- config/lx_office.conf.default | 3 ++- css/frame_header/header.css | 26 ++++++++++++++++++++++++++ js/switchmenuframe.js | 3 --- scripts/mklinks.sh | 4 ++-- templates/webpages/menu/header.html | 17 +++++------------ 12 files changed, 74 insertions(+), 53 deletions(-) create mode 100644 SL/Controller/FrameHeader.pm delete mode 100644 bin/mozilla/kopf.pl create mode 100644 css/frame_header/header.css diff --git a/SL/Controller/DebugMenu.pm b/SL/Controller/DebugMenu.pm index d612d3701..0e536760a 100644 --- a/SL/Controller/DebugMenu.pm +++ b/SL/Controller/DebugMenu.pm @@ -9,7 +9,7 @@ __PACKAGE__->run_before(sub { die 'not allowed in config' unless $::lx_office_co sub action_reload { my ($self, %params) = @_; - print $::cgi->redirect('kopf.pl'); + print $::cgi->redirect('controller.pl?action=FrameHeader/header'); exit; } @@ -17,7 +17,7 @@ sub action_toggle { my ($self, %params) = @_; $::lxdebug->level_by_name($::form->{level}, !$::lxdebug->level_by_name($::form->{level})); - print $::cgi->redirect('kopf.pl'); + print $::cgi->redirect('controller.pl?action=FrameHeader/header'); return; } diff --git a/SL/Controller/FrameHeader.pm b/SL/Controller/FrameHeader.pm new file mode 100644 index 000000000..855350c73 --- /dev/null +++ b/SL/Controller/FrameHeader.pm @@ -0,0 +1,17 @@ +package SL::Controller::FrameHeader; + +use strict; +use parent qw(SL::Controller::Base); + +sub action_header { + my ($self) = @_; + + delete $::form->{stylesheet}; + $::form->use_stylesheet('frame_header/header.css'); + $self->render('menu/header', + now => DateTime->now_local, + is_fastcgi => scalar($::dispatcher->interface_type =~ /fastcgi/i), + is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i)); +} + +1; diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index e72897693..47c2e2a35 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -188,7 +188,7 @@ sub handle_request { $::form->error($::locale->text('System currently down for maintenance!')) if -e ($::lx_office_conf{paths}->{userspath} . "/nologin") && $script ne 'admin'; - if ($script eq 'login' or $script eq 'admin' or $script eq 'kopf') { + if ($script eq 'login' or $script eq 'admin') { $::form->{titlebar} = "Lx-Office " . $::locale->text('Version') . " $::form->{version}"; ::run($session_result); diff --git a/SL/Form.pm b/SL/Form.pm index dfff9b4f7..cef5995ab 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -640,6 +640,18 @@ sub create_http_response { return $output; } +sub use_stylesheet { + my $self = shift; + + $self->{stylesheet} = [ $self->{stylesheet} ] unless ref $self->{stylesheet} eq 'ARRAY'; + $self->{stylesheet} = [ grep { -f } + map { m:^css/: ? $_ : "css/$_" } + grep { $_ } + (@{ $self->{stylesheet} }, @_) + ]; + + return @{ $self->{stylesheet} }; +} sub header { $::lxdebug->enter_sub; @@ -662,8 +674,7 @@ sub header { push @header, ""; } - push @header, "" - for grep { -f "css/$_" } apply { s|.*/|| } $self->{stylesheet}, $self->{stylesheets}; + push @header, map { qq|| } $self->use_stylesheet; push @header, "" if $self->{landscape}; push @header, "" if -f $self->{favicon}; @@ -1638,7 +1649,7 @@ sub date_closed { # Leere Datumseingabe i.O. # SELECT 1 FROM defaults WHERE '' < closedto # normale Zahlungsbuchung über Rechnungsmaske i.O. - # SELECT 1 FROM defaults WHERE '10.05.2011' < closedto + # SELECT 1 FROM defaults WHERE '10.05.2011' < closedto # Testfälle mit definiertem closedto (30.04.2011): # Leere Datumseingabe i.O. # SELECT 1 FROM defaults WHERE '' < closedto @@ -3812,7 +3823,7 @@ Examples: =head2 C
Generates a general purpose http/html header and includes most of the scripts -ans stylesheets needed. +and stylesheets needed. Stylesheets can be added with L. Only one header will be generated. If the method was already called in this request it will not output anything and return undef. Also if no @@ -3832,9 +3843,8 @@ default to 3 seconds and the refering url. =item stylesheet -=item stylesheets - -If these are arrayrefs the contents will be inlined into the header. +Either a scalar or an array ref. Will be inlined into the header. Add +stylesheets with the L function. =item landscape diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 5dfb72f00..c6bb8e47c 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -504,7 +504,7 @@ sub list_account { push(@ { $form->{AJAX} }, $pjx); - $form->{stylesheets} = "list_accounts.css"; + $form->use_stylesheet("list_accounts.css"); $form->{title} = $locale->text('Chart of Accounts'); $form->header; diff --git a/bin/mozilla/kopf.pl b/bin/mozilla/kopf.pl deleted file mode 100644 index 0228566ae..000000000 --- a/bin/mozilla/kopf.pl +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/perl - -use strict; -use DateTime; - -sub run { - my $session_result = shift; - - %::myconfig = $::auth->read_user($::form->{login}) if $::form->{login}; - $::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode}; - - $::form->header; - print $::form->parse_html_template('menu/header', { - now => DateTime->now, - show_debug => $::lx_office_conf{debug}{show_debug_menu}, - lxdebug => $::lxdebug, - is_links => ($ENV{HTTP_USER_AGENT} =~ /links/i), - }); -} - -1; - -# diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index cd0ca0d91..15c43efe5 100644 --- a/bin/mozilla/menu.pl +++ b/bin/mozilla/menu.pl @@ -63,7 +63,7 @@ sub display { print qq| - + diff --git a/config/lx_office.conf.default b/config/lx_office.conf.default index 5f7f272a4..bc350c7d1 100644 --- a/config/lx_office.conf.default +++ b/config/lx_office.conf.default @@ -222,7 +222,8 @@ global_level = NONE # default. watch_form = 0 -# Include menu options for debugging in the HTML menu +# Include menu options for debugging in the HTML menu. Works only in +# FastCGI mode. show_debug_menu = 0 # If you want to debug the creation of LaTeX files then set this to 1. diff --git a/css/frame_header/header.css b/css/frame_header/header.css new file mode 100644 index 000000000..cfca0816a --- /dev/null +++ b/css/frame_header/header.css @@ -0,0 +1,26 @@ +body { + margin: 0; + color: white; + background: url('../../image/fade.png') repeat-x; +} + +a:link, a:visited, a:hover, a:active { + color: white; +} + +body > * { + font-size: 12px; + font-family: verdana,arial,sans-serif; + vertical-align: middle; +} + +table { + border: 0; + width: 100%; + background: url('../../image/bg_titel.gif'); + border-spacing: 0; +} + +td { + padding: 0; +} diff --git a/js/switchmenuframe.js b/js/switchmenuframe.js index d0bf2ac2d..ec2242648 100644 --- a/js/switchmenuframe.js +++ b/js/switchmenuframe.js @@ -1,6 +1,3 @@ -/* 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); diff --git a/scripts/mklinks.sh b/scripts/mklinks.sh index 190433f2c..52b8bb4d9 100755 --- a/scripts/mklinks.sh +++ b/scripts/mklinks.sh @@ -1,10 +1,10 @@ #!/bin/sh -for i in am dispatcher kopf login; do +for i in am dispatcher login; do rm $i.pl 2> /dev/null ln -s admin.pl $i.pl done -for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do +for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do rm $i.pl 2> /dev/null ln -s am.pl $i.pl done diff --git a/templates/webpages/menu/header.html b/templates/webpages/menu/header.html index 359c94094..4c2cbddc2 100644 --- a/templates/webpages/menu/header.html +++ b/templates/webpages/menu/header.html @@ -1,12 +1,5 @@ [%- USE T8 %] - - + @@ -19,13 +12,13 @@ [[% 'Fwd' | $T8 %]] [%- END %] -[% IF show_debug %] +[% IF is_fastcgi && LXCONFIG.debug.show_debug_menu %] [%- END %]
Debug: [FCGI Reload] - [[% IF lxdebug.level_by_name('request_timer') %]Timing[% ELSE %]Timing[% END %]] - [[% IF lxdebug.level_by_name('trace') %]Trace[% ELSE %]Trace[% END %]] - [[% IF lxdebug.level_by_name('query') %]Query[% ELSE %]Query[% END %]] + [[% IF LXDEBUG.level_by_name('request_timer') %]Timing[% ELSE %]Timing[% END %]] + [[% IF LXDEBUG.level_by_name('trace') %]Trace[% ELSE %]Trace[% END %]] + [[% IF LXDEBUG.level_by_name('query') %]Query[% ELSE %]Query[% END %]] -- 2.20.1