I did this for someone a while back.
In sub html_view_success, change
Code:
for (0 .. $numhits - 1) {
print "<P>";
&html_record (&array_to_hash($_, @hits));
}
to
Code:
$new_url = $ENV{'QUERY_STRING'};
$new_url =~ s/\&sb=\d+//;
$new_url =~ s/\&so=\w+//;
for ($col=0; $col <=$#db_cols; ++$col) {
if ($in{'sb'} == $col) {
if ($in{'so'} eq 'descend') { $sb[$col] = 'ascend'; }
else { $so[$col] = 'descend'; }
}
else { $so[$col] = 'ascend'; }
}
print qq|
<TABLE><TR><TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD></TR>\n|;
for (0 .. $numhits - 1) {
print "<TR>";
&html_record (&array_to_hash($_, @hits));
print "</TR>\n";
}
print "</TABLE>";
Be sure to change
FieldName to the name of your field you want to display and the matching
#s to the number of that field. You can add as many fields as you want, just by following the pattern above.
Replace sub html_record with the following:
Code:
sub html_record {
my (%rec) = @_;
print qq|
<TD>$rec{FieldName'}</TD>
<TD>$rec{'FieldName'}</TD>
<TD>$rec{'FieldName'}</TD>
<TD>$rec{'FieldName'}</TD>
|;
}
If you're using one of the short/long display mods, the instructions are within the mod.
You'll also need to change sub html_delete_form and sub html_modify_form.
In sub html_delete_form, change
Code:
for (0 .. $numhits - 1) {
%tmp = &array_to_hash($_, @hits);
print qq|<TABLE BORDER=0><TR><TD><INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete">
</TD><TD>|;
&html_record (%tmp);
print qq|</TD></TR></TABLE>\n|;
}
to
Code:
$new_url = $ENV{'QUERY_STRING'};
$new_url =~ s/\&sb=\d+//;
$new_url =~ s/\&so=\w+//;
for ($col=0; $col <=$#db_cols; ++$col) {
if ($in{'sb'} == $col) {
if ($in{'so'} eq 'descend') { $sb[$col] = 'ascend'; }
else { $so[$col] = 'descend'; }
}
else { $so[$col] = 'ascend'; }
}
print qq|
<TABLE><TR><TD> </TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD></TR>\n|;
for (0 .. $numhits - 1) {
print "<TR>";
%tmp = &array_to_hash($_, @hits);
print qq|<TD><INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete"></TD>|;
&html_record (%tmp);
print "</TR>\n";
}
print "</TABLE>";
In sub html_modify_form, change
Code:
for (0 .. $numhits - 1) {
%tmp = &array_to_hash($_, @hits);
print qq|<TABLE BORDER=0><TR><TD><INPUT TYPE=RADIO NAME="modify" VALUE="$tmp{$db_key}">
</TD><TD>|;
&html_record (%tmp);
print qq|</TD></TR></TABLE>\n|;
}
to
Code:
$new_url = $ENV{'QUERY_STRING'};
$new_url =~ s/\&sb=\d+//;
$new_url =~ s/\&so=\w+//;
for ($col=0; $col <=$#db_cols; ++$col) {
if ($in{'sb'} == $col) {
if ($in{'so'} eq 'descend') { $sb[$col] = 'ascend'; }
else { $so[$col] = 'descend'; }
}
else { $so[$col] = 'ascend'; }
}
print qq|
<TABLE><TR><TD> </TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD>
<TD><a href="$db_script_url?$new_url&sb=#&so=$so[#]">FieldName</a></TD></TR>\n|;
for (0 .. $numhits - 1) {
print "<TR>";
%tmp = &array_to_hash($_, @hits);
print qq|<TD><INPUT TYPE=RADIO NAME="modify" VALUE="$tmp{$db_key}"></TD>|;
&html_record (%tmp);
print "</TR>\n";
}
print "</TABLE>";
If you're not using one of the short/long display mods, you'll also need to change sub html_add_success and sub html_modify_success.
In both subroutines, change
&html_record(&get_record($in{$db_key})); to
Code:
print qq|
<TABLE><TR><TD>FieldName</TD>
<TD>FieldName</TD>
<TD>FieldName</TD>
<TD>FieldName</TD></TR>\n
<TR>|;
&html_record(&get_record($in{$db_key}));
print "</TR></TABLE>";
JPD
http://www.jpdeni.com/dbman/