[Bio] / Sprout / CompileTemplate.pl Repository:
ViewVC logotype

Diff of /Sprout/CompileTemplate.pl

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

revision 1.2, Wed Feb 21 13:17:22 2007 UTC revision 1.3, Tue Nov 6 13:54:53 2007 UTC
# Line 12  Line 12 
12  style. The entire text will be in a C<pre> element with the  style. The entire text will be in a C<pre> element with the
13  C<codeNormal> style.  C<codeNormal> style.
14    
15  The templates use the notation C<[[%ask>I<n>C<:>I<prompt>]]> for most  The templates use the notation C<[[%ask>I<n>C<:>I<prompt>C<]]> for most
16  variables. In more complex templates, there are also flag prompts  variables. In more complex templates, there are also flag prompts
17  and if-constructs. This notation is designed to be compatible with  and if-constructs. This notation is designed to be compatible with
18  the Komodo template/snippet facility.  the Komodo template/snippet facility.
# Line 246  Line 246 
246          push @retVal, $line;          push @retVal, $line;
247      }      }
248      # Stop the table.      # Stop the table.
249      push @retVal, "</pre></td></tr></table>";      push @retVal, "</pre></td></tr>";
250      push @retVal, $cgi->end_table();      push @retVal, $cgi->end_table();
251      # Now comes the form. The form data is processed by the ProcessTemplate CGI script.      # Now comes the form. The form data is processed by the ProcessTemplate CGI script.
252      push @retVal, $cgi->h2("Code Generation Form");      push @retVal, $cgi->h2("Code Generation Form");
# Line 261  Line 261 
261      push @retVal, $cgi->start_table({ border => 2 });      push @retVal, $cgi->start_table({ border => 2 });
262      # We'll put all the flags in here. They are added at the end of the table.      # We'll put all the flags in here. They are added at the end of the table.
263      my @flagLines = ();      my @flagLines = ();
264        # This will be a list of the flag names. We put this list into a hidden field so we
265        # know which flag IDs are valid.
266        my @flagNames = ();
267      # Loop through the prompts.      # Loop through the prompts.
268      for my $promptKey (@promptKeys) {      for my $promptKey (@promptKeys) {
269          # Extract the prompt text.          # Extract the prompt text.
# Line 268  Line 271 
271          if ($promptKey =~ /flag/) {          if ($promptKey =~ /flag/) {
272              # Here we have a checkbox. It goes in the cell for flags.              # Here we have a checkbox. It goes in the cell for flags.
273              push @flagLines, $cgi->checkbox(-name => $promptKey, -value => 1, -label => $promptText);              push @flagLines, $cgi->checkbox(-name => $promptKey, -value => 1, -label => $promptText);
274                # Save its name.
275                push @flagNames, $promptKey;
276          } else {          } else {
277              # Here we have an input box. It goes in a table row.              # Here we have an input box. It goes in a table row.
278              push @retVal, $cgi->Tr($cgi->td([$promptText, $cgi->textfield(-name => $promptKey, -size => 40)]));              push @retVal, $cgi->Tr($cgi->td([$promptText, $cgi->textfield(-name => $promptKey, -size => 40)]));
# Line 277  Line 282 
282      if (@flagLines) {      if (@flagLines) {
283          push @retVal, $cgi->Tr($cgi->td(["Flags", join($cgi->br, @flagLines)]));          push @retVal, $cgi->Tr($cgi->td(["Flags", join($cgi->br, @flagLines)]));
284      }      }
285        # Put in the file title row.
286        push @retVal, $cgi->Tr($cgi->td(["File Title", $cgi->textfield(-name => "fileTitle", -size => 40)]));
287      # Now for the submit button.      # Now for the submit button.
288      push @retVal, $cgi->Tr( $cgi->td({-colspan => 2, -align => "center" },      push @retVal, $cgi->Tr( $cgi->td({-colspan => 2, -align => "center" },
289                              $cgi->submit(-name => 'submit', -value => 'GENERATE')));                              $cgi->submit(-name => 'submit', -value => 'GENERATE')));
290      # Close the table.      # Close the table.
291      push @retVal, $cgi->end_table();      push @retVal, $cgi->end_table();
292        # Put in a list of the flag names.
293        push @retVal, $cgi->hidden(-name => 'flagList', -value => join(",", @flagNames));
294      # Close the form.      # Close the form.
295      push @retVal, $cgi->end_form();      push @retVal, $cgi->end_form();
296      # Write the output web page.      # Write the output web page.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3