} else {
$::form->{title} = $locals{title} if $locals{title};
- $::form->header;
+ $::form->header(no_menu => $options->{no_menu});
}
}
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));
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 {
$::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 {
# 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.
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 {
$::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";
push @header, sprintf "<script type='text/javascript'>top.document.title='%s';</script>",
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|
- <script type="text/javascript">
- <!--
- // Write a meaningful title-tag for our frameset.
- top.document.title="| . $self->{"title"} . qq| - | . $self->{"login"} . qq| - | . $::myconfig{dbname} . qq| - V| . $self->{"version"} . qq|";
- //-->
- </script>|;
- }
-
my %doctypes = (
strict => qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|,
transitional => qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">|,
</script>
$params{extra_code}
- $title_hack
</head>
+ <body>
EOT
+ print $layout;
+
+ print "<div id='content'>\n";
$::lxdebug->leave_sub;
}
$::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__
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|
-<frameset rows="28px,*" cols="*" framespacing="0" frameborder="0">
- <frame src="controller.pl?action=FrameHeader/header" scrolling="NO">
- <frameset cols="$framesize,*" framespacing="0" frameborder="0" border="0" id="menuframe" name="menuframe">
- <frame src="$::form->{script}?action=acc_menu" name="acc_menu" scrolling="auto" noresize marginwidth="0">
- <frame src="$callback" name="main_window" scrolling="auto">
- </frameset>
- <noframes>
- You need a browser that can read frames to see this page.
- </noframes>
-</frameset>
-</HTML>
-|;
-
- $::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;
$menuitem->{module} ||= $::form->{script};
$menuitem->{action} ||= "section_menu";
- $menuitem->{target} ||= "main_window";
$menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
# add other params
$id++;
}
- $::lxdebug->leave_sub;
+ $::lxdebug->leave_sub(2);
return @items;
}
#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; }
#html-menu div.s1 { padding-left: 8px }
#html-menu div.s2 { padding-left: 16px }
+#content { margin-left: 190px }
+body { margin: 0 }
[%- USE T8 %]
+[%- UNLESS inline %]
<body class="frame-header">
+[%- END %]
<div class="frame-header">
[% UNLESS is_links %]
<span class="frame-header-element frame-header-left">
[% now.hms %]
</span>
</div>
+[%- UNLESS inline %]
</body>
</html>
+[%- END %]
[%- USE JSON %]
-<body class="menu">
<div id='html-menu'></div>
<script type='text/javascript'>$(function(){$([% JSON.json(sections) %]).each(function(i,b){var a=$('<a class="ml">').append($('<span class="mii ms">').append($('<div>').addClass(b.i)),$('<span class="mic">').append(b.l));if(b.h)a.attr('href', b.h);if(b.t)a.attr('target', b.t);$('#html-menu').append($('<div class="mi">').addClass(b.c).addClass(b.s).attr('id','mi'+b.id).append(a));});$('#html-menu div.i, #html-menu div.sm').hide();$('#html-menu div.m').each(function(){$(this).click(function(){$('#html-menu div.mi').not('div.m').not('[id^='+$(this).attr('id')+'_]').hide();$('#html-menu div.mi[id^='+$(this).attr('id')+'_]').toggle()})})})</script>
-</body>
-</html>