Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bae050e9

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID bae050e9f3e3aaeab94bbbbed96949edca155346
  • Vorgänger 88bb5aaa
  • Nachfolger 75c1894b

Entwickleroption "debug.auto_reload_resources" implementiert

Fügt einen zufälligen GET-Parameter an jeden JavaScript-/CSS-Link
hinzu, der via $layout->use_javascript()/use_stylesheet() ausgegeben
wird. Sorgt dafür, dass der Browser Resourcen jedes Mal neu lädt.

Hilfreich, wenn man gerade CSS oder JavaScript bastelt und nicht
dauernd F5 drücken möchte.

Unterschiede anzeigen:

SL/Form.pm
490 490
    push @header, "<meta http-equiv='refresh' content='$refresh_time;$refresh_url'>";
491 491
  }
492 492

  
493
  push @header, map { qq|<link rel="stylesheet" href="$_" type="text/css" title="Stylesheet">| } $layout->stylesheets;
493
  my $auto_reload_resources_param = $layout->auto_reload_resources_param;
494

  
495
  push @header, map { qq|<link rel="stylesheet" href="${_}${auto_reload_resources_param}" type="text/css" title="Stylesheet">| } $layout->stylesheets;
494 496
  push @header, "<style type='text/css'>\@page { size:landscape; }</style> "                     if $self->{landscape};
495 497
  push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>"         if -f $self->{favicon};
496
  push @header, map { qq|<script type="text/javascript" src="$_"></script>| }                    $layout->javascripts;
498
  push @header, map { qq|<script type="text/javascript" src="${_}${auto_reload_resources_param}"></script>| }                    $layout->javascripts;
497 499
  push @header, $self->{javascript} if $self->{javascript};
498 500
  push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] };
499 501

  
SL/Layout/Base.pm
4 4
use parent qw(SL::Controller::Base);
5 5

  
6 6
use List::MoreUtils qw(uniq);
7
use Time::HiRes qw();
7 8

  
8 9
use Rose::Object::MakeMethods::Generic (
9
  'scalar --get_set_init' => qw(menu),
10
  'scalar --get_set_init' => [ qw(menu auto_reload_resources_param) ],
10 11
  'scalar'                => qw(focus),
11 12
  'array'                 => [
12 13
    'add_stylesheets_inline' => { interface => 'add', hash_key => 'stylesheets_inline' },
......
30 31
  Menu->new('menu.ini');
31 32
}
32 33

  
34
sub init_auto_reload_resources_param {
35
  return '' unless $::lx_office_conf{debug}->{auto_reload_resources};
36
  return sprintf('?rand=%d-%d-%d', Time::HiRes::gettimeofday(), int(rand 1000000000000));
37
}
38

  
33 39
##########################################
34 40
#  inheritable/overridable
35 41
##########################################
config/kivitendo.conf.default
293 293
# If set to 1 then the installation will be kept unlocked even if a
294 294
# database upgrade fails.
295 295
keep_installation_unlocked = 0
296

  
297
# If set to 1 then all resource links (JavaScript, CSS files) output
298
# via $::request->{layout}->use_stylesheet() / use_javascript() will
299
# be made unique by appending a random GET parameter. This will cause
300
# the web browser to always reload the resources.
301
auto_reload_resources = 0

Auch abrufbar als: Unified diff