X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/82053b457be3de2ee5285dc13633222f4d30802c..9d015fd3a98cdfd59863a7d2908d3887099107a7:/SL/Template/Plugin/L.pm diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 3e157a366..3cde38482 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -66,6 +66,7 @@ sub select_tag { return _call_presenter('select_tag', @_); } sub input_tag { return _call_presenter('input_tag', @_); } sub truncate { return _call_presenter('truncate', @_); } sub simple_format { return _call_presenter('simple_format', @_); } +sub part_picker { return _call_presenter('part_picker', @_); } sub _set_id_attribute { my ($attributes, $name) = @_; @@ -221,14 +222,18 @@ sub date_tag { _set_id_attribute(\%params, $name); my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : (); - my @class = $params{no_cal} || $params{readonly} ? () : (class => 'datepicker'); + my @classes = $params{no_cal} || $params{readonly} ? () : ('datepicker'); + push @classes, delete($params{class}) if $params{class}; + my %class = @classes ? (class => join(' ', @classes)) : (); + + $::request->presenter->need_reinit_widgets($params{id}); return $self->input_tag( $name, blessed($value) ? $value->to_lxoffice : $value, size => 11, onblur => "check_right_date_format(this);", %params, - @class, @onchange, + %class, @onchange, ); } @@ -429,17 +434,6 @@ JAVASCRIPT return $code; } -sub online_help_tag { - my ($self, $tag, %params) = _hashify(2, @_); - my $cc = $::myconfig{countrycode}; - my $file = "doc/online/$cc/$tag.html"; - my $text = $params{text} || $::locale->text('Help'); - - die 'malformed help tag' unless $tag =~ /^[a-zA-Z0-9_]+$/; - return unless -f $file; - return $self->html_tag('a', $text, href => $file, class => 'jqModal') -} - sub dump { my $self = shift; return '
' . Data::Dumper::Dumper(@_) . '
'; @@ -449,40 +443,45 @@ sub sortable_table_header { my ($self, $by, %params) = _hashify(2, @_); my $controller = $self->{CONTEXT}->stash->get('SELF'); - my $sort_spec = $controller->get_sort_spec; + my $models = $params{models} || $self->{CONTEXT}->stash->get('MODELS'); + my $sort_spec = $models->get_sort_spec; my $by_spec = $sort_spec->{$by}; - my %current_sort_params = $controller->get_current_sort_params; + my %current_sort_params = $models->get_current_sort_params; my ($image, $new_dir) = ('', $current_sort_params{dir}); my $title = delete($params{title}) || $::locale->text($by_spec->{title}); - if ($current_sort_params{by} eq $by) { - my $current_dir = $current_sort_params{dir} ? 'up' : 'down'; + if ($current_sort_params{sort_by} eq $by) { + my $current_dir = $current_sort_params{sort_dir} ? 'up' : 'down'; $image = ''; - $new_dir = 1 - ($current_sort_params{dir} || 0); + $new_dir = 1 - ($current_sort_params{sort_dir} || 0); } - $params{ $sort_spec->{FORM_PARAMS}->[0] } = $by; - $params{ $sort_spec->{FORM_PARAMS}->[1] } = ($new_dir ? '1' : '0'); + $params{ $models->sorted->form_params->[0] } = $by; + $params{ $models->sorted->form_params->[1] } = ($new_dir ? '1' : '0'); - return '' . _H($title) . $image . ''; + return '' . _H($title) . $image . ''; } sub paginate_controls { - my ($self) = @_; + my ($self, %params) = _hashify(1, @_); my $controller = $self->{CONTEXT}->stash->get('SELF'); - my $paginate_spec = $controller->get_paginate_spec; - my %paginate_params = $controller->get_current_paginate_params; + my $models = $params{models} || $self->{CONTEXT}->stash->get('MODELS'); + my $pager = $models->paginated; +# my $paginate_spec = $controller->get_paginate_spec; + + my %paginate_params = $models->get_paginate_args; my %template_params = ( pages => \%paginate_params, url_maker => sub { my %url_params = _hashify(0, @_); - $url_params{ $paginate_spec->{FORM_PARAMS}->[0] } = delete $url_params{page}; - $url_params{ $paginate_spec->{FORM_PARAMS}->[1] } = delete $url_params{per_page} if exists $url_params{per_page}; + $url_params{ $pager->form_params->[0] } = delete $url_params{page}; + $url_params{ $pager->form_params->[1] } = delete $url_params{per_page} if exists $url_params{per_page}; - return $controller->get_callback(%url_params); + return $models->get_callback(%url_params); }, + %params, ); return SL::Presenter->get->render('common/paginate', %template_params);