Changed styling of selected row. Added auto styling of SVG.
[scpubgit/stemmatology.git] / TreeOfTexts / lib / TreeOfTexts / Controller / Stemmagraph.pm
1 package TreeOfTexts::Controller::Stemmagraph;
2 use Moose;
3 use namespace::autoclean;
4 use Text::Tradition::Collation;
5 use Text::Tradition::Stemma;
6
7 BEGIN { 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
17 TreeOfTexts::Controller::Root - Root Controller for TreeOfTexts
18
19 =head1 DESCRIPTION
20
21 [enter your description here]
22
23 =head1 METHODS
24
25 sub 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
43 Standard 404 error page
44
45 =cut
46
47 sub default :Path {
48     my ( $self, $c ) = @_;
49     $c->response->body( 'Page not found' );
50     $c->response->status(404);
51 }
52
53 =head2 end
54
55 Attempt to render a view, if needed.
56
57 =cut
58
59 sub end : ActionClass('RenderView') {}
60
61 =head1 AUTHOR
62
63 Tara L Andrews
64
65 =head1 LICENSE
66
67 This library is free software. You can redistribute it and/or modify
68 it under the same terms as Perl itself.
69
70 =cut
71
72 __PACKAGE__->meta->make_immutable;
73
74 1;