Changeset 3995
- Timestamp:
- 07/09/08 13:14:03 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ticketsubmitpolicyplugin/0.11/ticketsubmitpolicy/templates/ticketsubmitpolicy.html
r3994 r3995 18 18 <div py:for="name in sorted(policies.keys())" class="plugin"> 19 19 <h2>${name}</h2> 20 21 <input type="hidden" name="policy" value="${name}"/> 20 22 21 23 <div> … … 108 110 109 111 <div> 110 <input type="text" />112 <input type="text" name="new-policy"/> 111 113 <input type="submit" name="add-policy" value="Add Policy"/> 112 114 </div> ticketsubmitpolicyplugin/0.11/ticketsubmitpolicy/ticketsubmitpolicy.py
r3994 r3995 349 349 data to be passed to the template. 350 350 """ 351 data = { 'policies': self.parse()} # data for template351 data = {} # data for template 352 352 data['fields'] = Ticket(self.env).fields # possible ticket fields 353 353 data['comparitors'] = self.comparitors # implemented comparitors … … 361 361 362 362 # organize request args based on policy 363 args = dict([(key, {}) for key in data['policies']]) 363 policies = req.args.get('policy', []) 364 if isinstance(policies, basestring): 365 policies = [ policies ] 366 args = dict([(policy, {}) for policy in policies ]) 364 367 for arg, value in req.args.items(): 365 for policy in data['policies']:368 for policy in policies: 366 369 token = '_%s' % policy 367 370 if arg.endswith(token): … … 369 372 370 373 # get the conditions and policies from the request 371 old_policies = data['policies'] # XXX for debugging372 374 data['policies'] = {} 373 375 for policy in args: … … 415 417 416 418 419 # added policy 420 new_policy = req.args.get('new-policy') 421 if new_policy: 422 data['policies'][new_policy] = dict(actions=[], condition=[]) 423 417 424 # save the data if the user clicks apply 418 425 if 'apply' in req.args: 419 426 self.save(data['policies']) 420 427 data['saved'] = True 428 429 if req.method == 'GET' or 'apply' in req.args: 430 data['policies'] = self.parse() 421 431 422 432 return ('ticketsubmitpolicy.html', data)
