X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ed4a9af1e86b98c870cfc0d16573bd59496bc7ba..3ab26ffc:/SL/Form.pm
diff --git a/SL/Form.pm b/SL/Form.pm
index 55ee46d4c..521d899bd 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";
@@ -506,7 +509,7 @@ sub header {
push @header, "" if $self->{landscape};
push @header, "" if -f $self->{favicon};
push @header, map { qq|| }
- qw(jquery common jscalendar/calendar jscalendar/lang/calendar-de jscalendar/calendar-setup part_selection jquery-ui jqModal switchmenuframe);
+ qw(jquery common jscalendar/calendar jscalendar/lang/calendar-de jscalendar/calendar-setup part_selection jquery-ui jquery.cookie jqModal switchmenuframe);
push @header, $self->{javascript} if $self->{javascript};
push @header, map { qq|| }
qw(main menu tabcontent list_accounts jquery.autocomplete jquery.multiselect2side frame_header/header ui-lightness/jquery-ui-1.8.12.custom);
@@ -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;
}
@@ -866,41 +859,30 @@ sub format_amount {
$main::lxdebug->enter_sub(2);
my ($self, $myconfig, $amount, $places, $dash) = @_;
- $dash ||= '';
+ $amount ||= 0;
+ $dash ||= '';
+ my $neg = $amount < 0;
+ my $force_places = defined $places && $places >= 0;
- if ($amount eq "") {
- $amount = 0;
- }
+ $amount = $self->round_amount($amount, abs $places) if $force_places;
+ $amount = sprintf "%.*f", ($force_places ? $places : 10), abs $amount; # 6 is default for %fa
- $amount *= 1;
+ # before the sprintf amount was a number, afterwards it's a string. because of the dynamic nature of perl
+ # this is easy to confuse, so keep in mind: before this comment no s///, m//, concat or other strong ops on
+ # $amount. after this comment no +,-,*,/,abs. it will only introduce subtle bugs.
- # Hey watch out! The amount can be an exponential term like 1.13686837721616e-13
-
- my $neg = ($amount =~ s/^-//);
- my $exp = ($amount =~ m/[e]/) ? 1 : 0;
-
- if (defined($places) && ($places ne '')) {
- if (not $exp) {
- if ($places < 0) {
- $amount *= 1;
- $places *= -1;
-
- if ($amount =~ /\.(\d+)/) {
- my $actual_places = length $1;
- $places = $actual_places if $actual_places > $places;
- }
- }
- }
- $amount = $self->round_amount($amount, $places);
- }
+ $amount =~ s/0*$// unless defined $places && $places == 0; # cull trailing 0s
my @d = map { s/\d//g; reverse split // } my $tmp = $myconfig->{numberformat}; # get delim chars
- my @p = split(/\./, $amount); # split amount at decimal point
-
- $p[0] =~ s/\B(?=(...)*$)/$d[1]/g if $d[1]; # add 1,000 delimiters
+ my @p = split(/\./, $amount); # split amount at decimal point
+ $p[0] =~ s/\B(?=(...)*$)/$d[1]/g if $d[1]; # add 1,000 delimiters
$amount = $p[0];
- $amount .= $d[0].($p[1]||'').(0 x ($places - length ($p[1]||''))) if ($places || $p[1] ne '');
+ if ($places || $p[1]) {
+ $amount .= $d[0]
+ . ( $p[1] || '' )
+ . (0 x (abs($places || 0) - length ($p[1]||''))); # pad the fraction
+ }
$amount = do {
($dash =~ /-/) ? ($neg ? "($amount)" : "$amount" ) :
@@ -908,7 +890,6 @@ sub format_amount {
($neg ? "-$amount" : "$amount" ) ;
};
-
$main::lxdebug->leave_sub(2);
return $amount;
}
@@ -3602,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__