From 2fe6237c8b09d2f5a83145673c15be84bdfadf8a Mon Sep 17 00:00:00 2001 From: Werner Hahn Date: Tue, 25 Sep 2018 12:14:05 +0200 Subject: [PATCH] =?utf8?q?TopQuickSearch=20f=C3=BCr=20den=20Benutzer=20kon?= =?utf8?q?figurierbar=20gemacht.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Über UserPreferences, allerdings wird die Mandantenkonfiguration (quick_search_modules) nicht berücksichtigt. Der Benutzer hat alle Schnellsuchen zur Verfügung. Das L.multiselect2side macht Probleme deswegen auskommeniert. Wenn aktiv wird das Emailsignaturfeld m Tab "Persönliche Einstellungen" doppelt angezeigt, beide Felder und Links (Signatur bearbeiten und volle Signatur prüfen) sind sichtbar. --- SL/Controller/TopQuickSearch.pm | 21 ++++++++++++++++++--- SL/Form.pm | 1 + bin/mozilla/am.pl | 23 ++++++++++++++++++++++- locale/de/all | 1 + templates/webpages/am/config.html | 21 +++++++++++++++++++-- 5 files changed, 61 insertions(+), 6 deletions(-) diff --git a/SL/Controller/TopQuickSearch.pm b/SL/Controller/TopQuickSearch.pm index c3ad7f37a..8b4708031 100644 --- a/SL/Controller/TopQuickSearch.pm +++ b/SL/Controller/TopQuickSearch.pm @@ -6,6 +6,7 @@ use parent qw(SL::Controller::Base); use SL::ClientJS; use SL::JSON; use SL::Locale::String qw(t8); +use SL::Helper::UserPreferences; use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(module js) ], @@ -65,9 +66,23 @@ sub available_modules { } sub enabled_modules { - my %enabled_names = map { - $_ => 1 - } @{ $::instance_conf->get_quick_search_modules }; + my $user_prefs = SL::Helper::UserPreferences->new( + namespace => 'TopQuickSearch', + ); + + my %enabled_names; + if ($user_prefs) { + my $prefs_val = $user_prefs->get('quick_search_modules'); + my @quick_search_modules = split ',', $prefs_val; + + %enabled_names = map { + $_ => 1 + } @quick_search_modules ; + } else { + %enabled_names = map { + $_ => 1 + } @{ $::instance_conf->get_quick_search_modules }; + } grep { $enabled_names{$_->name} diff --git a/SL/Form.pm b/SL/Form.pm index 0ecb2219d..0c21ae2e6 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -434,6 +434,7 @@ sub header { jquery jquery-ui jquery.cookie jquery.checkall jquery.download jquery/jquery.form jquery/fixes client_js jquery/jquery.tooltipster.min + jquery.multiselect2side common part_selection ), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}"); diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index c23e9d241..83d1bd58a 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -42,6 +42,7 @@ use SL::AM; use SL::CA; use SL::Form; use SL::Helper::Flash; +use SL::Helper::UserPreferences; use SL::User; use SL::USTVA; use SL::Iconv; @@ -573,6 +574,7 @@ sub config { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; + my $defaults = SL::DB::Default->get; _build_cfg_options('dateformat', qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd)); _build_cfg_options('timeformat', qw(hh:mm hh:mm:ss)); @@ -643,6 +645,20 @@ sub config { }; } + my $user_prefs = SL::Helper::UserPreferences->new( + namespace => 'TopQuickSearch', + ); + my $prefs_val; + my @quick_search_modules; + if ($user_prefs) { + $prefs_val = $user_prefs->get('quick_search_modules'); + @quick_search_modules = split ',', $prefs_val; + } + + my $enabled_quick_search = [ SL::Controller::TopQuickSearch->new->available_modules ]; + $form->{ENABLED_QUICK_SEARCHMODULES} = \@{$enabled_quick_search}; + $form->{DEFAULT_QUICK_SEARCHMODULES} = \@quick_search_modules; + $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details})); $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password(); $form->{todo_cfg} = { TODO->get_user_config('login' => $::myconfig{login}) }; @@ -650,7 +666,6 @@ sub config { $form->{title} = $locale->text('Edit Preferences for #1', $::myconfig{login}); setup_am_config_action_bar(); - $form->header(); $form->{full_signature} = $form->create_email_signature(); @@ -671,6 +686,12 @@ sub save_preferences { TODO->save_user_config('login' => $::myconfig{login}, %{ $form->{todo_cfg} || { } }); + my $user_prefs = SL::Helper::UserPreferences->new( + namespace => 'TopQuickSearch', + ); + my $quick_search_modules = join ',', @{$form->{quick_search_modules}}; + $user_prefs->store('quick_search_modules', $quick_search_modules); + if (AM->save_preferences($form)) { if ($::auth->can_change_password() && defined $form->{new_password} diff --git a/locale/de/all b/locale/de/all index 4ea1a6a06..72aab61e7 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2472,6 +2472,7 @@ $self->{texts} = { 'Query parameters' => 'Abfrageparameter', 'Queue' => 'Warteschlange', 'Quick Search' => 'Schnellsuche', + 'Quick Searches that will be shown in the header for this user' => 'Schnellsuchen, die in der Kopfzeile gezeigt werden sollen', 'Quick Searches that will be shown in the header in this client' => 'Schnellsuchen, die in der Kopfzeile in diesem Mandanten gezeigt werden sollen', 'Quotation' => 'Angebot', 'Quotation Date' => 'Angebotsdatum', diff --git a/templates/webpages/am/config.html b/templates/webpages/am/config.html index d939919c1..e215590e5 100644 --- a/templates/webpages/am/config.html +++ b/templates/webpages/am/config.html @@ -1,6 +1,8 @@ [%- USE T8 %] [%- USE LxERP %] -[%- USE HTML %][%- USE L %] +[%- USE HTML %] +[%- USE L %] +[% USE Dumper %]

[% title %]

@@ -161,7 +163,22 @@ [% L.input_tag('form_cvars_nr_cols', MYCONFIG.form_cvars_nr_cols || 3, size = 5) %] - + + [% 'Quick Searches that will be shown in the header for this user' | $T8 %] + +
+ [% L.select_tag("quick_search_modules[]", + ENABLED_QUICK_SEARCHMODULES, + value_key = "name", + title_key = "description_config", + id = "quick_searches", + multiple = 1, + size = ENABLED_QUICK_SEARCHMODULES.size, + default = DEFAULT_QUICK_SEARCHMODULES) %] + [% # L.multiselect2side("quick_searches", labelsx=LxERP.t8("All modules"), labeldx=LxERP.t8("Enabled modules")) %] +
+ + -- 2.20.1