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
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.02'; |
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
|
|
|
|
|
|
|
=cut |