Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: updateRecord Arguments: server,path,value Description: Page type: webl Render function: Module: demavu Page source: path = Str_Split(Base64_Decode(path), ","); value = Base64_Decode(value); var db = Wub_GetDB("demavu"); var coll = Wub_GetCollection(db, "data"); if server == "-" then server = "staging" end; var queryObj = Wub_NewDBObject([. "server"=server, "app"="devtools" .]); var res = Wub_QueryDB(coll, queryObj, 20); // 20 = max results var selectedGame = "Shark_Showdown"; if Size(res) > 0 then selectedGame = res[0].selected; end; var obj = [. .]; var done = false; var addList = false; var ret = "NOTHING"; var i = 0; every o in path do if path[i] != "*" then if path[i] == "-" then if i == 0 then obj["lev" + ToString(i)] := "sXbxqn7udYfN"; elsif i == 2 then obj["lev" + ToString(i)] := selectedGame; end elsif path[i] == "selected" and i == 1 then done = selectedGame elsif path[i] == "ADDLIST" then addList = true else obj["lev" + ToString(i)] := Str_Trim(o); end end; i = i + 1 end; if value == "Add Intent" then done = true end; if done == false then obj["server"] := server; if addList then obj["value"] := value; var dbobj = Wub_NewDBObject(obj); Wub_InsertDB(coll, dbobj); else queryObj = Wub_NewDBObject(obj); var upobj = Wub_NewDBObject([. "$set" = [. "value"=value .] .]); // var res = Wub_QueryDB(coll, queryObj, 5000); var res = Wub_UpdateDB(coll, queryObj, upobj, true, true); end; ret = ToString(obj); else ret = ToString(done) end; NewPage(ret, "text/plain");