- Timestamp:
- 10/22/04 16:37:16 (20 years ago)
- Location:
- trunk/lib/Text
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r12 r14 87 87 } 88 88 89 ## #TODO: option switch for this 90 ## #TODO: goes with CGI::FormBuilder 2.13 91 ## foreach (@{ $self->{form_spec}{fields} }) { 92 ## $$_{ulist} = 1 if $$_{type} and $$_{type} =~ /checkbox|radio/ and @{ $$_{options} } >= 3; 93 ## } 89 foreach (@{ $self->{form_spec}{fields} }) { 90 $$_{ulist} = 1 if defined $$_{options} and @{ $$_{options} } >= 3; 91 } 94 92 95 93 $self->{form} = CGI::FormBuilder->new( … … 107 105 }, 108 106 data => { 109 headings => $self->{form_spec}{headings}, 110 author => $self->{form_spec}{author}, 107 headings => $self->{form_spec}{headings}, 108 author => $self->{form_spec}{author}, 109 description => $self->{form_spec}{description}, 111 110 }, 112 111 }, … … 138 137 my $title = $self->{form_spec}{title} || ''; 139 138 my $author = $self->{form_spec}{author} || ''; 139 my $description = $self->{form_spec}{description} || ''; 140 140 my $headings = Data::Dumper->Dump([$self->{form_spec}{headings}],['headings']); 141 141 my $fields = Data::Dumper->Dump([ [ map { $$_{name} } @{ $self->{form_spec}{fields} } ] ],['fields']); … … 176 176 headings => $headings, 177 177 author => q[$author], 178 description => q[$description], 178 179 }, 179 180 }, … … 229 230 th h2 { padding: .125em .5em; background: #eee; } 230 231 th.label { font-weight: normal; text-align: right; vertical-align: top; } 232 td ul { list-style: none; padding-left: 0; margin-left: 0; } 231 233 </style> 232 234 </head> … … 235 237 <h1><% $title %></h1> 236 238 <% $author ? qq[<p id="author">Created by $author</p>] : '' %> 239 <% $description ? qq[<p id="description">$description</p>] : '' %> 237 240 ] . $self->_form_template . q[ 238 241 <hr /> -
trunk/lib/Text/FormBuilder/grammar
r11 r14 1 { my ($title, $author, %lists, %patterns, @fields, @headings, $type, @options, $list_var, $size, $rows, $cols); }1 { my ($title, $author, $description, %lists, %patterns, @fields, @headings, $type, @options, $list_var, $size, $rows, $cols); } 2 2 3 form_spec: (list_def | line)(s)3 form_spec: (list_def | description_def | line)(s) 4 4 { 5 5 $return = { 6 6 title => $title, 7 7 author => $author, 8 description => $description, 8 9 lists => \%lists, 9 10 patterns => \%patterns, … … 29 30 30 31 list_name: /[A-Z_]+/ 32 33 description_def: '!description' <perl_codeblock> 34 { warn "[Text::FormBuilder] Description redefined at input text line $thisline\n" if defined $description; 35 36 $description = $item[2]; 37 $description =~ s/^{\s*|\s*}$//g; 38 } 31 39 32 40 line: <skip:'[ \t]*'> ( title | author | pattern_def | heading | field | comment | blank ) "\n"
Note: See TracChangeset
for help on using the changeset viewer.