public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var estateListVars = new List <Dictionary <string, object> > (); var estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> (); var user = Authenticator.GetAuthentication(httpRequest); var estates = estateConnector.GetEstates(user.PrincipalID); if (estates.Count > 0) { foreach (var estate in estates) { var regions = estateConnector.GetRegions((int)estate.EstateID); estateListVars.Add(new Dictionary <string, object> { { "EstateName", estate.EstateName }, { "PublicAccess", WebHelpers.YesNo(translator, estate.PublicAccess) }, { "AllowVoice", WebHelpers.YesNo(translator, estate.AllowVoice) }, { "TaxFree", WebHelpers.YesNo(translator, estate.TaxFree) }, { "AllowDirectTeleport", WebHelpers.YesNo(translator, estate.AllowDirectTeleport) }, { "RegionCount", regions.Count.ToString() } }); } } else { estateListVars.Add(new Dictionary <string, object> { { "EstateName", translator.GetTranslatedString("NoDetailsText") }, { "PublicAccess", "" }, { "AllowVoice", "" }, { "TaxFree", "" }, { "AllowDirectTeleport", "" }, { "RegionCount", "" } }); } vars.Add("EstateList", estateListVars); // labels vars.Add("UserName", user.Name); vars.Add("AddEstateText", translator.GetTranslatedString("AddEstateText")); vars.Add("EditEstateText", translator.GetTranslatedString("EditText")); vars.Add("EstateListText", translator.GetTranslatedString("EstatesText")); vars.Add("EstateText", translator.GetTranslatedString("EstateText")); vars.Add("PublicAccessText", translator.GetTranslatedString("PublicAccessText")); vars.Add("AllowVoiceText", translator.GetTranslatedString("AllowVoiceText")); vars.Add("TaxFreeText", translator.GetTranslatedString("TaxFreeText")); vars.Add("AllowDirectTeleportText", translator.GetTranslatedString("AllowDirectTeleportText")); vars.Add("RegionsText", translator.GetTranslatedString("MenuRegionsTitle")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); string error = ""; UserAccount user = Authenticator.GetAuthentication(httpRequest); if (user == null) { response = "No authentication service was available to change user details"; return(null); } // who we are dealing with... vars.Add("UserName", user.Name); // password change if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitPasswordChange") { string password = requestParameters["password"].ToString(); string passwordconf = requestParameters["passwordconf"].ToString(); response = "Success"; if (passwordconf != password) { response = "Passwords do not match"; } else { IAuthenticationService authService = webInterface.Registry.RequestModuleInterface <IAuthenticationService>(); if (authService != null) { response = authService.SetPassword(user.PrincipalID, "UserAccount", password) ? "Your password has been updated" : "Failed to set your password, try again later"; } else { response = "No authentication service was available to change your password"; } } return(null); } // email change if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitEmailChange") { string email = requestParameters["email"].ToString(); IUserAccountService userService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); if (userService != null) { user.Email = email; userService.StoreUserAccount(user); response = "Success"; } else { response = "No authentication service was available to change your password"; } return(null); } // Delete User if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitDeleteUser") { string username = requestParameters["username"].ToString(); string password = requestParameters["password"].ToString(); ILoginService loginService = webInterface.Registry.RequestModuleInterface <ILoginService>(); if (loginService.VerifyClient(UUID.Zero, username, "UserAccount", password)) { IUserAccountService userService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); if (userService != null) { userService.DeleteUser(user.PrincipalID, user.Name, password, true, false); response = "Successfully deleted account."; } else { response = "User service unavailable, please try again later"; } } else { response = "Wrong username or password"; } return(null); } // Page variables vars.Add("ErrorMessage", error); vars.Add("ChangeUserInformationText", translator.GetTranslatedString("ChangeUserInformationText")); vars.Add("ChangePasswordText", translator.GetTranslatedString("ChangePasswordText")); vars.Add("NewPasswordText", translator.GetTranslatedString("NewPasswordText")); vars.Add("NewPasswordConfirmationText", translator.GetTranslatedString("NewPasswordConfirmationText")); vars.Add("ChangeEmailText", translator.GetTranslatedString("ChangeEmailText")); vars.Add("NewEmailText", translator.GetTranslatedString("NewEmailText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("PasswordText", translator.GetTranslatedString("PasswordText")); vars.Add("DeleteUserText", translator.GetTranslatedString("DeleteUserText")); vars.Add("DeleteText", translator.GetTranslatedString("DeleteText")); vars.Add("DeleteUserInfoText", translator.GetTranslatedString("DeleteUserInfoText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var usersList = new List <Dictionary <string, object> > (); var agentInfo = Framework.Utilities.DataManager.RequestPlugin <IAgentInfoConnector> (); var IsAdmin = Authenticator.CheckAdminAuthentication(httpRequest); //var activeUsers = agentInfo.RecentlyOnline(15*60, true, new Dictionary<string, bool>()); // active in the last 15 minutes var activeUsers = agentInfo.CurrentlyOnline(0, new Dictionary <string, bool> ()); var onlineText = ""; if (activeUsers.Count > 0) { var activeUsersList = new List <UUID> (); if (IsAdmin) // display all online users { onlineText = translator.GetTranslatedString("OnlineUsersText"); foreach (var user in activeUsers) { activeUsersList.Add((UUID)user.UserID); } } else // only show the users online friends { onlineText = translator.GetTranslatedString("OnlineFriendsText"); var ourAccount = Authenticator.GetAuthentication(httpRequest); if (ourAccount != null) { var friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService> (); if (friendsService != null) { var friends = friendsService.GetFriends(ourAccount.PrincipalID); foreach (var friend in friends) { UUID friendID; UUID.TryParse(friend.Friend, out friendID); if (friendID != UUID.Zero) { // if ( (friendID != UUID.Zero) && (friendID == ourAccount.PrincipalID)) activeUsersList.Add(friendID); } } } } } if (activeUsersList.Count > 0) { var accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService> (); var gridService = webInterface.Registry.RequestModuleInterface <IGridService> (); foreach (var user in activeUsers) { if (Utilities.IsSystemUser((UUID)user.UserID)) { continue; } if (!activeUsersList.Contains((UUID)user.UserID)) { continue; } var region = gridService.GetRegionByUUID(null, user.CurrentRegionID); if (region != null) { var account = accountService.GetUserAccount(region.AllScopeIDs, UUID.Parse(user.UserID)); if (account != null) { usersList.Add(new Dictionary <string, object> { { "UserName", account.Name }, { "UserRegion", region.RegionName }, { "UserLocation", user.CurrentPosition }, { "UserID", user.UserID }, { "UserRegionID", region.RegionID } }); } } } } } if (usersList.Count == 0) { usersList.Add( new Dictionary <string, object> { { "UserName", "" }, { "UserRegion", "" }, { "UserLocation", "No users are currently logged in" }, { "UserID", "" }, { "UserRegionID", "" } }); } if (requestParameters.ContainsKey("Order")) { if (requestParameters ["Order"].ToString() == "RegionName") { usersList.Sort((a, b) => a ["UserRegion"].ToString().CompareTo(b ["UserRegion"].ToString())); } if (requestParameters ["Order"].ToString() == "UserName") { usersList.Sort((a, b) => a ["UserName"].ToString().CompareTo(b ["UserName"].ToString())); } } vars.Add("OnlineUsersText", onlineText); vars.Add("UsersOnlineList", usersList); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule> (); var currencySymbol = "$"; if (moneyModule != null) { currencySymbol = moneyModule.InWorldCurrencySymbol; } response = null; var vars = new Dictionary <string, object> (); var duration = 10; if (requestParameters.ContainsKey("Submit")) { string eventName = requestParameters ["eventName"].ToString(); string eventDate = requestParameters ["eventDate"].ToString(); string eventTime = requestParameters ["eventTime"].ToString(); string eventDuration = requestParameters ["eventDuration"].ToString(); string eventLocation = requestParameters ["eventLocation"].ToString(); string eventCategory = requestParameters ["eventCategory"].ToString(); string eventCoverCharge = requestParameters ["eventCoverCharge"].ToString(); string eventDescription = requestParameters ["eventDescription"].ToString(); var directoryService = Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector> (); var regionData = Framework.Utilities.DataManager.RequestPlugin <IRegionData> (); var selParcel = eventLocation.Split(','); // Format: parcelLocationX, parcelLocationY, parcelLandingX, parcelLandingY, parcelLandingZ, parcelUUID // "1020,995,128,28,25,d436261b-7186-42a6-dcd3-b80c1bcafaa4" Framework.Services.GridRegion region = null; var parcel = directoryService.GetParcelInfo((UUID)selParcel [5]); if (parcel != null) { region = regionData.Get(parcel.RegionID, null); } if (region == null) { var error = "Parcel details not found!"; vars.Add("ErrorMessage", "<h3>" + error + "</h3>"); response = "<h3>" + error + "</h3>"; return(null); } // we have details... var eventDT = DateTime.Parse(eventDate + " " + eventTime).ToUniversalTime(); var localPos = new Vector3(int.Parse(selParcel [0]), int.Parse(selParcel [0]), 0); var nEvent = directoryService.CreateEvent( ourAccount.PrincipalID, region.RegionID, (UUID)selParcel [5], eventDT, uint.Parse(eventCoverCharge), (DirectoryManager.EventFlags)Util.ConvertAccessLevelToMaturity(region.Access), (uint)region.Access, uint.Parse(eventDuration), localPos, eventName, eventDescription, eventCategory ); if (nEvent != null) { response = "<h3>Event added successfully, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html?page=events\";}, 0);" + "</script>"; } return(null); } // Time selections var nearestHalf = Utilities.RoundUp(DateTime.Now, TimeSpan.FromMinutes(30)).ToString("hh\\:mm\\:ss"); vars.Add("EventDate", DateTime.Now.AddDays(1).ToShortDateString()); vars.Add("EventTimes", WebHelpers.EventTimeSelections(nearestHalf, translator)); // event durations vars.Add("EventDurations", WebHelpers.EventDurationSelections(duration)); // event locations vars.Add("EventLocations", WebHelpers.EventLocations(ourAccount, webInterface.Registry)); vars.Add("EventCategories", WebHelpers.EventCategorySelections(-1, translator)); vars.Add("EventCoverCharge", "0"); // labels vars.Add("AddEventText", translator.GetTranslatedString("AddEventText")); vars.Add("EventNameText", translator.GetTranslatedString("EventNameText")); vars.Add("EventDateText", translator.GetTranslatedString("EventDateText")); vars.Add("EventTimeText", translator.GetTranslatedString("TimeText")); vars.Add("EventTimeInfoText", translator.GetTranslatedString("EventTimeInfoText")); vars.Add("EventDurationText", translator.GetTranslatedString("DurationText")); vars.Add("EventLocationText", translator.GetTranslatedString("EventLocationText")); vars.Add("EventCategoryText", translator.GetTranslatedString("CategoryText")); vars.Add("EventCoverChargeText", translator.GetTranslatedString("CoverChargeText") + " " + currencySymbol); vars.Add("EventDescriptionText", translator.GetTranslatedString("DescriptionText")); vars.Add("ErrorMessage", ""); vars.Add("Submit", translator.GetTranslatedString("AddEventText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var gridService = webInterface.Registry.RequestModuleInterface <IGridService> (); var user = Authenticator.GetAuthentication(httpRequest); vars.Add("RegionServerURL", webInterface.GridURL); // This needs to be sorted out for grid regions #region EditRegion if (requestParameters.ContainsKey("Submit")) { var regionServerURL = requestParameters ["RegionServerURL"].ToString(); // required if (regionServerURL == "") { response = "<h3>" + translator.GetTranslatedString("RegionServerURLError") + "</h3>"; return(null); } var regionID = requestParameters ["RegionID"].ToString(); var regionName = requestParameters ["RegionName"].ToString(); //var OwnerUUID = requestParameters["OwnerUUID"].ToString(); var regionLocX = requestParameters ["RegionLocX"].ToString(); var regionLocY = requestParameters ["RegionLocY"].ToString(); var regionSizeX = requestParameters ["RegionSizeX"].ToString(); var regionSizeY = requestParameters ["RegionSizeY"].ToString(); var regionType = requestParameters ["RegionType"].ToString(); var regionPresetType = requestParameters ["RegionPresetType"].ToString(); var regionTerrain = requestParameters ["RegionTerrain"].ToString(); var regionLoadTerrain = requestParameters.ContainsKey("RegionLoadTerrain") ? requestParameters ["RegionLoadTerrain"].ToString() : ""; // a bit of idiot proofing if (regionName == "") { response = "<h3>" + translator.GetTranslatedString("RegionNameError") + "</h3>"; return(null); } if ((regionLocX == "") || (regionLocY == "")) { response = "<h3>" + translator.GetTranslatedString("RegionLocationError") + "</h3>"; return(null); } // so far so good... // build the new region details int RegionPort = int.Parse(requestParameters ["RegionPort"].ToString()); var newRegion = new RegionInfo(); if (regionID != "") { newRegion.RegionID = UUID.Parse(regionID); } newRegion.RegionName = regionName; newRegion.RegionType = regionType; newRegion.RegionLocX = int.Parse(regionLocX); newRegion.RegionLocY = int.Parse(regionLocY); newRegion.RegionSizeX = int.Parse(regionSizeX); newRegion.RegionSizeY = int.Parse(regionSizeY); newRegion.RegionPort = RegionPort; newRegion.SeeIntoThisSimFromNeighbor = true; newRegion.InfiniteRegion = true; newRegion.ObjectCapacity = 50000; newRegion.Startup = StartupType.Normal; var regionPreset = regionPresetType.ToLower(); //SubString(0,1); if (regionPreset.StartsWith("c", System.StringComparison.Ordinal)) { newRegion.RegionPort = int.Parse(requestParameters ["RegionPort"].ToString()); newRegion.SeeIntoThisSimFromNeighbor = (requestParameters ["RegionVisibility"].ToString().ToLower() == "yes"); newRegion.InfiniteRegion = (requestParameters ["RegionInfinite"].ToString().ToLower() == "yes"); newRegion.ObjectCapacity = int.Parse(requestParameters ["RegionCapacity"].ToString()); string delayStartup = requestParameters ["RegionDelayStartup"].ToString(); newRegion.Startup = delayStartup.StartsWith("n", System.StringComparison.Ordinal) ? StartupType.Normal : StartupType.Medium; } if (regionPreset.StartsWith("w", System.StringComparison.Ordinal)) { // 'standard' setup newRegion.RegionType = newRegion.RegionType + "Whitecore"; //info.RegionPort; // use auto assigned port newRegion.RegionTerrain = "Flatland"; newRegion.Startup = StartupType.Normal; newRegion.SeeIntoThisSimFromNeighbor = true; newRegion.InfiniteRegion = true; newRegion.ObjectCapacity = 50000; newRegion.RegionPort = RegionPort; } if (regionPreset.StartsWith("o", System.StringComparison.Ordinal)) { // 'Openspace' setup newRegion.RegionType = newRegion.RegionType + "Openspace"; //newRegion.RegionPort; // use auto assigned port if (regionTerrain.StartsWith("a", System.StringComparison.Ordinal)) { newRegion.RegionTerrain = "Aquatic"; } else { newRegion.RegionTerrain = "Grassland"; } newRegion.Startup = StartupType.Medium; newRegion.SeeIntoThisSimFromNeighbor = true; newRegion.InfiniteRegion = true; newRegion.ObjectCapacity = 750; newRegion.RegionSettings.AgentLimit = 10; newRegion.RegionSettings.AllowLandJoinDivide = false; newRegion.RegionSettings.AllowLandResell = false; } if (regionPreset.StartsWith("h", System.StringComparison.Ordinal)) { // 'Homestead' setup newRegion.RegionType = newRegion.RegionType + "Homestead"; //info.RegionPort; // use auto assigned port newRegion.RegionTerrain = "Homestead"; newRegion.Startup = StartupType.Medium; newRegion.SeeIntoThisSimFromNeighbor = true; newRegion.InfiniteRegion = true; newRegion.ObjectCapacity = 3750; newRegion.RegionSettings.AgentLimit = 20; newRegion.RegionSettings.AllowLandJoinDivide = false; newRegion.RegionSettings.AllowLandResell = false; } if (regionPreset.StartsWith("f", System.StringComparison.Ordinal)) { // 'Full Region' setup newRegion.RegionType = newRegion.RegionType + "Full Region"; //newRegion.RegionPort; // use auto assigned port newRegion.RegionTerrain = regionTerrain; newRegion.Startup = StartupType.Normal; newRegion.SeeIntoThisSimFromNeighbor = true; newRegion.InfiniteRegion = true; newRegion.ObjectCapacity = 15000; newRegion.RegionSettings.AgentLimit = 100; if (newRegion.RegionType.StartsWith("M", System.StringComparison.Ordinal)) // defaults are 'true' { newRegion.RegionSettings.AllowLandJoinDivide = false; newRegion.RegionSettings.AllowLandResell = false; } } if (regionLoadTerrain.Length > 0) { // we are loading terrain from a file... handled later newRegion.RegionTerrain = "Custom"; } // TODO: !!! Assumes everything is local for now !!! if (requestParameters.ContainsKey("NewRegion")) { ISceneManager scenemanager = webInterface.Registry.RequestModuleInterface <ISceneManager> (); if (scenemanager.CreateRegion(newRegion)) { response = "<h3>Successfully created region</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"/?page=region_manager\";}, 2000);" + "</script>"; return(null); } response = "<h3>Error creating this region.</h3>"; return(null); /* not required?? * IGridRegisterModule gridRegister = webInterface.Registry.RequestModuleInterface<IGridRegisterModule> (); * if (gridRegister != null) { * if (gridRegister.RegisterRegionWithGrid (null, true, false, null)) { * * response = "<h3>Successfully created region</h3>" + * "<script language=\"javascript\">" + * "setTimeout(function() {window.location.href = \"/?page=region_manager\";}, 2000);" + * "</script>"; * return null; * } * } * * response = "<h3> Error registering region with grid</h3>"; * } else * response = "<h3>Error creating this region.</h3>"; * return null; */ } // TODO: This will not work yet :) // update region details var infoConnector = Framework.Utilities.DataManager.RequestPlugin <IRegionInfoConnector> (); if (infoConnector != null) { infoConnector.UpdateRegionInfo(newRegion); response = "<h3>Region details updated.</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"/?page=region_manager\";}, 2000);" + "</script>"; } else { response = "<h3>Unable to update Region details!</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"/?page=region_manager\";}, 2000);" + "</script>"; } return(null); } #endregion #region EditRegion // we have or need data if (httpRequest.Query.ContainsKey("regionid")) { var region = gridService.GetRegionByUUID(null, UUID.Parse(httpRequest.Query ["regionid"].ToString())); vars.Add("RegionID", region.RegionID.ToString()); vars.Add("RegionName", region.RegionName); UserAccount estateOwnerAcct = new UserAccount(); var estateOwner = UUID.Zero; var estateId = -1; IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> (); if (estateConnector != null) { EstateSettings estate = estateConnector.GetRegionEstateSettings(region.RegionID); if (estate != null) { estateId = (int)estate.EstateID; estateOwner = estate.EstateOwner; } var accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService> (); if (accountService != null) { estateOwnerAcct = accountService.GetUserAccount(null, estate.EstateOwner); } } vars.Add("EstateList", WebHelpers.EstateSelections(webInterface.Registry, estateOwner.ToString(), estateId)); vars.Add("OwnerUUID", region.EstateOwner); vars.Add("OwnerName", estateOwnerAcct.Valid ? estateOwnerAcct.Name : "No account found"); vars.Add("RegionLocX", region.RegionLocX / Constants.RegionSize); vars.Add("RegionLocY", region.RegionLocY / Constants.RegionSize); vars.Add("RegionSizeX", region.RegionSizeX); vars.Add("RegionSizeY", region.RegionSizeY); vars.Add("RegionPort", region.InternalPort.ToString()); vars.Add("RegionType", WebHelpers.RegionTypeArgs(translator, region.RegionType)); vars.Add("RegionPresetType", WebHelpers.RegionPresetArgs(translator, region.RegionType)); vars.Add("RegionTerrain", WebHelpers.RegionTerrainArgs(translator, region.RegionTerrain)); // TODO: This will not work yet :) bool switches = false; var infoConnector = Framework.Utilities.DataManager.RequestPlugin <IRegionInfoConnector> (); if (infoConnector != null) { var regionInfo = infoConnector.GetRegionInfo(region.RegionID); if (regionInfo != null) { vars.Add("RegionCapacity", regionInfo.ObjectCapacity.ToString()); vars.Add("RegionVisibility", WebHelpers.YesNoSelection(translator, regionInfo.SeeIntoThisSimFromNeighbor)); vars.Add("RegionInfinite", WebHelpers.YesNoSelection(translator, regionInfo.InfiniteRegion)); vars.Add("RegionDelayStartup", WebHelpers.RegionStartupSelection(translator, regionInfo.Startup)); } } if (!switches) { vars.Add("RegionCapacity", "Unknown"); vars.Add("RegionVisibility", WebHelpers.YesNoSelection(translator, true)); vars.Add("RegionInfinite", WebHelpers.YesNoSelection(translator, true)); vars.Add("RegionDelayStartup", WebHelpers.RegionStartupSelection(translator, StartupType.Normal)); // normal startup } //vars.Add ("RegionOnline", // (region.Flags & (int)RegionFlags.RegionOnline) == (int)RegionFlags.RegionOnline // ? translator.GetTranslatedString ("Online") // : translator.GetTranslatedString ("Offline")); IWebHttpTextureService webTextureService = webInterface.Registry. RequestModuleInterface <IWebHttpTextureService> (); if (webTextureService != null && region.TerrainMapImage != UUID.Zero) { vars.Add("RegionImageURL", webTextureService.GetTextureURL(region.TerrainMapImage)); } else { vars.Add("RegionImageURL", "images/icons/no_picture.jpg"); } vars.Add("Submit", translator.GetTranslatedString("SaveUpdates")); } #endregion vars.Add("RegionPresets", WebHelpers.RegionSelections(webInterface.Registry)); // Labels vars.Add("UserName", user.Name); vars.Add("RegionManagerText", translator.GetTranslatedString("MenuRegionManager")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText")); vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText")); vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText")); vars.Add("RegionPresetText", translator.GetTranslatedString("RegionPresetText")); vars.Add("RegionTerrainText", translator.GetTranslatedString("RegionTerrainText")); vars.Add("EstateText", translator.GetTranslatedString("EstateText")); vars.Add("RegionPortText", translator.GetTranslatedString("RegionPortText")); vars.Add("RegionDelayStartupText", translator.GetTranslatedString("RegionDelayStartupText")); vars.Add("RegionVisibilityText", translator.GetTranslatedString("RegionVisibilityText")); vars.Add("RegionInfiniteText", translator.GetTranslatedString("RegionInfiniteText")); vars.Add("RegionCapacityText", translator.GetTranslatedString("RegionCapacityText")); vars.Add("Cancel", translator.GetTranslatedString("Cancel")); vars.Add("InfoMessage", ""); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); UserAccount account = null; if (httpRequest.Query.ContainsKey("regionid")) { var regionService = webInterface.Registry.RequestModuleInterface <IGridService> (); var region = regionService.GetRegionByUUID(null, UUID.Parse(httpRequest.Query ["regionid"].ToString())); UUID userid = region.EstateOwner; account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, userid); //IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin<IEstateConnector> (); //EstateSettings estate = estateConnector.GetEstateSettings (region.RegionID); } if (account == null) { return(vars); } // There is no harm in showing the system users here, actually it is required //if ( Utilities.IsSytemUser(account.PrincipalID)) // return vars; vars.Add("UserName", account.Name); // TODO: User Profile inworld shows this as the standard mm/dd/yyyy // Do we want this to be localised into the users Localisation or keep it as standard ? // // greythane, Oct 2014 - Not sure why we need to keep the US format here? A lot of us don't live there :) // vars.Add("UserBorn", Culture.LocaleDate(Util.ToDateTime(account.Created))); vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString()); IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(). GetUserProfile(account.PrincipalID); if (profile != null) { vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup); if (profile != null) { if (profile.Partner != UUID.Zero) { account = webInterface.Registry.RequestModuleInterface <IUserAccountService> (). GetUserAccount(null, profile.Partner); vars.Add("UserPartner", account.Name); } else { vars.Add("UserPartner", "No partner"); } vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText); string url = "../images/icons/no_avatar.jpg"; IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService> (); if (webhttpService != null && profile.Image != UUID.Zero) { url = webhttpService.GetTextureURL(profile.Image); } vars.Add("UserPictureURL", url); } } else { // no profile yet for this user vars.Add("UserType", "Unknown"); vars.Add("UserPartner", "Unknown"); vars.Add("UserPictureURL", "../images/icons/no_avatar.jpg"); } UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); if (ourAccount != null) { IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService>(); var friends = friendsService.GetFriends(account.PrincipalID); UUID friendID = UUID.Zero; if (friends.Any(f => UUID.TryParse(f.Friend, out friendID) && friendID == ourAccount.PrincipalID)) { IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService>(); IGridService gridService = webInterface.Registry.RequestModuleInterface <IGridService>(); UserInfo ourInfo = agentInfoService.GetUserInfo(account.PrincipalID.ToString()); if (ourInfo != null && ourInfo.IsOnline) { vars.Add("OnlineLocation", gridService.GetRegionByUUID(null, ourInfo.CurrentRegionID).RegionName); } vars.Add("UserIsOnline", ourInfo != null && ourInfo.IsOnline); vars.Add("IsOnline", ourInfo != null && ourInfo.IsOnline ? translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline")); } else { vars.Add("OnlineLocation", ""); vars.Add("UserIsOnline", false); vars.Add("IsOnline", translator.GetTranslatedString("Offline")); } } else { vars.Add("OnlineLocation", ""); vars.Add("UserIsOnline", false); vars.Add("IsOnline", translator.GetTranslatedString("Offline")); } vars.Add("UserProfileFor", translator.GetTranslatedString("UserProfileFor")); vars.Add("ResidentSince", translator.GetTranslatedString("ResidentSince")); vars.Add("AccountType", translator.GetTranslatedString("AccountType")); vars.Add("PartnersName", translator.GetTranslatedString("PartnersName")); vars.Add("AboutMe", translator.GetTranslatedString("AboutMe")); vars.Add("IsOnlineText", translator.GetTranslatedString("IsOnlineText")); vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; IConfig gridInfo = webInterface.Registry.RequestModuleInterface <ISimulationBase> ().ConfigSource.Configs ["GridInfoService"]; var inWorldCurrency = gridInfo.GetString("CurrencySymbol", string.Empty) + " "; var realCurrency = gridInfo.GetString("RealCurrencySymbol", string.Empty) + " "; var vars = new Dictionary <string, object> (); var purchasesList = new List <Dictionary <string, object> > (); var today = DateTime.Now; var thirtyDays = today.AddDays(-7); string dateStart = thirtyDays.ToShortDateString(); string dateEnd = today.ToShortDateString(); IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule> (); string noDetails = translator.GetTranslatedString("NoPurchasesText"); // Check if we're looking at the standard page or the submitted one if (requestParameters.ContainsKey("Submit")) { if (requestParameters.ContainsKey("date_start")) { dateStart = requestParameters ["date_start"].ToString(); } if (requestParameters.ContainsKey("date_end")) { dateEnd = requestParameters ["date_end"].ToString(); } } UserAccount user = Authenticator.GetAuthentication(httpRequest); // Purchases Logs var timeNow = DateTime.Now.ToString("HH:mm:ss"); var dateFrom = DateTime.Parse(dateStart + " " + timeNow); var dateTo = DateTime.Parse(dateEnd + " " + timeNow); TimeSpan period = dateTo.Subtract(dateFrom); var purchases = new List <AgentPurchase> (); if (user != null && moneyModule != null) { purchases = moneyModule.GetPurchaseHistory(user.PrincipalID, dateFrom, dateTo, null, null); } // data if (purchases.Count > 0) { noDetails = ""; foreach (var purchase in purchases) { purchasesList.Add(new Dictionary <string, object> { { "ID", purchase.ID }, { "AgentID", purchase.AgentID }, { "AgentName", user.Name }, { "LoggedIP", purchase.IP }, { "Description", "Purchase" }, { "Amount", purchase.Amount }, { "RealAmount", ((float)purchase.RealAmount / 100).ToString("0.00") }, { "PurchaseDate", Culture.LocaleDate(purchase.PurchaseDate.ToLocalTime(), "MMM dd, hh:mm:ss tt") }, { "UpdateDate", Culture.LocaleDate(purchase.UpdateDate.ToLocalTime(), "MMM dd, hh:mm:ss tt") } }); } } if (purchasesList.Count == 0) { purchasesList.Add(new Dictionary <string, object> { { "ID", "" }, { "AgentID", "" }, { "AgentName", "" }, { "LoggedIP", "" }, { "Description", translator.GetTranslatedString("NoPurchasesText") }, { "Amount", "" }, { "RealAmount", "" }, { "PurchaseDate", "" }, { "UpdateDate", "" } }); } // always required data vars.Add("DateStart", dateStart); vars.Add("DateEnd", dateEnd); vars.Add("Period", period.TotalDays + " " + translator.GetTranslatedString("DaysText")); vars.Add("PurchasesList", purchasesList); vars.Add("NoPurchasesText", noDetails); // labels vars.Add("PurchasesText", translator.GetTranslatedString("PurchasesText")); vars.Add("DateInfoText", translator.GetTranslatedString("DateInfoText")); vars.Add("DateStartText", translator.GetTranslatedString("DateStartText")); vars.Add("DateEndText", translator.GetTranslatedString("DateEndText")); vars.Add("SearchUserText", translator.GetTranslatedString("AvatarNameText")); vars.Add("PurchaseAgentText", translator.GetTranslatedString("TransactionToAgentText")); vars.Add("PurchaseDateText", translator.GetTranslatedString("TransactionDateText")); vars.Add("PurchaseUpdateDateText", translator.GetTranslatedString("TransactionDateText")); //vars.Add("PurchaseTimeText", translator.GetTranslatedString("Time")); vars.Add("PurchaseDetailText", translator.GetTranslatedString("TransactionDetailText")); vars.Add("LoggedIPText", translator.GetTranslatedString("LoggedIPText")); vars.Add("PurchaseAmountText", inWorldCurrency + translator.GetTranslatedString("TransactionAmountText")); vars.Add("PurchaseRealAmountText", realCurrency + translator.GetTranslatedString("PurchaseCostText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; IConfig gridInfo = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs ["GridInfoService"]; var InWorldCurrency = gridInfo.GetString("CurrencySymbol", String.Empty) + " "; var RealCurrency = gridInfo.GetString("RealCurrencySymbol", String.Empty) + " "; var vars = new Dictionary <string, object>(); var purchasesList = new List <Dictionary <string, object> >(); uint amountPerQuery = 25; var today = DateTime.Now; var thirtyDays = today.AddDays(-7); string DateStart = thirtyDays.ToShortDateString(); string DateEnd = today.ToShortDateString(); UUID UserID = UUID.Zero; int start = 0; IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule>(); string noDetails = translator.GetTranslatedString("NoPurchasesText"); // Check if we're looking at the standard page or the submitted one if (requestParameters.ContainsKey("Submit")) { if (requestParameters.ContainsKey("date_start")) { DateStart = requestParameters ["date_start"].ToString(); } if (requestParameters.ContainsKey("date_end")) { DateEnd = requestParameters ["date_end"].ToString(); } // pagination start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query ["Start"].ToString()) : 0; int count = (int)moneyModule.NumberOfPurchases(UserID); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); } else { vars.Add("CurrentPage", 0); vars.Add("NextOne", 0); vars.Add("BackOne", 0); } UserAccount user = Authenticator.GetAuthentication(httpRequest); // Purchases Logs var timeNow = DateTime.Now.ToString("HH:mm:ss"); var dateFrom = DateTime.Parse(DateStart + " " + timeNow); var dateTo = DateTime.Parse(DateEnd + " " + timeNow); TimeSpan period = dateTo.Subtract(dateFrom); List <AgentPurchase> purchases; purchases = moneyModule.GetPurchaseHistory(user.PrincipalID, dateFrom, dateTo, (uint)start, amountPerQuery); // data if (purchases.Count > 0) { noDetails = ""; foreach (var purchase in purchases) { purchasesList.Add(new Dictionary <string, object> { { "ID", purchase.ID }, { "AgentID", purchase.AgentID }, { "AgentName", user.Name }, { "LoggedIP", purchase.IP }, { "Description", "Purchase" }, { "Amount", purchase.Amount }, { "RealAmount", ((float)purchase.RealAmount / 100).ToString("0.00") }, { "PurchaseDate", Culture.LocaleDate(purchase.PurchaseDate.ToLocalTime(), "MMM dd, hh:mm:ss tt") }, { "UpdateDate", Culture.LocaleDate(purchase.UpdateDate.ToLocalTime(), "MMM dd, hh:mm:ss tt") } }); } } if (purchasesList.Count == 0) { purchasesList.Add(new Dictionary <string, object> { { "ID", "" }, { "AgentID", "" }, { "AgentName", "" }, { "LoggedIP", "" }, { "Description", translator.GetTranslatedString("NoPurchasesText") }, { "Amount", "" }, { "RealAmount", "" }, { "PurchaseDate", "" }, { "UpdateDate", "" }, }); } // always required data vars.Add("DateStart", DateStart); vars.Add("DateEnd", DateEnd); vars.Add("Period", period.TotalDays + " " + translator.GetTranslatedString("DaysText")); vars.Add("PurchasesList", purchasesList); vars.Add("NoPurchasesText", noDetails); // labels vars.Add("PurchasesText", translator.GetTranslatedString("PurchasesText")); vars.Add("DateInfoText", translator.GetTranslatedString("DateInfoText")); vars.Add("DateStartText", translator.GetTranslatedString("DateStartText")); vars.Add("DateEndText", translator.GetTranslatedString("DateEndText")); vars.Add("SearchUserText", translator.GetTranslatedString("AvatarNameText")); vars.Add("PurchaseAgentText", translator.GetTranslatedString("TransactionToAgentText")); vars.Add("PurchaseDateText", translator.GetTranslatedString("TransactionDateText")); vars.Add("PurchaseUpdateDateText", translator.GetTranslatedString("TransactionDateText")); //vars.Add("PurchaseTimeText", translator.GetTranslatedString("Time")); vars.Add("PurchaseDetailText", translator.GetTranslatedString("TransactionDetailText")); vars.Add("LoggedIPText", translator.GetTranslatedString("LoggedIPText")); vars.Add("PurchaseAmountText", InWorldCurrency + translator.GetTranslatedString("TransactionAmountText")); vars.Add("PurchaseRealAmountText", RealCurrency + translator.GetTranslatedString("PurchaseCostText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); var transactionsList = new List <Dictionary <string, object> >(); uint amountPerQuery = 25; var today = DateTime.Now; var thirtyDays = today.AddDays(-7); string DateStart = thirtyDays.ToShortDateString(); string DateEnd = today.ToShortDateString(); UUID UserID = UUID.Zero; int start = 0; IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule>(); string noDetails = translator.GetTranslatedString("NoTransactionsText"); // Check if we're looking at the standard page or the submitted one if (requestParameters.ContainsKey("Submit")) { if (requestParameters.ContainsKey("date_start")) { DateStart = requestParameters ["date_start"].ToString(); } if (requestParameters.ContainsKey("date_end")) { DateEnd = requestParameters ["date_end"].ToString(); } // paginations start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query ["Start"].ToString()) : 0; int count = (int)moneyModule.NumberOfTransactions(UserID, UUID.Zero); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); } else { vars.Add("CurrentPage", 0); vars.Add("NextOne", 0); vars.Add("BackOne", 0); } UserAccount user = Authenticator.GetAuthentication(httpRequest); // Transaction Logs var timeNow = DateTime.Now.ToString("HH:mm:ss"); var dateFrom = DateTime.Parse(DateStart + " " + timeNow); var dateTo = DateTime.Parse(DateEnd + " " + timeNow); TimeSpan period = dateTo.Subtract(dateFrom); List <AgentTransfer> transactions; transactions = moneyModule.GetTransactionHistory(user.PrincipalID, UUID.Zero, dateFrom, dateTo, (uint)start, amountPerQuery); // data if (transactions.Count > 0) { noDetails = ""; foreach (var transaction in transactions) { transactionsList.Add(new Dictionary <string, object> { { "Date", Culture.LocaleDate(transaction.TransferDate.ToLocalTime(), "MMM dd, hh:mm:ss tt") }, { "ToAgent", transaction.ToAgentName }, { "FromAgent", transaction.FromAgentName }, { "Description", transaction.Description }, { "Amount", transaction.Amount }, { "ToBalance", transaction.ToBalance } }); } } if (transactionsList.Count == 0) { transactionsList.Add(new Dictionary <string, object> { { "Date", "" }, //Culture.LocaleDate(today,"MMM dd, hh:mm:ss")}, { "ToAgent", "" }, { "FromAgent", "" }, { "Description", translator.GetTranslatedString("NoTransactionsText") }, { "Amount", "" }, { "ToBalance", "" } }); } // always required data vars.Add("DateStart", DateStart); vars.Add("DateEnd", DateEnd); vars.Add("Period", period.TotalDays + " " + translator.GetTranslatedString("DaysText")); vars.Add("TransactionsList", transactionsList); vars.Add("NoTransactionsText", noDetails); // labels vars.Add("TransactionsText", translator.GetTranslatedString("TransactionsText")); vars.Add("DateInfoText", translator.GetTranslatedString("DateInfoText")); vars.Add("DateStartText", translator.GetTranslatedString("DateStartText")); vars.Add("DateEndText", translator.GetTranslatedString("DateEndText")); vars.Add("TransactionDateText", translator.GetTranslatedString("TransactionDateText")); vars.Add("TransactionToAgentText", translator.GetTranslatedString("TransactionToAgentText")); vars.Add("TransactionFromAgentText", translator.GetTranslatedString("TransactionFromAgentText")); //vars.Add("TransactionTimeText", translator.GetTranslatedString("Time")); vars.Add("TransactionDetailText", translator.GetTranslatedString("TransactionDetailText")); vars.Add("TransactionAmountText", translator.GetTranslatedString("TransactionAmountText")); vars.Add("TransactionBalanceText", translator.GetTranslatedString("TransactionBalanceText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var directoryService = Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector> (); var eventListVars = new List <Dictionary <string, object> > (); IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule> (); var currencySymbol = "$"; if (moneyModule != null) { currencySymbol = moneyModule.InWorldCurrencySymbol; } UserAccount user = Authenticator.GetAuthentication(httpRequest); var eventLevel = 7; // all events; var category = (int)DirectoryManager.EventCategories.All; var timeframe = 24; var pg_checked = "checked"; var ma_checked = "checked"; var ao_checked = "checked"; if (requestParameters.ContainsKey("Submit")) { int level = 0; pg_checked = ""; ma_checked = ""; ao_checked = ""; if (requestParameters.ContainsKey("display_pg")) { //level += 1; level += Util.ConvertEventMaturityToDBMaturity(DirectoryManager.EventFlags.PG); pg_checked = "checked"; } if (requestParameters.ContainsKey("display_ma")) { //level += 2; level += Util.ConvertEventMaturityToDBMaturity(DirectoryManager.EventFlags.Mature); ma_checked = "checked"; } if (requestParameters.ContainsKey("display_ao")) { //level += 4; level += Util.ConvertEventMaturityToDBMaturity(DirectoryManager.EventFlags.Adult); ao_checked = "checked"; } eventLevel = level; string cat = requestParameters ["category"].ToString(); category = int.Parse(cat); string timsel = requestParameters ["timeframe"].ToString(); timeframe = int.Parse(timsel); } // maturity selections vars.Add("PG_checked", pg_checked); vars.Add("MA_checked", ma_checked); vars.Add("AO_checked", ao_checked); // build category selection vars.Add("CategoryType", WebHelpers.EventCategorySelections(category, translator)); // build timeframes vars.Add("TimeFrame", WebHelpers.EventTimeframesSelections(timeframe, translator)); // get some events if (directoryService != null) { var events = new List <EventData> (); events = directoryService.GetUserEvents(user.PrincipalID.ToString(), timeframe, category, eventLevel); if (events.Count == 0) { vars.Add("EditText", ""); eventListVars.Add(new Dictionary <string, object> { { "EventID", "" }, { "CreatorUUID", "" }, { "EventDate", "" }, { "EventDateUTC", "" }, { "CoverCharge", "" }, { "Duration", "" }, { "Name", "" }, { "Description", translator.GetTranslatedString("NoDetailsText") }, { "SimName", "" }, { "GPosX", "" }, { "GPosY", "" }, { "GPosZ", "" }, { "LocalPosX", "" }, { "LocalPosY", "" }, { "LocalPosZ", "" }, { "Maturity", "" }, { "EventFlags", "" }, // same as maturity?? { "Category", "" } }); } else { vars.Add("EditText", translator.GetTranslatedString("EditText")); foreach (var evnt in events) { var evntDateTime = Util.ToDateTime(evnt.dateUTC).ToLocalTime(); eventListVars.Add(new Dictionary <string, object> { { "EventID", evnt.eventID }, { "CreatorUUID", evnt.creator }, { "EventDate", evnt.date }, { "EventDateUTC", Culture.LocaleShortDateTime(evntDateTime) }, { "CoverCharge", currencySymbol + " " + evnt.amount }, { "Duration", WebHelpers.EventDuration((int)evnt.duration, translator) }, { "Name", evnt.name }, { "Description", evnt.description }, { "SimName", evnt.simName }, { "GPosX", evnt.globalPos.X.ToString() }, { "GPosY", evnt.globalPos.Y.ToString() }, { "GPosZ", evnt.globalPos.Z.ToString() }, { "LocalPosX", evnt.regionPos.X.ToString() }, { "LocalPosY", evnt.regionPos.Y.ToString() }, { "LocalPosZ", evnt.regionPos.Z.ToString() }, { "Maturity", WebHelpers.EventMaturity(evnt.maturity) }, { "EventFlags", evnt.eventFlags }, { "Category", WebHelpers.EventCategory(int.Parse(evnt.category), translator) } }); } } vars.Add("EventList", eventListVars); } vars.Add("Events", translator.GetTranslatedString("Events")); // labels vars.Add("UserName", user.Name); vars.Add("EventsText", translator.GetTranslatedString("EventsText")); vars.Add("AddEventText", translator.GetTranslatedString("AddEventText")); vars.Add("EventDateText", translator.GetTranslatedString("EventDateText")); vars.Add("CategoryText", translator.GetTranslatedString("CategoryText")); vars.Add("LocationText", translator.GetTranslatedString("LocationText")); vars.Add("DescriptionText", translator.GetTranslatedString("DescriptionText")); vars.Add("MaturityText", translator.GetTranslatedString("MaturityText")); vars.Add("GeneralText", translator.GetTranslatedString("GeneralText")); vars.Add("MatureText", translator.GetTranslatedString("MatureText")); vars.Add("AdultText", translator.GetTranslatedString("AdultText")); vars.Add("CoverChargeText", translator.GetTranslatedString("CoverChargeText")); vars.Add("DurationText", translator.GetTranslatedString("DurationText")); vars.Add("SearchText", translator.GetTranslatedString("SearchText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var regionListVars = new List <Dictionary <string, object> > (); var user = Authenticator.GetAuthentication(httpRequest); var regionData = Framework.Utilities.DataManager.RequestPlugin <IRegionData> (); var regions = regionData.GetOwnerRegions(user.PrincipalID); if (regions.Count > 0) { foreach (var region in regions) { string info; info = (region.RegionArea < 1000000) ? region.RegionArea + " m2" : (region.RegionArea / 1000000) + " km2"; info = info + ", " + region.RegionTerrain; regionListVars.Add(new Dictionary <string, object> { { "RegionLocX", region.RegionLocX / Constants.RegionSize }, { "RegionLocY", region.RegionLocY / Constants.RegionSize }, { "RegionName", region.RegionName }, { "RegionInfo", info }, { "RegionStatus", WebHelpers.YesNo(translator, region.IsOnline) }, { "RegionID", region.RegionID }, { "RegionURI", region.RegionURI } }); } } else { regionListVars.Add(new Dictionary <string, object> { { "RegionLocX", "" }, { "RegionLocY", "" }, { "RegionName", "" }, { "RegionInfo", translator.GetTranslatedString("NoDetailsText") }, { "RegionStatus", "" }, { "RegionID", "" }, { "RegionURI", "" } }); } vars.Add("RegionList", regionListVars); // labels vars.Add("UserName", user.Name); vars.Add("RegionsText", translator.GetTranslatedString("MenuRegionsTitle")); vars.Add("AddRegionText", translator.GetTranslatedString("AddRegionText")); vars.Add("EditRegionText", translator.GetTranslatedString("EditText")); vars.Add("RegionListText", translator.GetTranslatedString("RegionListText")); vars.Add("RegionText", translator.GetTranslatedString("Region")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("RegionLocXText", translator.GetTranslatedString("RegionLocXText")); vars.Add("RegionLocYText", translator.GetTranslatedString("RegionLocYText")); vars.Add("RegionOnlineText", translator.GetTranslatedString("Online")); //vars.Add ("MainServerURL", webInterface.GridURL); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); var usersList = new List <Dictionary <string, object> >(); uint amountPerQuery = 10; string noDetails = translator.GetTranslatedString("NoDetailsText"); if (requestParameters.ContainsKey("Submit")) { IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); var IsAdmin = Authenticator.CheckAdminAuthentication(httpRequest); string userName = requestParameters["username"].ToString(); // allow '*' wildcards var username = userName.Replace('*', '%'); int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query ["Start"].ToString()) : 0; uint count = accountService.NumberOfUserAccounts(null, username); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); // check for admin wildcard search if ((username.Trim().Length > 0) || IsAdmin) { var users = accountService.GetUserAccounts(null, username, (uint)start, amountPerQuery); var searchUsersList = new List <UUID>(); if (IsAdmin) // display all users { foreach (var user in users) { searchUsersList.Add(user.PrincipalID); } } else // only show the users friends { UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); if (ourAccount != null) { IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService> (); var friends = friendsService.GetFriends(ourAccount.PrincipalID); foreach (var friend in friends) { UUID friendID = UUID.Zero; UUID.TryParse(friend.Friend, out friendID); if (friendID != UUID.Zero) { searchUsersList.Add(friendID); } } } } if (searchUsersList.Count > 0) { noDetails = ""; foreach (var user in users) { if (!searchUsersList.Contains(user.PrincipalID)) { continue; } if (Utilities.IsSystemUser(user.PrincipalID)) { continue; } usersList.Add(new Dictionary <string, object> { { "UserName", user.Name }, { "UserID", user.PrincipalID }, { "CanEdit", IsAdmin } }); } } if (usersList.Count == 0) { usersList.Add(new Dictionary <string, object> { { "UserName", translator.GetTranslatedString("NoDetailsText") }, { "UserID", "" }, { "CanEdit", false } }); } } } else { vars.Add("CurrentPage", 0); vars.Add("NextOne", 0); vars.Add("BackOne", 0); } vars.Add("NoDetailsText", noDetails); vars.Add("UsersList", usersList); vars.Add("UserSearchText", translator.GetTranslatedString("UserSearchText")); vars.Add("SearchForUserText", translator.GetTranslatedString("SearchForUserText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("Search", translator.GetTranslatedString("Search")); vars.Add("SearchResultForUserText", translator.GetTranslatedString("SearchResultForUserText")); vars.Add("EditText", translator.GetTranslatedString("EditText")); vars.Add("EditUserAccountText", translator.GetTranslatedString("EditUserAccountText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> (); var user = Authenticator.GetAuthentication(httpRequest); string estate; if (httpRequest.Query.ContainsKey("EstateID")) { estate = httpRequest.Query ["EstateID"].ToString(); } else { if (requestParameters.ContainsKey("EstateID")) { estate = requestParameters ["EstateID"].ToString(); } else { response = "<h3>Estate details not supplied, redirecting to main page</h3>" + "<script>" + "setTimeout(function() {window.location.href = \"/?page=user_estatemanager\";}, 5000);" + "</script>"; return(null); } } var estateid = -1; int.TryParse(estate, out estateid); if (requestParameters.ContainsKey("Delete")) { response = "<h3>This estate would have been deleted... but not yet</h3>"; return(null); } var estateSettings = estateConnector.GetEstateIDSettings(estateid); if (estateSettings != null) { if (requestParameters.ContainsKey("Submit")) { var estateOwner = requestParameters ["EstateOwner"].ToString(); estateSettings.EstateName = requestParameters ["EstateName"].ToString(); estateSettings.EstateOwner = UUID.Parse(estateOwner); estateSettings.PricePerMeter = int.Parse(requestParameters ["PricePerMeter"].ToString()); estateSettings.PublicAccess = requestParameters ["PublicAccess"].ToString() == "1"; estateSettings.TaxFree = requestParameters ["TaxFree"].ToString() == "1"; estateSettings.AllowVoice = requestParameters ["AllowVoice"].ToString() == "1"; estateSettings.AllowDirectTeleport = requestParameters ["AllowDirectTeleport"].ToString() == "1"; estateConnector.SaveEstateSettings(estateSettings); response = "Estate details have been updated." + "<script>" + "setTimeout(function() {window.location.href = \"/?page=user_estatemanager\";}, 5000);" + "</script>"; return(null); } // get selected estate details if (estateSettings != null) { vars.Add("EstateID", estateSettings.EstateID.ToString()); vars.Add("EstateName", estateSettings.EstateName); vars.Add("PricePerMeter", estateSettings.PricePerMeter.ToString()); vars.Add("PublicAccess", WebHelpers.YesNoSelection(translator, estateSettings.PublicAccess)); vars.Add("AllowVoice", WebHelpers.YesNoSelection(translator, estateSettings.AllowVoice)); vars.Add("TaxFree", WebHelpers.YesNoSelection(translator, estateSettings.TaxFree)); vars.Add("AllowDirectTeleport", WebHelpers.YesNoSelection(translator, estateSettings.AllowDirectTeleport)); vars.Add("Submit", translator.GetTranslatedString("SaveUpdates")); } } // labels vars.Add("UserName", user.Name); vars.Add("EstateManagerText", translator.GetTranslatedString("MenuEstateManager")); vars.Add("EstateNameText", translator.GetTranslatedString("EstateText")); vars.Add("EstateOwnerText", translator.GetTranslatedString("MenuOwnerTitle")); vars.Add("PricePerMeterText", translator.GetTranslatedString("PricePerMeterText")); vars.Add("PublicAccessText", translator.GetTranslatedString("PublicAccessText")); vars.Add("AllowVoiceText", translator.GetTranslatedString("AllowVoiceText")); vars.Add("TaxFreeText", translator.GetTranslatedString("TaxFreeText")); vars.Add("AllowDirectTeleportText", translator.GetTranslatedString("AllowDirectTeleportText")); vars.Add("Cancel", translator.GetTranslatedString("Cancel")); vars.Add("InfoMessage", ""); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var usersList = new List <Dictionary <string, object> > (); var IsAdmin = Authenticator.CheckAdminAuthentication(httpRequest); string noDetails = translator.GetTranslatedString("NoDetailsText"); if (requestParameters.ContainsKey("Submit")) { IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService> (); string userName = requestParameters ["username"].ToString(); // allow '*' wildcards var username = userName.Replace('*', '%'); // check for admin wildcard search if ((username.Trim().Length > 0) || IsAdmin) { var users = accountService.GetUserAccounts(null, username, null, null); var searchUsersList = new List <UUID> (); if (IsAdmin) // display all users { foreach (var user in users) { searchUsersList.Add(user.PrincipalID); } } else // only show the users friends { UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); if (ourAccount.Valid) { IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService> (); var friends = friendsService.GetFriends(ourAccount.PrincipalID); foreach (var friend in friends) { UUID friendID = UUID.Zero; UUID.TryParse(friend.Friend, out friendID); if (friendID != UUID.Zero) { searchUsersList.Add(friendID); } } } } if (searchUsersList.Count > 0) { noDetails = ""; foreach (var user in users) { if (!searchUsersList.Contains(user.PrincipalID)) { continue; } if (Utilities.IsSystemUser(user.PrincipalID)) { continue; } usersList.Add(new Dictionary <string, object> { { "UserName", user.Name }, { "UserID", user.PrincipalID }, { "CanEdit", IsAdmin } }); } } if (usersList.Count == 0) { usersList.Add(new Dictionary <string, object> { { "UserName", translator.GetTranslatedString("NoDetailsText") }, { "UserID", "" }, { "CanEdit", false } }); } } } vars.Add("NoDetailsText", noDetails); vars.Add("UsersList", usersList); vars.Add("UserSearchText", translator.GetTranslatedString("UserSearchText") + (IsAdmin ? "" : " (Friends)")); vars.Add("SearchForUserText", translator.GetTranslatedString("SearchForUserText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("Search", translator.GetTranslatedString("Search")); vars.Add("SearchResultForUserText", translator.GetTranslatedString("SearchResultForUserText")); vars.Add("EditText", translator.GetTranslatedString("EditText")); vars.Add("EditUserAccountText", translator.GetTranslatedString("EditUserAccountText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); var usersList = new List <Dictionary <string, object> >(); var agentInfo = Framework.Utilities.DataManager.RequestPlugin <IAgentInfoConnector> (); uint amountPerQuery = 10; int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; //uint count = agentInfo.RecentlyOnline(15*60, true); uint count = agentInfo.OnlineUsers(0); int maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (int)(maxPages < 0 ? 0 : maxPages); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); var IsAdmin = Authenticator.CheckAdminAuthentication(httpRequest); //var activeUsers = agentInfo.RecentlyOnline(15*60, true, new Dictionary<string, bool>(), (uint) start, amountPerQuery); var activeUsers = agentInfo.CurrentlyOnline(0, new Dictionary <string, bool>(), (uint)start, amountPerQuery); if (activeUsers.Count > 0) { var activeUsersList = new List <UUID>(); if (IsAdmin) // display all online users { foreach (var user in activeUsers) { activeUsersList.Add((UUID)user.UserID); } } else // only show the users online friends { UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); if (ourAccount != null) { IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService> (); var friends = friendsService.GetFriends(ourAccount.PrincipalID); foreach (var friend in friends) { UUID friendID = UUID.Zero; UUID.TryParse(friend.Friend, out friendID); if (friendID != UUID.Zero) { // if ( (friendID != UUID.Zero) && (friendID == ourAccount.PrincipalID)) activeUsersList.Add(friendID); } } } } if (activeUsersList.Count > 0) { IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService> (); IGridService gridService = webInterface.Registry.RequestModuleInterface <IGridService> (); foreach (var user in activeUsers) { if (Utilities.IsSystemUser((UUID)user.UserID)) { continue; } if (!activeUsersList.Contains((UUID)user.UserID)) { continue; } var region = gridService.GetRegionByUUID(null, user.CurrentRegionID); if (region != null) { var account = accountService.GetUserAccount(region.AllScopeIDs, UUID.Parse(user.UserID)); if (account != null) { usersList.Add(new Dictionary <string, object> { { "UserName", account.Name }, { "UserRegion", region.RegionName }, { "UserLocation", user.CurrentPosition }, { "UserID", user.UserID }, { "UserRegionID", region.RegionID } }); } } } } } if (usersList.Count == 0) { usersList.Add( new Dictionary <string, object> { { "UserName", "" }, { "UserRegion", "" }, { "UserLocation", "No users are currently logged in" }, { "UserID", "" }, { "UserRegionID", "" } }); } if (requestParameters.ContainsKey("Order")) { if (requestParameters["Order"].ToString() == "RegionName") { usersList.Sort((a, b) => a["UserRegion"].ToString().CompareTo(b["UserRegion"].ToString())); } if (requestParameters["Order"].ToString() == "UserName") { usersList.Sort((a, b) => a["UserName"].ToString().CompareTo(b["UserName"].ToString())); } } vars.Add("UsersOnlineList", usersList); vars.Add("OnlineUsersText", translator.GetTranslatedString("OnlineUsersText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText")); vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText")); vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); var transactionsList = new List <Dictionary <string, object> > (); var today = DateTime.Now; var fromDays = today.AddDays(-7); string DateStart = fromDays.ToShortDateString(); string DateEnd = today.ToShortDateString(); IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule> (); string noDetails = translator.GetTranslatedString("NoTransactionsText"); // Check if we're looking at the standard page or the submitted one if (requestParameters.ContainsKey("Submit")) { if (requestParameters.ContainsKey("date_start")) { DateStart = requestParameters ["date_start"].ToString(); } if (requestParameters.ContainsKey("date_end")) { DateEnd = requestParameters ["date_end"].ToString(); } } UserAccount user = Authenticator.GetAuthentication(httpRequest); if (user == null) { response = "<h3>Error validating user details</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"/?page=user_transactions\";}, 1000);" + "</script>"; return(null); } // Transaction Logs var timeNow = DateTime.Now.ToString("HH:mm:ss"); var dateFrom = DateTime.Parse(DateStart + " " + timeNow); var dateTo = DateTime.Parse(DateEnd + " " + timeNow); TimeSpan period = dateTo.Subtract(dateFrom); var transactions = new List <AgentTransfer> (); if (user != null && moneyModule != null) { transactions = moneyModule.GetTransactionHistory(user.PrincipalID, UUID.Zero, dateFrom, dateTo, null, null); } // data if (transactions.Count > 0) { noDetails = ""; foreach (var transaction in transactions) { transactionsList.Add(new Dictionary <string, object> { { "Date", Culture.LocaleDate(transaction.TransferDate.ToLocalTime(), "MMM dd, hh:mm:ss tt") }, { "ToAgent", transaction.ToAgentName }, { "FromAgent", transaction.FromAgentName }, { "Description", transaction.Description }, { "Amount", transaction.Amount }, { "ToBalance", transaction.ToBalance } }); } } if (transactionsList.Count == 0) { transactionsList.Add(new Dictionary <string, object> { { "Date", "" }, //Culture.LocaleDate(today,"MMM dd, hh:mm:ss")}, { "ToAgent", "" }, { "FromAgent", "" }, { "Description", translator.GetTranslatedString("NoTransactionsText") }, { "Amount", "" }, { "ToBalance", "" } }); } // always required data vars.Add("DateStart", DateStart); vars.Add("DateEnd", DateEnd); vars.Add("Period", period.TotalDays + " " + translator.GetTranslatedString("DaysText")); vars.Add("TransactionsList", transactionsList); vars.Add("NoTransactionsText", noDetails); // labels vars.Add("UserName", user.Name); vars.Add("TransactionsText", translator.GetTranslatedString("TransactionsText")); vars.Add("DateInfoText", translator.GetTranslatedString("DateInfoText")); vars.Add("DateStartText", translator.GetTranslatedString("DateStartText")); vars.Add("DateEndText", translator.GetTranslatedString("DateEndText")); vars.Add("TransactionDateText", translator.GetTranslatedString("TransactionDateText")); vars.Add("TransactionToAgentText", translator.GetTranslatedString("TransactionToAgentText")); vars.Add("TransactionFromAgentText", translator.GetTranslatedString("TransactionFromAgentText")); //vars.Add("TransactionTimeText", translator.GetTranslatedString("Time")); vars.Add("TransactionDetailText", translator.GetTranslatedString("TransactionDetailText")); vars.Add("TransactionAmountText", translator.GetTranslatedString("TransactionAmountText")); vars.Add("TransactionBalanceText", translator.GetTranslatedString("TransactionBalanceText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object> (); IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService> (); //string username = filename.Split('/').LastOrDefault(); UserAccount account = Authenticator.GetAuthentication(httpRequest); if (account == null) { return(vars); } /* Allow access to the syatem user info - needed for Estate owner Profiles of regions * * if ( Utilities.IsSystemUser(account.PrincipalID)) * return vars; */ vars.Add("UserName", account.Name); // TODO: User Profile inworld shows this as the standard mm/dd/yyyy // Do we want this to be localised into the users Localisation or keep it as standard ? // // vars.Add("UserBorn", Culture.LocaleDate(Util.ToDateTime(account.Created))); vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString()); IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> (). GetUserProfile(account.PrincipalID); string picUrl = "../images/icons/no_avatar.jpg"; if (profile != null) { vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup); if (profile.Partner != UUID.Zero) { account = webInterface.Registry.RequestModuleInterface <IUserAccountService> (). GetUserAccount(null, profile.Partner); vars.Add("UserPartner", account.Name); } else { vars.Add("UserPartner", "No partner"); } vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText); if (webhttpService != null && profile.Image != UUID.Zero) { picUrl = webhttpService.GetTextureURL(profile.Image); } } else { // no profile yet vars.Add("UserType", "Guest"); vars.Add("UserPartner", "Not specified yet"); vars.Add("UserAboutMe", "Nothing here yet"); } vars.Add("UserPictureURL", picUrl); // TODO: This is only showing online status if you are logged in ?? UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); if (ourAccount != null) { IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService> (); var friends = friendsService.GetFriends(account.PrincipalID); UUID friendID = UUID.Zero; if (friends.Any(f => UUID.TryParse(f.Friend, out friendID) && friendID == ourAccount.PrincipalID)) { IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService> (); IGridService gridService = webInterface.Registry.RequestModuleInterface <IGridService> (); UserInfo ourInfo = agentInfoService.GetUserInfo(account.PrincipalID.ToString()); if (ourInfo != null && ourInfo.IsOnline) { vars.Add("OnlineLocation", gridService.GetRegionByUUID(null, ourInfo.CurrentRegionID).RegionName); } vars.Add("UserIsOnline", ourInfo != null && ourInfo.IsOnline); vars.Add("IsOnline", ourInfo != null && ourInfo.IsOnline ? translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline")); } else { vars.Add("OnlineLocation", ""); vars.Add("UserIsOnline", false); vars.Add("IsOnline", translator.GetTranslatedString("Offline")); } } else { vars.Add("OnlineLocation", ""); vars.Add("UserIsOnline", false); vars.Add("IsOnline", translator.GetTranslatedString("Offline")); } vars.Add("UsersGroupsText", translator.GetTranslatedString("UsersGroupsText")); IGroupsServiceConnector groupsConnector = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> (); List <Dictionary <string, object> > groups = new List <Dictionary <string, object> > (); if (groupsConnector != null) { var groupsIn = groupsConnector.GetAgentGroupMemberships(account.PrincipalID, account.PrincipalID); if (groupsIn != null) { foreach (var grp in groupsIn) { var grpData = groupsConnector.GetGroupProfile(account.PrincipalID, grp.GroupID); string url = "../images/icons/no_groups.jpg"; if (grpData != null) { if (webhttpService != null && grpData.InsigniaID != UUID.Zero) { url = webhttpService.GetTextureURL(grpData.InsigniaID); } groups.Add(new Dictionary <string, object> { { "GroupPictureURL", url }, { "GroupName", grp.GroupName } }); } } } if (groups.Count == 0) { groups.Add(new Dictionary <string, object> { { "GroupPictureURL", "../images/icons/no_groups.jpg" }, { "GroupName", "None yet" } }); } } vars.Add("GroupNameText", translator.GetTranslatedString("GroupNameText")); vars.Add("Groups", groups); vars.Add("GroupsJoined", groups.Count); // Menus vars.Add("MenuProfileTitle", translator.GetTranslatedString("MenuProfileTitle")); vars.Add("TooltipsMenuProfile", translator.GetTranslatedString("TooltipsMenuProfile")); vars.Add("MenuGroupTitle", translator.GetTranslatedString("MenuGroupTitle")); vars.Add("TooltipsMenuGroups", translator.GetTranslatedString("TooltipsMenuGroups")); vars.Add("MenuPicksTitle", translator.GetTranslatedString("MenuPicksTitle")); vars.Add("TooltipsMenuPicks", translator.GetTranslatedString("TooltipsMenuPicks")); vars.Add("MenuRegionsTitle", translator.GetTranslatedString("MenuRegionsTitle")); vars.Add("TooltipsMenuRegions", translator.GetTranslatedString("TooltipsMenuRegions")); // User data vars.Add("UserProfileFor", translator.GetTranslatedString("UserProfileFor")); vars.Add("ResidentSince", translator.GetTranslatedString("ResidentSince")); vars.Add("AccountType", translator.GetTranslatedString("AccountType")); vars.Add("PartnersName", translator.GetTranslatedString("PartnersName")); vars.Add("AboutMe", translator.GetTranslatedString("AboutMe")); vars.Add("IsOnlineText", translator.GetTranslatedString("IsOnlineText")); vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText")); // Style Switcher vars.Add("styles1", translator.GetTranslatedString("styles1")); vars.Add("styles2", translator.GetTranslatedString("styles2")); vars.Add("styles3", translator.GetTranslatedString("styles3")); vars.Add("styles4", translator.GetTranslatedString("styles4")); vars.Add("styles5", translator.GetTranslatedString("styles5")); vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText")); vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText")); vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText")); // Language Switcher vars.Add("en", translator.GetTranslatedString("en")); vars.Add("fr", translator.GetTranslatedString("fr")); vars.Add("de", translator.GetTranslatedString("de")); vars.Add("it", translator.GetTranslatedString("it")); vars.Add("es", translator.GetTranslatedString("es")); vars.Add("nl", translator.GetTranslatedString("nl")); var settings = webInterface.GetWebUISettings(); vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar); vars.Add("ShowStyleBar", !settings.HideStyleBar); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest); IMoneyModule moneyModule = webInterface.Registry.RequestModuleInterface <IMoneyModule> (); var currencySymbol = "$"; if (moneyModule != null) { currencySymbol = moneyModule.InWorldCurrencySymbol; } var directoryService = Framework.Utilities.DataManager.RequestPlugin <IDirectoryServiceConnector> (); response = null; var eventData = new EventData(); var vars = new Dictionary <string, object> (); string eventId; uint eid = 0; if (httpRequest.Query.ContainsKey("eventid")) { eventId = httpRequest.Query ["eventid"].ToString(); } else { if (requestParameters.ContainsKey("eventid")) { eventId = requestParameters ["eventid"].ToString(); } else { response = "<h3>Event details not supplied, redirecting to main page</h3>" + "<script>" + "setTimeout(function() {window.location.href = \"index.html\";}, 1000);" + "</script>"; return(null); } } uint.TryParse(eventId, out eid); if (requestParameters.ContainsKey("Delete")) { //string newsID = httpRequest.Query ["delete"].ToString (); if (directoryService.DeleteEvent(eid.ToString())) { response = "<h3>Event details have been deleted</h3>" + "<script>" + "setTimeout(function() {window.location.href = \"/?page=user_events\";}, 1000);" + "</script>"; } else { response = "<h3>Error encountered when deleting event. Please try again later</h3>"; } return(null); } if (requestParameters.ContainsKey("Submit")) { string eventName = requestParameters ["eventName"].ToString(); string eventDate = requestParameters ["eventDate"].ToString(); string eventTime = requestParameters ["eventTime"].ToString(); string eventDuration = requestParameters ["eventDuration"].ToString(); string eventLocation = requestParameters ["eventLocation"].ToString(); string eventCategory = requestParameters ["eventCategory"].ToString(); string eventCoverCharge = requestParameters ["eventCoverCharge"].ToString(); string eventDescription = requestParameters ["eventDescription"].ToString(); var regionData = Framework.Utilities.DataManager.RequestPlugin <IRegionData> (); var selParcel = eventLocation.Split(','); // Format: parcelLocationX, parcelLocationY, parcelLandingX, parcelLandingY, parcelLandingZ, parcelUUID // "1020,995,128,28,25,d436261b-7186-42a6-dcd3-b80c1bcafaa4" Framework.Services.GridRegion region = null; var parcel = directoryService.GetParcelInfo((UUID)selParcel [5]); if (parcel != null) { region = regionData.Get(parcel.RegionID, null); } if (region == null) { var error = "Parcel details not found!"; vars.Add("ErrorMessage", "<h3>" + error + "</h3>"); response = "<h3>" + error + "</h3>"; return(null); } // we have details... var eventDT = DateTime.Parse(eventDate + " " + eventTime); var localPos = new Vector3(int.Parse(selParcel [0]), int.Parse(selParcel [0]), 0); eventData.eventID = eid; // used to delete the existing event details eventData.creator = ourAccount.PrincipalID.ToString(); eventData.regionId = region.RegionID.ToString(); eventData.parcelId = selParcel [5]; eventData.date = eventDT.ToString("s"); eventData.cover = uint.Parse(eventCoverCharge); eventData.maturity = (int)Util.ConvertAccessLevelToMaturity(region.Access); eventData.eventFlags = region.Access; // region maturity flags eventData.duration = uint.Parse(eventDuration); eventData.regionPos = localPos; eventData.name = eventName; eventData.description = eventDescription; eventData.category = eventCategory; var success = directoryService.UpdateAddEvent(eventData); if (success) { response = "<h3>Event updated successfully</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"/?page=user_events\";}, 1000);" + "</script>"; } return(null); } eventData = directoryService.GetEventInfo(eid); if (eventData == null) { response = "<h3>Event details are not available</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"/?page=user_events\";}, 1000);" + "</script>"; return(null); } // details vars.Add("EventID", eventData.eventID); //vars.Add ("CreatorUUID", eventData.creator); vars.Add("Name", eventData.name); vars.Add("Description", eventData.description.Trim()); vars.Add("SimName", eventData.simName); // Time selections var evntDateTime = Util.ToDateTime(eventData.dateUTC).ToLocalTime(); vars.Add("EventDate", evntDateTime.ToShortDateString()); vars.Add("EventTimes", WebHelpers.EventTimeSelections(evntDateTime.ToString("HH\\:mm\\:ss"))); // event durations vars.Add("EventDurations", WebHelpers.EventDurationSelections((int)eventData.duration)); // event locations vars.Add("EventLocations", WebHelpers.EventLocations(ourAccount, webInterface.Registry, eventData.parcelId)); vars.Add("EventCategories", WebHelpers.EventCategorySelections(int.Parse(eventData.category), translator)); vars.Add("EventCoverCharge", eventData.cover.ToString()); // labels vars.Add("AddEventText", translator.GetTranslatedString("AddEventText")); vars.Add("EventNameText", translator.GetTranslatedString("EventNameText")); vars.Add("EventDateText", translator.GetTranslatedString("EventDateText")); vars.Add("EventTimeText", translator.GetTranslatedString("TimeText")); vars.Add("EventTimeInfoText", translator.GetTranslatedString("EventTimeInfoText")); vars.Add("EventDurationText", translator.GetTranslatedString("DurationText")); vars.Add("EventLocationText", translator.GetTranslatedString("EventLocationText")); vars.Add("EventCategoryText", translator.GetTranslatedString("CategoryText")); vars.Add("EventCoverChargeText", translator.GetTranslatedString("CoverChargeText") + " " + currencySymbol); vars.Add("EventDescriptionText", translator.GetTranslatedString("DescriptionText")); vars.Add("ErrorMessage", ""); vars.Add("Delete", translator.GetTranslatedString("DeleteText")); vars.Add("Submit", translator.GetTranslatedString("SaveUpdates")); return(vars); }