modified seedlot upload from cross file
[sgn.git] / cgi-bin / search / family_search.pl
blobaa1501e84abbacbacabb329c6186ae01f2578e22
1 #!/usr/bin/perl
3 use strict;
5 use CXGN::Page;
6 use CXGN::Page::FormattingHelpers qw/
7 blue_section_html info_section_html
8 columnar_table_html page_title_html
9 /;
10 use CXGN::Search::CannedForms;
11 use CXGN::Searches::Family;
13 my $page = CXGN::Page->new("SGN Family Search Results", "Chris");
14 $page->header();
16 print page_title_html("Family Search Results");
18 my $search = CXGN::Searches::Family->new();
19 my $query = $search->new_query();
20 $search->page_size(20);
22 my %params = $page->get_all_encoded_arguments();
23 $query->from_request(\%params);
27 if(%params){
28 my $result = $search->do_search($query);
29 my @results;
30 while(my $r = $result->next_result()) {
31 push(@results, [map {$_}
33 "<a href=\"/search/family.pl?family_id=" . $r->[0] . "\">" . $r->[2] . "</a>", $r->[3], $r->[4], $r->[6], $r->[0], $r->[1] )] );
36 my $pagination_html = $search->pagination_buttons_html($query, $result);
38 my $results_html = '<div id="searchresults">';
40 $results_html .= columnar_table_html(headings => ['Family Number', 'Number of Members', 'I-Value', 'Build #', 'Family ID', 'Annotation'],
41 data => \@results, __alt_freq => 2);
43 $results_html .= "</div>\n$pagination_html\n";
45 if(@results) {
46 print blue_section_html('Results', , sprintf('<span class="paginate_summary">%s matches </span>', $result->total_results(), $result->time), $results_html);
48 else {
49 print '<span class=""><h4>No matches found</h4></span>';
51 print info_section_html(title => 'Search again', contents =>CXGN::Search::CannedForms::family_search_form($page, $query));
54 $page->footer();