/[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 53 - (show annotations)
Sun Apr 6 20:49:32 2008 UTC (11 years, 1 month ago) by dpavlin
File size: 1250 byte(s)
fix various bugs to make picture upload from unit page to work
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 render as 'Arh::Web::Form::Field::Upload',
22 is mandatory;
23
24 column campaign =>
25 label is _("Part of campaign"),
26 refers_to Arh::Model::Campaign,
27 is mandatory,
28 is indexed,
29 since '0.0.4';
30
31 column type =>
32 label is _("Type of picture"),
33 refers_to Arh::Model::PictureType,
34 is mandatory,
35 is indexed,
36 since '0.0.4';
37
38 column unit =>
39 label is _('Unit'),
40 refers_to Arh::Model::Unit,
41 is mandatory,
42 is indexed;
43
44 };
45
46 # Your model-specific methods go here.
47
48 sub all_filenames {
49
50 my @files;
51 my $path = Jifty::Util->app_root . '/share/web/static/pics';
52
53 # warn "## path = $path";
54
55 find({ wanted => sub {
56 my $f = $File::Find::name;
57 return unless -f $f;
58 push @files, $_;
59 }, follow => 0 }, $path);
60
61 # warn "## all_filenames = ",dump( @files );
62
63 return @files;
64 }
65
66 #use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
67
68 use Arh::DefaultACL;
69
70 1;
71

  ViewVC Help
Powered by ViewVC 1.1.26