+ my ($class, $context, @args) = @_;
+
+ return bless {
+ CONTEXT => $context,
+ }, $class;
+}
+
+sub _context {
+ die 'not an accessor' if @_ > 1;
+ return $_[0]->{CONTEXT};
+}
+
+sub _call_presenter {
+ my ($method, $self, @args) = @_;
+
+ my $presenter = $::request->presenter;
+
+ splice @args, -1, 1, %{ $args[-1] } if @args && (ref($args[-1]) eq 'HASH');
+
+ if (my $sub = SL::Presenter::Simple->can($method)) {
+ return $sub->(@args);
+ }
+
+ if ($presenter->can($method)) {
+ return $presenter->$method(@args);
+ }
+
+ $::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 _set_id_attribute {
+ my ($attributes, $name, $unique) = @_;
+ SL::Presenter::Tag::_set_id_attribute($attributes, $name, $unique);
+}
+
+sub img_tag {
+ my ($self, %options) = _hashify(1, @_);
+
+ $options{alt} ||= '';
+
+ return $self->html_tag('img', undef, %options);
+}
+
+sub radio_button_tag {
+ my ($self, $name, %attributes) = _hashify(2, @_);
+
+ $attributes{value} = 1 unless exists $attributes{value};
+
+ _set_id_attribute(\%attributes, $name, 1);
+ my $label = delete $attributes{label};
+
+ _set_id_attribute(\%attributes, $name . '_' . $attributes{value});
+
+ 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 div_tag {
+ my ($self, $content, @slurp) = @_;
+ return $self->html_tag('div', $content, @slurp);
+}
+
+sub ul_tag {
+ my ($self, $content, @slurp) = @_;
+ return $self->html_tag('ul', $content, @slurp);
+}
+
+sub li_tag {
+ my ($self, $content, @slurp) = @_;
+ return $self->html_tag('li', $content, @slurp);
+}
+
+sub yes_no_tag {
+ my ($self, $name, $value, %attributes) = _hashify(3, @_);
+
+ return $self->select_tag($name, [ [ 1 => $::locale->text('Yes') ], [ 0 => $::locale->text('No') ] ], default => $value ? 1 : 0, %attributes);
+}