3 |
3 |
use strict;
|
4 |
4 |
|
5 |
5 |
use SL::HTML::Restrict;
|
|
6 |
use SL::Locale::String qw(t8);
|
6 |
7 |
use SL::Presenter::EscapedText qw(escape);
|
7 |
8 |
use Scalar::Util qw(blessed);
|
8 |
9 |
|
... | ... | |
11 |
12 |
html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag
|
12 |
13 |
checkbox_tag button_tag submit_tag ajax_submit_tag input_number_tag
|
13 |
14 |
stringify_attributes textarea_tag link_tag date_tag
|
14 |
|
div_tag radio_button_tag img_tag multi_level_select_tag input_tag_trim);
|
|
15 |
div_tag radio_button_tag img_tag multi_level_select_tag input_tag_trim
|
|
16 |
input_email_tag);
|
15 |
17 |
our %EXPORT_TAGS = (ALL => \@EXPORT_OK);
|
16 |
18 |
|
17 |
19 |
use Carp;
|
... | ... | |
509 |
511 |
);
|
510 |
512 |
}
|
511 |
513 |
|
|
514 |
sub input_email_tag {
|
|
515 |
my ($name, $value, %params) = @_;
|
|
516 |
|
|
517 |
my $show_icon = $value || delete($params{show_icon_always});
|
|
518 |
|
|
519 |
# _set_id_attribute removes the no_id param
|
|
520 |
my $no_id_wanted = $params{no_id};
|
|
521 |
_set_id_attribute(\%params, $name);
|
|
522 |
$params{no_id} = $no_id_wanted;
|
|
523 |
|
|
524 |
my $html = input_tag_trim($name, $value, %params);
|
|
525 |
|
|
526 |
my $link_id = $params{id} ? $params{id} . '_link' : undef;
|
|
527 |
$html .= link_tag(escape('mailto:' . $value),
|
|
528 |
img_tag(src => 'image/mail.png', alt => t8('Send email'), border => 0),
|
|
529 |
(id => $link_id)x!!$link_id,
|
|
530 |
(style => 'display:none')x!$show_icon);
|
|
531 |
|
|
532 |
return '<span>' . $html . '</span>';
|
|
533 |
}
|
512 |
534 |
|
513 |
535 |
sub javascript {
|
514 |
536 |
my ($data) = @_;
|
... | ... | |
674 |
696 |
$attributes{'data-validate'} and loads C<js/kivi.Validator.js>. This will trim
|
675 |
697 |
the whitespaces around the input.
|
676 |
698 |
|
|
699 |
=item C<input_email_tag $name, $value, %params>
|
|
700 |
|
|
701 |
This creates an C<input_tag_trim> and a C<link_tag> with an C<img_tag> for an
|
|
702 |
email icon. The link opens a 'mailto:' url with the value of the C<input_tag>.
|
|
703 |
The style of the C<link_tag> is set to 'display:none' if there is no value or
|
|
704 |
if the param C<show_icon_always> is truish.
|
|
705 |
All but the C<show_icon_always> params are forwared to the C<input_tag_trim>
|
|
706 |
as attributes.
|
|
707 |
This tag does not offer any javascript magic. The input value is only
|
|
708 |
evaluated when the tag is created.
|
|
709 |
The 'id' attrubute of the C<link_tag> is set to the 'id' of the C<input_tag>
|
|
710 |
with the string '_link' appended. This can be used to show/hide set the
|
|
711 |
C<link_tag> or set the link target dynamically.
|
|
712 |
|
677 |
713 |
=item C<submit_tag $name, $value, %attributes>
|
678 |
714 |
|
679 |
715 |
Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
|
S:P:Tag: input_email_tag mit einem Icon und Link via "mailto:"