1 ######################################################################
2 # #### DEPRECATED CGIBIN CODE ########################################
4 # Search the image database and display the results.
6 ######################################################################
10 use CXGN
::Searches
::Images
;
12 use CXGN
::Page
::FormattingHelpers qw
/blue_section_html
17 use CXGN
::Search
::CannedForms
;
18 #################################################
20 # Start a new SGN page.
21 my $page=CXGN
::Page
->new("SGN image search results","Jessica");
24 print page_title_html
('Image search results');
26 #create the search and query objects
27 my $search = CXGN
::Searches
::Images
->new;
28 my $query = $search->new_query;
29 $search->page_size(30); #set 30 images per page
32 my %params = $page->get_all_encoded_arguments;
34 $query->from_request(\
%params);
37 my $result = $search->do_search($query);
40 while(my $r = $result->next_result) {
41 my $image_id = $r->[0];
43 my $image_description = $r->[2];
44 if( length($image_description) < 1 ) {
45 $image_description = "---";
48 my $image_filename = $r->[3];
49 my $submitter_id = $r->[4];
51 my $submitter_first = $r->[5];
52 if( length($submitter_first) < 1 ) {
53 $submitter_first = "---";
56 my $submitter_last = $r->[6];
57 if( length($submitter_last) < 1 ) {
58 $submitter_last = "---";
61 # Put all submitter data in one variable
62 my $submitter_string = "";
64 unless ( $submitter_first eq "---" ) {
65 $submitter_string .= $submitter_first;
66 $submitter_string .= " ";
69 unless ( $submitter_last eq "---" ) {
70 $submitter_string .= $submitter_last;
73 # Image id, image filename, and submitter id can't be null, but everything else can be.
75 push @results, [$image_description, '<a href="/image/index.pl?image_id='.$r->[0].'">'.$image_filename.'</a>', '<a href="/solpeople/personal-info.pl?sp_person_id='.$r->[4].'">'.$submitter_string.'</a>'];
78 #build the HTML to output
79 my $pagination_html = $search->pagination_buttons_html( $query, $result );
82 my $results_html = <<EOH;
83 <div id="searchresults">
86 $results_html .= columnar_table_html
(headings
=> ['Image Description',
88 'Submitter (ID) Name'],
92 $results_html .= <<EOH;
99 print blue_section_html
('Image search results', ,sprintf('<span class="paginate_summary">%s matches </span>', $result->total_results,$result->time),$results_html);
101 print '<h4>No matches found</h4>';
104 print info_section_html
(title
=> 'Search again',
105 contents
=>CXGN
::Search
::CannedForms
::image_search_form
($page,$query)