4 use CXGN
::Scrap
::AjaxPage
;
8 my $doc = CXGN
::Scrap
::AjaxPage
->new();
9 $doc->send_http_header();
10 my ($stock_name, $locus_id, $type, $allele_id, $stock_id) = $doc->get_encoded_arguments("stock_name", "locus_id", "type", "allele_id" , "stock_id");
12 my $dbh = CXGN
::DB
::Connection
->new();
14 my($login_person_id, $login_user_type)=CXGN
::Login
->new($dbh)->verify_session();
16 if ($login_user_type eq 'curator' || $login_user_type eq 'submitter' || $login_user_type eq 'sequencer') {
18 if ($type eq 'browse') {
19 my $query = $dbh->prepare("SELECT stock_id, name, description FROM public.stock WHERE stock.name ilike ? ");
20 $query->execute("\%$stock_name\%");
22 while ( my ($stock_id, $name, $desc) = $query->fetchrow_array() ) {
23 $available_stocks .= "$stock_id*$name--$desc|";
25 print "$available_stocks";
27 #search from the allele page. Fiter only the existing individuals associated with $allele.
28 #obsolete individual-allele association
29 elsif ($type eq 'obsolete') {
31 my $query = "delete from phenome.stock_allele WHERE stock_id = ? AND allele_id = ? ";
32 my $sth= $dbh->prepare($query);
33 $sth->execute($stock_id, $allele_id);
36 warn "stock-allele obsoletion failed! " . $@
;