| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::DataTables::SSP::Params; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use Mojo::Base -base; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '2.01'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'columns'; |
|
8
|
|
|
|
|
|
|
has 'draw'; |
|
9
|
|
|
|
|
|
|
has 'length'; |
|
10
|
|
|
|
|
|
|
has 'order'; |
|
11
|
|
|
|
|
|
|
has 'search'; |
|
12
|
|
|
|
|
|
|
has 'columns'; |
|
13
|
|
|
|
|
|
|
has 'timestamp'; |
|
14
|
|
|
|
|
|
|
has 'start'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub db_columns { |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my @columns; |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
foreach ( @{ $self->columns } ) { |
|
|
0
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
push @columns, $_->database if ( $_->database ); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return @columns; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub db_order { |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $order = {}; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
foreach ( @{ $self->order } ) { |
|
|
0
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if ( $_->{column}->{database} ) { |
|
38
|
0
|
|
|
|
|
|
$order->{ $_->{column}->{database} } = $_->{dir}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $order; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding utf8 |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Mojolicious::Plugin::DataTables::SSP::Params - DataTables SSP Params Helper |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Mojolicious |
|
57
|
|
|
|
|
|
|
$self->plugin('DataTables'); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Mojolicious::Lite |
|
60
|
|
|
|
|
|
|
plugin 'DataTables'; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
[...] |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $dt_params = $c->datatable->ssp_params( |
|
65
|
|
|
|
|
|
|
[ |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
|
|
|
|
|
|
label => 'UID', |
|
68
|
|
|
|
|
|
|
db => 'uid', |
|
69
|
|
|
|
|
|
|
dt => 0, |
|
70
|
|
|
|
|
|
|
formatter => sub { |
|
71
|
|
|
|
|
|
|
my ($value, $column) = @_; |
|
72
|
|
|
|
|
|
|
return '' . $value . ''; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
|
|
|
|
|
|
label => 'e-Mail', |
|
77
|
|
|
|
|
|
|
db => 'mail', |
|
78
|
|
|
|
|
|
|
dt => 1, |
|
79
|
|
|
|
|
|
|
}, |
|
80
|
|
|
|
|
|
|
{ |
|
81
|
|
|
|
|
|
|
label => 'Status', |
|
82
|
|
|
|
|
|
|
db => 'status', |
|
83
|
|
|
|
|
|
|
dt => 2, |
|
84
|
|
|
|
|
|
|
}, |
|
85
|
|
|
|
|
|
|
] |
|
86
|
|
|
|
|
|
|
)); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L is a L plugin to add DataTables SSP (Server-Side Protocol) support in your Mojolicious application. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 CONTRUCTOR |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 Mojolicious::Plugin::DataTables::SSP::Params->new ( @options ) |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Create a new instance of L class. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Options: |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item C |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item C: Database column name |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item C: DataTable column ID |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item C: Formatter sub |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 METHODS |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L implements the following methods. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 columns |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 draw |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 length |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 order |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 search |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 columns |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 timestamp |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 start |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L, L, L, L, L. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 SUPPORT |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
|
146
|
|
|
|
|
|
|
at L. |
|
147
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 Source Code |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
|
152
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
git clone https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables.git |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 AUTHOR |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=over 4 |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * Giuseppe Di Terlizzi |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=back |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This software is copyright (c) 2020-2021 by Giuseppe Di Terlizzi. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
173
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
|
176
|
|
|
|
|
|
|
|