source: main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/interfaces.py @ 14199

Last change on this file since 14199 was 14199, checked in by Henrik Bettermann, 8 years ago

Add nominee passport field.

  • Property svn:keywords set to Id
File size: 8.2 KB
Line 
1## $Id: interfaces.py 14199 2016-09-28 07:44:37Z henrik $
2##
3## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18
19import re
20from zope import schema
21from waeup.ikoba.interfaces import IIkobaObject
22from waeup.ikoba.schema import FormattedDate, PhoneNumber
23from waeup.ikoba.customers.interfaces import (
24    ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract)
25from waeup.ikoba.customers.vocabularies import (
26    ConCatProductSource, CustomerDocumentSource, nats_vocab)
27from waeup.ikoba.products.productoptions import ProductOptionField
28from ikobacustom.uniben.interfaces import MessageFactory as _
29
30class NotUnibenEmailAddress(schema.ValidationError):
31    __doc__ = u"Invalid Uniben email address"
32
33check_email = re.compile(
34    r"^[^@\s,]+@[^@\.\s,]+(\.[^@\.\s,]+)*$").match
35
36def validate_uniben_email(value):
37    if not check_email(value):
38        raise NotUnibenEmailAddress(value)
39    if not value.endswith('uniben.edu'):
40        raise NotUnibenEmailAddress(value)
41    return True
42
43class IUnibenCustomer(ICustomer):
44    """Representation of a customer.
45
46    """
47
48# Customer document interfaces
49
50
51class IUnibenCustomerJPGDocument(ICustomerDocument):
52    """A customer document.
53
54    """
55
56class IUnibenCustomerPDFDocument(ICustomerPDFDocument):
57    """A customer pdf document.
58
59    """
60
61# Customer contract interfaces
62
63class IUnibenContract(IContract):
64    """A customer contract with document attached.
65
66    """
67
68    nominator_title_rank = schema.TextLine(
69        title = _(u'Title/Rank'),
70        required = False,
71        )
72
73    nominator_nationality = schema.Choice(
74        vocabulary = nats_vocab,
75        title = _(u'Current Nationality'),
76        required = False,
77        )
78
79    nominator_address = schema.Text(
80        title = _(u'Affiliation/Address'),
81        required = False,
82        )
83
84    nominee_fullname = schema.TextLine(
85        title = _(u'Name'),
86        description = u'Surname last and in capital letters',
87        required = False,
88        )
89
90    nominee_title_rank = schema.TextLine(
91        title = _(u'Title/Rank'),
92        required = False,
93        )
94
95    nominee_department = schema.TextLine(
96        title = _(u'Department/Faculty/Institute'),
97        required = False,
98        )
99
100    nominee_date_of_birth = FormattedDate(
101        title = _(u'Date of Birth'),
102        required = False,
103        show_year = True,
104        )
105
106    nominee_nationality = schema.Choice(
107        vocabulary = nats_vocab,
108        title = _(u'Current Nationality'),
109        required = False,
110        )
111
112    nominee_email = schema.ASCIILine(
113        title = _(u'Uniben Email Address'),
114        required = True,
115        constraint=validate_uniben_email,
116        )
117
118    nominee_phone = PhoneNumber(
119        title = _(u'Phone'),
120        description = u'',
121        required = False,
122        )
123
124    app_dates = schema.Text(
125        title = _(u'Date of Appointment as Uniben staff'),
126        description = u'State periods nominee had a break in service from '
127                       'UNIBEN service (including leave of absence), '
128                       'but excluding training/study/sabbatical leave',
129        required = False,
130        )
131
132    bib_cit = schema.Text(
133        title = _(u'Biographical Citation'),
134        description = u'Suggested biographical citation of '
135                       'nominee (max. 200 words) in the event that the '
136                       'nominee is selected for the award.',
137        required = False,
138        )
139
140    sup_stat = schema.Text(
141        title = _(u'Supporting Statement'),
142        description = u'Supporting statement (max. 200 words) summarizing '
143                       'the research and innovative achievement of the '
144                       'candidate. It should preferably focus on one major '
145                       'achievement/innovation/accomplishment.',
146        required = False,
147        )
148
149    nar_wu = schema.Text(
150        title = _(u'Narrative Write-Up'),
151        description = u'A narrative write-up (max. 1,000 words) of the '
152                       'candidate highlighting his/her scientific/creative '
153                       'achievement and/or innovation; restrict to one major '
154                       'innovation/achievement/accomplishment. '
155                       'The national/international impact of the '
156                       'achievement/innovation should be emphasized.',
157        required = False,
158        )
159
160    item_stat = schema.Text(
161        title = _(u'Itemized Statement'),
162        description = u'Itemized statement of research leadership and '
163                        'collaboration (max. 100 words)',
164        required = False,
165        )
166
167    sign_pub = schema.Text(
168        title = _(u'Significant Publications'),
169        description = u'A list of his/her most significant publications '
170                       '(max. 10) pertaining to the achievement/innovation '
171                       'along with each publication\'s H-index',
172        required = False,
173        )
174
175    prev_aw = schema.Text(
176        title = _(u'Previous Awards'),
177        description = u'List of previous awards, honours and recognition '
178                       '(max. 10) received by nominee, including awarding '
179                       'body, purpose of award, date of award, and nature '
180                       'of award (cash, certificate, plaque, etc)',
181        required = False,
182        )
183
184    lead_rol = schema.Text(
185        title = _(u'Leadership Roles'),
186        description = u'List of leadership roles in academic/professional '
187                       'societies/organizations (max. no. of 3)',
188        required = False,
189        )
190
191    h_index = schema.Text(
192        title = _(u'State H-Index'),
193        description = u'State the full H-index of author, i.e. nominee',
194        required = False,
195        )
196
197    passport = schema.Choice(
198        title = _(u'Passport Photo'),
199        source = CustomerDocumentSource(),
200        required = False,
201        )
202
203    doc1 = schema.Choice(
204        title = _(u'Curriculum Vitae'),
205        source = CustomerDocumentSource(),
206        description = u'A curriculum vitae including a full list of scholarly '
207                       'publications',
208        required = False,
209        )
210
211    doc2 = schema.Choice(
212        title = _(u'Reference Letters'),
213        source = CustomerDocumentSource(),
214        description = u'Reference letters from three referees '
215                       'added together in a pdf document',
216        required = False,
217        )
218
219    doc3 = schema.Choice(
220        title = _(u'Photo or Illustration 1'),
221        source = CustomerDocumentSource(),
222        description = u'(optional)',
223        required = False,
224        )
225
226
227    doc4 = schema.Choice(
228        title = _(u'Photo or Illustration 2'),
229        source = CustomerDocumentSource(),
230        description = u'(optional)',
231        required = False,
232        )
233
234    doc5 = schema.Choice(
235        title = _(u'Photo or Illustration 3'),
236        source = CustomerDocumentSource(),
237        description = u'(optional)',
238        required = False,
239        )
240
241class IRIAAContract(IUnibenContract):
242    """A Retention of Name contract.
243
244    """
245
246class IRIAAContractOfficialUse(IIkobaObject):
247    """Interface for editing RIAA official use data.
248
249    """
250
251    comment = schema.Text(
252        title= _('Reason for rejection'),
253        required = False,
254        )
255
256
257class IRIAAContractProcess(IRIAAContract, IRIAAContractOfficialUse):
258    """Interface for processing RIAA data.
259    """
260
261    product_options = schema.List(
262        title = _(u'Options/Fees'),
263        value_type = ProductOptionField(),
264        required = False,
265        readonly = False,
266        defaultFactory=list,
267        )
268
269class IRIAAContractEdit(IRIAAContract):
270    """Interface for editing RIAA data by customers.
271
272    """
273
Note: See TracBrowser for help on using the repository browser.