6 Controller for experimental design mason components
12 This is the script to show the web_page using MASON
18 Aureliano Bombarely Gomez
30 use CXGN
::MasonFactory
;
31 use CXGN
::DB
::Connection
;
32 use CXGN
::DB
::DBICFactory
;
33 use CXGN
::GEM
::Schema
;
34 use CXGN
::GEM
::ExperimentalDesign
;
36 my $m = CXGN
::MasonFactory
->new();
38 ## Use of CXGN::Page to take the arguments from the URL
40 my %args = CXGN
::Page
->new()
41 ->get_all_encoded_arguments();
44 ## Create the schema used for all the gem searches
46 my $psqlv = `psql --version`;
49 my @schema_list = ('gem', 'biosource', 'metadata', 'public');
50 if ($psqlv =~ /8\.1/) {
51 push @schema_list, 'tsearch2';
54 my $schema = CXGN
::DB
::DBICFactory
->open_schema( 'CXGN::GEM::Schema', search_path
=> \
@schema_list, );
57 my $expdesign = CXGN
::GEM
::ExperimentalDesign
->new($schema);
58 if (exists $args{'id'} && $args{'id'} =~ m/^\d+$/) {
59 $expdesign = CXGN
::GEM
::ExperimentalDesign
->new($schema, $args{'id'});
60 } elsif (exists $args{'name'}) {
61 $expdesign = CXGN
::GEM
::ExperimentalDesign
->new_by_name($schema, $args{'name'});
65 if (defined $expdesign->get_experimental_design_id() ) {
66 @exp_list = $expdesign->get_experiment_list();
70 if (defined $expdesign->get_experimental_design_id()) {
71 @pubs = $expdesign->get_publication_list();
75 ## There are two ways to access to the page, using id=int or name=something. If use other combinations give an error message
77 if (defined $expdesign->get_experimental_design_id or defined $expdesign->get_experimental_design_name ) {
78 $m->exec('/gem/experimental_design_detail.mas',
80 expdesign
=> $expdesign,
82 exp_list
=> \
@exp_list );
84 $m->exec('/gem/gem_page_error.mas',
86 object
=> $expdesign );