Changeset 11 in text-formbuilder for trunk/lib/Text
- Timestamp:
- 10/22/04 10:10:54 (20 years ago)
- Location:
- trunk/lib/Text
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r7 r11 92 92 TYPE => 'STRING', 93 93 SOURCE => $self->_template, 94 DELIM ETERS => [ qw(<% %>) ],94 DELIMITERS => [ qw(<% %>) ], 95 95 }, 96 96 data => { 97 author => $self->{form_spec}{author}, 97 headings => $self->{form_spec}{headings}, 98 author => $self->{form_spec}{author}, 98 99 }, 99 100 }, … … 125 126 <style type="text/css"> 126 127 #author, #footer { font-style: italic; } 127 th { font-weight: normal; text-align: right; vertical-align: top; } 128 th { text-align: left; } 129 th h2 { padding: .125em .5em; background: #eee; } 130 th.label { font-weight: normal; text-align: right; vertical-align: top; } 128 131 </style> 129 132 </head> … … 135 138 <% $start %> 136 139 <table> 137 <% foreach (@fields) { 140 <% my $i; foreach(@fields) { 141 $OUT .= qq[ <tr><th colspan="2"><h2>$headings[$i]</h2></th></tr>\n] if $headings[$i]; 138 142 $OUT .= qq[ <tr>]; 139 $OUT .= '<th>' . ($$_{required} ? qq[<strong class="required">$$_{label}:</strong>] : "$$_{label}:") . '</th>'; 140 $OUT .= qq[<td>$$_{field} $$_{comment}</td></tr>\n] 143 $OUT .= '<th class="label">' . ($$_{required} ? qq[<strong class="required">$$_{label}:</strong>] : "$$_{label}:") . '</th>'; 144 $OUT .= qq[<td>$$_{field} $$_{comment}</td></tr>\n]; 145 $i++; 141 146 } %> 142 147 <tr><th></th><td style="padding-top: 1em;"><% $submit %></td></tr> -
trunk/lib/Text/FormBuilder/grammar
r10 r11 1 { my ($title, $author, %lists, %patterns, @fields, $type, @options, $list_var, $size, $rows, $cols); }1 { my ($title, $author, %lists, %patterns, @fields, @headings, $type, @options, $list_var, $size, $rows, $cols); } 2 2 3 3 form_spec: (list_def | line)(s) … … 8 8 lists => \%lists, 9 9 patterns => \%patterns, 10 headings => \@headings, 10 11 fields => \@fields, 11 12 } … … 29 30 list_name: /[A-Z_]+/ 30 31 31 line: <skip:'[ \t]*'> ( title | author | pattern_def | field | comment | blank ) "\n"32 line: <skip:'[ \t]*'> ( title | author | pattern_def | heading | field | comment | blank ) "\n" 32 33 33 34 title: '!title' /.*/ … … 43 44 pattern_name: /[A-Z_]+/ 44 45 pattern: /.*/ 46 47 heading: '!head' /.*/ 48 { warn "[Text::FormBuilder] Header before field " . scalar(@fields) . " redefined at input text line $thisline\n" if defined $headings[@fields]; 49 $headings[@fields] = $item[2] } 45 50 46 51 field: name field_size(?) label(?) hint(?) type(?) default(?) option_list(?) validate(?)
Note: See TracChangeset
for help on using the changeset viewer.