1 package SGN
::Controller
::Folder
;
6 use SGN
::Model
::Cvterm
;
8 use CXGN
::Trial
::Folder
;
10 BEGIN { extends
'Catalyst::Controller'; }
14 isa
=> 'DBIx::Class::Schema',
18 shift->_app->dbic_schema( 'Bio::Chado::Schema', 'sgn_chado' )
21 sub folder_page
:Path
("/folder") Args
(1) {
24 my $folder_id = shift;
26 #print STDERR Dumper $folder_id;
28 my $folder_project = $self->schema->resultset("Project::Project")->find( { project_id
=> $folder_id } );
29 my $folder = CXGN
::Trial
::Folder
->new({ bcs_schema
=> $self->schema, folder_id
=> $folder_id });
31 my $children = $folder->children();
33 my $cross_type_id = SGN
::Model
::Cvterm
->get_cvterm_row($self->schema(), 'cross', 'stock_type')->cvterm_id();
34 foreach (@
$children) {
35 if ($_->folder_type eq 'cross') {
36 my $cross_stock = $self->schema->resultset("Project::Project")->search({ 'me.project_id' => $_->folder_id() })->search_related('nd_experiment_projects')->search_related('nd_experiment')->search_related('nd_experiment_stocks')->search_related('stock', {'stock.type_id'=>$cross_type_id})->first();
38 push @crosses, [$cross_stock->stock_id(), $cross_stock->uniquename()];
42 #print STDERR Dumper \@crosses;
44 $c->stash->{children
} = $children;
45 $c->stash->{crosses
} = \
@crosses;
46 $c->stash->{project_parent
} = $folder->project_parent();
47 $c->stash->{breeding_program
} = $folder->breeding_program();
48 $c->stash->{folder_id
} = $folder_id;
49 $c->stash->{folder_name
} = $folder_project->name();
50 $c->stash->{folder_for_trials
} = $folder->folder_for_trials();
51 $c->stash->{folder_for_crosses
} = $folder->folder_for_crosses();
52 $c->stash->{folder_description
} = $folder_project->description();
53 if (!$folder->breeding_program) {
54 $c->stash->{message
} = "The requested folder does not exist or has been deleted.";
55 $c->stash->{template
} = 'generic_message.mas';
58 $c->stash->{template
} = '/breeders_toolbox/folder/folder.mas';