/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26