Changeset 611 for WAeUP_SRP/trunk
- Timestamp:
- 2 Oct 2006, 12:24:04 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_academics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_academics/academics_search_view.pt
r600 r611 2 2 portal_status_message options/psm; 3 3 objects options/objects; 4 is_manager options/is_manager;" 4 is_manager options/is_manager; 5 " 5 6 > 6 7 <metal:body use-macro="here/main_template/macros/master"> … … 30 31 > 31 32 <span tal:replace="structure rendered" /> 33 <form action="search" method="post" class="group" 34 tal:attributes="action context/absolute_url" 35 > 32 36 <tal:block tal:condition="python: batch_info and batch_info['nb_pages'] > 1"> 33 37 <div class="batchLayout"> … … 47 51 <table class="contentListing" width="100%"> 48 52 <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 <tr tal:repeat="object rows" 54 tal:attributes="class python:test(repeat['object'].even(), 'even ajaxtd', 'odd ajaxtd')"> 55 <td align="left" valign="middle" style="width: 5px;" 56 tal:condition="is_manager"> 57 <input type="checkbox" name="ids:list" value="" id="" class="noborder" 58 tal:condition="is_manager" 59 tal:define="id object/id" 60 tal:attributes="value id; 61 id python:'cb_' + id; 62 checked python:id in options['choosen_ids'];" 63 /> 64 </td> 65 <td><a href="id" tal:attributes="href string:${object/url}" 66 tal:content="object/title"></a></td> 53 67 <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" /> 68 <span tal:replace="object/review_state" /> 57 69 </td> 58 <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td> 59 <td><span tal:replace="student/review_state" /></td> 70 <td> 71 <a tal:condition="object/is_editable" 72 href="edit" tal:attributes="href string:${object/url}/external_edit_form" 73 target="edit" 74 onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')"> 75 [edit] 76 </a> 77 </td> 60 78 </tr> 61 79 </span> 80 </table> 81 <table width="100%" cellspacing="0" cellpadding="2" 82 summary="buttons" 83 class="folderButtons"> 84 <tr> 85 <td align="left" valign="top" rowspan="3"></td> 86 <td align="left" valign="top"> 87 <span tal:condition="is_manager"> 88 <input type="button" value="button_select_all" class="context" 89 onclick="someJavaScriptFunctionThatWillBeReplaced" 90 i18n:attributes="value" 91 tal:attributes="onclick python:'toggleSelect(this, \'%s\', \'%s\')' 92 % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))" 93 /> 94 <input type="submit" name="folder_delete:method" value="button_delete" 95 class="destructive" i18n:attributes="value" 96 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 97 (cpsmcat('description_confirm_delete'), )" 98 /> 99 </span> 100 </td> 101 </tr> 62 102 </table> 63 103 <tal:block condition="python:batch_info and batch_info['nb_pages'] > 1"> … … 98 138 </div> 99 139 </tal:block> 140 </form> 100 141 </span> 101 142 </metal:main> -
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.