/[A3C]/lib/A3C/Model/Person.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/A3C/Model/Person.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations)
Thu Mar 13 17:33:45 2008 UTC (16 years ago) by dpavlin
Original Path: lib/A3C/Model/User.pm
File size: 6357 byte(s)
work a bit more on model: valid syntax produce dropdowns, some reorder and sane default values
1 use strict;
2 use warnings;
3
4 package A3C::Model::User;
5 use Jifty::DBI::Schema;
6
7 use utf8;
8
9 use A3C::Record schema {
10
11 column name =>
12 type is 'text',
13 label is _('Ime'),
14 is mandatory;
15
16 column cn =>
17 label is _('Ime'),
18 type is 'virtual';
19
20 column sn =>
21 type is 'virtual',
22 label is _('Prezime'),
23 is mandatory;
24
25 column givenName =>
26 type is 'virtual',
27 label is _('Ime'),
28 is mandatory;
29
30 column email =>
31 type is 'text',
32 is mandatory,
33 label is _('Email address'), default is '', is immutable, is distinct;
34
35 column email_confirmed =>
36 label is _('Email address confirmed?'),
37 type is 'boolean';
38
39 column password =>
40 is unreadable,
41 label is _('Password'),
42 type is 'varchar',
43 hints is _('Your password should be at least six characters'),
44 render_as 'password',
45 # filters are 'Jifty::DBI::Filter::SaltHash',
46 is mandatory;
47
48 column telephoneNumber =>
49 type is 'text',
50 label is _('Telefonski broj'),
51 hint is '+385 xx yyyyyy';
52
53 column hrEduPersonExtensionNumber =>
54 label is _('Lokalni telefonski broj');
55
56 column mobile =>
57 label is _('Broj mobilnog telefona');
58
59 column facsimileTelephoneNumber =>
60 label is _('Fax broj');
61
62 column hrEduPersonUniqueNumber =>
63 # is mandatory,
64 label is _('JMBG');
65
66 column hrEduPersonDateOfBirth =>
67 type is 'date',
68 render as 'date',
69 label is _('Datum rođenja');
70
71 column hrEduPersonGender =>
72 label is _('Spol');
73
74 column jpegPhoto =>
75 label is _('Slika');
76
77 column userCertificate =>
78 label is _('Ceritifikat');
79
80 column labeledURI =>
81 label is _('URI adresa');
82
83 column wtAdminType =>
84 label is _('Tip administratora'),
85 valid are [ '', 'AS', 'AI', 'AR', 'AHU' ];
86
87 column hrEduPersonProfessionalStatus =>
88 label is _('Stručni status'),
89 valid are [
90 '',
91 'NKV',
92 'PKV',
93 'KV',
94 'VKV',
95 'SSS',
96 'VS',
97 'VSS',
98 'VŠS',
99 'MR',
100 'DR',
101 ],
102 default is '';
103
104 column hrEduPersonAcademicStatus =>
105 label is _('Zvanje'),
106 valid are [
107 '',
108 'knjižničar',
109 'viši knjižničar',
110 'korepetitor',
111 'viši korepetitor',
112 'lektor',
113 'viši lektor',
114 'stručni suradnik',
115 'asistent visoke škole',
116 'profesor visoke škole',
117 'mlađi asistent',
118 'znanstveni novak',
119 'znanstveni asistent',
120 'znanstveni suradnik',
121 'predavač',
122 'viši predavač',
123 'asistent',
124 'asistent - predavač',
125 'viši asistent',
126 'docent',
127 'izvanredni profesor',
128 'redoviti profesor',
129 'znanstveni savjetnik',
130 'viši znanstveni suradnik',
131 ],
132 default is '';
133
134 column hrEduPersonScienceArea =>
135 label is _('Područje znanosti'),
136 valid are [
137 '',
138 'Tehničke znanosti',
139 'Prirodne znanosti',
140 'Humanističke znanosti',
141 'Društvene znanosti',
142 'Biotehničke znanosti',
143 'Biomedicina i zdravstvo',
144 ],
145 default is '';
146
147 column hrEduPersonAffiliation =>
148 label is _('Povezanost s ustanovom'),
149 is mandatory,
150 valid are [
151 'učenik',
152 'student',
153 'djelatnik',
154 'vanjski suradnik',
155 'korisnik usluge',
156 'gost',
157 ],
158 default is 'korisnik usluge';
159
160 column hrEduPersonPrimaryAffiliation =>
161 label is _('Temeljna povezanost s ustanovom');
162 is mandatory,
163 valid are [
164 'učenik',
165 'student',
166 'djelatnik',
167 'vanjski suradnik',
168 'korisnik usluge',
169 'gost',
170 ],
171 default is 'korisnik usluge';
172
173 column hrEduPersonStudentCategory =>
174 label is 'Vrsta studenta',
175 valid are [
176 '',
177 'osnovnoškolac',
178 'srednjoškolac',
179 'student stručnog studija',
180 'preddiplomac',
181 'postdiplomac',
182 'dodiplomac',
183 'pauzira godinu',
184 'prekid studija',
185 ],
186 default is '';
187
188 column hrEduPersonExpireDate =>
189 label is _('Datum isteka temeljne povezanosti'),
190 type is 'date',
191 render as 'date',
192 is mandatory,
193
194 column hrEduPersonTitle =>
195 label is 'Položaj u ustanovi',
196 valid are [ # FIXME reorder
197 '',
198 'dekan',
199 'direktor',
200 'pomoćnik ravnatelja',
201 'predstojnik zavoda',
202 'pročelnik katedre',
203 'pročelnik odsjeka',
204 'pročelnik sveučilišnog odjela',
205 'prodekan',
206 'prorektor',
207 'ravnatelj',
208 'rektor',
209 'voditelj laboratorija',
210 'voditelj odjela',
211 'voditelj organizacijske jedini',
212 'voditelj projekta',
213 'zamjenik pročelnika sveučilišn',
214 'zamjenik ravnatelja',
215 ],
216 default is '';
217
218 column hrEduPersonRole =>
219 label is 'Uloga u ustanovi',
220 valid are [
221 '',
222 'administrator imenika',
223 'CARNet koordinator',
224 'CARNet sistem inženjer',
225 'ICT koordinator',
226 'ISVU koordinator',
227 'kontakt za sigurnosna pitanja',
228 'MS koordinator',
229 'MATICA operater',
230 'MATICA urednik',
231 ],
232 default is '';
233
234 column hrEduPersonStaffCategory =>
235 label is 'Vrsta posla u ustanovi',
236 valid are [
237 'administrativno osoblje',
238 'ICT podrška',
239 'istraživači',
240 'nastavno osoblje',
241 'osoblje knjižnice',
242 'tehničko osoblje',
243 ];
244
245 column hrEduPersonGroupMember =>
246 label is 'Pripadnost grupi',
247 hint is 'skolskagodina::razred';
248
249 column o =>
250 label is _('Naziv matične ustanove'),
251 is mandatory;
252
253 column hrEduPersonHomeOrg =>
254 label is _('Oznaka matične ustanove'),
255 hint is 'CARNet',
256 is mandatory;
257
258 column ou =>
259 label is _('Organizacijska jedinica');
260
261 column roomNumber =>
262 label is _('Broj sobe');
263
264 column postalAddress =>
265 label is _('Poštanska adresa'),
266 render as 'textarea',
267 is mandatory;
268
269 column l =>
270 label is _('Mjesto'),
271 hist is 'Zagreb',
272 is mandatory;
273
274 column postalCode =>
275 label is _('Poštanski broj'),
276 hint is 'HR-10000';
277
278 column street =>
279 label is _('Ulica i kućni broj');
280
281 column homePostalAddress =>
282 label is _('Kućna poštanska adresa'),
283 render as 'textarea';
284
285 column homePhone =>
286 label is _('Kućni telefonski broj');
287
288 column hrEduPersonCommURI =>
289 label is _('Desktop uređaj');
290
291 column hrEduPersonPrivacy =>
292 label is _('Oznaka privatnosti');
293
294 };
295
296 use Jifty::Plugin::User::Mixin::Model::User;
297 use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
298 #use Jifty::Plugin::OpenID::Mixin::Model::User;
299 use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
300
301 # Your model-specific methods go here.
302
303 =head2 validate_telephoneNumber
304
305 =cut
306
307 sub validate_telephoneNumber {
308 my ( $self, $value ) = @_;
309
310 return ( 0, _('Telephone number invalid') ) if $value !~ m/^(\+?385)?[\d\s-]+$/;
311
312 return ( 1, 'OK' );
313 }
314
315 sub current_user_can {
316 # FIXME no security for now :-)
317 return 1;
318 }
319
320 1;
321

  ViewVC Help
Powered by ViewVC 1.1.26