Changeset 3024


Ignore:
Timestamp:
15 Jan 2008, 08:40:08 (17 years ago)
Author:
Henrik Bettermann
Message:

clean-up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/search_students.py

    r3023 r3024  
    4242    aq_portal = context.portal_catalog_real.evalAdvancedQuery
    4343students_catalog = context.students_catalog
    44 aq_students = context.students_catalog.evalAdvancedQuery
    45 
    46 def cmp_id(a,b):
    47     if a.getId() > b.getId():
    48         return 1
    49     return -1
    50 
    51 student_subobjects = ("StudentApplication",
    52                       "StudentPersonal",
    53                       "StudentStudyCourse",
    54                       "StudentAccommodation",
    55                       "StudentStudyLevel",)
    56 
    57 student_objects = ("Student",)
     44aq_students = students_catalog.evalAdvancedQuery
     45
     46#def cmp_id(a,b):
     47#    if a.getId() > b.getId():
     48#        return 1
     49#    return -1
    5850
    5951user_info = {}
    60 items = []
    6152validate = request.has_key("cpsdocument_edit_button")
    6253
    63 state = "all"
     54default_state = "all"
    6455user_info['member'] = str(member)
    6556user_info['departments'] = []
     
    7162certificate_levels = fget('certificate_levels')
    7263dep_str = fac_str = certificate_levels_str = ''
     64
     65# determine local roles
     66
    7367if "ClearanceOfficers" in member.getGroups():
    74     state = "clearance_requested"
    75     only_review = False
     68    default_state = "clearance_requested"
    7669    co_view = True
    7770    if faculties or departments:
     
    10295        dep_str = " ".join(departments)
    10396elif "CourseAdvisers" in member.getGroups():
    104     state = "courses_registered"
    105     only_review = False
     97    default_state = "courses_registered"
    10698    ca_view = True
    10799    if certificate_levels:
     
    137129
    138130default = {'search_mode': 'student_id',
    139         'review_state': state,
     131        'review_state': default_state,
    140132        'search_string': ''
    141133        }
     
    160152                             allowed = allowed,
    161153                             )
     154                             
     155# return to search form  if form was not properly filled
     156                             
    162157what = ds.get('search_mode')
    163158state = ds.get('review_state')
    164159st = term = ds.get('search_string')
    165160err = False
    166 with_review = state != "all"
    167 if not co_view or not ca_view:
    168     only_review = with_review and not term
    169 bools = "with_review = %s<br\> only_review = %s<br\>" % (with_review,only_review)
    170 if not term and not with_review:
    171     psm = "You must specify a search string when searching 'all states'!"
     161if not term and state == "all":
     162    psm = "You must specify a search string when searching for students in all states!"
    172163    err = True
    173164elif '*' in term:
     
    179170                             #psm = "%s, %s" % (psm,ds),
    180171                             info = user_info,
    181                              students = items,
    182                              allowed = allowed,
    183                              )
    184 #st_queries = ('jamb_reg_no','matric_no','name')
    185 review_res = None
    186 query = None
    187 items = []
    188 res = []
    189 review_set = []
    190 search_set = []
     172                             students = [],
     173                             allowed = allowed,
     174                             )
     175
     176# build query string part 1
     177
    191178query = None
    192179if len(term) > 0:
     
    224211        logger.info('%s searches for student with name %s' % (member,term))
    225212
    226 if only_review or with_review or co_view:
     213
     214# build query string part 2
     215
     216if state != 'all':
    227217    if query is not None:
    228218        query = Eq('review_state',state) & query
     
    231221    logger.info('%s searches for students in review_state %s' % (member,state))
    232222
     223# build query string part 3
     224
    233225if co_view:
    234     only_review = False
    235     with_review = True
    236226    if query is not None:
    237227        query = query & In('faculty',faculties) | In('department',departments)
     
    239229        query = In('faculty',faculties) | In('department',departments)
    240230elif ca_view:
    241     only_review = False
    242     with_review = True
    243231    courses = [cl.split('/')[0] for cl in certificate_levels]
    244232    levels = [cl.split('/')[1] for cl in certificate_levels]
    245233    if query is not None:
    246234        query = query & In('course',courses) & In('level',levels)
     235
     236# search students_catalog
     237
    247238student_records = aq_students(query)
    248239students = []
Note: See TracChangeset for help on using the changeset viewer.