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.
  • [get | view] (2004-05-05 21:34:20, 10.3 KB) [[attachment:AbcMusic.py]]
  • [get | view] (2004-04-15 07:19:38, 3.4 KB) [[attachment:DataLanguage.py]]
  • [get | view] (2004-04-15 20:23:33, 2.5 KB) [[attachment:GANTT-1.2.1.py]]
  • [get | view] (2003-12-07 18:15:55, 2.4 KB) [[attachment:GANTT.py]]
  • [get | view] (2004-07-29 15:04:28, 12.1 KB) [[attachment:IndentTable.py]]
  • [get | view] (2004-10-05 13:12:16, 10.6 KB) [[attachment:MySQL.py]]
  • [get | view] (2004-03-27 18:55:57, 3.7 KB) [[attachment:SimpleTable.py]]
  • [get | view] (2003-12-07 18:15:55, 1.5 KB) [[attachment:TextOnRight.py]]
  • [get | view] (2004-09-17 06:53:46, 3.0 KB) [[attachment:awktable-1.2.3.py]]
  • [get | view] (2004-10-28 13:55:04, 1.0 KB) [[attachment:colorer.py]]
  • [get | view] (2004-11-04 00:26:37, 1.4 KB) [[attachment:csv_python_module.diff]]
  • [get | view] (2004-04-21 18:29:38, 0.2 KB) [[attachment:html.py]]
  • [get | view] (2004-08-16 10:59:24, 4.8 KB) [[attachment:latex-1.2.3.py]]
  • [get | view] (2004-08-07 07:36:59, 3.9 KB) [[attachment:latex-cygwin.py]]
  • [get | view] (2004-04-09 17:05:33, 2.9 KB) [[attachment:latex.1.2.1.py]]
  • [get | view] (2004-02-29 16:50:13, 2.1 KB) [[attachment:latex.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.