Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 94f5cb15

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID 94f5cb152afa9210162295b6727801c296af0631
  • Vorgänger 86751c7a
  • Nachfolger 40f3befb

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.

Unterschiede anzeigen:

SL/AM.pm
52 52
use SL::DB::Vendor;
53 53
use SL::DB;
54 54
use SL::GenericTranslations;
55
use SL::Helper::UserPreferences::DisplayPreferences;
55 56
use SL::Helper::UserPreferences::PositionsScrollbar;
56 57
use SL::Helper::UserPreferences::PartPickerSearch;
57 58
use SL::Helper::UserPreferences::TimeRecording;
......
551 552
  SL::Helper::UserPreferences::TimeRecording->new()->get_use_duration();
552 553
}
553 554

  
555
sub longdescription_dialog_size_percentage {
556
  SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
557
}
558

  
554 559
sub save_preferences {
555 560
  $main::lxdebug->enter_sub();
556 561

  
......
591 596
  if (exists $form->{time_recording_use_duration}) {
592 597
    SL::Helper::UserPreferences::TimeRecording->new()->store_use_duration($form->{time_recording_use_duration})
593 598
  }
599
  if (exists $form->{longdescription_dialog_size_percentage}) {
600
    SL::Helper::UserPreferences::DisplayPreferences->new()->store_longdescription_dialog_size_percentage($form->{longdescription_dialog_size_percentage})
601
  }
594 602

  
595 603
  $main::lxdebug->leave_sub();
596 604

  
SL/Controller/DeliveryOrder.pm
33 33
use SL::Helper::CreatePDF qw(:all);
34 34
use SL::Helper::PrintOptions;
35 35
use SL::Helper::ShippedQty;
36
use SL::Helper::UserPreferences::DisplayPreferences;
36 37
use SL::Helper::UserPreferences::PositionsScrollbar;
37 38
use SL::Helper::UserPreferences::UpdatePositions;
38 39

  
......
1781 1782
                                                } } @all_objects;
1782 1783
  }
1783 1784

  
1784
  $self->{template_args}{in_out} = $self->type_data->transfer;
1785
  $self->{template_args}{in_out}                                 = $self->type_data->transfer;
1786
  $self->{template_args}{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
1785 1787

  
1786 1788
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
1787 1789

  
SL/Controller/Order.pm
33 33
use SL::Helper::CreatePDF qw(:all);
34 34
use SL::Helper::PrintOptions;
35 35
use SL::Helper::ShippedQty;
36
use SL::Helper::UserPreferences::DisplayPreferences;
36 37
use SL::Helper::UserPreferences::PositionsScrollbar;
37 38
use SL::Helper::UserPreferences::UpdatePositions;
38 39

  
......
2025 2026
      && $::instance_conf->get_transport_cost_reminder_article_number_id ) {
2026 2027
    $self->{template_args}->{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load;
2027 2028
  }
2029
  $self->{template_args}->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
2028 2030

  
2029 2031
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
2030 2032

  
SL/Helper/UserPreferences/DisplayPreferences.pm
1
package SL::Helper::UserPreferences::DisplayPreferences;
2

  
3
use strict;
4
use parent qw(Rose::Object);
5

  
6
use SL::Helper::UserPreferences;
7

  
8
use Rose::Object::MakeMethods::Generic (
9
  'scalar --get_set_init' => [ qw(user_prefs) ],
10
);
11

  
12
sub get_longdescription_dialog_size_percentage {
13
  $_[0]->user_prefs->get('longdescription_dialog_size_percentage');
14
}
15

  
16
sub store_longdescription_dialog_size_percentage {
17
  $_[0]->user_prefs->store('longdescription_dialog_size_percentage', $_[1]);
18
}
19

  
20
sub init_user_prefs {
21
  SL::Helper::UserPreferences->new(
22
    namespace => $_[0]->namespace,
23
  )
24
}
25

  
26
# read only stuff
27
sub namespace     { 'DisplayPreferences' }
28
sub version       { 1 }
29

  
30
1;
31

  
32
__END__
33

  
34
=pod
35

  
36
=encoding utf-8
37

  
38
=head1 NAME
39

  
40
SL::Helper::UserPreferences::DisplayPreferences - preferences intended
41
to store user settings for various display settings.
42

  
43
=head1 SYNOPSIS
44

  
45
  use SL::Helper::UserPreferences::DisplayPreferences;
46
  my $prefs = SL::Helper::UserPreferences::DisplayPreferences->new();
47

  
48
  $prefs->store_use_duration(1);
49
  my $value = $prefs->get_longdescription_dialog_size_percentage;
50

  
51
=head1 DESCRIPTION
52

  
53
This module manages storing the user's choise for settings for
54
various display settings.
55
For now the preferred procentual size of the edit-dialog for longdescriptions
56
of positions can be stored.
57

  
58
=head1 BUGS
59

  
60
None yet :)
61

  
62
=head1 AUTHOR
63

  
64
Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
65

  
66
=cut
bin/mozilla/am.pl
659 659
  $form->{enabled_quick_searchmodules} = \@{$enabled_quick_search};
