From: Moritz Bunkus Date: Mon, 27 Dec 2010 12:57:56 +0000 (+0100) Subject: Layout-Helfer für multiselect2side X-Git-Tag: release-2.6.2beta1~64^2~19 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=04854ac27e2b18b2d5a15089c69ed5b79c495a2b;p=kivitendo-erp.git Layout-Helfer für multiselect2side --- diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 844c88dd2..9aead0113 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -377,6 +377,26 @@ sub areainput_tag { : $self->input_tag($name, $value, %attributes); } +sub multiselect2side { + my ($self, $id, @slurp) = @_; + my %params = _hashify(@slurp); + + $params{labelsx} = "\"" . _J($params{labelsx} || $::locale->text('Available')) . "\""; + $params{labeldx} = "\"" . _J($params{labeldx} || $::locale->text('Selected')) . "\""; + $params{moveOptions} = 'false'; + + my $vars = join(', ', map { "${_}: " . $params{$_} } keys %params); + my $code = < + \$().ready(function() { + \$('#${id}').multiselect2side({ ${vars} }); + }); + +EOCODE + + return $code; +} + 1; __END__ @@ -545,6 +565,27 @@ include C for rendering a minimum of rows if a textarea is displayed. You can force input by setting rows to 1, and you can force textarea by setting rows to anything >1. +=item C + +Creates a JavaScript snippet calling the jQuery function +C on the select control with the ID C<$id>. The +select itself is not created. C<%params> can contain the following +entries: + +=over 2 + +=item C + +The label of the list of available options. Defaults to the +translation of 'Available'. + +=item C + +The label of the list of selected options. Defaults to the +translation of 'Selected'. + +=back + =back =head2 CONVERSION FUNCTIONS