X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/14d5612bd71957448bb5a6325cb8650d84e7dd54..a56327d7da54b291ceb55af12e46757d3f8f05e4:/SL/Template/Plugin/L.pm diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 871e683bf..bac6f7f12 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -358,41 +358,23 @@ sub stylesheet_tag { return $code; } +my $date_tag_id_idx = 0; sub date_tag { my ($self, $name, $value, @slurp) = @_; + my %params = _hashify(@slurp); - my $name_e = _H($name); - my $seq = _tag_id(); - my $datefmt = apply { - s/d+/\%d/gi; - s/m+/\%m/gi; - s/y+/\%Y/gi; - } $::myconfig{"dateformat"}; - - my $cal_align = delete $params{cal_align} || 'BR'; - my $onchange = delete $params{onchange}; - my $str_value = blessed $value ? $value->to_lxoffice : $value; - - $self->input_tag($name, $str_value, - id => $name_e, + my $id = $self->name_to_id($name) . _tag_id(); + my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : (); + my @class = $params{no_cal} || $params{readonly} ? () : (class => 'datepicker'); + + return $self->input_tag( + $name, blessed($value) ? $value->to_lxoffice : $value, + id => $id, size => 11, - title => _H($::myconfig{dateformat}), - onBlur => 'check_right_date_format(this)', - ($onchange ? ( - onChange => $onchange, - ) : ()), + onblur => "check_right_date_format(this);", %params, - ) . ((!$params{no_cal} && !$params{readonly}) ? - $self->html_tag('img', undef, - src => 'image/calendar.png', - alt => $::locale->text('Calendar'), - id => "trigger$seq", - title => _H($::myconfig{dateformat}), - %params, - ) . - $self->javascript( - "Calendar.setup({ inputField: '$name_e', ifFormat: '$datefmt', align: '$cal_align', button: 'trigger$seq' });" - ) : ''); + @class, @onchange, + ); } sub customer_picker { @@ -829,13 +811,10 @@ If C<%attributes> contains a key C then the value is taken as a JQuery selector and clicking this checkbox will also toggle all checkboxes matching the selector. -=item C $align_code, %attributes> +=item C Creates a date input field, with an attached javascript that will open a -calendar on click. The javascript ist by default anchoered at the bottom right -sight. This can be overridden with C, see Calendar documentation for -the details, usually you'll want a two letter abbreviation of the alignment. -Right + Bottom becomes C. +calendar on click. =item C @@ -861,14 +840,6 @@ for each file name parameter passed. Each file name will be postfixed with '.css' if it isn't already and prefixed with 'css/' if it doesn't contain a slash. -=item C $align_code, %attributes> - -Creates a date input field, with an attached javascript that will open a -calendar on click. The javascript ist by default anchoered at the bottom right -sight. This can be overridden with C, see Calendar documentation for -the details, usually you'll want a two letter abbreviation of the alignment. -Right + Bottom becomes C. - =item C Will create a tabbed area. The tabs should be created with the helper function