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

  ViewVC Help
Powered by ViewVC 1.1.26