1 package SL::Controller::Layout::Base;
4 use parent qw(SL::Controller::Base);
6 use Rose::Object::MakeMethods::Generic (
7 'scalar --get_set_init' => qw(menu),
15 my ($class, @slurp) = @_;
17 my $self = $class->SUPER::new(@slurp);
21 Menu->new('menu.ini');
24 ##########################################
25 # inheritable/overridable
26 ##########################################
40 sub stylesheets_inline {
43 sub javascript_inline {
46 #########################################
48 ########################################
52 push @{ $self->{stylesheets} ||= [] }, @_ if @_;
53 @{ $self->{stylesheets} ||= [] };
58 my $css_path = $self->get_stylesheet_for_user;
60 return grep { $_ } map { $self->_find_stylesheet($_, $css_path) } $self->use_stylesheet;
63 sub _find_stylesheet {
64 my ($self, $stylesheet, $css_path) = @_;
66 return "$css_path/$stylesheet" if -f "$css_path/$stylesheet";
67 return "css/$stylesheet" if -f "css/$stylesheet";
68 return $stylesheet if -f $stylesheet;
71 sub get_stylesheet_for_user {
73 if (my $user_style = $::myconfig{stylesheet}) {
74 $user_style =~ s/\.css$//; # nuke trailing .css, this is a remnand of pre 2.7.0 stylesheet handling
75 if (-d "$css_path/$user_style" &&
76 -f "$css_path/$user_style/main.css") {
77 $css_path = "$css_path/$user_style";
79 $css_path = "$css_path/lx-office-erp";
82 $css_path = "$css_path/lx-office-erp";
84 $::myconfig{css_path} = $css_path; # needed for menunew, FIXME: don't do this here
92 $::lxdebug->dump(0, "class", \@_);
93 push @{ $self->{javascripts} ||= [] }, @_ if @_;
94 @{ $self->{javascripts} ||= [] };
100 $::lxdebug->dump(0, "called", [ map { $self->find_javascript($_) } $self->use_javascript ]);
101 return map { $self->_find_javascript($_) } $self->use_javascript;
104 sub _find_javascript {
105 my ($self, $javascript) = @_;
107 return "js/$javascript" if -f "js/$javascript";
108 return $javascript if -f $javascript;