660 660
  $form->{default_quick_searchmodules} = \@quick_search_modules;
661 661

  
662
  $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module();
663
  $form->{positions_scrollbar_height}       = AM->positions_scrollbar_height();
664
  $form->{purchase_search_makemodel}        = AM->purchase_search_makemodel();
665
  $form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber();
666
  $form->{positions_show_update_button}     = AM->positions_show_update_button();
667
  $form->{time_recording_use_duration}      = AM->time_recording_use_duration();
662
  $form->{displayable_name_specs_by_module}       = AM->displayable_name_specs_by_module();
663
  $form->{positions_scrollbar_height}             = AM->positions_scrollbar_height();
664
  $form->{purchase_search_makemodel}              = AM->purchase_search_makemodel();
665
  $form->{sales_search_customer_partnumber}       = AM->sales_search_customer_partnumber();
666
  $form->{positions_show_update_button}           = AM->positions_show_update_button();
667
  $form->{time_recording_use_duration}            = AM->time_recording_use_duration();
668
  $form->{longdescription_dialog_size_percentage} = AM->longdescription_dialog_size_percentage();
668 669

  
669 670
  $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
670 671
  $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
bin/mozilla/do.pl
39 39
use SL::Controller::DeliveryOrder;
40 40
use SL::DB::DeliveryOrder;
41 41
use SL::DB::DeliveryOrder::TypeData qw(:types validate_type);
42
use SL::Helper::UserPreferences::DisplayPreferences;
42 43
use SL::DO;
43 44
use SL::IR;
44 45
use SL::IS;
......
517 518

  
518 519

  
519 520
  $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')' if $form->{VC_OBJ};
521
  $form->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
520 522

  
521 523
  $::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));
522 524

  
bin/mozilla/ir.pl
34 34

  
35 35
use SL::FU;
36 36
use SL::Helper::Flash qw(flash_later);
37
use SL::Helper::UserPreferences::DisplayPreferences;
37 38
use SL::IR;
38 39
use SL::IS;
39 40
use SL::DB::BankTransactionAccTrans;
......
456 457
    $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
457 458
  }
458 459

  
459
  $TMPL_VAR{is_format_html}      = $form->{format} eq 'html';
460
  $TMPL_VAR{dateformat}          = $myconfig{dateformat};
461
  $TMPL_VAR{numberformat}        = $myconfig{numberformat};
460
  $TMPL_VAR{is_format_html}                         = $form->{format} eq 'html';
461
  $TMPL_VAR{dateformat}                             = $myconfig{dateformat};
462
  $TMPL_VAR{numberformat}                           = $myconfig{numberformat};
