Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 313367d3

Von Moritz Bunkus vor etwa 10 Jahren hinzugefügt

  • ID 313367d361bdc37ebad9647a82a437eedbf45ef4
  • Vorgänger 5fe965f7
  • Nachfolger 30590722

%::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.

Unterschiede anzeigen:

SL/Dispatcher.pm
use SL::Helper::DateTime;
use SL::InstanceConfiguration;
use SL::Template::Plugin::HTMLFixes;
use SL::User;
# Trailing new line is added so that Perl will not add the line
# number 'die' was called in.
......
$::lxdebug = LXDebug->new;
$::auth = SL::Auth->new;
$::form = undef;
%::myconfig = ();
$::request = undef;
%::myconfig = User->get_default_myconfig;
}
$SIG{__WARN__} = sub {
SL/Dispatcher/AuthHandler/Admin.pm
sub handle {
my ($self, %params) = @_;
%::myconfig = ();
%::myconfig = User->get_default_myconfig;
my $ok = $::auth->is_api_token_cookie_valid;
$ok ||= $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK());
SL/Dispatcher/AuthHandler/None.pm
use parent qw(Rose::Object);
sub handle {
%::myconfig = ();
%::myconfig = User->get_default_myconfig;
return 1;
}
SL/Dispatcher/AuthHandler/User.pm
my $client_id = $::form->{'{AUTH}client_id'} || $::auth->get_session_value('client_id');
return $self->_error(%param) if !$client_id || !$::auth->set_client($client_id);
%::myconfig = $::auth->read_user(login => $login);
%::myconfig = User->get_default_myconfig($::auth->read_user(login => $login));
return $self->_error(%param) unless $::myconfig{login};
SL/Layout/Base.pm
} else {
$css_path = "$css_path/kivitendo";
}
$::myconfig{css_path} = $css_path; # needed for menunew, FIXME: don't do this here
return $css_path;
}
SL/User.pm
+{ %{ $_[0] } }
}
sub get_default_myconfig {
my ($self_or_class, %user_config) = @_;
return (
countrycode => 'de',
css_path => 'css', # Needed for menunew, see SL::Layout::Base::get_stylesheet_for_user
dateformat => 'dd.mm.yy',
numberformat => '1.000,00',
stylesheet => 'kivitendo.css',
timeformat => 'hh:mm',
%user_config,
);
}
1;

Auch abrufbar als: Unified diff