From: Bernd Bleßmann Date: Mon, 11 Apr 2022 14:23:44 +0000 (+0200) Subject: Langtext-Dialog: Größe prozentual zum Hauptfenster einstellbar pro Benutzer X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~54 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=94f5cb152afa9210162295b6727801c296af0631;p=kivitendo-erp.git Langtext-Dialog: Größe prozentual zum Hauptfenster einstellbar pro Benutzer Ist hier in der Benutzereinstellung ein Wert != 0 gewählt, so wird der Dialog entsprechend dargestellt. Auch die Größe des Editor-Bereichs wird in diesem Fall angpepasst. Ist 0 oder kein Wert gewählt, so ist das Verhalten wie zuvor. --- diff --git a/SL/AM.pm b/SL/AM.pm index 2ec225238..2d8ed4cff 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -52,6 +52,7 @@ use SL::DB::Part; use SL::DB::Vendor; use SL::DB; use SL::GenericTranslations; +use SL::Helper::UserPreferences::DisplayPreferences; use SL::Helper::UserPreferences::PositionsScrollbar; use SL::Helper::UserPreferences::PartPickerSearch; use SL::Helper::UserPreferences::TimeRecording; @@ -551,6 +552,10 @@ sub time_recording_use_duration { SL::Helper::UserPreferences::TimeRecording->new()->get_use_duration(); } +sub longdescription_dialog_size_percentage { + SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); +} + sub save_preferences { $main::lxdebug->enter_sub(); @@ -591,6 +596,9 @@ sub save_preferences { if (exists $form->{time_recording_use_duration}) { SL::Helper::UserPreferences::TimeRecording->new()->store_use_duration($form->{time_recording_use_duration}) } + if (exists $form->{longdescription_dialog_size_percentage}) { + SL::Helper::UserPreferences::DisplayPreferences->new()->store_longdescription_dialog_size_percentage($form->{longdescription_dialog_size_percentage}) + } $main::lxdebug->leave_sub(); diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index 1bb641ceb..97bfbca3e 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -33,6 +33,7 @@ use SL::DB::TransferType; use SL::Helper::CreatePDF qw(:all); use SL::Helper::PrintOptions; use SL::Helper::ShippedQty; +use SL::Helper::UserPreferences::DisplayPreferences; use SL::Helper::UserPreferences::PositionsScrollbar; use SL::Helper::UserPreferences::UpdatePositions; @@ -1781,7 +1782,8 @@ sub pre_render { } } @all_objects; } - $self->{template_args}{in_out} = $self->type_data->transfer; + $self->{template_args}{in_out} = $self->type_data->transfer; + $self->{template_args}{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted}; diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 43e8dc4eb..025078111 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -33,6 +33,7 @@ use SL::DB::Translation; use SL::Helper::CreatePDF qw(:all); use SL::Helper::PrintOptions; use SL::Helper::ShippedQty; +use SL::Helper::UserPreferences::DisplayPreferences; use SL::Helper::UserPreferences::PositionsScrollbar; use SL::Helper::UserPreferences::UpdatePositions; @@ -2025,6 +2026,7 @@ sub pre_render { && $::instance_conf->get_transport_cost_reminder_article_number_id ) { $self->{template_args}->{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load; } + $self->{template_args}->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted}; diff --git a/SL/Helper/UserPreferences/DisplayPreferences.pm b/SL/Helper/UserPreferences/DisplayPreferences.pm new file mode 100644 index 000000000..f3bcae381 --- /dev/null +++ b/SL/Helper/UserPreferences/DisplayPreferences.pm @@ -0,0 +1,66 @@ +package SL::Helper::UserPreferences::DisplayPreferences; + +use strict; +use parent qw(Rose::Object); + +use SL::Helper::UserPreferences; + +use Rose::Object::MakeMethods::Generic ( + 'scalar --get_set_init' => [ qw(user_prefs) ], +); + +sub get_longdescription_dialog_size_percentage { + $_[0]->user_prefs->get('longdescription_dialog_size_percentage'); +} + +sub store_longdescription_dialog_size_percentage { + $_[0]->user_prefs->store('longdescription_dialog_size_percentage', $_[1]); +} + +sub init_user_prefs { + SL::Helper::UserPreferences->new( + namespace => $_[0]->namespace, + ) +} + +# read only stuff +sub namespace { 'DisplayPreferences' } +sub version { 1 } + +1; + +__END__ + +=pod + +=encoding utf-8 + +=head1 NAME + +SL::Helper::UserPreferences::DisplayPreferences - preferences intended +to store user settings for various display settings. + +=head1 SYNOPSIS + + use SL::Helper::UserPreferences::DisplayPreferences; + my $prefs = SL::Helper::UserPreferences::DisplayPreferences->new(); + + $prefs->store_use_duration(1); + my $value = $prefs->get_longdescription_dialog_size_percentage; + +=head1 DESCRIPTION + +This module manages storing the user's choise for settings for +various display settings. +For now the preferred procentual size of the edit-dialog for longdescriptions +of positions can be stored. + +=head1 BUGS + +None yet :) + +=head1 AUTHOR + +Bernd Bleßmann Ebernd@kivitendo-premium.deE + +=cut diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 0b29a83a9..541ababea 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -659,12 +659,13 @@ sub config { $form->{enabled_quick_searchmodules} = \@{$enabled_quick_search}; $form->{default_quick_searchmodules} = \@quick_search_modules; - $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module(); - $form->{positions_scrollbar_height} = AM->positions_scrollbar_height(); - $form->{purchase_search_makemodel} = AM->purchase_search_makemodel(); - $form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber(); - $form->{positions_show_update_button} = AM->positions_show_update_button(); - $form->{time_recording_use_duration} = AM->time_recording_use_duration(); + $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module(); + $form->{positions_scrollbar_height} = AM->positions_scrollbar_height(); + $form->{purchase_search_makemodel} = AM->purchase_search_makemodel(); + $form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber(); + $form->{positions_show_update_button} = AM->positions_show_update_button(); + $form->{time_recording_use_duration} = AM->time_recording_use_duration(); + $form->{longdescription_dialog_size_percentage} = AM->longdescription_dialog_size_percentage(); $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details})); $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password(); diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 581ec5b37..e0b4dbc54 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -39,6 +39,7 @@ use POSIX qw(strftime); use SL::Controller::DeliveryOrder; use SL::DB::DeliveryOrder; use SL::DB::DeliveryOrder::TypeData qw(:types validate_type); +use SL::Helper::UserPreferences::DisplayPreferences; use SL::DO; use SL::IR; use SL::IS; @@ -517,6 +518,7 @@ sub form_header { $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')' if $form->{VC_OBJ}; + $form->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.File kivi.MassDeliveryOrderPrint kivi.SalesPurchase kivi.Part kivi.CustomerVendor kivi.Validator ckeditor/ckeditor ckeditor/adapters/jquery kivi.io)); diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 1b9a782ad..b0df30c44 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -34,6 +34,7 @@ use SL::FU; use SL::Helper::Flash qw(flash_later); +use SL::Helper::UserPreferences::DisplayPreferences; use SL::IR; use SL::IS; use SL::DB::BankTransactionAccTrans; @@ -456,9 +457,10 @@ sub form_header { $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } - $TMPL_VAR{is_format_html} = $form->{format} eq 'html'; - $TMPL_VAR{dateformat} = $myconfig{dateformat}; - $TMPL_VAR{numberformat} = $myconfig{numberformat}; + $TMPL_VAR{is_format_html} = $form->{format} eq 'html'; + $TMPL_VAR{dateformat} = $myconfig{dateformat}; + $TMPL_VAR{numberformat} = $myconfig{numberformat}; + $TMPL_VAR{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); # hiddens $TMPL_VAR{HIDDENS} = [qw( diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 57a79af0d..d0e25062a 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -35,6 +35,7 @@ use SL::FU; use SL::IS; use SL::OE; +use SL::Helper::UserPreferences::DisplayPreferences; use SL::MoreCommon qw(restore_form save_form); use SL::RecordLinks; @@ -625,11 +626,12 @@ sub form_header { $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } - $TMPL_VAR{is_type_normal_invoice} = $form->{type} eq "invoice"; - $TMPL_VAR{is_type_credit_note} = $form->{type} eq "credit_note"; - $TMPL_VAR{is_format_html} = $form->{format} eq 'html'; - $TMPL_VAR{dateformat} = $myconfig{dateformat}; - $TMPL_VAR{numberformat} = $myconfig{numberformat}; + $TMPL_VAR{is_type_normal_invoice} = $form->{type} eq "invoice"; + $TMPL_VAR{is_type_credit_note} = $form->{type} eq "credit_note"; + $TMPL_VAR{is_format_html} = $form->{format} eq 'html'; + $TMPL_VAR{dateformat} = $myconfig{dateformat}; + $TMPL_VAR{numberformat} = $myconfig{numberformat}; + $TMPL_VAR{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); # hiddens $TMPL_VAR{HIDDENS} = [qw( diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 610215b42..3ac2fc248 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -42,6 +42,7 @@ use SL::FU; use SL::OE; use SL::IR; use SL::IS; +use SL::Helper::UserPreferences::DisplayPreferences; use SL::MoreCommon qw(ary_diff restore_form save_form); use SL::ReportGenerator; use SL::YAML; @@ -50,7 +51,6 @@ use List::Util qw(min max reduce sum); use Data::Dumper; use SL::Controller::Order; - use SL::DB::Customer; use SL::DB::TaxZone; use SL::DB::PaymentTerm; @@ -622,8 +622,9 @@ sub form_header { } $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});"); - $TMPL_VAR->{dateformat} = $myconfig{dateformat}; - $TMPL_VAR->{numberformat} = $myconfig{numberformat}; + $TMPL_VAR->{dateformat} = $myconfig{dateformat}; + $TMPL_VAR->{numberformat} = $myconfig{numberformat}; + $TMPL_VAR->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); if ($form->{type} eq 'sales_order') { if (!$form->{periodic_invoices_config}) { diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index a350e1963..4dc390b16 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -1,4 +1,6 @@ namespace('kivi.SalesPurchase', function(ns) { + this.longdescription_dialog_size_percentage = 0; + this.edit_longdescription = function(row) { var $element = $('#longdescription_' + row); @@ -17,8 +19,20 @@ namespace('kivi.SalesPurchase', function(ns) { }; this.edit_longdescription_with_params = function(params) { + var dialog_width = 800; + var dialog_height = 500; + var textarea_width = 750; + var textarea_height = 220; + if (this.longdescription_dialog_size_percentage != 0) { + dialog_width = Math.ceil(window.innerWidth * this.longdescription_dialog_size_percentage/100); + dialog_height = Math.ceil(window.innerHeight * this.longdescription_dialog_size_percentage/100); + textarea_width = Math.ceil(dialog_width * 95/100); + textarea_height = dialog_height - 220; + if (textarea_height <= 0) textarea_height = 220; + } + var $container = $('#popup_edit_longdescription_input_container'); - var $edit = $(''); + var $edit = $(''); $container.children().remove(); $container.append($edit); @@ -44,6 +58,8 @@ namespace('kivi.SalesPurchase', function(ns) { id: 'edit_longdescription_dialog', dialog: { title: kivi.t8('Enter longdescription'), + width: dialog_width, + height: dialog_height, open: function() { kivi.focus_ckeditor_when_ready('#popup_edit_longdescription_input'); }, close: function() { $('#popup_edit_longdescription_input_container').children().remove(); } } diff --git a/locale/de/all b/locale/de/all index 9c443aef3..b4c12b76a 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2046,6 +2046,7 @@ $self->{texts} = { 'Long Description (quotations & orders)' => 'Langtext (Angebote & Aufträge)', 'Long Description for invoices' => 'Langtext für Rechnungen', 'Long Description for quotations & orders' => 'Langtext für Angebote & Aufträge', + 'Longdescription dialog size percentage from main window (0 means fix values)' => 'Prozentuale Größe des Langtext-Dialogs im Verhältnis zum Hauptfenster (0 bedeutet feste Größe)', 'Loss' => 'Verlust', 'Loss carried forward account' => 'Verlustvortragskonto', 'Luxembourg' => 'Luxemburg', diff --git a/locale/en/all b/locale/en/all index f1c9c7a11..0c0c44f41 100644 --- a/locale/en/all +++ b/locale/en/all @@ -2046,6 +2046,7 @@ $self->{texts} = { 'Long Description (quotations & orders)' => '', 'Long Description for invoices' => '', 'Long Description for quotations & orders' => '', + 'Longdescription dialog size percentage from main window (0 means fix values)' => '', 'Loss' => '', 'Loss carried forward account' => '', 'Luxembourg' => '', diff --git a/templates/webpages/am/config.html b/templates/webpages/am/config.html index 4a8d64d52..cd0e7eeec 100644 --- a/templates/webpages/am/config.html +++ b/templates/webpages/am/config.html @@ -159,6 +159,12 @@ + + [% 'Longdescription dialog size percentage from main window (0 means fix values)' | $T8 %] + + [% L.input_tag('longdescription_dialog_size_percentage', longdescription_dialog_size_percentage, size = 5) %] + + [%- IF INSTANCE_CONF.get_feature_experimental_order -%] [% 'Scrollbar height percentage for form postion area (0 means no scrollbar)' | $T8 %] diff --git a/templates/webpages/generic/set_longdescription.html b/templates/webpages/generic/set_longdescription.html index 318763768..eb746759d 100644 --- a/templates/webpages/generic/set_longdescription.html +++ b/templates/webpages/generic/set_longdescription.html @@ -25,3 +25,9 @@ [% LxERP.t8("Abort") %]

+ +