Attachment 'GANTT-1.2.1.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 2004-04-15 : Daniel Hottinger code fix to work with moin 1.2.1
10
11 """
12
13 import string, os
14
15 from MoinMoin.Page import Page
16 from MoinMoin import config
17 from MoinMoin.action import AttachFile
18
19 htdocs_access = isinstance(config.attachments, type({}))
20
21 def process(request, formatter, lines):
22 # parse bangpath for arguments
23 exclude = []
24 image = 'gantt'
25 renderer = 'png'
26 txt=''
27
28
29 arg=string.split(lines[0])
30
31 for test in arg:
32 if test == '-name' :
33 i=string.index(arg,test)
34 image=arg[i+1]
35 if test == '-renderer' :
36 i=string.index(arg,test)
37 renderer = arg[i+1]
38 if test == '-csp':
39 txt = txt + ' --csp '
40 if test == '-usdates':
41 txt = txt + ' --usdates '
42 if test == '-datesinbars':
43 txt = txt + ' --datesinbars '
44 if test == '-rappel':
45 txt = txt + ' --rappel '
46 if test == '-display-resources':
47 txt = txt + ' --display-resources '
48 if test == '-display-id' :
49 i=string.index(arg,test)
50 txt = txt + ' --display-id ' + arg[i+1]
51 if test == '-resource':
52 i=string.index(arg,test)
53 txt = txt + ' --resourcep ' + arg[i+1]
54 if test == '-timestep':
55 i=string.index(arg,test)
56 txt = txt + ' --timestep ' + arg[i+1]
57 if test == '-detail':
58 i=string.index(arg,test)
59 txt = txt + ' --detail ' + arg[i+1]
60 if test == '-datesinbars':
61 txt = txt + ' --datesinbars '
62 if test == '-depth':
63 i=string.index(arg,test)
64 txt = txt + ' --depth ' + arg[i+1]
65 if test == '-view-begin':
66 i=string.index(arg,test)
67 txt=txt + ' --view-begin=' + arg[i+1]
68 if test == '-view-end':
69 i=string.index(arg,test)
70 txt=txt + ' --view-end=' + arg[i+1]
71 # remove bang path, create output list
72 del lines[0]
73 pagename=formatter.page.page_name
74 attach_dir=AttachFile.getAttachDir(pagename,create=1)
75 url=AttachFile.getAttachUrl(pagename,image + '.' + renderer,request)
76 file_name=attach_dir+ '/' + image + '.' + renderer
77 cmd='pygantt --renderer '+renderer +' ' + txt + ' - > ' + file_name
78 f=os.popen(cmd,'w')
79 for line in lines:
80 print >>f, line
81 f.flush()
82
83
84 link='<img src="'+url+'" >'
85 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.