Changeset 1062 for WAeUP_SRP/trunk/skins
- Timestamp:
- 14 Dec 2006, 20:16:23 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_pins
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_pins/pins_view.pt
r1002 r1062 1 <metal:html> 1 <metal:html tal:define="info options/info; 2 rendered options/rendered; 3 mtool here/portal_membership; 4 member mtool/getAuthenticatedMember; 5 "> 2 6 <metal:body use-macro="here/main_template/macros/master"> 3 7 <metal:main fill-slot="main"> … … 5 9 </span> 6 10 <span tal:condition="not:isAnon"> 11 <span tal:replace="structure rendered" /> 12 <form action="." method="post"> 13 <table> 14 <tr tal:repeat="pin info/used"> 15 <td> 16 <input type="checkbox" name="ids:list" value="" id="" class="noborder" 17 tal:define="id string:${pin/serial}_${pin/prefix}" 18 tal:attributes="value id; 19 id python:'cb_' + id;" 20 /> 21 </td> 22 <td width="50px"> <span tal:content="pin/serial" />: </td> 23 <td tal:content="pin/pin" /> 24 <td tal:content="pin/student_id" /> 25 <td tal:condition="pin/student_url"> 26 <a tal:condition="pin/student_url" href="" tal:content="pin/student" 27 tal:attributes="href pin/student_url"></a> 28 <span tal:condition="not: pin/student_url" tal:content="pin/student" /> 29 </td> 30 </tr> 31 </table> 32 <table width="100%" cellspacing="0" cellpadding="2" 33 summary="contents of the folder" 34 class="folderButtons"> 35 <tr> 36 <td align="left" valign="top" rowspan="3"></td> 37 <td align="left" valign="top"> 38 <input type="submit" name="disable_pins:method" 39 value="disable pins" 40 class="destructive" 41 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 42 (cpsmcat('really disable ?'), )" 43 /> 44 </td> 45 <td align="left" valign="top"> 46 <input type="submit" name="enable_pins:method" 47 value="enable pins" 48 class="destructive" 49 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 50 (cpsmcat('really enable ?'), )" 51 /> 52 </td> 53 </tr> 54 </table> 55 </form> 7 56 <h3>PIN Batches</h3> 8 57 <br /> 9 <table tal:define="batches python: context.portal_catalog(portal_type='ScratchCardBatch')"> 10 <tr tal:repeat="batch batches"> 11 <td><a href="batch" 12 tal:attributes="href string:${batch/getPath}/search_pins" 13 tal:content="batch/Title"></a></td> 14 </tr> 15 </table> 58 <form action="." method="get"> 59 <select class="form-element" name=":action" 60 tal:attributes="onChange string:location.href='${context/absolute_url}/'+this.options[this.selectedIndex].value" 61 > 62 <option value="--">Goto Batch ...</option> 63 <option tal:repeat="batch context/objectIds" 64 tal:attributes="value batch" 65 tal:content="batch"> 66 </option> 67 </select> 68 </form> 16 69 </span> 17 70 </metal:main> -
WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py
r1012 r1062 33 33 ) 34 34 info = {} 35 info['batch_doc'] = context.getContent()36 info['unused'] = info['batch_doc'].getUnusedPins()37 35 info['used'] = [] 38 info['nr_used'] = info['batch_doc'].getNumberOfUsedPins() 39 36 if context.portal_type == "ScratchCardBatch": 37 info['batch_doc'] = context.getContent() 38 info['unused'] = info['batch_doc'].getUnusedPins() 39 info['nr_used'] = info['batch_doc'].getNumberOfUsedPins() 40 view = context.batch_view 41 elif context.portal_type == "ScratchCardBatchesFolder": 42 view = context.pins_view 40 43 if psm == '': 41 return context.batch_view(rendered = rend, 42 psm = psm, 43 #psm = "%s, %s" % (psm,ds), 44 info = info, 45 allowed = True, 46 ) 47 #set_trace() 44 return view(rendered = rend, 45 psm = psm, 46 #psm = "%s, %s" % (psm,ds), 47 info = info, 48 allowed = True, 49 ) 48 50 what = ds.get('search_mode') 49 51 term = ds.get('search_string') 52 pincat = context.portal_pins 50 53 if term != "": 51 54 if what == 'student' : 52 items_1 = context.portal_pins(student = term.upper())53 items_2 = context.portal_pins(student = term.lower())55 items_1 = pincat(student = term.upper()) 56 items_2 = pincat(student = term.lower()) 54 57 items = items_1 + items_2 55 58 elif what == 'pin': 56 items = context.portal_pins(pin = term.upper()) 59 items = pincat(pin = term.upper()) 60 elif what == 'serial': 61 try: 62 snr = int(term.strip()) 63 items = pincat(serial = snr) 64 except ValueError: 65 psm = "invalid number" 66 items = [] 67 pass 57 68 else: 58 69 items = [] … … 64 75 sno = i['student'] 65 76 item['student'] = sno 77 item['prefix'] = i.prefix_batch 66 78 item['serial'] = i.serial 67 item['pin'] = i.pin 79 if len(sno) > 0: 80 item['pin'] = i.pin 81 else: 82 item['pin'] = "%s%s****%s" % (i.prefix_batch,i.pin[-10:-7],i.pin[-3:]) 68 83 if i.pin in pins: 69 84 continue … … 73 88 res = context.students_catalog(jamb_reg_no=sno.upper()) 74 89 if len(res) > 0: 75 item['student_url'] = "%s/campus/students/%s" % (context.portal_url(),res[0].id) 90 if sno.startswith('disabled'): 91 item['student_url'] = None 92 else: 93 item['student_url'] = "%s/campus/students/%s" % (context.portal_url(),res[0].id) 76 94 item['student_id'] = res[0].id 77 95 else: … … 79 97 item['student_id'] = '' 80 98 elif sno: 81 item['student_url'] = '%s/campus/students/%s' % (students_url,item['student']) 82 item['student_id'] = student 99 if sno.startswith('disabled'): 100 item['student_url'] = None 101 else: 102 item['student_url'] = '%s/campus/students/%s' % (students_url,item['student']) 103 item['student_id'] = item['student'] 83 104 else: 84 105 item['student_url'] = '' … … 88 109 info['used'] = l 89 110 90 return context.batch_view(rendered = rend,91 92 93 94 95 111 return view(rendered = rend, 112 psm = psm, 113 #psm = "%s, %s" % (psm,ds), 114 info = info, 115 allowed = True, 116 )
Note: See TracChangeset for help on using the changeset viewer.