- delete($attributes{default});
-
-
- my @all_options;
- push @all_options, [undef, $empty_title || ''] if $with_empty;
-
- my $normalize_entry = sub {
- my ($type, $entry, $sub, $key) = @_;
-
- return $sub->($entry) if $sub;
-
- my $ref = ref($entry);
-
- if ( !$ref ) {
- return $entry if $type eq 'value' || $type eq 'title';
- return 0;
- }
-
- if ( $ref eq 'ARRAY' ) {
- return $entry->[ $type eq 'value' ? 0 : $type eq 'title' ? 1 : 2 ];
- }
-
- return $entry->{$key} if $ref eq 'HASH';
- return $entry->$key if $type ne 'default' || $entry->can($key);
- return undef;
- };
-
- my $list_to_code = sub {
- my ($sub_collection) = @_;
-
- my @options;
- foreach my $entry ( @{ $sub_collection } ) {
- my $value;
- my $title;
-
- if ( $value_title_sub ) {
- ($value, $title) = @{ $value_title_sub->($entry) };
- } else {
-
- $value = $normalize_entry->('value', $entry, $value_sub, $value_key);
- $title = $normalize_entry->('title', $entry, $title_sub, $title_key);
- }
-
- my $default = $normalize_entry->('default', $entry, $default_sub, $default_key);
-
- push(@options, [$value, $title, $default]);
- }
-
- foreach my $entry (@options) {
- $entry->[2] = 1 if $selected{$entry->[0]};
- }
-
- return join '', map { $self->html_tag('option', _H($_->[1]), value => $_->[0], selected => $_->[2]) } @options;
- };
-
- my $code;
-
- if (!$with_optgroups) {
- $code = $list_to_code->($collection);
-
- } else {
- $code = join '', map {
- my ($optgroup_title, $sub_collection) = @{ $_ };
- $self->html_tag('optgroup', $list_to_code->($sub_collection), label => $optgroup_title)
- } @{ $collection };
- }
-
- return $self->html_tag('select', $code, %attributes, name => $name);
-}
-
-sub textarea_tag {
- my ($self, $name, $content, @slurp) = @_;
- my %attributes = _hashify(@slurp);
-
- $attributes{id} ||= $self->name_to_id($name);
- $attributes{rows} *= 1; # required by standard
- $attributes{cols} *= 1; # required by standard
- $content = $content ? _H($content) : '';
-
- return $self->html_tag('textarea', $content, %attributes, name => $name);
-}
-
-sub checkbox_tag {
- my ($self, $name, @slurp) = @_;
- my %attributes = _hashify(@slurp);
-
- $attributes{id} ||= $self->name_to_id($name);
- $attributes{value} = 1 unless defined $attributes{value};
- my $label = delete $attributes{label};
- my $checkall = delete $attributes{checkall};
-
- if ($attributes{checked}) {
- $attributes{checked} = 'checked';
- } else {
- delete $attributes{checked};
- }
-
- my $code = $self->html_tag('input', undef, %attributes, name => $name, type => 'checkbox');
- $code .= $self->html_tag('label', $label, for => $attributes{id}) if $label;
- $code .= $self->javascript(qq|\$('#$attributes{id}').checkall('$checkall');|) if $checkall;
-
- return $code;
-}
-
-sub radio_button_tag {
- my $self = shift;
- my $name = shift;
- my %attributes = _hashify(@_);
-
- $attributes{value} = 1 unless defined $attributes{value};
- $attributes{id} ||= $self->name_to_id($name . "_" . $attributes{value});
- my $label = delete $attributes{label};
-
- if ($attributes{checked}) {
- $attributes{checked} = 'checked';
- } else {
- delete $attributes{checked};
- }
-
- my $code = $self->html_tag('input', undef, %attributes, name => $name, type => 'radio');
- $code .= $self->html_tag('label', $label, for => $attributes{id}) if $label;
-
- return $code;
-}
-
-sub input_tag {
- my ($self, $name, $value, @slurp) = @_;
- my %attributes = _hashify(@slurp);
-
- $attributes{id} ||= $self->name_to_id($name);
- $attributes{type} ||= 'text';
-
- return $self->html_tag('input', undef, %attributes, name => $name, value => $value);
-}
-
-sub hidden_tag {
- my ($self, $name, $value, @slurp) = @_;
- return $self->input_tag($name, $value, _hashify(@slurp), type => 'hidden');
-}
-
-sub div_tag {
- my ($self, $content, @slurp) = @_;
- return $self->html_tag('div', $content, @slurp);
+ $::lxdebug->message(LXDebug::WARN(), "SL::Presenter has no method named '$method'!");
+ return;
+}
+
+sub name_to_id { return _call_presenter('name_to_id', @_); }
+sub html_tag { return _call_presenter('html_tag', @_); }
+sub hidden_tag { return _call_presenter('hidden_tag', @_); }
+sub select_tag { return _call_presenter('select_tag', @_); }
+sub checkbox_tag { return _call_presenter('checkbox_tag', @_); }
+sub input_tag { return _call_presenter('input_tag', @_); }
+sub javascript { return _call_presenter('javascript', @_); }
+sub truncate { return _call_presenter('truncate', @_); }
+sub simple_format { return _call_presenter('simple_format', @_); }
+sub button_tag { return _call_presenter('button_tag', @_); }
+sub submit_tag { return _call_presenter('submit_tag', @_); }
+sub ajax_submit_tag { return _call_presenter('ajax_submit_tag', @_); }
+sub link { return _call_presenter('link_tag', @_); }
+sub input_number_tag { return _call_presenter('input_number_tag', @_); }
+sub textarea_tag { return _call_presenter('textarea_tag', @_); }
+sub date_tag { return _call_presenter('date_tag', @_); }
+sub div_tag { return _call_presenter('div_tag', @_); }
+sub radio_button_tag { return _call_presenter('radio_button_tag', @_); }
+sub img_tag { return _call_presenter('img_tag', @_); }
+sub restricted_html { return _call_presenter('restricted_html', @_); }
+sub stripped_html { return _call_presenter('stripped_html', @_); }
+
+sub _set_id_attribute {
+ my ($attributes, $name, $unique) = @_;
+ SL::Presenter::Tag::_set_id_attribute($attributes, $name, $unique);