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' },
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;
push @header, map { qq|<script type="text/javascript" src="$_"></script>| } $layout->javascripts;
push @header, $self->{javascript} if $self->{javascript};
push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] };
- push @header, "<script type='text/javascript'>function fokus(){ document.$self->{fokus}.focus(); }</script>" if $self->{fokus};
my %doctypes = (
strict => qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|,
--- /dev/null
+function fokus(){ [% IF focus %]$('[% focus %]').focus()[% ELSE %][% fokus %].focus()[% END %] }