/[Arh]/lib/Arh/Model/Picture.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/Arh/Model/Picture.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 48 - (show annotations)
Sun Apr 6 16:09:03 2008 UTC (16 years ago) by dpavlin
File size: 1105 byte(s)
cleanup and tweaks for filename to endup in database
1 use strict;
2 use warnings;
3
4 package Arh::Model::Picture;
5 use Jifty::DBI::Schema;
6 use File::Find;
7 use Data::Dump qw/dump/;
8
9 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 =>
24 label is _("Part of campaign"),
25 refers_to Arh::Model::Campaign,
26 is mandatory,
27 is indexed,
28 since '0.0.4';
29
30 column type =>
31 label is _("Type of picture"),
32 refers_to Arh::Model::PictureType,
33 is mandatory,
34 is indexed,
35 since '0.0.4';
36
37 };
38
39 # Your model-specific methods go here.
40
41 sub all_filenames {
42
43 my @files;
44 my $path = Jifty::Util->app_root . '/share/web/static/pics';
45
46 # warn "## path = $path";
47
48 find({ wanted => sub {
49 my $f = $File::Find::name;
50 return unless -f $f;
51 push @files, $_;
52 }, follow => 0 }, $path);
53
54 # warn "## all_filenames = ",dump( @files );
55
56 return @files;
57 }
58
59 #use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
60
61 use Arh::DefaultACL;
62
63 1;
64

  ViewVC Help
Powered by ViewVC 1.1.26