Ignore:
Timestamp:
27 Sep 2006, 17:03:31 (18 years ago)
Author:
joachim
Message:

search for students ready for testing, update waeup_student_wf first

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py

    r565 r572  
    1515form = request.form
    1616fget = form.get
     17info = {}
    1718wf = context.portal_workflow
     19catalog = context.portal_catalog
     20student_wf_states = wf.waeup_student_wf.states.keys()
     21info['wf_states'] = student_wf_states
     22info['wf_states'][0] = " ----- "
     23
    1824mtool = context.portal_membership
    1925member = mtool.getAuthenticatedMember()
    2026path_info = request.get('PATH_INFO').split('/')
    2127roles = member.getRoles()
    22 info = {}
    2328info['is_manager'] = 'Manager' in roles or 'SectionManager' in roles
    2429student_id = fget('student_id')
     
    2631matric_no = fget('matric_no')
    2732name = fget('name')
    28 info['students'] = []
     33state = fget('state')
     34if state == " ----- ":
     35    state = ''
     36onlyreview = state and not (student_id or jamb_id or matric_no or name)
     37items = []
     38res = []
     39portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']}
     40if onlyreview:
     41    res = catalog(portal_type=portal_type_query,
     42                  review_state=state)
     43elif student_id:
     44    res = catalog(portal_type='Student',
     45                  id = student_id.strip())
     46elif jamb_id:
     47    res = catalog(portal_type='StudentApplication',
     48                  SearchableText="%s*" % jamb_id.strip().lower())
     49elif matric_no:
     50    res = catalog(portal_type='StudentClearance',
     51                  SearchableText="%s*" % matric_no.strip().lower())
     52elif name:
     53    res = catalog(portal_type=portal_type_query,
     54                  SearchableText="%s*" % name.strip())
     55if res:
     56    for r in res:
     57        row = {}
     58        if r.portal_type in ("StudentApplication","StudentPersonal"):
     59            items.append(r.getObject().aq_parent)
     60        else:
     61            items.append(r.getObject())
     62info['state'] = state
     63info['student_id'] = student_id
     64info['jamb_id'] = jamb_id
     65info['matric_no'] = matric_no
     66info['name'] = name
     67
     68info['students'] = items
    2969return info
Note: See TracChangeset for help on using the changeset viewer.