blib/lib/QBit/WebInterface/Controller/Multistate.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 43 CC 4 SCAR 26.4
CC
4
Cov
0%
graph
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 14.0
1 package QBit::WebInterface::Controller::Multistate;
2 $QBit::WebInterface::Controller::Multistate::VERSION = '0.004';
3 use qbit;
4  
5 use base qw(QBit::WebInterface::Controller);
6  
7 __PACKAGE__->register_rights(
8 [
9 {
10 name => 'multistate_controller',
11 description => d_gettext('Project multistates actions'),
12 rights => {multistate_graph_view => d_gettext('Right to view multistate graph'),},
13 }
14 ]
15 );
16  
17 sub graph : CMD : DEFAULT {
18 my ($self) = @_;
19  
20 return $self->denied() unless $self->check_rights('multistate_graph_view');
21  
22 my $models = $self->app->get_models();
23  
24 my @accessors;
25 while (my ($accessor, $package) = each(%$models)) {
26 push(@accessors, $accessor) if $package->isa('QBit::Application::Model::Multistate');
27 }
28  
29 my $graph_svg = '';
30 my $accessor = $self->request->param('accessor');
31 if ( defined($accessor)
32 && $self->app->can($accessor)
33 && $self->app->$accessor->isa('QBit::Application::Model::Multistate'))
34 {
35 $graph_svg =
36 $self->app->$accessor->get_multistates_graph(private_names => $self->request->param('private_names'))
37 ->as_svg();
38 $graph_svg =~ s/^.+?<svg/<svg style="max-width: 100%;" onclick="this.style.maxWidth=''"/s;
39 }
40  
41 return $self->from_template('multistate/graph.tt2', vars => {accessors => \@accessors, graph_svg => $graph_svg});
42 }
43  
44 TRUE;
45  
46 __END__