L
Little
Could someone start me on putting in a table into this code, and some
HTML tags. I would to make the table below the map and have a header at
the top. Thanks for the help.
""" Publisher example """
def query(req, building=""):
# NOTE: best way to understand this is to see the output,
# that is, to "view source" on the generated web page
# read common header for any google mapping
f = file('/home/ta/public_html/maplish/googleHead.html','r')
t = f.read()
f.close()
# define the two buildings we know (because no SQL is done here)
buildings = [ ("cb", "Cambus Office", "-91.552977", "41.659655")
]
buildings += [ ("va/hardlib", "VA/Hardin Library", "-91.549501",
"41.662348") ]
buildings += [ ("hancher", "Hancher Auditorium", "-91.538214",
"41.669529") ]
buildings += [ ("currier", "Currier Hall", "-91.534996",
"41.666163") ]
buildings += [ ("schaeffer", "Schaeffer Hall", "-91.535296",
"41.660969") ]
buildings += [ ("shospital", "South Hospital", "-91.548900",
"41.658885") ]
str = '' # in case no buildings match, use empty string
for x in buildings:
a,b,c,d = x # isolate all the tuple components into a,b,c,d
if building.lower() == a:
# construct javascript, using Python %s to substitute names
and data
# see http://docs.python.org/lib/typesseq-strings.html if
needed
str = 'var bldg%s = new GPoint( %s, %s);\n' % (a, c, d)
str += 'var mrk%s = new GMarker( bldg%s );\n' % (a, a)
str += 'var htm%s = "%s";\n' % (a, b)
str += 'GEvent.addListener(mrk%s,"click",function() {' % a
str += 'mrk%s.openInfoWindowHtml(htm%s); });\n' % (a, a)
str += 'map.addOverlay(mrk%s);\n' % a
# output markers, if any
t = t + str
# then add trailing html to finish page
trail = "//]]> </script> </body> </html>"
t = t + trail
return t
HTML tags. I would to make the table below the map and have a header at
the top. Thanks for the help.
""" Publisher example """
def query(req, building=""):
# NOTE: best way to understand this is to see the output,
# that is, to "view source" on the generated web page
# read common header for any google mapping
f = file('/home/ta/public_html/maplish/googleHead.html','r')
t = f.read()
f.close()
# define the two buildings we know (because no SQL is done here)
buildings = [ ("cb", "Cambus Office", "-91.552977", "41.659655")
]
buildings += [ ("va/hardlib", "VA/Hardin Library", "-91.549501",
"41.662348") ]
buildings += [ ("hancher", "Hancher Auditorium", "-91.538214",
"41.669529") ]
buildings += [ ("currier", "Currier Hall", "-91.534996",
"41.666163") ]
buildings += [ ("schaeffer", "Schaeffer Hall", "-91.535296",
"41.660969") ]
buildings += [ ("shospital", "South Hospital", "-91.548900",
"41.658885") ]
str = '' # in case no buildings match, use empty string
for x in buildings:
a,b,c,d = x # isolate all the tuple components into a,b,c,d
if building.lower() == a:
# construct javascript, using Python %s to substitute names
and data
# see http://docs.python.org/lib/typesseq-strings.html if
needed
str = 'var bldg%s = new GPoint( %s, %s);\n' % (a, c, d)
str += 'var mrk%s = new GMarker( bldg%s );\n' % (a, a)
str += 'var htm%s = "%s";\n' % (a, b)
str += 'GEvent.addListener(mrk%s,"click",function() {' % a
str += 'mrk%s.openInfoWindowHtml(htm%s); });\n' % (a, a)
str += 'map.addOverlay(mrk%s);\n' % a
# output markers, if any
t = t + str
# then add trailing html to finish page
trail = "//]]> </script> </body> </html>"
t = t + trail
return t