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