6 use CXGN
::Page
::FormattingHelpers qw
/
12 use CXGN
::Search
::CannedForms
;
13 use CXGN
::DB
::Connection
;
15 use CXGN
::People
::Person
;
16 use CXGN
::Chado
::Publication
;
18 #################################################
20 # Start a new SGN page.
22 my $page = CXGN
::Page
->new( "SGN publcation search results", "Naama" );
24 $page->jsan_use("jquery");
25 $page->jsan_use("CXGN.Phenome.Publication");
29 print page_title_html
('SGN Publication search');
30 my $dbh = CXGN
::DB
::Connection
->new;
32 #create the search and query objects
33 my $search = CXGN
::Publication
->new;
34 my $query = $search->new_query;
36 $search->page_size(10); #set 10 phenetypes per page
38 my ( $login_person_id, $login_user_type ) =
39 CXGN
::Login
->new($dbh)->has_session();
42 my %params = $page->get_all_encoded_arguments;
44 #my $allele_keyword = $page->get_encoded_arguments("allele_keyword");
45 $query->from_request( \
%params );
48 $query->order_by( date_stored
=> 'desc', pyear
=> 'desc', title
=> '' );
49 my $result = $search->do_search($query); #execute the search
52 ###check if the the user has permission to alter pub_curator status
54 my $has_permission = 0;
55 if ( $login_user_type eq 'curator'
56 || $login_user_type eq 'submitter'
57 || $login_user_type eq 'sequencer' )
63 while ( my $r = $result->next_result ) {
65 my $publication = CXGN
::Chado
::Publication
->new( $dbh, $pub_id );
66 my $pub_ref = $publication->print_mini_ref();
69 #my $series = $r->[2];
71 my $assigned_to_id = $r->[4];
73 CXGN
::People
::Person
->new( $dbh, $assigned_to_id )->get_first_name();
74 my $curation_date = $r->[5];
75 my $curated_by_id = $r->[6];
77 my $stored_on = $r->[8];
78 $stored_on =~ s/(\d{4}-\d{2}-\d{2})(.*)/$1/;
80 my @stat_options = ( "curated", "pending", "irrelevant", "no gene" );
81 my $stat_options = qq|<option value
=""></option
>|;
82 foreach my $s (@stat_options) {
83 my $selected = qq|selected
="selected"| if $s eq $stat || '';
84 $stat_options .= qq|<option value
="$s" $selected >$s</option
>|;
88 qq|<select id
="pub_stat" onchange
="Publication.updatePubCuratorStat(this.value, $pub_id)">
93 my @curators = CXGN
::People
::Person
::get_curators
($dbh);
95 map { $_ => CXGN
::People
::Person
->new( $dbh, $_ )->get_first_name() }
97 my $curator_options = qq|<option value
=""></option
>|;
98 for my $curator_id ( keys %names ) {
99 my $curator = $names{$curator_id};
100 my $selected = qq|selected
="selected"| if $curator_id == $assigned_to_id || '';
102 qq|<option value
="$curator_id" $selected>$curator</option
>|;
104 my $curators = $assigned_to;
106 qq|<select id
="pub_curator_select" onchange
="Publication.updatePubCuratorAssigned(this.value, $pub_id)">
109 | if $has_permission;
111 my $pub = CXGN
::Chado
::Publication
->new( $dbh, $pub_id );
115 qq|<a href
="/publication/$pub_id/view">$pub_ref</a
>|,
116 $stats, $curators, $stored_on
121 #build the HTML to output
122 my $pagination_html = $search->pagination_buttons_html( $query, $result );
124 my $results_html = <<EOH;
125 <div id="searchresults">
128 $results_html .= columnar_table_html
(
129 headings
=> [ 'Title', 'Status', 'Assigned to', 'Stored' ],
137 $results_html .= <<EOH;
143 print blue_section_html
(
144 'Publication search results',
147 '<span class="paginate_summary">%s matches </span>',
148 $result->total_results, $result->time
154 print '<h4>No matches found</h4>';
157 print info_section_html
(
158 title
=> 'Search again',
160 CXGN
::Search
::CannedForms
::publication_search_form
( $page, $query )
165 print CXGN
::Search
::CannedForms
::publication_search_form
($page);