def displayHTML(conf, inputs, outputs): #print >> sys.stderr,conf import datastores.directories.service as dirs #print >> sys.stderr,dir(dirs) inputs["state"] = {"value": "open"} dirs.display(conf, inputs, outputs) dirStr = outputs["Result"]["value"] #print >> sys.stderr,outputs import postgis.service as dbs #Hard coded supported dbs ! suported_dbs = ["PostGIS", "MySQL"] dbStrs = {} for i in suported_dbs: dbs.display(conf, {"type": {"value": i}}, outputs) dbStrs[i] = outputs["Result"]["value"] import datastores.wfs.service as wfs wfs.display(conf, {"type": {"value": "WFS"}}, outputs) wfsStrs = outputs["Result"]["value"] wfs.display(conf, {"type": {"value": "WMS"}}, outputs) wmsStrs = outputs["Result"]["value"] inputs["dirs"] = {"value": dirStr} inputs["dbs"] = {"value": dbStrs} inputs["wfs"] = {"value": wfsStrs} inputs["wms"] = {"value": wmsStrs} import template.service as tmpl tmpl.display(conf, { "tmpl": { "value": "Distiller" }, "force": { "value": "true" } }, outputs) return 3
def displayHTML(conf,inputs,outputs): #print >> sys.stderr,conf import datastores.directories.service as dirs #print >> sys.stderr,dir(dirs) inputs["state"]={"value":"open"} dirs.display(conf,inputs,outputs) dirStr=outputs["Result"]["value"] #print >> sys.stderr,outputs import postgis.service as dbs #Hard coded supported dbs ! suported_dbs=["PostGIS","MySQL"] dbStrs={} for i in suported_dbs: dbs.display(conf,{"type":{"value":i}},outputs) dbStrs[i]=outputs["Result"]["value"] import datastores.wfs.service as wfs wfs.display(conf,{"type":{"value":"WFS"}},outputs) wfsStrs=outputs["Result"]["value"] wfs.display(conf,{"type":{"value":"WMS"}},outputs) wmsStrs=outputs["Result"]["value"] #print >> sys.stderr,dbStrs #outputs["Result"]["value"]=str(dirStr)+str(dbStrs) inputs["dirs"]={"value":dirStr} inputs["dbs"]={"value":dbStrs} inputs["wfs"]={"value":wfsStrs} inputs["wms"]={"value":wmsStrs} import template.service as tmpl tmpl.display(conf,{"tmpl":{"value":"Distiller"},"force":{"value":"true"}},outputs) return 3
def options(conf,inputs,outputs): import datastores.service as ds import mm_access ds.list(conf,inputs,outputs) elements=eval(outputs["Result"]["value"]) print >>sys.stderr,str(elements) li=[] dsList=None dstnStr="" for a in elements: if a=="Directories": #print >> sys.stderr,"ELEMENTS A 0 "+str(elements[a][0]) for j in range(0,len(elements[a])): if mm_access.checkDataStorePriv(conf,elements[a][j]["name"],"rx"): dstnStr=elements[a][j]["name"] print >> sys.stderr,"DSTN : "+dstnStr outputs["Result"]["value"]="[]" ds.listDataSource(conf,{"dstn":{"value": elements[a][j]["name"]+"/"}},outputs) dsList=eval(outputs["Result"]["value"]) break #print >> sys.stderr,str(dsList) li+=[{"name": a}] import template.service as tmpl #print >> sys.stderr,conf mapfile=conf["main"]["dataPath"]+"/maps/project_"+conf["senv"]["last_map"]+".map" import mapscript m = mapscript.mapObj(mapfile) levels=[m.web.metadata.get("mm_group_0")] try: level1=m.web.metadata.get("mm_group_1").split(',') except: level1=None try: level2=m.web.metadata.get("mm_group_2").split(';') except: level2=None if level1 is not None: for a in level1: levels+=["- "+a] if level2 is not None: for b in level2: tmp=b.split('|') if len(tmp)>1 and tmp[1]==a: tmp1=tmp[0].split(',') for c in tmp1: levels+=["-- "+c] print >> sys.stderr,"TEMPLATE!" print >> sys.stderr,{"tmpl":{"value":"Manager/AddLayer"},"dstn": dstnStr,"elements": elements, "dsList": dsList, "groups": levels,"inputs":inputs} try: tmpl.display(conf,{"tmpl":{"value":"Manager/AddLayer"},"dstn": dstnStr,"elements": elements, "dsList": dsList, "groups": levels,"inputs":inputs},outputs) except Exception,e: print >> sys.stderr,e
def getForm(conf, inputs, outputs): import datastores.service as ds import mm_access ds.list(conf, inputs, outputs) elements = eval(outputs["Result"]["value"]) dirs = [] j = 0 for i in range(0, len(elements["Directories"])): print >>sys.stderr, elements["Directories"][i]["name"] + " rwx" if mm_access.checkDataStorePriv(conf, elements["Directories"][i]["name"], "rwx"): dirs += [elements["Directories"][i]["name"]] j += 1 import template.service as tmpl tmpl.display(conf, {"tmpl": {"value": inputs["form"]["value"]}, "dirs": dirs}, outputs) return 3
def getForm(conf, inputs, outputs): import datastores.service as ds import mm_access ds.list(conf, inputs, outputs) elements = eval(outputs["Result"]["value"]) dirs = [] j = 0 for i in range(0, len(elements["Directories"])): print >> sys.stderr, elements["Directories"][i]["name"] + " rwx" if mm_access.checkDataStorePriv(conf, elements["Directories"][i]["name"], "rwx"): dirs += [elements["Directories"][i]["name"]] j += 1 import template.service as tmpl inputs1 = inputs inputs1["tmpl"] = {"value": inputs["form"]["value"]} inputs1["dirs"] = dirs tmpl.display(conf, inputs1, outputs) return 3
def options(conf, inputs, outputs): import datastores.service as ds import mm_access ds.list(conf, inputs, outputs) elements = eval(outputs["Result"]["value"]) print >> sys.stderr, str(elements) li = [] dsList = None dstnStr = "" for a in elements: if a == "Directories": #print >> sys.stderr,"ELEMENTS A 0 "+str(elements[a][0]) for j in range(0, len(elements[a])): if mm_access.checkDataStorePriv(conf, elements[a][j]["name"], "rx"): dstnStr = elements[a][j]["name"] print >> sys.stderr, "DSTN : " + dstnStr outputs["Result"]["value"] = "[]" ds.listDataSource( conf, {"dstn": { "value": elements[a][j]["name"] + "/" }}, outputs) dsList = eval(outputs["Result"]["value"]) break #print >> sys.stderr,str(dsList) li += [{"name": a}] import template.service as tmpl #print >> sys.stderr,conf mapfile = conf["main"]["dataPath"] + "/maps/project_" + conf["senv"][ "last_map"] + ".map" import mapscript m = mapscript.mapObj(mapfile) levels = [m.web.metadata.get("mm_group_0")] try: level1 = m.web.metadata.get("mm_group_1").split(',') except: level1 = None try: level2 = m.web.metadata.get("mm_group_2").split(';') except: level2 = None if level1 is not None: for a in level1: levels += ["- " + a] if level2 is not None: for b in level2: tmp = b.split('|') if len(tmp) > 1 and tmp[1] == a: tmp1 = tmp[0].split(',') for c in tmp1: levels += ["-- " + c] print >> sys.stderr, "TEMPLATE!" print >> sys.stderr, { "tmpl": { "value": "Manager/AddLayer" }, "dstn": dstnStr, "elements": elements, "dsList": dsList, "groups": levels, "inputs": inputs } try: tmpl.display( conf, { "tmpl": { "value": "Manager/AddLayer" }, "dstn": dstnStr, "elements": elements, "dsList": dsList, "groups": levels, "inputs": inputs }, outputs) except Exception, e: print >> sys.stderr, e