xmlnotes.py :  » Business-Application » ganttproject-at-web » gantt » older » old_18feb » 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_18feb » xmlnotes.py
#!/usr/bin/python
import cgitb;cgitb.enable()
import xml.dom.minidom
from domprojects import *
import webpage

def setup():
  return xml.dom.minidom.parse("gantt_setup.xml").documentElement
  
  
######

######

WORLD = setup()
TOWN = None

def main():
  vento ={}
  dom_set_icon_xml("/gantt/xml.gif")
  global TOWN
  TOWN = dom_get_element_by_value(WORLD.getElementsByTagName("group"),"todo")
  webresult = webpage.webpage("gantt@web")
  top="<h1>%s</h1>%s" % (TOWN.getAttribute("label"),dom_info_button(TOWN))
  bottom="ree"
  webresult.js_function("mostra_nascondi")
  webresult.set_icon("/gantt/burst.png")
  webresult.add_rss("prova.x","prova.y")
  html=pagina_visualizza(vento)
  webresult.set_div_top(top)
  webresult.set_div_main(html)
  webresult.set_div_bottom(bottom)
  
  webresult.html_css="""<style>
  #visualizzazione div.tag_task {border:solid 1px blue;
    min-height:30px; 
    margin:30px 5px 30px 5px;}
  .attribute_company, .attribute_webLink,
  .attribute_name, .attribute_id, .attribute_start, .attribute_duration,
  .attribute_color, .attribute_expand, .attribute_meeting, 
  .attribute_complete, .attribute_fixed-start,
  .attribute_priority
  {border:solid 1px red;  margin:5px; display:inline; display:none;}
  
  .attribute_name {position:absolute; left:180px; display:block; width:300px;}
  .attribute_start {position:absolute; left:50px; display:block;}
  .attribute_duration {position:absolute; left:130px; display:block; width:30px;}
  h1 {background-color:#ccf;}
    
  #piede {background-color:#eee; width:100%%px; height:5px; top:-15px; opacity:0.4; left:90%;}
  #piede:hover {height:100px; top:-80px; opacity:0.8; left:0%}
    </style>"""
  print "Content-type:text/html\n\n\n"
  print webresult.html()

  
#####
def albero_dom2html(dom_element):
  """
    trasforma i valori del file in un albero
  """
  html = "<div class='tag_%s'>" % dom_element.tagName
  diz_attr=dom_attr2dict(dom_element)
  for a in diz_attr.keys():
    html+="<div class='attribute_%s'>%s</div>" % (a,diz_attr[a])
  for a in dom_element.childNodes:
    tipo = a.nodeType
    if tipo == a.ELEMENT_NODE:
      html+= albero_dom2html(a)
  html+="</div>"
  return html

def albero_html2dom(vento):
  """
    trasforma i valori di un albero nel file
  """
  
#####

def pagina_visualizza(vento):
  html="<h2>visualizzazione</h2>"
  html+="<div id='visualizzazione'>"  
  x = xml.dom.minidom.parse("esempio.gan")
  html+=albero_dom2html(x.documentElement)
  html+="</div>"
  html+=repr(dir(x))
  return html
  
if __name__ == "__main__":
  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.