Revision 313367d3
Von Moritz Bunkus vor mehr als 9 Jahren hinzugefügt
SL/Dispatcher.pm | ||
---|---|---|
38 | 38 |
use SL::Helper::DateTime; |
39 | 39 |
use SL::InstanceConfiguration; |
40 | 40 |
use SL::Template::Plugin::HTMLFixes; |
41 |
use SL::User; |
|
41 | 42 |
|
42 | 43 |
# Trailing new line is added so that Perl will not add the line |
43 | 44 |
# number 'die' was called in. |
... | ... | |
157 | 158 |
$::lxdebug = LXDebug->new; |
158 | 159 |
$::auth = SL::Auth->new; |
159 | 160 |
$::form = undef; |
160 |
%::myconfig = (); |
|
161 | 161 |
$::request = undef; |
162 |
%::myconfig = User->get_default_myconfig; |
|
162 | 163 |
} |
163 | 164 |
|
164 | 165 |
$SIG{__WARN__} = sub { |
SL/Dispatcher/AuthHandler/Admin.pm | ||
---|---|---|
8 | 8 |
sub handle { |
9 | 9 |
my ($self, %params) = @_; |
10 | 10 |
|
11 |
%::myconfig = ();
|
|
11 |
%::myconfig = User->get_default_myconfig;
|
|
12 | 12 |
|
13 | 13 |
my $ok = $::auth->is_api_token_cookie_valid; |
14 | 14 |
$ok ||= $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK()); |
SL/Dispatcher/AuthHandler/None.pm | ||
---|---|---|
5 | 5 |
use parent qw(Rose::Object); |
6 | 6 |
|
7 | 7 |
sub handle { |
8 |
%::myconfig = ();
|
|
8 |
%::myconfig = User->get_default_myconfig;
|
|
9 | 9 |
return 1; |
10 | 10 |
} |
11 | 11 |
|
SL/Dispatcher/AuthHandler/User.pm | ||
---|---|---|
14 | 14 |
my $client_id = $::form->{'{AUTH}client_id'} || $::auth->get_session_value('client_id'); |
15 | 15 |
return $self->_error(%param) if !$client_id || !$::auth->set_client($client_id); |
16 | 16 |
|
17 |
%::myconfig = $::auth->read_user(login => $login);
|
|
17 |
%::myconfig = User->get_default_myconfig($::auth->read_user(login => $login));
|
|
18 | 18 |
|
19 | 19 |
return $self->_error(%param) unless $::myconfig{login}; |
20 | 20 |
|
SL/Layout/Base.pm | ||
---|---|---|
115 | 115 |
} else { |
116 | 116 |
$css_path = "$css_path/kivitendo"; |
117 | 117 |
} |
118 |
$::myconfig{css_path} = $css_path; # needed for menunew, FIXME: don't do this here |
|
119 | 118 |
|
120 | 119 |
return $css_path; |
121 | 120 |
} |
SL/User.pm | ||
---|---|---|
412 | 412 |
+{ %{ $_[0] } } |
413 | 413 |
} |
414 | 414 |
|
415 |
sub get_default_myconfig { |
|
416 |
my ($self_or_class, %user_config) = @_; |
|
417 |
|
|
418 |
return ( |
|
419 |
countrycode => 'de', |
|
420 |
css_path => 'css', # Needed for menunew, see SL::Layout::Base::get_stylesheet_for_user |
|
421 |
dateformat => 'dd.mm.yy', |
|
422 |
numberformat => '1.000,00', |
|
423 |
stylesheet => 'kivitendo.css', |
|
424 |
timeformat => 'hh:mm', |
|
425 |
%user_config, |
|
426 |
); |
|
427 |
} |
|
428 |
|
|
415 | 429 |
1; |
Auch abrufbar als: Unified diff
%::myconfig mit sinnvollen Standardwerten vorbelegen
Das zur-Verfügung-Stellen von ::myconfig in JavaScript und die darauf
basierende vereinfachte Initialisierung in 4ec753d erfordert, dass
::myconfig immer numberformat und dateformat enthält. Andernfalls gibt
es JavaScript-Fehler, wenn noch kein User angemeldet ist.