3 SGN::Controller::Marker - controller for marker-related stuff
7 package SGN
::Controller
::Marker
;
9 use namespace
::autoclean
;
11 BEGIN { extends
'Catalyst::Controller' }
13 use File
::Spec
::Functions
;
18 =head2 view_rflp_image
20 Public path: /marker/<marker_id>/rflp_image/view
24 sub view_rflp_image
: Chained
('get_marker') PathPart
('rflp_image/view') :Args
(0) {
25 my ( $self, $c, ) = @_;
27 my $image_size = $c->req->query_parameters->{size
};
29 my $image_location = $self->rflp_image_link( $c, $c->stash->{marker
} )
30 or $c->throw_404( "RFLP image not found for SGN-M".$c->stash->{marker
}->marker_id );
33 template
=> '/markers/view_rflp.mas',
35 image_location
=> $image_location,
36 image_size
=> $image_size
43 Public path: /marker/SGN-M23545/details
45 Show the HTML detail page for this marker.
50 sub marker_details
: Chained
('get_marker') PathPart
('details') :Args
(0) {
51 my ( $self, $c ) = @_;
54 template
=> '/markers/index.mas',
62 Public path: /marker/SGN-M23545
64 Chaining base for fetching the marker indicated by the given marker
65 id. The marker ID is an SGN-M identifier.
70 sub get_marker
: Chained
('/') PathPart
('marker') :CaptureArgs
(1) {
71 my ( $self, $c, $marker_id ) = @_;
73 ($marker_id) = $marker_id =~ /^SGN-M(\d+)$/i
74 and $c->stash->{marker
} = CXGN
::Marker
->new( $c->dbc->dbh, $marker_id)
75 or $c->throw_404('No marker found with that ID');
77 $c->stash->{marker_id
} = $marker_id;
81 ############ helper methods ########
83 # Returns the stuff that goes in the 'href' attribute of the 'a' tag for
84 # an RFLP image, or undef if there is no image.
89 my ( $class, $c, $marker ) = @_;
90 my $marker_name = uc $marker->name_that_marker();
91 my ( $dir ) = $marker_name =~ /^(CD|CT|PC|PG|TG|PCD2)/
94 my $source = catfile
( $c->get_conf('image_path'), 'rflp', $dir, "$marker_name.jpg" );
96 return unless -f
$source;
98 return catfile
( $c->get_conf('static_datasets_url'), 'images','rflp', $dir, "$marker_name.jpg" );