Edgewall Software

Ticket #6930: ticket-6930-v1.patch

File ticket-6930-v1.patch, 3.4 KB (added by ecarter, 14 months ago)

proposed fix

  • contrib/workflow/enterprise-workflow.ini

     
    6666requestinfo_new.permissions = TICKET_MODIFY 
    6767 
    6868provideinfo_new = infoneeded_new -> new 
    69 provideinfo_new.name = provide info 
     69provideinfo_new.name = pròvide info 
    7070provideinfo_new.permissions = TICKET_MODIFY 
    7171provideinfo_new.default = 2 
    7272 
  • contrib/workflow/showworkflow

     
    1717pdf=`echo "$config" | sed 's/\.ini$/.pdf/g'` 
    1818png=`echo "$config" | sed 's/\.ini$/.png/g'` 
    1919 
    20 $basedir/workflow_parser.py $options "$config" > "$dot" 
     20$basedir/workflow_parser.py $options "$config" "$dot" 
    2121if [ $? -ne 0 ]; then 
    2222    echo "Failed to parse \"$config\", exiting." >&2 
    2323    exit 1 
     
    2828    dot -T png -o "$png" "$dot" 
    2929    cmd /c start $png 
    3030else 
    31     dot -T ps -o "$ps" "$dot" && ps2pdf "$ps" "$pdf" || exit 1 
    32     kpdf "$pdf" 
     31    dot -T ps -o "$ps" "$dot" 
     32    dot -T pdf -o "$pdf" "$dot" 
     33    # attempt to find a Linux pdf viewer 
     34    for viewer in kpdf okular evince; do 
     35        if which $viewer >/dev/null 2>&1; then 
     36            break 
     37        fi 
     38    done 
     39    $viewer "$pdf" 
    3340fi 
  • contrib/workflow/workflow_parser.py

     
    4646    """Returns a list of lines to be fed to graphviz.""" 
    4747    # The size value makes it easier to create a useful printout. 
    4848    color_scheme = ColorScheme() 
    49     digraph_lines = [""" 
     49    digraph_lines = [u""" 
    5050digraph G { 
    5151  center=1 
    5252  size="10,8" 
     
    6464        for oldstate in attributes['oldstates']: 
    6565            color = color_scheme.get_color(attributes['name']) 
    6666            digraph_lines.append( 
    67                 '  "%s" -> "%s" [label="%s" color=%s fontcolor=%s]' % \ 
     67                u'  "%s" -> "%s" [label="%s" color=%s fontcolor=%s]' % \ 
    6868                (oldstate, attributes['newstate'], '\\n'.join(label), color, 
    6969                 color)) 
    70     digraph_lines.append('}') 
     70    digraph_lines.append(u'}') 
    7171    return digraph_lines 
    7272 
    73 def main(filename, show_ops=False, show_perms=False): 
     73def main(filename, output, show_ops=False, show_perms=False): 
    7474    # Read in the config 
    7575    rawactions = readconfig(filename) 
    7676 
     
    8181    digraph_lines = actions2graphviz(actions, show_ops, show_perms) 
    8282 
    8383    # And output 
    84     sys.stdout.write('\n'.join(digraph_lines)) 
     84    output.write(unicode.encode(u'\n'.join(digraph_lines), 'UTF8')) 
    8585 
    8686def usage(output): 
    87     output.write('workflow_parser [options] configfile.ini\n' 
     87    output.write('workflow_parser [options] configfile.ini [output.dot]\n' 
    8888                 '-h --help shows this message\n' 
    8989                 '-o --operations include operations in the graph\n' 
    9090                 '-p --permissions include permissions in the graph\n' 
     
    114114        usage(sys.stderr) 
    115115        sys.stderr.flush() 
    116116        sys.exit(1) 
    117     main(args[0], show_ops, show_perms) 
     117    ini_filename = args[0] 
     118    if len(args) > 1: 
     119        output = open(args[1], 'w') 
     120    else: 
     121        output = sys.stdout 
     122 
     123    main(ini_filename, output, show_ops, show_perms)