本文整理汇总了C#中Universe.Modules.Web.WebInterface.GetWebUISettings方法的典型用法代码示例。如果您正苦于以下问题:C# WebInterface.GetWebUISettings方法的具体用法?C# WebInterface.GetWebUISettings怎么用?C# WebInterface.GetWebUISettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Universe.Modules.Web.WebInterface
的用法示例。
在下文中一共展示了WebInterface.GetWebUISettings方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fill
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>();
vars.Add("WorldMap", translator.GetTranslatedString("WorldMap"));
var settings = webInterface.GetWebUISettings();
vars.Add("GridCenterX", settings.MapCenter.X);
vars.Add("GridCenterY", settings.MapCenter.Y);
return vars;
}
示例2: Fill
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>();
#region Find pages
List<Dictionary<string, object>> pages = new List<Dictionary<string, object>>();
var settings = webInterface.GetWebUISettings();
var rootPage = webInterface.GetGridPages();
rootPage.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));
foreach (GridPage page in rootPage.Children)
{
if (page.LoggedOutRequired && Authenticator.CheckAuthentication(httpRequest))
continue;
if (page.LoggedInRequired && !Authenticator.CheckAuthentication(httpRequest))
continue;
if (page.AdminRequired && !Authenticator.CheckAdminAuthentication(httpRequest, page.AdminLevelRequired))
continue;
List<Dictionary<string, object>> childPages = new List<Dictionary<string, object>>();
page.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));
foreach (GridPage childPage in page.Children)
{
if (childPage.LoggedOutRequired && Authenticator.CheckAuthentication(httpRequest))
continue;
if (childPage.LoggedInRequired && !Authenticator.CheckAuthentication(httpRequest))
continue;
if (childPage.AdminRequired &&
!Authenticator.CheckAdminAuthentication(httpRequest, childPage.AdminLevelRequired))
continue;
childPages.Add(new Dictionary<string, object>
{
{"ChildMenuItemID", childPage.MenuID},
{"ChildShowInMenu", childPage.ShowInMenu},
{"ChildMenuItemLocation", childPage.Location},
{
"ChildMenuItemTitleHelp",
GetTranslatedString(translator, childPage.MenuToolTip, childPage, true)
},
{
"ChildMenuItemTitle",
GetTranslatedString(translator, childPage.MenuTitle, childPage, false)
}
});
//Add one for menu.js
pages.Add(new Dictionary<string, object>
{
{"MenuItemID", childPage.MenuID},
{"ShowInMenu", false},
{"MenuItemLocation", childPage.Location}
});
}
pages.Add(new Dictionary<string, object>
{
{"MenuItemID", page.MenuID},
{"ShowInMenu", page.ShowInMenu},
{"HasChildren", page.Children.Count > 0},
{"ChildrenMenuItems", childPages},
{"MenuItemLocation", page.Location},
{"MenuItemTitleHelp", GetTranslatedString(translator, page.MenuToolTip, page, true)},
{"MenuItemTitle", GetTranslatedString(translator, page.MenuTitle, page, false)},
{"MenuItemToolTip", GetTranslatedString(translator, page.MenuToolTip, page, true)}
});
}
vars.Add("MenuItems", pages);
#endregion
// Tooltips Urls
vars.Add("TooltipsWelcomeScreen", translator.GetTranslatedString("TooltipsWelcomeScreen"));
vars.Add("TooltipsWorldMap", translator.GetTranslatedString("TooltipsWorldMap"));
// 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"));
//.........这里部分代码省略.........
示例3: Fill
//.........这里部分代码省略.........
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);
IWebHttpTextureService webhttpService =
webInterface.Registry.RequestModuleInterface<IWebHttpTextureService> ();
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"));
}
// 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;
}
示例4: Fill
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 settings = webInterface.GetWebUISettings();
bool adminUser = Authenticator.CheckAdminAuthentication(httpRequest, Constants.USER_GOD_CUSTOMER_SERVICE);
bool allowRegistration = settings.WebRegistration;
bool anonymousLogins;
// allow configuration to override the web settings
var simBase = webInterface.Registry.RequestModuleInterface<ISimulationBase>();
IConfig loginServerConfig = simBase.ConfigSource.Configs["LoginService"];
if (loginServerConfig != null)
{
anonymousLogins = loginServerConfig.GetBoolean ("AllowAnonymousLogin", allowRegistration);
allowRegistration = (allowRegistration || anonymousLogins);
}
if (!adminUser && !allowRegistration)
{
vars.Add("ErrorMessage", "");
vars.Add("RegistrationText", translator.GetTranslatedString("RegistrationText"));
vars.Add("RegistrationsDisabled", translator.GetTranslatedString("RegistrationsDisabled"));
vars.Add("Registrations", false);
vars.Add("NoRegistrations", true);
return vars;
}
if (requestParameters.ContainsKey("Submit"))
{
string AvatarName = requestParameters["AvatarName"].ToString();
string AvatarPassword = requestParameters["AvatarPassword"].ToString();
string AvatarPasswordCheck = requestParameters["AvatarPassword2"].ToString();
string FirstName = requestParameters["FirstName"].ToString();
string LastName = requestParameters["LastName"].ToString();
//removed - greythane - deemed not used
//string UserAddress = requestParameters["UserAddress"].ToString();
//string UserZip = requestParameters["UserZip"].ToString();
string UserCity = requestParameters["UserCity"].ToString();
string UserEmail = requestParameters["UserEmail"].ToString();
string UserHomeRegion = requestParameters["UserHomeRegion"].ToString();
string UserDOBMonth = requestParameters["UserDOBMonth"].ToString();
string UserDOBDay = requestParameters["UserDOBDay"].ToString();
string UserDOBYear = requestParameters["UserDOBYear"].ToString();
string AvatarArchive = requestParameters.ContainsKey("AvatarArchive")
? requestParameters["AvatarArchive"].ToString()
: "";
bool ToSAccept = requestParameters.ContainsKey("ToSAccept") &&
requestParameters["ToSAccept"].ToString() == "Accepted";
string UserType = requestParameters.ContainsKey("UserType") // only admins can set membership
? requestParameters ["UserType"].ToString ()
: "Resident";
// revise UserDOBMonth to a number
UserDOBMonth = ShortMonthToNumber(UserDOBMonth);
// revise Type flags
int UserFlags = webInterface.UserTypeToUserFlags (UserType);
// a bit of idiot proofing
if (AvatarName == "") {
response = "<h3>" + translator.GetTranslatedString ("AvatarNameError") + "</h3>";
return null;
}
if ( (AvatarPassword == "") || (AvatarPassword != AvatarPasswordCheck) )
{
response = "<h3>" + translator.GetTranslatedString ("AvatarPasswordError") + "</h3>";
return null;
}
if (UserEmail == "")
{
response = "<h3>" + translator.GetTranslatedString ("AvatarEmailError") + "</h3>";
return null;
}
// Thish - Only one space is allowed in the name to seperate First and Last of the avatar name
if (AvatarName.Split (' ').Length != 2)
{
response = "<h3>" + translator.GetTranslatedString("AvatarNameSpacingError") + "</h3>";
return null;
}
// so far so good...
if (ToSAccept)
{
AvatarPassword = Util.Md5Hash(AvatarPassword);
IUserAccountService accountService =
webInterface.Registry.RequestModuleInterface<IUserAccountService>();
UUID userID = UUID.Random();
string error = accountService.CreateUser(userID, settings.DefaultScopeID, AvatarName, AvatarPassword,
UserEmail);
if (error == "")
{
// set the user account type
UserAccount account = accountService.GetUserAccount (null, userID);
//.........这里部分代码省略.........
示例5: Fill
//.........这里部分代码省略.........
List<Dictionary<string, object>> users = new List<Dictionary<string, object>>();
foreach (var client in usersInRegion)
{
UserAccount account = userService.GetUserAccount(null, client.UserID);
if (account == null)
continue;
Dictionary<string, object> user = new Dictionary<string, object>();
user.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
user.Add("UserUUID", client.UserID);
user.Add("UserName", account.Name);
users.Add(user);
}
vars.Add("UsersInRegion", users);
}
else
{
vars.Add("NumberOfUsersInRegion", 0);
vars.Add("UsersInRegion", new List<Dictionary<string, object>>());
}
IDirectoryServiceConnector directoryConnector =
Framework.Utilities.DataManager.RequestPlugin<IDirectoryServiceConnector>();
if (directoryConnector != null)
{
List<LandData> data = directoryConnector.GetParcelsByRegion(0, 10, region.RegionID, UUID.Zero,
ParcelFlags.None, ParcelCategory.Any);
List<Dictionary<string, object>> parcels = new List<Dictionary<string, object>>();
foreach (var p in data)
{
Dictionary<string, object> parcel = new Dictionary<string, object>();
parcel.Add("ParcelNameText", translator.GetTranslatedString("ParcelNameText"));
parcel.Add("ParcelOwnerText", translator.GetTranslatedString("ParcelOwnerText"));
parcel.Add("ParcelUUID", p.GlobalID);
parcel.Add("ParcelName", p.Name);
parcel.Add("ParcelOwnerUUID", p.OwnerID);
IUserAccountService accountService =
webInterface.Registry.RequestModuleInterface<IUserAccountService>();
if (accountService != null)
{
var account = accountService.GetUserAccount(null, p.OwnerID);
if (account == null)
parcel.Add("ParcelOwnerName", translator.GetTranslatedString("NoAccountFound"));
else
parcel.Add("ParcelOwnerName", account.Name);
}
parcels.Add(parcel);
}
vars.Add("ParcelInRegion", parcels);
vars.Add("NumberOfParcelsInRegion", parcels.Count);
}
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");
// Menu Region
vars.Add("MenuRegionTitle", translator.GetTranslatedString("MenuRegionTitle"));
vars.Add("MenuParcelTitle", translator.GetTranslatedString("MenuParcelTitle"));
vars.Add("MenuOwnerTitle", translator.GetTranslatedString("MenuOwnerTitle"));
vars.Add("RegionInformationText", translator.GetTranslatedString("RegionInformationText"));
vars.Add("OwnerNameText", translator.GetTranslatedString("OwnerNameText"));
vars.Add("RegionLocationText", translator.GetTranslatedString("RegionLocationText"));
vars.Add("RegionSizeText", translator.GetTranslatedString("RegionSizeText"));
vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
vars.Add("RegionTypeText", translator.GetTranslatedString("RegionTypeText"));
vars.Add("RegionTerrainText", translator.GetTranslatedString("RegionTerrainText"));
vars.Add("RegionInfoText", translator.GetTranslatedString("RegionInfoText"));
vars.Add("RegionOnlineText", translator.GetTranslatedString("RegionOnlineText"));
vars.Add("NumberOfUsersInRegionText", translator.GetTranslatedString("NumberOfUsersInRegionText"));
vars.Add("ParcelsInRegionText", translator.GetTranslatedString("ParcelsInRegionText"));
// 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;
}
示例6: Fill
//.........这里部分代码省略.........
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)
{
foreach (var grp in groupsConnector.GetAgentGroupMemberships(account.PrincipalID, account.PrincipalID))
{
var grpData = groupsConnector.GetGroupProfile (account.PrincipalID, grp.GroupID);
string url = "../images/icons/no_groups.jpg";
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;
}
示例7: Fill
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 settings = webInterface.GetWebUISettings();
if (requestParameters.ContainsKey("Submit"))
{
settings.WebRegistration = requestParameters["WebRegistration"].ToString() == "1";
settings.MapCenter.X = int.Parse(requestParameters["GridCenterX"].ToString());
settings.MapCenter.Y = int.Parse(requestParameters["GridCenterY"].ToString());
settings.LocalFrontPage = requestParameters["LocalFrontPage"].ToString();
if (settings.LocalFrontPage != "")
settings.LocalFrontPage = "local/" + settings.LocalFrontPage;
settings.LocalCSS = requestParameters["LocalCSS"].ToString();
settings.HideSlideshowBar = requestParameters["HideSlideshowBar"].ToString() == "1";
settings.HideLanguageTranslatorBar = requestParameters["HideLanguageBar"].ToString() == "1";
settings.HideStyleBar = requestParameters["HideStyleBar"].ToString() == "1";
if (settings.LocalCSS != "")
{
settings.LocalCSS = "local/" + settings.LocalCSS;
settings.HideStyleBar = true; // not needed if a local style is used
}
webInterface.SaveWebUISettings (settings);
response = "Successfully updated WebUI settings.";
return null;
}
else if (requestParameters.ContainsKey("IgnorePagesUpdates"))
{
settings.LastPagesVersionUpdateIgnored = PagesMigrator.CurrentVersion;
webInterface.SaveWebUISettings (settings);
}
else if (requestParameters.ContainsKey("IgnoreSettingsUpdates"))
{
settings.LastSettingsVersionUpdateIgnored = PagesMigrator.CurrentVersion;
webInterface.SaveWebUISettings (settings);
}
vars.Add("WebRegistrationNo", !settings.WebRegistration ? "selected=\"selected\"" : "");
vars.Add("WebRegistrationYes", settings.WebRegistration ? "selected=\"selected\"" : "");
vars.Add("GridCenterX", settings.MapCenter.X);
vars.Add("GridCenterY", settings.MapCenter.Y);
if (settings.LocalFrontPage.StartsWith("local/"))
vars.Add("LocalFrontPage", settings.LocalFrontPage.Remove(0,6)); // remove 'local/' prefix
else
vars.Add("LocalFrontPage", settings.LocalFrontPage);
if (settings.LocalCSS.StartsWith("local/"))
vars.Add("LocalCSS", settings.LocalCSS.Remove(0,6)); // remove 'local/' prefix
else
vars.Add("LocalCSS", settings.LocalCSS);
vars.Add("HideSlideshowBarNo", !settings.HideSlideshowBar ? "selected=\"selected\"" : "");
vars.Add("HideSlideshowBarYes", settings.HideSlideshowBar ? "selected=\"selected\"" : "");
vars.Add("HideLanguageBarNo", !settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
vars.Add("HideLanguageBarYes", settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
vars.Add("HideStyleBarNo", !settings.HideStyleBar ? "selected=\"selected\"" : "");
vars.Add("HideStyleBarYes", settings.HideStyleBar ? "selected=\"selected\"" : "");
vars.Add("IgnorePagesUpdates",
PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored)
? ""
: "checked");
vars.Add("IgnoreSettingsUpdates",
settings.LastSettingsVersionUpdateIgnored != SettingsMigrator.CurrentVersion ? "" : "checked");
vars.Add("SettingsManager", translator.GetTranslatedString("SettingsManager"));
vars.Add("IgnorePagesUpdatesText", translator.GetTranslatedString("IgnorePagesUpdatesText"));
vars.Add("IgnoreSettingsUpdatesText", translator.GetTranslatedString("IgnoreSettingsUpdatesText"));
vars.Add("WebRegistrationText", translator.GetTranslatedString("WebRegistrationText"));
vars.Add("GridCenterXText", translator.GetTranslatedString("GridCenterXText"));
vars.Add("GridCenterYText", translator.GetTranslatedString("GridCenterYText"));
vars.Add("LocalFrontPageText", translator.GetTranslatedString("LocalFrontPageText"));
vars.Add("LocalCSSText", translator.GetTranslatedString("LocalCSSText"));
vars.Add("WelcomeMessageText", translator.GetTranslatedString("WelcomeMessageText"));
vars.Add("HideSlideshowBarText", translator.GetTranslatedString("HideSlideshowBarText"));
vars.Add("HideLanguageBarText", translator.GetTranslatedString("HideLanguageBarText"));
vars.Add("HideStyleBarText", translator.GetTranslatedString("HideStyleBarText"));
vars.Add("Save", translator.GetTranslatedString("Save"));
vars.Add("No", translator.GetTranslatedString("No"));
vars.Add("Yes", translator.GetTranslatedString("Yes"));
return vars;
}
示例8: Fill
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>();
// homescreen login
string error = "";
if (requestParameters.ContainsKey("username") && requestParameters.ContainsKey("password"))
{
string username = requestParameters["username"].ToString();
string password = requestParameters["password"].ToString();
ILoginService loginService = webInterface.Registry.RequestModuleInterface<ILoginService>();
if (loginService.VerifyClient(UUID.Zero, username, "UserAccount", password))
{
UUID sessionID = UUID.Random();
UserAccount account =
webInterface.Registry.RequestModuleInterface<IUserAccountService>()
.GetUserAccount(null, username);
Authenticator.AddAuthentication(sessionID, account);
if (account.UserLevel > 0)
Authenticator.AddAdminAuthentication(sessionID, account);
httpResponse.AddCookie(new System.Web.HttpCookie("SessionID", sessionID.ToString())
{
Expires = DateTime.MinValue,
Path = ""
});
response = "<h3>Successfully logged in</h3>" +
"<script language=\"javascript\">" +
"setTimeout(function() {window.location.href = \"index.html\";}, 0);" +
"</script>";
}
else
response = "<h3>Failed to verify user name and password</h3>";
return null;
}
// Tooltips Urls
vars.Add("TooltipsWelcomeScreen", translator.GetTranslatedString("TooltipsWelcomeScreen"));
vars.Add("TooltipsWorldMap", translator.GetTranslatedString("TooltipsWorldMap"));
// Index Page
vars.Add("HomeText", translator.GetTranslatedString("HomeText"));
vars.Add("HomeTextWelcome", translator.GetTranslatedString("HomeTextWelcome"));
vars.Add("HomeTextTips", translator.GetTranslatedString("HomeTextTips"));
vars.Add("WelcomeScreen", translator.GetTranslatedString("WelcomeScreen"));
vars.Add("WelcomeToText", translator.GetTranslatedString("WelcomeToText"));
// login
vars.Add("UserLogin", !Authenticator.CheckAuthentication(httpRequest));
vars.Add("ErrorMessage", error);
vars.Add("Login", translator.GetTranslatedString("Login"));
vars.Add("UserNameText", translator.GetTranslatedString("UserName"));
vars.Add("PasswordText", translator.GetTranslatedString("Password"));
vars.Add("ForgotPassword", translator.GetTranslatedString("ForgotPassword"));
vars.Add("Submit", translator.GetTranslatedString("Login"));
var settings = webInterface.GetWebUISettings();
if (PagesMigrator.RequiresUpdate() &&
PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored))
vars.Add("PagesUpdateRequired",
translator.GetTranslatedString("Pages") + " " +
translator.GetTranslatedString("DefaultsUpdated"));
else
vars.Add("PagesUpdateRequired", "");
if (SettingsMigrator.RequiresUpdate() &&
SettingsMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastSettingsVersionUpdateIgnored))
vars.Add("SettingsUpdateRequired",
translator.GetTranslatedString("Settings") + " " +
translator.GetTranslatedString("DefaultsUpdated"));
else
vars.Add("SettingsUpdateRequired", "");
vars.Add("ShowSlideshowBar", !settings.HideSlideshowBar);
// user setup news inclusion
if (settings.LocalFrontPage == "")
{
vars.Add ("LocalPage", false);
vars.Add ("LocalFrontPage", "");
}
else
{
vars.Add ("LocalPage", true);
vars.Add ("LocalFrontPage", settings.LocalFrontPage);
}
return vars;
}