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

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

Uups, fix syntax.

  • Property svn:keywords set to Id
File size: 8.4 KB
RevLine 
[12272]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
[14197]19import re
[12272]20from zope import schema
[12502]21from waeup.ikoba.interfaces import IIkobaObject
[14197]22from waeup.ikoba.schema import FormattedDate, PhoneNumber
[12272]23from waeup.ikoba.customers.interfaces import (
[14184]24    ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract)
[12273]25from waeup.ikoba.customers.vocabularies import (
[14191]26    ConCatProductSource, CustomerDocumentSource, nats_vocab)
[12335]27from waeup.ikoba.products.productoptions import ProductOptionField
[14178]28from ikobacustom.uniben.interfaces import MessageFactory as _
[12272]29
[14197]30class NotUnibenEmailAddress(schema.ValidationError):
31    __doc__ = u"Invalid Uniben email address"
[12272]32
[14197]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
[14181]43class IUnibenCustomer(ICustomer):
[12272]44    """Representation of a customer.
45
46    """
47
48# Customer document interfaces
49
50
[14197]51class IUnibenCustomerJPGDocument(ICustomerDocument):
[12272]52    """A customer document.
53
54    """
55
[14184]56class IUnibenCustomerPDFDocument(ICustomerPDFDocument):
57    """A customer pdf document.
58
59    """
60
[12272]61# Customer contract interfaces
62
[14181]63class IUnibenContract(IContract):
[14190]64    """A customer contract with document attached.
[12272]65
66    """
67
[14197]68    nominator_title_rank = schema.TextLine(
[14191]69        title = _(u'Title/Rank'),
70        required = False,
71        )
72
[14197]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(
[14191]96        title = _(u'Department/Faculty/Institute'),
97        required = False,
98        )
99
[14197]100    nominee_date_of_birth = FormattedDate(
[14191]101        title = _(u'Date of Birth'),
102        required = False,
103        show_year = True,
104        )
105
[14197]106    nominee_nationality = schema.Choice(
[14191]107        vocabulary = nats_vocab,
108        title = _(u'Current Nationality'),
109        required = False,
110        )
111
[14197]112    nominee_email = schema.ASCIILine(
113        title = _(u'Uniben Email Address'),
[14203]114        required = False,
[14197]115        constraint=validate_uniben_email,
116        )
117
118    nominee_phone = PhoneNumber(
119        title = _(u'Phone'),
120        description = u'',
[14191]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
[14190]132    bib_cit = schema.Text(
[14188]133        title = _(u'Biographical Citation'),
[14190]134        description = u'Suggested biographical citation of '
135                       'nominee (max. 200 words) in the event that the '
136                       'nominee is selected for the award.',
[12272]137        required = False,
138        )
[12273]139
[14190]140    sup_stat = schema.Text(
[14188]141        title = _(u'Supporting Statement'),
[14190]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.',
[14184]146        required = False,
147        )
[12502]148
[14190]149    nar_wu = schema.Text(
[14188]150        title = _(u'Narrative Write-Up'),
[14190]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.',
[14188]157        required = False,
158        )
159
[14190]160    item_stat = schema.Text(
[14188]161        title = _(u'Itemized Statement'),
[14190]162        description = u'Itemized statement of research leadership and '
163                        'collaboration (max. 100 words)',
[14188]164        required = False,
165        )
166
[14190]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',
[14188]172        required = False,
173        )
174
[14190]175    prev_aw = schema.Text(
[14188]176        title = _(u'Previous Awards'),
[14190]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)',
[14188]181        required = False,
182        )
183
[14190]184    lead_rol = schema.Text(
[14188]185        title = _(u'Leadership Roles'),
[14190]186        description = u'List of leadership roles in academic/professional '
187                       'societies/organizations (max. no. of 3)',
[14188]188        required = False,
189        )
190
[14190]191    h_index = schema.Text(
[14197]192        title = _(u'State H-Index'),
[14190]193        description = u'State the full H-index of author, i.e. nominee',
[14188]194        required = False,
195        )
196
[14199]197    passport = schema.Choice(
198        title = _(u'Passport Photo'),
199        source = CustomerDocumentSource(),
200        required = False,
201        )
202
[14203]203    vitae_doc = schema.Choice(
[14197]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
[14203]211    ref1_doc = schema.Choice(
212        title = _(u'Reference Letter 1'),
[14188]213        source = CustomerDocumentSource(),
214        required = False,
215        )
216
[14204]217    ref2_doc = schema.Choice(
[14203]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(
[14197]230        title = _(u'Photo or Illustration 1'),
[14188]231        source = CustomerDocumentSource(),
[14197]232        description = u'(optional)',
[14188]233        required = False,
234        )
235
[14197]236
[14203]237    photo2 = schema.Choice(
[14197]238        title = _(u'Photo or Illustration 2'),
239        source = CustomerDocumentSource(),
240        description = u'(optional)',
241        required = False,
242        )
243
[14203]244    photo3 = schema.Choice(
[14197]245        title = _(u'Photo or Illustration 3'),
246        source = CustomerDocumentSource(),
247        description = u'(optional)',
248        required = False,
249        )
[14199]250
[14184]251class IRIAAContract(IUnibenContract):
252    """A Retention of Name contract.
253
[12502]254    """
255
[14184]256class IRIAAContractOfficialUse(IIkobaObject):
257    """Interface for editing RIAA official use data.
258
259    """
260
[12502]261    comment = schema.Text(
262        title= _('Reason for rejection'),
263        required = False,
264        )
265
[14184]266
267class IRIAAContractProcess(IRIAAContract, IRIAAContractOfficialUse):
268    """Interface for processing RIAA data.
[12335]269    """
270
271    product_options = schema.List(
272        title = _(u'Options/Fees'),
273        value_type = ProductOptionField(),
274        required = False,
275        readonly = False,
[14184]276        defaultFactory=list,
[12335]277        )
278
[14184]279class IRIAAContractEdit(IRIAAContract):
280    """Interface for editing RIAA data by customers.
[12273]281
282    """
283
Note: See TracBrowser for help on using the repository browser.