From: Sven Schöling Date: Wed, 19 Sep 2012 13:52:38 +0000 (+0200) Subject: container für focus handling X-Git-Tag: release-3.0.0beta1~157 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4061ebb703c95986c6ffaffd688b0db917667117;p=kivitendo-erp.git container für focus handling --- diff --git a/SL/Controller/Layout/Base.pm b/SL/Controller/Layout/Base.pm index dbd5d8835..ed25f1b78 100644 --- a/SL/Controller/Layout/Base.pm +++ b/SL/Controller/Layout/Base.pm @@ -5,6 +5,7 @@ use parent qw(SL::Controller::Base); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => qw(menu), + 'scalar' => qw(focus), 'array' => [ 'add_stylesheets_inline' => { interface => 'add', hash_key => 'stylesheets_inline' }, 'add_javascripts_inline' => { interface => 'add', hash_key => 'javascripts_inline' }, diff --git a/SL/Controller/Layout/None.pm b/SL/Controller/Layout/None.pm index 2d9e2e85e..204b8ee36 100644 --- a/SL/Controller/Layout/None.pm +++ b/SL/Controller/Layout/None.pm @@ -4,7 +4,24 @@ use strict; use parent qw(SL::Controller::Layout::Base); sub javascripts_inline { + _setup_formats(), + _setup_focus(), +} + + +sub _setup_formats { $::form->parse_html_template('generic/javascript_setup') } +sub _setup_focus { + if ($::request->{layout}->focus || $::form->{fokus}) { + return $::form->parse_html_template('generic/focus_setup', { + focus => $::request->{layout}->focus, + fokus => $::form->{fokus}, + }) + } else { + return (); + } +} + 1; diff --git a/SL/Form.pm b/SL/Form.pm index 186e66151..514c282d2 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -488,7 +488,6 @@ sub header { push @header, map { qq|| } $layout->javascripts; push @header, $self->{javascript} if $self->{javascript}; push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] }; - push @header, "" if $self->{fokus}; my %doctypes = ( strict => qq||, diff --git a/templates/webpages/generic/focus_setup.html b/templates/webpages/generic/focus_setup.html new file mode 100644 index 000000000..22bb2a280 --- /dev/null +++ b/templates/webpages/generic/focus_setup.html @@ -0,0 +1 @@ +function fokus(){ [% IF focus %]$('[% focus %]').focus()[% ELSE %][% fokus %].focus()[% END %] }