%# In a five year period we can get one superb programming language.  Only
%# we can't control when the five year period will begin.

<& /RG/Elements/PageHeader &>
<form action="Parameter.html" name="thisform" method=post>

<table border="0" cellspacing="0" cellpadding="4" class="poptable" width="100%">
  <tr> 
    <td height="153"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <table border="0" cellspacing="1" cellpadding="2" width="100%">
              <tr> 
                <td class="tableTitle" width="80"><&|/l&>Parameter</&></td>
                <td class="tableTitle" width="100"><&|/l&>Current value</&></td>
                <td class="tableTitle" width="100"><&|/l&>Default value</&></td>
                <td class="tableTitle" width="100"><&|/l&>Description</&></td>
              </tr>
% my $cnt = 0;
% my @vars = grep { $ContentObj->VarObj($_)->IsUserDefined } $ContentObj->Vars;
% foreach my $cnt (0 .. 4) {
%     my $var = $vars[$cnt];
                <tr bgcolor="#FFFFFF"> 
                  <td width="80"> 
                      <input type="text" value="<% $var %>" name="Var-Name-<% $cnt %>" style="width:100%">
                  </td>
                  <td width="100"> 
                      <input type="text" value="<% $ContentObj->Var($var) %>" name="Var-Value-<% $cnt %>" style="width:100%">
                  </td>
                  <td width="100"> 
                      <input type="text" value="<% $ContentObj->VarDefault($var) %>" name="Var-Default-<% $cnt %>" style="width:100%">
                  </td>
                  <td width="100"> 
                      <input type="text" value="<% $ContentObj->VarDescription($var) %>" name="Var-Description-<% $cnt %>" style="width:100%">
                  </td>
                </tr>
% }
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td height="48" align="center">
        <input type="submit" name="Submit" value=" <&|/l&>Change</&> ">
        <input type="button" name="Cancel" onclick="window.close()" value=" <&|/l&>Cancel</&> ">
    </td>
  </tr>
</table>
</body>
</html>

<%INIT>
our $DB;
my $ReportObj = $DB->ReportObj($session{reportId});
my $ContentObj = DBIx::ReportBuilder->new(
    Handle	=> $ReportObj->HandleObj,
    SearchHook	=> $ReportObj->SearchHook,
    Content	=> $session{reportContent},
    Loc         => \&loc,
);

if ($Submit) {
    $ContentObj->RemoveVar($_) for $ContentObj->Vars;
    foreach my $cnt (0 .. 4) {
	my $name = $ARGS{"Var-Name-$cnt"};
	next unless defined($name) and $name =~ /^(?!_)\w+$/;

	my ($value, $default, $description) =
	    map $ARGS{"Var-$_-$cnt"}, qw(Value Default Description);
	$ContentObj->SetVar( $name => $value );
	$ContentObj->SetVar( $name => $value );
	$ContentObj->SetVarDefault( $name => $default );
	$ContentObj->SetVarDescription( $name => $description );
    }
    $session{reportContent} = $ContentObj->RenderXML;
    $m->print("<html><body><script><!--\nwindow.close();\n--></script></body></html>");
    return;
}

</%INIT>
<%ARGS>
$Submit	=> undef
</%ARGS>
