6 Controller to show the web_page for target information using MASON.
15 This is a controller script to show the web_page using MASON
21 Aureliano Bombarely Gomez
30 use CXGN
::MasonFactory
;
33 use CXGN
::DB
::Connection
;
34 use CXGN
::DB
::DBICFactory
;
35 use CXGN
::GEM
::Schema
;
36 use CXGN
::GEM
::Target
;
38 ## Call the mason object
40 my $m = CXGN
::MasonFactory
->new();
43 ## Create the schema object for gem (and gem related searches)
45 my $psqlv = `psql --version`;
48 my @schema_list = ('gem','biosource','metadata','public');
49 if ($psqlv =~ /8\.1/) {
50 push @schema_list, 'tsearch2';
53 my $schema = CXGN
::DB
::DBICFactory
->open_schema( 'CXGN::GEM::Schema', search_path
=> \
@schema_list, );
56 ## Use of CXGN::Page to take the arguments from the URL
58 my %args = CXGN
::Page
->new()
59 ->get_all_encoded_arguments();
62 ## Create the target object (by default it will create an empty object)
64 my $target = CXGN
::GEM
::Target
->new($schema);
66 if (exists $args{'id'} && $args{'id'} =~ m/^\d+$/) {
67 $target = CXGN
::GEM
::Target
->new($schema, $args{'id'});
68 } elsif (exists $args{'name'}) {
69 $target = CXGN
::GEM
::Target
->new_by_name($schema, $args{'name'});
73 ## There are two ways to access to the page, using id=int or name=something. If use other combinations give an error message
75 if (defined $target->get_target_id or defined $target->get_target_name ) {
76 $m->exec('/gem/target_detail.mas',
80 $m->exec('/gem/gem_page_error.mas',