[Rt-commit] r7459 - in rt/branches/3.7-EXPERIMENTAL: html/Widgets/Form

ruz at bestpractical.com ruz at bestpractical.com
Wed Apr 4 17:53:08 EDT 2007


Author: ruz
Date: Wed Apr  4 17:53:07 2007
New Revision: 7459

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/Widgets/Form/Select

Log:
 r4892 at cubic-pc:  cubic | 2007-04-04 17:33:13 +0400
 * add InputOnly method


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	Wed Apr  4 17:53:07 2007
@@ -1,25 +1,51 @@
 <div id="form-box-<% lc $Name %>">
 % if ( $Description ) {
-<% $Description %>:
+<% $Description %>:\
 % }
+<& SELF:InputOnly, %ARGS &>
+</div>
+<%ARGS>
+$Name
+$Description      => undef,
+</%ARGS>
+
+<%METHOD InputOnly>
+<%ARGS>
+$Name
+$Description      => undef,
+
+ at Values           => (),
+$ValuesCallback   => undef,
+%ValuesLabel      => (),
+ at CurrentValue     => (),
+
+$Empty            => 1,
+ at EmptyValue       => (),
+$EmptyLabel       => loc('Use system default ([_1])', join ', ', @EmptyValue),
+
+$Alternative      => 0,
+$AlternativeLabel => loc('other...'),
+
+$Multiple         => 0,
+</%ARGS>
 <select name="<% $Name %>">
 
 % if ( $Empty ) {
 % my $selected = '';
-% $selected = 'selected' unless @CurrentValue;
-<option value="__empty_value__" <% $selected %>><% $EmptyLabel %></option>
+% $selected = 'selected="selected"' unless @CurrentValue;
+<option value="__empty_value__" <% $selected |n %>><% $EmptyLabel %></option>
 % }
 
 % foreach my $v( @Values ) {
 % my $selected = '';
-% $selected = 'selected' if delete $CurrentValue{ $v };
-<option value="<% $v %>" <% $selected %>><% $ValuesLabel{ $v } || $v %></option>
+% $selected = 'selected="selected"' if delete $CurrentValue{ $v };
+<option value="<% $v %>" <% $selected |n %>><% $ValuesLabel{ $v } || $v %></option>
 % }
 
 % if ( $Alternative ) {
 %     my $selected = '';
-%     $selected = 'selected' if keys %CurrentValue;
-<option value="__alternative_value__" <% $selected %>><% $AlternativeLabel %></option>
+%     $selected = 'selected="selected"' if keys %CurrentValue;
+<option value="__alternative_value__" <% $selected |n %>><% $AlternativeLabel %></option>
 % }
 
 </select>
@@ -42,24 +68,7 @@
     }
 }
 </%INIT>
-<%ARGS>
-$Name
-$Description      => undef,
-
- at Values           => (),
-$ValuesCallback   => undef,
-%ValuesLabel      => (),
- at CurrentValue     => (),
-
-$Empty            => 1,
- at EmptyValue       => (),
-$EmptyLabel       => loc('Use system default ([_1])', join ', ', @EmptyValue),
-
-$Alternative      => 0,
-$AlternativeLabel => loc('other...'),
-
-$Multiple         => 0,
-</%ARGS>
+</%METHOD>
 
 <%METHOD Process>
 <%ARGS>
@@ -78,11 +87,9 @@
 <%INIT>
 my $value = $Arguments->{ $Name };
 if( !defined $value || $value eq '__empty_value__' ) {
-    unless ( $Empty ) {
-        return [ @CurrentValue ] if $Multiple;
-        return $CurrentValue[0];
-    }
-    return undef;
+    return undef if $Empty;
+    return [ @CurrentValue ] if $Multiple;
+    return $CurrentValue[0];
 }
 $value = [$value] unless ref $value;
 


More information about the Rt-commit mailing list