Changeset 6087 for main/waeup.sirp
- Timestamp:
- 14 May 2011, 14:19:59 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/app.py
r6085 r6087 40 40 # The default frontpage. 41 41 frontpage= """ 42 This is the default frontpage of the portal w hich is written43 in in the `reStructuredText<http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_42 This is the default frontpage of the portal written 43 in `reStructuredText (reST) <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ 44 44 markup language. 45 45 46 Some reST examples for getting started:46 Some more reST examples for getting started: 47 47 48 48 1. Heading -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6084 r6087 52 52 IApplicant, IApplicantPrincipal, IApplicantPDEEditData, 53 53 IApplicantsRoot, IApplicantsContainer, IApplicantsContainerProvider, 54 IApplicantsContainerAdd 54 IApplicantsContainerAdd, application_types_vocab 55 55 ) 56 56 … … 150 150 @grok.action('Add applicants container') 151 151 def addApplicantsContainer(self, **data): 152 if data['code'] in self.context.keys(): 153 self.status = Invalid('The name chosen already exists ' 152 year1 = unicode(data['year']) 153 year2 = unicode(data['year']+1) 154 code = unicode(data['prefix']) + year1 155 title = unicode(application_types_vocab.getTerm(data['prefix']).title) + u' ' + year1 + u'/' + year2 156 if code in self.context.keys(): 157 self.status = Invalid('The code chosen already exists ' 154 158 'in the database') 155 159 return … … 158 162 container = provider.factory() 159 163 self.applyData(container, **data) 160 self.context[data['code']] = container 161 self.flash('Added "%s".' % data['code']) 164 container.code = code 165 container.title = title 166 #import pdb; pdb.set_trace() 167 self.context[code] = container 168 self.flash('Added "%s".' % code) 162 169 self.redirect(self.url(self.context, u'@@manage')+'#tab-1') 163 170 return … … 210 217 @property 211 218 def title(self): 212 return "Applicants Container: %s" % getattr( 213 self.context, '__name__', 'unnamed') 219 return "Applicants Container: %s" % self.context.title 214 220 215 221 @property 216 222 def label(self): 217 return self.title 218 223 return self.context.title 219 224 220 225 class ManageApplicantsContainerActionButton(ManageActionButton): … … 235 240 @property 236 241 def title(self): 237 return "Manage applicants container: %s" % getattr( 238 self.context, '__name__', 'unnamed') 242 return "Applicants Container: %s" % self.context.title 239 243 240 244 @property 241 245 def label(self): 242 return self.title246 return 'Manage applicants container' 243 247 244 248 pnav = 3 -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainerpage.pt
r6069 r6087 1 <h2 tal:content=" context/title">Title</h2>1 <h2 tal:content="view/label">Title</h2> 2 2 3 3 <span tal:replace="structure view/widgets/description">Title</span> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrootpage.pt
r6079 r6087 6 6 <thead> 7 7 <tr> 8 <th> Code</th><th>Title</th>8 <th>Year</th><th>Code</th><th>Title</th> 9 9 </tr> 10 10 </thead> … … 12 12 <tr tal:repeat="entry context/values" 13 13 class="gradeB"> 14 <td tal:content="entry/year">Year 15 </td> 14 16 <td> 15 17 <a href="" 16 18 tal:attributes="href python:view.url(entry)" 17 tal:content="entry/__name__" 18 >Name</a> 19 tal:content="entry/__name__">Code</a> 19 20 </td> 20 <td tal:content="entry/title"> 21 Title 21 <td tal:content="entry/title">Title 22 22 </td> 23 23 </tr> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/form_manage_applicants_container.pt
r6014 r6087 31 31 <tbody> 32 32 <tal:block repeat="widget view/widgets"> 33 <tal:condition condition="python:widget.name not in ['form.title']"> 33 34 <tr> 34 35 <td class="label" tal:define="hint widget/hint"> … … 55 56 </td> 56 57 </tr> 58 </tal:condition> 57 59 </tal:block> 58 60 </tbody> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r6076 r6087 5 5 ## $Id$ 6 6 ## 7 ## Copyright (C) 2011 Uli Fouquet 7 ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann 8 8 ## This program is free software; you can redistribute it and/or modify 9 9 ## it under the terms of the GNU General Public License as published by … … 34 34 from waeup.sirp.image.image import WAeUPImageFile 35 35 from waeup.sirp.interfaces import IWAeUPObject, SimpleWAeUPVocabulary 36 from waeup.sirp.university.vocabularies import FutureYearsSource 36 37 37 38 … … 49 50 ) 50 51 51 #: Categories of applications we support. 52 #: Yet not complete nor correct. 53 APPLICATION_CATEGORIES = ( 54 ('Direct Entry Screening Exam (PDE)', 'pde'), 55 ('Post-UME', 'pume'), 56 ('Post-UDE', 'pude'), 57 ('PCE', 'pce'), 52 #: Types of applications we support. 53 APPLICATION_TYPES = ( 54 ('Pre-NCE Programme', 'prence'), 55 ('Post UME Screening Test', 'pume'), 56 ('Post UDE Screening', 'pude'), 57 ('Part Time Degree in Education', 'sandwich'), 58 ('Part-Time Degree Programmes', 'pt'), 59 ('Diploma Programmes', 'dp'), 60 ('PCE Screening', 'pce'), 61 ('Certificate Programmes', 'ct'), 58 62 ('Common Entry Screening Test (CEST)', 'cest'), 59 63 ) 60 64 61 65 #: A :class:`waeup.sirp.interfaces.SimpleWAeUPVocabulary` of supported 62 #: application categories.63 application_ categories_vocab = SimpleWAeUPVocabulary(*APPLICATION_CATEGORIES)66 #: application or screening types. 67 application_types_vocab = SimpleWAeUPVocabulary(*APPLICATION_TYPES) 64 68 65 69 class GenderSource(BasicSourceFactory): … … 152 156 code = schema.TextLine( 153 157 title = u'Code', 154 description = u'Abbreviated code of applicants container', 155 default = u'NA', 156 required = True, 157 readonly = True, 158 ) 158 default = u'-', 159 required = True, 160 readonly = True, 161 ) 162 163 title = schema.TextLine( 164 title = u'Title', 165 required = True, 166 default = u'-', 167 readonly = True, 168 ) 169 170 prefix = schema.Choice( 171 title = u'Application target', 172 required = True, 173 default = None, 174 source = application_types_vocab, 175 readonly = True, 176 ) 177 178 year = schema.Choice( 179 title = u'Year of entrance', 180 required = True, 181 default = None, 182 source = FutureYearsSource(), 183 readonly = True, 184 ) 159 185 160 186 provider = schema.Choice( … … 163 189 default = None, 164 190 source = ApplicantContainerProviderSource(), 165 ) 166 167 title = schema.TextLine( 168 title = u'Title of the type of applicants stored here', 169 required = True, 170 default = u'Untitled', 191 readonly = True, 171 192 ) 172 193 … … 228 249 """An applicants container contains university applicants. 229 250 """ 230 code = schema.TextLine(231 title = u' Code',232 description = u'Abbreviated code of applicants container',233 default = u'NA',234 required = True,251 prefix = schema.Choice( 252 title = u'Application target', 253 required = True, 254 default = None, 255 source = application_types_vocab, 235 256 readonly = False, 236 257 ) 237 258 238 IApplicantsContainerAdd['code'].order = IApplicantsContainer['code'].order 259 year = schema.Choice( 260 title = u'Year of entrance', 261 required = True, 262 default = None, 263 source = FutureYearsSource(), 264 readonly = False, 265 ) 266 267 provider = schema.Choice( 268 title = u'Applicants container type', 269 required = True, 270 default = None, 271 source = ApplicantContainerProviderSource(), 272 readonly = False, 273 ) 274 275 IApplicantsContainerAdd['prefix'].order = IApplicantsContainer['prefix'].order 276 IApplicantsContainerAdd['year'].order = IApplicantsContainer['year'].order 277 IApplicantsContainerAdd['provider'].order = IApplicantsContainer['provider'].order 239 278 240 279 class IApplicantBaseData(IWAeUPObject): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_interfaces.py
r5755 r6087 31 31 from waeup.sirp.applicants import interfaces 32 32 from waeup.sirp.applicants.interfaces import ( 33 APPLICATION_ CATEGORIES, application_categories_vocab, GenderSource,33 APPLICATION_TYPES, application_types_vocab, GenderSource, 34 34 ) 35 35 … … 37 37 38 38 def setUp(self): 39 self.vocab = application_ categories_vocab39 self.vocab = application_types_vocab 40 40 return 41 41 -
main/waeup.sirp/trunk/src/waeup/sirp/university/vocabularies.py
r5988 r6087 10 10 from zope.app.catalog.interfaces import ICatalog 11 11 from zope.component import getUtility 12 import datetime 12 13 13 14 inst_types = SimpleWAeUPVocabulary( … … 74 75 return "%s - %s" % (value.code, value.title[:64]) 75 76 77 78 79 class FutureYearsSource(BasicSourceFactory): 80 """ 81 """ 82 def getValues(self): 83 cy = datetime.datetime.now().year 84 return [x for x in range(cy-2,cy+5)] 85 86 def getToken(self, value): 87 return str(value) 88 89 def getTitle(self, value): 90 return str(value) 91 76 92
Note: See TracChangeset for help on using the changeset viewer.