Changeset 502
- Timestamp:
- 11 Sep 2006, 10:39:59 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 1 added
- 20 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Accommodation.py
r411 r502 91 91 92 92 ###) 93 94 95 96 93 97 94 InitializeClass(Accommodation) -
WAeUP_SRP/trunk/PatchCatalogToolXMLAdapter.py
r486 r502 7 7 """Import the object from the DOM node. 8 8 """ 9 #import pdb;pdb.set_trace() 9 10 if self.environ.shouldPurge(): 10 11 self._purgeProperties() … … 12 13 self._purgeIndexes() 13 14 self._purgeColumns() 14 ## self._initProperties(node)15 ## self._initObjects(node)16 ## self._initIndexes(node)17 ## self._initColumns(node)18 15 columns = [] 19 16 for col in self._extractColumns()._get_childNodes(): … … 27 24 na = node.attributes.items() 28 25 not_found = True 29 if na[ 1][1] == "portal_catalog":26 if na[0][1] == "CMF Catalog": 30 27 not_found = False 31 print na[1][1]28 #print na[1][1] 32 29 for ch in node._get_childNodes(): 33 30 if ch.nodeName in ('index',): -
WAeUP_SRP/trunk/ScratchCards.py
r490 r502 11 11 #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument 12 12 from Products.CPSDocument.CPSDocument import CPSDocument 13 import DateTime 14 import Globals 15 p_home = Globals.package_home(globals()) 16 i_home = Globals.INSTANCE_HOME 13 17 14 18 class ScratchCardBatchesFolder(CPSDocument): ###( … … 45 49 security = ClassSecurityInfo() 46 50 47 def __init__(self,id,**kw):48 CPSDocument.__init__(self,id,**kw)49 self.table = PinTable()50 51 51 security.declareProtected(View,"Title") 52 52 def Title(self): … … 60 60 batch = self.getContent() 61 61 nr = batch.no_of_pins 62 prefix = batch.prefix 63 sold = batch.sold_by 64 cost = batch.cost 62 65 import random 63 66 r = random 64 67 b_no = batch.batch_no 68 #import pdb;pdb.set_trace() 69 generated = [] 70 generated.append('"Serial","Pin","Sold","Cost"' % vars()) 71 generated.append('"%(prefix)s","%(b_no)d","%(sold)s","%(cost)f"' % vars()) 72 pins = self.portal_pins 65 73 for i in range(nr): 66 pin = "%d%d" % (b_no,r.randint(999999999,1000000000)) 67 import pdp;pdb.set_trace() 68 while len(res) > 0: 69 pin = "%d%d" % (b_no,r.randint(9999,1000000000)) 70 res = self.table.searchResults(uid=pin) 71 self.table.addRecord(pin=pin,serial=i,student="") 72 print i,pin 74 ri = r.randint(1000000000,9999999999) 75 pin = "%s%d%d" % (prefix,b_no,ri) 76 while len(pins.searchResults({'pin': pin})) > 0: 77 ri = r.randint(1000000000,9999999999) 78 pin = "%s%d%d" % (prefix,b_no,ri) 79 pins.addRecord(pin=pin,serial=i,student="") 80 generated.append('"%(i)d","%(prefix)s-%(b_no)d-%(ri)d"' % vars()) 81 print '\n'.join(generated) 82 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 83 open("%s/import/%s-%s-%s" % (i_home,prefix,b_no,current),"w+").write('\n'.join(generated)) 73 84 74 85 -
WAeUP_SRP/trunk/Students.py
r488 r502 5 5 from AccessControl.SecurityManagement import newSecurityManager 6 6 from zExceptions import BadRequest 7 from Products.ZCatalog.ZCatalog import ZCatalog 7 8 from Products.CMFCore.utils import UniqueObject, getToolByName 8 9 from Products.CMFCore.permissions import View … … 25 26 r = random 26 27 return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) 28 29 def getStudentByRegNo(self,reg_no): 30 """search student by JAMB Reg No and return StudentFolder""" 31 search = ZCatalog.searchResults(self.portal_catalog,{'meta_type': 'StudentApplication', 32 'jamb_reg_no': reg_no, 33 }) 34 if len(search) < 1: 35 return None 36 return search[0].getObject().aq_parent 27 37 28 38 class StudentsFolder(CPSDocument): ###( … … 102 112 logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) 103 113 s = getattr(self,sid) 114 self.portal_registration.addMember(sid, 115 'uNsEt' , 116 roles=('Member', 117 'Student',)) 104 118 s.invokeFactory('StudentApplication','application') 105 119 da = {'Title': 'Application Data'} … … 314 328 logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars()) 315 329 s = getattr(self,sid) 330 self.portal_registration.addMember(sid, 331 'uNsEt' , 332 roles=('Member', 333 'Student',)) 316 334 s.invokeFactory('StudentApplication','application') 317 335 da = {'Title': 'Application Data'} … … 335 353 ## s.personal.getContent().edit(mapping=d) 336 354 s.application.getContent().edit(mapping=da) 355 s.application.getContent().content_status_modify(workflow_action="open") 356 s.application.manage_setLocalRoles(s_id, ['Owner',]) 337 357 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 338 358 ###) 339 359 340 security.declareProtected(View,"getStudentByRegNo")341 def getStudentByRegNo(self,reg_no):342 """search student by JAMB Reg No and return StudentFolder"""343 search = self.portal_catalog({'meta_type': 'StudentApplication',344 'jamb_reg_no': reg_no,345 })346 if len(search) < 1:347 return None348 return search[0].getObject().aq_parent349 360 350 361 security.declareProtected(View,"Title") -
WAeUP_SRP/trunk/WAeUPTables.py
r490 r502 31 31 for key, value in dict.items(): 32 32 setattr(ob, key, value) 33 34 33 return ob 35 34 … … 40 39 41 40 def addRecord(self, **data): 42 raise NotImplementedError 41 # The uid is the same as "bed". 42 uid = data[self.key] 43 res = self.searchResults({"%s" % self.key : uid}) 44 if len(res) > 0: 45 raise ValueError("More than one record with uid %s" % uid) 46 self.catalog_object(dict2ob(data), uid=uid) 47 return uid 43 48 44 49 def deleteRecord(self, uid): 45 50 self.uncatalog_object(uid) 46 51 47 def modifyRecord(self, uid, **data): 48 records = self.searchResults(uid=uid) 52 def searchAndSetRecord(self, **data): 53 raise NotImplemented 54 55 def modifyRecord(self, **data): 56 #records = self.searchResults(uid=uid) 57 uid = data[self.key] 58 records = self.searchResults({"%s" % self.key : uid}) 49 59 if len(records) > 1: 50 60 # Can not happen, but anyway... … … 52 62 if len(records) == 0: 53 63 raise KeyError("No record for uid %s" % uid) 54 55 64 record = records[0] 56 65 record_data = {} … … 64 73 65 74 meta_type = 'WAeUP Accommodation Tool' 66 75 name = "accommodation" 76 key = "bed" 67 77 def __init__(self): 68 78 WAeUPTable.__init__(self, 'portal_accommodation') 69 70 def addRecord(self, **data):71 # The uid is the same as "bed".72 uid = data['bed']73 self.catalog_object(dict2ob(data), uid=uid)74 return uid75 79 76 80 … … 80 84 81 85 meta_type = 'WAeUP Pin Tool' 82 86 name = "pins" 87 key = 'pin' 83 88 def __init__(self): 84 89 WAeUPTable.__init__(self, 'portal_pins') 85 90 86 def addRecord(self, **data):87 # The uid is the same as "bed".88 uid = data['pin']89 self.catalog_object(dict2ob(data), uid=uid)90 return uid91 91 92 def searchAndSetRecord(self, uid, jamb_reg_no): 93 #records = self.searchResults(uid=uid) 94 records = self.searchResults({"%s" % self.key : uid}) 95 if len(records) > 1: 96 # Can not happen, but anyway... 97 raise ValueError("More than one record with uid %s" % uid) 98 if len(records) == 0: 99 return -1 100 record = records[0] 101 if record.student == "": 102 record_data = {} 103 for field in self.schema() + self.indexes(): 104 record_data[field] = getattr(record, field) 105 # Add the updated data: 106 record_data['student'] = jamb_reg_no 107 self.catalog_object(dict2ob(record_data), uid) 108 return 1 109 if record.student != jamb_reg_no: 110 return 0 111 if record.student == jamb_reg_no: 112 return 2 92 113 93 114 InitializeClass(PinTable) -
WAeUP_SRP/trunk/Widgets.py
r488 r502 2 2 3 3 from cgi import escape 4 4 from types import * 5 5 from Globals import InitializeClass 6 6 ##from Products.CPSSchemas.Widget import CPSWidgetType … … 13 13 from DateTime.DateTime import DateTime 14 14 from AccessControl import getSecurityManager 15 15 from Products.WAeUP_SRP.Students import getStudentByRegNo 16 16 from re import compile 17 17 … … 211 211 ###) 212 212 213 ##def getStudentByRegNo(self,reg_no): 214 ## search = self.portal_catalog({'meta_type': 'StudentApplication', 215 ## 'jamb_reg_no': reg_no, 216 ## }) 217 ## if len(search) < 1: 218 ## return None 219 ## return search[0].getObject(). 220 213 221 class JambRegNoWidget(CPSStringWidget): ###( 214 222 """ JambRegNo Widget""" … … 232 240 err = 'Invalid Registration Number in the format: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str) 233 241 else: 234 search = self.portal_catalog({'meta_type': 'StudentApplication', 235 'jamb_reg_no': value, 236 }) 237 if len(search) < 1: 242 s = getStudentByRegNo(self,value) 243 if s is None: 238 244 err = 'No JAMB data for %s' % (value) 239 245 if err: … … 279 285 reference = '' 280 286 281 def prepare(self, datastructure, **kw): 287 def prepare(self, datastructure, **kw): ###( 282 288 """Prepare datastructure from datamodel.""" 283 289 datamodel = datastructure.getDataModel() 284 290 v = datamodel[self.fields[0]] 285 291 widget_id = self.getWidgetId() 292 if v and type(v) is StringType: 293 p,b,n = v.split('-') 294 v = ScratchCardPin(v,b,n) 286 295 if v: 287 296 b = '%s' % v.b … … 293 302 datastructure[widget_id+'_n'] = n 294 303 304 ###) 305 295 306 def validate(self, datastructure, **kw): 296 307 """Validate datastructure and update datamodel.""" … … 298 309 v = datastructure[widget_id] 299 310 err = 0 311 p = self.prefix 300 312 b = datastructure[widget_id+'_b'].strip() 301 313 n = datastructure[widget_id+'_n'].strip() 302 314 #import pdb; pdb.set_trace() 303 if not n in self.valid_pins: 304 err = 'invalid Pin' 315 pins = self.portal_pins 316 pin = "%(p)s%(b)s%(n)s" % vars() 317 ref = datastructure[self.reference] 318 import pdb;pdb.set_trace() 319 ok = pins.searchAndSetRecord(pin,ref) 320 while 1: 321 if ok == -1: 322 err = 'invalid Pin' 323 break 324 if ok == 0: 325 err = 'Pin already used' 326 break 327 if ok >= 1: 328 student = getStudentByRegNo(self,ref) 329 if student is None: 330 err = "Student not Found in validate SC" 331 break 332 s_id = student.getId() 333 if ok == 2: 334 break 335 break 305 336 if err: 306 337 datastructure.setError(widget_id, err) … … 311 342 datastructure[widget_id+'_b'] = b 312 343 datastructure[widget_id+'_n'] = n 344 datastructure['s_id'] = s_id 313 345 #import pdb;pdb.set_trace() 314 346 return not err 315 347 316 def render(self, mode, datastructure, **kw): 348 def render(self, mode, datastructure, **kw): ###( 317 349 """Render in mode from datastructure.""" 318 350 render_method = 'widget_scratch_card_pin_render' … … 327 359 datamodel = datastructure.getDataModel() 328 360 v = datamodel[self.fields[0]] 361 if v and type(v) is StringType: 362 p,b,n = v.split('-') 363 v = ScratchCardPin(v,b,n) 329 364 if v: 330 365 b = '%s' % v.b … … 338 373 datastructure[widget_id+'_n'] = n 339 374 375 ###) 376 340 377 341 378 return meth(mode=mode, -
WAeUP_SRP/trunk/exportimport.py
r486 r502 15 15 16 16 # Zope3 component architecture 17 from zope.app import zapi 17 18 from zope.component import adapts 18 19 from zope.interface import implements … … 38 39 NAME = 'waeup' 39 40 41 def importWAeUPTable(obj, parent_path, context, name): 42 """ Import subobjects recursively. 43 """ 44 importer = zapi.queryMultiAdapter((obj, context), IBody) 45 46 path = '%s%s' % (parent_path, obj.getId().replace(' ', '_')) 47 __traceback_info__ = path 48 if importer: 49 path = '%s%s' % (parent_path, name) 50 filename = '%s%s' % (path, importer.suffix) 51 body = context.readDataFile(filename) 52 if body is not None: 53 importer.filename = filename # for error reporting 54 importer.body = body 55 56 if getattr(obj, 'objectValues', False): 57 for sub in obj.objectValues(): 58 importObjects(sub, path+'/', context) 59 40 60 def exportWAeUP(context): 41 61 """Export our WAeUP tool configuration … … 56 76 pm.setLocalGroupRoles(site,['role:Authenticated',],'SectionReader') 57 77 58 importObjects(site.portal_accommodation, '', context) 78 importWAeUPTable(site.portal_accommodation, '', context,'accommodation') 79 importWAeUPTable(site.portal_pins, '', context,'pins') 59 80 60 from Products.GenericSetup.ZCatalog.exportimport import ZCatalogXMLAdapter 81 from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter 82 #from Products.GenericSetup.ZCatalog.exportimport import ZCatalogXMLAdapter 61 83 62 84 from interfaces import IWAeUPTable 63 85 64 class WAeUPTableXMLAdapter( ZCatalogXMLAdapter):65 86 class WAeUPTableXMLAdapter(CatalogToolXMLAdapter): 87 #class WAeUPTableXMLAdapter(ZCatalogXMLAdapter): 66 88 __used_for__ = IWAeUPTable 67 68 89 _LOGGER_ID = 'waeup_table' 69 90 70 name = 'accommodation' 71 91 ## def _importNode(self, node): 92 ## """Import the object from the DOM node. 93 ## """ 94 ## if self.environ.shouldPurge(): 95 ## self._purgeProperties() 96 ## self._purgeObjects() 97 ## self._purgeIndexes() 98 ## self._purgeColumns() 99 ## 100 ## self._logger.info('Catalog imported.') 72 101 # This the XMLAdapter itself. It encodes the im- / export logic that is specific 73 102 # to our tool. `im- / exportObjects` functions will find it thanks to the zope -
WAeUP_SRP/trunk/interfaces.py
r486 r502 20 20 """Tables to store object relational data 21 21 """ 22 22 23 23 def addRecord(**data): 24 24 """Adds a record, with the data expressed in the data mapping. … … 30 30 """Deletes the record specified by the uid""" 31 31 32 def searchAndSetRecord(self, **data): 33 """ 34 searches a record and set a specific value if this is unset 35 raises an error when not found. 36 returns 37 -1 if not found 38 0 if already set by other 39 1 if found and not set 40 2 if found and set 41 """ 42 32 43 def modifyRecord(uid, **data): 33 44 """Modifies a record, with the data expressed in the data mapping. -
WAeUP_SRP/trunk/profiles/default/accommodation.xml
r486 r502 1 1 <?xml version="1.0"?> 2 <object name="portal_ catalog" meta_type="CMF Catalog">2 <object name="portal_accommodation" meta_type="CMF Catalog"> 3 3 <column value="bed"/> 4 4 <column value="student"/> -
WAeUP_SRP/trunk/profiles/default/layouts.xml
r486 r502 3 3 <property name="title"></property> 4 4 <object name="accommodation" meta_type="CPS Layout"/> 5 <object name="accopay" meta_type="CPS Layout"/>6 5 <object name="certificate" meta_type="CPS Layout"/> 7 6 <object name="certificate_course" meta_type="CPS Layout"/> -
WAeUP_SRP/trunk/profiles/default/layouts/scratch_card_batch.xml
r488 r502 33 33 <property name="max_value">100000</property> 34 34 </widget> 35 <widget name="prefix" meta_type="String Widget"> 36 <property name="title">Prefix</property> 37 <property name="fields"> 38 <element value="prefix"/> 39 </property> 40 <property name="is_required">True</property> 41 <property name="label">Prefix</property> 42 <property name="label_edit">Prefix</property> 43 <property name="readonly_layout_modes"/> 44 <property name="hidden_layout_modes"/> 45 <property name="hidden_readonly_layout_modes"/> 46 <property name="display_width">3</property> 47 <property name="size_max">3</property> 48 </widget> 49 <widget name="sold_by" meta_type="String Widget"> 35 <widget name="prefix" meta_type="Select Widget"> 36 <property name="title">Prefix</property> 37 <property name="fields"> 38 <element value="prefix"/> 39 </property> 40 <property name="label">Prefix</property> 41 <property name="label_edit">Prefix</property> 42 <property name="readonly_layout_modes"/> 43 <property name="hidden_layout_modes"/> 44 <property name="hidden_readonly_layout_modes"/> 45 <property name="vocabulary">pin_prefixes</property> 46 </widget> <widget name="sold_by" meta_type="String Widget"> 50 47 <property name="title">Sold by</property> 51 48 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/pins.xml
r488 r502 1 1 <?xml version="1.0"?> 2 <object name="portal_ catalog" meta_type="CMF Catalog">2 <object name="portal_pins" meta_type="CMF Catalog"> 3 3 <column value="pin"/> 4 4 <column value="student"/> -
WAeUP_SRP/trunk/profiles/default/rolemap.xml
r486 r502 2 2 <rolemap> 3 3 <roles> 4 <role name="Student"/> 4 5 <role name="SectionReader"/> 5 6 <role name="SectionManager"/> … … 7 8 <permissions> 8 9 <permission name="List folder contents" acquire="True"> 10 <role name="Owner"/> 9 11 <role name="SectionManager"/> 10 12 <role name="SectionReader"/> … … 26 28 </permission> 27 29 <permission name="List portal members" acquire="True"> 28 <role name="Member"/>29 30 <role name="SectionManager"/> 30 31 </permission> 31 32 <permission name="Review portal content" acquire="True"> 33 <role name="Owner"/> 32 34 <role name="Reviewer"/> 33 35 <role name="SectionManager"/> -
WAeUP_SRP/trunk/profiles/default/schemas/student_application.xml
r486 r502 1 1 <?xml version="1.0"?> 2 2 <object name="student_application" meta_type="CPS Schema"> 3 <field name="app_ac_batch_no" meta_type="CPS String Field"/>4 3 <field name="app_ac_date" meta_type="CPS DateTime Field"/> 5 4 <field name="app_ac_pin" meta_type="CPS String Field"> 6 <property name="is_searchabletext"> True</property>5 <property name="is_searchabletext">False</property> 7 6 </field> 8 <field name="app_ac_prefix" meta_type="CPS String Field"/>9 7 <field name="entry_mode" meta_type="CPS String Field"/> 10 8 <field name="jamb_age" meta_type="CPS Int Field"/> -
WAeUP_SRP/trunk/profiles/default/skins.xml
r486 r502 9 9 <object name="waeup_academics" meta_type="Filesystem Directory View" 10 10 directory="WAeUP_SRP/skins/waeup_academics"/> 11 <object name="waeup_pins" meta_type="Filesystem Directory View" 12 directory="WAeUP_SRP/skins/waeup_pins"/> 11 13 <object name="waeup_student" meta_type="Filesystem Directory View" 12 14 directory="WAeUP_SRP/skins/waeup_student"/> … … 14 16 <layer name="waeup_custom" insert-after="custom"/> 15 17 <layer name="waeup_default" insert-after="waeup_custom"/> 18 <layer name="waeup_pins" insert-after="waeup_custom"/> 16 19 <layer name="waeup_student" insert-after="waeup_custom"/> 17 20 <layer name="waeup_academics" insert-after="waeup_custom"/> … … 20 23 <layer name="waeup_custom" insert-after="custom"/> 21 24 <layer name="waeup_default" insert-after="waeup_custom"/> 25 <layer name="waeup_pins" insert-after="waeup_custom"/> 22 26 <layer name="waeup_student" insert-after="waeup_custom"/> 23 27 <layer name="waeup_academics" insert-after="waeup_custom"/> -
WAeUP_SRP/trunk/profiles/default/skins/waeup_pins.xml
r501 r502 1 1 <?xml version="1.0"?> 2 <object name="waeup_ student" meta_type="Folder">2 <object name="waeup_pins" meta_type="Folder"> 3 3 <property name="title"></property> 4 4 </object> -
WAeUP_SRP/trunk/skins/waeup_academics/academics_contents.pt
r486 r502 43 43 </div> 44 44 <span tal:omit-tag="" tal:condition="python:display_buttons or context.display_content()" 45 tal:content="structure doc/render" />45 tal:content="structure python: doc.render(proxy=here,layout_mode='view')" /> 46 46 47 47 <form action="" method="post" class="group" -
WAeUP_SRP/trunk/skins/waeup_custom/logged_in.pt
r486 r502 38 38 dum_home mtool/createMemberArea" 39 39 > 40 <span tal:condition=" nothing"40 <span tal:condition="python:1" 41 41 tal:define="dummy python: context.process_waeup_login(member=member,sc_pin=request.get('sc_pin',None))" /> 42 42 <tal:block condition="first_time"> -
WAeUP_SRP/trunk/skins/waeup_default/process_waeup_login.py
r472 r502 7 7 request = context.REQUEST 8 8 response=request.response 9 return 10 ## 11 ##if request.form.get('submit') == 'Login': 12 ## #waeup = context.portal_catalog(id = 'demouni')[0] 13 ## #waeup = context.portal_catalog(portal_type = 'University')[0] 14 ## if 1 or "Manager" in member.getRoles(): 15 ## return 16 ###return 17 ##member_id = str(member) 9 import DateTime 10 current = DateTime.DateTime() 11 # 12 if request.form.get('submit') == 'Login': 13 if "Manager" in member.getRoles(): 14 return 15 member_id = str(member) 16 student = getattr(context.students,member_id) 17 application = student.application 18 #student.invokeFactory('StudentPersonal','personal') 19 apdoc = application.getContent() 20 names = apdoc.jamb_lastname.split() 21 dp = {} 22 if len(names) == 3: 23 dp['firstname'] = names[0].capitalize() 24 dp['middlename'] = names[1].capitalize() 25 dp['lastname'] = names[2].capitalize() 26 elif len(names) == 2: 27 dp['firstname'] = names[0].capitalize() 28 dp['lastname'] = names[1].capitalize() 29 else: 30 dp['lastname'] = apdoc.jamb_lastname 31 dp['sex'] = apdoc.jamb_sex == 'F' 32 dp['lga'] = "%s/%s" % (apdoc.jamb_state,apdoc.jamb_lga ) 33 student.personal.getContent().edit(mapping = dp) 34 ##student.content_status_modify(workflow_action="enter_application_pin") 35 36 da = {} 37 da['app_ac_pin'] = request.get('pin') 38 da['app_ac_date'] = current 39 apdoc.edit(mapping = da) 40 41 return response.redirect("%s/application_form" % student.application.absolute_url()) 42 18 43 ##ma = getattr(context,member_id) 19 44 ##jkw = {'application_sc_pin': sc_pin} … … 53 78 ##context.notifyCPSDocumentCreation(ob=pd) 54 79 ## 55 ##return response.redirect("%s" % ma.absolute_url())56 80 ###return ma.personal_addon(REQUEST=context.REQUEST) 57 81 -
WAeUP_SRP/trunk/skins/waeup_pins/scratch_card_batch_create_do.py
r501 r502 33 33 ob.getContent().edit(mapping=datamodel) 34 34 35 context.notifyCPSDocumentCreation(ob=ob) # BBB obsolete in CPS 3.5.035 #context.notifyCPSDocumentCreation(ob=ob) # BBB obsolete in CPS 3.5.0 36 36 37 37 return ob -
WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py
r488 r502 7 7 import DateTime 8 8 current = DateTime.DateTime() 9 pr = context.portal_registration 9 10 10 11 … … 25 26 layout_mode='create', 26 27 formaction = "apply_admission", 27 submit = "check",28 button = "Open JAMB Record", 28 29 ) 29 30 if psm == 'invalid': … … 43 44 ) 44 45 elif psm == 'valid': 45 jamb_id = ds.get('jamb_reg_no') 46 student = context.getContent().getStudentByRegNo(jamb_id) 47 if student is None: 48 psm = "JAMB record %s not accessible." % (jamb_id) 49 return context.application_pin_form(rendered = res, 50 psm = psm, 51 #psm = "%s, %s" % (psm,ds), 52 ds = ds, 53 ) 54 application = student.application 55 if context.portal_workflow.getInfoFor(student,'review_state',None) == "created": 56 #student.invokeFactory('StudentClearance','clearance') 57 student.invokeFactory('StudentPersonal','personal') 58 student.content_status_modify(workflow_action="enter_application_pin") 46 s_id = ds.get('s_id') 47 return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" 48 % (context.absolute_url(),s_id,'uNsEt',ds.get('app_ac_pin'))) 49 50 ## jamb_id = ds.get('jamb_reg_no') 51 ## student = context.getContent().getStudentByRegNo(jamb_id) 52 ## if student is None: 53 ## psm = "JAMB record %s not accessible." % (jamb_id) 54 ## return context.application_pin_form(rendered = res, 55 ## psm = psm, 56 ## #psm = "%s, %s" % (psm,ds), 57 ## ds = ds, 58 ## ) 59 ##if context.portal_workflow.getInfoFor(student,'review_state',None) == "created": 60 ## #student.invokeFactory('StudentClearance','clearance') 61 ##da = {} 62 ##pin = str(ds.get('app_ac_pin')) 63 ##da['app_ac_pin'] = pin 64 ##da['app_ac_date'] = current 65 ##apdoc.edit(mapping = da) 59 66 60 67 61 apdoc = application.getContent()62 names = apdoc.jamb_lastname.split()63 dp = {}64 if len(names) == 3:65 dp['firstname'] = names[0].capitalize()66 dp['middlename'] = names[1].capitalize()67 dp['lastname'] = names[2].capitalize()68 elif len(names) == 2:69 dp['firstname'] = names[0].capitalize()70 dp['lastname'] = names[1].capitalize()71 else:72 dp['lastname'] = apdoc.jamb_lastname73 dp['sex'] = apdoc.jamb_sex == 'F'74 dp['lga'] = "%s/%s" % (apdoc.jamb_state,apdoc.jamb_lga )75 student.personal.getContent().edit(mapping = dp)76 da = {}77 da['app_ac_pin'] = ds.get('app_ac_pin')78 da['app_ac_date'] = current79 apdoc.edit(mapping = da)80 68 # now display the passport form with jamb-data readonly 81 69 return context.REQUEST.RESPONSE.redirect("%s/application_form" % (student.application.absolute_url())) -
WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt
r493 r502 81 81 class="standalone" 82 82 name="cpsdocument_create_button" 83 value="apply" 84 i18n:attributes="value" tal:condition="creation" /> 83 value="apply" 84 tal:attributes="value options/button" 85 tal:condition="creation" /> 85 86 86 87 </form> 87 88 89 88 </metal:block> 90 89
Note: See TracChangeset for help on using the changeset viewer.