8 |
|
|
9 |
use Arh::Record schema { |
use Arh::Record schema { |
10 |
|
|
11 |
|
column filename => |
12 |
|
label is _("Picture filename"); |
13 |
|
# is immutable, |
14 |
|
# is indexed, |
15 |
|
# is unique; |
16 |
|
|
17 |
|
column content => |
18 |
|
label is _('Picture'), |
19 |
|
type is 'bytea', |
20 |
|
render as 'Upload', |
21 |
|
is mandatory; |
22 |
|
|
23 |
column campaign => |
column campaign => |
24 |
label is _("Part of campaign"), |
label is _("Part of campaign"), |
25 |
refers_to Arh::Model::Campaign, |
refers_to Arh::Model::Campaign, |
26 |
is required, |
is mandatory, |
27 |
is indexed, |
is indexed, |
28 |
since '0.0.4'; |
since '0.0.4'; |
29 |
|
|
|
column filename => |
|
|
label is _("Picture filename"), |
|
|
is required, |
|
|
is indexed, |
|
|
is unique; |
|
|
|
|
30 |
column type => |
column type => |
31 |
label is _("Type of picture"), |
label is _("Type of picture"), |
32 |
refers_to Arh::Model::PictureType, |
refers_to Arh::Model::PictureType, |
33 |
is required, |
is mandatory, |
34 |
is indexed, |
is indexed, |
35 |
since '0.0.4'; |
since '0.0.4'; |
36 |
|
|
45 |
my @files; |
my @files; |
46 |
my $path = Jifty::Util->app_root . '/share/web/static/pics'; |
my $path = Jifty::Util->app_root . '/share/web/static/pics'; |
47 |
|
|
48 |
warn "## path = $path"; |
# warn "## path = $path"; |
49 |
|
|
50 |
find({ wanted => sub { |
find({ wanted => sub { |
51 |
my $f = $File::Find::name; |
my $f = $File::Find::name; |
53 |
push @files, $_; |
push @files, $_; |
54 |
}, follow => 0 }, $path); |
}, follow => 0 }, $path); |
55 |
|
|
56 |
warn "## all_filenames = ",dump( @files ); |
# warn "## all_filenames = ",dump( @files ); |
57 |
|
|
58 |
return @files; |
return @files; |
59 |
} |
} |
60 |
|
|
61 |
#use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
#use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
62 |
|
|
63 |
sub current_user_can { |
use Arh::DefaultACL; |
|
my ( $self, $action,$item,$name ) = @_; |
|
|
return 1 if $self->current_user->superuser || $self->current_user->administrator; |
|
|
return 1 if $action eq 'read'; |
|
|
return 0; |
|
|
} |
|
64 |
|
|
65 |
1; |
1; |
66 |
|
|