/// <summary>Escreve informações sobre a Cache</summary> private void writeCacheInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_cache_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Cache.Count + "</b><br />"); writer.WriteLine("<b>" + info.getContent("stats_cache_content") + "</b><br />"); writer.WriteLine("<table class='stats_cache_items' >"); foreach (DictionaryEntry item in Page.Cache) { if (item.Key.ToString().StartsWith("@@")) { continue; } writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item.Key.ToString()); writer.WriteLine("<td>{0}</td>", item.Value.ToString()); writer.WriteLine("<td><a href='javascript:{1}'><img src='{0}' /></a></td>", OrionGlobals.getCommonImagePath("remove.gif"), "deleteCache(\"" + item.Key.ToString() + "\")" ); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); mailValidator.ErrorMessage = LoginControl.getError("validators_invalidMailFormat"); resetButton.Text = info.getContent("reset_button"); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_resetpassword")); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); mailValidator.ErrorMessage = LoginControl.getError("validators_invalidMailFormat"); resetButton.Text = info.getContent("reset_button"); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_resetpassword")); }
/// <summary> /// preenche o título /// </summary> private void createTitle(ItemsTable itemsTable) { ItemsTableLine line = new ItemsTableLine(); line.add(new ItemsTableText(info.getContent("fleet_fleetToMove"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("coordenada"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("fleet_moveFleet"), "resourceTitle")); itemsTable.HeaderItem = line; itemsTable.TableTitleCssClass = "resourceTitle"; }
/// <summary>Evento de click no buto</summary> protected void onLoginClick(object src, ImageClickEventArgs args) { //verificar se as string n esto vazias if (userMail.Text == string.Empty) { Information.AddError(info.getContent("provide-mail")); return; } if (!Regex.IsMatch(userMail.Text, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { Information.AddError(info.getContent("bad-mail-format")); return; } if (password.Text == string.Empty) { Information.AddError(info.getContent("provide-password")); return; } if ((userMail.Text.IndexOf(" ")) == 0 || (password.Text.IndexOf(" ")) == 0) { Information.AddError(info.getContent("login-error")); return; } bool user = UserUtility.bd.checkUser(userMail.Text, password.Text); if (!user) { Information.AddError(info.getContent("login-error")); return; } login.Visible = false; logout.Visible = true; FormsAuthentication.SetAuthCookie(userMail.Text, autoLogin.Checked); string redirectUrl = FormsAuthentication.GetRedirectUrl(userMail.Text, autoLogin.Checked).ToLower(); HttpContext context = HttpContext.Current; if (context.Request.QueryString["ReturnUrl"] != null) { context.Response.Redirect(redirectUrl); } else { context.Response.Redirect(OrionGlobals.resolveBase("default.aspx")); } }
private void PopulateBattleTypes() { foreach (string type in BattleInfo.EndBattleTypes) { battleTypes.Items.Add(new ListItem(info.getContent(type), type)); } }
/// <summary>Evento de click no butão</summary> protected void onLoginClick(object src, EventArgs args) { Log.log("-------------------------------"); if (!Page.IsValid) { Trace.Write("LoginControl", "Login fields not valid"); return; } Trace.Write("LoginControl", "Login fields valid"); bool user = UserUtility.bd.checkUser(userMail.Text, password.Text); Log.log("-------------------------------"); Log.log("Authentication for'{0}': {1}", userMail.Text, user); if (!user) { Information.AddError(info.getContent("login-error")); return; } else { Trace.Write("go redirect"); FormsAuthentication.RedirectFromLoginPage(userMail.Text, autoLogin.Checked); } }
protected override void OnPreRender(EventArgs e) { string id = (string)Page.Request.Form["exception"]; if (id != null && OrionGlobals.isInt(id)) { remove(int.Parse(id)); } ExceptionInfo[] allExceptions = ExceptionLog.load(); if (allExceptions.Length != 0) { content.Visible = true; noContent.Visible = false; removeAllException.Text = info.getContent("orionsbelterror_removeAll"); exceptions.DataSource = allExceptions; exceptions.DataBind(); } else { content.Visible = false; noContent.Visible = true; } //regista o código javascript registerScripts(); }
protected override void OnLoad(EventArgs e) { Ruler ruler = getRuler(); Planet planet = getPlanet(); ILanguageInfo info = CultureModule.getLanguage(); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Battle, string.Format("{0} - {1}", planet.Name, info.getContent("section_fleet"))); resources.Manager = queue.Manager = planet; resources.Category = queue.Category = "Unit"; resources.QueueError = queueError; resources.AskBuildQuantity = true; resources.ShowQuantity = false; resources.ShowDemolish = false; resources.Tooltip = "attributes"; resources.ShowImagePreview = true; resources.Cost = Cost; resources.ShowRareResourceCost = true; resources.ShowDocumentation = true; resources.IncludeOnMouseOver = false; resources.CategoryDescription = "general"; resources.AllowKeywords = false; resourcesHelp.Title = info.getContent("planetResources"); resourcesHelp.Manager = planet; resourcesHelp.ShowImages = true; resourcesHelp.Category = "Intrinsic"; resourcesHelp.ShowDocumentation = false; resourcesHelp.ShowDocumentation = false; resourcesHelp.ResourcesToShow = Cost; queue.Title = info.getContent("inProduction"); queue.EmptyMessage = info.getContent("buildingsQueueEmpty"); queue.ShowImagePreview = true; resources.Title = info.getContent("fleet_buildShip"); planetNavigation.Player = ruler; planetNavigation.Current = planet; planetNavigation.Section = "Fleet"; }
/// <summary>Escreve informações sobre o ApplicationState</summary> private void writeApplicationInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_application_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Application.Count + "</b><br />"); writer.WriteLine("<b>" + info.getContent("stats_cache_content") + "</b><br />"); writer.WriteLine("<table class='stats_cache_items'>"); string[] keys = Page.Application.AllKeys; foreach (string item in keys) { writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item); writer.WriteLine("<td>{0}</td>", Page.Application[item].ToString()); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
/// <summary>Constrói todo o conteúdo do controlo</summary> private void buildControlTree() { ILanguageInfo info = CultureModule.getLanguage(); User user = (User)Page.User; if (user.IsInRole("ruler")) { Information.AddError(info.getContent("addruler_already-ruler")); hide(); return; } int count = int.Parse(OrionGlobals.getConfigurationValue("alnitak", "userCount")); if (Universe.instance.canAddRuler() && Universe.instance.rulers.Count < count) { string status = info.getContent("addruler_status-goodnews"); string m = string.Format(info.getContent("addruler_intro"), status); Information.AddInformation(m); } else { string status = info.getContent("addruler_status-badnews"); string m = string.Format(info.getContent("addruler_intro"), status); Information.AddInformation(m); hide(); return; } EventHandler click = new EventHandler(this.onClick); insertPlanetName.Text = info.getContent("addruler_home-planet"); planet.TextChanged += click; registerRuler.Text = info.getContent("register"); registerRuler.Click += click; onlyTextValidator.ErrorMessage = info.getContent("addruler_planet-only-text") + "<p/>"; requiredFieldValidator.ErrorMessage = info.getContent("addruler_planet-required") + "<p/>"; charCountValidator.ErrorMessage = info.getContent("addruler_planet-tolong"); }
/// <summary> /// preenche o ttulo /// </summary> private void createTitle(ItemsTable itemsTable, string title) { ItemsTableLine line = new ItemsTableLine(); line.add(new ItemsTableText("#", "resourceTitle")); line.add(new ItemsTableText(info.getContent(title), "resourceTitle")); line.add(new ItemsTableText(info.getContent("quantidade"), "resourceTitle")); itemsTable.HeaderItem = line; }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("login"); passValidator.ErrorMessage = getError("provide-password"); userValidator.ErrorMessage = getError("provide-mail"); mailValidator.ErrorMessage = getError("bad-mail-format"); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("login"); passValidator.ErrorMessage = getError("provide-password"); userValidator.ErrorMessage = getError("provide-mail"); mailValidator.ErrorMessage = getError("bad-mail-format"); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); userUpdated.Visible = false; userMail.EnableViewState = true; OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_profile")); updateButton.Text = info.getContent("update"); nickValidator.ErrorMessage = LoginControl.getError("profile_provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); avatarUrlValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-avatarUrl"); avatarRangeValidator.ErrorMessage = LoginControl.getError("validators_big-avatarUrl"); urlTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-url"); urlRangeValidator.ErrorMessage = LoginControl.getError("validators_big-url"); imagesDirValidator.ErrorMessage = LoginControl.getError("validators_invalidDir"); msnValidator.ErrorMessage = LoginControl.getError("validators_invalid-msn"); icqValidator.ErrorMessage = LoginControl.getError("validators_invalid-icq"); jabberValidator.ErrorMessage = LoginControl.getError("validators_invalid-jabber"); aimValidator.ErrorMessage = LoginControl.getError("validators_invalid-aim"); yahooValidator.ErrorMessage = LoginControl.getError("validators_invalid-yahoo"); signatureValidator.ErrorMessage = LoginControl.getError("validators_invalid-signature"); signatureRangeValidator.ErrorMessage = LoginControl.getError("validators_big-signature"); if (!IsPostBack) { povoateLang(); povoateSkin(); setFields(); } }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); userUpdated.Visible = false; userMail.EnableViewState = true; OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_profile")); updateButton.Text = info.getContent("update"); nickValidator.ErrorMessage = LoginControl.getError("profile_provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); avatarUrlValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-avatarUrl"); avatarRangeValidator.ErrorMessage = LoginControl.getError("validators_big-avatarUrl"); urlTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-url"); urlRangeValidator.ErrorMessage = LoginControl.getError("validators_big-url"); imagesDirValidator.ErrorMessage = LoginControl.getError("validators_invalidDir"); msnValidator.ErrorMessage = LoginControl.getError("validators_invalid-msn"); icqValidator.ErrorMessage = LoginControl.getError("validators_invalid-icq"); jabberValidator.ErrorMessage = LoginControl.getError("validators_invalid-jabber"); aimValidator.ErrorMessage = LoginControl.getError("validators_invalid-aim"); yahooValidator.ErrorMessage = LoginControl.getError("validators_invalid-yahoo"); signatureValidator.ErrorMessage = LoginControl.getError("validators_invalid-signature"); signatureRangeValidator.ErrorMessage = LoginControl.getError("validators_big-signature"); if( !IsPostBack ) { povoateLang(); povoateSkin(); setFields(); } }
/// <summary>Povoa a DropDownLost das linguas</summary> private void povoateLang() { User user = (User)HttpContext.Current.User; string[] langs = CultureModule.Languages; foreach (object l in langs) { string language = l.ToString(); if (language == "CVS") { continue; } ListItem item = new ListItem(); item.Text = info.getContent("Culture", language); item.Value = language; if (language == user.Lang) { item.Selected = true; } lang.Items.Add(item); } }
/// <summary>Evento de click no botão</summary> protected void onLoginClick(object src, EventArgs args) { if (!Page.IsValid) { return; } if (UserUtility.bd.checkUser(userMail.Text)) { Information.AddError(info.getContent("register_mail-exists")); return; } UserUtility.bd.registerUser(nick.Text, userMail.Text, password.Text); foreach (Control control in Controls) { control.Visible = false; } Information.AddInformation(string.Format(info.getContent("register_go-login"), userMail.Text)); Page.Cache.Remove("TotalUsers"); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("send"); passValidator.ErrorMessage = LoginControl.getError("provide-password"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); userValidator.ErrorMessage = LoginControl.getError("provide-mail"); mailValidator.ErrorMessage = LoginControl.getError("bad-mail-format"); nickValidator.ErrorMessage = LoginControl.getError("provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); passRangeValidator.ErrorMessage = LoginControl.getError("validators_big-pass"); }
/// <summary>Evento de click no botão</summary> protected void onResetPassword(object src, EventArgs args) { Chronos.Utils.Log.log("Reset Password Click"); string newPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(User.GeneratePassword(), "sha1"); if (UserUtility.bd.resetPassword(mail.Text, newPassword)) { resetOk = true; } else { Information.AddError(info.getContent("validators_invalidEmail")); } }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("send"); passValidator.ErrorMessage = LoginControl.getError("provide-password"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); userValidator.ErrorMessage = LoginControl.getError("provide-mail"); mailValidator.ErrorMessage = LoginControl.getError("bad-mail-format"); nickValidator.ErrorMessage = LoginControl.getError("provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); passRangeValidator.ErrorMessage = LoginControl.getError("validators_big-pass"); }
/// <summary> /// preenche o título /// </summary> private void createTitle(ItemsTable itemsTable) { ItemsTableLine line = new ItemsTableLine(); line.add(new ItemsTableText("#", "resourceTitle")); line.add(new ItemsTableText(info.getContent("cancelBattle_ruler"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("battleAdminUser_battle"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("cancelBattle_accept"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("cancelBattle_reject"), "resourceTitle")); itemsTable.HeaderItem = line; }
/// <summary>Escreve o título da tabela</summary> private void writeTitle(HtmlTextWriter writer) { if (ShowImages) { writer.WriteLine("<td class='resourceTitle'>-</td>"); } writer.WriteLine("<td class='resourceTitle'>" + info.getContent("recurso") + "</td>"); if (!showOnlyQuantity) { writer.WriteLine("<td class='resourceTitle' title='{1}'>{0}</td>", info.getContent("modificadores"), info.getContent("modificadores_title")); writer.WriteLine("<td class='resourceTitle' title='{1}'>{0}</td>", info.getContent("turnIncome"), info.getContent("turnIncome_title")); } if (ShowQuantity) { writer.WriteLine("<td class='resourceTitle' title='{1}'>{0}</td>", info.getContent("quantidade"), info.getContent("quantidade_title")); } }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, CultureModule.getContent("section_index")); NewsList news = NewsUtility.Persistence.GetNews(); if (news != null && news.List.Count > 0) { writeNews(writer, news); } else { ILanguageInfo info = CultureModule.getLanguage(); /*writer.WriteLine("<div><b>{0}</b></div>", * info.getContent("no_news_title") * );*/ writer.WriteLine("<div>{0}</div>", info.getContent("no_news_message")); } }
private void RaiseError(Result r) { queueError.Title = info.getContent("battle_error"); queueError.ResultSet = r; queueError.Visible = true; }
/// <summary>Pinta o controlo</summary> protected override void Render(HtmlTextWriter _writer) { try { writer = _writer; string locale = Request.QueryString["locale"]; if (locale == null || locale == string.Empty) { locale = "en"; } string url = OrionGlobals.AlnitakUrl; ILanguageInfo info = CultureModule.getLanguage(locale); int rulerId = int.Parse(Request.QueryString["id"]); User user = UserUtility.bd.getUser(rulerId); Ruler ruler = null; if (user != null) { ruler = Universe.instance.getRuler(user.RulerId); } Write("<div class=\"orionsbelt_title\">"); Write("<a href=\"{0}\" class=\"orionsbelt_link\">Orion`s Belt</a></div>", url); if (ruler == null || user.RulerId == -1) { Write(info.getContent("ruler_not_playing")); return; } Write("<table class=\"orionsbelt_table\">"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("name")); Write("<td class=\"orionsbelt_td\">{0}</td>", OrionGlobals.getCompleteLink(ruler).Replace("'", "\"")); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("stats_alliances")); string allianceText = null; if (Universe.instance.isDefaultAlliance(ruler)) { allianceText = "<i>" + info.getContent("no_alliance") + "</i>"; } else { allianceText = ruler.Alliance.Name; } Write("<td class=\"orionsbelt_td\">{0}</td>", allianceText); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("planetas")); Write("<td class=\"orionsbelt_td\">{0}</td>", ruler.Planets.Length); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("batalhas")); Write("<td class=\"orionsbelt_td\"><span class=\"green\">{0}</span>/<span class=\"orange\">{1}</span>/<span class=\"red\">{2}</span></td>", ruler.Victories, ruler.Draws, ruler.Defeats); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("score")); Write("<td class=\"orionsbelt_td\">{0}</td>", ruler.getResourceCount("score")); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("battle_rank")); Write("<td class=\"orionsbelt_td\"><b>{0}</b></td>", (ruler.Rank == -1?"~":ruler.Rank.ToString())); Write("</tr>"); Write("</table>"); } catch (Exception) { Write("<div class=\"orionsbelt_title\">Error processing the URL</div>"); } }
/// <summary>Retorna uma string HTML com um erro</summary> public static string getError(string target, string reference) { ILanguageInfo info = CultureModule.getLanguage(); return(string.Format("{0} {1}{2}", "*", info.getContent(target, reference), "<br/>")); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { EnableViewState = false; Universe universe = Universe.instance; ILanguageInfo info = CultureModule.getLanguage(); ChronosStats stats = (ChronosStats)Page.Application["ChronosStats"]; writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_alliances") + "<b>: " + (universe.allianceCount - 1) + "</b><br />"); writer.WriteLine(info.getContent("stats_rulers") + ": <b>" + universe.rulerCount + "</b><br />"); int maxP = Coordinate.MaximumGalaxies * Coordinate.MaximumSystems * Coordinate.MaximumSectors * Coordinate.MaximumPlanets; writer.WriteLine(info.getContent("stats_planets") + ": <b>" + universe.planetCount + "/" + maxP + "</b><br />"); writer.WriteLine(info.getContent("stats_nextCoordinate") + ": <b>" + universe.CurrentCoordinate + "</b><br />"); writer.WriteLine("<div>--</div>"); writer.WriteLine(info.getContent("stats_timeFromLastReboot") + ": <b>" + stats.StartTime + "</b><br />"); writer.WriteLine("Dress Up: <b>" + stats.DressUp + "</b><br />"); writer.WriteLine(info.getContent("stats_lastTurnTime") + ": <b>" + stats.LastTurnTime + "</b><br />"); writer.WriteLine(info.getContent("stats_turnSinceReboot") + ": <b>" + stats.TurnCount + "</b><br />"); writer.WriteLine(info.getContent("stats_totalTurns") + ": <b>" + universe.TurnCount + "</b><br />"); writer.WriteLine(info.getContent("stats_turnTime") + ": <b>" + universe.TurnTime + "</b><br />"); writer.WriteLine(info.getContent("stats_lastTurn") + ": <b>" + stats.LastTurn.ToLongTimeString() + "</b><br />"); writer.WriteLine(info.getContent("stats_nextTurn") + ": <b>" + stats.LastTurn.AddMilliseconds(universe.TurnTime).ToLongTimeString() + "</b><br />"); if (Universe.instance.Persistence is UniverseSerializer) { writer.WriteLine("Stream Size: <b>" + (((UniverseSerializer)Universe.instance.Persistence).StreamSize / 1024) + " Kb</b><br />"); } writer.WriteLine("<div>--</div>"); writer.WriteLine(info.getContent("stats_persistence") + ": <b>" + Chronos.Persistence.UniverseSerializer.Instance.GetType().Name + "</b><br />"); writer.WriteLine("<div>--</div>"); writer.WriteLine("<b>Alnitak: </b><br/>{0}<p/>", OrionGlobals.AlnitakInfo.Replace(";", "<br/>")); writer.WriteLine("<b>Chronos: </b><br/>{0}", Chronos.Utils.Platform.ChronosInfo.Replace(";", "<br/>")); writer.WriteLine("</div>"); registerScripts(); writer.WriteLine("<p />"); writeCacheInfo(writer, info); writer.WriteLine("<p />"); writeApplicationInfo(writer, info); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_admin")); }
protected override void initializeSkin(Control skin) { info = CultureModule.getLanguage(); string c = OrionGlobals.getCulture(); login = (Panel)getControl(skin,"login"); logout = (Panel)getControl(skin,"logout"); becomeRulerPanel = (Panel)getControl(skin,"becomeRulerPanel"); loginButton = (ImageButton)getControl(skin,"loginButton"); loginButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/login_"+ c +".gif" ); registerButton = (ImageButton)getControl(skin,"registerButton"); registerButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/register_"+ c +".gif" ); logoutButton = (ImageButton)getControl(skin,"logoutButton"); logoutButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/logout_"+ c +".gif" ); profileButton = (ImageButton)getControl(skin,"profileButton"); profileButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/profile_"+ c +".gif" ); userMail = (TextBox)getControl(skin,"userMail"); if( ! Page.IsPostBack ) { userMail.Text = string.Empty; } password = (TextBox)getControl(skin,"password"); autoLogin = (CheckBox)getControl(skin,"autoLogin"); loginButton.ToolTip = info.getContent("login_login"); registerButton.ToolTip = info.getContent("login_register"); logoutButton.ToolTip = info.getContent("login_logout"); profileButton.ToolTip = info.getContent("login_profile"); //eventos loginButton.Click += new ImageClickEventHandler( onLoginClick ); registerButton.Click += new ImageClickEventHandler(onRegisterClick); logoutButton.Click += new ImageClickEventHandler(onLogoutClick); profileButton.Click += new ImageClickEventHandler(onProfileClick); if( HttpContext.Current.User.IsInRole("guest") ) { logout.Visible = false; login.Visible = true; }else{ logout.Visible = true; login.Visible = false; if( !HttpContext.Current.User.IsInRole("ruler") ) { becomeRulerPanel.Controls.Clear(); if( becomeRulerPanel.Controls.Count == 0 ) { ImageButton becomeRuler; object o = HttpContext.Current.Cache["ImageButton_BecomeRulers"]; if( o == null ) { becomeRuler = new ImageButton(); becomeRuler.ToolTip = info.getContent("login_becomeRuler"); becomeRuler.Click += new ImageClickEventHandler(onBecomeRuler); becomeRuler.ImageUrl = OrionGlobals.getSkinImagePath("buttons/becomeRuler_"+ c +".gif" ); becomeRuler.CausesValidation = false; becomeRuler.CssClass = "imageButton"; becomeRulerPanel.Visible = true; HttpContext.Current.Cache["ImageButton_BecomeRulers"] = becomeRuler; }else{ becomeRuler = (ImageButton)o; } becomeRulerPanel.Controls.Add( becomeRuler ); } }else { if( becomeRulerPanel.Controls.Count > 0 ) becomeRulerPanel.Controls.Clear(); } } }
protected void remove(string name) { Chronos.Core.Fleet srcFleet = ruler.getFleet(name); if (srcFleet != null) { if (srcFleet.Owner != ruler) { Planet p = (Planet)srcFleet.Owner; Chronos.Core.Fleet dstFleet = p.getPlanetFleet(); IDictionaryEnumerator iter = srcFleet.Ships.GetEnumerator(); while (iter.MoveNext()) { dstFleet.swapShips(srcFleet, iter.Key.ToString(), int.Parse(iter.Value.ToString())); iter = srcFleet.Ships.GetEnumerator(); } p.removeFleet(srcFleet); Information.AddInformation(info.getContent("fleet_removeOk")); } else { if (!srcFleet.HasShips) { ruler.removeUniverseFleet(srcFleet.Id); Information.AddInformation(info.getContent("fleet_removeOkUniverse")); } } } }
protected override void initializeSkin(Control skin) { info = CultureModule.getLanguage(); string c = OrionGlobals.getCulture(); login = (Panel)getControl(skin, "login"); logout = (Panel)getControl(skin, "logout"); becomeRulerPanel = (Panel)getControl(skin, "becomeRulerPanel"); loginButton = (ImageButton)getControl(skin, "loginButton"); loginButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/login_" + c + ".gif"); registerButton = (ImageButton)getControl(skin, "registerButton"); registerButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/register_" + c + ".gif"); logoutButton = (ImageButton)getControl(skin, "logoutButton"); logoutButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/logout_" + c + ".gif"); profileButton = (ImageButton)getControl(skin, "profileButton"); profileButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/profile_" + c + ".gif"); userMail = (TextBox)getControl(skin, "userMail"); if (!Page.IsPostBack) { userMail.Text = string.Empty; } password = (TextBox)getControl(skin, "password"); autoLogin = (CheckBox)getControl(skin, "autoLogin"); loginButton.ToolTip = info.getContent("login_login"); registerButton.ToolTip = info.getContent("login_register"); logoutButton.ToolTip = info.getContent("login_logout"); profileButton.ToolTip = info.getContent("login_profile"); //eventos loginButton.Click += new ImageClickEventHandler(onLoginClick); registerButton.Click += new ImageClickEventHandler(onRegisterClick); logoutButton.Click += new ImageClickEventHandler(onLogoutClick); profileButton.Click += new ImageClickEventHandler(onProfileClick); if (HttpContext.Current.User.IsInRole("guest")) { logout.Visible = false; login.Visible = true; } else { logout.Visible = true; login.Visible = false; if (!HttpContext.Current.User.IsInRole("ruler")) { becomeRulerPanel.Controls.Clear(); if (becomeRulerPanel.Controls.Count == 0) { ImageButton becomeRuler; object o = HttpContext.Current.Cache["ImageButton_BecomeRulers"]; if (o == null) { becomeRuler = new ImageButton(); becomeRuler.ToolTip = info.getContent("login_becomeRuler"); becomeRuler.Click += new ImageClickEventHandler(onBecomeRuler); becomeRuler.ImageUrl = OrionGlobals.getSkinImagePath("buttons/becomeRuler_" + c + ".gif"); becomeRuler.CausesValidation = false; becomeRuler.CssClass = "imageButton"; becomeRulerPanel.Visible = true; HttpContext.Current.Cache["ImageButton_BecomeRulers"] = becomeRuler; } else { becomeRuler = (ImageButton)o; } becomeRulerPanel.Controls.Add(becomeRuler); } } else { if (becomeRulerPanel.Controls.Count > 0) { becomeRulerPanel.Controls.Clear(); } } } }
/// <summary>Escreve informações sobre a Cache</summary> private void writeCacheInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_cache_title") + "</b></div>" ); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Cache.Count + "</b><br />" ); writer.WriteLine("<b>" + info.getContent("stats_cache_content")+ "</b><br />"); writer.WriteLine("<table class='stats_cache_items' >"); foreach( DictionaryEntry item in Page.Cache ) { if( item.Key.ToString().StartsWith("@@") ) { continue; } writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item.Key.ToString()); writer.WriteLine("<td>{0}</td>", item.Value.ToString()); writer.WriteLine("<td><a href='javascript:{1}'><img src='{0}' /></a></td>", OrionGlobals.getCommonImagePath("remove.gif"), "deleteCache(\"" + item.Key.ToString() + "\")" ); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
/// <summary> /// preenche o título /// </summary> private void CreateTitle(ItemsTable itemsTable) { ItemsTableLine line = new ItemsTableLine(); line.add(new ItemsTableText("Id", "resourceTitle")); line.add(new ItemsTableText(info.getContent("battleAdminUser_enemy"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("battleAdminUser_view"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("battleAdminUser_winner"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("battleAdminUser_winner"), "resourceTitle")); line.add(new ItemsTableText(info.getContent("battleAdminUser_remove"), "resourceTitle")); itemsTable.HeaderItem = line; itemsTable.TableTitleCssClass = "resourceTitle"; }
/// <summary>Escreve informações sobre o ApplicationState</summary> private void writeApplicationInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_application_title") + "</b></div>" ); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Application.Count + "</b><br />" ); writer.WriteLine("<b>" + info.getContent("stats_cache_content")+ "</b><br />"); writer.WriteLine("<table class='stats_cache_items'>"); string[] keys = Page.Application.AllKeys; foreach( string item in keys ) { writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item); writer.WriteLine("<td>{0}</td>", Page.Application[item].ToString()); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
private void insertNoFleets() { ItemsTableLine line = new ItemsTableLine(); ItemsTableText item = new ItemsTableText(info.getContent("battle_noFleets"), "resource"); item.ColumnSpan = 4; line.add(item); _itemsTable.addLine(line); }
/// <summary>Traduz uma palavra numa frase localizada</summary> public string translate(string origin) { return(info.getContent(origin)); }
private string RenderMenu() { StringBuilder menu = new StringBuilder(); menu.AppendFormat(@"<table id='battleMenu' class='planetFrame'> <tr> <td class='BattleMenuTitle'> {0} </td> </tr> <tr> <td class='borderBottom'> {1}:<span id='moves'>{2}</span><br/> {3}:<span id='terrain'>{4}</span> </td> </tr> <tr> <td class='borderBottom'> {5}:<input id='quantity' type='text'> {6}:<span id='minquantity'></span><br/> {7}:<span id='maxquantity'></span><br/> </td> </tr> " , info.getContent("battle_menu"), info.getContent("battle_moves"), _numberOfMoves, info.getContent("terrain"), _terrain, info.getContent("battle_insert"), info.getContent("battle_minQuant"), info.getContent("battle_maxQuant") ); if (!_positionTime) { menu.AppendFormat(@"<tr> <td class='BattleMenuTitle'> {0} </td> </tr> <tr> <td class='borderBottom'> {1}:<span id='attackAgainst'></span><br/> {2}:<span id='defenseAgainst'></span><br/> {3}:<span id='targetDefense'></span><br/> {4}:<span id='targetLive'></span><br/> {5}:<span id='damage'></span><br/> </td> </tr>" , info.getContent("battle_info"), info.getContent("battle_attack"), info.getContent("battle_defense"), info.getContent("battle_targetDefense"), info.getContent("battle_targetLive"), info.getContent("battle_unitsDestroyed") ); } menu.AppendFormat(@"<tr> <td class='BattleMenuTitle'> {0} </td> </tr> <tr> <td class='borderBottom'> {1}:<span id='shipType'></span><br/> {2}:<span id='unitQuant'></span><br/> {3}:<span id='baseAttack'></span><br/> {4}:<span id='baseDefense'></span><br/> {5}:<span id='baseLive'></span><br/> {6}:<span id='movementCost'></span><br/> {7}:<span id='movementType'></span><br/> {8}:<span id='range'></span><br/> {9}:<span id='hasAttack'></span><br/> {10}:<span id='hasStrikeBack'></span><br/> {11}:<span id='hasCatapultAttack'></span><br/> {12}:<span id='hasDamageBehindUnits'></span><br/> {13}:<span id='hasTripleAttack'></span><br/> {14}:<span id='hasReplicator'></span><br/> </td> </tr> " , info.getContent("battle_unitInfo"), info.getContent("battle_shipType"), info.getContent("fleet_quant"), info.getContent("battle_attack"), info.getContent("battle_defense"), info.getContent("battle_live"), info.getContent("battle_moveCost"), info.getContent("battle_moveType"), info.getContent("battle_range"), info.getContent("battle_canAttack"), info.getContent("battle_strikeBack"), info.getContent("battle_catapult"), info.getContent("battle_damageBehind"), info.getContent("battle_tripleAttack"), info.getContent("battle_replicator") ); if (!_positionTime) { menu.AppendFormat(@"<tr> <td class='BattleMenuTitle'> {0} </td> </tr> <tr> <td class='borderBottom' align='center'>" + "<input type='button' value='N' onClick='setPosition(\"n\");' /><br/>" + "<input type='button' value='W' onClick='setPosition(\"w\");' /> <input type='button' value='E' onClick='setPosition(\"e\");' /><br/>" + "<input type='button' value='S' onClick='setPosition(\"s\");' /><br/>" + @"</td> </tr>" , info.getContent("battle_position")); } menu.Append("</table>"); menu.Append("<div align='center'><input type='button' value='Undo' onClick='undo();' /> <input type='button' value='Reset' onClick='resetMoves();' /></div>"); return(menu.ToString()); }