Changeset 750
- Timestamp:
- 25 Oct 2006, 11:36:12 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_student
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
r748 r750 88 88 row['s_edit_link'] = "%s/%s" % (student.absolute_url(),se_link) 89 89 row['review_state'] = so.review_state 90 row['display'] = so.review_state in ('opened','closed',) or so.portal_type == "StudentAccommodation" 90 row['display'] = so.review_state in ('opened','closed',) or\ 91 so.portal_type in ("StudentAccommodation","StudentStudyCourse") 91 92 items.append(row) 92 93 info['items'] = items -
WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py
r731 r750 13 13 """ 14 14 try: 15 from Products.AdvancedQuery import Eq, Between, Le 15 from Products.AdvancedQuery import Eq, Between, Le,In 16 16 evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery 17 17 except: … … 21 21 form = request.form 22 22 fget = form.get 23 student_subobjects = ("StudentApplication", 24 "StudentPersonal", 25 "StudentStudyCourse", 26 "StudentAccommodation", 27 "StudentStudyLevel",) 23 28 info = {} 29 items = [] 24 30 wf = context.portal_workflow 25 31 catalog = context.portal_catalog … … 32 38 is_manager = context.isManager 33 39 validate = request.has_key("cpsdocument_edit_button") 34 items = []35 40 default = {'search_mode': 'name', 36 41 'review_state': 'all', … … 59 64 with_review = state != "all" 60 65 onlyreview = with_review and not term 61 with_level_results = state.startswith("category") or\62 state in ('content_addable',) and\63 evalAdvancedQuery is not None64 bools = "with_review = %s<br\> onlyreview = %s<br\> with_level_results = %s" % (with_review,onlyreview,with_level_results)66 ##with_level_results = state.startswith("category") or\ 67 ## state in ('content_addable',) and\ 68 ## evalAdvancedQuery is not None 69 bools = "with_review = %s<br\> onlyreview = %s<br\>" % (with_review,onlyreview) 65 70 if not term and not with_review: 66 71 psm = "You must specify a search string when searching 'all states'." … … 81 86 st_queries = ('jamb_reg_no','matric_no','name') 82 87 query_step = 0 83 if onlyreview and not with_level_results: 88 review_query = None 89 if onlyreview: 84 90 query_step = 1 85 query = Eq('portal_type','Student') & Eq('review_state',state) 86 res = evalAdvancedQuery(query) 87 ## res = catalog(portal_type='Student', 88 ## review_state=state) 89 elif onlyreview and with_level_results: 90 query_step = 2 91 query = (Eq('portal_type','StudentStudyLevel') | 92 Eq('portal_type','StudentStudyCourse')) & Eq('review_state',state) 93 res = evalAdvancedQuery(query) 91 query = In('portal_type',student_subobjects) & Eq('review_state',state) 92 #res = evalAdvancedQuery(query) 94 93 elif what == "student_id": 95 94 if with_review: … … 102 101 res = catalog(portal_type='Student', 103 102 id = term.strip()) 104 elif what in st_queries and not with_level_results:103 elif what in st_queries: 105 104 if what == "jamb_reg_no": 106 105 query_step = 5 107 pt = 'StudentApplication'106 pt = ('StudentApplication',) 108 107 st = "%s*" % term.strip().lower() 109 108 elif what == "matric_no": 110 109 query_step = 6 111 pt = 'StudentClearance'110 pt = ('StudentClearance',) 112 111 st = "%s*" % term.strip().lower() 113 112 elif what == "name": … … 115 114 pt = portal_type_query 116 115 st = "%s*" % term.strip() 117 try: 118 res = catalog(portal_type=pt,SearchableText=st) 119 except: 120 return context.students_manager_view(rendered = rend, 121 psm = 'Search string "%s" not allowed.' % term, 122 #psm = "%s, %s" % (psm,ds), 123 students = items, 124 is_manager = is_manager, 125 ) 126 elif what in st_queries and with_level_results and evalAdvancedQuery: 127 if what == "jamb_reg_no": 128 query_step = 8 129 pt = 'StudentApplication' 130 st = "%s*" % term.strip().lower() 131 elif what == "matric_no": 132 query_step = 9 133 pt = 'StudentClearance' 134 st = "%s*" % term.strip().lower() 135 elif what == "name": 136 query_step = 10 137 pt = portal_type_query 138 st = "%s*" % term.strip() 139 query = Eq('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip().lower())\ 140 | ((Eq('portal_type','StudentStudyLevel') | 141 Eq('portal_type','StudentStudyCourse')) & Eq('review_state',state)) 142 try: 143 res = evalAdvancedQuery(query) 144 except: 145 return context.students_manager_view(rendered = rend, 146 psm = 'Advanced Query failed' % term, 147 #psm = "%s, %s" % (psm,ds), 148 students = items, 149 is_manager = is_manager, 150 ) 116 if with_review: 117 review_query = In('portal_type',student_subobjects) & Eq('review_state',state) 118 query = (In('portal_type',pt) & Eq('SearchableText',st)) 119 ## try: 120 ## res = catalog(portal_type=pt,SearchableText=st) 121 ## except: 122 ## return context.students_manager_view(rendered = rend, 123 ## psm = 'Search string "%s" not allowed.' % term, 124 ## #psm = "%s, %s" % (psm,ds), 125 ## students = items, 126 ## is_manager = is_manager, 127 ## ) 128 ##elif what in st_queries and with_level_results and evalAdvancedQuery: 129 ## if what == "jamb_reg_no": 130 ## query_step = 8 131 ## pt = 'StudentApplication' 132 ## st = "%s*" % term.strip().lower() 133 ## elif what == "matric_no": 134 ## query_step = 9 135 ## pt = 'StudentClearance' 136 ## st = "%s*" % term.strip().lower() 137 ## elif what == "name": 138 ## query_step = 10 139 ## pt = portal_type_query 140 ## st = "%s*" % term.strip() 141 ## query = Eq('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip().lower())\ 142 ## | ((Eq('portal_type','StudentStudyLevel') | 143 ## Eq('portal_type','StudentStudyCourse')) & Eq('review_state',state)) 144 if review_query: 145 res = evalAdvancedQuery(query | review_query) 146 else: 147 res = evalAdvancedQuery(query) 148 ##try: 149 ## if review_query: 150 ## res = evalAdvancedQuery(query) & evalAdvancedQuery(review_query) 151 ## else: 152 ## res = evalAdvancedQuery(query) 153 ##except: 154 ## return context.students_manager_view(rendered = rend, 155 ## psm = 'Advanced Query failed' % term, 156 ## #psm = "%s, %s" % (psm,ds), 157 ## students = items, 158 ## is_manager = is_manager, 159 ## ) 151 160 students = [] 152 161 raw_res = len(res) 162 all = [] 153 163 if res: 154 164 for r in res: 155 if r.portal_type in ("StudentApplication","StudentPersonal","StudentStudyCourse",): 165 if r.portal_type in ("StudentStudyLevel",): 166 student = r.getObject().aq_parent.aq_parent 167 elif r.portal_type in student_subobjects: 156 168 student = r.getObject().aq_parent 157 elif r.portal_type in ("StudentStudyLevel",):158 student = r.getObject().aq_parent.aq_parent159 ## pp = '/'.join(r.getPath().split('/')[:-1])160 ## student_cat = catalog(pathindex=pp,portal_type='Student')[0]161 ## student_rs = student_cat.review_state162 ## student = student_cat.getObject()163 169 else: 164 170 student = r.getObject() 165 student_rs = wf.getInfoFor(student,'review_state','keiner')166 if (with_review and student_rs != state and not with_level_results) or student in items:171 if student in all: 172 items.append(student) 167 173 continue 168 items.append(student) 174 all.append(student) 175 if onlyreview: 176 items = all 169 177 if items: 170 178 for item in items: 171 students.append(context.getStudentInfo(item)) 179 info = context.getStudentInfo(item) 180 students.append(info) 172 181 return context.students_manager_view(rendered = rend, 173 182 psm = "%d matching Students found QS = %s" % (len(items),query_step), 183 #psm = "%d found QS = %s items: %s" % (len(items),query_step,items), 174 184 students = students, 175 185 is_manager = is_manager, -
WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt
r603 r750 52 52 <table class="contentListing" width="100%"> 53 53 <span tal:repeat="rows batches" tal:omit-tag=""> 54 <tr tal:repeat="student rows" 55 tal:attributes="class python:test(repeat['student'].even(), 'even ajaxtd', 'odd ajaxtd')"> 56 <td><a href="id" tal:attributes="href string:${student/student/absolute_url}" 57 tal:content="student/id"></a></td> 58 <td> 59 <span tal:replace="python: student['per_doc'].firstname" /> 60 <span tal:replace="python: student['per_doc'].middlename" /> 61 <span tal:replace="python: student['per_doc'].lastname" /> 62 </td> 63 <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td> 64 <td><span tal:replace="student/review_state" /></td> 65 </tr> 54 <span tal:repeat="student rows"> 55 <tr tal:condition="student" 56 tal:attributes="class python:test(repeat['student'].even(), 'even ajaxtd', 'odd ajaxtd')"> 57 <td><a href="id" tal:attributes="href string:${student/student/absolute_url}" 58 tal:content="student/id"></a></td> 59 <td> 60 <span tal:replace="python: student['per_doc'].firstname" /> 61 <span tal:replace="python: student['per_doc'].middlename" /> 62 <span tal:replace="python: student['per_doc'].lastname" /> 63 </td> 64 <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td> 65 <td><span tal:replace="student/review_state" /></td> 66 </tr> 67 </span> 66 68 </span> 67 69 </table>
Note: See TracChangeset for help on using the changeset viewer.