Changeset 1033


Ignore:
Timestamp:
12 Dec 2006, 11:05:00 (18 years ago)
Author:
joachim
Message:

search for department included
search for student_id now directly goes to the Student.

Location:
WAeUP_SRP/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/profiles/default/vocabularies/student_search_mode.xml

    r805 r1033  
    99 <item key="matric_no" msgid="">Matriculation No</item>
    1010 <item key="jamb_reg_no" msgid="">Jamb Registration No</item>
     11 <item key="department" msgid="">Department (complete ids only)</item>
    1112</object>
  • WAeUP_SRP/trunk/skins/waeup_student/get_searchable_student_states.py

    r875 r1033  
    2121    return voc.get(key)
    2222if "ClearanceOfficers" in member.getGroups():
    23     return [item for item in voc.items() if item[0].startswith('clear')]
     23    return [item for item in voc.items() if item[0].startswith('clear') or
     24                                         item[0] in ("all",)]
    2425return voc.items()
    2526
  • WAeUP_SRP/trunk/skins/waeup_student/search_students.py

    r1011 r1033  
    1313"""
    1414request = REQUEST
     15form = request.form
     16fget = form.get
    1517wftool = context.portal_workflow
    1618mtool = context.portal_membership
    1719member = mtool.getAuthenticatedMember()
    1820roles = member.getRolesInContext(context)
     21students_folder = context.portal_url.getPortalObject().campus.students
    1922try:
    2023    from Products.AdvancedQuery import Eq, Between, Le,In
     
    2831    return -1
    2932
    30 request = context.REQUEST
    31 form = request.form
    32 fget = form.get
    3333student_subobjects = ("StudentApplication",
    3434                      "StudentPersonal",
     
    8282with_review = state != "all"
    8383only_review = with_review and not term
    84 ##with_level_results = state.startswith("category") or\
    85 ##                     state in ('content_addable',) and\
    86 ##                     evalAdvancedQuery is not None
    8784bools = "with_review = %s<br\> only_review = %s<br\>" % (with_review,only_review)
    8885if not term and not with_review:
     
    109106    if what == "student_id":
    110107        query_step = 1
    111         query = Eq('portal_type','Student') & Eq('id', term.strip())
     108        if hasattr(students_folder,term.strip()):
     109            request.RESPONSE.redirect("%s/%s" % (students_folder.absolute_url(),term))
     110        return context.search_students_form(rendered = rend,
     111                             psm = "No student found!",
     112                             students = [],
     113                             allowed = True,
     114                             )
    112115    elif what in st_queries:
    113116        if what == "jamb_reg_no":
     
    124127            st = "%s" % term.strip()
    125128        query = In('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip())
    126     res = evalAdvancedQuery(query)
    127 if with_review:
    128     query_step += 10
    129     review_res = evalAdvancedQuery(In('portal_type',student_objects) & Eq('review_state',state))
    130 search_set = []
    131 if res:
    132     for r in res:
    133         pl = r.getPath().split('/')
    134         search_set.append(pl[pl.index('students') + 1])
    135 review_set = []
    136 if review_res:
    137     for r in review_res:
    138         pl = r.getPath().split('/')
    139         review_set.append(pl[pl.index('students') + 1])
     129        res = evalAdvancedQuery(query)
     130        if with_review:
     131            query_step += 10
     132            review_res = evalAdvancedQuery(In('portal_type',student_objects) & Eq('review_state',state))
     133        search_set = []
     134        if res:
     135            for r in res:
     136                pl = r.getPath().split('/')
     137                search_set.append(pl[pl.index('students') + 1])
     138        review_set = []
     139        if review_res:
     140            for r in review_res:
     141                pl = r.getPath().split('/')
     142                review_set.append(pl[pl.index('students') + 1])
     143    elif what == "department":
     144        res = context.students_catalog(department=term.strip())
     145        search_set = [r.id for r in res]
    140146all = []
    141147if only_review:
     
    147153else:
    148154    all = search_set
    149 for a in all[:100]:
     155for a in all[:1000]:
    150156    if a in items:
    151157        continue
Note: See TracChangeset for help on using the changeset viewer.