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

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

Uups, fix syntax.

  • Property svn:keywords set to Id
File size: 8.4 KB
Line 
1## $Id: interfaces.py 14204 2016-09-29 07:20:07Z 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 = False,
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    vitae_doc = 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    ref1_doc = schema.Choice(
212        title = _(u'Reference Letter 1'),
213        source = CustomerDocumentSource(),
214        required = False,
215        )
216
217    ref2_doc = schema.Choice(
218        title = _(u'Reference Letter 2'),
219        source = CustomerDocumentSource(),
220        required = False,
221        )
222
223    ref3_doc = schema.Choice(
224        title = _(u'Reference Letter 3'),
225        source = CustomerDocumentSource(),
226        required = False,
227        )
228
229    photo1 = schema.Choice(
230        title = _(u'Photo or Illustration 1'),
231        source = CustomerDocumentSource(),
232        description = u'(optional)',
233        required = False,
234        )
235
236
237    photo2 = schema.Choice(
238        title = _(u'Photo or Illustration 2'),
239        source = CustomerDocumentSource(),
240        description = u'(optional)',
241        required = False,
242        )
243
244    photo3 = schema.Choice(
245        title = _(u'Photo or Illustration 3'),
246        source = CustomerDocumentSource(),
247        description = u'(optional)',
248        required = False,
249        )
250
251class IRIAAContract(IUnibenContract):
252    """A Retention of Name contract.
253
254    """
255
256class IRIAAContractOfficialUse(IIkobaObject):
257    """Interface for editing RIAA official use data.
258
259    """
260
261    comment = schema.Text(
262        title= _('Reason for rejection'),
263        required = False,
264        )
265
266
267class IRIAAContractProcess(IRIAAContract, IRIAAContractOfficialUse):
268    """Interface for processing RIAA data.
269    """
270
271    product_options = schema.List(
272        title = _(u'Options/Fees'),
273        value_type = ProductOptionField(),
274        required = False,
275        readonly = False,
276        defaultFactory=list,
277        )
278
279class IRIAAContractEdit(IRIAAContract):
280    """Interface for editing RIAA data by customers.
281
282    """
283
Note: See TracBrowser for help on using the repository browser.