Ticket #6930: ticket-6930-v1.patch
| File ticket-6930-v1.patch, 3.4 KB (added by ecarter, 14 months ago) |
|---|
-
contrib/workflow/enterprise-workflow.ini
66 66 requestinfo_new.permissions = TICKET_MODIFY 67 67 68 68 provideinfo_new = infoneeded_new -> new 69 provideinfo_new.name = pr ovide info69 provideinfo_new.name = pròvide info 70 70 provideinfo_new.permissions = TICKET_MODIFY 71 71 provideinfo_new.default = 2 72 72 -
contrib/workflow/showworkflow
17 17 pdf=`echo "$config" | sed 's/\.ini$/.pdf/g'` 18 18 png=`echo "$config" | sed 's/\.ini$/.png/g'` 19 19 20 $basedir/workflow_parser.py $options "$config" >"$dot"20 $basedir/workflow_parser.py $options "$config" "$dot" 21 21 if [ $? -ne 0 ]; then 22 22 echo "Failed to parse \"$config\", exiting." >&2 23 23 exit 1 … … 28 28 dot -T png -o "$png" "$dot" 29 29 cmd /c start $png 30 30 else 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" 33 40 fi -
contrib/workflow/workflow_parser.py
46 46 """Returns a list of lines to be fed to graphviz.""" 47 47 # The size value makes it easier to create a useful printout. 48 48 color_scheme = ColorScheme() 49 digraph_lines = [ """49 digraph_lines = [u""" 50 50 digraph G { 51 51 center=1 52 52 size="10,8" … … 64 64 for oldstate in attributes['oldstates']: 65 65 color = color_scheme.get_color(attributes['name']) 66 66 digraph_lines.append( 67 ' "%s" -> "%s" [label="%s" color=%s fontcolor=%s]' % \67 u' "%s" -> "%s" [label="%s" color=%s fontcolor=%s]' % \ 68 68 (oldstate, attributes['newstate'], '\\n'.join(label), color, 69 69 color)) 70 digraph_lines.append( '}')70 digraph_lines.append(u'}') 71 71 return digraph_lines 72 72 73 def main(filename, show_ops=False, show_perms=False):73 def main(filename, output, show_ops=False, show_perms=False): 74 74 # Read in the config 75 75 rawactions = readconfig(filename) 76 76 … … 81 81 digraph_lines = actions2graphviz(actions, show_ops, show_perms) 82 82 83 83 # And output 84 sys.stdout.write('\n'.join(digraph_lines))84 output.write(unicode.encode(u'\n'.join(digraph_lines), 'UTF8')) 85 85 86 86 def usage(output): 87 output.write('workflow_parser [options] configfile.ini \n'87 output.write('workflow_parser [options] configfile.ini [output.dot]\n' 88 88 '-h --help shows this message\n' 89 89 '-o --operations include operations in the graph\n' 90 90 '-p --permissions include permissions in the graph\n' … … 114 114 usage(sys.stderr) 115 115 sys.stderr.flush() 116 116 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)
