| 1 | package Strehler::Admin; | ||||||||||||||||||||||||||||||||
| 2 | 12 | $Strehler::Admin::VERSION = '1.6.8'; | |||||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 12 | ▶ | use Cwd 'abs_path'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 12 | ▶ | use Dancer2 0.166001; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 12 | ▶ | use Dancer2::Plugin::DBIC; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use Dancer2::Plugin::Ajax; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 12 | ▶ | use Dancer2::Serializer::JSON; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 12 | ▶ | use Strehler::Dancer2::Plugin::Admin; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 12 | ▶ | use HTML::FormFu 1.00; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 12 | ▶ | use HTML::FormFu::Element::Block; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 12 | ▶ | use Authen::Passphrase::BlowfishCrypt; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 12 | ▶ | use Time::localtime; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | 12 | ▶ | use Strehler::Helpers; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 12 | ▶ | use Strehler::Forms; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 12 | ▶ | use Strehler::Meta::Tag; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | use Strehler::Element::Image; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | 12 | ▶ | use Strehler::Element::Article; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | 12 | ▶ | use Strehler::Element::User; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 20 | 12 | ▶ | use Strehler::Element::Log; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 21 | 12 | ▶ | use Strehler::Meta::Category; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 22 | 12 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | 12 | my @languages; | |||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 12 | ▶ | if(config->{Strehler}->{languages}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||||||
| 28 | 12 | @languages = @{config->{Strehler}->{languages}}; | |||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||
| 30 | else | ||||||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||||
| 32 | 0 | @languages = ('en'); | |||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 35 | 12 | my $module_file_path = __FILE__; | |||||||||||||||||||||||||||||||
| 36 | 12 | my $root_path = abs_path($module_file_path); | |||||||||||||||||||||||||||||||
| 37 | 12 | $root_path =~ s/Admin\.pm//; | |||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | 12 | my $forms_path = $root_path . 'forms'; | |||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 12 | set views => $root_path . 'views'; | |||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | ##### Homepage ##### | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | get '/' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||
| 46 | 1 | my $redir = redirect(dancer_app->prefix); | |||||||||||||||||||||||||||||||
| 47 | 0 | return $redir; | |||||||||||||||||||||||||||||||
| 48 | 12 | }; | |||||||||||||||||||||||||||||||
| 49 | 5 | ▶ | get '' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.7
| |||||||||||||||||||||||||||||||||
| 50 | 5 | ▶ | if(config->{'Strehler'}->{'dashboard_active'} && config->{'Strehler'}->{'dashboard_active'} == 1) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
config()->{"Strehler"}{"dashboard_active"} and config()->{"Strehler"}{"dashboard_active"} == 1
MC/DC0%0/2
config()->{"Strehler"}{"dashboard_active"} and config()->{"Strehler"}{"dashboard_active"} == 1
config()->{"Strehler"}{"dashboard_active"}
config()->{"Strehler"}{"dashboard_active"} == 1
Truth table33%1/3
A and B
A= config()->{"Strehler"}{"dashboard_active"}B= config()->{"Strehler"}{"dashboard_active"} == 1
| |||||||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||||||
| 52 | 0 | redirect dancer_app->prefix . '/dashboard/' . config->{'Strehler'}->{'default_language'}; | |||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||
| 54 | else | ||||||||||||||||||||||||||||||||
| 55 | { | ||||||||||||||||||||||||||||||||
| 56 | 5 | my %navbar; | |||||||||||||||||||||||||||||||
| 57 | 5 | $navbar{'home'} = "active"; | |||||||||||||||||||||||||||||||
| 58 | 5 | template "admin/index", { navbar => \%navbar}; | |||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | 12 | }; | |||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | ##### Login/Logout ##### | ||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 6 | ▶ | any '/login' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||||||
| 65 | 6 | my $form = Strehler::Forms::form_login(); | |||||||||||||||||||||||||||||||
| 66 | 6 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 67 | 6 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 68 | 6 | my $message; | |||||||||||||||||||||||||||||||
| 69 | 6 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||||||
| 71 | 6 | my $user = Strehler::Element::User->valid_login($params_hashref->{'user'}, $params_hashref->{'password'}); | |||||||||||||||||||||||||||||||
| 72 | 6 | ▶ | if($user) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||||||
| 74 | 5 | session 'user' => $user->get_attr('user'); | |||||||||||||||||||||||||||||||
| 75 | 5 | session 'role' => $user->get_attr('role'); | |||||||||||||||||||||||||||||||
| 76 | 5 | ▶ | if( session 'redir_url' ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 77 | { | ||||||||||||||||||||||||||||||||
| 78 | 0 | my $redir = redirect(session 'redir_url'); | |||||||||||||||||||||||||||||||
| 79 | 0 | return $redir; | |||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | else | ||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||
| 83 | 5 | my $redir = redirect(dancer_app->prefix); | |||||||||||||||||||||||||||||||
| 84 | 0 | return $redir; | |||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||
| 87 | else | ||||||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||||||
| 89 | 1 | $message = "Authentication failed!"; | |||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||
| 92 | 1 | template "admin/login", { form => $form->render(), message => $message }, { layout => 'light-admin' } | |||||||||||||||||||||||||||||||
| 93 | 12 | }; | |||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | get '/logout' => sub | ||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 97 | 0 | session 'user' => undef; | |||||||||||||||||||||||||||||||
| 98 | 0 | session 'role' => undef; | |||||||||||||||||||||||||||||||
| 99 | 0 | my $redir = redirect(dancer_app->prefix); | |||||||||||||||||||||||||||||||
| 100 | 0 | return $redir; | |||||||||||||||||||||||||||||||
| 101 | 12 | }; | |||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | ajax '/image/src/:id' => sub | ||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 105 | 1 | content_type('text/plain'); | |||||||||||||||||||||||||||||||
| 106 | 1 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 107 | 1 | my $img = Strehler::Element::Image->new($id); | |||||||||||||||||||||||||||||||
| 108 | 1 | return $img->get_attr('image'); | |||||||||||||||||||||||||||||||
| 109 | 12 | }; | |||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||
| 111 | #Users | ||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | any '/user/add' => sub | ||||||||||||||||||||||||||||||||
| 114 | 3 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=17.4
| |||||||||||||||||||||||||||||||||
| 115 | 3 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Element::User->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
'Strehler::Element::User'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Element::User'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Element::User'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= 'Strehler::Element::User'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 116 | 3 | my $form = Strehler::Forms::form_user('add'); | |||||||||||||||||||||||||||||||
| 117 | 3 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 118 | 3 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 119 | 3 | my $message = ""; | |||||||||||||||||||||||||||||||
| 120 | 3 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||
| 122 | 2 | my $id = Strehler::Element::User->save_form(undef, $form); | |||||||||||||||||||||||||||||||
| 123 | 2 | ▶ | if($id >= 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||||||
| 125 | 2 | Strehler::Element::Log->write(session->read('user'), 'add', 'user', $id); | |||||||||||||||||||||||||||||||
| 126 | 2 | redirect dancer_app->prefix . '/user/list'; | |||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||
| 129 | else | ||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||
| 131 | 0 | return template "admin/message", { message => Strehler::Element::User->error_message("add", $id), backlink => dancer_app->prefix . '/user' }; | |||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||
| 134 | 1 | template "admin/user", { form => $form->render(), message => $message } | |||||||||||||||||||||||||||||||
| 135 | 12 | }; | |||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | get '/user/edit/:id' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Element::User->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
'Strehler::Element::User'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Element::User'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Element::User'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= 'Strehler::Element::User'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 139 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 140 | 0 | my $user = Strehler::Element::User->new($id); | |||||||||||||||||||||||||||||||
| 141 | 0 | my $form_data = $user->get_form_data(); | |||||||||||||||||||||||||||||||
| 142 | 0 | my $form = Strehler::Forms::form_user('edit'); | |||||||||||||||||||||||||||||||
| 143 | 0 | $form->default_values($form_data); | |||||||||||||||||||||||||||||||
| 144 | 0 | template "admin/user", { form => $form->render() } | |||||||||||||||||||||||||||||||
| 145 | 12 | }; | |||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||
| 147 | post '/user/edit/:id' => sub | ||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Element::User->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
'Strehler::Element::User'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Element::User'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Element::User'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= 'Strehler::Element::User'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 150 | 0 | my $form = Strehler::Forms::form_user('edit'); | |||||||||||||||||||||||||||||||
| 151 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 152 | 0 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 153 | 0 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 154 | 0 | my $message; | |||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||
| 157 | 0 | my $return_id = Strehler::Element::User->save_form($id, $form); | |||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if($id >= 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 159 | { | ||||||||||||||||||||||||||||||||
| 160 | 0 | Strehler::Element::Log->write(session->read('user'), 'edit', 'user', $id); | |||||||||||||||||||||||||||||||
| 161 | 0 | redirect dancer_app->prefix . '/user/list'; | |||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||
| 163 | else | ||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||
| 165 | 0 | return template "admin/message", { message => Strehler::Element::User->error_message("edit", $id), backlink => dancer_app->prefix . '/user' }; | |||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||
| 168 | 0 | template "admin/user", { form => $form->render(), message => $message } | |||||||||||||||||||||||||||||||
| 169 | 12 | }; | |||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||
| 171 | 1 | ▶ | get '/user/password' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 172 | 1 | my $user = Strehler::Element::User->get_from_username(session->read('user')); | |||||||||||||||||||||||||||||||
| 173 | 1 | my $form_data = $user->get_form_data(); | |||||||||||||||||||||||||||||||
| 174 | 1 | my $form = Strehler::Forms::form_user('password'); | |||||||||||||||||||||||||||||||
| 175 | 1 | $form->default_values($form_data); | |||||||||||||||||||||||||||||||
| 176 | 1 | template "admin/user", { form => $form->render() } | |||||||||||||||||||||||||||||||
| 177 | 12 | }; | |||||||||||||||||||||||||||||||
| 178 | post '/user/password' => sub | ||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=18.2
| |||||||||||||||||||||||||||||||||
| 180 | 1 | ▶ | send_error("Wrong call", 500) && return if params->{user}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
params()->{'user'} && (send_error('Wrong call', 500) && (return))
send_error("Wrong call", 500) and return
MC/DC0%0/2
params()->{'user'} && (send_error('Wrong call', 500) && (return))
params()->{'user'}
send_error("Wrong call", 500)
Truth table33%1/3
A && B
A= params()->{'user'}B= send_error("Wrong call", 500)
| |||||||||||||||||||||||||||||||||
| 181 | 1 | my $user = Strehler::Element::User->get_from_username(session->read('user')); | |||||||||||||||||||||||||||||||
| 182 | 1 | my $id = $user->get_attr('id'); | |||||||||||||||||||||||||||||||
| 183 | 1 | my $form = Strehler::Forms::form_user('password'); | |||||||||||||||||||||||||||||||
| 184 | 1 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 185 | 1 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 186 | 1 | my $message; | |||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 188 | { | ||||||||||||||||||||||||||||||||
| 189 | 1 | my $return_id = Strehler::Element::User->save_password($id, $form); | |||||||||||||||||||||||||||||||
| 190 | 1 | ▶ | if($return_id < 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 191 | { | ||||||||||||||||||||||||||||||||
| 192 | 0 | return template "admin/message", { message => Strehler::Element::User->error_message("change password", $id), backlink => dancer_app->prefix . '/user' }; | |||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||
| 194 | else | ||||||||||||||||||||||||||||||||
| 195 | { | ||||||||||||||||||||||||||||||||
| 196 | 1 | Strehler::Element::Log->write(session->read('user'), 'change password', 'user', $id); | |||||||||||||||||||||||||||||||
| 197 | 1 | redirect dancer_app->prefix . '/'; | |||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||
| 200 | 0 | template "admin/user", { form => $form->render(), message => $message } | |||||||||||||||||||||||||||||||
| 201 | 12 | }; | |||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | #Categories | ||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | get '/category' => sub | ||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 210 | 0 | redirect dancer_app->prefix . '/category/list'; | |||||||||||||||||||||||||||||||
| 211 | 12 | }; | |||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | any '/category/list' => sub | ||||||||||||||||||||||||||||||||
| 214 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.4
| |||||||||||||||||||||||||||||||||
| 215 | 2 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||
| 217 | #THE TABLE | ||||||||||||||||||||||||||||||||
| 218 | 1 | my @to_view = Strehler::Meta::Category->get_list(); | |||||||||||||||||||||||||||||||
| 219 | 1 | my @entities = Strehler::Helpers::get_categorized_entities(); | |||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | #THE FORM | ||||||||||||||||||||||||||||||||
| 222 | 1 | my $form = Strehler::Forms::form_category_fast(); | |||||||||||||||||||||||||||||||
| 223 | 1 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 224 | 1 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 225 | 1 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||||||
| 227 | 0 | my $id = Strehler::Meta::Category->save_form(undef, $form, \@entities); | |||||||||||||||||||||||||||||||
| 228 | 0 | Strehler::Element::Log->write(session->read('user'), 'add', 'category', $id); | |||||||||||||||||||||||||||||||
| 229 | 0 | redirect dancer_app->prefix . '/category/list?message=fast-created'; | |||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||
| 231 | 1 | template "admin/category_list", { categories => \@to_view, form => $form, "message" => params->{'message'}}; | |||||||||||||||||||||||||||||||
| 232 | 12 | }; | |||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||
| 234 | any '/category/add' => sub | ||||||||||||||||||||||||||||||||
| 235 | 15 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||
| 236 | 15 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 237 | 15 | my $form = Strehler::Forms::form_category(); | |||||||||||||||||||||||||||||||
| 238 | 15 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 239 | 15 | my @entities = Strehler::Helpers::get_categorized_entities(); | |||||||||||||||||||||||||||||||
| 240 | 15 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 241 | 15 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 242 | { | ||||||||||||||||||||||||||||||||
| 243 | 14 | my $id = Strehler::Meta::Category->save_form(undef, $form, \@entities); | |||||||||||||||||||||||||||||||
| 244 | 14 | Strehler::Element::Log->write(session->read('user'), 'add', 'category', $id); | |||||||||||||||||||||||||||||||
| 245 | 14 | redirect dancer_app->prefix . '/category/list'; | |||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||
| 247 | 1 | template "admin/category", { form => $form->render() } | |||||||||||||||||||||||||||||||
| 248 | 12 | }; | |||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | get '/category/edit/:id' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 251 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 252 | 0 | my $category = Strehler::Meta::Category->new($id); | |||||||||||||||||||||||||||||||
| 253 | 0 | my @entities = Strehler::Helpers::get_categorized_entities(); | |||||||||||||||||||||||||||||||
| 254 | 0 | my $form_data = $category->get_form_data(\@entities); | |||||||||||||||||||||||||||||||
| 255 | 0 | $form_data->{'prev-name'} = $form_data->{'category'}; | |||||||||||||||||||||||||||||||
| 256 | 0 | $form_data->{'prev-parent'} = $form_data->{'parent'}; | |||||||||||||||||||||||||||||||
| 257 | 0 | my $form = Strehler::Forms::form_category(); | |||||||||||||||||||||||||||||||
| 258 | 0 | $form->default_values($form_data); | |||||||||||||||||||||||||||||||
| 259 | 0 | template "admin/category", { form => $form->render() } | |||||||||||||||||||||||||||||||
| 260 | 12 | }; | |||||||||||||||||||||||||||||||
| 261 | post '/category/edit/:id' => sub | ||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 264 | 0 | my $form = Strehler::Forms::form_category(); | |||||||||||||||||||||||||||||||
| 265 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 266 | 0 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 267 | 0 | my @entities = Strehler::Helpers::get_categorized_entities(); | |||||||||||||||||||||||||||||||
| 268 | 0 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 270 | { | ||||||||||||||||||||||||||||||||
| 271 | 0 | Strehler::Meta::Category->save_form($id, $form, \@entities); | |||||||||||||||||||||||||||||||
| 272 | 0 | Strehler::Element::Log->write(session->read('user'), 'edit', 'category', $id); | |||||||||||||||||||||||||||||||
| 273 | 0 | redirect dancer_app->prefix . '/category/list'; | |||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||
| 275 | 0 | template "admin/category", { form => $form->render() } | |||||||||||||||||||||||||||||||
| 276 | 12 | }; | |||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||
| 278 | get '/category/delete/:id' => sub | ||||||||||||||||||||||||||||||||
| 279 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=13.0
| |||||||||||||||||||||||||||||||||
| 280 | 1 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 281 | 1 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 282 | 1 | my $category = Strehler::Meta::Category->new($id); | |||||||||||||||||||||||||||||||
| 283 | 1 | my %data = $category->get_basic_data(); | |||||||||||||||||||||||||||||||
| 284 | 1 | template "admin/delete-category", { what => "category", subs => $category->is_parent(), el => \%data, backlink => dancer_app->prefix . '/category' }; | |||||||||||||||||||||||||||||||
| 285 | 12 | }; | |||||||||||||||||||||||||||||||
| 286 | post '/category/delete/:id' => sub | ||||||||||||||||||||||||||||||||
| 287 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||||||
| 288 | 2 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 289 | 2 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 290 | 2 | my $category = Strehler::Meta::Category->new($id); | |||||||||||||||||||||||||||||||
| 291 | 2 | my $code = $category->delete(); | |||||||||||||||||||||||||||||||
| 292 | 2 | ▶ | if($code != 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 293 | { | ||||||||||||||||||||||||||||||||
| 294 | 1 | return template "admin/message", { message => $category->error_message("delete", $code), backlink => dancer_app->prefix . '/category' }; | |||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||
| 296 | 1 | Strehler::Element::Log->write(session->read('user'), 'delete', 'category', $id); | |||||||||||||||||||||||||||||||
| 297 | 1 | redirect dancer_app->prefix . '/category/list'; | |||||||||||||||||||||||||||||||
| 298 | 12 | }; | |||||||||||||||||||||||||||||||
| 299 | post '/category/delete-tree/:id' => sub | ||||||||||||||||||||||||||||||||
| 300 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||
| 301 | 2 | ▶ | send_error("Access denied", 403) && return if ( ! Strehler::Meta::Category->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
'Strehler::Meta::Category'->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
'Strehler::Meta::Category'->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= 'Strehler::Meta::Category'->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 302 | 2 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 303 | 2 | my $category = Strehler::Meta::Category->new($id); | |||||||||||||||||||||||||||||||
| 304 | 2 | my @categories_to_delete = ( $category ); | |||||||||||||||||||||||||||||||
| 305 | 2 | ▶ | while(@categories_to_delete) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 306 | { | ||||||||||||||||||||||||||||||||
| 307 | 7 | my $cat = shift @categories_to_delete; | |||||||||||||||||||||||||||||||
| 308 | 7 | ▶ | if($cat->is_parent()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 309 | { | ||||||||||||||||||||||||||||||||
| 310 | 3 | @categories_to_delete = ( $cat->subcategories(0), $cat, @categories_to_delete ); | |||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||
| 312 | else | ||||||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||||||
| 314 | 4 | my $code = $cat->delete(); | |||||||||||||||||||||||||||||||
| 315 | 4 | ▶ | if($code != 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 316 | { | ||||||||||||||||||||||||||||||||
| 317 | 1 | return template "admin/message", { message => $cat->error_message("delete", $code), backlink => dancer_app->prefix . '/category' }; | |||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||
| 319 | 3 | Strehler::Element::Log->write(session->read('user'), 'delete', 'category', $cat->get_attr('id')); | |||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||
| 322 | 1 | redirect dancer_app->prefix . '/category/list'; | |||||||||||||||||||||||||||||||
| 323 | 12 | }; | |||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||
| 325 | ajax '/category/select/:id' => sub | ||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 327 | 0 | content_type('text/plain'); | |||||||||||||||||||||||||||||||
| 328 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $option = params->{option} || undef; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
params()->{'option'} || undef
MC/DC0%0/1
params()->{'option'} || undef
params()->{'option'}
Truth table0%0/2
A
A= params()->{'option'}
| |||||||||||||||||||||||||||||||||
| 330 | 0 | my $data = Strehler::Meta::Category->make_select($id, $option); | |||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | if($data->[1]) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 332 | { | ||||||||||||||||||||||||||||||||
| 333 | 0 | template 'admin/category_select', { categories => $data }, { layout => undef }; | |||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||
| 335 | else | ||||||||||||||||||||||||||||||||
| 336 | { | ||||||||||||||||||||||||||||||||
| 337 | 0 | return 0; | |||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||
| 339 | 12 | }; | |||||||||||||||||||||||||||||||
| 340 | ajax '/category/select' => sub | ||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||
| 342 | 1 | content_type('text/plain'); | |||||||||||||||||||||||||||||||
| 343 | 1 | my $data = Strehler::Meta::Category->make_select(undef); | |||||||||||||||||||||||||||||||
| 344 | 1 | ▶ | if($data->[1]) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 345 | { | ||||||||||||||||||||||||||||||||
| 346 | 1 | template 'admin/category_select', { categories => $data }, { layout => undef }; | |||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||
| 348 | else | ||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||
| 350 | 0 | return 0; | |||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||
| 352 | 12 | }; | |||||||||||||||||||||||||||||||
| 353 | ajax '/category/info' => sub | ||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||
| 355 | 0 | content_type('application/json'); | |||||||||||||||||||||||||||||||
| 356 | 0 | my $category; | |||||||||||||||||||||||||||||||
| 357 | 0 | my $input = params->{input}; | |||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | my $option = params->{option} || undef; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
params()->{'option'} || undef
MC/DC0%0/1
params()->{'option'} || undef
params()->{'option'}
Truth table0%0/2
A
A= params()->{'option'}
| |||||||||||||||||||||||||||||||||
| 359 | 0 | my $ancestor = 0; | |||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if(params->{query} eq 'id' && $input) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
params()->{"query"} eq "id" and $input
MC/DC0%0/2
params()->{"query"} eq "id" and $input
params()->{"query"} eq "id"
$input
Truth table0%0/3
A and B
A= params()->{"query"} eq "id"B= $input
| |||||||||||||||||||||||||||||||||
| 361 | { | ||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if($input =~ m/^anc:([0-9]+)$/) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 363 | { | ||||||||||||||||||||||||||||||||
| 364 | 0 | $input = $1; | |||||||||||||||||||||||||||||||
| 365 | 0 | $ancestor = 1; | |||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||
| 367 | 0 | $category = Strehler::Meta::Category->new($input); | |||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||
| 369 | ▶ | elsif(params->{query} eq 'name' && $input) | |||||||||||||||||||||||||||||||
|
Condition0%0/3
params()->{"query"} eq "name" and $input
MC/DC0%0/2
params()->{"query"} eq "name" and $input
params()->{"query"} eq "name"
$input
Truth table0%0/3
A and B
A= params()->{"query"} eq "name"B= $input
| |||||||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | if($input =~ m/^(.*)\*$/) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 372 | { | ||||||||||||||||||||||||||||||||
| 373 | 0 | $input = $1; | |||||||||||||||||||||||||||||||
| 374 | 0 | $ancestor = 1; | |||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||
| 376 | 0 | $category = Strehler::Meta::Category->explode_name($input); | |||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||
| 378 | else | ||||||||||||||||||||||||||||||||
| 379 | { | ||||||||||||||||||||||||||||||||
| 380 | 0 | $category = Strehler::Meta::Category->new( row => undef ); | |||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||
| 382 | 0 | my %data = $category->get_basic_data(); | |||||||||||||||||||||||||||||||
| 383 | 0 | my $subs = Strehler::Meta::Category->make_select($category->get_attr('id'), $option); | |||||||||||||||||||||||||||||||
| 384 | 0 | my @subs_array = @{$subs}; | |||||||||||||||||||||||||||||||
| 385 | 0 | $data{select} = template 'admin/category_select', { categories => $subs }, { layout => undef }; | |||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if($#subs_array > 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||||||
| 388 | 0 | $data{subcategories} = 1; | |||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||
| 390 | else | ||||||||||||||||||||||||||||||||
| 391 | { | ||||||||||||||||||||||||||||||||
| 392 | 0 | $data{subcategories} = 0; | |||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if($ancestor && $category->exists()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ancestor and $category->exists
MC/DC0%0/2
$ancestor and $category->exists
$ancestor
$category->exists
Truth table0%0/3
A and B
A= $ancestorB= $category->exists
| |||||||||||||||||||||||||||||||||
| 395 | { | ||||||||||||||||||||||||||||||||
| 396 | 0 | $data{'parent'} = $input; | |||||||||||||||||||||||||||||||
| 397 | 0 | $data{subcategories} = 0; | |||||||||||||||||||||||||||||||
| 398 | 0 | $data{'ext_name'} = $data{'ext_name'} . "/*"; | |||||||||||||||||||||||||||||||
| 399 | 0 | $data{'id'} = 'anc:'.$input; | |||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||
| 401 | 0 | my $serializer = Dancer2::Serializer::JSON->new(); | |||||||||||||||||||||||||||||||
| 402 | 0 | return $serializer->serialize(\%data); | |||||||||||||||||||||||||||||||
| 403 | 12 | }; | |||||||||||||||||||||||||||||||
| 404 | ajax '/category/tagform/:type/:id?' => sub | ||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||
| 406 | 0 | content_type('text/plain'); | |||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | if(params->{id}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 408 | { | ||||||||||||||||||||||||||||||||
| 409 | 0 | my $category = Strehler::Meta::Category->new(params->{id}); | |||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | if(! $category->exists()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 411 | { | ||||||||||||||||||||||||||||||||
| 412 | 0 | template 'admin/open_tags'; | |||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||
| 414 | else | ||||||||||||||||||||||||||||||||
| 415 | { | ||||||||||||||||||||||||||||||||
| 416 | 0 | my @tags = Strehler::Meta::Tag->get_configured_tags_for_template($category->ext_name(), params->{type}); | |||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | if($#tags > -1) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 418 | { | ||||||||||||||||||||||||||||||||
| 419 | 0 | template 'admin/configured_tags', { tags => \@tags }, { layout => undef }; | |||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||
| 421 | else | ||||||||||||||||||||||||||||||||
| 422 | { | ||||||||||||||||||||||||||||||||
| 423 | 0 | template 'admin/open_tags'; | |||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||
| 427 | else | ||||||||||||||||||||||||||||||||
| 428 | { | ||||||||||||||||||||||||||||||||
| 429 | 0 | template 'admin/open_tags'; | |||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||
| 431 | 12 | }; | |||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||
| 433 | get '/:entity' => sub | ||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||
| 435 | 0 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 436 | 0 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | if($class) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 438 | { | ||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 440 | 0 | redirect dancer_app->prefix . '/' . $entity . '/list'; | |||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||
| 442 | else | ||||||||||||||||||||||||||||||||
| 443 | { | ||||||||||||||||||||||||||||||||
| 444 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||
| 446 | 12 | }; | |||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||
| 448 | any '/:entity/list' => sub | ||||||||||||||||||||||||||||||||
| 449 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=15 SCAR=31.9
| |||||||||||||||||||||||||||||||||
| 450 | #Page init | ||||||||||||||||||||||||||||||||
| 451 | 6 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 452 | 6 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 453 | 6 | ▶ | if(! $class->auto()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 454 | { | ||||||||||||||||||||||||||||||||
| 455 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||
| 457 | 6 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||
| 459 | #Parameters collection | ||||||||||||||||||||||||||||||||
| 460 | 6 | my $input_params; | |||||||||||||||||||||||||||||||
| 461 | my $session; | ||||||||||||||||||||||||||||||||
| 462 | 6 | foreach my $p (Strehler::Helpers::list_parameters_names('session')) | |||||||||||||||||||||||||||||||
| 463 | { | ||||||||||||||||||||||||||||||||
| 464 | 36 | ▶ | if(exists params->{$p}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 465 | { | ||||||||||||||||||||||||||||||||
| 466 | 4 | $input_params->{$p} = params->{$p}; | |||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||
| 468 | 36 | my $session_value = session->read($entity . "-" . $p); | |||||||||||||||||||||||||||||||
| 469 | 36 | ▶ | $session->{$p} = $session_value if($session_value); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||
| 471 | 6 | foreach my $p (Strehler::Helpers::list_parameters_names('extra')) | |||||||||||||||||||||||||||||||
| 472 | { | ||||||||||||||||||||||||||||||||
| 473 | 24 | ▶ | if(exists params->{$p}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 474 | { | ||||||||||||||||||||||||||||||||
| 475 | 0 | $input_params->{$p} = params->{$p}; | |||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||
| 478 | 6 | my %parameters = Strehler::Helpers::list_parameters_init($entity, $session, $input_params); | |||||||||||||||||||||||||||||||
| 479 | 6 | ▶ | if(exists $parameters{'error'} && $parameters{'error'} == 1) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $parameters{"error"} and $parameters{"error"} == 1
MC/DC0%0/2
exists $parameters{"error"} and $parameters{"error"} == 1
exists $parameters{"error"}
$parameters{"error"} == 1
Truth table33%1/3
A and B
A= exists $parameters{"error"}B= $parameters{"error"} == 1
| |||||||||||||||||||||||||||||||||
| 480 | { | ||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | my $backlink = params->{'strehl-from'} || "/admin/$entity/list"; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
params()->{'strehl-from'} || "/admin/$entity/list"
MC/DC0%0/1
params()->{'strehl-from'} || "/admin/$entity/list"
params()->{'strehl-from'}
Truth table0%0/2
A
A= params()->{'strehl-from'}
| |||||||||||||||||||||||||||||||||
| 482 | 0 | return template "admin/message", { message => "Wrong category name: " . params->{'strehl-catname'}, backlink => $backlink }; | |||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||
| 485 | #Search | ||||||||||||||||||||||||||||||||
| 486 | 6 | my $elements; | |||||||||||||||||||||||||||||||
| 487 | 6 | my %search_params = %parameters; | |||||||||||||||||||||||||||||||
| 488 | 6 | ▶ | if($parameters{'search'}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 489 | { | ||||||||||||||||||||||||||||||||
| 490 | 0 | $elements = $class->search_box($parameters{'search'}, \%search_params); | |||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||
| 492 | else | ||||||||||||||||||||||||||||||||
| 493 | { | ||||||||||||||||||||||||||||||||
| 494 | 6 | $elements = $class->get_list(\%search_params); | |||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||
| 496 | 6 | my $filter_form = Strehler::Forms::form_filter($forms_path . '/admin/category_filter.yml', $class->multilang(), $parameters{'language'}, \@languages); | |||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||
| 498 | #Session saving management | ||||||||||||||||||||||||||||||||
| 499 | 6 | foreach my $p_save (Strehler::Helpers::list_parameters_names('session')) | |||||||||||||||||||||||||||||||
| 500 | { | ||||||||||||||||||||||||||||||||
| 501 | 36 | session $entity . '-' . $p_save => $parameters{$p_save}; | |||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||
| 504 | #Rendering | ||||||||||||||||||||||||||||||||
| 505 | 6 | my $custom_list_template = $class->custom_list_template(); | |||||||||||||||||||||||||||||||
| 506 | 6 | ▶ | my $list_view = $custom_list_template ? 'admin/custom_list' : 'admin/generic_list'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 507 | template $list_view, { entity => $entity, | ||||||||||||||||||||||||||||||||
| 508 | elements => $elements->{'to_view'}, | ||||||||||||||||||||||||||||||||
| 509 | 6 | last_page => $elements->{'last_page'}, | |||||||||||||||||||||||||||||||
| 510 | filter_form => $filter_form, | ||||||||||||||||||||||||||||||||
| 511 | fields => $class->fields_list(), | ||||||||||||||||||||||||||||||||
| 512 | custom_list_template => $custom_list_template, | ||||||||||||||||||||||||||||||||
| 513 | languages => \@languages, | ||||||||||||||||||||||||||||||||
| 514 | %parameters, | ||||||||||||||||||||||||||||||||
| 515 | $class->entity_data() | ||||||||||||||||||||||||||||||||
| 516 | }; | ||||||||||||||||||||||||||||||||
| 517 | 12 | }; | |||||||||||||||||||||||||||||||
| 518 | get '/:entity/turnon/:id' => sub | ||||||||||||||||||||||||||||||||
| 519 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=23.5
| |||||||||||||||||||||||||||||||||
| 520 | 6 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 521 | 6 | ▶ | my $redirect = params->{'strehl-from'} || dancer_app->prefix . '/'. $entity . '/list'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
params()->{'strehl-from'} || dancer_app()->prefix . '/' . $entity . '/list'
MC/DC0%0/1
params()->{'strehl-from'} || dancer_app()->prefix . '/' . $entity . '/list'
params()->{'strehl-from'}
Truth table50%1/2
A
A= params()->{'strehl-from'}
| |||||||||||||||||||||||||||||||||
| 522 | 6 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 523 | 6 | ▶ | if((! $class->auto()) || (! $class->publishable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->auto and $class->publishable
MC/DC0%0/2
$class->auto and $class->publishable
$class->auto
$class->publishable
Truth table33%1/3
A and B
A= $class->autoB= $class->publishable
| |||||||||||||||||||||||||||||||||
| 524 | { | ||||||||||||||||||||||||||||||||
| 525 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||
| 527 | 6 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 528 | 6 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 529 | 6 | my $obj = $class->new($id); | |||||||||||||||||||||||||||||||
| 530 | 6 | my $code = $obj->publish(); | |||||||||||||||||||||||||||||||
| 531 | 6 | ▶ | if($code != 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 532 | { | ||||||||||||||||||||||||||||||||
| 533 | 0 | return template "admin/message", { message => $obj->error_message("publish", $code), backlink => dancer_app->prefix . '/' . $entity }; | |||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||
| 535 | 6 | Strehler::Element::Log->write(session->read('user'), 'publish', $entity, $id); | |||||||||||||||||||||||||||||||
| 536 | 6 | redirect $redirect; | |||||||||||||||||||||||||||||||
| 537 | 12 | }; | |||||||||||||||||||||||||||||||
| 538 | get '/:entity/turnoff/:id' => sub | ||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 540 | 0 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | my $redirect = params->{'strehl-from'} || dancer_app->prefix . '/'. $entity . '/list'; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
params()->{'strehl-from'} || dancer_app()->prefix . '/' . $entity . '/list'
MC/DC0%0/1
params()->{'strehl-from'} || dancer_app()->prefix . '/' . $entity . '/list'
params()->{'strehl-from'}
Truth table0%0/2
A
A= params()->{'strehl-from'}
| |||||||||||||||||||||||||||||||||
| 542 | 0 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if((! $class->auto()) || (! $class->publishable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class->auto and $class->publishable
MC/DC0%0/2
$class->auto and $class->publishable
$class->auto
$class->publishable
Truth table0%0/3
A and B
A= $class->autoB= $class->publishable
| |||||||||||||||||||||||||||||||||
| 544 | { | ||||||||||||||||||||||||||||||||
| 545 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 548 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 549 | 0 | my $obj = $class->new($id); | |||||||||||||||||||||||||||||||
| 550 | 0 | my $code = $obj->unpublish(); | |||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if($code != 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 552 | { | ||||||||||||||||||||||||||||||||
| 553 | 0 | return template "admin/message", { message => $obj->error_message("unpublish", $code), backlink => dancer_app->prefix . '/' . $entity }; | |||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||
| 555 | 0 | Strehler::Element::Log->write(session->read('user'), 'unpublish', $entity, $id); | |||||||||||||||||||||||||||||||
| 556 | 0 | redirect $redirect; | |||||||||||||||||||||||||||||||
| 557 | 12 | }; | |||||||||||||||||||||||||||||||
| 558 | get '/:entity/delete/:id' => sub | ||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||
| 560 | 0 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 561 | 0 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | if((! $class->auto()) || (! $class->deletable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class->auto and $class->deletable
MC/DC0%0/2
$class->auto and $class->deletable
$class->auto
$class->deletable
Truth table0%0/3
A and B
A= $class->autoB= $class->deletable
| |||||||||||||||||||||||||||||||||
| 563 | { | ||||||||||||||||||||||||||||||||
| 564 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 567 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 568 | 0 | my $obj = $class->new($id); | |||||||||||||||||||||||||||||||
| 569 | 0 | my %el = $obj->get_basic_data(); | |||||||||||||||||||||||||||||||
| 570 | 0 | template "admin/delete", { what => $class->label(), el => \%el, backlink => dancer_app->prefix . '/' . $entity }; | |||||||||||||||||||||||||||||||
| 571 | 12 | }; | |||||||||||||||||||||||||||||||
| 572 | post '/:entity/delete/:id' => sub | ||||||||||||||||||||||||||||||||
| 573 | 3 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=22.6
| |||||||||||||||||||||||||||||||||
| 574 | 3 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 575 | 3 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 576 | 3 | ▶ | if((! $class->auto()) || (! $class->deletable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->auto and $class->deletable
MC/DC0%0/2
$class->auto and $class->deletable
$class->auto
$class->deletable
Truth table33%1/3
A and B
A= $class->autoB= $class->deletable
| |||||||||||||||||||||||||||||||||
| 577 | { | ||||||||||||||||||||||||||||||||
| 578 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||
| 580 | 3 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 581 | 3 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 582 | 3 | my $obj = $class->new($id); | |||||||||||||||||||||||||||||||
| 583 | 3 | my $code = $obj->delete(); | |||||||||||||||||||||||||||||||
| 584 | 3 | ▶ | if($code != 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 585 | { | ||||||||||||||||||||||||||||||||
| 586 | 3 | return template "admin/message", { message => $obj->error_message("delete", $code), backlink => dancer_app->prefix . '/' . $entity }; | |||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||
| 588 | 0 | Strehler::Element::Log->write(session->read('user'), 'delete', $entity, $id); | |||||||||||||||||||||||||||||||
| 589 | 0 | redirect dancer_app->prefix . '/' . $entity . '/list'; | |||||||||||||||||||||||||||||||
| 590 | 12 | }; | |||||||||||||||||||||||||||||||
| 591 | ajax '/:entity/tagform/:id?' => sub | ||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 593 | 0 | content_type('text/plain'); | |||||||||||||||||||||||||||||||
| 594 | 0 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 595 | 0 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | if((! $class->auto()) || (! $class->categorized())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class->auto and $class->categorized
MC/DC0%0/2
$class->auto and $class->categorized
$class->auto
$class->categorized
Truth table0%0/3
A and B
A= $class->autoB= $class->categorized
| |||||||||||||||||||||||||||||||||
| 597 | { | ||||||||||||||||||||||||||||||||
| 598 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | if(params->{id}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 601 | { | ||||||||||||||||||||||||||||||||
| 602 | 0 | my $obj = $class->new(params->{id}); | |||||||||||||||||||||||||||||||
| 603 | 0 | my @category_tags = Strehler::Meta::Tag->get_configured_tags_for_template($obj->get_attr('category-name'), $entity); | |||||||||||||||||||||||||||||||
| 604 | 0 | my @tags = split(',', $obj->get_tags()); | |||||||||||||||||||||||||||||||
| 605 | 0 | my @out; | |||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | if($#category_tags > -1) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 607 | { | ||||||||||||||||||||||||||||||||
| 608 | 0 | foreach my $c_t (@category_tags) | |||||||||||||||||||||||||||||||
| 609 | { | ||||||||||||||||||||||||||||||||
| 610 | 0 | my $default = 0; | |||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | if (grep {$_ eq $c_t->tag} @tags) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 612 | { | ||||||||||||||||||||||||||||||||
| 613 | 0 | $default = 1; | |||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||
| 615 | 0 | push @out, { tag => $c_t->tag, default_tag => $default }; | |||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||
| 617 | 0 | template 'admin/configured_tags', { tags => \@out }; | |||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||
| 619 | else | ||||||||||||||||||||||||||||||||
| 620 | { | ||||||||||||||||||||||||||||||||
| 621 | 0 | template 'admin/open_tags', { tags => $obj->get_tags() }; | |||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||
| 624 | else | ||||||||||||||||||||||||||||||||
| 625 | { | ||||||||||||||||||||||||||||||||
| 626 | 0 | template 'admin/open_tags'; | |||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||
| 628 | 12 | }; | |||||||||||||||||||||||||||||||
| 629 | ajax '/:entity/lastchapter/:id?' => sub | ||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||
| 631 | 0 | content_type('text/plain'); | |||||||||||||||||||||||||||||||
| 632 | 0 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | my $id = params->{id} || undef; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
params()->{'id'} || undef
MC/DC0%0/1
params()->{'id'} || undef
params()->{'id'}
Truth table0%0/2
A
A= params()->{'id'}
| |||||||||||||||||||||||||||||||||
| 634 | 0 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | if((! $class->auto()) || (! $class->ordered())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class->auto and $class->ordered
MC/DC0%0/2
$class->auto and $class->ordered
$class->auto
$class->ordered
Truth table0%0/3
A and B
A= $class->autoB= $class->ordered
| |||||||||||||||||||||||||||||||||
| 636 | { | ||||||||||||||||||||||||||||||||
| 637 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||
| 639 | 0 | return $class->max_category_order($id) +1; | |||||||||||||||||||||||||||||||
| 640 | 12 | }; | |||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||
| 642 | any '/:entity/add' => sub | ||||||||||||||||||||||||||||||||
| 643 | 19 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=24 SCAR=48.2
| |||||||||||||||||||||||||||||||||
| 644 | 19 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 645 | 19 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 646 | 19 | ▶ | if((! $class->auto()) || (! $class->creatable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->auto and $class->creatable
MC/DC0%0/2
$class->auto and $class->creatable
$class->auto
$class->creatable
Truth table33%1/3
A and B
A= $class->autoB= $class->creatable
| |||||||||||||||||||||||||||||||||
| 647 | { | ||||||||||||||||||||||||||||||||
| 648 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||
| 651 | 19 | my $check_cat = Strehler::Meta::Category->no_categories(); | |||||||||||||||||||||||||||||||
| 652 | 19 | ▶ | if($check_cat and $class->categorized()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$check_cat and $class->categorized
MC/DC50%1/2
$check_cat and $class->categorized
$check_cat
$class->categorized
Truth table66%2/3
A and B
A= $check_catB= $class->categorized
| |||||||||||||||||||||||||||||||||
| 653 | { | ||||||||||||||||||||||||||||||||
| 654 | 2 | my $message = "No category in the system. Create a category before creating categorized content."; | |||||||||||||||||||||||||||||||
| 655 | 2 | my $return = dancer_app->prefix . "/"; | |||||||||||||||||||||||||||||||
| 656 | 2 | my $create = dancer_app->prefix . "/category/add"; | |||||||||||||||||||||||||||||||
| 657 | 2 | return template "admin/no_category", { message => $message, backlink => $return, createlink => $create }; | |||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||
| 660 | 17 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 661 | 17 | my $form = Strehler::Forms::form_generic($class->form(), $class->multilang_form(), {languages => \@languages, default_language => config->{'Strehler'}->{'default_language'}, only_default_required => $class->only_default_required() } ); | |||||||||||||||||||||||||||||||
| 662 | 17 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 663 | 17 | $form = Strehler::Forms::tags_for_form($form, $params_hashref); | |||||||||||||||||||||||||||||||
| 664 | 17 | ▶ | if(! $form) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 665 | { | ||||||||||||||||||||||||||||||||
| 666 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||
| 668 | 17 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 669 | 17 | my $message = 'quiet'; | |||||||||||||||||||||||||||||||
| 670 | 17 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 671 | { | ||||||||||||||||||||||||||||||||
| 672 | 15 | my $id = $class->save_form(undef, $form, request->uploads()); | |||||||||||||||||||||||||||||||
| 673 | 15 | ▶ | if($id < 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 674 | { | ||||||||||||||||||||||||||||||||
| 675 | 0 | return template "admin/message", { message => $class->error_message("delete", $id), backlink => dancer_app->prefix . '/' . $entity }; | |||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||
| 677 | 15 | Strehler::Element::Log->write(session->read('user'), 'add', $entity, $id); | |||||||||||||||||||||||||||||||
| 678 | 15 | my $action = $form->param_value('strehl-action'); | |||||||||||||||||||||||||||||||
| 679 | 15 | ▶ | if(! $action) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 680 | { | ||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | if(session->read('backlink')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 682 | { | ||||||||||||||||||||||||||||||||
| 683 | 0 | redirect session->read('backlink'); | |||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||
| 685 | else | ||||||||||||||||||||||||||||||||
| 686 | { | ||||||||||||||||||||||||||||||||
| 687 | 0 | redirect dancer_app->prefix . '/' . $entity . '/list'; | |||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||
| 690 | 15 | ▶ | if($action eq 'submit-continue') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 691 | { | ||||||||||||||||||||||||||||||||
| 692 | 0 | redirect dancer_app->prefix . '/' . $entity . '/edit/' . $id . '?from_add=1'; | |||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||
| 694 | else | ||||||||||||||||||||||||||||||||
| 695 | { | ||||||||||||||||||||||||||||||||
| 696 | 15 | ▶ | if(session->read('backlink')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 697 | { | ||||||||||||||||||||||||||||||||
| 698 | 0 | redirect session->read('backlink'); | |||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||
| 700 | else | ||||||||||||||||||||||||||||||||
| 701 | { | ||||||||||||||||||||||||||||||||
| 702 | 15 | redirect dancer_app->prefix . '/' . $entity . '/list'; | |||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||
| 706 | 2 | my $fake_tags = $form->get_element({ name => 'tags'}); | |||||||||||||||||||||||||||||||
| 707 | 2 | ▶ | $form->remove_element($fake_tags) if($fake_tags); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 708 | 2 | my $backlink = undef; | |||||||||||||||||||||||||||||||
| 709 | 2 | ▶ | if(request->method eq 'GET') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 710 | { | ||||||||||||||||||||||||||||||||
| 711 | 0 | my $wanted_cat; | |||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | if(exists params->{'strehl-catname'}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 713 | { | ||||||||||||||||||||||||||||||||
| 714 | 0 | $wanted_cat = Strehler::Meta::Category->explode_name(params->{'strehl-catname'}); | |||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | if($wanted_cat->exists()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 716 | { | ||||||||||||||||||||||||||||||||
| 717 | 0 | $form->default_values({ category => $wanted_cat->get_attr('id')}); | |||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | if(exists params->{'strehl-today'}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 721 | { | ||||||||||||||||||||||||||||||||
| 722 | 0 | my $tm = localtime; | |||||||||||||||||||||||||||||||
| 723 | 0 | my $tm_day = $tm->mday; | |||||||||||||||||||||||||||||||
| 724 | 0 | my $tm_month = $tm->mon + 1; | |||||||||||||||||||||||||||||||
| 725 | 0 | my $tm_year = $tm->year + 1900; | |||||||||||||||||||||||||||||||
| 726 | 0 | my $date_string = "$tm_day/$tm_month/$tm_year"; | |||||||||||||||||||||||||||||||
| 727 | 0 | $form->default_values({ publish_date => $date_string }); | |||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | if(exists params->{'strehl-max-order'}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 730 | { | ||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | if($wanted_cat && $wanted_cat->exists()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$wanted_cat and $wanted_cat->exists
MC/DC0%0/2
$wanted_cat and $wanted_cat->exists
$wanted_cat
$wanted_cat->exists
Truth table0%0/3
A and B
A= $wanted_catB= $wanted_cat->exists
| |||||||||||||||||||||||||||||||||
| 732 | { | ||||||||||||||||||||||||||||||||
| 733 | 0 | my $max = $class->max_category_order($wanted_cat->get_attr('id')) + 1; | |||||||||||||||||||||||||||||||
| 734 | 0 | $form->default_values({ display_order => $max }); | |||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | if(exists params->{'strehl-from'}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 738 | { | ||||||||||||||||||||||||||||||||
| 739 | 0 | $backlink = params->{'strehl-from'}; | |||||||||||||||||||||||||||||||
| 740 | 0 | session 'backlink' => params->{'strehl-from'}; | |||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||
| 742 | else | ||||||||||||||||||||||||||||||||
| 743 | { | ||||||||||||||||||||||||||||||||
| 744 | 0 | session 'backlink' => undef; | |||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||
| 747 | 2 | ▶ | $backlink = $backlink || session->read('backlink'); | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$backlink || session()->read('backlink')
MC/DC0%0/2
$backlink || session()->read('backlink')
$backlink
session()->read('backlink')
Truth table33%1/3
A || B
A= $backlinkB= session()->read('backlink')
| |||||||||||||||||||||||||||||||||
| 748 | 2 | my %conf_data = $class->entity_data(); | |||||||||||||||||||||||||||||||
| 749 | 2 | template "admin/generic_add", { entity => $entity, label => $class->label(), form => $form->render(), custom_snippet => $class->custom_add_snippet(), entity_conf => \%conf_data, backlink => $backlink } | |||||||||||||||||||||||||||||||
| 750 | 12 | }; | |||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | get '/:entity/edit/:id' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||
| 752 | 0 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 753 | 0 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | my $from_add = params->{from_add} || 0; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
params()->{'from_add'} || 0
MC/DC0%0/1
params()->{'from_add'} || 0
params()->{'from_add'}
Truth table0%0/2
A
A= params()->{'from_add'}
| |||||||||||||||||||||||||||||||||
| 755 | 0 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 756 | 0 | my $backlink = undef; | |||||||||||||||||||||||||||||||
| 757 | 0 | ▶ | if((! $class->auto()) || (! $class->updatable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class->auto and $class->updatable
MC/DC0%0/2
$class->auto and $class->updatable
$class->auto
$class->updatable
Truth table0%0/3
A and B
A= $class->autoB= $class->updatable
| |||||||||||||||||||||||||||||||||
| 758 | { | ||||||||||||||||||||||||||||||||
| 759 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | if(exists params->{'strehl-from'}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 762 | { | ||||||||||||||||||||||||||||||||
| 763 | 0 | $backlink = params->{'strehl-from'}; | |||||||||||||||||||||||||||||||
| 764 | 0 | session 'backlink' => params->{'strehl-from'}; | |||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||
| 766 | else | ||||||||||||||||||||||||||||||||
| 767 | { | ||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | if(! $from_add) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 769 | { | ||||||||||||||||||||||||||||||||
| 770 | 0 | session 'backlink' => undef; | |||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table0%0/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 774 | 0 | my $el = $class->new($id); | |||||||||||||||||||||||||||||||
| 775 | 0 | my $form_data = $el->get_form_data(); | |||||||||||||||||||||||||||||||
| 776 | 0 | my $form = Strehler::Forms::form_generic($class->form(), $class->multilang_form(), {languages => \@languages, default_language => config->{'Strehler'}->{'default_language'}, only_default_required => $class->only_default_required() } ); | |||||||||||||||||||||||||||||||
| 777 | 0 | ▶ | if(! $form) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 778 | { | ||||||||||||||||||||||||||||||||
| 779 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||
| 781 | 0 | $form->default_values($form_data); | |||||||||||||||||||||||||||||||
| 782 | 0 | my %conf_data = $class->entity_data(); | |||||||||||||||||||||||||||||||
| 783 | 0 | ▶ | my $message = $from_add ? 'saved' : 'quiet'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | $backlink = $backlink || session->read('backlink'); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$backlink || session()->read('backlink')
MC/DC0%0/2
$backlink || session()->read('backlink')
$backlink
session()->read('backlink')
Truth table0%0/3
A || B
A= $backlinkB= session()->read('backlink')
| |||||||||||||||||||||||||||||||||
| 785 | 0 | template "admin/generic_add", { entity => $entity, label => $class->label(), id => $id, form => $form->render(), message => $message, custom_snippet => $el->custom_add_snippet(), entity_conf => \%conf_data, backlink => $backlink } | |||||||||||||||||||||||||||||||
| 786 | 12 | }; | |||||||||||||||||||||||||||||||
| 787 | post '/:entity/edit/:id' => sub | ||||||||||||||||||||||||||||||||
| 788 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=40.0
| |||||||||||||||||||||||||||||||||
| 789 | 1 | my $id = params->{id}; | |||||||||||||||||||||||||||||||
| 790 | 1 | my $entity = params->{entity}; | |||||||||||||||||||||||||||||||
| 791 | 1 | my $class = Strehler::Helpers::class_from_entity($entity); | |||||||||||||||||||||||||||||||
| 792 | 1 | ▶ | if((! $class->auto()) || (! $class->updatable())) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->auto and $class->updatable
MC/DC0%0/2
$class->auto and $class->updatable
$class->auto
$class->updatable
Truth table33%1/3
A and B
A= $class->autoB= $class->updatable
| |||||||||||||||||||||||||||||||||
| 793 | { | ||||||||||||||||||||||||||||||||
| 794 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||
| 796 | 1 | ▶ | send_error("Access denied", 403) && return if ( ! $class->check_role(session->read('role'))); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
send_error("Access denied", 403) and return
MC/DC0%0/2
$class->check_role(session()->read('role')) || send_error('Access denied', 403) && (return)
$class->check_role(session()->read('role'))
send_error("Access denied", 403)
Truth table33%1/3
A || B
A= $class->check_role(session()->read('role'))B= send_error("Access denied", 403)
| |||||||||||||||||||||||||||||||||
| 797 | 1 | my $form = Strehler::Forms::form_generic($class->form(), $class->multilang_form(), {languages => \@languages, default_language => config->{'Strehler'}->{'default_language'}, only_default_required => $class->only_default_required() } ); | |||||||||||||||||||||||||||||||
| 798 | 1 | ▶ | if(! $form) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 799 | { | ||||||||||||||||||||||||||||||||
| 800 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||
| 802 | 1 | my $params_hashref = params; | |||||||||||||||||||||||||||||||
| 803 | 1 | $form = Strehler::Forms::tags_for_form($form, $params_hashref); | |||||||||||||||||||||||||||||||
| 804 | 1 | $form->process($params_hashref); | |||||||||||||||||||||||||||||||
| 805 | 1 | my $message = 'quiet'; | |||||||||||||||||||||||||||||||
| 806 | 1 | ▶ | if($form->submitted_and_valid) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 807 | { | ||||||||||||||||||||||||||||||||
| 808 | 0 | my $id = $class->save_form($id, $form, request->uploads()); ## no critic qw(Variables::ProhibitReusedNames) | |||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | if($id < 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 810 | { | ||||||||||||||||||||||||||||||||
| 811 | 0 | return template "admin/message", { message => $class->error_message("edit", $id), backlink => dancer_app->prefix . '/' . $entity }; | |||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||
| 814 | 0 | Strehler::Element::Log->write(session->read('user'), 'edit', $entity, $id); | |||||||||||||||||||||||||||||||
| 815 | 0 | my $action = $form->param_value('strehl-action'); | |||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | if(! $action) | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 817 | { | ||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | if(session->read('backlink')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 819 | { | ||||||||||||||||||||||||||||||||
| 820 | 0 | redirect session->read('backlink'); | |||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||
| 822 | else | ||||||||||||||||||||||||||||||||
| 823 | { | ||||||||||||||||||||||||||||||||
| 824 | 0 | redirect dancer_app->prefix . '/' . $entity . '/list'; | |||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||
| 827 | elsif($action eq 'submit-go') | ||||||||||||||||||||||||||||||||
| 828 | { | ||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | if(session->read('backlink')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 830 | { | ||||||||||||||||||||||||||||||||
| 831 | 0 | redirect session->read('backlink'); | |||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||
| 833 | else | ||||||||||||||||||||||||||||||||
| 834 | { | ||||||||||||||||||||||||||||||||
| 835 | 0 | redirect dancer_app->prefix . '/' . $entity . '/list'; | |||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||
| 838 | elsif($action eq 'submit-continue') | ||||||||||||||||||||||||||||||||
| 839 | { | ||||||||||||||||||||||||||||||||
| 840 | 0 | $message = 'saved'; | |||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||
| 843 | 1 | my $el = $class->new($id); | |||||||||||||||||||||||||||||||
| 844 | 1 | my %conf_data = $class->entity_data(); | |||||||||||||||||||||||||||||||
| 845 | 1 | my $backlink = session->read('backlink'); | |||||||||||||||||||||||||||||||
| 846 | 1 | template "admin/generic_add", { entity => $entity, label => $class->label(), id => $id, form => $form->render(), message => $message, custom_snippet => $el->custom_add_snippet(), entity_conf => \%conf_data, backlink => $backlink } | |||||||||||||||||||||||||||||||
| 847 | 12 | }; | |||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||
| 849 | ##### DASHBOARD ##### | ||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||
| 851 | 3 | ▶ | get '/dashboard/:lang' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=16 SCAR=28.4
| |||||||||||||||||||||||||||||||||
| 852 | 3 | ▶ | if(! config->{'Strehler'}->{'dashboard_active'} || config->{'Strehler'}->{'dashboard_active'} == 0) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not config()->{"Strehler"}{"dashboard_active"} or config()->{"Strehler"}{"dashboard_active"} == 0
MC/DC0%0/2
not config()->{"Strehler"}{"dashboard_active"} or config()->{"Strehler"}{"dashboard_active"} == 0
not config()->{"Strehler"}{"dashboard_active"}
config()->{"Strehler"}{"dashboard_active"} == 0
Truth table33%1/3
not(A) or B
A= not config()->{"Strehler"}{"dashboard_active"}B= config()->{"Strehler"}{"dashboard_active"} == 0
| |||||||||||||||||||||||||||||||||
| 853 | { | ||||||||||||||||||||||||||||||||
| 854 | 0 | return pass; | |||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||
| 856 | 3 | my %navbar; | |||||||||||||||||||||||||||||||
| 857 | 3 | $navbar{'home'} = "active"; | |||||||||||||||||||||||||||||||
| 858 | 3 | my $language = params->{'lang'}; | |||||||||||||||||||||||||||||||
| 859 | 3 | ▶ | if ( ! grep { $_ eq $language } @languages ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 860 | { | ||||||||||||||||||||||||||||||||
| 861 | 1 | return pass; | |||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||
| 864 | 2 | my $dashboard_data = config->{'Strehler'}->{'dashboard'}; | |||||||||||||||||||||||||||||||
| 865 | 2 | my $elid = 0; | |||||||||||||||||||||||||||||||
| 866 | 2 | foreach my $el (@{$dashboard_data}) | |||||||||||||||||||||||||||||||
| 867 | { | ||||||||||||||||||||||||||||||||
| 868 | 4 | $el->{id} = $elid++; | |||||||||||||||||||||||||||||||
| 869 | 4 | ▶ | $el->{entity} ||= 'article'; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$el->{"entity"} ||= "article"
MC/DC100%1/1
$el->{"entity"} ||= "article"
$el->{"entity"}
Truth table100%2/2
A
A= $el->{"entity"}
| |||||||||||||||||||||||||||||||||
| 870 | 4 | ▶ | if($el->{'type'} eq 'list') | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 871 | { | ||||||||||||||||||||||||||||||||
| 872 | 2 | my $cat = Strehler::Meta::Category->explode_name($el->{'category'}); | |||||||||||||||||||||||||||||||
| 873 | 2 | ▶ | if($cat->exists()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 874 | { | ||||||||||||||||||||||||||||||||
| 875 | 2 | $el->{'nocategory'} = 0; | |||||||||||||||||||||||||||||||
| 876 | 2 | my $class = Strehler::Helpers::class_from_entity($el->{'entity'}); | |||||||||||||||||||||||||||||||
| 877 | my $elements = $class->get_list({ entries_per_page => -1, | ||||||||||||||||||||||||||||||||
| 878 | 2 | category => $el->{'category'}, | |||||||||||||||||||||||||||||||
| 879 | language => $language, | ||||||||||||||||||||||||||||||||
| 880 | published => 1 | ||||||||||||||||||||||||||||||||
| 881 | }); | ||||||||||||||||||||||||||||||||
| 882 | 2 | my @list = @{$elements->{'to_view'}}; | |||||||||||||||||||||||||||||||
| 883 | 2 | $el->{'counter'} = $#list+1; | |||||||||||||||||||||||||||||||
| 884 | my $unpub_elements = $class->get_list({ entries_per_page => -1, | ||||||||||||||||||||||||||||||||
| 885 | 2 | category => $el->{'category'}, | |||||||||||||||||||||||||||||||
| 886 | language => $language, | ||||||||||||||||||||||||||||||||
| 887 | published => 0 | ||||||||||||||||||||||||||||||||
| 888 | }); | ||||||||||||||||||||||||||||||||
| 889 | 2 | my @unpub_list = @{$unpub_elements->{'to_view'}}; | |||||||||||||||||||||||||||||||
| 890 | 2 | $el->{'unpublished_counter'} = $#unpub_list+1; | |||||||||||||||||||||||||||||||
| 891 | 2 | ▶ | my $by = $el->{'by'} || 'date'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$el->{'by'} || 'date'
MC/DC0%0/1
$el->{'by'} || 'date'
$el->{'by'}
Truth table50%1/2
A
A= $el->{'by'}
| |||||||||||||||||||||||||||||||||
| 892 | 2 | $el->{'by'} = $by; | |||||||||||||||||||||||||||||||
| 893 | } | ||||||||||||||||||||||||||||||||
| 894 | else | ||||||||||||||||||||||||||||||||
| 895 | { | ||||||||||||||||||||||||||||||||
| 896 | 0 | $el->{'counter'} = 0; | |||||||||||||||||||||||||||||||
| 897 | 0 | $el->{'unpublished_counter'} = 0; | |||||||||||||||||||||||||||||||
| 898 | 0 | $el->{'nocategory'} = 1; | |||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||
| 901 | elsif($el->{'type'} eq 'page') | ||||||||||||||||||||||||||||||||
| 902 | { | ||||||||||||||||||||||||||||||||
| 903 | 2 | my $total_elements = 0; | |||||||||||||||||||||||||||||||
| 904 | 2 | my $published_elements = 0; | |||||||||||||||||||||||||||||||
| 905 | 2 | foreach my $piece (@{$el->{'elements'}}) | |||||||||||||||||||||||||||||||
| 906 | { | ||||||||||||||||||||||||||||||||
| 907 | 4 | my $cat = Strehler::Meta::Category->explode_name($piece->{'category'}); | |||||||||||||||||||||||||||||||
| 908 | 4 | ▶ | $piece->{'entity'} ||= 'article'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$piece->{"entity"} ||= "article"
MC/DC0%0/1
$piece->{"entity"} ||= "article"
$piece->{"entity"}
Truth table50%1/2
A
A= $piece->{"entity"}
| |||||||||||||||||||||||||||||||||
| 909 | 4 | ▶ | if($cat->exists()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 910 | { | ||||||||||||||||||||||||||||||||
| 911 | 4 | $el->{'nocategory'} = 0; | |||||||||||||||||||||||||||||||
| 912 | 4 | $total_elements++; | |||||||||||||||||||||||||||||||
| 913 | 4 | my $class = Strehler::Helpers::class_from_entity($piece->{'entity'}); | |||||||||||||||||||||||||||||||
| 914 | 4 | ▶ | my $by = $piece->{'by'} || 'date'; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$piece->{'by'} || 'date'
MC/DC100%1/1
$piece->{'by'} || 'date'
$piece->{'by'}
Truth table100%2/2
A
A= $piece->{'by'}
| |||||||||||||||||||||||||||||||||
| 915 | 4 | $piece->{'by'} = $by; | |||||||||||||||||||||||||||||||
| 916 | 4 | my ($latest_published, $latest_unpublished) = $class->get_last_pubunpub($piece->{'category'}, $language, $by); | |||||||||||||||||||||||||||||||
| 917 | 4 | ▶ | if($latest_unpublished) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 918 | { | ||||||||||||||||||||||||||||||||
| 919 | 2 | my %latest_unpub_data = $latest_unpublished->get_ext_data($language); | |||||||||||||||||||||||||||||||
| 920 | 2 | $piece->{'latest_unpublished'} = \%latest_unpub_data; | |||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||
| 922 | else | ||||||||||||||||||||||||||||||||
| 923 | { | ||||||||||||||||||||||||||||||||
| 924 | 2 | $piece->{'latest_unpublished'} = undef; | |||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||
| 926 | 4 | ▶ | if($latest_published) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 927 | { | ||||||||||||||||||||||||||||||||
| 928 | 2 | $published_elements++; | |||||||||||||||||||||||||||||||
| 929 | 2 | my %latest_pub_data = $latest_published->get_ext_data($language); | |||||||||||||||||||||||||||||||
| 930 | 2 | $piece->{'latest_published'} = \%latest_pub_data; | |||||||||||||||||||||||||||||||
| 931 | } | ||||||||||||||||||||||||||||||||
| 932 | else | ||||||||||||||||||||||||||||||||
| 933 | { | ||||||||||||||||||||||||||||||||
| 934 | 2 | $piece->{'latest_published'} = undef; | |||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||
| 937 | else | ||||||||||||||||||||||||||||||||
| 938 | { | ||||||||||||||||||||||||||||||||
| 939 | 0 | $total_elements++; | |||||||||||||||||||||||||||||||
| 940 | 0 | $piece->{'nocategory'} = 1; | |||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||
| 943 | 2 | $el->{'published_elements'} = $published_elements; | |||||||||||||||||||||||||||||||
| 944 | 2 | $el->{'total_elements'} = $total_elements; | |||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||
| 947 | 2 | template "admin/dashboard", { language => $language, languages => \@languages, navbar => \%navbar, dashboard => config->{'Strehler'}->{'dashboard'}}; | |||||||||||||||||||||||||||||||
| 948 | 12 | }; | |||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||
| 950 | ### MESSAGES ### | ||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | get '/sys/warnings' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 953 | 0 | my @messages = (); | |||||||||||||||||||||||||||||||
| 954 | 0 | ▶ | if(! Strehler::Helpers::check_statics()) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 955 | { | ||||||||||||||||||||||||||||||||
| 956 | 0 | push @messages, "Strehler statics are not aligned with installed release. Run <strong>strehler statics</strong> to solve." | |||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||
| 958 | 0 | template "admin/warnings", { messages => \@messages, no_war => 1 }; | |||||||||||||||||||||||||||||||
| 959 | 12 | }; | |||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||
| 961 | =encoding utf8 | ||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||
| 963 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||
| 965 | Strehler::Admin - App holding the routes used by Strehler backend | ||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||
| 967 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||
| 969 | Strehler::Admin holds all the routes used by Strehler to erogate views. It also contains some helpers, mostly about form management, called inside routes. | ||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||
| 971 | The use of the L<Strehler::Dancer2::Plugin::Admin> makes all the routes to have /admin as prefix. | ||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||
| 973 | Routes have the structure: | ||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||
| 975 | /entity/action/id | ||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||
| 977 | Where B<entity> represent a L<Strehler::Element> class, action is usually a standard action of a CRUD interface and id (where needed) is the identifier of the object cosidered. | ||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||
| 979 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||
| 981 | Strehler::Admin is just a Dancer2 app so you need to add it to your bin/app.pl script to use it. | ||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||
| 983 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||
| 985 | use FindBin; | ||||||||||||||||||||||||||||||||
| 986 | use lib "$FindBin::Bin/../lib"; | ||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||
| 988 | use Site; | ||||||||||||||||||||||||||||||||
| 989 | use Strehler::Admin; | ||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||
| 991 | Site->dance; | ||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||
| 993 | Never add the C<use Strehler::Admin> line as the first App included to not mess with site directories (public, lib...) | ||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||
| 995 | =cut | ||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||
| 998 | 12 | 1; | |||||||||||||||||||||||||||||||