Changeset 1728 for WAeUP_SRP/trunk


Ignore:
Timestamp:
3 May 2007, 07:54:44 (17 years ago)
Author:
joachim
Message:

reworked addstudent and import_student as a basis for massimport.

Location:
WAeUP_SRP/trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r1721 r1728  
    13521352                format = ','.join(['"%%(%s)s"' % k for k in right_keys])
    13531353                format_error = format + ',"%(error)s"'
    1354             study_course = record.get('study_course')
     1354            study_course = makeCertificateCode(record.get('study_course'))
    13551355            matric_no = record.get('matric_no')
    13561356            student_res = self.students_catalog(matric_no = matric_no)
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1721 r1728  
    6363                     )
    6464
     65    student_field2types = {   ###(
     66                      'StudentApplication':
     67                          {'id': 'application',
     68                           'title': 'Application Data',
     69                           'fields':
     70                             ('jamb_reg_no',
     71                              'entry_mode',
     72                              'entry_level',
     73                              'entry_session',
     74                              'jamb_score',
     75                              'email',
     76                              'phone',
     77                              )
     78                              },
     79                      'StudentPume':
     80                          {'id': 'pume',
     81                           'title': 'Pume Data',
     82                           'fields':
     83                             ('pume_score',
     84                              )
     85                              },
     86                      'StudentClearance':
     87                          {'id': 'clearance',
     88                           'title': 'Clearance Data',
     89                           'fields':
     90                             ('matric_no',
     91                              'entry_level',
     92                              'entry_session',
     93                              'nationality',
     94                              'lga',
     95                              )
     96                              },
     97                         'StudentPersonal':
     98                          {'id': 'personal',
     99                           'title': 'Personal Data',
     100                           'fields':
     101                             ('firstname',
     102                              'middlename',
     103                              'lastname',
     104                              'sex',
     105                              'email',
     106                              'phone',
     107                              )
     108                              },
     109                         'StudentStudyCourse':
     110                          {'id': 'study_course',
     111                           'title': 'Study Course',
     112                           'fields':
     113                             ('study_course',
     114                              'current_level',
     115                              'current_session',
     116                              'current_verdict',
     117                              )
     118                              },
     119                         }
     120    ###)
     121
    65122    def rwrite(self,s):
    66123        response = self.REQUEST.RESPONSE
     
    199256        password = self.generatePassword()
    200257        self.makeStudentMember(sid,password)
    201         status,entry_mode = dict.get('entry_mode').split('_')
     258        f2t = self.student_field2types
     259        for pt in f2t.keys():
     260            student_obj.invokeFactory(pt,f2t[pt]['id'])
     261            sub_obj = getattr(student_obj,f2t[pt]['id'])
     262            sub_doc = sub_obj.getContent()
     263            self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj)
     264            d = {'Title': f2t[pt]['title']}
     265            for field in f2t[pt]['fields']:
     266                d[field] = dict.get(field,None)
     267            if pt == 'StudentPersonal':
     268                d['sex'] = dict.get('sex') == 'F'
     269            sub_doc.edit(mapping = d)
     270            self.portal_workflow.doActionFor(sub_obj,'close',dest_container=sub_obj)
     271           
     272        entry_session = dict.get('entry_session')
    202273        wfaction = 'return'
    203         if status == "NEW":
     274        if entry_session == self.getSessionId():
    204275            wfaction = 'admit'
    205         matric_no = dict.get('matric_no')
    206         email = dict.get('email')
    207         level = dict.get('level')
    208         jamb_reg_no = dict.get('jamb_reg_no')
    209         study_course = dict.get('study_course')
    210276        self.portal_workflow.doActionFor(student_obj,wfaction)
    211277        student_obj.manage_setLocalRoles(sid, ['Owner',])
    212         student_obj.invokeFactory('StudentApplication','application')
    213         application = student_obj.application
    214         self.portal_workflow.doActionFor(application,'open',dest_container=application)
    215         da = {'Title': 'Application Data'}
    216         student_obj.invokeFactory('StudentPersonal','personal')
    217         da['entry_mode'] = entry_mode
    218         personal = student_obj.personal
    219         self.portal_workflow.doActionFor(personal,'open',dest_container=personal)
    220         dp = {'Title': 'Personal Data'}
    221         student_obj.invokeFactory('StudentClearance','clearance')
    222         clearance = student_obj.clearance
    223         self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance)
    224         dc = {'Title': 'Clearance/Eligibility Record'}
    225         dc['matric_no'] = matric_no
    226         da['app_email'] = dp['email'] = email
    227         da['jamb_reg_no'] = jamb_reg_no
    228         dp['firstname'] = dict.get('firstname')
    229         dp['middlename'] = dict.get('middlename')
    230         dp['lastname'] = dict.get('lastname')
    231         da['jamb_lastname'] = "%(firstname)s %(middlename)s %(lastname)s" % dict
    232         sex = dict.get('sex')
    233         if sex:
    234             da['jamb_sex'] = 'F'
    235         else:
    236             da['jamb_sex'] = 'M'
    237         dp['sex'] = sex
    238         application.getContent().edit(mapping=da)
    239         self.portal_workflow.doActionFor(application,'close',dest_container=application)
    240         personal.getContent().edit(mapping=dp)
    241         clearance.getContent().edit(mapping=dc)
    242         self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance)
    243         catd = {}
    244         catd['id'] = sid
    245         catd['entry_mode']= entry_mode
    246         catd['email'] = email
    247         catd['jamb_reg_no'] = jamb_reg_no
    248         catd['matric_no'] = matric_no
    249         catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp
    250         catd['sex'] = dp['sex']
    251         catd['level'] = level
    252         certificate_brain = self.getCertificateBrain(study_course)
    253         if certificate_brain:
    254             cpath = certificate_brain.getPath().split('/')
    255             catd['faculty'] = cpath[-4]
    256             catd['department'] = cpath[-3]
    257             catd['course'] = study_course
    258         self.students_catalog.addRecord(**catd)
    259         #
    260         # Study Course
    261         #
    262         student_obj.invokeFactory('StudentStudyCourse','study_course')
    263         sc = student_obj.study_course
    264         self.portal_workflow.doActionFor(sc,'open',dest_container=sc)
    265         dsc = {}
    266         dsc['study_course'] = study_course
    267         dsc['current_level'] = level
    268         sc.getContent().edit(mapping=dsc)
    269 
     278##        matric_no = dict.get('matric_no')
     279##        email = dict.get('email')
     280##        #level = dict.get('level')
     281##        jamb_reg_no = dict.get('jamb_reg_no')
     282##        study_course = dict.get('study_course')
     283##        self.portal_workflow.doActionFor(student_obj,wfaction)
     284##        student_obj.manage_setLocalRoles(sid, ['Owner',])
     285##        student_obj.invokeFactory('StudentApplication','application')
     286##        application = student_obj.application
     287##        self.portal_workflow.doActionFor(application,'open',dest_container=application)
     288##        da = {'Title': 'Application Data'}
     289##        student_obj.invokeFactory('StudentPersonal','personal')
     290##        da['entry_mode'] = entry_mode
     291##        personal = student_obj.personal
     292##        self.portal_workflow.doActionFor(personal,'open',dest_container=personal)
     293##        dp = {'Title': 'Personal Data'}
     294##        student_obj.invokeFactory('StudentClearance','clearance')
     295##        clearance = student_obj.clearance
     296##        self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance)
     297##        dc = {'Title': 'Clearance/Eligibility Record'}
     298##        dc['matric_no'] = matric_no
     299##        da['app_email'] = dp['email'] = email
     300##        da['jamb_reg_no'] = jamb_reg_no
     301##        dp['firstname'] = dict.get('firstname')
     302##        dp['middlename'] = dict.get('middlename')
     303##        dp['lastname'] = dict.get('lastname')
     304##        da['jamb_lastname'] = "%(firstname)s %(middlename)s %(lastname)s" % dict
     305##        sex = dict.get('sex')
     306##        if sex:
     307##            da['jamb_sex'] = 'F'
     308##        else:
     309##            da['jamb_sex'] = 'M'
     310##        dp['sex'] = sex
     311##        application.getContent().edit(mapping=da)
     312##        self.portal_workflow.doActionFor(application,'close',dest_container=application)
     313##        personal.getContent().edit(mapping=dp)
     314##        clearance.getContent().edit(mapping=dc)
     315##        self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance)
     316####        catd = {}
     317####        catd['id'] = sid
     318####        catd['entry_mode']= entry_mode
     319####        catd['email'] = email
     320####        catd['jamb_reg_no'] = jamb_reg_no
     321####        catd['matric_no'] = matric_no
     322####        catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp
     323####        catd['sex'] = dp['sex']
     324####        catd['level'] = level
     325####        certificate_brain = self.getCertificateBrain(study_course)
     326####        if certificate_brain:
     327####            cpath = certificate_brain.getPath().split('/')
     328####            catd['faculty'] = cpath[-4]
     329####            catd['department'] = cpath[-3]
     330####            catd['course'] = study_course
     331####        self.students_catalog.addRecord(**catd)
     332##        #
     333##        # Study Course
     334##        #
     335##        student_obj.invokeFactory('StudentStudyCourse','study_course')
     336##        sc = student_obj.study_course
     337##        self.portal_workflow.doActionFor(sc,'open',dest_container=sc)
     338##        dsc = {}
     339##        dsc['study_course'] = study_course
     340##        #dsc['current_level'] = level
     341##        sc.getContent().edit(mapping=dsc)
     342##
    270343        return sid,password
    271344    ###)
  • WAeUP_SRP/trunk/doc/srp_documentation.mm

    r1663 r1728  
    5858<node CREATED="1172156481009" ID="Freemind_Link_615926152" LINK="waeup_student_wf.gif" MODIFIED="1172486913476" TEXT="Diagram"/>
    5959</node>
     60<node CREATED="1170883343230" ID="Freemind_Link_1345153944" MODIFIED="1172162754390" TEXT="User Interface">
     61<node CREATED="1170883352226" ID="Freemind_Link_1688911390" MODIFIED="1172488273241" TEXT="Officer">
     62<node CREATED="1171124982312" ID="Freemind_Link_1991960145" LINK="../profiles/default/layouts/student_create.xml" MODIFIED="1178091125746" TEXT="Layout: student_create" VSHIFT="2"/>
     63<node CREATED="1178091137285" ID="Freemind_Link_1938706963" LINK="../skins/waeup_student/add_student.py" MODIFIED="1178091313673" TEXT="PY: add_student"/>
     64<node CREATED="1178091137285" ID="Freemind_Link_954925660" LINK="../skins/waeup_student/add_student_form.pt" MODIFIED="1178091384412" TEXT="PT: add_student_form"/>
     65</node>
     66</node>
    6067<node CREATED="1170082164451" FOLDED="true" ID="Freemind_Link_1627718074" MODIFIED="1171894825978" TEXT="Accommodation Data">
    6168<node CREATED="1170083733194" ID="Freemind_Link_1398132513" MODIFIED="1171894857194" TEXT="Id: accommodation06"/>
     
    7885</node>
    7986</node>
    80 <node CREATED="1170082164451" FOLDED="true" ID="Freemind_Link_1808367236" MODIFIED="1171711160327" TEXT="Application Data">
     87<node CREATED="1170082164451" ID="Freemind_Link_1808367236" MODIFIED="1171711160327" TEXT="Application Data">
    8188<node CREATED="1170083733194" ID="Freemind_Link_1603566745" MODIFIED="1170862024807" TEXT="Id: application"/>
    8289<node CREATED="1170083603042" ID="Freemind_Link_1501749959" LINK="../profiles/default/types/StudentApplication.xml" MODIFIED="1171009517689" TEXT="Type: StudentApplication"/>
     
    116123<node CREATED="1172156481009" ID="Freemind_Link_1817393683" LINK="waeup_student_subobject_wf.gif" MODIFIED="1172903933018" TEXT="Diagram"/>
    117124</node>
    118 <node CREATED="1170883343230" FOLDED="true" ID="Freemind_Link_998392827" MODIFIED="1172162754390" TEXT="User Interface">
     125<node CREATED="1170883343230" ID="Freemind_Link_998392827" MODIFIED="1172162754390" TEXT="User Interface">
    119126<node CREATED="1170883352226" FOLDED="true" ID="Freemind_Link_556396570" MODIFIED="1172163796143" TEXT="Student">
    120127<node CREATED="1171124982312" ID="Freemind_Link_683557361" LINK="../profiles/default/layouts/student_clearance_fe.xml" MODIFIED="1172590208847" TEXT="Layout: student_clearance_fe" VSHIFT="2"/>
     
    128135</node>
    129136</node>
    130 <node CREATED="1170883352226" FOLDED="true" ID="Freemind_Link_1353155855" MODIFIED="1172488273241" TEXT="Officer">
     137<node CREATED="1170883352226" ID="Freemind_Link_1353155855" MODIFIED="1172488273241" TEXT="Officer">
    131138<node CREATED="1171124982312" ID="Freemind_Link_1920730860" LINK="../profiles/default/layouts/student_clearance.xml" MODIFIED="1172590245309" TEXT="Layout: student_clearance" VSHIFT="2"/>
    132139<node CREATED="1172488875157" FOLDED="true" ID="Freemind_Link_888492061" MODIFIED="1172488877500" TEXT="view">
     
    141148</node>
    142149</node>
    143 <node CREATED="1170082180802" FOLDED="true" ID="Freemind_Link_634523864" MODIFIED="1171711172044" TEXT="Personal Data">
     150<node CREATED="1170082180802" ID="Freemind_Link_634523864" MODIFIED="1171711172044" TEXT="Personal Data">
    144151<node CREATED="1170083733194" ID="Freemind_Link_1809756717" MODIFIED="1170862205697" TEXT="Id: personal"/>
    145152<node CREATED="1170083603042" ID="Freemind_Link_212388289" LINK="../profiles/default/types/StudentPersonal.xml" MODIFIED="1171010050967" TEXT="Type: StudentPersonal"/>
     
    171178</node>
    172179</node>
    173 <node CREATED="1170082392807" ID="Freemind_Link_1979443941" MODIFIED="1171711179966" TEXT="Study Course">
     180<node CREATED="1170082392807" FOLDED="true" ID="Freemind_Link_1979443941" MODIFIED="1171711179966" TEXT="Study Course">
    174181<node CREATED="1170930140692" ID="Freemind_Link_607082969" MODIFIED="1171009488850" TEXT="Id: study_course"/>
    175182<node CREATED="1170930264337" ID="Freemind_Link_1384807180" LINK="../profiles/default/types/StudentStudyCourse.xml" MODIFIED="1172159914623" TEXT="Type: StudentStudyCourse"/>
     
    211218<node CREATED="1172488817664" ID="Freemind_Link_183452447" MODIFIED="1172488820358" TEXT="view">
    212219<node CREATED="1172163808013" LINK="../skins/waeup_student/application_slip.pt" MODIFIED="1172488857021" TEXT="PT: application_slip"/>
    213 <node CREATED="1172163797590" LINK="../skins/waeup_student/application_view.pt" MODIFIED="1172488862899" TEXT="PT: application_view"/>
    214 </node>
    215 <node CREATED="1172488821089" FOLDED="true" ID="Freemind_Link_1024852395" MODIFIED="1172488823242" TEXT="edit">
     220<node CREATED="1172163797590" ID="Freemind_Link_1061894954" LINK="../skins/waeup_student/application_view.pt" MODIFIED="1178091232930" TEXT="PT: application_view"/>
     221</node>
     222<node CREATED="1172488821089" ID="Freemind_Link_1024852395" MODIFIED="1172488823242" TEXT="edit">
    216223<node CREATED="1172163808013" LINK="../skins/waeup_student/application_edit_form.pt" MODIFIED="1172488851172" TEXT="PT: application_edit_form"/>
    217 <node CREATED="1172163808013" ID="Freemind_Link_987823120" LINK="../skins/waeup_student/application_edit.py" MODIFIED="1173007903444" TEXT="PY: application_edit"/>
     224<node CREATED="1172163808013" ID="Freemind_Link_987823120" LINK="../skins/waeup_student/application_edit.py" MODIFIED="1178091292813" TEXT="PY: application_edit"/>
    218225</node>
    219226</node>
     
    303310<node CREATED="1171712154817" ID="Freemind_Link_1307066201" LINK="../profiles/default/pumeresults.xml" MODIFIED="1172055646399" TEXT="PUME/PDE Resuts Table"/>
    304311</node>
    305 <node CREATED="1172001308558" FOLDED="true" ID="Freemind_Link_1997267023" MODIFIED="1172490300476" TEXT="Profiles">
     312<node CREATED="1172001308558" ID="Freemind_Link_1997267023" MODIFIED="1172490300476" TEXT="Profiles">
    306313<node CREATED="1172001324877" ID="Freemind_Link_1866579033" MODIFIED="1172001330846" TEXT="default">
    307314<node CREATED="1172001340812" ID="Freemind_Link_274105864" LINK="../profiles/default/directories.xml" MODIFIED="1172001465313" TEXT="portal_directories"/>
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r1456 r1728  
    1111  <object name="department" meta_type="CPS Layout"/>
    1212  <object name="faculty" meta_type="CPS Layout"/>
     13  <object name="import_student" meta_type="CPS Layout"/>
    1314  <object name="members" meta_type="CPS Layout"/>
    1415  <object name="members_search" meta_type="CPS Layout"/>
  • WAeUP_SRP/trunk/profiles/default/schemas/import_student.xml

    r1700 r1728  
    22<?xml-stylesheet type="text/xsl" href="schema.xsl"?>
    33<object name="import_student" meta_type="CPS Schema">
    4  <field name="mode" meta_type="CPS String Field"/>
    54 <field name="firstname" meta_type="CPS String Field"/>
    65 <field name="middlename" meta_type="CPS String Field"/>
    76 <field name="lastname" meta_type="CPS String Field"/>
    87 <field name="sex" meta_type="CPS String Field"/>
     8 <field name="religion" meta_type="CPS String Field"/>
    99 <field name="jamb_reg_no" meta_type="CPS String Field"/>
    1010 <field name="entry_mode" meta_type="CPS String Field"/>
     11 <field name="entry_session" meta_type="CPS String Field"/>
    1112 <field name="jamb_score" meta_type="CPS Int Field"/>
    1213 <field name="pume_score" meta_type="CPS Int Field"/>
     
    1516 <field name="study_course" meta_type="CPS String Field"/>
    1617 <field name="matric_no" meta_type="CPS String Field"/>
    17  <field name="state" meta_type="CPS String Field"/>
     18 <field name="nationality" meta_type="CPS String Field"/>
    1819 <field name="lga" meta_type="CPS String Field"/>
    1920 <field name="phone" meta_type="CPS String Field"/>
    2021 <field name="email" meta_type="CPS String Field"/>
    21  <field name="address" meta_type="CPS String Field"/>
     22 <field name="current_level" meta_type="CPS String Field"/>
     23 <field name="current_session" meta_type="CPS String Field"/>
     24 <field name="current_verdict" meta_type="CPS String Field"/>
    2225</object>
  • WAeUP_SRP/trunk/profiles/default/vocabularies.xml

    r1449 r1728  
    2222 <object name="high_qual" meta_type="CPS Vocabulary"/>
    2323 <object name="religion" meta_type="CPS Vocabulary"/>
     24 <object name="sessions" meta_type="CPS Method Vocabulary"/>
    2425 <object name="exam_types" meta_type="CPS Vocabulary"/>
    2526 <object name="pin_prefixes" meta_type="CPS Vocabulary"/>
  • WAeUP_SRP/trunk/skins/waeup_student/add_student.py

    r1571 r1728  
    1919d = {}
    2020mode = 'edit'
    21 rendered,psm,ds = lt.renderLayout(layout_id= 'student_create',
    22                       schema_id= 'student_create',
     21rendered,psm,ds = lt.renderLayout(layout_id= 'import_student',
     22                      schema_id= 'import_student',
    2323                      context=context,
    2424                      mapping=validate and REQUEST,
     
    6969logger.info('%s created student %s' % (member,sid))
    7070return context.add_student_form(rendered = rendered,
    71                                  #psm = "%s, %s" % (psm,ds),
    7271                                 mode = 'view',
    7372                                 psm = psm,
Note: See TracChangeset for help on using the changeset viewer.