[Rt-commit] r5008 - in rt/branches/3.7-EXPERIMENTAL:
html/Widgets/Form
ruz at bestpractical.com
ruz at bestpractical.com
Tue Apr 11 05:04:41 EDT 2006
Author: ruz
Date: Tue Apr 11 05:04:40 2006
New Revision: 5008
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Widgets/Form/Select
Log:
r2374 at cubic-pc: cubic | 2006-04-11 04:23:43 +0400
* 'Select-' name prefix makes this component less generic
** add NamePrefix
*** TODO: drop it and check all users of this component
Modified: rt/branches/3.7-EXPERIMENTAL/html/Widgets/Form/Select
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Widgets/Form/Select (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Widgets/Form/Select Tue Apr 11 05:04:40 2006
@@ -1,6 +1,8 @@
<div id="form-box-<% lc $Name %>">
+% if ( $Description ) {
<% $Description %>:
-<select name="Select-<% $Name %>">
+% }
+<select name="<% $NamePrefix %><% $Name %>">
% if ( $Empty ) {
% my $selected = '';
@@ -22,13 +24,14 @@
</select>
% if ( $Alternative ) {
-<input type="text" class="alternative" name="Select-Alternative-<% $Name %>" value="<% join ', ', @CurrentValue %>" />
+<input type="text" class="alternative" name="<% $NamePrefix %>Alternative-<% $Name %>" value="<% join ', ', @CurrentValue %>" />
% }
</div>
<%INIT>
my %CurrentValue = map {$_ => 1} grep defined, @CurrentValue;
</%INIT>
<%ARGS>
+$NamePrefix => 'Select-',
$Name => '',
$Description => undef,
@@ -50,6 +53,7 @@
<%ARGS>
$Arguments => {},
+$NamePrefix => 'Select-',
$Name => undef,
@Values => (),
@@ -61,7 +65,7 @@
$Multiple => 0,
</%ARGS>
<%INIT>
-my $value = $Arguments->{ "Select-$Name" };
+my $value = $Arguments->{ $NamePrefix . $Name };
if( !defined $value || $value eq '__empty_value__' ) {
return [ @CurrentValue ] unless $Empty;
return undef;
@@ -69,7 +73,7 @@
$value = [$value] unless ref $value;
if ( $Alternative ) {
- my $alt = $Arguments->{ "Select-Alternative-$Name" };
+ my $alt = $Arguments->{ $NamePrefix ."Alternative-". $Name };
if( $Multiple ) {
push @$value, split /\s*,\s*/, $alt;
} else {
More information about the Rt-commit
mailing list