Changeset 3833

Show
Ignore:
Timestamp:
06/13/08 10:00:38 (5 months ago)
Author:
k0s
Message:

move exclude logic to the exclude-field interface where it belongs; also, semi-horrible formatting for function names

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ticketsubmitpolicyplugin/0.11/setup.py

    r3829 r3833  
    11from setuptools import find_packages, setup 
    22 
    3 version='0.5.1
     3version='0.5.2
    44 
    55setup(name='TicketSubmitPolicy', 
  • ticketsubmitpolicyplugin/0.11/ticketsubmitpolicy/ticketsubmitpolicy.py

    r3829 r3833  
    5454function requires(policy, requiredfield) 
    5555{ 
    56 var element=document.getElementById("field-" + requiredfield); 
     56 
    5757var field=getValue("field-" + requiredfield); 
    5858 
     
    6565} 
    6666 
    67 } 
    68 else 
    69 { 
    70 element.value = ""; 
    7167} 
    7268 
     
    111107 
    112108} 
     109 
     110function excludeSubmit(policy, excludedfield) 
     111{ 
     112var element=document.getElementById("field-" + excludedfield); 
     113if (condition(policy)) 
     114{ 
     115element.value = ""; 
     116} 
     117return true; 
     118} 
     119 
    113120""" 
    114121 
     
    117124 
    118125    def onsubmit(self, policy, condition, excludedfield): 
    119         return 
     126        excludesubmit = "excludeSubmit(%s, '%s');" % (policy, excludedfield) 
     127        return excludesubmit 
    120128 
    121129    def filter_stream(self, stream, policy, condition, excludedfield): 
     
    404412function policytostring(policy) 
    405413{ 
     414    // this should be replaced by a deCamelCase function 
     415    names = { is: 'is', isNot: 'is not', isIn: 'is in', isNotIn: 'is not in' } 
    406416 
    407417    var strings = new Array(policy.length); 
    408418    for ( var i=0; i != policy.length; i++ ) 
    409419    { 
    410         strings[i] = policy[i].field + ' ' + policy[i].comparitor.name + ' ' + policy[i].value; 
     420        funcname = names[policy[i].comparitor.name] 
     421        strings[i] = policy[i].field + ' ' + funcname + ' ' + policy[i].value; 
    411422    } 
    412423    return strings.join(' and ');