diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-04-12 20:46:20 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-04-12 20:46:20 +0000 |
commit | df073d6e09c0f87fb2e88cc215ace843a5851d4a (patch) | |
tree | 1c15ce909d3e0353b21bbd909e6720fd485a3a53 /LedgerSMB/Menu.pm | |
parent | 65458125b8f3814fd6ef4d07b55ab69f62f5a528 (diff) |
Formatting with Perltidy
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1068 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Menu.pm')
-rwxr-xr-x | LedgerSMB/Menu.pm | 149 |
1 files changed, 74 insertions, 75 deletions
diff --git a/LedgerSMB/Menu.pm b/LedgerSMB/Menu.pm index d6ce2053..57c83245 100755 --- a/LedgerSMB/Menu.pm +++ b/LedgerSMB/Menu.pm @@ -1,8 +1,8 @@ #===================================================================== -# LedgerSMB +# LedgerSMB # Small Medium Business Accounting software # http://www.ledgersmb.org/ -# +# # Copyright (C) 2006 # This work contains copyrighted information from a number of sources all used # with permission. @@ -36,91 +36,90 @@ package Menu; use LedgerSMB::Inifile; @ISA = qw/Inifile/; - sub menuitem { - my ($self, $myconfig, $form, $item) = @_; - - my $module = ($self->{$item}{module}) - ? $self->{$item}{module} : $form->{script}; - my $action = ($self->{$item}{action}) - ? $self->{$item}{action} : "section_menu"; - my $target = ($self->{$item}{target}) - ? $self->{$item}{target} : ""; - - my $level = $form->escape($item); - my $style; - if ($form->{menubar}){ - $style = ""; - } else { - $style = "display:block;"; - } - my $str = qq|<a style="$style"|. - qq|href="$module?path=$form->{path}&action=$action&|. - qq|level=$level&login=$form->{login}&|. - qq|timeout=$form->{timeout}&sessionid=$form->{sessionid}|. - qq|&js=$form->{js}|; - - my @vars = qw(module action target href); - - if ($self->{$item}{href}) { - $str = qq|<a href="$self->{$item}{href}|; - @vars = qw(module target href); - } - - for (@vars) { delete $self->{$item}{$_} } - - delete $self->{$item}{submenu}; - - # add other params - foreach my $key (keys %{ $self->{$item} }) { - $str .= "&".$form->escape($key)."="; - ($value, $conf) = split /=/, $self->{$item}{$key}, 2; - $value = "$myconfig->{$value}$conf" - if $self->{$item}{$key} =~ /=/; - - $str .= $form->escape($value); - } - - $str .= qq|#id$form->{tag}| if $target eq 'acc_menu'; - - if ($target) { - $str .= qq|" target="$target"|; - } - else{ - $str .= '"'; - } - - $str .= qq|>|; - -} + my ( $self, $myconfig, $form, $item ) = @_; + + my $module = + ( $self->{$item}{module} ) ? $self->{$item}{module} : $form->{script}; + my $action = + ( $self->{$item}{action} ) ? $self->{$item}{action} : "section_menu"; + my $target = ( $self->{$item}{target} ) ? $self->{$item}{target} : ""; + + my $level = $form->escape($item); + my $style; + if ( $form->{menubar} ) { + $style = ""; + } + else { + $style = "display:block;"; + } + my $str = + qq|<a style="$style"| + . qq|href="$module?path=$form->{path}&action=$action&| + . qq|level=$level&login=$form->{login}&| + . qq|timeout=$form->{timeout}&sessionid=$form->{sessionid}| + . qq|&js=$form->{js}|; + + my @vars = qw(module action target href); + + if ( $self->{$item}{href} ) { + $str = qq|<a href="$self->{$item}{href}|; + @vars = qw(module target href); + } + + for (@vars) { delete $self->{$item}{$_} } + + delete $self->{$item}{submenu}; + + # add other params + foreach my $key ( keys %{ $self->{$item} } ) { + $str .= "&" . $form->escape($key) . "="; + ( $value, $conf ) = split /=/, $self->{$item}{$key}, 2; + $value = "$myconfig->{$value}$conf" + if $self->{$item}{$key} =~ /=/; + + $str .= $form->escape($value); + } + + $str .= qq|#id$form->{tag}| if $target eq 'acc_menu'; + + if ($target) { + $str .= qq|" target="$target"|; + } + else { + $str .= '"'; + } + + $str .= qq|>|; +} sub access_control { - my ($self, $myconfig, $menulevel) = @_; - - my @menu = (); + my ( $self, $myconfig, $menulevel ) = @_; - if ($menulevel eq "") { - @menu = grep { !/--/ } @{ $self->{ORDER} }; - } else { - @menu = grep { /^${menulevel}--/; } @{ $self->{ORDER} }; - } + my @menu = (); - my @a = split /;/, $myconfig->{acs}; - my $excl = (); + if ( $menulevel eq "" ) { + @menu = grep { !/--/ } @{ $self->{ORDER} }; + } + else { + @menu = grep { /^${menulevel}--/; } @{ $self->{ORDER} }; + } - # remove --AR, --AP from array - grep { ($a, $b) = split /--/; s/--$a$//; } @a; + my @a = split /;/, $myconfig->{acs}; + my $excl = (); - for (@a) { $excl{$_} = 1 } + # remove --AR, --AP from array + grep { ( $a, $b ) = split /--/; s/--$a$//; } @a; - @a = (); - for (@menu) { push @a, $_ unless $excl{$_} } + for (@a) { $excl{$_} = 1 } - @a; + @a = (); + for (@menu) { push @a, $_ unless $excl{$_} } -} + @a; +} 1; |