--- loncom/interface/lonsearchcat.pm 2002/07/03 20:10:14 1.135 +++ loncom/interface/lonsearchcat.pm 2002/07/05 18:56:52 1.136 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.135 2002/07/03 20:10:14 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.136 2002/07/05 18:56:52 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1107,13 +1107,32 @@ sub output_results { my $elapsetime=0; my $resultflag=0; my $tflag=1; - my $viewselect=$ENV{'form.viewselect'}; + ## + ## Set viewing function + ## + my $viewfunction = undef; + if ($ENV{'form.viewselect'} eq 'Detailed Citation View') { + $viewfunction = \&detailed_citation_view; + } elsif ($ENV{'form.viewselect'} eq 'Summary View') { + $viewfunction = \&summary_view; + } elsif ($ENV{'form.viewselect'} eq 'Fielded Format') { + $viewfunction = \&fielded_format_view; + } elsif ($ENV{'form.viewselect'} eq 'XML/SGML') { + $viewfunction = \&xml_sgml_view; + } + if (!defined($viewfunction)) { + $r->print("Internal Error - Bad view selected.\n"); + $r->rflush(); + return; + } # # make query information persistent to allow for subsequent revision my $persistent=&make_persistent(\%ENV); - # spit out the results header + # + # Begin producing output $r->print(&search_results_header($mode)); $r->rflush(); + # # begin showing the cataloged results my $action = "/adm/searchcat"; if ($mode eq 'Basic') { @@ -1134,7 +1153,6 @@ $persistent CATALOGCONTROLS # # make the pop-up window for status - # $r->print(&make_popwin(%rhash)); $r->rflush(); ## @@ -1211,7 +1229,8 @@ CATALOGCONTROLS } # end of if ($reply eq 'con_lost') else statement my %Fields = undef; # Holds the data to be sent to the various # *_view routines. - my ($extrashow,$customfields,$customhash) = &handle_custom_fields(\@results); + my ($extrashow,$customfields,$customhash) = + &handle_custom_fields(\@results); my @customfields = @$customfields; my %customhash = %$customhash; untie %hash if (keys %hash); @@ -1262,22 +1281,8 @@ END # $fnum++; } - if ($viewselect eq 'Detailed Citation View') { - $compiledresult.=&detailed_citation_view - (%Fields, hostname => $rkey ); - } - elsif ($viewselect eq 'Summary View') { - $compiledresult.=&summary_view - (%Fields, hostname => $rkey ); - } - elsif ($viewselect eq 'Fielded Format') { - $compiledresult.=&fielded_format_view - (%Fields, hostname => $rkey ); - } - elsif ($viewselect eq 'XML/SGML') { - $compiledresult.=&xml_sgml_view - (%Fields, hostname => $rkey ); - } + # Render the result into html + $compiledresult.= &$viewfunction(%Fields, hostname => $rkey ); if ($compiledresult or $servercount!=$servernum) { $compiledresult.="
"; } @@ -1288,7 +1293,6 @@ END $resultflag=1; $r->print($compiledresult); } - my $percent=sprintf('%3.0f',($servercount/$servernum*100)); } # End of foreach loop over servers remaining } # End of big loop - while($serversleft && $timeremain) unless ($resultflag) {