Changed styling of selected row. Added auto styling of SVG.
[scpubgit/stemmatology.git] / TreeOfTexts / lib / TreeOfTexts / Controller / Stemmagraph.pm
CommitLineData
3f9bd252 1package TreeOfTexts::Controller::Stemmagraph;
2use Moose;
3use namespace::autoclean;
4use Text::Tradition::Collation;
5use Text::Tradition::Stemma;
6
7BEGIN { extends 'Catalyst::Controller' }
8
9#
10# Sets the actions in this controller to be registered with no prefix
11# so they function identically to actions created in MyApp.pm
12#
13__PACKAGE__->config(namespace => '');
14
15=head1 NAME
16
17TreeOfTexts::Controller::Root - Root Controller for TreeOfTexts
18
19=head1 DESCRIPTION
20
21[enter your description here]
22
23=head1 METHODS
24
3f9bd252 25sub get_graph :Local {
26 my( $self, $c ) = @_;
27 # If called interactively, we have params 'display', 'output', 'witnesses'
28 # If called non-interactively, we look at headers and content.
29 # The body is actually a File::Temp object; this is undocumented but
30 # so it seems to be.
31 my $dot_fh = $c->request->body;
32 my $format = 'svg';
33
34 # Render the dot in the given format.
35 my $collation = Text::Tradition::Collation->new();
36 my $stemma = Text::Tradition::Stemma->new( 'collation' => $collation, 'dot' => $dot_fh );
37 $c->stash->{result} = $stemma->as_svg;
38 $c->forward( "View::SVG" );
39}
40
41=head2 default
42
43Standard 404 error page
44
45=cut
46
47sub default :Path {
48 my ( $self, $c ) = @_;
49 $c->response->body( 'Page not found' );
50 $c->response->status(404);
51}
52
53=head2 end
54
55Attempt to render a view, if needed.
56
57=cut
58
59sub end : ActionClass('RenderView') {}
60
61=head1 AUTHOR
62
63Tara L Andrews
64
65=head1 LICENSE
66
67This library is free software. You can redistribute it and/or modify
68it under the same terms as Perl itself.
69
70=cut
71
72__PACKAGE__->meta->make_immutable;
73
741;