Revision da2fecb4
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Template/Plugin/L.pm | ||
---|---|---|
69 | 69 |
sub truncate { return _call_presenter('truncate', @_); } |
70 | 70 |
sub simple_format { return _call_presenter('simple_format', @_); } |
71 | 71 |
|
72 |
sub _set_id_attribute { |
|
73 |
my ($attributes, $name) = @_; |
|
74 |
SL::Presenter::Tag::_set_id_attribute($attributes, $name); |
|
75 |
} |
|
76 |
|
|
72 | 77 |
sub img_tag { |
73 | 78 |
my ($self, @slurp) = @_; |
74 | 79 |
my %options = _hashify(@slurp); |
... | ... | |
82 | 87 |
my ($self, $name, $content, @slurp) = @_; |
83 | 88 |
my %attributes = _hashify(@slurp); |
84 | 89 |
|
85 |
$attributes{id} ||= $self->name_to_id($name);
|
|
90 |
_set_id_attribute(\%attributes, $name);
|
|
86 | 91 |
$attributes{rows} *= 1; # required by standard |
87 | 92 |
$attributes{cols} *= 1; # required by standard |
88 | 93 |
$content = $content ? _H($content) : ''; |
... | ... | |
94 | 99 |
my ($self, $name, @slurp) = @_; |
95 | 100 |
my %attributes = _hashify(@slurp); |
96 | 101 |
|
97 |
$attributes{id} ||= $self->name_to_id($name);
|
|
102 |
_set_id_attribute(\%attributes, $name);
|
|
98 | 103 |
$attributes{value} = 1 unless defined $attributes{value}; |
99 | 104 |
my $label = delete $attributes{label}; |
100 | 105 |
my $checkall = delete $attributes{checkall}; |
... | ... | |
117 | 122 |
my $name = shift; |
118 | 123 |
my %attributes = _hashify(@_); |
119 | 124 |
|
125 |
_set_id_attribute(\%attributes, $name); |
|
120 | 126 |
$attributes{value} = 1 unless defined $attributes{value}; |
121 |
$attributes{id} ||= $self->name_to_id($name . "_" . $attributes{value}); |
|
122 | 127 |
my $label = delete $attributes{label}; |
123 | 128 |
|
124 | 129 |
if ($attributes{checked}) { |
... | ... | |
177 | 182 |
my ($self, $onclick, $value, @slurp) = @_; |
178 | 183 |
my %attributes = _hashify(@slurp); |
179 | 184 |
|
180 |
$attributes{id} ||= $self->name_to_id($attributes{name}) if $attributes{name};
|
|
185 |
_set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
|
|
181 | 186 |
$attributes{type} ||= 'button'; |
182 | 187 |
|
183 | 188 |
$onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm}; |
... | ... | |
226 | 231 |
my ($self, $name, $value, @slurp) = @_; |
227 | 232 |
|
228 | 233 |
my %params = _hashify(@slurp); |
229 |
my $id = $self->name_to_id($name) . _tag_id();
|
|
234 |
_set_id_attribute(\%params, $name);
|
|
230 | 235 |
my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : (); |
231 | 236 |
my @class = $params{no_cal} || $params{readonly} ? () : (class => 'datepicker'); |
232 | 237 |
|
233 | 238 |
return $self->input_tag( |
234 | 239 |
$name, blessed($value) ? $value->to_lxoffice : $value, |
235 |
id => $id, |
|
236 | 240 |
size => 11, |
237 | 241 |
onblur => "check_right_date_format(this);", |
238 | 242 |
%params, |
... | ... | |
531 | 535 |
A module modeled a bit after Rails' ActionView helpers. Several small |
532 | 536 |
functions that create HTML tags from various kinds of data sources. |
533 | 537 |
|
538 |
The C<id> attribute is usually calculated automatically. This can be |
|
539 |
overridden by either specifying an C<id> attribute or by setting |
|
540 |
C<no_id> to trueish. |
|
541 |
|
|
534 | 542 |
=head1 FUNCTIONS |
535 | 543 |
|
536 | 544 |
=head2 LOW-LEVEL FUNCTIONS |
Auch abrufbar als: Unified diff
L-Plugin und Presenter: Erzeugung "ID"-Attribute mittels "no_id => 1" unterdrückbar