App-Mimosa
view release on metacpan or search on metacpan
lib/App/Mimosa/Controller/Root.pm view on Meta::CPAN
package App::Mimosa::Controller::Root;
use Moose;
use namespace::autoclean;
use autodie qw/:all/;
use App::Mimosa::Util qw/slurp/;
use File::Slurp qw/write_file/;
use File::Temp qw/tempfile/;
use IO::String;
use File::Spec::Functions;
use Storable 'freeze';
use Digest::SHA1 'sha1_hex';
use Path::Class;
use Bio::SearchIO;
use Bio::SearchIO::Writer::HTMLResultWriter;
use File::Spec::Functions;
use Bio::GMOD::Blast::Graph;
use App::Mimosa::Job;
use App::Mimosa::Database;
use Try::Tiny;
use DateTime;
use HTML::Entities;
use Digest::SHA1 qw/sha1_hex/;
#use Carp::Always;
use Cwd;
BEGIN { extends 'Catalyst::Controller' }
with 'Catalyst::Component::ApplicationAttribute';
#
# Sets the actions in this controller to be registered with no prefix
# so they function identically to actions created in MyApp.pm
#
__PACKAGE__->config(namespace => '');
=head1 NAME
App::Mimosa::Controller::Root - Mimosa Root Controller
=head1 DESCRIPTION
This is the root controller of Mimosa. It defines all the URL's which
Mimosa responds to.
=head1 METHODS
=head2 index
The root page (/)
=cut
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
$c->forward('login');
$c->forward('show_grid');
}
sub show_grid :Local {
my ($self, $c) = @_;
my @sets = $c->model('BCS')->resultset('Mimosa::SequenceSet')->all;
my @setinfo = map { [ $_->mimosa_sequence_set_id, $_->title ] } @sets;
$c->stash->{sequenceset_html} = join '',
map { "<option value='$_->[0]'> $_->[1] </option>" } @setinfo;
$c->stash->{sequence_data_dir} = $self->_app->config->{sequence_data_dir};
$c->stash->{template} = 'index.mason';
$c->stash->{schema} = $c->model('Model::BCS');
# currently, any logged-in user has admin rights
$c->stash->{admin} = 1 if $c->user_exists;
# Must encode HTML entities here to prevent XSS attack
$c->stash->{sequence_input} = encode_entities($c->req->param('sequence_input')) || '';
}
( run in 3.354 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )