Changeset 1169 for WAeUP_SRP


Ignore:
Timestamp:
1 Jan 2007, 16:38:46 (18 years ago)
Author:
joachim
Message:

display_session_results now asks for jamb_reg_no
set_access_data uses this information
permission mappings for new states in waeup_student_wf added
set_access_data is now called from a form

Location:
WAeUP_SRP/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1160 r1169  
    134134        student_obj.invokeFactory('StudentApplication','application')
    135135        application = student_obj.application
    136         self.portal_workflow.doActionFor(application,'close',dest_container=application)
     136        self.portal_workflow.doActionFor(application,'open',dest_container=application)
    137137        da = {'Title': 'Application Data'}
    138138        student_obj.invokeFactory('StudentPersonal','personal')
     
    144144        student_obj.invokeFactory('StudentClearance','clearance')
    145145        clearance = student_obj.clearance
    146         self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance)
     146        self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance)
    147147        dc = {'Title': 'Clearance/Eligibility Record'}
    148148        dc['matric_no'] = matric_no
     
    162162        dp['perm_address'] = student.Permanent_Address
    163163        application.getContent().edit(mapping=da)
     164        self.portal_workflow.doActionFor(application,'close',dest_container=application)
    164165        personal.getContent().edit(mapping=dp)
    165166        clearance.getContent().edit(mapping=dc)
     167        self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance)
    166168        catd = {}
    167169        catd['id'] = sid
  • WAeUP_SRP/trunk/Widgets.py

    r1155 r1169  
    317317    """ JambRegNo Widget"""
    318318    meta_type = "JambRegNo Widget"
     319    _properties = CPSStringWidget._properties + (
     320        {'id': 'catalog', 'type': 'string', 'mode': 'w',
     321         'label': 'Catalog to search'},
     322         {'id': 'reference', 'type': 'string', 'mode': 'w',
     323         'label': 'Reference Field'},
     324         )
     325    catalog = "portal_pumeresults" #the catalog to search for jamb_reg_no
     326    reference = ""
    319327    digits = 8
    320328    digits_str = "N"*digits
     
    323331    def validate(self, datastructure, **kw):
    324332        """Validate datastructure and update datamodel."""
    325 
    326333        valid = CPSStringWidget.validate(self, datastructure, **kw)
    327334        #import pdb;pdb.set_trace()
    328         pumeresults = self.portal_pumeresults
    329         if not valid:
    330             return 0
    331         else:
    332             widget_id = self.getWidgetId()
    333             value = datastructure[widget_id].upper()
    334             err = 0
    335             if not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()):
    336                 err = 'Invalid number, the expected format is: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str)
     335        jamb_nr_catalog = getattr(self,self.catalog)
     336        widget_id = self.getWidgetId()
     337        value = datastructure[widget_id].upper()
     338        err = 0
     339        if not valid: #or not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()):
     340            #err = 'Invalid number, the expected format is: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str)
     341            err = 'Invalid number'
     342        elif self.reference == '':
     343            #s = getStudentByRegNo(self,value)
     344            pume = jamb_nr_catalog(jamb_reg_no = value)
     345            if len(pume) < 1:
     346                err = 'No Student with JAMB RegNo %s.' % (value)
    337347            else:
    338                 #s = getStudentByRegNo(self,value)
    339                 pume = pumeresults(jamb_reg_no = value)
    340                 if len(pume) < 1:
    341                     err = 'No Student with JAMB RegNo %s.' % (value)
    342                 else:
    343                     datastructure['pume'] = pume[0]
    344             if err:
    345                 datastructure.setError(widget_id, err)
    346             else:
    347                 datamodel = datastructure.getDataModel()
    348                 datamodel[self.fields[0]] = value
    349             return not err
     348                datastructure['pume'] = pume[0]
     349        else:
     350            #import pdb;pdb.set_trace()
     351            record = datastructure[self.reference]
     352            #jamb_reg_no = getattr(record,widget_id)
     353            jamb_reg_no = record.Entryregno
     354            if jamb_reg_no != value:
     355                err = 'Entry Registration Nr does not match.'
     356        if err:
     357            datastructure.setError(widget_id, err)
     358        else:
     359            datamodel = datastructure.getDataModel()
     360            datamodel[self.fields[0]] = value
     361        return not err
    350362
    351363InitializeClass(JambRegNoWidget)
     
    593605         {'id': 'reference', 'type': 'string', 'mode': 'w',
    594606         'label': 'Reference Field'},
    595 
    596607        )
    597608    prefix = ''
     
    626637###)
    627638
    628     def validate(self, datastructure, **kw):
     639    def validate(self, datastructure, **kw): ###(
    629640        """Validate datastructure and update datamodel."""
    630641        s_logger = logging.getLogger('Pin.Validate')
     
    720731        return not err
    721732
     733###)
     734
    722735    def render(self, mode, datastructure, **kw): ###(
    723736        """Render in mode from datastructure."""
     
    767780###)
    768781
    769 class WAeUPImageWidget(CPSImageWidget):
     782class WAeUPImageWidget(CPSImageWidget): ###(
    770783    """Photo widget."""
    771784    meta_type = 'WAeUP Image Widget'
     
    780793        return meth(mode=mode, datastructure=datastructure, **img_info)
    781794
     795###)
     796
    782797
    783798
  • WAeUP_SRP/trunk/profiles/default/layouts/student_session_results_search.xml

    r1158 r1169  
    2020  <property name="hidden_readonly_layout_modes"/>
    2121 </widget>
    22  <widget name="jamb_reg_no" meta_type="String Widget">
     22 <widget name="jamb_reg_no" meta_type="JambRegNo Widget">
    2323  <property name="title">JAMB Registration Number</property>
    2424  <property name="fields">
     
    2929  <property name="readonly_layout_modes"/>
    3030  <property name="hidden_layout_modes">
    31    <element value="create"/>
     31   <element value="edit"/>
    3232  </property>
    3333  <property name="hidden_readonly_layout_modes"/>
     34  <property name="catalog">returning_import</property>
     35  <property name="reference">student</property>
    3436  <property name="display_width">10</property>
    3537  <property name="size_max">10</property>
  • WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml

    r1167 r1169  
    110110  <exit-transition transition_id="notify_change_courses"/>
    111111  <exit-transition transition_id="validate_courses"/>
     112  <permission-map name="View" acquired="True">
     113   <permission-role>Owner</permission-role>
     114   <permission-role>SectionOfficer</permission-role>
     115  </permission-map>
    112116 </state>
    113117 <state state_id="courses_validated" title="">
     118  <permission-map name="View" acquired="True">
     119   <permission-role>Owner</permission-role>
     120   <permission-role>SectionOfficer</permission-role>
     121  </permission-map>
    114122 </state>
    115123 <state state_id="deferred" title="">
     
    180188  <exit-transition transition_id="create_content"/>
    181189  <exit-transition transition_id="enter_school_fee_pin"/>
     190  <permission-map name="View" acquired="True">
     191   <permission-role>Owner</permission-role>
     192   <permission-role>SectionOfficer</permission-role>
     193  </permission-map>
    182194 </state>
    183195 <state state_id="school_fee_pin_entered" title="">
    184196  <exit-transition transition_id="create_content"/>
    185197  <exit-transition transition_id="register_courses"/>
     198  <permission-map name="View" acquired="True">
     199   <permission-role>Owner</permission-role>
     200   <permission-role>SectionOfficer</permission-role>
     201  </permission-map>
    186202 </state>
    187203 <state state_id="student_created" title="">
  • WAeUP_SRP/trunk/skins/waeup_student/createReturningStudent.py

    r1160 r1169  
    88##title=
    99##
    10 # $Id: createStudentFT.py 1151 2006-12-29 22:05:53Z joachim $
    11 ''' create the Studenbase folder'''
     10# $Id: createReturningStudent.py 1151 2006-12-29 22:05:53Z joachim $
     11''' create the Studentbase folder'''
    1212
    1313
     
    3030    return "MatricNo %s not found in Returning Table" % matric_no
    3131student_brain = res[0]
    32 sid = context.waeup_tool.generateStudentId(student_brain.Firstname[0])
     32sid = context.waeup_tool.generateStudentId('?')
    3333students_folder.invokeFactory('Student', sid)
    3434logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no))
    3535student = getattr(students_folder,sid)
    36 wftool.doActionFor(student,'clear_and_validate')
     36wftool.doActionFor(student,'return')
    3737student.manage_setLocalRoles(sid, ['Owner',])
     38jamb_reg_no = student_brain.Entryregno,
    3839context.students_catalog.addRecord(id = sid,
    3940                                   matric_no = matric_no,
    40                                    jamb_reg_no = student_brain.Entryregno,
     41                                   jamb_reg_no = jamb_reg_no,
    4142                                   sex = student_brain.Sex == "F",
    4243                                   name = "%s %s %s" % (student_brain.Firstname,
     
    4445                                                        student_brain.Lastname)
    4546                                )
    46 return "Student MatricNo %s and %s created" % (matric_no,sid)
     47return "Student MatricNo %s, StudentId %s Jamb %s created" % (matric_no,sid,jamb_reg_no)
    4748
  • WAeUP_SRP/trunk/skins/waeup_student/entry_results_anon_view.pt

    r1123 r1169  
    1 <metal:html tal:define="pume options/pume">
     1<metal:html tal:define="pume options/pume;
     2                      result_type pume/result_type|string:PU">
    23  <metal:body use-macro="here/main_template/macros/master">
    34    <metal:main fill-slot="main">
    45
    5         <span tal:condition="python:pume['result_type']!='DE'">       
     6        <span tal:condition="python:result_type =='PU'">       
    67        <div style="text-align: right">
    78        <a href="" target="slip" tal:attributes="href string:entry_results_anon_slip?nr=${pume/jamb_reg_no}"
     
    1415        </span>       
    1516                     
    16         <span tal:condition="python:pume['result_type']=='DE'">
     17        <span tal:condition="python:result_type == 'DE'">
    1718        <div style="text-align: right">
    1819        <a href="" target="slip" tal:attributes="href string:entry_results_anon_slip?nr=${pume/jamb_reg_no}"
  • WAeUP_SRP/trunk/skins/waeup_student/session_results_anon_view.pt

    r1166 r1169  
    5959      </table>
    6060      <br />
    61       <a href="" tal:attributes="href string:${context/absolute_url}/set_access_data?matric_no=${student/matric_no}">
    62         Continue to Login!
    63       </a>
     61      <form action="" method="post"
     62            tal:attributes="action string:${context/portal_url}/set_access_data">
     63        <input type="hidden" name="matric_no" tal:attributes="value student/matric_no" />
     64        <input type="hidden" name="jamb_reg_no" tal:attributes="value student/Entryregno" />
     65        <input type="submit"
     66               class="standalone"
     67               value="Continue to Login!"
     68               name="submit" />
     69      </form>
    6470    </metal:main>
    6571  </metal:body>
  • WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py

    r1158 r1169  
    4242elif psm == 'valid':
    4343    pass
    44     jamb_reg_no = ds.get('jamb_reg_no')
    45     r = context.returning_import(matric_no = matric_no)
    46     if r and r[0].Entryregno != jamb_reg_no or not r:
    47         psm = "Your Jamb Registration Nr is wrong"
    48         return context.set_access_data_form(rendered = res,
    49                                  psm = psm,
    50                                  firstlayout = True,
    51                                  lastlayout = True,
    52                                  ds = ds,
    53                                  )
     44##    jamb_reg_no = ds.get('jamb_reg_no')
     45##    r = context.returning_import(matric_no = matric_no)
     46##    if r and r[0].Entryregno != jamb_reg_no or not r:
     47##        psm = "Your Jamb Registration Nr is wrong"
     48##        return context.set_access_data_form(rendered = res,
     49##                                 psm = psm,
     50##                                 firstlayout = True,
     51##                                 lastlayout = True,
     52##                                 ds = ds,
     53##                                 )
    5454## from Products.zdb import set_trace;set_trace()
    5555password = REQUEST.get('widget__password')
     
    6464args['returning'] = '1'
    6565args['email'] = email
     66args['phone_nr'] = ds.get('phone_nr')
    6667from urllib import urlencode
    6768url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
Note: See TracChangeset for help on using the changeset viewer.