From 3880d6570d3ee1d0f26e54887defcf49f359b9a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 11 Sep 2012 11:06:25 +0200 Subject: [PATCH] Erste Version Frameless --- SL/Controller/Base.pm | 2 +- SL/Controller/FrameHeader.pm | 3 +- SL/Controller/LoginScreen.pm | 16 +++------- SL/Form.pm | 45 ++++++++++++++++++--------- bin/mozilla/menu.pl | 47 ++++------------------------- css/lx-office-erp/menu.css | 4 ++- templates/webpages/menu/header.html | 4 +++ templates/webpages/menu/menu.html | 3 -- 8 files changed, 50 insertions(+), 74 deletions(-) diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index 6d879e82a..7fe1d36ea 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -84,7 +84,7 @@ sub render { } else { $::form->{title} = $locals{title} if $locals{title}; - $::form->header; + $::form->header(no_menu => $options->{no_menu}); } } diff --git a/SL/Controller/FrameHeader.pm b/SL/Controller/FrameHeader.pm index 855350c73..69c48eb70 100644 --- a/SL/Controller/FrameHeader.pm +++ b/SL/Controller/FrameHeader.pm @@ -6,9 +6,8 @@ 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', + $self->render('menu/header', { partial => 1, no_output => 1 }, now => DateTime->now_local, is_fastcgi => scalar($::dispatcher->interface_type =~ /fastcgi/i), is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i)); diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm index 47dfa90c9..aace43a19 100644 --- a/SL/Controller/LoginScreen.pm +++ b/SL/Controller/LoginScreen.pm @@ -19,7 +19,7 @@ sub action_user_login { return if $self->_redirect_to_main_script_if_already_logged_in; # Otherwise show the login form. - $self->render('login_screen/user_login'); + $self->render('login_screen/user_login', { no_menu => 1 }); } sub action_logout { @@ -27,7 +27,7 @@ sub action_logout { $::auth->destroy_session; $::auth->create_or_refresh_session; - $self->render('login_screen/user_login', error => $::locale->text('You are logged out!')); + $self->render('login_screen/user_login', { no_menu => 1 }, error => $::locale->text('You are logged out!')); } sub action_login { @@ -54,7 +54,7 @@ sub action_login { # Other login errors. if (0 > $result) { $::auth->punish_wrong_login; - return $self->render('login_screen/user_login', error => $::locale->text('Incorrect username or password!')); + return $self->render('login_screen/user_login', { no_menu => 1 }, error => $::locale->text('Incorrect username or password!')); } # Everything is fine. @@ -83,15 +83,7 @@ sub _redirect_to_main_script { return $self->redirect_to($::form->{callback}) if $::form->{callback}; - my %style_to_script_map = ( - v3 => 'v3', - neu => 'new', - v4 => 'v4', - ); - - my $menu_script = $style_to_script_map{$user->{menustyle}} || ''; - - $self->redirect_to(controller => "menu${menu_script}.pl", action => 'display'); + $self->redirect_to(controller => "login.pl", action => 'company_logo'); } sub _redirect_to_main_script_if_already_logged_in { diff --git a/SL/Form.pm b/SL/Form.pm index 539cd9cb2..12a38c819 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -489,6 +489,9 @@ sub header { $::lxdebug->leave_sub and return if !$ENV{HTTP_USER_AGENT} || $self->{header}++; + my $layout; + $layout = $self->layout unless $params{no_menu}; + my $css_path = $self->get_stylesheet_for_user; $self->{favicon} ||= "favicon.ico"; @@ -516,19 +519,6 @@ sub header { push @header, sprintf "", join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->{version} if $self->{title}; - # if there is a title, we put some JavaScript in to the page, wich writes a - # meaningful title-tag for our frameset. - my $title_hack = ''; - if ($self->{title}) { - $title_hack = qq| - |; - } - my %doctypes = ( strict => qq||, transitional => qq||, @@ -557,10 +547,13 @@ EOT $params{extra_code} - $title_hack + EOT + print $layout; + + print "
\n"; $::lxdebug->leave_sub; } @@ -3590,6 +3583,30 @@ sub reformat_numbers { $::myconfig{numberformat} = $saved_numberformat; } +sub layout { + my ($self) = @_; + $::lxdebug->enter_sub; + + my %style_to_script_map = ( + v3 => 'v3', + neu => 'new', + v4 => 'v4', + ); + + my $menu_script = $style_to_script_map{$::myconfig{menustyle}} || ''; + + package main; + require "bin/mozilla/menu$menu_script.pl"; + package Form; + require SL::Controller::FrameHeader; + + + my $layout = SL::Controller::FrameHeader->new->action_header . ::render(); + + $::lxdebug->leave_sub; + return $layout; +} + 1; __END__ diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index af860fd15..f6e7c7fae 100644 --- a/bin/mozilla/menu.pl +++ b/bin/mozilla/menu.pl @@ -44,57 +44,23 @@ use URI; use List::MoreUtils qw(apply); -# end of main - -sub display { +sub render { $::lxdebug->enter_sub; - 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(doctype => 'frameset'); - - print qq| - - - - - - - - You need a browser that can read frames to see this page. - - - -|; - - $::lxdebug->leave_sub; -} - -sub acc_menu { - $::lxdebug->enter_sub; + $::form->use_stylesheet(qw(css/icons16.css css/icons24.css)); - $::form->{stylesheet} = [ qw(css/icons16.css css/icons24.css ) ]; - - my $framesize = _calc_framesize() - 2; my $menu = Menu->new("menu.ini"); - $::form->{title} = $::locale->text('kivitendo'); - $::form->header; my $sections = [ section_menu($menu) ]; - print $::form->parse_html_template('menu/menu', { - framesize => $framesize, + $::form->parse_html_template('menu/menu', { sections => $sections, + inline => 1, }); - - $::lxdebug->leave_sub; } sub section_menu { - $::lxdebug->enter_sub; + $::lxdebug->enter_sub(2); my ($menu, $level, $id_prefix) = @_; my @menuorder = $menu->access_control(\%::myconfig, $level); my @items; @@ -114,7 +80,6 @@ sub section_menu { $menuitem->{module} ||= $::form->{script}; $menuitem->{action} ||= "section_menu"; - $menuitem->{target} ||= "main_window"; $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}"; # add other params @@ -159,7 +124,7 @@ sub section_menu { $id++; } - $::lxdebug->leave_sub; + $::lxdebug->leave_sub(2); return @items; } diff --git a/css/lx-office-erp/menu.css b/css/lx-office-erp/menu.css index ed6e7e5bf..6bdde9a15 100644 --- a/css/lx-office-erp/menu.css +++ b/css/lx-office-erp/menu.css @@ -304,7 +304,7 @@ div#menuv4 li li li li:hover ul #html-menu .m span.ms { float: left; width: 32px } #html-menu .sm span.ms { float: left; width: 24px; background: url(../../image/unterpunkt.png); } #html-menu div.m { height: 24px } -#html-menu div.m span.mic { color:blue; position: relative; top: 5px; } +#html-menu div.m span.mic { color:blue; position: relative; top: 4px } #html-menu div.m:hover, #html-menu div.i:hover { color:blue; background-color: lemonchiffon; cursor: pointer; } #html-menu span.mic { white-space: normal; display: inline-block; vertical-align: top; line-height: 1.2; } @@ -313,4 +313,6 @@ div#menuv4 li li li li:hover ul #html-menu div.s1 { padding-left: 8px } #html-menu div.s2 { padding-left: 16px } +#content { margin-left: 190px } +body { margin: 0 } diff --git a/templates/webpages/menu/header.html b/templates/webpages/menu/header.html index 862d7def2..b53302fd1 100644 --- a/templates/webpages/menu/header.html +++ b/templates/webpages/menu/header.html @@ -1,5 +1,7 @@ [%- USE T8 %] +[%- UNLESS inline %] +[%- END %]
[% UNLESS is_links %] @@ -28,5 +30,7 @@ [% now.hms %]
+[%- UNLESS inline %] +[%- END %] diff --git a/templates/webpages/menu/menu.html b/templates/webpages/menu/menu.html index 72a80e2dd..e5bbbee43 100644 --- a/templates/webpages/menu/menu.html +++ b/templates/webpages/menu/menu.html @@ -1,6 +1,3 @@ [%- USE JSON %] -
- - -- 2.20.1