#!/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()
|