/[Arh]/lib/Arh/Model/Unit.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/Unit.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (hide annotations)
Thu Nov 29 17:17:16 2007 UTC (16 years, 5 months ago) by dpavlin
File size: 1367 byte(s)
added users/passowrds all over the place
1 dpavlin 2 use strict;
2     use warnings;
3    
4     package Arh::Model::Unit;
5     use Jifty::DBI::Schema;
6    
7     use Arh::Record schema {
8    
9     column name =>
10     type is 'text',
11     label is _("Name"),
12     is mandatory;
13    
14     column number =>
15     type is 'text',
16     label is _("Number"),
17     is mandatory;
18    
19 dpavlin 9 column campaign =>
20 dpavlin 10 label is _("Part of campaign"),
21 dpavlin 9 refers_to Arh::Model::Campaign,
22     is mandatory,
23     since '0.0.9';
24    
25 dpavlin 2 column dimensions =>
26     label is _("Dimensions"),
27     hit is _("Separate values with ; (semicolumn)"),
28     type is 'text';
29    
30     column position =>
31     label is _("Place of discovery"),
32     type is 'text';
33    
34     column description =>
35 dpavlin 8 label is _("Description"),
36     render as 'textarea';
37 dpavlin 2
38     column chronology =>
39     label is _("Chronology"),
40     refers_to Arh::Model::Chronology,
41     since '0.0.2';
42    
43     column location =>
44     label is _("Current location"),
45     refers_to Arh::Model::Location;
46    
47     };
48    
49 dpavlin 10 #use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
50    
51 dpavlin 2 # Your model-specific methods go here.
52    
53 dpavlin 8 sub material {
54     my $self = shift;
55     my $m = Arh::Model::UnitMaterialCollection->new;
56     $m->limit( column => 'unit', value => $self->id );
57     return $m;
58     }
59    
60 dpavlin 10 sub current_user_can {
61     my ( $self, $action,$item,$name ) = @_;
62     return 1 if $self->current_user->superuser || $self->current_user->administrator;
63     return 1 if $self->current_user->id && $action eq 'read';
64     return 0;
65     }
66    
67 dpavlin 2 1;
68    

  ViewVC Help
Powered by ViewVC 1.1.26