4 use CXGN
::Scrap
::AjaxPage
;
5 use CXGN
::DB
::Connection
;
6 use CXGN
::Phenome
::LocusDbxref
;
9 use CXGN
::People
::Person
;
12 my $dbh = CXGN
::DB
::Connection
->new();
13 my($login_person_id,$login_user_type)=CXGN
::Login
->new($dbh)->verify_session();
14 my $json = JSON
->new();
18 if ($login_user_type eq 'curator' || $login_user_type eq 'submitter' || $login_user_type eq 'sequencer') {
20 my $doc = CXGN
::Scrap
::AjaxPage
->new();
21 $doc->send_http_header();
22 my ($object_dbxref_id, $type, $action) = $doc->get_encoded_arguments("object_dbxref_id", "type", "action");
26 if ($type eq 'locus') {
27 my $locus_dbxref=CXGN
::Phenome
::LocusDbxref
->new($dbh, $object_dbxref_id);
28 if ($action eq 'unobsolete' ) {
29 $locus_dbxref->unobsolete();
30 }else { $locus_dbxref->obsolete(); }
31 my $locus_id = $locus_dbxref->get_locus_id();
32 $link = "http://solgenomics.net/phenome/locus_display.pl?locus_id=$locus_id";
33 }elsif ($type eq 'individual') {
34 my $individual_dbxref=CXGN
::Phenome
::Individual
::IndividualDbxref
->new($dbh, $object_dbxref_id);
35 if ($action eq 'unobsolete' ) { $individual_dbxref->unobsolete(); }
36 else { $individual_dbxref->obsolete(); }
38 my $individual_id = $individual_dbxref->get_individual_id();
39 $link = "http://solgenomics.net/phenome/individual.pl?individual_id=$individual_id";
43 warn "$action ontology term association failed! $@";
44 $error{error
} = "$action annotation for $type failed! $@";
47 $error{response
} = "$action annotation for $type worked!";
49 my $subject="[Ontology-$type association $action] ";
50 my $person= CXGN
::People
::Person
->new($dbh, $login_person_id);
51 my $user=$person->get_first_name()." ".$person->get_last_name();
52 my $user_link = qq |http
://solgenomics
.net
/solpeople/personal
-info
.pl?sp_person_id
=$login_person_id|;
54 my $fdbk_body="$user ($user_link) just $action ontology-$type association from phenome. $type - dbxref\n
55 id=$object_dbxref_id \n $link";
56 CXGN
::Contact
::send_email
($subject,$fdbk_body, 'sgn-db-curation@sgn.cornell.edu');
60 $error{error
} = "User type $login_user_type does not have permissions to obsolete ! ";
63 my $jobj = $json->encode(\
%error);