Changeset 3024
- Timestamp:
- 15 Jan 2008, 08:40:08 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_student/search_students.py
r3023 r3024 42 42 aq_portal = context.portal_catalog_real.evalAdvancedQuery 43 43 students_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",) 44 aq_students = students_catalog.evalAdvancedQuery 45 46 #def cmp_id(a,b): 47 # if a.getId() > b.getId(): 48 # return 1 49 # return -1 58 50 59 51 user_info = {} 60 items = []61 52 validate = request.has_key("cpsdocument_edit_button") 62 53 63 state = "all"54 default_state = "all" 64 55 user_info['member'] = str(member) 65 56 user_info['departments'] = [] … … 71 62 certificate_levels = fget('certificate_levels') 72 63 dep_str = fac_str = certificate_levels_str = '' 64 65 # determine local roles 66 73 67 if "ClearanceOfficers" in member.getGroups(): 74 state = "clearance_requested" 75 only_review = False 68 default_state = "clearance_requested" 76 69 co_view = True 77 70 if faculties or departments: … … 102 95 dep_str = " ".join(departments) 103 96 elif "CourseAdvisers" in member.getGroups(): 104 state = "courses_registered" 105 only_review = False 97 default_state = "courses_registered" 106 98 ca_view = True 107 99 if certificate_levels: … … 137 129 138 130 default = {'search_mode': 'student_id', 139 'review_state': state,131 'review_state': default_state, 140 132 'search_string': '' 141 133 } … … 160 152 allowed = allowed, 161 153 ) 154 155 # return to search form if form was not properly filled 156 162 157 what = ds.get('search_mode') 163 158 state = ds.get('review_state') 164 159 st = term = ds.get('search_string') 165 160 err = 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'!" 161 if not term and state == "all": 162 psm = "You must specify a search string when searching for students in all states!" 172 163 err = True 173 164 elif '*' in term: … … 179 170 #psm = "%s, %s" % (psm,ds), 180 171 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 191 178 query = None 192 179 if len(term) > 0: … … 224 211 logger.info('%s searches for student with name %s' % (member,term)) 225 212 226 if only_review or with_review or co_view: 213 214 # build query string part 2 215 216 if state != 'all': 227 217 if query is not None: 228 218 query = Eq('review_state',state) & query … … 231 221 logger.info('%s searches for students in review_state %s' % (member,state)) 232 222 223 # build query string part 3 224 233 225 if co_view: 234 only_review = False235 with_review = True236 226 if query is not None: 237 227 query = query & In('faculty',faculties) | In('department',departments) … … 239 229 query = In('faculty',faculties) | In('department',departments) 240 230 elif ca_view: 241 only_review = False242 with_review = True243 231 courses = [cl.split('/')[0] for cl in certificate_levels] 244 232 levels = [cl.split('/')[1] for cl in certificate_levels] 245 233 if query is not None: 246 234 query = query & In('course',courses) & In('level',levels) 235 236 # search students_catalog 237 247 238 student_records = aq_students(query) 248 239 students = []
Note: See TracChangeset for help on using the changeset viewer.