Changeset 584 for WAeUP_SRP/trunk/skins/waeup_student
- Timestamp:
- 28 Sep 2006, 19:09:45 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_student
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
r563 r584 33 33 #info['wf_state'] = 'keiner' 34 34 info['student'] = student 35 info['id'] = student.getId() 35 36 info['student_doc'] = student.getContent() 36 37 info['app'] = student.application -
WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py
r572 r584 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= student=None7 ##parameters= 8 8 ##title= 9 9 ## … … 21 21 info['wf_states'] = student_wf_states 22 22 info['wf_states'][0] = " ----- " 23 24 23 mtool = context.portal_membership 25 24 member = mtool.getAuthenticatedMember() 25 lt = context.portal_layouts 26 pr = context.portal_registration 26 27 path_info = request.get('PATH_INFO').split('/') 27 28 roles = member.getRoles() 28 info['is_manager'] = 'Manager' in roles or 'SectionManager' in roles 29 student_id = fget('student_id') 30 jamb_id = fget('jamb_id') 31 matric_no = fget('matric_no') 32 name = fget('name') 33 state = fget('state') 29 is_manager = 'Manager' in roles or 'SectionManager' in roles 30 validate = request.has_key("cpsdocument_edit_button") 31 items = [] 32 default = {'search_mode': 'name', 33 'review_state': 'admission_applied ', 34 'search_string': 'yy' 35 } 36 37 rend,psm,ds = lt.renderLayout(layout_id= 'student_search', 38 schema_id= 'student_search', 39 context=context, 40 mapping=validate and request, 41 ob=default, 42 layout_mode='edit', 43 formaction="searchStudents" 44 ) 45 if psm == '': 46 return context.students_manager_view(rendered = rend, 47 psm = psm, 48 #psm = "%s, %s" % (psm,ds), 49 students = items, 50 is_manager = is_manager, 51 ) 52 what = ds.get('search_mode') 53 state = ds.get('review_state') 54 term = ds.get('search_string') 34 55 if state == " ----- ": 35 56 state = '' 36 onlyreview = state and not (student_id or jamb_id or matric_no or name)57 onlyreview = state and what == "review_state" 37 58 items = [] 38 59 res = [] … … 41 62 res = catalog(portal_type=portal_type_query, 42 63 review_state=state) 43 elif student_id:64 elif what == "student_id": 44 65 res = catalog(portal_type='Student', 45 66 id = student_id.strip()) 46 elif jamb_id:67 elif what == "jamb_id": 47 68 res = catalog(portal_type='StudentApplication', 48 SearchableText="%s*" % jamb_id.strip().lower())49 elif matric_no:69 SearchableText="%s*" % term.strip().lower()) 70 elif what == "matric_no": 50 71 res = catalog(portal_type='StudentClearance', 51 SearchableText="%s*" % matric_no.strip().lower())52 elif name:72 SearchableText="%s*" % term.strip().lower()) 73 elif what == "name": 53 74 res = catalog(portal_type=portal_type_query, 54 SearchableText="%s*" % name.strip())75 SearchableText="%s*" % term.strip()) 55 76 if res: 56 77 for r in res: … … 60 81 else: 61 82 items.append(r.getObject()) 62 info['state'] = state 63 info['student_id'] = student_id 64 info['jamb_id'] = jamb_id 65 info['matric_no'] = matric_no 66 info['name'] = name 67 68 info['students'] = items 69 return info 83 students = [] 84 if items: 85 for item in items: 86 students.append(context.getStudentInfo(item)) 87 return context.students_manager_view(rendered = rend, 88 psm = "%d matching Students found" % len(items), 89 #psm = "%s, %s" % (psm,ds), 90 students = students, 91 is_manager = is_manager, 92 ) -
WAeUP_SRP/trunk/skins/waeup_student/students_index.py
r543 r584 29 29 30 30 if isManager: 31 return redirect("%s/s tudents_manager_view" % campus.students.absolute_url())31 return redirect("%s/searchStudents" % campus.students.absolute_url()) 32 32 if isStudent: 33 33 info = context.getStudentInfo() -
WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt
r572 r584 1 <metal:html tal:define="info context/searchStudents; 2 students info/students; 3 is_manager info/is_manager;"> 4 1 <metal:html tal:define="rendered options/rendered; 2 portal_status_message options/psm; 3 students options/students; 4 is_manager options/is_manager;" 5 > 5 6 <metal:body use-macro="here/main_template/macros/master"> 6 7 <metal:main fill-slot="main" 8 tal:define="isManager python:'Manager' in member.getRoles() or 'SectionManager' in member.getRoles()"> 9 <span tal:condition="not: isManager"> 7 <metal:block fill-slot="header" 8 tal:define="creation creation|nothing; 9 edition edition|nothing; 10 metadata metadata|nothing" 11 > 12 </metal:block> 13 14 <metal:main fill-slot="main"> 15 <span tal:condition="not: is_manager"> 10 16 <metal:block use-macro="here/error_not_found/macros/not_found" /> 11 17 </span> 12 <span tal:condition="isManager"> 13 <h3>Search Students by</h3> 14 <br /> 15 <form action="." method="post" tal:attributes="action string: ${context/absolute_url}/students_manager_view"> 16 <table> 17 <tr> 18 <td>Status</td><td><div class="field"><span tal:condition="python:0" tal:content="info/wf_states"/> 19 <select name="state" tal:condition="python:1"> 20 <option value="state" 21 tal:repeat="state info/wf_states" 22 tal:attributes="value state;selected python: info['state'] == state" 23 tal:content="state"></option> 24 </select> 25 </div> 26 </td> 27 </tr> 28 <tr> 29 <td>StudentId</td><td><input type="text" name="student_id" 30 tal:attributes="value info/student_id"/></td> 31 <td>Student Name</td><td><input type="text" name="name" 32 tal:attributes="value info/name"/></td> 18 <span tal:condition="is_manager" 19 tal:define="items students; 20 columns python:3; 21 items_per_page python:40; 22 max_items python:300; 23 zoom python:0; 24 batches_all python:here.getBatchList(items,columns, items_per_page,zoom,max_items=400); 25 batches python:batches_all[0]; 26 batch_info python:batches_all[1]; 27 zoomed python:batches_all[2]; 28 mq nocall:modules/ZTUtils/make_query;" 29 tal:omit-tag="" 30 > 31 <span tal:replace="structure rendered" /> 32 <tal:block tal:condition="python: batch_info and batch_info['nb_pages'] > 1"> 33 <div class="batchLayout"> 34 <span i18n:translate=""> 35 Objects: 36 <strong> 37 <tal:block replace="batch_info/start" 38 i18n:name="batch_start" /> - <tal:block replace="batch_info/limit" 39 i18n:name="batch_limit" /> 40 </strong> 41 of <tal:block replace="batch_info/length" 42 i18n:name="batch_length" /> 43 </span> 44 </div> 45 <br /> 46 </tal:block> 47 <table class="contentListing" width="100%"> 48 <span tal:repeat="rows batches" tal:omit-tag=""> 49 <tr tal:repeat="student rows" 50 tal:attributes="class python:test(repeat['student'].even(), 'even ajaxtd', 'odd ajaxtd')"> 51 <td><a href="id" tal:attributes="href string:${student/student/absolute_url}" 52 tal:content="student/id"></a></td> 53 <td> 54 <span tal:replace="python: student['per_doc'].firstname" /> 55 <span tal:replace="python: student['per_doc'].middlename" /> 56 <span tal:replace="python: student['per_doc'].lastname" /> 57 </td> 58 <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td> 59 <td><span tal:replace="student/review_state" /></td> 33 60 </tr> 34 <tr> 35 <td>Matric No</td><td><input type="text" name="matric_no" 36 tal:attributes="value info/matric_no"/></td> 37 <td>JAMB Id</td><td><input type="text" name="jamb_id" 38 tal:attributes="value info/jamb_id"/></td> 39 </tr> 40 <tr><td><input type="submit" class="context" name="search" value="search" /></td></tr> 41 </table> 42 </form> 43 <table tal:condition="students"> 44 <tr tal:repeat="student students"> 45 <td><a href="id" tal:attributes="href string:${student/absolute_url}" 46 tal:content="student/getId"></a></td> 47 <span tal:omit-tag="" tal:define="info python: context.getStudentInfo(student)"> 48 <td><span tal:replace="python: info['per_doc'].lastname" /></td> 49 <td><span tal:replace="python: info['app_doc'].jamb_reg_no" /></td> 50 <td><span tal:replace="info/review_state" /></td> 51 </span> 52 </tr> 61 </span> 53 62 </table> 63 <tal:block condition="python:batch_info and batch_info['nb_pages'] > 1"> 64 <div class="pageNavigationLayout"> 65 <a tal:define="previous batch_info/previous" 66 tal:condition="python:previous is not None" 67 tal:attributes="href python:'%s?%s'%(request['URL'], 68 mq(request.form, b_start=0))" 69 > 70 (<<)</a> 71 <a tal:define="previous batch_info/previous" 72 tal:condition="python:previous is not None" 73 tal:attributes="href python:'%s?%s'%(request['URL'], 74 mq(request.form, b_start=previous))" 75 i18n:translate="batch_previous">Previous</a> 76 <tal:block repeat="page batch_info/pages"> 77 <tal:block condition="python:page != batch_info['start'] - 1"> 78 <a tal:attributes="href python:'%s?%s'%(request['URL'], 79 mq(request.form, b_start=page))" 80 tal:content="repeat/page/number">1</a> 81 </tal:block> 82 <tal:block condition="python:page == batch_info['start'] - 1"> 83 <span tal:content="string:${repeat/page/number}" /> 84 </tal:block> 85 </tal:block> 86 <a tal:define="next batch_info/next" 87 tal:condition="python:next is not None" 88 tal:attributes="href python:'%s?%s'%(request['URL'], 89 mq(request.form, b_start=next))" 90 i18n:translate="batch_next">Next</a> 91 <a tal:define="next batch_info/next; 92 last_page python:batch_info['pages'][-1]" 93 tal:condition="python:next is not None" 94 tal:attributes="href python:'%s?%s'%(request['URL'], 95 mq(request.form, b_start=last_page))" 96 > 97 (>>)</a> 98 </div> 99 </tal:block> 54 100 </span> 55 101 </metal:main> 56 102 </metal:body> 57 103 </metal:html> 104
Note: See TracChangeset for help on using the changeset viewer.