def options1(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] import json outputs["Result"]["value"] = json.dumps(elements)
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