5 /stock/index.mas - a page for displaying stock details (e.g. accession, population, etc.)
15 The id of the stock in the database
19 L<Bio::Chado::Schema> object
23 the person logged into the system right now
31 Naama Menda <nm249@cornell.edu>
52 use Bio::Chado::Schema;
53 use CXGN::Sunshine::Browser;
54 use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html /;
57 # print message if stock_id is not valid
58 unless ( ( $stock_id =~ m /^\d+$/ ) || ($action eq 'new' && !$stock_id) ) {
59 $c->throw(is_error=>0,
60 message=>"No stock/accession exists for identifier $stock_id",
63 #my $stock = $schema->resultset("Stock::Stock")->create( {} ) if !$stock_id;
64 my ($stock) = $schema->resultset("Stock::Stock")->search( { stock_id => $stock_id} ) ;
66 my $person_id = $user->get_sp_person_id();
67 my $user_type = $user->get_user_type();
68 my $stockprop_cv = $schema->resultset("Cv::Cv")->search( {
69 'me.name' => 'stock_property'} );
70 # print message if the stock is obsolete
71 my ($obsolete_cvterm) = $stockprop_cv->search_related('cvterms',
72 { 'me.name' => 'obsolete' } );
75 $obsolete = $stock->search_related('stockprops' , {
76 type_id => $obsolete_cvterm->cvterm_id() }) if $obsolete_cvterm;
78 if ( $obsolete && $user_type ne 'curator' )
80 $c->throw(is_error=>0,
81 title => 'Obsolete stock',
82 message=>"Stock $stock_id is obsolete!",
83 developer_message => 'only curators can see obsolete stock',
84 notify => 0, #< does not send an error email
88 # print message if stock_id does not exist
90 if ( !$stock && $action ne 'new' && $action ne 'store' ) {
91 $c->throw(is_error=>0, message=>'No stock exists for this identifier',);
94 my $this_page = "/phenome/stock.pl?stock_id=$stock_id";
96 my ($organism) = $stock->search_related('organism');
97 my $species = $organism->species();
99 #my ($person_id_cvterm) = $stockprop_cv->search_related('cvterms' , { 'me.name'=>'sp_person_id' } );
101 #my @owners = $stock->search_related('stockprops', { type_id => $person_id_cvterm->cvterm_id() } );
103 #my $owner_objects= $locus->get_owners(1);
108 #if ( $stock && ($user_type eq 'curator' || $person_id && grep { $_ == $person_id } @owners ) ) { $owner = 1; }
109 #<& /stock/initialize.mas, stock_id=>$stock_id &>
112 <& /util/import_javascript.mas, classes => [ "jquery", "thickbox", "CXGN.Page.FormattingHelpers"] &>
116 <& /page/page_title.mas, title=> $stock->uniquename() . "\n" &>
119 <&| /page/info_section.mas, title=>"Stock details" , subtitle => "" &>
121 <& /page/form.mas, object_type=>'stock', object_id=>"$stock_id", form_name=> 'stock_form', server_side_script => '/phenome/stock/stock_ajax_form.pl', form_div_name=>'stock_details', js_object_name=> 'stockForm', page_url => '/phenome/stock.pl' &>
127 <&| /page/info_section.mas, title=>"Stock history", collapsible=>1, collapsed=>1 &>
128 <& /stock/history.mas, stock=>$stock &>
135 <& /page/comments.mas, object_type=>'stock', object_id=>$stock_id, referer=>$this_page &>