X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=SL%2FLayout%2FJavascript.pm;h=85454c4ee658869f19ef7fdcfbf980e316ef045e;hb=5eb836e4c3a624438acea1984639bfafb0d03d94;hp=366e0d7c9464322b1b11f7b0883cff77236e1a9f;hpb=4247547d2a925ddad7006cae89e5f9f1fda7d469;p=kivitendo-erp.git diff --git a/SL/Layout/Javascript.pm b/SL/Layout/Javascript.pm index 366e0d7c9..85454c4ee 100644 --- a/SL/Layout/Javascript.pm +++ b/SL/Layout/Javascript.pm @@ -3,27 +3,37 @@ package SL::Layout::Javascript; use strict; use parent qw(SL::Layout::Base); +use SL::Layout::None; +use SL::Layout::Top; +use SL::Layout::ActionBar; +use SL::Layout::Content; + use List::Util qw(max); +use List::MoreUtils qw(uniq); use URI; sub init_sub_layouts { + $_[0]->sub_layouts_by_name->{actionbar} = SL::Layout::ActionBar->new; [ SL::Layout::None->new, SL::Layout::Top->new, + SL::Layout::Content->new, ] } -sub use_javascript { - my $self = shift; - qw( - js/dhtmlsuite/menu-for-applications.js - ), - $self->SUPER::use_javascript(@_); +sub javascripts { + my ($self) = @_; + + return uniq grep { $_ } map { $self->_find_javascript($_) } + map({ $_->javascripts } $self->sub_layouts), + qw(dhtmlsuite/menu-for-applications.js), + $_[0]->sub_layouts_by_name->{actionbar}->javascripts, + $self->use_javascript; } sub javascripts_inline { $_[0]->SUPER::javascripts_inline, -<<'EOJS' +<<'EOJS', DHTMLSuite.createStandardObjects(); DHTMLSuite.configObj.setImagePath('image/dhtmlsuite/'); var menu_model = new DHTMLSuite.menuModel(); @@ -34,6 +44,7 @@ sub javascripts_inline { menu_bar.setTarget('main_menu_div'); menu_bar.init(); EOJS + $_[0]->sub_layouts_by_name->{actionbar}->javascripts_inline, } sub pre_content { @@ -41,28 +52,29 @@ sub pre_content { $_[0]->presenter->render("menu/menunew", force_ul_width => 1, menu => $_[0]->menu, - icon_path => sub { my $img = "image/icons/16x16/$_[0].png"; -f $img ? $img : () }, + icon_path => sub { my $simg = "image/icons/svg/$_[0].svg"; my $pimg="image/icons/16x16/$_[0].png"; -f $simg ? $simg : ( -f $pimg ? $pimg : ()) }, max_width => sub { 10 * max map { length $::locale->text($_->{name}) } @{ $_[0]{children} || [] } }, - ); -} - -sub start_content { - "