/[Frey]/trunk/lib/Frey/Action.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/Action.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 978 by dpavlin, Fri Jan 9 23:17:23 2009 UTC revision 1079 by dpavlin, Thu Jun 4 20:30:24 2009 UTC
# Line 142  sub params_form { Line 142  sub params_form {
142    
143                  my $max_value_len = 0;                  my $max_value_len = 0;
144                  my @values;                  my @values;
145                    my $display;
146                  my $html = '';                  my $html = '';
147    
148                  foreach ( @$values ) {                  foreach ( @$values ) {
149                          my $v = ref($_) eq 'HASH' ? $_->{$name} : $_;                          my $v = ref($_) eq 'HASH' ? $_->{$name} : $_;
150                            if ( $v =~ s/\t+(.+)$// ) {
151                                    $display->{$v} = $1;
152                            }
153                          warn "## value '$v'";                          warn "## value '$v'";
154                          push @values, $v;                          push @values, $v;
155                          $max_value_len = length($v) if length($v) > $max_value_len;                          $max_value_len = length($v) if length($v) > $max_value_len;
# Line 158  sub params_form { Line 162  sub params_form {
162                  if ( $#values > 3 && $render !~ m{radio} ) {                  if ( $#values > 3 && $render !~ m{radio} ) {
163                          my $options = join("\n",                          my $options = join("\n",
164                                  map {                                  map {
165                                          qq|<option value="$_">$_</option>|;                                          my $d = $display->{$_} || $_;
166                                            qq|<option value="$_">$d</option>|;
167                                  } @values                                  } @values
168                          );                          );
169                          # onchange="alert(this.options[this.selectedIndex].value);"                          # onchange="alert(this.options[this.selectedIndex].value);"
# Line 205  sub params_form { Line 210  sub params_form {
210    
211          my $label_width = 1; # minimum          my $label_width = 1; # minimum
212    
213    
214          foreach my $name (          foreach my $name (
215                  grep {                  grep {
216                          die "$_ doesn't have meta" unless $class->can('meta');                          die "$_ doesn't have meta" unless $class->can('meta');
# Line 234  sub params_form { Line 240  sub params_form {
240                          $default->{$name} = $params_config->[0]->{$name};                          $default->{$name} = $params_config->[0]->{$name};
241                  } elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) {                  } elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) {
242                          $value_html = select_values( $name, $attr_type, $attr->type_constraint->values );                          $value_html = select_values( $name, $attr_type, $attr->type_constraint->values );
243                    } elsif ( $class->can( $name . '_available' ) ) {
244                            my $available = eval $class . '->' . $name . '_available';
245                            confess $@ if $@;
246                            $available =~ s/^\s+//gs;
247                            $available =~ s/\s+$//gs;
248                            $value_html = select_values( $name, $attr_type, [ split(/\n/,$available) ]);
249                  } elsif ( $attr_type =~ m{^Bool} ) {                  } elsif ( $attr_type =~ m{^Bool} ) {
250                          my $suffix = '';                          my $suffix = '';
251                          $suffix = ' checked=1' if $value;                          $suffix = ' checked=1' if $value;

Legend:
Removed from v.978  
changed lines
  Added in v.1079

  ViewVC Help
Powered by ViewVC 1.1.26