/[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 504 by dpavlin, Mon Nov 24 22:08:10 2008 UTC revision 509 by dpavlin, Tue Nov 25 01:00:16 2008 UTC
# Line 135  sub params_form { Line 135  sub params_form {
135                  } elsif ( $attr_type !~ m{^(Str|Int)$} ) {                  } elsif ( $attr_type !~ m{^(Str|Int)$} ) {
136                                  $value_html = qq|<textarea name="$name" title="$attr_type">$value</textarea>|;                                  $value_html = qq|<textarea name="$name" title="$attr_type">$value</textarea>|;
137                  }                  }
138                    
139                  $value = $attr->default( $name ) if ! $value && $attr->has_default;                  $value = $attr->default( $name ) if ! $value && $attr->has_default;
140                  $label_title = qq| title="| . $attr->documentation . qq|"| if $attr->has_documentation;                  $label_title = qq| title="| . $attr->documentation . qq|"| if $attr->has_documentation;
141    
142                  $default->{$name} = $value unless defined $default->{$name};                  $default->{$name} = $value unless defined $default->{$name};
143    
144                  $value_html = qq|<input type="$type" name="$name" title="$attr_type" value="$value">| unless $value_html;                  if ( ! $value_html ) {
145                            my $suffix = '';
146                            if ( $attr_type =~ m{^Bool$} ) {
147                                    $type = 'checkbox';
148                                    $suffix = ' checked' if $value;
149                            }
150                            $value_html = qq|<input type="$type" name="$name" title="$attr_type" value="$value"$suffix>|;
151                    }
152    
153  #               warn "# required $name ", $class->meta->get_attribute( $name )->dump( 2 );  #               warn "# required $name ", $class->meta->get_attribute( $name )->dump( 2 );
154                  $form .= qq|<label for="$name"$label_title>$label</label>| . $value_html;                  $form .= qq|<label for="$name"$label_title>$label</label>| . $value_html;
155          }          }
156          my $html = qq|<h1>$class params</h1><form method="post">$form<input type="submit" value="Run $class"></form>|;          my $html = qq|<h1>$class params</h1><form method="post">$form<input type="submit" value="Run $class"></form>|;
157          push @{ $self->status }, {          $self->add_status({
158                  $self->editor( $self->class ) => {                  $self->editor( $self->class ) => {
159                          params  => $self->params,                          params  => $self->params,
160                          config_params  => $config_params,                          config_params  => $config_params,
161                          default => $default                          default => $default
162                  },                  },
163          };          });
164    
165          return ($html,$default) if wantarray;          return ($html,$default) if wantarray;
166          return $html;          return $html;

Legend:
Removed from v.504  
changed lines
  Added in v.509

  ViewVC Help
Powered by ViewVC 1.1.26