Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: data2 Arguments: server Description: Data for the games Page type: webl Render function: Module: demavu Page source: var db = Wub_GetDB("demavu"); var coll = Wub_GetCollection(db, "data"); if server == "" or server == "-" then server = "staging" end; var selectedGame = "Shark_Showdown"; var res = Str_Trim(WubCall("getConfigVar", [server,"selectedGame"])); if Size(res) > 0 then selectedGame = res; end; // var s = recurseData("sXbxqn7udYfN", data); var obj = [. .]; var done = false; var multi = false; var i = 0; every o in OPTIONALARGS do if OPTIONALARGS[i] == "*" then multi = true else if OPTIONALARGS[i] == "-" then if i == 0 then obj["lev" + ToString(i)] := "sXbxqn7udYfN"; elsif i == 2 then obj["lev" + ToString(i)] := selectedGame; end elsif OPTIONALARGS[i] == "selected" and i == 1 then done = selectedGame else obj["lev" + ToString(i)] := Str_Trim(o); end end; i = i + 1 end; if done == false then obj["server"] := server; var queryObj = Wub_NewDBObject(obj); res = Wub_QueryDB(coll, queryObj, 5000); var sz = -1; var same = true; var samefield = true; var fld; every r in res do if sz == -1 then sz = Size(ToList(r)); fld = ToList(r)[Size(ToList(r))-2] end; if Size(ToList(r)) != sz then same = false end; if fld != ToList(r)[Size(ToList(r))-2] then samefield = false end end; if same then if Size(res) == 0 then ""; elsif Size(res) == 1 then if Size(OPTIONALARGS) + 3 == Size(ToList(res[0])) and !multi then res[0].value else res end elsif samefield then var rs = []; every r in res do rs = rs + [r] end; rs else var res2 = []; var obj = [. .]; // every r in res do // end; res end else res end; else done end;