show = utils.show form = cgi.FieldStorage() if "name" not in form and "poly" not in form: utils.print_header("Importer of .poly files") show(u"<h1>%s</h1>" % ("Import of .poly files")) show(u"<br><br>\n") show(u"<form method='POST' action='' enctype='multipart/form-data'>") show(u"<label for='name'>%s</label>" % "Name") show(u"<input type='text' name='name' id='name'>") show(u"<label for='poly'>%s</label>" % ".poly file") show(u"<input type='file' name='poly' id='poly'>") show(u"<input type='submit'>") show(u"</form>") utils.print_tail() sys.exit(0) import cgitb cgitb.enable() name = str(form.getvalue("name", -1)) poly_file = form["poly"].file PgConn = utils.get_dbconn() PgCursor = PgConn.cursor() utils.print_header("Importer of .poly files") #show(u"Content-Type: text/plain; charset=utf-8") #print
show( u"<a href='get_poly.py?id=%d&params=%s&name=%s' title='poly'>poly</a>\n" % (rel_id, o_res["params"], u_res["name"])) show( u"<a href='get_image.py?id=%d&params=%s&name=%s' title='image'>image</a>\n" % (rel_id, o_res["params"], u_res["name"])) show(u" </td>") show(u" </tr>\n") show(u"</table>\n") if rel_id == -1 or name == "": show(u"<br><br>\n") show(u"<h1>%s</h1>" % ("Show polygon")) show(u"<form method='GET' action=''>") show(u"<label for='id'>%s</label>" % "Id of relation") if rel_id == -1: show(u"<input type='text' name='id' id='id'>") else: show(u"<input type='text' name='id' id='id' value='%d'>", rel_id) show(u"<br>") show(u"<label for='name'>%s</label>" % "Name of user polygon") show(u"<input type='text' name='name' id='name' value='%s'>" % name) show(u"<input type='submit'>") show(u"</form>") ########################################################################### utils.print_tail() PgConn.commit() PgConn.close()