463
  $TMPL_VAR{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
462 464

  
463 465
  # hiddens
464 466
  $TMPL_VAR{HIDDENS} = [qw(
bin/mozilla/is.pl
35 35
use SL::FU;
36 36
use SL::IS;
37 37
use SL::OE;
38
use SL::Helper::UserPreferences::DisplayPreferences;
38 39
use SL::MoreCommon qw(restore_form save_form);
39 40
use SL::RecordLinks;
40 41

  
......
625 626
    $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
626 627
  }
627 628

  
628
  $TMPL_VAR{is_type_normal_invoice} = $form->{type} eq "invoice";
629
  $TMPL_VAR{is_type_credit_note}    = $form->{type}   eq "credit_note";
630
  $TMPL_VAR{is_format_html}         = $form->{format} eq 'html';
631
  $TMPL_VAR{dateformat}             = $myconfig{dateformat};
632
  $TMPL_VAR{numberformat}           = $myconfig{numberformat};
629
  $TMPL_VAR{is_type_normal_invoice}                 = $form->{type} eq "invoice";
630
  $TMPL_VAR{is_type_credit_note}                    = $form->{type}   eq "credit_note";
631
  $TMPL_VAR{is_format_html}                         = $form->{format} eq 'html';
632
  $TMPL_VAR{dateformat}                             = $myconfig{dateformat};
633
  $TMPL_VAR{numberformat}                           = $myconfig{numberformat};
634
  $TMPL_VAR{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
633 635

  
634 636
  # hiddens
635 637
  $TMPL_VAR{HIDDENS} = [qw(
bin/mozilla/oe.pl
42 42
use SL::OE;
43 43
use SL::IR;
44 44
use SL::IS;
45
use SL::Helper::UserPreferences::DisplayPreferences;
45 46
use SL::MoreCommon qw(ary_diff restore_form save_form);
46 47
use SL::ReportGenerator;
47 48
use SL::YAML;
......
50 51
use Data::Dumper;
51 52

  
52 53
use SL::Controller::Order;
53

  
54 54
use SL::DB::Customer;
55 55
use SL::DB::TaxZone;
56 56
use SL::DB::PaymentTerm;
......
622 622
  }
623 623

  
624 624
  $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});");
625
  $TMPL_VAR->{dateformat}          = $myconfig{dateformat};
626
  $TMPL_VAR->{numberformat}        = $myconfig{numberformat};
625
  $TMPL_VAR->{dateformat}                             = $myconfig{dateformat};
626
  $TMPL_VAR->{numberformat}                           = $myconfig{numberformat};
627
  $TMPL_VAR->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
627 628

  
628 629
  if ($form->{type} eq 'sales_order') {
629 630
    if (!$form->{periodic_invoices_config}) {
js/kivi.SalesPurchase.js
1 1
namespace('kivi.SalesPurchase', function(ns) {
2
  this.longdescription_dialog_size_percentage = 0;
3

  
2 4
  this.edit_longdescription = function(row) {
3 5
    var $element = $('#longdescription_' + row);
4 6

  
......
17 19
  };
18 20

  
19 21
  this.edit_longdescription_with_params = function(params) {
22
    var dialog_width    = 800;
23
    var dialog_height   = 500;
24
    var textarea_width  = 750;
25
    var textarea_height = 220;
26
    if (this.longdescription_dialog_size_percentage != 0) {
27
      dialog_width    = Math.ceil(window.innerWidth  * this.longdescription_dialog_size_percentage/100);
28
      dialog_height   = Math.ceil(window.innerHeight * this.longdescription_dialog_size_percentage/100);
29
      textarea_width  = Math.ceil(dialog_width * 95/100);
30
      textarea_height = dialog_height - 220;
31
      if (textarea_height <= 0) textarea_height = 220;
32
    }
33

  
20 34
    var $container = $('#popup_edit_longdescription_input_container');
21
    var $edit      = $('<textarea id="popup_edit_longdescription_input" class="texteditor-in-dialog texteditor-space-for-toolbar" wrap="soft" style="width: 750px; height: 220px;"></textarea>');
35
    var $edit      = $('<textarea id="popup_edit_longdescription_input" class="texteditor-in-dialog texteditor-space-for-toolbar" wrap="soft" style="width: ' + textarea_width + 'px; height: ' + textarea_height + 'px;"></textarea>');
22 36

  
23 37
    $container.children().remove();
24 38
    $container.append($edit);
......
44 58
      id:    'edit_longdescription_dialog',
45 59
      dialog: {
46 60
        title: kivi.t8('Enter longdescription'),
61
        width:  dialog_width,
62
        height: dialog_height,
47 63
        open:  function() { kivi.focus_ckeditor_when_ready('#popup_edit_longdescription_input'); },
48 64
        close: function() { $('#popup_edit_longdescription_input_container').children().remove(); }
49 65
      }
locale/de/all
2046 2046
  'Long Description (quotations & orders)' => 'Langtext (Angebote & Aufträge)',
2047 2047
  'Long Description for invoices' => 'Langtext für Rechnungen',
2048 2048
  'Long Description for quotations & orders' => 'Langtext für Angebote & Aufträge',
2049
  '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)',
2049 2050
  'Loss'                        => 'Verlust',
2050 2051
  'Loss carried forward account' => 'Verlustvortragskonto',
2051 2052
  'Luxembourg'                  => 'Luxemburg',
locale/en/all
2046 2046
  'Long Description (quotations & orders)' => '',
2047 2047
  'Long Description for invoices' => '',
2048 2048
  'Long Description for quotations & orders' => '',
2049
  'Longdescription dialog size percentage from main window (0 means fix values)' => '',
2049 2050
  'Loss'                        => '',
2050 2051
  'Loss carried forward account' => '',
2051 2052
  'Luxembourg'                  => '',
templates/webpages/am/config.html
159 159
      </td>
160 160
     </tr>
161 161

  
162
     <tr>
163
      <th align="right">[% 'Longdescription dialog size percentage from main window (0 means fix values)' | $T8 %]</th>
164
      <td>
165
        [% L.input_tag('longdescription_dialog_size_percentage', longdescription_dialog_size_percentage, size = 5) %]
166
      </td>
167
     </tr>
162 168
     [%- IF INSTANCE_CONF.get_feature_experimental_order -%]
163 169
     <tr>
164 170
      <th align="right">[% 'Scrollbar height percentage for form postion area (0 means no scrollbar)' | $T8 %]</th>
templates/webpages/generic/set_longdescription.html
25 25
  <a onclick="$('#edit_longdescription_dialog').dialog('close');" href="#">[% LxERP.t8("Abort") %]</a>
26 26
 </p>
27 27
</div>
28

  
29
<script>
30
  $(function() {
31
    kivi.SalesPurchase.longdescription_dialog_size_percentage = "[% longdescription_dialog_size_percentage %]";
32
  });
33
</script>

Auch abrufbar als: Unified diff