Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e1130151

Von Sven Schöling vor fast 8 Jahren hinzugefügt

  • ID e11301512d37d53cecc845fa9359be7ad2c84d51
  • Vorgänger 9c337bc8
  • Nachfolger f61ca7d5

Javascript Layout: ActionBar

Unterschiede anzeigen:

SL/Layout/Javascript.pm
5 5

  
6 6
use SL::Layout::None;
7 7
use SL::Layout::Top;
8
use SL::Layout::ActionBar;
8 9
use SL::Layout::Content;
9 10

  
10 11
use List::Util qw(max);
12
use List::MoreUtils qw(uniq);
11 13
use URI;
12 14

  
13 15
sub init_sub_layouts {
16
  $_[0]->sub_layouts_by_name->{actionbar} = SL::Layout::ActionBar->new;
14 17
  [
15 18
    SL::Layout::None->new,
16 19
    SL::Layout::Top->new,
......
18 21
  ]
19 22
}
20 23

  
21
sub use_javascript {
22
  my $self = shift;
23
  qw(
24
    js/dhtmlsuite/menu-for-applications.js
25
  ),
26
  $self->SUPER::use_javascript(@_);
24
sub javascripts {
25
  my ($self) = @_;
26

  
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;
27 32
}
28 33

  
29 34
sub javascripts_inline {
30 35
  $_[0]->SUPER::javascripts_inline,
31
<<'EOJS'
36
<<'EOJS',
32 37
  DHTMLSuite.createStandardObjects();
33 38
  DHTMLSuite.configObj.setImagePath('image/dhtmlsuite/');
34 39
  var menu_model = new DHTMLSuite.menuModel();
......
39 44
  menu_bar.setTarget('main_menu_div');
40 45
  menu_bar.init();
41 46
EOJS
47
  $_[0]->sub_layouts_by_name->{actionbar}->javascripts_inline,
42 48
}
43 49

  
44 50
sub pre_content {
......
48 54
    menu            => $_[0]->menu,
49 55
    icon_path       => sub { my $simg = "image/icons/svg/$_[0].svg";  my $pimg="image/icons/16x16/$_[0].png"; -f $simg ? $simg : ( -f $pimg ? $pimg : ()) },
50 56
    max_width       => sub { 10 * max map { length $::locale->text($_->{name}) } @{ $_[0]{children} || [] } },
51
  );
57
  ) .
58
  $_[0]->sub_layouts_by_name->{actionbar}->pre_content;
52 59
}
53 60

  
54 61
sub stylesheets {
55
  $_[0]->add_stylesheets(qw(
56
    dhtmlsuite/menu-item.css
57
    dhtmlsuite/menu-bar.css
58
    icons16.css
59
    menu.css
60
  ));
61
  $_[0]->SUPER::stylesheets;
62
  my ($self) = @_;
63
  my $css_path = $self->get_stylesheet_for_user;
64

  
65
  return
66
    uniq
67
    grep { $_ }
68
    map { $self->_find_stylesheet($_, $css_path)  }
69
    qw(
70
      dhtmlsuite/menu-item.css
71
      dhtmlsuite/menu-bar.css
72
      icons16.css
73
      menu.css
74
    ),
75
    ( map { $_->stylesheets } $_[0]->sub_layouts ),
76
    $_[0]->sub_layouts_by_name->{actionbar}->stylesheets,
77
    $_[0]->use_stylesheet;
62 78
}
63 79

  
64 80
1;

Auch abrufbar als: Unified diff