| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
1275
|
use utf8; |
|
|
2
|
|
|
|
|
11
|
|
|
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Interchange6::Schema::Result::Media; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Interchange6::Schema::Result::Media |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
|
|
16
|
use Interchange6::Schema::Candy -components => |
|
12
|
2
|
|
|
2
|
|
109
|
[qw(InflateColumn::DateTime TimeStamp)]; |
|
|
2
|
|
|
|
|
6
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 media_id |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Primary key. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
primary_column media_id => { |
|
23
|
|
|
|
|
|
|
data_type => "integer", |
|
24
|
|
|
|
|
|
|
is_auto_increment => 1, |
|
25
|
|
|
|
|
|
|
sequence => "media_media_id_seq", |
|
26
|
|
|
|
|
|
|
}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 file |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The image/video file. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Is nullable. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
unique_column file => { |
|
37
|
|
|
|
|
|
|
data_type => "varchar", |
|
38
|
|
|
|
|
|
|
size => 255, |
|
39
|
|
|
|
|
|
|
is_nullable => 1, |
|
40
|
|
|
|
|
|
|
}; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 uri |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The image/video uri. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Defaults to empty string. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
column uri => { |
|
51
|
|
|
|
|
|
|
data_type => "varchar", |
|
52
|
|
|
|
|
|
|
default_value => "", |
|
53
|
|
|
|
|
|
|
size => 255 |
|
54
|
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 mime_type |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Mime type. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Defaults to empty string. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
column mime_type => { |
|
65
|
|
|
|
|
|
|
data_type => "varchar", |
|
66
|
|
|
|
|
|
|
default_value => "", |
|
67
|
|
|
|
|
|
|
size => 255 |
|
68
|
|
|
|
|
|
|
}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 label |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Label. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Defaults to empty string. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
column label => { |
|
79
|
|
|
|
|
|
|
data_type => "varchar", |
|
80
|
|
|
|
|
|
|
default_value => "", |
|
81
|
|
|
|
|
|
|
size => 255 |
|
82
|
|
|
|
|
|
|
}; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 author_users_id |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
FK on L<Interchange6::Schema::Result::User/users_id>. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
column author_users_id => |
|
91
|
|
|
|
|
|
|
{ data_type => "integer", is_nullable => 1 }; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 created |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Date and time when this record was created returned as L<DateTime> object. |
|
96
|
|
|
|
|
|
|
Value is auto-set on insert. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
column created => |
|
101
|
|
|
|
|
|
|
{ data_type => "datetime", set_on_create => 1 }; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 last_modified |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Date and time when this record was last modified returned as L<DateTime> object. |
|
106
|
|
|
|
|
|
|
Value is auto-set on insert and update. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
column last_modified => { |
|
111
|
|
|
|
|
|
|
data_type => "datetime", |
|
112
|
|
|
|
|
|
|
set_on_create => 1, |
|
113
|
|
|
|
|
|
|
set_on_update => 1, |
|
114
|
|
|
|
|
|
|
}; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 active |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Boolean whether media is active. Defaults to true (1). |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
column active => |
|
123
|
|
|
|
|
|
|
{ data_type => "boolean", default_value => 1 }; |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 media_types_id |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
FK on L<Interchange6::Schema::Result::MediaType/media_types_id>. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
column media_types_id => |
|
132
|
|
|
|
|
|
|
{ data_type => "integer" }; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 priority |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Priority for display. Defaults to 0. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
column priority => { data_type => "integer", default_value => 0 }; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 UNIQUE CONSTRAINTS |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 C<media_id_media_types_id_unique> |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over 4 |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * L</media_id> |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * L</media_types_id> |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=back |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
unique_constraint media_id_media_types_id_unique => |
|
157
|
|
|
|
|
|
|
[ "media_id", "media_types_id" ]; |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 RELATIONS |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 author |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Type: belongs_to |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::User> |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
belongs_to |
|
170
|
|
|
|
|
|
|
author => "Interchange6::Schema::Result::User", |
|
171
|
|
|
|
|
|
|
{ "foreign.users_id" => "self.author_users_id" }, |
|
172
|
|
|
|
|
|
|
{ join_type => "left" }; |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 media_type |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Type: belongs_to |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::MediaType> |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
belongs_to |
|
183
|
|
|
|
|
|
|
media_type => "Interchange6::Schema::Result::MediaType", |
|
184
|
|
|
|
|
|
|
"media_types_id", |
|
185
|
|
|
|
|
|
|
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }; |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 media_products |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Type: has_many |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::MediaProduct> |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=cut |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
has_many |
|
196
|
|
|
|
|
|
|
media_products => "Interchange6::Schema::Result::MediaProduct", |
|
197
|
|
|
|
|
|
|
"media_id", |
|
198
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 media_navigations |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Type: has_many |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::MediaNavigation> |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
has_many |
|
209
|
|
|
|
|
|
|
media_navigations => "Interchange6::Schema::Result::MediaNavigation", |
|
210
|
|
|
|
|
|
|
"media_id", |
|
211
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 media_messages |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Type: has_many |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::MediaMessage> |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
has_many |
|
222
|
|
|
|
|
|
|
media_messages => "Interchange6::Schema::Result::MediaMessage", |
|
223
|
|
|
|
|
|
|
"media_id", |
|
224
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 products |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Type: many_to_many with product. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
many_to_many products => "media_products", "product"; |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head2 displays |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Type: many_to_many with media_displays |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=cut |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
many_to_many displays => "media_type", "media_displays"; |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 METHODS |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 type |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Return the media type looking into MediaDisplay and MediaType. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=cut |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub type { |
|
251
|
6
|
|
|
6
|
1
|
245701
|
my $self = shift; |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
# here we return just the first result. UNCLEAR if more are |
|
254
|
|
|
|
|
|
|
# needed, but has many... Either we |
|
255
|
6
|
|
|
|
|
182
|
return $self->media_type->type; |
|
256
|
|
|
|
|
|
|
} |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 display_uris |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Return an hashref with the media display type and the final uri. |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub display_uris { |
|
265
|
6
|
|
|
6
|
1
|
11122
|
my $self = shift; |
|
266
|
6
|
|
|
|
|
11
|
my %uris; |
|
267
|
6
|
|
|
|
|
21
|
foreach my $d ( $self->displays ) { |
|
268
|
14
|
|
|
|
|
48841
|
my $path = $d->path; |
|
269
|
14
|
|
|
|
|
208
|
$path =~ s!/$!!; # remove eventual trailing slash |
|
270
|
14
|
|
|
|
|
318
|
$uris{ $d->type } = $path . '/' . $self->uri; |
|
271
|
|
|
|
|
|
|
} |
|
272
|
6
|
|
|
|
|
248
|
return \%uris; |
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head2 display_uri('display_type') |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Return the uri for the display type (or undef if not found). |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub display_uri { |
|
282
|
3
|
|
|
3
|
1
|
3113
|
my ( $self, $type ) = @_; |
|
283
|
3
|
|
|
|
|
13
|
return $self->display_uris->{$type}; |
|
284
|
|
|
|
|
|
|
} |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
1; |