projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Entwickleroption "debug.auto_reload_resources" implementiert
[kivitendo-erp.git]
/
SL
/
Layout
/
Base.pm
diff --git
a/SL/Layout/Base.pm
b/SL/Layout/Base.pm
index
56d5b8e
..
de94ee0
100644
(file)
--- a/
SL/Layout/Base.pm
+++ b/
SL/Layout/Base.pm
@@
-3,14
+3,17
@@
package SL::Layout::Base;
use strict;
use parent qw(SL::Controller::Base);
use strict;
use parent qw(SL::Controller::Base);
+use List::MoreUtils qw(uniq);
+use Time::HiRes qw();
+
use Rose::Object::MakeMethods::Generic (
use Rose::Object::MakeMethods::Generic (
- 'scalar --get_set_init' =>
qw(menu)
,
+ 'scalar --get_set_init' =>
[ qw(menu auto_reload_resources_param) ]
,
'scalar' => qw(focus),
'array' => [
'add_stylesheets_inline' => { interface => 'add', hash_key => 'stylesheets_inline' },
'add_javascripts_inline' => { interface => 'add', hash_key => 'javascripts_inline' },
'scalar' => qw(focus),
'array' => [
'add_stylesheets_inline' => { interface => 'add', hash_key => 'stylesheets_inline' },
'add_javascripts_inline' => { interface => 'add', hash_key => 'javascripts_inline' },
- 'sub_layouts',
- 'add_sub_layouts'
=> { interface => 'add', hash_key => 'sub_layouts' },
+ 'sub_layouts',
=> { interface => 'get_set_init' },
+ 'add_sub_layouts' => { interface => 'add', hash_key => 'sub_layouts' },
],
);
],
);
@@
-28,6
+31,11
@@
sub init_menu {
Menu->new('menu.ini');
}
Menu->new('menu.ini');
}
+sub init_auto_reload_resources_param {
+ return '' unless $::lx_office_conf{debug}->{auto_reload_resources};
+ return sprintf('?rand=%d-%d-%d', Time::HiRes::gettimeofday(), int(rand 1000000000000));
+}
+
##########################################
# inheritable/overridable
##########################################
##########################################
# inheritable/overridable
##########################################
@@
-49,20
+57,26
@@
sub post_content {
}
sub stylesheets_inline {
}
sub stylesheets_inline {
- ( map { $_->stylesheets_inline } $_[0]->sub_layouts ),
+
uniq
( map { $_->stylesheets_inline } $_[0]->sub_layouts ),
@{ $_[0]->{stylesheets_inline} || [] };
}
sub javascripts_inline {
@{ $_[0]->{stylesheets_inline} || [] };
}
sub javascripts_inline {
- ( map { $_->javascripts_inline } $_[0]->sub_layouts ),
+
uniq
( map { $_->javascripts_inline } $_[0]->sub_layouts ),
@{ $_[0]->{javascripts_inline} || [] };
}
@{ $_[0]->{javascripts_inline} || [] };
}
+sub init_sub_layouts { [] }
+
#########################################
# Interface
########################################
#########################################
# Interface
########################################
+sub add_stylesheets {
+ &use_stylesheet;
+}
+
sub use_stylesheet {
my $self = shift;
push @{ $self->{stylesheets} ||= [] }, @_ if @_;
sub use_stylesheet {
my $self = shift;
push @{ $self->{stylesheets} ||= [] }, @_ if @_;
@@
-73,7
+87,7
@@
sub stylesheets {
my ($self) = @_;
my $css_path = $self->get_stylesheet_for_user;
my ($self) = @_;
my $css_path = $self->get_stylesheet_for_user;
- return grep { $_ } map { $self->_find_stylesheet($_, $css_path) }
+ return
uniq
grep { $_ } map { $self->_find_stylesheet($_, $css_path) }
$self->use_stylesheet, map { $_->stylesheets } $self->sub_layouts;
}
$self->use_stylesheet, map { $_->stylesheets } $self->sub_layouts;
}
@@
-93,16
+107,19
@@
sub get_stylesheet_for_user {
-f "$css_path/$user_style/main.css") {
$css_path = "$css_path/$user_style";
} else {
-f "$css_path/$user_style/main.css") {
$css_path = "$css_path/$user_style";
} else {
- $css_path = "$css_path/
lx-office-erp
";
+ $css_path = "$css_path/
kivitendo
";
}
} else {
}
} else {
- $css_path = "$css_path/
lx-office-erp
";
+ $css_path = "$css_path/
kivitendo
";
}
$::myconfig{css_path} = $css_path; # needed for menunew, FIXME: don't do this here
return $css_path;
}
}
$::myconfig{css_path} = $css_path; # needed for menunew, FIXME: don't do this here
return $css_path;
}
+sub add_javascripts {
+ &use_javascript
+}
sub use_javascript {
my $self = shift;
sub use_javascript {
my $self = shift;
@@
-113,8
+130,8
@@
sub use_javascript {
sub javascripts {
my ($self) = @_;
sub javascripts {
my ($self) = @_;
- return map { $self->_find_javascript($_) }
-
$self->use_javascript, map { $_->javascripts } $self->sub_layouts
;
+ return
uniq
map { $self->_find_javascript($_) }
+
map({ $_->javascripts } $self->sub_layouts), $self->use_javascript
;
}
sub _find_javascript {
}
sub _find_javascript {