Attachment 'GANTT.py'
Download 1 """
2 MoinMoin - Processor for GANTT data
3
4 Copyright (c) 2003 by Reimar Bauer <R.Bauer@fz-juelich.de>
5 All rights reserved.
6
7 This routine is published under the GNU Library General Public License
8
9 """
10
11 import string, os
12
13 from MoinMoin.Page import Page
14 from MoinMoin import config
15 from MoinMoin.action import AttachFile
16
17 htdocs_access = isinstance(config.attachments, type({}))
18
19 def process(request, formatter, lines):
20 # parse bangpath for arguments
21 exclude = []
22 image = 'gantt'
23 renderer = 'png'
24 txt=''
25
26
27 arg=string.split(lines[0])
28
29 for test in arg:
30 if test == '-name' :
31 i=string.index(arg,test)
32 image=arg[i+1]
33 if test == '-renderer' :
34 i=string.index(arg,test)
35 renderer = arg[i+1]
36 if test == '-csp':
37 txt = txt + ' --csp '
38 if test == '-usdates':
39 txt = txt + ' --usdates '
40 if test == '-datesinbars':
41 txt = txt + ' --datesinbars '
42 if test == '-rappel':
43 txt = txt + ' --rappel '
44 if test == '-display-resources':
45 txt = txt + ' --display-resources '
46 if test == '-display-id' :
47 i=string.index(arg,test)
48 txt = txt + ' --display-id ' + arg[i+1]
49 if test == '-resource':
50 i=string.index(arg,test)
51 txt = txt + ' --resourcep ' + arg[i+1]
52 if test == '-timestep':
53 i=string.index(arg,test)
54 txt = txt + ' --timestep ' + arg[i+1]
55 if test == '-detail':
56 i=string.index(arg,test)
57 txt = txt + ' --detail ' + arg[i+1]
58 if test == '-datesinbars':
59 txt = txt + ' --datesinbars '
60 if test == '-depth':
61 i=string.index(arg,test)
62 txt = txt + ' --depth ' + arg[i+1]
63 if test == '-view-begin':
64 i=string.index(arg,test)
65 txt=txt + ' --view-begin=' + arg[i+1]
66 if test == '-view-end':
67 i=string.index(arg,test)
68 txt=txt + ' --view-end=' + arg[i+1]
69 # remove bang path, create output list
70 del lines[0]
71 pagename=formatter.page.page_name
72 attach_dir=AttachFile.getAttachDir(pagename,create=1)
73 url=AttachFile.getAttachUrl(pagename,image + '.' + renderer)
74 file_name=attach_dir+ '/' + image + '.' + renderer
75 cmd='pygantt --renderer '+renderer +' ' + txt + ' - > ' + file_name
76 f=os.popen(cmd,'w')
77 for line in lines:
78 print >>f, line
79 f.flush()
80
81
82 link='<img src="'+url+'" >'
83 request.write(link)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.