| 1 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # lib/JPList/Request.pm - JPList Request parser module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Copyright (C) 2017 Exceleron Software, LLC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | package JPList::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use URI::Escape; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | with 'JPList::Controls::Filter'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | with 'JPList::Controls::Sort'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | JPList::Request - JPList Request parser module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | use JPList::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | my $jplist_req = JPList::Request->new(request_params => $self->request_params); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | The JPList::Request module allows you to decode the request params with all the controls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | =head2 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | has 'request_params' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | isa => 'Str' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | has 'request_data' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | builder => '_decode_request_params', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | clearer => 'clear_request_data' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | has 'filter_attrs' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | isa => 'HashRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | has 'filter_data' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | isa => 'ArrayRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | has 'sort_data' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | isa => 'ArrayRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | has 'pagination_data' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | isa => 'HashRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | has 'is_download' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | default => 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | =head2 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | =item C<decode_data> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | Params : $statuses_request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | Returns: NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | Desc : decode the request params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | sub decode_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_data: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if (ref($self->request_data) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->_store_status_list($self->request_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | =item C<_decode_request_params> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | Params : $self->request_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | Returns: Data structure of formatted request data structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | Desc : decode params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | sub _decode_request_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_request_params: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | return decode_json(uri_unescape($self->request_params)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | =item C<_store_status_list> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | Params : Request Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | Returns: NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | Desc : parses the list of unique actions and computes filter, sort and pagination data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | sub _store_status_list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | my ($self, $statuses_request) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_store_status_list: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | foreach my $status_req (@$statuses_request) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $action = $status_req->{'action'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | push(@{$self->{'status_list'}->{$action}}, $status_req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $self->_get_filter_data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $self->_get_sort_data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $self->_get_pagination_data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ## Clear unwanted attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $self->clear_request_data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | delete($self->{'status_list'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | =item C<_get_filter_data> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | Params : NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | Returns: NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | Desc : private function to parse filter data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | sub _get_filter_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_filter_data: not called CC=20 SCAR=60.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my @filter_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # This is used to store the values of filter by column name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # Eg: $jplist->jplist_request->filter_attrs->{'ServiceType'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | my %filter_attrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | foreach my $filter_vals (@{$self->{'status_list'}->{'filter'}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if ($filter_vals->{'type'} eq 'textbox') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $filter_result = $self->textbox($filter_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if (defined $filter_result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | push(@filter_data, $filter_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $filter_attrs{$filter_result->{'column'}} = $filter_result->{'value'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | elsif ($filter_vals->{'type'} eq 'filter-drop-down') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $filter_result = $self->filterdropdown($filter_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if (defined $filter_result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | push(@filter_data, $filter_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $filter_attrs{$filter_result->{'column'}} = $filter_result->{'value'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | elsif ($filter_vals->{'type'} eq 'filter-select') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $filter_result = $self->filterselect($filter_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if (defined $filter_result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | push(@filter_data, $filter_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $filter_attrs{$filter_result->{'column'}} = $filter_result->{'value'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | elsif ($filter_vals->{'type'} eq 'date-picker-range-filter') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $filter_result = $self->filterdaterange($filter_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if (defined $filter_result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | push(@filter_data, $filter_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $filter_attrs{$filter_result->{'column'}} = $filter_result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | elsif ($filter_vals->{'type'} eq 'date-picker-filter') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $filter_result = $self->filterdatepicker($filter_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if (defined $filter_result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | push(@filter_data, $filter_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $filter_attrs{$filter_result->{'column'}} = $filter_result->{'value'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | elsif ($filter_vals->{'type'} eq 'checkbox-group-filter') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $filter_result = $self->checkboxgroup($filter_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | if (defined $filter_result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | push(@filter_data, $filter_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $filter_attrs{$filter_result->{'column'}} = $filter_result->{'values'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ▶ | elsif ($filter_vals->{'type'} eq 'button-filter' and $filter_vals->{'name'} eq 'download') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$filter_vals->{"type"} eq "button-filter" and $filter_vals->{"name"} eq "download"
MC/DC0%0/2
$filter_vals->{"type"} eq "button-filter" and $filter_vals->{"name"} eq "download"
$filter_vals->{"type"} eq "button-filter"
$filter_vals->{"name"} eq "download"
Truth table0%0/3
A and B
A= $filter_vals->{"type"} eq "button-filter"B= $filter_vals->{"name"} eq "download"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | print STDERR "[jplist info] download request filter called\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my $data = $filter_vals->{'data'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | if ( exists($data->{'filterType'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
exists $data->{"filterType"} and $data->{"filterType"} eq "path" and exists $data->{"path"} and $data->{"path"} eq ".download"
exists $data->{"filterType"} and $data->{"filterType"} eq "path" and exists $data->{"path"}
exists $data->{"filterType"} and $data->{"filterType"} eq "path"
MC/DC0%0/4
exists $data->{"filterType"} and $data->{"filterType"} eq "path" and exists $data->{"path"} and $data->{"path"} eq ".download"
exists $data->{"filterType"}
$data->{"filterType"} eq "path"
exists $data->{"path"}
$data->{"path"} eq ".download"
Truth table0%0/5
A and B and C and D
A= exists $data->{"filterType"}B= $data->{"filterType"} eq "path"C= exists $data->{"path"}D= $data->{"path"} eq ".download"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | and ($data->{'filterType'} eq 'path') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | and exists($data->{'path'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | and ($data->{'path'} eq '.download')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->is_download(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->filter_data(\@filter_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->filter_attrs(\%filter_attrs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | =item C<_get_sort_data> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | Params : NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | Returns: NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | Desc : private functiont to parse sort data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | sub _get_sort_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_sort_data: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my @sort_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | foreach my $sort_vals (@{$self->{'status_list'}->{'sort'}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if ($sort_vals->{'type'} eq 'sort-drop-down') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $sort_result = $self->sortdropdown($sort_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | push(@sort_data, $sort_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | elsif ($sort_vals->{'type'} eq 'sort-select') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $sort_result = $self->sortselect($sort_vals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | push(@sort_data, $sort_result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $self->sort_data(\@sort_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | =item C<_get_pagination_data> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | Params : NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | Returns: NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | Desc : private functiont to parse pagination data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | sub _get_pagination_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_pagination_data: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $pagination_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | foreach my $paging_vals (@{$self->{'status_list'}->{'paging'}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $data = $paging_vals->{'data'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | if ($data) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if ($data->{'currentPage'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $pagination_data->{'currentPage'} = $data->{'currentPage'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if ($data->{'number'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $pagination_data->{'number'} = $data->{'number'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $self->pagination_data($pagination_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | Sheeju Alex, <sheeju@exceleron.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | https://github.com/sheeju/JPList/issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | perldoc JPList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=JPList> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | L<http://annocpan.org/dist/JPList> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | L<http://cpanratings.perl.org/d/JPList> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | L<http://search.cpan.org/dist/JPList/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | Development time supported by Exceleron L<www.exceleron.com|http://www.exceleron.com>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | Copyright (C) 2017 Exceleron Software, LLC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | copy of the full license at: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | Any use, modification, and distribution of the Standard or Modified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | or distribute the Package, if you do not accept this license. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | If your Modified Version has been derived from a Modified Version made | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | by someone other than you, you are nevertheless required to ensure that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | your Modified Version complies with the requirements of this license. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | This license does not grant you the right to use any trademark, service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | mark, tradename, or logo of the Copyright Holder. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | otherwise transfer the Package with respect to any patent claims | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | counterclaim) against any party alleging that the Package constitutes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | direct or contributory patent infringement, then this Artistic License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | to you shall terminate on the date that such litigation is filed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # vim: ts=4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # vim600: fdm=marker fdl=0 fdc=3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||