push @header, "<meta http-equiv='refresh' content='$refresh_time;$refresh_url'>";
}
- push @header, map { qq|<link rel="stylesheet" href="$_" type="text/css" title="Stylesheet">| } $layout->stylesheets;
+ my $auto_reload_resources_param = $layout->auto_reload_resources_param;
+
+ push @header, map { qq|<link rel="stylesheet" href="${_}${auto_reload_resources_param}" type="text/css" title="Stylesheet">| } $layout->stylesheets;
push @header, "<style type='text/css'>\@page { size:landscape; }</style> " if $self->{landscape};
push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>" if -f $self->{favicon};
- push @header, map { qq|<script type="text/javascript" src="$_"></script>| } $layout->javascripts;
+ push @header, map { qq|<script type="text/javascript" src="${_}${auto_reload_resources_param}"></script>| } $layout->javascripts;
push @header, $self->{javascript} if $self->{javascript};
push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] };
use parent qw(SL::Controller::Base);
use List::MoreUtils qw(uniq);
+use Time::HiRes qw();
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' },
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
##########################################
# If set to 1 then the installation will be kept unlocked even if a
# database upgrade fails.
keep_installation_unlocked = 0
+
+# If set to 1 then all resource links (JavaScript, CSS files) output
+# via $::request->{layout}->use_stylesheet() / use_javascript() will
+# be made unique by appending a random GET parameter. This will cause
+# the web browser to always reload the resources.
+auto_reload_resources = 0