Changeset 3987
- Timestamp:
- 07/08/08 15:49:09 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ticketsubmitpolicyplugin/0.11/ticketsubmitpolicy/templates/ticketsubmitpolicy.html
r3986 r3987 10 10 </head> 11 11 <body> 12 13 <form method="post"> 12 14 <div py:for="name in sorted(policies.keys())" class="plugin"> 13 15 <h2>${name}</h2> 14 <form id="${name}" method="post">15 16 16 17 <div> … … 21 22 22 23 <td class="field"> 23 <select name=" ${name}-condition-field">24 <select name="condition_field_${name}"> 24 25 <py:for each="field in fields"> 25 26 <option py:attrs="{'selected': condition['field'] … … 32 33 33 34 <td class="operator"> 34 <select name=" ${name}-condition-operator">35 <select name="condition_operator_${name}"> 35 36 <py:for each="comparitor in comparitors"> 36 37 <option py:attrs="{'selected': … … 44 45 45 46 <td> 46 <input type="text" value="${condition['value']}"/>47 <input type="text" name="condition_value_${name}" value="${condition['value']}"/> 47 48 </td> 48 49 … … 52 53 </tr> 53 54 </table> 54 <input type="submit" name="add_condition }" value="+"/>55 <input type="submit" name="add_condition_${name}" value="+"/> 55 56 </div> 56 57 … … 58 59 <h3>Policy</h3> 59 60 61 <table> 60 62 <tr py:for="action in policies[name]['actions']"> 61 63 <td> … … 74 76 </td> 75 77 <td class="actions"> 76 <input type="submit" name="rm_ policy_${action['name']}" value="-"/>78 <input type="submit" name="rm_action_${action['name']}_${name}" value="-"/> 77 79 </td> 78 80 </tr> 81 </table> 82 83 <!-- new policy checkbox --> 84 <py:if test="len(policies[name]['actions']) != 85 len(self_actions)"> 86 Add action: 87 <select name="add_action_${name}"> 88 <py:for each="action in [ i.name() for i in self_actions 89 if i.name() not in [ j['name'] for j in policies[name]['actions']]]"> 90 <option>${action}</option> 91 </py:for> 92 </select> 93 </py:if> 94 79 95 </div> 80 96 81 97 <input type="submit" name="apply" value="Apply Changes"/> 82 98 <input type="submit" name="remove" value="Remove"/> 83 </form>84 99 85 100 </div> 86 101 87 102 <div> 88 <form id="new-policy" name="new-policy"> 89 <input type="text"/> 90 <input type="submit" name="add-policy" value="Add Policy"/> 91 </form> 103 <input type="text"/> 104 <input type="submit" name="add-policy" value="Add Policy"/> 92 105 </div> 106 107 </form> 93 108 94 109 </body> ticketsubmitpolicyplugin/0.11/ticketsubmitpolicy/ticketsubmitpolicy.py
r3985 r3987 34 34 35 35 implements(ITemplateStreamFilter, IAdminPanelProvider, ITemplateProvider) 36 37 # XXX this should be renamed -> actions 36 38 policies = ExtensionPoint(ITicketSubmitPolicy) 37 39 … … 322 324 """ 323 325 data = { 'policies': self.parse() } # data for template 324 data['fields'] = Ticket(self.env).fields 325 data['comparitors'] = self.comparitors 326 data['fields'] = Ticket(self.env).fields # possible ticket fields 327 data['comparitors'] = self.comparitors # implemented comparitors 328 data['self_actions'] = self.policies # available policies 329 330 if req.method == 'POST': 331 332 import pdb; pdb.set_trace() 333 334 # get the conditions and policies from the request 335 336 # added conditions 337 new_conditions = [ i.split('add_condition_', 1)[-1] 338 for i in req.args.keys() 339 if i.startswith('add_condition_') ] 340 for name in new_conditions: 341 data['policies'][name]['condition'].append(dict(comparitor='', field='', value='')) 342 343 # added actions 326 344 327 345 return ('ticketsubmitpolicy.html', data)
