Changeset 611 for WAeUP_SRP/trunk/skins/waeup_academics/searchAcademics.py
- Timestamp:
- 2 Oct 2006, 12:24:04 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_academics/searchAcademics.py
r603 r611 20 20 lt = context.portal_layouts 21 21 pr = context.portal_registration 22 mtool = context.portal_membership 22 23 path_info = request.get('PATH_INFO').split('/') 23 24 is_manager = context.isManager … … 47 48 state = ds.get('review_state') 48 49 term = ds.get('search_string') 49 if state == " ----- ": 50 state = '' 51 if not term and what in ('student_edit','jamb_reg_no','name','matric_no'): 50 if not term and not with_review: 52 51 return context.academics_search_view(rendered = rend, 53 52 psm = "You must specify a search string", … … 56 55 is_manager = is_manager, 57 56 ) 58 onlyreview = state and what == "review_state" 57 with_review = state != "all" 58 what = ds.get('search_mode') 59 state = ds.get('review_state') 60 term = ds.get('search_string') 61 err = False 62 with_review = state != "all" 63 if not term and not with_review: 64 psm = "You must specify a search string when searching 'all states'." 65 err = True 66 elif '*' in term: 67 psm = "you cannot use the '*' alone" 68 err = True 69 if err: 70 return context.academics_search_view(rendered = rend, 71 psm = psm, 72 #psm = "%s, %s" % (psm,ds), 73 students = items, 74 is_manager = is_manager, 75 ) 76 with_review = state != "all" 59 77 items = [] 60 78 res = [] 61 portal_type_query = {'query':['Department','Course','CertificateCourse']} 79 portal_type_query = {'query':['Course','CertificateCourse']} 80 onlyreview = with_review and not term 62 81 if onlyreview: 63 82 res = catalog(portal_type=portal_type_query, 64 83 review_state=state) 65 elif what == "student_id": 66 res = catalog(portal_type='Student', 67 id = term.strip()) 68 elif what == "jamb_reg_no": 69 res = catalog(portal_type='StudentApplication', 84 elif what == "course": 85 res = catalog(portal_type='Course', 70 86 SearchableText="%s*" % term.strip().lower()) 71 elif what == " matric_no":72 res = catalog(portal_type=' StudentClearance',87 elif what == "certificate_course": 88 res = catalog(portal_type='CertificateCourse', 73 89 SearchableText="%s*" % term.strip().lower()) 74 elif what == "name": 75 res = catalog(portal_type=portal_type_query, 76 SearchableText="%s*" % term.strip()) 90 objects = [] 77 91 if res: 78 92 for r in res: 79 93 row = {} 80 if r.portal_type in ("StudentApplication","StudentPersonal"): 81 items.append(r.getObject().aq_parent) 82 else: 83 items.append(r.getObject()) 84 objects = [] 85 if items: 86 for item in items: 87 objects.append(context.getStudentInfo(item)) 94 ro = r.getObject() 95 rd = ro.getContent() 96 row['id'] = r.getId 97 row['title'] = rd.Title() 98 row['url'] = ro.absolute_url() 99 row['review_state'] = wf.getInfoFor(ro,'review_state','None') 100 row['is_editable'] = mtool.checkPermission('Modify portal content', ro) 101 objects.append(row) 102 #objects.append(context.getStudentInfo(item)) 88 103 return context.academics_search_view(rendered = rend, 89 psm = "%d matching objects found" % len( items),104 psm = "%d matching objects found" % len(objects), 90 105 #psm = "%s, %s" % (psm,ds), 91 106 objects = objects, 92 107 is_manager = is_manager, 108 choosen_ids = [] 93 109 )
Note: See TracChangeset for help on using the changeset viewer.