1 package SL::Layout::Javascript;
4 use parent qw(SL::Layout::Base);
8 use SL::Layout::ActionBar;
9 use SL::Layout::Content;
11 use List::Util qw(max);
12 use List::MoreUtils qw(uniq);
15 sub init_sub_layouts {
16 $_[0]->sub_layouts_by_name->{actionbar} = SL::Layout::ActionBar->new;
18 SL::Layout::None->new,
20 SL::Layout::Content->new,
27 return uniq grep { $_ } map { $self->_find_javascript($_) }
28 map({ $_->javascripts } $self->sub_layouts),
29 qw(dhtmlsuite/menu-for-applications.js),
30 $_[0]->sub_layouts_by_name->{actionbar}->javascripts,
31 $self->use_javascript;
34 sub javascripts_inline {
35 $_[0]->SUPER::javascripts_inline,
37 DHTMLSuite.createStandardObjects();
38 DHTMLSuite.configObj.setImagePath('image/dhtmlsuite/');
39 var menu_model = new DHTMLSuite.menuModel();
40 menu_model.addItemsFromMarkup('main_menu_model');
42 var menu_bar = new DHTMLSuite.menuBar();
43 menu_bar.addMenuItems(menu_model);
44 menu_bar.setTarget('main_menu_div');
47 $_[0]->sub_layouts_by_name->{actionbar}->javascripts_inline,
51 $_[0]->SUPER::pre_content .
52 $_[0]->presenter->render("menu/menunew",
55 icon_path => sub { my $simg = "image/icons/svg/$_[0].svg"; my $pimg="image/icons/16x16/$_[0].png"; -f $simg ? $simg : ( -f $pimg ? $pimg : ()) },
56 max_width => sub { 10 * max map { length $::locale->text($_->{name}) } @{ $_[0]{children} || [] } },
58 ($_[0]->sub_layouts_by_name->{actionbar}->pre_content // '');
63 my $css_path = $self->get_stylesheet_for_user;
68 map { $self->_find_stylesheet($_, $css_path) }
70 dhtmlsuite/menu-item.css
71 dhtmlsuite/menu-bar.css
75 ( map { $_->stylesheets } $_[0]->sub_layouts ),
76 $_[0]->sub_layouts_by_name->{actionbar}->stylesheets,
77 $_[0]->use_stylesheet;