« blib/lib/OpusVL/AppKit/Plugin/AppKitControllerSorter.pm
↑ Summary
blib/lib/OpusVL/AppKit/RolesFor/Schema/AppKitAuthDB/Result/User.pm »
| 1 | package OpusVL::AppKit::RolesFor::Controller::GUI; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | ################################################################################################################################## | ||||||||||||||||||||||||||||
| 5 | # use lines. | ||||||||||||||||||||||||||||
| 6 | ################################################################################################################################## | ||||||||||||||||||||||||||||
| 7 | 17 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 17 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | ################################################################################################################################## | ||||||||||||||||||||||||||||
| 11 | # moose calls. | ||||||||||||||||||||||||||||
| 12 | ################################################################################################################################## | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 17 | has appkit => ( is => 'ro', isa => 'Int', default => 1 ); | |||||||||||||||||||||||||||
| 15 | 17 | has appkit_name => ( is => 'rw', isa => 'Str', default => 'AppKit' ); | |||||||||||||||||||||||||||
| 16 | 17 | has appkit_myclass => ( is => 'ro', isa => 'Str', ); | |||||||||||||||||||||||||||
| 17 | 17 | has appkit_shared_module => ( is => 'rw', isa => 'Str'); | |||||||||||||||||||||||||||
| 18 | 17 | has navigation_items_merged => ( is => 'rw', isa => 'Bool', default => 0 ); | |||||||||||||||||||||||||||
| 19 | 17 | has appkit_method_group_order => ( is => 'rw', isa => 'Int', default => 0); | |||||||||||||||||||||||||||
| 20 | 17 | has appkit_method_group => ( is => 'rw', isa => 'Str', default => ''); | |||||||||||||||||||||||||||
| 21 | 17 | has appkit_order => ( is => 'rw', isa => 'Int', default => 0); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 17 | has _default_order => ( is => 'rw', isa => 'Int', default => 0); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 17 | has home_action => ( is => 'rw', isa => 'HashRef' ); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 114 | ▶ | has navigation_actions => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 114 | ▶ | has navigation_actions_grouped => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 114 | ▶ | has portlet_actions => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 114 | ▶ | has search_actions => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | before create_action => sub | ||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||
| 43 | 976 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=15 SCAR=31.3
| |||||||||||||||||||||||||||||
| 44 | 976 | my %args = @_; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # add any ActionClass's to this action.. so when it is called, some extra code is excuted.... | ||||||||||||||||||||||||||||
| 47 | 976 | ▶ | if ( defined $args{attributes}{AppKitForm} ) { push @{ $args{attributes}{ActionClass} }, "OpusVL::AppKit::Action::AppKitForm"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 976 | ▶ | if ( defined $args{attributes}{NavigationHome} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||
| 51 | # This action has been identified as a Home action... | ||||||||||||||||||||||||||||
| 52 | $self->home_action | ||||||||||||||||||||||||||||
| 53 | ( | ||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | actionpath => $args{reverse}, | ||||||||||||||||||||||||||||
| 56 | actionname => $args{name}, | ||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 24 | ); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 976 | ▶ | if ( defined $args{attributes}{NavigationName} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | # This action has been identified as a Navigation item.. | ||||||||||||||||||||||||||||
| 64 | 120 | my $array = $self->navigation_actions; | |||||||||||||||||||||||||||
| 65 | 120 | ▶ | $array = [] unless defined $array; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 120 | $self->_default_order($self->_default_order+1); | |||||||||||||||||||||||||||
| 67 | 120 | my $order; | |||||||||||||||||||||||||||
| 68 | 120 | ▶ | if(defined $args{attributes}{NavigationOrder}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||
| 70 | 16 | $order = $args{attributes}{NavigationOrder}->[0] | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | else | ||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||
| 74 | 104 | $order = $self->_default_order; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 120 | my $hide = {}; | |||||||||||||||||||||||||||
| 78 | 120 | ▶ | if ($args{attributes}{Hide}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | my ($key, $value) = split(':', $args{attributes}{Hide}->[0]); | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ($key && $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key and $value
MC/DC0%0/2
$key and $value
$key
$value
Truth table0%0/3
A and B
A= $keyB= $value
| |||||||||||||||||||||||||||||
| 81 | 0 | $hide = { | |||||||||||||||||||||||||||
| 82 | hidden => 1, | ||||||||||||||||||||||||||||
| 83 | as => $key, | ||||||||||||||||||||||||||||
| 84 | with => $value | ||||||||||||||||||||||||||||
| 85 | }; | ||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | push | ||||||||||||||||||||||||||||
| 90 | ( | ||||||||||||||||||||||||||||
| 91 | @$array, | ||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||
| 93 | value => $args{attributes}{NavigationName}->[0], | ||||||||||||||||||||||||||||
| 94 | actionpath => $args{reverse}, | ||||||||||||||||||||||||||||
| 95 | actionname => $args{name}, | ||||||||||||||||||||||||||||
| 96 | title => $args{attributes}{Description}->[0], | ||||||||||||||||||||||||||||
| 97 | controller => $self, | ||||||||||||||||||||||||||||
| 98 | sort_index => $order, | ||||||||||||||||||||||||||||
| 99 | hide_as => $hide->{as}||0, | ||||||||||||||||||||||||||||
| 100 | 120 | ▶ | hide_with => $hide->{with}||0, | ||||||||||||||||||||||||||
|
Condition50%2/4
$hide->{'as'} || 0
$hide->{'with'} || 0
MC/DC0%0/1
$hide->{'as'} || 0
$hide->{'as'}
MC/DC0%0/1
$hide->{'with'} || 0
$hide->{'with'}
Truth table50%1/2
A
A= $hide->{'as'}
Truth table50%1/2
A
A= $hide->{'with'}
| |||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 120 | $self->navigation_actions( $array ); | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 976 | ▶ | if ( defined $args{attributes}{PortletName} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||
| 109 | # This action has been identified as a Portlet action... | ||||||||||||||||||||||||||||
| 110 | 8 | my $array = $self->portlet_actions; | |||||||||||||||||||||||||||
| 111 | 8 | ▶ | $array = [] unless defined $array; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | push | ||||||||||||||||||||||||||||
| 113 | ( | ||||||||||||||||||||||||||||
| 114 | @$array, | ||||||||||||||||||||||||||||
| 115 | { | ||||||||||||||||||||||||||||
| 116 | value => $args{attributes}{PortletName}->[0], | ||||||||||||||||||||||||||||
| 117 | actionpath => $args{reverse}, | ||||||||||||||||||||||||||||
| 118 | actionname => $args{name}, | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 8 | ); | |||||||||||||||||||||||||||
| 121 | 8 | $self->portlet_actions ( $array ); | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 976 | ▶ | if ( defined $args{attributes}{SearchName} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||
| 126 | # This action has been identified as a Search action... | ||||||||||||||||||||||||||||
| 127 | 0 | my $array = $self->search_actions; | |||||||||||||||||||||||||||
| 128 | 0 | ▶ | $array = [] unless defined $array; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | push | ||||||||||||||||||||||||||||
| 130 | ( | ||||||||||||||||||||||||||||
| 131 | @$array, | ||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||
| 133 | value => $args{attributes}{SearchName}->[0], | ||||||||||||||||||||||||||||
| 134 | actionpath => $args{reverse}, | ||||||||||||||||||||||||||||
| 135 | actionname => $args{name}, | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | 0 | ); | |||||||||||||||||||||||||||
| 138 | 0 | $self->search_actions ( $array ); | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | 17 | }; | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | sub intranet_action_list | ||||||||||||||||||||||||||||
| 143 | { | ||||||||||||||||||||||||||||
| 144 | 40 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
intranet_action_list: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 145 | 40 | my $c = shift; | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 40 | my $actions = $self->navigation_actions; | |||||||||||||||||||||||||||
| 148 | 40 | return $self->_sorted_filtered_actions($c, $actions); | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | sub _sorted_filtered_actions | ||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||
| 153 | 46 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_sorted_filtered_actions: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 154 | 46 | my $c = shift; | |||||||||||||||||||||||||||
| 155 | 46 | my $actions = shift; | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 46 | ▶ | return [] if !$actions; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 12 | my @actions = sort { $a->{sort_index} <=> $b->{sort_index} } | |||||||||||||||||||||||||||
| 159 | 46 | grep { $c->can_access($_->{controller}->action_for($_->{actionname})) } @$actions; | |||||||||||||||||||||||||||
| 160 | 46 | return \@actions; | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | sub application_action_list | ||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||
| 165 | # this list includes groups too. | ||||||||||||||||||||||||||||
| 166 | 22 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
application_action_list: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 167 | 22 | my $c = shift; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 22 | my $grouped_actions = $self->navigation_actions_grouped; | |||||||||||||||||||||||||||
| 170 | 22 | ▶ | return [] if !$grouped_actions; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 22 | my @groups; | |||||||||||||||||||||||||||
| 172 | 22 | for my $group (@$grouped_actions) | |||||||||||||||||||||||||||
| 173 | { | ||||||||||||||||||||||||||||
| 174 | 6 | my $filtered = $self->_sorted_filtered_actions($c, $group->{actions}); | |||||||||||||||||||||||||||
| 175 | 6 | ▶ | push @groups, { group => $group->{group}, actions => $filtered } if @$filtered; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | 22 | return \@groups; | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | ################################################################################################################################## | ||||||||||||||||||||||||||||
| 182 | # controller actions. | ||||||||||||||||||||||||||||
| 183 | ################################################################################################################################## | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | sub date_long | ||||||||||||||||||||||||||||
| 186 | { | ||||||||||||||||||||||||||||
| 187 | 51 | ▶ | my ($self, $dt) = @_; | ||||||||||||||||||||||||||
|
Subroutine
date_long: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 51 | ▶ | return if !$dt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 42 | return join '', | |||||||||||||||||||||||||||
| 191 | $dt->day_name, | ||||||||||||||||||||||||||||
| 192 | ', ', | ||||||||||||||||||||||||||||
| 193 | sprintf("%02d ",$dt->day), | ||||||||||||||||||||||||||||
| 194 | $dt->month_name, | ||||||||||||||||||||||||||||
| 195 | ' ', | ||||||||||||||||||||||||||||
| 196 | $dt->year; | ||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | sub date_short | ||||||||||||||||||||||||||||
| 200 | { | ||||||||||||||||||||||||||||
| 201 | 1 | ▶ | my ($self, $dt) = @_; | ||||||||||||||||||||||||||
|
Subroutine
date_short: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 202 | 1 | ▶ | return if !$dt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | 1 | return join '', | |||||||||||||||||||||||||||
| 204 | sprintf("%02d", $dt->day), | ||||||||||||||||||||||||||||
| 205 | '-', | ||||||||||||||||||||||||||||
| 206 | $dt->month_abbr, | ||||||||||||||||||||||||||||
| 207 | '-', | ||||||||||||||||||||||||||||
| 208 | $dt->year; | ||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | sub time_long | ||||||||||||||||||||||||||||
| 212 | { | ||||||||||||||||||||||||||||
| 213 | 1 | ▶ | my ($self, $dt) = @_; | ||||||||||||||||||||||||||
|
Subroutine
time_long: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 214 | 1 | ▶ | return if !$dt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 1 | return join '', | |||||||||||||||||||||||||||
| 217 | sprintf('%02d', $dt->hour), | ||||||||||||||||||||||||||||
| 218 | ':', | ||||||||||||||||||||||||||||
| 219 | sprintf('%02d', $dt->minute), | ||||||||||||||||||||||||||||
| 220 | ':', | ||||||||||||||||||||||||||||
| 221 | sprintf('%02d', $dt->second); | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | sub time_short | ||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||
| 227 | 1 | ▶ | my ($self, $dt) = @_; | ||||||||||||||||||||||||||
|
Subroutine
time_short: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 228 | 1 | ▶ | return if !$dt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 1 | return join '', | |||||||||||||||||||||||||||
| 231 | sprintf('%02d', $dt->hour), | ||||||||||||||||||||||||||||
| 232 | ':', | ||||||||||||||||||||||||||||
| 233 | sprintf('%02d', $dt->minute); | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | sub add_breadcrumb | ||||||||||||||||||||||||||||
| 239 | { | ||||||||||||||||||||||||||||
| 240 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
add_breadcrumb: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 241 | 0 | my $c = shift; | |||||||||||||||||||||||||||
| 242 | 0 | my $args = shift; | |||||||||||||||||||||||||||
| 243 | 0 | push @{$c->stash->{breadcrumbs}}, $args; | |||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | sub add_final_crumb | ||||||||||||||||||||||||||||
| 248 | { | ||||||||||||||||||||||||||||
| 249 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
add_final_crumb: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 250 | 0 | my $c = shift; | |||||||||||||||||||||||||||
| 251 | 0 | my $title = shift; | |||||||||||||||||||||||||||
| 252 | 0 | push @{$c->stash->{breadcrumbs}}, { name => $title, url => $c->req->uri }; | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | sub flag_callback_error | ||||||||||||||||||||||||||||
| 257 | { | ||||||||||||||||||||||||||||
| 258 | 0 | ▶ | my ($self, $c, $field_name, $message) = @_; | ||||||||||||||||||||||||||
|
Subroutine
flag_callback_error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 259 | 0 | return $self->flag_callback_error_ex($c, $field_name, { message => $message }); | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | sub flag_callback_error_ex | ||||||||||||||||||||||||||||
| 263 | { | ||||||||||||||||||||||||||||
| 264 | 0 | ▶ | my ($self, $c, $field_name, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
flag_callback_error_ex: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 0 | ▶ | $args //= {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args //= {}
MC/DC0%0/1
$args //= {}
$args
Truth table0%0/2
A
A= $args
| |||||||||||||||||||||||||||||
| 267 | 0 | my $message = $args->{message}; | |||||||||||||||||||||||||||
| 268 | 0 | my $no_detach = $args->{no_detach}; | |||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 0 | my $form = $c->stash->{form}; | |||||||||||||||||||||||||||
| 271 | 0 | my $constraint = $form->get_field($field_name)->get_constraint({ type => 'Callback' }); | |||||||||||||||||||||||||||
| 272 | 0 | ▶ | $constraint->callback(sub { 0}); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 273 | 0 | ▶ | $constraint->message($message) if $message; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | 0 | $form->process; | |||||||||||||||||||||||||||
| 275 | 0 | ▶ | $c->detach unless $no_detach; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | ## | ||||||||||||||||||||||||||||
| 279 | 17 | 1; | |||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | __END__ | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | =pod | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head1 NAME | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | OpusVL::AppKit::RolesFor::Controller::GUI | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | =head1 VERSION | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | version 2.24 | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | package MyApp::Controller::SomeFunkyThing; | ||||||||||||||||||||||||||||
| 298 | use Moose; | ||||||||||||||||||||||||||||
| 299 | BEGIN{ extends 'Catalyst::Controller' }; | ||||||||||||||||||||||||||||
| 300 | with 'OpusVL::AppKit::RolesFor::Controller::GUI'; | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | __PACKAGE__->config( appkit_name => 'My Funky App' ); | ||||||||||||||||||||||||||||
| 303 | __PACKAGE__->config( appkit_icon => 'static/funkster/me.gif' ); | ||||||||||||||||||||||||||||
| 304 | __PACKAGE__->config( appkit_myclass => 'MyApp' ); | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | sub index | ||||||||||||||||||||||||||||
| 307 | :Path | ||||||||||||||||||||||||||||
| 308 | :Args(0) | ||||||||||||||||||||||||||||
| 309 | :NavigationHome | ||||||||||||||||||||||||||||
| 310 | :NavigationName("Funky Home") | ||||||||||||||||||||||||||||
| 311 | :PortletName("Funky Portlet") | ||||||||||||||||||||||||||||
| 312 | :AppKitForm | ||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||
| 314 | # .. do some funky stuff .. | ||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | If you use this Moose::Role with a controller it can be intergrated into the OpusVL::AppKit. | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | You can just do: | ||||||||||||||||||||||||||||
| 322 | use Moose; | ||||||||||||||||||||||||||||
| 323 | with 'OpusVL::AppKit::RolesFor::Controller::GUI'; | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | Give your Controller a name within the GUI: | ||||||||||||||||||||||||||||
| 326 | __PACKAGE__->config( appkit_name => 'Some Name' ); | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | To make use of the additional features you will have to use one of the following | ||||||||||||||||||||||||||||
| 329 | action method attributes: | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | NavigationHome | ||||||||||||||||||||||||||||
| 332 | This tells the GUI this action is the 'Home' action for this controller. | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | NavigationName | ||||||||||||||||||||||||||||
| 335 | Tells the GUI this action is a navigation item and what its name should be. | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | PortletName | ||||||||||||||||||||||||||||
| 338 | Tells the GUI this action is a portlet action, so calling is only garented to fill | ||||||||||||||||||||||||||||
| 339 | out the 'portlet' stash key. | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | AppKitForm | ||||||||||||||||||||||||||||
| 342 | Behaves like FormConfig option in FormFu Controller, except it loads form from the | ||||||||||||||||||||||||||||
| 343 | ShareDir of namespace passed in 'appkit_myclass' | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | SearchName | ||||||||||||||||||||||||||||
| 346 | Tells the GUI this action is a search action and what its name should be | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | =head1 NAME | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | OpusVL::AppKit::RolesFor::Controller::GUI - Role for Controllers wanting to interact with AppKit | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | =head1 METHODS | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =head2 home_action | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | This should be the hash of action details that pertain the the 'home action' of a controller. | ||||||||||||||||||||||||||||
| 357 | If there is none defined for a controller, it should be undef. | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | =head2 navigation_actions | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | This should be an Array Ref of HashRef's pertaining the actions that make up the navigation | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | =head2 navigation_actions_grouped | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | This should be an Array Ref of HashRef's pertaining the actions that make up the navigation | ||||||||||||||||||||||||||||
| 366 | grouped by appkit_method_group. | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | =head2 portlet_actions | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | This should be an Array Ref of HashRef's pertaining the actions that are Portlet's | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | =head2 search_actions | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | This should be an Array Ref of HashRef's pertaining the actions that are Portlet's | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | =head2 create_action | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | Hook into the creation of the actions. | ||||||||||||||||||||||||||||
| 379 | Here we read the action attributes and act accordingly. | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | =head2 intranet_action_list | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | Returns a sorted list of actions for the menu filtered by what the user can access. | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =head2 application_action_list | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | Returns a sorted list of actions for the menu filtered by what the user can access. | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | It returns a list of hashes containing two keys, group (the group name) and actions, a list of | ||||||||||||||||||||||||||||
| 390 | the actions for that group. | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | =head2 date_long | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | Provides a standard L<DateTime> formatting function that is also mirrored (and called) from TT using | ||||||||||||||||||||||||||||
| 395 | the date_long() function. | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | Monday, 10 May 2010 | ||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | =head2 date_short | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | Provides a short date format function for DD-MM-YYYY display. | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | =head2 time_long | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | Provides a long time format function, HH:MM:SS | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | =head2 time_short | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | Provides a short time format function, HH:MM | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | =head2 add_breadcrumb | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | Adds the a breadcrumb on your breadcrumb trial. Pass it the context object and the breadcumb info, | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | $self->add_breadcrumb($c, { name => 'Title', url => $search_url }); | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | =head2 add_final_crumb | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | Adds the final breadcrumb on your trial. Simply pass it the title of the breadcrumb. | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | $self->add_final_crumb($c, 'Title'); | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | =head2 flag_callback_error | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | Flags an HTML::FormFu callback error. | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | Setup a callback constraint on your form, | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | - type: Text | ||||||||||||||||||||||||||||
| 430 | name: project | ||||||||||||||||||||||||||||
| 431 | label: Project | ||||||||||||||||||||||||||||
| 432 | constraints: | ||||||||||||||||||||||||||||
| 433 | - type: Callback | ||||||||||||||||||||||||||||
| 434 | message: Project is invalid | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | Then within your controller you can do, | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | $self->flag_callback_error($c, 'project'); | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | This will terminate the processing of the action too, by doing a $c->detach; | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | L<CatalystX::AppBuilder>, | ||||||||||||||||||||||||||||
| 445 | L<OpusVL::AppKit>, | ||||||||||||||||||||||||||||
| 446 | L<Catalyst> | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | OpusVL - www.opusvl.com | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | This software is copyright (c) 2010 by OpusVL - www.opusvl.com. | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 457 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | =cut | ||||||||||||||||||||||||||||