#####################################################################
# S P R E A D S H E E T F O R M A T D I S P L A Y #4
#
# written by JPDeni
#
# Written 13 Jul 2000
#####################################################################
#
# This is a non-autogenerated way to display search results in a
# spreadsheet format, with all fields in one table and each record in a row on the table.
#
# This is for use with a short/long display mod. This includes clickable links in the header that will resort the search results
# by the field. Clicking the same header a second time will sort the results in reverse order.
#####################################################################
#####################################################################
# Replace sub html_record with the following:
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
# This is the "short display" -- the list of records that are returned
# from a search.
my (%rec) = @_;
# create link to full display
$record_number = ((($nh - 1) * $db_max_hits) + $rec_count);
$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;
$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";
print qq|
$rec{'Field'} |
$rec{'Field'} |
$rec{'Field'} |
$rec{'Field'} | |;
# Add or remove columns as needed. Be sure you add the $long_url link to one of your fields
# <-- End of short display formatting -- >
}
#####################################################################
# In sub html_view_success, change
for (0 .. $numhits - 1) {
print "";
&html_record (&array_to_hash($_, @hits));
}
# to
$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'; }
}
# Note: In each of the header cells, replace # with the field number
# of the field that is associated with that header -- in both places
# within each line.
print qq|
";
#####################################################################
# In sub html_delete_form, change
for (0 .. $numhits - 1) {
%tmp = &array_to_hash($_, @hits);
print qq|\n|;
}
# to
$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'; }
}
# Note: In each of the header cells, replace # with the field number
# of the field that is associated with that header -- in both places
# within each line.
print qq|
";
#####################################################################
# In sub html_modify_form, change
for (0 .. $numhits - 1) {
%tmp = &array_to_hash($_, @hits);
print qq|\n|;
}
# to
$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'; }
}
# Note: In each of the header cells, replace # with the field number
# of the field that is associated with that header -- in both places
# within each line.
print qq|
";