index.py :  » Business-Application » ganttproject-at-web » gantt » older » old_22mar » cgi-bin » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » ganttproject at web 
ganttproject at web » gantt » older » old_22mar » cgi bin » index.py
#!/usr/bin/python
"""
  programma per i grafici di gantt
  
@author:Baruffaldi Paolo
@since:18-feb-2005

"""
__docformat__ = "epytext it"

import cgi
import cgitb; cgitb.enable()
import xml.dom.minidom
import webpage
from domprojects import *

THE_DOM = {}

def slash_get(diz_param,chiave,elseValue=None):
  """
    chiave indica il valore delle chiave diz_param,
    incastonata tramite "/";
    "$" indica un attributo senza figli di tipo stringa
    "%" indica un attributo senza figli di tipo numero
  """
  if "/" in chiave:
    x,y = chiave.split("/",1)
    if x in diz_param:
      return situazione(diz_param[x],y)
    else:
      return elseValue
  else:
    return diz_param.get(chiave) or elseValue
  
def main():
  
  res = {}
    
  pagina = webpage.webpage("gantt")
  
  testa="""
  <img src='../img/gantt.png' class='big_icon'>
  """
  if not(slash_get(res,"azione")):
    corpo=pagina_apertura(res)
  
  pagina.set_div_top(testa)
  pagina.set_div_main(corpo)
  pagina.css(css())
  pagina.out()
  
def html_colonne(lista_colonne,titoli_colonne=None):
  html=["<table class='html_colonne'><tr>"]
  if titoli_colonne:
    html.extend(["<th>%s</th>" % x for x in titoli_colonne])
    html.append("</tr><tr>")
  for a in lista_colonne:
    html.append("<td valign='top'>%s</td>" % a)
  html.append("</tr></table>")
  return "\n".join(html)
  
  
def box_sommario(diz):
  argomenti = THE_DOM.getElementsByTagName("actions")
  titoli=[]
  colonne=[]
  for a in argomenti:
    titoli.append(dom_etichetta(a))
    modello_link = "&nbsp; <a href='%(v)s' title='%(label)s'>%%s</a> &nbsp;"
    colonne.append("".join([\
      modello_link % dom_attr2dict(y) % dom_etichetta(y)\
        for y in a.getElementsByTagName("action")\
          if not(y.getAttribute("v")[-1] in [str(x) for x in range(10)]) ]))  
  return html_colonne(colonne,titoli)
  
def pagina_apertura(diz):
  design = {"sommario": box_sommario(diz)}
  return """
  <h2>sommario</h2>
    <div class='titled_box'>
    %(sommario)s
    </div>
  <h2>informazioni</h2>
    <div class='titled_box'>
    Ganttproject@web: <i>...now pythoning</i>
    <img src='../img/gantt.png'>
    </div>
    """ % design
  
def css():
  return """
  <style>
  .big_icon {height:64px;}
  .html_colonne th {
    background-color:#ccc;
    }
  .html_colonne td {
    background-color:#eee;
    }
  h1 {color:white; background-color:#aaf; 
    text-align:center; 
    margin-left:5%;width:70%;}
    
  h2,h3 {-moz-border-radius: 2% 2% 0 0;
      border:solid 2px #ccccff;
      background-color:#9999ff;
      text-align:center;
      color:#fff;
      width:60%; margin-bottom:0;}
  .titled_box {
      -moz-border-radius: 0 2% 2% 2%;
      border:solid 2px #ccccff;
      padding:1%;
      width:95%; margin-bottom:1%;
    }
  </style>
  """
#####    #####    #####    #####    #####    #####    #####    
if __name__ == "__main__":
  THE_DOM = xml.dom.minidom.parse("gantt_setup.xml")
  main()
  
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.