Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: sellerHome Arguments: Description: Returns homepage for a seller Page type: webl Render function: Module: maybeathome Page source: var ret = nil; // [sessionkey, type, address, price, size, lotSize, beds, baths, features, description]; var msg = ""; var geocode = nil; var list = []; var sessionkey = wubinfo.cookies.sessionkey ? nil; if (sessionkey == nil) then if (Size(OPTIONALARGS) > 0) then sessionkey = OPTIONALARGS[0] end end; if (Size(OPTIONALARGS) > 0) and (OPTIONALARGS[0] == "nil") then sessionkey = nil; end; var userInfo = WubCall("siteutil.getSessionInfo", ["maybeathome", sessionkey]); var lang = wubinfo.cookies.countryCode ? ""; // No errors: add it if (ret == nil) then var db = Wub_GetDB("maybeathome"); var coll = Wub_GetCollection(db, "listings"); var searchParams = [. userId=userInfo.username .]; var dbobj = Wub_NewDBObject(searchParams); var res = Wub_QueryDB(coll, dbobj, 30); if (Size(res) == 0) then // should update msg = "NOT SELLING ANY PROPERTIES YET<ul>Click <a href='/site/sell'>Here</a> to add one.</ul>"; if (lang == `"fr"`) then msg = "VOUS NE VENDES PAS DE PROPRIETES ENCORE Cliquez <a href='/site/sell'>ici</a> pour en ajouter une." end; ret = WubCall("maybeathome.results", [ [. "args" = [sessionkey, msg, "", "", "", "", "", "", "", "", ""], "listings" = list .], sessionkey ]) end; if (ret == nil) then every r in res do list = list + [ r ]; end; var lbl = "PROPERTIES YOU ARE SELLING"; if (lang == `"fr"`) then lbl = "PROPRIETES QUE VOUS VENDEZ" end; ret = WubCall("maybeathome.results", [ [. "args" = [sessionkey,lbl,"", "", "", "", "", "", "", "", ""], "listings" = list .], sessionkey ]) end end; ret;