/[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

Annotation of /lib/A3C/Model/Person.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (hide 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 dpavlin 2 use strict;
2     use warnings;
3    
4 dpavlin 11 package A3C::Model::User;
5 dpavlin 2 use Jifty::DBI::Schema;
6    
7 dpavlin 14 use utf8;
8    
9 dpavlin 11 use A3C::Record schema {
10 dpavlin 2
11 dpavlin 4 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 dpavlin 10 # is mandatory,
64 dpavlin 4 label is _('JMBG');
65    
66     column hrEduPersonDateOfBirth =>
67     type is 'date',
68 dpavlin 15 render as 'date',
69 dpavlin 4 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 dpavlin 15 valid are [ '', 'AS', 'AI', 'AR', 'AHU' ];
86 dpavlin 4
87     column hrEduPersonProfessionalStatus =>
88     label is _('Stručni status'),
89 dpavlin 15 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 dpavlin 4
104     column hrEduPersonAcademicStatus =>
105     label is _('Zvanje'),
106 dpavlin 15 valid are [
107     '',
108 dpavlin 4 'knjižničar',
109 dpavlin 15 'viši knjižničar',
110 dpavlin 4 'korepetitor',
111 dpavlin 15 'viši korepetitor',
112 dpavlin 4 'lektor',
113 dpavlin 15 'viši lektor',
114     'stručni suradnik',
115     'asistent visoke škole',
116     'profesor visoke škole',
117 dpavlin 4 'mlađi asistent',
118 dpavlin 15 'znanstveni novak',
119     'znanstveni asistent',
120     'znanstveni suradnik',
121 dpavlin 4 'predavač',
122 dpavlin 15 'viši predavač',
123     'asistent',
124     'asistent - predavač',
125     'viši asistent',
126     'docent',
127     'izvanredni profesor',
128 dpavlin 4 'redoviti profesor',
129 dpavlin 15 'znanstveni savjetnik',
130 dpavlin 4 'viši znanstveni suradnik',
131 dpavlin 15 ],
132     default is '';
133 dpavlin 4
134     column hrEduPersonScienceArea =>
135     label is _('Područje znanosti'),
136 dpavlin 15 valid are [
137     '',
138 dpavlin 4 'Tehničke znanosti',
139     'Prirodne znanosti',
140     'Humanističke znanosti',
141     'Društvene znanosti',
142     'Biotehničke znanosti',
143     'Biomedicina i zdravstvo',
144 dpavlin 15 ],
145     default is '';
146 dpavlin 4
147     column hrEduPersonAffiliation =>
148     label is _('Povezanost s ustanovom'),
149     is mandatory,
150 dpavlin 15 valid are [
151     'učenik',
152     'student',
153 dpavlin 4 'djelatnik',
154 dpavlin 15 'vanjski suradnik',
155     'korisnik usluge',
156 dpavlin 4 'gost',
157 dpavlin 15 ],
158     default is 'korisnik usluge';
159 dpavlin 4
160     column hrEduPersonPrimaryAffiliation =>
161     label is _('Temeljna povezanost s ustanovom');
162     is mandatory,
163 dpavlin 15 valid are [
164     'učenik',
165     'student',
166 dpavlin 4 'djelatnik',
167 dpavlin 15 'vanjski suradnik',
168     'korisnik usluge',
169 dpavlin 4 'gost',
170 dpavlin 15 ],
171     default is 'korisnik usluge';
172 dpavlin 4
173     column hrEduPersonStudentCategory =>
174     label is 'Vrsta studenta',
175 dpavlin 15 valid are [
176     '',
177     'osnovnoškolac',
178     'srednjoškolac',
179     'student stručnog studija',
180     'preddiplomac',
181     'postdiplomac',
182 dpavlin 4 'dodiplomac',
183     'pauzira godinu',
184     'prekid studija',
185 dpavlin 15 ],
186     default is '';
187 dpavlin 4
188     column hrEduPersonExpireDate =>
189     label is _('Datum isteka temeljne povezanosti'),
190     type is 'date',
191 dpavlin 15 render as 'date',
192 dpavlin 4 is mandatory,
193    
194     column hrEduPersonTitle =>
195     label is 'Položaj u ustanovi',
196 dpavlin 15 valid are [ # FIXME reorder
197     '',
198 dpavlin 4 '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 dpavlin 15 ],
216     default is '';
217 dpavlin 4
218     column hrEduPersonRole =>
219     label is 'Uloga u ustanovi',
220 dpavlin 15 valid are [
221     '',
222 dpavlin 4 '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 dpavlin 15 ],
232     default is '';
233 dpavlin 4
234     column hrEduPersonStaffCategory =>
235     label is 'Vrsta posla u ustanovi',
236 dpavlin 15 valid are [
237 dpavlin 4 '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 dpavlin 12 render as 'textarea',
267 dpavlin 4 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 dpavlin 12 label is _('Kućna poštanska adresa'),
283     render as 'textarea';
284 dpavlin 4
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 dpavlin 2 };
295    
296 dpavlin 4 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 dpavlin 2 # Your model-specific methods go here.
302    
303 dpavlin 4 =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 dpavlin 7 sub current_user_can {
316     # FIXME no security for now :-)
317     return 1;
318     }
319    
320 dpavlin 2 1;
321    

  ViewVC Help
Powered by ViewVC 1.1.26