1 |
use strict; |
2 |
use warnings; |
3 |
|
4 |
package Arh::Model::Unit; |
5 |
use Jifty::DBI::Schema; |
6 |
|
7 |
use Data::Dump qw/dump/; |
8 |
|
9 |
use Arh::Record schema { |
10 |
|
11 |
column unit_id => |
12 |
type is 'text', |
13 |
label is _("ID"), |
14 |
hints is _('Number for unit identification'), |
15 |
is mandatory; |
16 |
|
17 |
column name => |
18 |
type is 'text', |
19 |
label is _("Unit"), |
20 |
hints is _('Name of unit described'), |
21 |
is mandatory; |
22 |
|
23 |
column subcategory => |
24 |
label is _('Subcategory'), |
25 |
hints is _('Function of unit, larger concept of which unit is part'), |
26 |
type is 'text', |
27 |
is mandatory; |
28 |
|
29 |
column category => |
30 |
label is _('Category'), |
31 |
is mandatory, |
32 |
references Arh::Model::Category, |
33 |
is AutoReference; |
34 |
|
35 |
column location => |
36 |
label is _("Location"), |
37 |
refers_to Arh::Model::Location, |
38 |
is AutoReference; |
39 |
|
40 |
column site => |
41 |
label is _('Site'), |
42 |
is mandatory, |
43 |
refers_to Arh::Model::Site, |
44 |
is AutoReference; |
45 |
|
46 |
column gps => |
47 |
label is _('GPS coordinates'); |
48 |
|
49 |
column placement => |
50 |
label is _('Placement'), |
51 |
is mandatory; |
52 |
|
53 |
column context => |
54 |
label is _('Context'); |
55 |
|
56 |
column discovery => |
57 |
label is _('Time of discovery'); |
58 |
|
59 |
column function => |
60 |
label is _('Function'); |
61 |
|
62 |
column reusage => |
63 |
label is _('Reusage'); |
64 |
|
65 |
column ownership => |
66 |
label is _('Ownership'); |
67 |
|
68 |
column presevation_place => |
69 |
label is _('Place of preservation'); |
70 |
|
71 |
column inventory_nr => |
72 |
label is _('Inventory number'); |
73 |
|
74 |
column dimensions => |
75 |
label is _("Dimensions"), |
76 |
hints is _("Separate values with ; (semicolumn)"), |
77 |
type is 'text'; |
78 |
|
79 |
column condition => |
80 |
label is _('Condition'), |
81 |
is mandatory; |
82 |
|
83 |
column toplogy => |
84 |
label is _('Topology'); |
85 |
|
86 |
# column material => |
87 |
# label is _('Material'); |
88 |
|
89 |
column technique => |
90 |
label is _('Technique'); |
91 |
|
92 |
column description => |
93 |
label is _("Description"), |
94 |
is mandatory, |
95 |
render as 'textarea'; |
96 |
|
97 |
column construction => |
98 |
label is _('Construction'); |
99 |
|
100 |
column iconography => |
101 |
label is _('Iconography'); |
102 |
|
103 |
column decoration => |
104 |
label is _('Decoration'); |
105 |
|
106 |
column motifs => |
107 |
label is _('Motifs'); |
108 |
|
109 |
column inscription => |
110 |
label is _('Inscription'); |
111 |
|
112 |
column language => |
113 |
label is _('Language'); |
114 |
|
115 |
column font => |
116 |
label is _('Font'); |
117 |
|
118 |
column author => |
119 |
label is _('Author(s)'); |
120 |
|
121 |
column chronology => |
122 |
label is _("Chronology"), |
123 |
refers_to Arh::Model::Chronology, |
124 |
# is AutoReference, |
125 |
since '0.0.2'; |
126 |
|
127 |
column chronostyle => |
128 |
label is _('Chronostyle'); |
129 |
|
130 |
column explored => |
131 |
label is _('Explored'); |
132 |
|
133 |
column conservations => |
134 |
label is _('Conservations'); |
135 |
|
136 |
column restorations => |
137 |
label is _('Restorations'); |
138 |
|
139 |
column legal => |
140 |
label is _('Legal status'); |
141 |
|
142 |
column links => |
143 |
label is _('Links'), |
144 |
refers_to Arh::Model::Unit, |
145 |
is AutoReference; |
146 |
|
147 |
column sources => |
148 |
label is _('Sources'); |
149 |
|
150 |
column bibliography => |
151 |
label is _('Bibliography'), |
152 |
is mandatory; |
153 |
|
154 |
column copyright => |
155 |
label is _('Copyright'), |
156 |
is mandatory; |
157 |
|
158 |
=for remove |
159 |
column campaign => |
160 |
label is _("Part of campaign"), |
161 |
refers_to Arh::Model::Campaign, |
162 |
# is AutoReference, |
163 |
is mandatory, |
164 |
since '0.0.9'; |
165 |
=cut |
166 |
|
167 |
}; |
168 |
|
169 |
#use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
170 |
|
171 |
# Your model-specific methods go here. |
172 |
|
173 |
sub material { |
174 |
my $self = shift; |
175 |
my $m = Arh::Model::UnitMaterialCollection->new; |
176 |
$m->limit( column => 'unit', value => $self->id ); |
177 |
return $m; |
178 |
} |
179 |
|
180 |
use Arh::DefaultACL; |
181 |
|
182 |
1; |
183 |
|