--- /dev/null
+package SL::Controller::Layout;
+
+use strict;
+use parent qw(SL::Controller::Base);
+
+use SL::Menu;
+use SL::Controller::Layout::Classic;
+use SL::Controller::Layout::V3;
+use SL::Controller::Layout::V4;
+use SL::Controller::Layout::Javascript;
+
+my %menu_cache;
+
+sub new {
+ my ($class, %params) = @_;
+
+ return SL::Controller::Layout::Classic->new if $params{style} eq 'old';
+ return SL::Controller::Layout::V3->new if $params{style} eq 'v3';
+ return SL::Controller::Layout::V4->new if $params{style} eq 'v4';
+ return SL::Controller::Layout::Javascript->new if $params{style} eq 'neu';
+ return SL::Controller::Layout::None->new;
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::Base;
+
+use strict;
+use parent qw(SL::Controller::Base);
+
+use Rose::Object::MakeMethods::Generic (
+ 'scalar --get_set_init' => qw(menu),
+);
+
+use SL::Menu;
+
+my %menu_cache;
+
+sub new {
+ my ($class, @slurp) = @_;
+
+ my $self = $class->SUPER::new(@slurp);
+}
+
+sub init_menu {
+ Menu->new('menu.ini');
+}
+
+sub pre_content {
+}
+
+sub start_content {
+}
+
+sub end_content {
+}
+
+sub post_content {
+}
+
+sub stylesheets {
+}
+
+sub stylesheets_inline {
+}
+
+sub javascript_inline {
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::Classic;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+
+use SL::Controller::Layout::Top;
+use SL::Controller::Layout::MenuLeft;
+
+sub new {
+ my ($class, @slurp) = @_;
+
+ my $self = $class->SUPER::new(@slurp);
+
+ $self->{top} = SL::Controller::Layout::Top->new;
+ $self->{left} = SL::Controller::Layout::MenuLeft->new;
+
+ $self;
+}
+
+sub pre_content {
+ $_[0]{top}->render .
+ $_[0]{left}->render;
+}
+
+sub start_content {
+ "<div id='content' class='html-menu'>\n";
+}
+
+sub end_content {
+ "</div>\n";
+}
+
+sub stylesheets {
+ $_[0]{top}->stylesheets,
+ $_[0]{left}->stylesheets;
+}
+
+sub javascripts {
+ $_[0]{top}->javascripts,
+ $_[0]{left}->javascripts;
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::Css;
+
+use List::Util qw(max);
+use Exporter qw(import);
+
+our @EXPORT = qw(clock_line print_menu menuitem_v3);
+
+sub clock_line {
+ my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
+ $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
+ = localtime(time);
+ $Monat += 1;
+ $Jahrestag += 1;
+ $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
+ $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
+ $Jahr += 1900;
+ my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
+ "Donnerstag", "Freitag", "Samstag");
+ my @Monatsnamen = ("", "Januar", "Februar", "März",
+ "April", "Mai", "Juni", "Juli",
+ "August", "September", "Oktober", "November",
+ "Dezember");
+ return
+ $Wochentage[$Wochentag] . ", der "
+ . $Monatstag . "."
+ . $Monat . "."
+ . $Jahr . " - ";
+}
+
+sub print_menu {
+ my ($self, $parent, $depth) = @_;
+
+ my $html;
+
+ die if ($depth * 1 > 5);
+
+ my @menuorder;
+ my $menu = $self->menu;
+
+ @menuorder = $menu->access_control(\%::myconfig, $parent);
+
+ $parent .= "--" if ($parent);
+
+ foreach my $item (@menuorder) {
+ substr($item, 0, length($parent)) = "";
+ next if (($item eq "") || ($item =~ /--/));
+
+ my $menu_item = $menu->{"${parent}${item}"};
+ my $menu_title = $::locale->text($item);
+ my $menu_text = $menu_title;
+
+ if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) ||
+ ($menu_item->{"module"} eq "menu.pl")) {
+
+ my $h = $self->print_menu("${parent}${item}", $depth * 1 + 1)."\n";
+ if (!$parent) {
+ $html .= qq|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>\n|;
+ } else {
+ $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|;
+ }
+ } else {
+ if ($self->{sub_class} && $depth > 1) {
+ $html .= qq|<li class='sub'>|;
+ } else {
+ $html .= qq|<li>|;
+ }
+ $html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title });
+ $html .= qq|${menu_text}</a></li>\n|;
+ }
+ }
+
+ return $html;
+}
+
+sub menuitem_v3 {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $item, $other) = @_;
+ my $menuitem = $self->menu->{$item};
+
+ my $action = "section_menu";
+ my $module;
+
+ if ($menuitem->{module}) {
+ $module = $menuitem->{module};
+ }
+ if ($menuitem->{action}) {
+ $action = $menuitem->{action};
+ }
+
+ my $level = $::form->escape($item);
+
+ my $str = qq|<a href="$module?action=| . $::form->escape($action) . qq|&level=| . $::form->escape($level);
+
+ my @vars = qw(module action target href);
+
+ if ($menuitem->{href}) {
+ $str = qq|<a href=$menuitem->{href}|;
+ @vars = qw(module target href);
+ }
+
+ map { delete $menuitem->{$_} } @vars;
+
+ # add other params
+ foreach my $key (keys %{ $menuitem }) {
+ $str .= "&" . $::form->escape($key, 1) . "=";
+ my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
+ $value = $::myconfig{$value} . "/$conf" if ($conf);
+ $str .= $::form->escape($value, 1);
+ }
+
+ $str .= '"';
+
+ if ($other) {
+ foreach my $key (keys(%{$other})) {
+ $str .= qq| ${key}="| . $::form->quote($other->{$key}) . qq|"|;
+ }
+ }
+
+ $str .= ">";
+
+ $main::lxdebug->leave_sub();
+
+ return $str;
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::Javascript;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+
+use List::Util qw(max);
+use URI;
+
+sub pre_content {
+ &display
+}
+
+sub start_content {
+ "<div id='content'>\n";
+}
+
+sub end_content {
+ "</div>\n";
+}
+
+sub display {
+ my ($self) = @_;
+ my $form = $main::form;
+
+ my $callback = $form->unescape($form->{callback});
+ $callback = URI->new($callback)->rel($callback) if $callback;
+ $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
+
+ $form->parse_html_template("menu/menunew", {
+# $self->render("menu/menunew", { no_menu => 1, no_output => 1 }, # buggy, no idea why
+ force_ul_width => 1,
+ date => $self->clock_line,
+ menu_items => $self->acc_menu,
+ callback => $callback,
+ });
+}
+
+sub clock_line {
+ my $form = $main::form;
+
+ my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
+ $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
+ = localtime(time);
+ $Monat += 1;
+ $Jahrestag += 1;
+ $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
+ $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
+ $Jahr += 1900;
+ my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
+ "Donnerstag", "Freitag", "Samstag");
+ my @Monatsnamen = ("", "Januar", "Februar", "März",
+ "April", "Mai", "Juni", "Juli",
+ "August", "September", "Oktober", "November",
+ "Dezember");
+ return
+ $Wochentage[$Wochentag] . ", der "
+ . $Monatstag . "."
+ . $Monat . "."
+ . $Jahr . " - ";
+}
+
+sub acc_menu {
+ my ($self) = @_;
+
+ my $menu = $self->menu;
+
+ my $all_items = [];
+ $self->create_menu($menu, $all_items);
+
+ my $item = { 'subitems' => $all_items };
+ calculate_width($item);
+
+ return $all_items;
+}
+
+sub calculate_width {
+ my $item = shift;
+
+ $item->{max_width} = max map { length $_->{title} } @{ $item->{subitems} };
+
+ foreach my $subitem (@{ $item->{subitems} }) {
+ calculate_width($subitem) if ($subitem->{subitems});
+ }
+}
+
+sub create_menu {
+ my ($self, $menu, $all_items, $parent, $depth) = @_;
+ my $html;
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ die if ($depth * 1 > 5);
+
+ my @menuorder = $menu->access_control(\%myconfig, $parent);
+ $parent .= "--" if ($parent);
+
+ foreach my $name (@menuorder) {
+ substr($name, 0, length($parent), "");
+ next if (($name eq "") || ($name =~ /--/));
+
+ my $menu_item = $menu->{"${parent}${name}"};
+ my $item = { 'title' => $::locale->text($name) };
+ push @{ $all_items }, $item;
+
+ if ($menu_item->{submenu} || !defined($menu_item->{module}) || ($menu_item->{module} eq "menu.pl")) {
+ $item->{subitems} = [];
+ $item->{image} = _icon_path("$name.png");
+ $self->create_menu($menu, $item->{subitems}, "${parent}${name}", $depth * 1 + 1);
+
+ } else {
+ $item->{image} = _icon_path("${parent}${name}.png");
+ $menu->menuitem_new("${parent}${name}", $item);
+ }
+ }
+}
+
+sub _icon_path {
+ my ($label, $size) = @_;
+
+ $size ||= 16;
+
+ my $img = "image/icons/${size}x${size}/$label";
+
+ return unless -f $img;
+ return $img;
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::MenuLeft;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+
+use URI;
+
+use List::MoreUtils qw(apply);
+
+sub stylesheets {
+ qw(css/icons16.css css/icons24.css);
+}
+
+sub render {
+ my ($self) = @_;
+ my $sections = [ section_menu($self->menu) ];
+
+ $self->SUPER::render('menu/menu', { no_menu => 1, no_output => 1 },
+ sections => $sections,
+ );
+}
+
+sub section_menu {
+ $::lxdebug->enter_sub(2);
+ my ($menu, $level, $id_prefix) = @_;
+ my @menuorder = $menu->access_control(\%::myconfig, $level);
+ my @items;
+
+ my $id = 0;
+
+ for my $item (@menuorder) {
+ my $menuitem = $menu->{$item};
+ my $olabel = apply { s/.*--// } $item;
+ my $ml = apply { s/--.*// } $item;
+ my $icon_class = apply { y/ /-/ } $item;
+ my $spacer = "s" . (0 + $item =~ s/--/--/g);
+
+ next if $level && $item ne "$level--$olabel";
+
+ my $label = $::locale->text($olabel);
+
+ $menuitem->{module} ||= $::form->{script};
+ $menuitem->{action} ||= "section_menu";
+ $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
+
+ # add other params
+ foreach my $key (keys %$menuitem) {
+ next if $key =~ /target|module|action|href/;
+ $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
+ my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
+ $value = $::myconfig{$value} . "/$conf" if ($conf);
+ $menuitem->{href} .= $::form->escape($value, 1);
+ }
+
+ my $anchor = $menuitem->{href};
+
+ my %common_args = (
+ l => $label,
+ s => $spacer,
+ id => "$id_prefix\_$id",
+ );
+
+ if (!$level) { # toplevel
+ push @items, { %common_args,
+ i => "icon24 $icon_class", # make_image(size => 24, label => $item),
+ c => 'm',
+ };
+ push @items, section_menu($menu, $item, "$id_prefix\_$id");
+ } elsif ($menuitem->{submenu}) {
+ push @items, { %common_args,
+ i => "icon16 submenu", #make_image(label => 'submenu'),
+ c => 'sm',
+ };
+ push @items, section_menu($menu, $item, "$id_prefix\_$id");
+ } elsif ($menuitem->{module}) {
+ push @items, { %common_args,
+ i => "icon16 $icon_class", #make_image(size => 16, label => $item),
+ h => $anchor,
+ c => 'i',
+ };
+ }
+ } continue {
+ $id++;
+ }
+
+ $::lxdebug->leave_sub(2);
+ return @items;
+}
+
+sub _calc_framesize {
+ my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
+ my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
+ my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
+
+ return $is_mobile_browser && $is_mobile_style ? 130
+ : $is_lynx_browser ? 240
+ : 200;
+}
+
+sub _show_images {
+ # don't show images in links
+ _calc_framesize() != 240;
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::None;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+
+1;
--- /dev/null
+package SL::Controller::Layout::Top;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+
+sub render {
+ my ($self) = @_;
+
+ $self->SUPER::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));
+}
+
+sub stylesheets {
+# 'frame_header/header.css';
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::V3;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+use SL::Controller::Layout::Css;
+
+use URI;
+
+sub pre_content {
+ &render;
+}
+
+sub start_content {
+ "<div id='content'>\n";
+}
+
+sub end_content {
+ "</div>\n";
+}
+
+sub render {
+ my ($self) = @_;
+
+ my $callback = $::form->unescape($::form->{callback});
+ $callback = URI->new($callback)->rel($callback) if $callback;
+ $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
+
+ $self->SUPER::render('menu/menuv3', { no_menu => 1, no_output => 1 },
+ force_ul_width => 1,
+ date => $self->clock_line,
+ menu => $self->print_menu,
+ callback => $callback,
+ );
+}
+
+1;
--- /dev/null
+package SL::Controller::Layout::V4;
+
+use strict;
+use parent qw(SL::Controller::Layout::Base);
+use SL::Controller::Layout::Css;
+use SL::Controller::Layout::Top;
+
+use URI;
+
+sub new {
+ my ($class, @slurp) = @_;
+
+ my $self = $class->SUPER::new(@slurp);
+ $self->{top} = SL::Controller::Layout::Top->new;
+ $self;
+}
+
+sub pre_content {
+ $_[0]{top}->render .
+ &render;
+}
+
+sub stylesheets {
+ $_[0]{top}->stylesheets
+}
+
+sub start_content {
+ "<div id='content'>\n";
+}
+
+sub end_content {
+ "</div>\n";
+}
+
+sub render {
+ my ($self) = @_;
+
+ $self->{sub_class} = 1;
+
+ my $callback = $::form->unescape($::form->{callback});
+ $callback = URI->new($callback)->rel($callback) if $callback;
+ $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
+
+ $self->SUPER::render('menu/menuv4', { no_menu => 1, no_output => 1 },
+ force_ul_width => 1,
+ date => $self->clock_line,
+ menu => $self->print_menu,
+ callback => $callback,
+ );
+}
+
+1;
$::form->{login} = $::myconfig{login};
$::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
my $user = User->new(login => $::myconfig{login});
+ $::request->{layout} = SL::Controller::Layout->new(style => $user->{menustyle});
# if we get an error back, bale out
my $result = $user->login($::form);
use SL::Helper::DateTime;
use SL::InstanceConfiguration;
use SL::Template::Plugin::HTMLFixes;
+use SL::Controller::Layout::None;
# Trailing new line is added so that Perl will not add the line
# number 'die' was called in.
$::locale = Locale->new($::lx_office_conf{system}->{language});
$::form = Form->new;
$::instance_conf = SL::InstanceConfiguration->new;
- $::request = { cgi => CGI->new({}) };
+ $::request = {
+ cgi => CGI->new({}),
+ layout => SL::Controller::Layout::None->new,
+ };
my $session_result = $::auth->restore_session;
$::auth->create_or_refresh_session;
-package SL::Dispatcher::AuthHandler;
+ package SL::Dispatcher::AuthHandler;
use strict;
my ($self, %param) = @_;
my $auth_level = $self->get_auth_level(%param);
+
my $handler_name = "SL::Dispatcher::AuthHandler::" . ucfirst($auth_level);
$self->{handlers} ||= {};
$self->{handlers}->{$handler_name} ||= $handler_name->new;
package SL::Dispatcher::AuthHandler::Admin;
use strict;
-
use parent qw(Rose::Object);
+use SL::Controller::Layout;
+
sub handle {
%::myconfig = ();
return if $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK());
return if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK());
+ $::request->{layout} = SL::Controller::Layout->new(style => 'admin');
+
$::auth->punish_wrong_login;
$::auth->delete_session_value('admin_password');
SL::Dispatcher::show_error('admin/adminlogin', 'password');
package SL::Dispatcher::AuthHandler::User;
use strict;
-
use parent qw(Rose::Object);
+use SL::Controller::Layout;
+
sub handle {
my ($self, %param) = @_;
$self->_error(%param) unless $::myconfig{login};
$::locale = Locale->new($::myconfig{countrycode});
+ $::request->{layout} = SL::Controller::Layout->new(style => $::myconfig{menustyle});
my $ok = $::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, $::form->{'{AUTH}password'}));
$ok ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, undef));
my $self = shift;
$self->{stylesheet} = [ $self->{stylesheet} ] unless ref $self->{stylesheet} eq 'ARRAY';
- $self->{stylesheet} = [ grep { -f }
- map { m:^css/: ? $_ : "css/$_" }
- grep { $_ }
- (@{ $self->{stylesheet} }, @_)
- ];
+
+ if (@_) {
+ $self->{stylesheet} =
+ [ grep { -f }
+ map { m:^css/: ? $_ : "css/$_" }
+ grep { $_ }
+ (@{ $self->{stylesheet} }, @_)
+ ];
+ }
return @{ $self->{stylesheet} };
}
$::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";
- $self->{titlebar} = "$self->{title} - $self->{titlebar}" if $self->{title};
+ $self->{titlebar} = join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->{version} if $self->{title};
# build includes
if ($self->{refresh_url} || $self->{refresh_time}) {
push @header, "<meta http-equiv='refresh' content='$refresh_time;$refresh_url'>";
}
- push @header, map { qq|<link rel="stylesheet" href="$_" type="text/css" title="Stylesheet">| } $self->use_stylesheet;
+ push @header, map { qq|<link rel="stylesheet" href="$_" type="text/css" title="Stylesheet">| } $self->use_stylesheet, $::request->{layout}->stylesheets;
push @header, "<style type='text/css'>\@page { size:landscape; }</style>" if $self->{landscape};
push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>" if -f $self->{favicon};
push @header, map { qq|<link rel="stylesheet" type="text/css" href="js/jscalendar/calendar-win2k-1.css">| }
push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] };
push @header, "<script type='text/javascript'>function fokus(){ document.$self->{fokus}.focus(); }</script>" if $self->{fokus};
- 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};
my %doctypes = (
strict => qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|,
<body>
EOT
- print $layout;
-
- print "<div id='content'>\n";
+ print $::request->{layout}->pre_content;
+ print $::request->{layout}->start_content;
$::lxdebug->leave_sub;
}
+sub footer {
+ # TODO: fix abort conditions
+
+ print $::request->{layout}->post_content;
+ print "<script type='text/javascript' src='$_'></script>\n" for $::request->{layout}->javascripts;
+ if (my @inline_scripts = $::request->{layout}->javascript_inline) {
+ print "<script type='text/javascript'>$_</script>\n" for @inline_scripts;
+ }
+
+ print <<EOL
+ </body>
+</html>
+EOL
+}
+
sub ajax_response_header {
$main::lxdebug->enter_sub();
return $self;
}
-sub menuitem_js {
- my ($self, $myconfig, $form, $item) = @_;
-
- my $module = $form->{script};
- my $action = "section_menu";
-
- #if ($self->{$item}{module}) {
- $module = $self->{$item}{module};
-
- #}
- if ($self->{$item}{action}) {
- $action = $self->{$item}{action};
- }
-
- my $level = $form->escape($item);
- my $str = qq|$module?action=$action&level=$level|;
- my @vars = qw(module action target href);
-
- if ($self->{$item}{href}) {
- $str = qq|$self->{$item}{href}|;
- @vars = qw(module target href);
- }
-
- map { delete $self->{$item}{$_} } @vars;
-
- # add other params
- foreach my $key (keys %{ $self->{$item} }) {
- $str .= "&" . $form->escape($key, 1) . "=";
- my ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
- $value = $myconfig->{$value} . "/$conf" if ($conf);
- $str .= $form->escape($value, 1);
- }
-
- $str .= " ";
-
-}
-
sub menuitem_new {
$main::lxdebug->enter_sub();
$main::lxdebug->leave_sub();
}
-sub menuitem_v3 {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, $item, $other) = @_;
-
- my $module = $form->{script};
- my $action = "section_menu";
- my $target = "";
-
- if ($self->{$item}{module}) {
- $module = $self->{$item}{module};
- }
- if ($self->{$item}{action}) {
- $action = $self->{$item}{action};
- }
- if ($self->{$item}{target}) {
- $target = $self->{$item}{target};
- }
-
- my $level = $form->escape($item);
-
- my $str = qq|<a href="$module?action=| . $form->escape($action) . qq|&level=| . $form->escape($level);
-
- my @vars = qw(module action target href);
-
- if ($self->{$item}{href}) {
- $str = qq|<a href=$self->{$item}{href}|;
- @vars = qw(module target href);
- }
-
- map { delete $self->{$item}{$_} } @vars;
-
- # add other params
- foreach my $key (keys %{ $self->{$item} }) {
- $str .= "&" . $form->escape($key, 1) . "=";
- my ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
- $value = $myconfig->{$value} . "/$conf" if ($conf);
- $str .= $form->escape($value, 1);
- }
-
- $str .= '"';
-
- if ($target) {
- $str .= qq| target="| . $form->quote($target) . qq|"|;
- }
-
- if ($other) {
- foreach my $key (keys(%{$other})) {
- $str .= qq| ${key}="| . $form->quote($other->{$key}) . qq|"|;
- }
- }
-
- $str .= ">";
-
- $main::lxdebug->leave_sub();
-
- return $str;
-}
-
-sub menuitem_XML {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, $item, $other) = @_;
-
- my $module = $form->{script};
- my $action = "section_menu";
- my $target = "";
-
- if ($self->{$item}{module}) {
- $module = $self->{$item}{module};
- }
- if ($self->{$item}{action}) {
- $action = $self->{$item}{action};
- }
- if ($self->{$item}{target}) {
- $target = $self->{$item}{target};
- }
-
- my $level = $form->escape($item);
-
- my $str = qq| link="$module?action=| . $form->escape($action) .
- qq|&level=| . $form->escape($level);
-
- my @vars = qw(module action target href);
-
- if ($self->{$item}{href}) {
- $str = qq| link=$self->{$item}{href}|;
- @vars = qw(module target href);
- }
-
- map { delete $self->{$item}{$_} } @vars;
-
- # add other params
- foreach my $key (keys %{ $self->{$item} }) {
- $str .= "&" . $form->escape($key, 1) . "=";
- my ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
- $value = $myconfig->{$value} . "/$conf" if ($conf);
- $str .= $form->escape($value, 1);
- }
-
- $str .= '"';
-
-
-
- if ($other) {
- foreach my $key (keys(%{$other})) {
- $str .= qq| ${key}="| . $form->quote($other->{$key}) . qq|"|;
- }
- }
-
-
- $main::lxdebug->leave_sub();
-
- return $str;
-}
-
sub access_control {
$main::lxdebug->enter_sub(2);
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-######################################################################
-# SQL-Ledger Accounting
-# Copyright (c) 1998-2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-# Contributors: Christopher Browne
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# the frame layout with refractured menu
-#
-# CHANGE LOG:
-# DS. 2002-03-25 Created
-# 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
-# 2010-08-19 - Icons for sub entries and single click behavior, unlike XUL-Menu
-# JS switchable HTML-menu - Sven Donath <lxo@dexo.de>
-#######################################################################
-
-use strict;
-
-use SL::Menu;
-use URI;
-
-use List::MoreUtils qw(apply);
-
-sub render {
- $::lxdebug->enter_sub;
-
- $::form->use_stylesheet(qw(css/icons16.css css/icons24.css));
-
- my $menu = Menu->new("menu.ini");
-
- my $sections = [ section_menu($menu) ];
-
- $::lxdebug->leave_sub;
- $::form->parse_html_template('menu/menu', {
- sections => $sections,
- inline => 1,
- });
-}
-
-sub section_menu {
- $::lxdebug->enter_sub(2);
- my ($menu, $level, $id_prefix) = @_;
- my @menuorder = $menu->access_control(\%::myconfig, $level);
- my @items;
-
- my $id = 0;
-
- for my $item (@menuorder) {
- my $menuitem = $menu->{$item};
- my $olabel = apply { s/.*--// } $item;
- my $ml = apply { s/--.*// } $item;
- my $icon_class = apply { y/ /-/ } $item;
- my $spacer = "s" . (0 + $item =~ s/--/--/g);
-
- next if $level && $item ne "$level--$olabel";
-
- my $label = $::locale->text($olabel);
-
- $menuitem->{module} ||= $::form->{script};
- $menuitem->{action} ||= "section_menu";
- $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
-
- # add other params
- foreach my $key (keys %$menuitem) {
- next if $key =~ /target|module|action|href/;
- $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
- my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
- $value = $::myconfig{$value} . "/$conf" if ($conf);
- $menuitem->{href} .= $::form->escape($value, 1);
- }
-
- my $anchor = $menuitem->{href};
-
- my %common_args = (
- l => $label,
- s => $spacer,
- id => "$id_prefix\_$id",
- );
-
- if (!$level) { # toplevel
- push @items, { %common_args,
- i => "icon24 $icon_class", # make_image(size => 24, label => $item),
- c => 'm',
- };
- push @items, section_menu($menu, $item, "$id_prefix\_$id");
- } elsif ($menuitem->{submenu}) {
- push @items, { %common_args,
- i => "icon16 submenu", #make_image(label => 'submenu'),
- c => 'sm',
- };
- push @items, section_menu($menu, $item, "$id_prefix\_$id");
- } elsif ($menuitem->{module}) {
- push @items, { %common_args,
- i => "icon16 $icon_class", #make_image(size => 16, label => $item),
- h => $anchor,
- c => 'i',
- };
- }
- } continue {
- $id++;
- }
-
- $::lxdebug->leave_sub(2);
- return @items;
-}
-
-sub _calc_framesize {
- my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
- my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
- my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
-
- return $is_mobile_browser && $is_mobile_style ? 130
- : $is_lynx_browser ? 240
- : 200;
-}
-
-sub _show_images {
- # don't show images in links
- _calc_framesize() != 240;
-}
-
-1;
-
-__END__
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-######################################################################
-# SQL-Ledger Accounting
-# Copyright (c) 1998-2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-# Contributors: Christopher Browne
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# thre frame layout with refractured menu
-#
-# CHANGE LOG:
-# DS. 2002-03-25 Created
-# 2004-12-14 - Holger Lindemann
-#######################################################################
-
-use utf8;
-use strict;
-
-use SL::Menu;
-use CGI::Carp qw(fatalsToBrowser);
-
-1;
-
-# end of main
-
-sub display {
-
- my $form = $main::form;
-
- $form->{callback} = $form->unescape($form->{callback});
- $form->{callback} ||= "login.pl?action=company_logo";
-
- $form->header;
-
- &clock_line;
-
- &acc_menu;
-
- print qq|
-<iframe id="win1" src="$form->{callback}" width="100%" height="93%" name="main_window" style="position: absolute; border:0px;">
-<p>Ihr Browser kann leider keine eingebetteten Frames anzeigen.
-</p>
-</iframe>
-</body>
-</html>
-
-|;
-
-}
-
-sub clock_line {
-
- my $form = $main::form;
-
- my $fensterlink="menujs.pl?action=display";
- my $fenster = "["."<a href=\"$fensterlink\" target=\"_blank\">neues Fenster</a>]";
-
- my $login = "[Nutzer "
- . $form->{login}
- . " - <a href=\"controller.pl?action=LoginScreen/logout\" target=\"_top\">"
- . $::locale->text('Logout')
- . "</a>] ";
- my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
- $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
- = localtime(time);
- my $CTIME_String = localtime(time);
- $Monat += 1;
- $Jahrestag += 1;
- $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
- $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
- $Jahr += 1900;
- my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
- "Donnerstag", "Freitag", "Samstag");
- my @Monatsnamen = ("", "Januar", "Februar", "März",
- "April", "Mai", "Juni", "Juli",
- "August", "September", "Oktober", "November",
- "Dezember");
- my $datum =
- $Wochentage[$Wochentag] . ", der "
- . $Monatstag . "."
- . $Monat . "."
- . $Jahr . " - ";
-
- #$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
- my $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
- print qq|
-<script type="text/javascript">
-<!--
-function clockon() {
- var now = new Date();
- var h = now.getHours();
- var m = now.getMinutes();
- document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
- var timer=setTimeout("clockon()", 10000);
-}
-window.onload=clockon
-//-->
-</script>
-<table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
- <tr>
- <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> $fenster [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
- <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
- $login $datum <span id='clock_id' style='position:relative'></span>
- </td>
- </tr>
-</table>
-|;
-}
-
-sub acc_menu {
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my $mainlevel = $form->{level};
- $mainlevel =~ s/$mainlevel--//g;
- my $menu = Menu->new("menu.ini");
-
- $| = 1;
-
- print qq|
-<style>
-<!--
-
-.itemBorder {
- border: 1px solid black
-}
-
-.itemText {
- text-decoration: none;
- color: #000000;
- font: 12px Arial, Helvetica
-}
-
-.rootItemText {
- text-decoration: none;
- color: #ffffff;
- font: 12px Arial, Helvetica
-}
-
-.menu {
- color:#ffffff;
- background:url(image/bg_css_menu.png) repeat bottom;
- border:1px solid;
- border-color:#ccc #888 #555 #bbb;
-}
-
--->
-</style>
-
-<script type="text/javascript">
-<!--
-var isDOM = (document.getElementById ? true : false);
-var isIE4 = ((document.all && !isDOM) ? true : false);
-var isNS4 = (document.layers ? true : false);
-//var KO = (navigator.appName=="Konqueror" \|\| navigator.appName=="Opera") ;
-var KO = ((navigator.userAgent.indexOf('Opera',0) != -1) \|\| (navigator.userAgent.indexOf('Konqueror',0) != -1));
-function getRef(id) {
- if (isDOM) return document.getElementById(id);
- if (isIE4) return document.all[id];
- if (isNS4) return document.layers[id];
-}
-function getSty(id) {
- return (isNS4 ? getRef(id) : getRef(id).style);
-}
-var popTimer = 0;
-var litNow = new Array();
-function popOver(menuNum, itemNum) {
- if (KO) document.getElementById("win1").style.visibility = "hidden";
- clearTimeout(popTimer);
- hideAllBut(menuNum);
- litNow = getTree(menuNum, itemNum);
- changeCol(litNow, true);
- targetNum = menu[menuNum][itemNum].target;
- if (targetNum > 0) {
- thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
- thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
- with (menu[targetNum][0].ref) {
- left = parseInt(thisX + menu[targetNum][0].x);
- top = parseInt(thisY + menu[targetNum][0].y);
- visibility = 'visible';
- }
- }
-}
-function popOut(menuNum, itemNum) {
- if ((menuNum == 0) && !menu[menuNum][itemNum].target)
- hideAllBut(0)
- if (KO) document.getElementById("win1").style.visibility = "visible";
- else
- popTimer = setTimeout('hideAllBut(0)', 500);
-}
-function getTree(menuNum, itemNum) {
- itemArray = new Array(menu.length);
- while(1) {
- itemArray[menuNum] = itemNum;
- if (menuNum == 0) return itemArray;
- itemNum = menu[menuNum][0].parentItem;
- menuNum = menu[menuNum][0].parentMenu;
- }
-}
-function changeCol(changeArray, isOver) {
- for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
- if (changeArray[menuCount]) {
- newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
- with (menu[menuCount][changeArray[menuCount]].ref) {
- if (isNS4) bgColor = newCol;
- else backgroundColor = newCol;
- }
- }
- }
-}
-function hideAllBut(menuNum) {
- var keepMenus = getTree(menuNum, 1);
- for (count = 0; count < menu.length; count++)
- if (!keepMenus[count])
- menu[count][0].ref.visibility = 'hidden';
- changeCol(litNow, false);
-}
-
-function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) {
- this.isVert = isVert;
- this.popInd = popInd
- this.x = x;
- this.y = y;
- this.width = width;
- this.overCol = overCol;
- this.backCol = backCol;
- this.borderClass = borderClass;
- this.textClass = textClass;
- this.parentMenu = null;
- this.parentItem = null;
- this.ref = null;
-}
-function Item(text, href, frame, length, spacing, target) {
- this.text = text;
- this.href = href;
- this.frame = frame;
- this.length = length;
- this.spacing = spacing;
- this.target = target;
- this.ref = null;
-}
-function go(link,frame) {
- tmp=eval("top."+frame);
- tmp.location=link;
- //top.main_window.location=link;
-}
-function writeMenus() {
- if (!isDOM && !isIE4 && !isNS4) return;
- for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
- var str = '', itemX = 0, itemY = 0;
- for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
- var itemID = 'menu' + currMenu + 'item' + currItem;
- var w = (isVert ? width : length);
- var h = (isVert ? length : width);
- if (isDOM \|\| isIE4) {
- str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
- if (backCol) str += 'background: ' + backCol + '; ';
- str += '" ';
- }
- if (isNS4) {
- str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' + w + '" height="' + h + '" visibility="inherit" ';
- if (backCol) str += 'bgcolor="' + backCol + '" ';
- }
- if (borderClass) str += 'class="' + borderClass + '" "';
- str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';
- str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '">';
- str +='<tr><td class="' + textClass + '" style="cursor:pointer;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
- if (target > 0) {
- menu[target][0].parentMenu = currMenu;
- menu[target][0].parentItem = currItem;
- if (popInd) str += '<td class="' + textClass + '" align="right">' + popInd + '</td>';
- }
- str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
- if (isVert) itemY += length + spacing;
- else itemX += length + spacing;
- }
- if (isDOM) {
- var newDiv = document.createElement('div');
- document.getElementsByTagName('body').item(0).appendChild(newDiv);
- newDiv.innerHTML = str;
- ref = newDiv.style;
- ref.position = 'absolute';
- ref.visibility = 'hidden';
- }
- if (isIE4) {
- document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
- ref = getSty('menu' + currMenu + 'div');
- }
- if (isNS4) {
- ref = new Layer(0);
- ref.document.write(str);
- ref.document.close();
- }
- for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
- itemName = 'menu' + currMenu + 'item' + currItem;
- if (isDOM \|\| isIE4) menu[currMenu][currItem].ref = getSty(itemName);
- if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
- }
- }
- with(menu[0][0]) {
- ref.left = x;
- ref.top = y;
- ref.visibility = 'visible';
- }
-}
-var menu = new Array();
-var defOver = '#cccccc';
-var defBack = '#dddddd';
-var defLength = 22;
-menu[0] = new Array();
-menu[0][0] = new Menu(false, '', 5, 18, 19, '#cccccc', '', '', 'rootItemText');
-
-|;
-
- §ion_menu($menu);
-
- print qq|
-var popOldWidth = window.innerWidth;
-nsResizeHandler = new Function('if (popOldWidth != window.innerWidth) location.reload()');
-if (isNS4) document.captureEvents(Event.CLICK);
-document.onclick = clickHandle;
-function clickHandle(evt) {
- if (isNS4) document.routeEvent(evt);
- hideAllBut(0);
- if (KO) document.getElementById("win1").style.visibility = "visible";
-}
-function moveRoot() {
- with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
-}
-// End -->
-</script>
-
-<BODY scrolling="no" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus(); clockon();" onResize="if (isNS4) nsResizeHandler()">
-
-
-<table class="menu" width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td height="21"><font size="1"> </font></td></tr></table>
-
-
-|;
-
- print qq|
-
-|;
-
-}
-
-sub section_menu {
- my ($menu, $level) = @_;
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- # build tiered menus
- my @menuorder = $menu->access_control(\%myconfig, $level);
- my $main = 0;
-
- #$pm=0;
- my $shlp=0;
- my (%mlz, $sm, $z, $pm, $mm);
- while (@menuorder) {
- my $item = shift @menuorder;
- my $label = $item;
- my $ml = $item;
- $label =~ s/$level--//g;
- $ml =~ s/--.*//;
- $label = $::locale->text($label);
- $label =~ s/ / /g;
- $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
-
- if ($menu->{$item}{submenu}) {
- $menu->{$item}{$item} = !$form->{$item};
-
- # Untermen
- if ($mlz{"s$ml"} > 1) {
- $z++;
- $sm = 1;
- } else {
- $z = $sm;
- $mlz{"s$ml"}++;
- }
- print
- qq|menu[$mlz{$ml}][$z] = new Item('$label', '#', '', defLength, 0, |
- . ++$pm
- . qq|);\n|;
- $sm = 1;
- print qq|menu[$pm] = new Array();\n|;
- print
- qq|menu[$pm][0] = new Menu(true, '', 85, 0, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
- map { shift @menuorder } grep /^$item/, @menuorder;
- §ion_menu($menu, $item);
- map { shift @menuorder } grep /^$item/, @menuorder;
- } else {
- if ($menu->{$item}{module}) {
-
- #Untermenüpunkte
- my $target = $menu->{$item}{target};
- my $uri = $menu->menuitem_js(\%myconfig, \%$form, $item, $level);
-
- print
- qq|menu[$pm][$sm] = new Item('$label', '$uri', '$target', defLength, 0, 0);\n|;
- $sm++;
- } else { # Hauptmenu
- my $ml_ = $form->escape($ml);
- $mm++;
- $pm++;
- %mlz = ($ml, $pm, "s$ml", 1);
- $shlp = $sm;
- $sm = 1;
- my $breit = 15 + length($label) * 6;
- print
- qq|menu[0][$mm] = new Item(' $label', '#', '', $breit, 10, $pm); \n|;
- print qq|menu[$pm] = new Array();\n|;
- print
- qq|menu[$pm][0] = new Menu(true, '>', 0, 20, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
-
- §ion_menu($menu, $item);
-
- #print qq|<br>\n|;
- }
- }
- }
-}
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-######################################################################
-# SQL-Ledger Accounting
-# Copyright (c) 1998-2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-# Contributors: Christopher Browne
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# thre frame layout with refractured menu
-#
-#######################################################################
-
-use English qw(-no_match_vars);
-use List::Util qw(max);
-use URI;
-
-use SL::Menu;
-
-use strict;
-
-1;
-
-# end of main
-
-sub display {
- my $form = $main::form;
-
- $form->header();
-
-# $form->{force_ul_width} = $ENV{HTTP_USER_AGENT} =~ m/MSIE\s+6\./;
-# $form->{force_ul_width} = $ENV{HTTP_USER_AGENT} !~ m/Opera/;
- $form->{force_ul_width} = 1;
- $form->{date} = clock_line();
- $form->{menu_items} = acc_menu();
- my $callback = $form->unescape($form->{callback});
- $callback = URI->new($callback)->rel($callback) if $callback;
- $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
- $form->{callback} = $callback;
-
- print $form->parse_html_template("menu/menunew");
-}
-
-sub clock_line {
- my $form = $main::form;
-
- my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
- $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
- = localtime(time);
- $Monat += 1;
- $Jahrestag += 1;
- $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
- $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
- $Jahr += 1900;
- my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
- "Donnerstag", "Freitag", "Samstag");
- my @Monatsnamen = ("", "Januar", "Februar", "März",
- "April", "Mai", "Juni", "Juli",
- "August", "September", "Oktober", "November",
- "Dezember");
- return
- $Wochentage[$Wochentag] . ", der "
- . $Monatstag . "."
- . $Monat . "."
- . $Jahr . " - ";
-}
-
-sub acc_menu {
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my $mainlevel = $form->{level};
- $mainlevel =~ s/\Q$mainlevel\E--//g;
- my $menu = Menu->new('menu.ini');
-
- $English::AUTOFLUSH = 1;
-
- my $all_items = [];
- create_menu($menu, $all_items);
-
- my $item = { 'subitems' => $all_items };
- calculate_width($item);
-
- return $all_items;
-}
-
-sub calculate_width {
- my $item = shift;
-
- $item->{max_width} = max map { length $_->{title} } @{ $item->{subitems} };
-
- foreach my $subitem (@{ $item->{subitems} }) {
- calculate_width($subitem) if ($subitem->{subitems});
- }
-}
-
-sub create_menu {
- my ($menu, $all_items, $parent, $depth) = @_;
- my $html;
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- die if ($depth * 1 > 5);
-
- my @menuorder = $menu->access_control(\%myconfig, $parent);
- $parent .= "--" if ($parent);
-
- foreach my $name (@menuorder) {
- substr($name, 0, length($parent), "");
- next if (($name eq "") || ($name =~ /--/));
-
- my $menu_item = $menu->{"${parent}${name}"};
- my $item = { 'title' => $::locale->text($name) };
- push @{ $all_items }, $item;
-
- if ($menu_item->{submenu} || !defined($menu_item->{module}) || ($menu_item->{module} eq "menu.pl")) {
- $item->{subitems} = [];
- $item->{image} = _icon_path("$name.png");
- create_menu($menu, $item->{subitems}, "${parent}${name}", $depth * 1 + 1);
-
- } else {
- $item->{image} = _icon_path("${parent}${name}.png");
- $menu->menuitem_new("${parent}${name}", $item);
- }
- }
-}
-
-sub _icon_path {
- my ($label, $size) = @_;
-
- $size ||= 16;
-
- my $img = "image/icons/${size}x${size}/$label";
-
- return unless -f $img;
- return $img;
-}
-
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-######################################################################
-# SQL-Ledger Accounting
-# Copyright (c) 1998-2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-# Contributors: Christopher Browne
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# thre frame layout with refractured menu
-#
-#######################################################################
-
-use SL::Menu;
-use URI;
-
-use strict;
-
-1;
-
-# end of main
-
-sub display {
- my $form = $main::form;
-
- $form->header(extra_code => qq|<link rel="stylesheet" href="css/menuv3.css?id=" type="text/css">|);
-
- $form->{date} = clock_line();
- $form->{menu} = acc_menu();
- my $callback = $form->unescape($form->{callback});
- $callback = URI->new($callback)->rel($callback) if $callback;
- $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
- $form->{callback} = $callback;
-
- print $form->parse_html_template("menu/menuv3");
-
-}
-
-sub clock_line {
- my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
- $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
- = localtime(time);
- $Monat += 1;
- $Jahrestag += 1;
- $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
- $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
- $Jahr += 1900;
- my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
- "Donnerstag", "Freitag", "Samstag");
- my @Monatsnamen = ("", "Januar", "Februar", "März",
- "April", "Mai", "Juni", "Juli",
- "August", "September", "Oktober", "November",
- "Dezember");
- return
- $Wochentage[$Wochentag] . ", der "
- . $Monatstag . "."
- . $Monat . "."
- . $Jahr . " - ";
-}
-
-sub acc_menu {
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my $mainlevel = $form->{level};
- $mainlevel =~ s/\Q$mainlevel\E--//g;
- my $menu = Menu->new("menu.ini");
-
- $| = 1;
-
- return print_menu($menu);
-}
-
-sub print_menu {
- my ($menu, $parent, $depth) = @_;
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my $html;
-
- die if ($depth * 1 > 5);
-
- my @menuorder;
-
- @menuorder = $menu->access_control(\%myconfig, $parent);
-
- $parent .= "--" if ($parent);
-
- foreach my $item (@menuorder) {
- substr($item, 0, length($parent)) = "";
- next if (($item eq "") || ($item =~ /--/));
-
- my $menu_item = $menu->{"${parent}${item}"};
- my $menu_title = $::locale->text($item);
- my $menu_text = $menu_title;
-
- my $target = "main_window";
- $target = $menu_item->{"target"} if ($menu_item->{"target"});
-
- if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) ||
- ($menu_item->{"module"} eq "menu.pl")) {
-
- my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1)."\n";
- if (!$parent) {
- $html .= qq|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>\n|;
- } else {
- $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|;
- }
- } else {
- $html .= qq|<li>|;
- $html .= $menu->menuitem_v3(\%myconfig, $form, "${parent}$item",
- { "title" => $menu_title,
- "target" => $target });
- $html .= qq|${menu_text}</a></li>\n|;
- }
- }
-
- return $html;
-}
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-######################################################################
-# SQL-Ledger Accounting
-# Copyright (c) 1998-2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-# Contributors: Christopher Browne
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# thre frame layout with refractured menu
-#
-#######################################################################
-
-use SL::Menu;
-use URI;
-
-use strict;
-
-1;
-
-# end of main
-
-sub display {
- my $form = $main::form;
-
- $form->header(extra_code => qq|<link rel="stylesheet" href="css/menuv4.css?id=" type="text/css">|);
-
- $form->{date} = clock_line();
- $form->{menu} = acc_menu();
- my $callback = $form->unescape($form->{callback});
- $callback = URI->new($callback)->rel($callback) if $callback;
- $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
- $form->{callback} = $callback;
-
- print $form->parse_html_template("menu/menuv4");
-
-}
-
-sub clock_line {
- my $form = $main::form;
-
- my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
- $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
- = localtime(time);
- $Monat += 1;
- $Jahrestag += 1;
- $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
- $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
- $Jahr += 1900;
- my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
- "Donnerstag", "Freitag", "Samstag");
- my @Monatsnamen = ("", "Januar", "Februar", "März",
- "April", "Mai", "Juni", "Juli",
- "August", "September", "Oktober", "November",
- "Dezember");
- return
- $Wochentage[$Wochentag] . ", der "
- . $Monatstag . "."
- . $Monat . "."
- . $Jahr . " - ";
-}
-
-sub acc_menu {
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my $mainlevel = $form->{level};
- $mainlevel =~ s/\Q$mainlevel\E--//g;
- my $menu = Menu->new("menu.ini");
-
- $| = 1;
-
- return print_menu($menu);
-}
-
-sub print_menu {
- my ($menu, $parent, $depth) = @_;
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my $html;
-
- die if ($depth * 1 > 5);
-
- my @menuorder;
-
- @menuorder = $menu->access_control(\%myconfig, $parent);
-
- $parent .= "--" if ($parent);
-
- foreach my $item (@menuorder) {
- substr($item, 0, length($parent)) = "";
- next if (($item eq "") || ($item =~ /--/));
-
- my $menu_item = $menu->{"${parent}${item}"};
- my $menu_title = $::locale->text($item);
- my $menu_text = $menu_title;
-
- my $target = "main_window";
- $target = $menu_item->{"target"} if ($menu_item->{"target"});
-
- if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) ||
- ($menu_item->{"module"} eq "menu.pl")) {
-
- my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1)."\n";
- if (!$parent) {
- $html .= qq|<ul><li><h2> ${menu_text} </h2><ul>${h}</ul></li></ul>\n|;
- } else {
- $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|;
- }
- } else {
- if ($depth>1) {
- $html .= qq|<li class='sub'>|;
- } else {
- $html .= qq|<li>|;
- }
- $html .= $menu->menuitem_v3(\%myconfig, $form, "${parent}$item",
- { "title" => $menu_title,
- "target" => $target });
- $html .= qq|${menu_text}</a></li>\n|;
- }
- }
-
- return $html;
-}
width: 100%;
border-spacing: 0;
font-size: 12px;
- margin-bottom:10px;
}
#frame-header .frame-header-left {
each line is a mi (menuitem) and has one mii (menu-item-icon) whcih is ms (menu-spacer)
and one mic (menu-item-chunk)
indenting is done with the levels s0, s1, s2 */
-#html-menu { float:left; width: 183px; font-size: 8pt }
+#html-menu { float:left; width: 183px; font-size: 8pt; margin-top: 10px; }
#html-menu div.mi { margin-top: 4px; margin-bottom: 3px; white-space: nowrap; clear:both; position:relative; }
#html-menu div.sm { font-weight: bold }
#html-menu img { vertical-align: top; border: 0; }
#html-menu div.s0 { padding-left: 2px }
#html-menu div.s1 { padding-left: 8px }
#html-menu div.s2 { padding-left: 16px }
-
-#content { margin-left: 190px }
+#content.html-menu { margin-left: 190px }
body { margin: 0 }
[%- USE T8 %]
-[% USE HTML %]<body class="menunew">
-
+[% USE HTML %]
<script type="text/javascript">
<!--
function clockon() {
<div id="main_menu_div"></div>
[%- SET main_id = '100' %]
- <ul id="main_menu_model">
+ <ul id="main_menu_model" style='display:none'>
[%- FOREACH mainitem = menu_items %]
[%- SET main_id = main_id + 1 %]
<li id="[% main_id %]"[% IF mainitem.image %] itemIcon="[% mainitem.image %]"[% END %]>
- <a href="[% IF mainitem.href %][% mainitem.href %][% ELSE %]#[% END %]"[% IF mainitem.target %] target="[% mainitem.target %]"[% END %]>
+ <a href="[% IF mainitem.href %][% mainitem.href %][% ELSE %]#[% END %]">
[%- HTML.escape(mainitem.title) %]
</a>
[%- IF mainitem.subitems %]
[%- FOREACH sub1item = mainitem.subitems %]
[%- SET sub1_id = sub1_id + 1 %]
<li id="[% sub1_id %]"[% IF sub1item.image %] itemIcon="[% sub1item.image %]"[% END %]>
- <a href="[% IF sub1item.href %][% sub1item.href %][% ELSE %]#[% END %]"[% IF sub1item.target %] target="[% sub1item.target %]"[% END %]>
+ <a href="[% IF sub1item.href %][% sub1item.href %][% ELSE %]#[% END %]">
[%- HTML.escape(sub1item.title) %]
</a>
[%- IF sub1item.subitems %]
[%- FOREACH sub2item = sub1item.subitems %]
[%- SET sub2_id = sub2_id + 1 %]
<li id="[% sub2_id %]"[% IF sub2item.image %] itemIcon="[% sub2item.image %]"[% END %]>
- <a href="[% IF sub2item.href %][% sub2item.href %][% ELSE %]#[% END %]"[% IF sub2item.target %] target="[% sub2item.target %]"[% END %]>
+ <a href="[% IF sub2item.href %][% sub2item.href %][% ELSE %]#[% END %]">
[%- HTML.escape(sub2item.title) %]
</a>
</li>
[%- END %]
</ul>
- <iframe id="win1" src="[% callback %]" width="100%" height="94%" name="main_window" style="position: absolute; border: 0px; z-index: 99; ">
- <p>[% 'MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES' | $T8 %]</p>
- </iframe>
<script type="text/javascript">
<!--
-DHTMLSuite.createStandardObjects();
+$(function(){
+ DHTMLSuite.createStandardObjects();
+
+ DHTMLSuite.configObj.setCssPath('[% myconfig.css_path %]/dhtmlsuite/');
+ DHTMLSuite.configObj.setImagePath('image/dhtmlsuite/');
-DHTMLSuite.configObj.setCssPath('[% myconfig.css_path %]/dhtmlsuite/');
-DHTMLSuite.configObj.setImagePath('image/dhtmlsuite/');
+ var menu_model = new DHTMLSuite.menuModel();
+ menu_model.addItemsFromMarkup('main_menu_model');
+ menu_model.init();
+
+ var menu_bar = new DHTMLSuite.menuBar();
+ menu_bar.addMenuItems(menu_model);
+ menu_bar.setTarget('main_menu_div');
+ menu_bar.init();
+});
-var menu_model = new DHTMLSuite.menuModel();
-menu_model.addItemsFromMarkup('main_menu_model');
-menu_model.init();
-var menu_bar = new DHTMLSuite.menuBar();
-menu_bar.addMenuItems(menu_model);
-menu_bar.setTarget('main_menu_div');
-menu_bar.init();
function open_url(url, target) {
-->
</script>
-
-</body>
-</html>
[%- USE T8 %]
-[% USE HTML %]<body style="padding:0px; margin:0px;">
-
+[% USE HTML %]
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
<!--
</tr>
</table>
-
<div id="menuv3">
[% menu %]
</div>
-
<div style="clear: both;"></div>
-
- <iframe id="win1" src="[% callback %]" width="100%" height="94%" name="main_window" style="position: absolute; border: 0px; z-index: 99; ">
- <p>[% 'MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES' | $T8 %]</p>
- </iframe>
-</body>
-</html>
[%- USE T8 %]
[%- USE HTML %]
-<body class="frame-header menuv4">
- <div class="frame-header">
- <span class="frame-header-element frame-header-left">
- [<a href="menuv4.pl?action=display" target="_blank">[% 'new Window' | $T8 %]</a>]
- [<a href="JavaScript:top.main_window.print()">[% 'print' | $T8 %]</a>]
- </span>
- <span class="frame-header-element frame-header-right">
- [[% 'User' | $T8 %]: [% HTML.escape(login) %] -
- <a href="controller.pl?action=LoginScreen/logout" target="_top">[% 'logout' | $T8 %]</a>]
- [% date %] <span id='clock_id' style='position:relative'></span>
- </span>
- </div>
<div id="menuv4">
[% menu %]
</div>
<div style="clear: both;"></div>
- <iframe id="win1" src="[% callback %]" width="100%" height="94%" name="main_window" style="position: absolute; border: 0px; z-index: 99; ">
- <p>[% 'MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES' | $T8 %]</p>
- </iframe>
-</body>
-
<script type="text/javascript">
<!--
window.onload=clockon
//-->
</script>
-</html>