using System; using System.Web.UI.WebControls; using SiberTek.Xenta.Presentation; using SiberTek.Xenta.Presentation.Utils; using SiberTek.Xenta.Presentation.Resources; using SiberTek.Xenta.Web.Forum.Modules; using SiberTek.Xenta.Web.Pages; using SiberTek.Xenta.Web.Utils; using SiberTek.Xenta.Utils; namespace SiberTek.Xenta.Web.Forum.Pages { public partial class ProfilePage : ForumPageBase { #region Properties public override bool IsAccessAllowed { get { return base.IsAccessAllowed && UserContext.Current.IsAuthenticated; } } #endregion #region Handlers protected override void OnInit(EventArgs e) { if(!IsPostBack) { btnSaveAvatar.CommandName = "Save"; btnSaveAvatar.Text = StringManager.GetString("Forum.ProfilePage.btnSaveAvatar.Text"); btnSaveSignature.CommandName = "Save"; btnSaveSignature.Text = StringManager.GetString("Forum.ProfilePage.btnSaveSignature.Text"); lblTabAvatar.Text = StringManager.GetString("Forum.ProfilePage.lblTabAvatar.Text"); lblTabSignature.Text = StringManager.GetString("Forum.ProfilePage.lblTabSignature.Text"); lblTabSubscriptions.Text = StringManager.GetString("Forum.ProfilePage.lblTabSubscriptions.Text"); lblAvatar.Text = StringManager.GetString("Forum.ProfilePage.lblAvatar.Text"); lblAvatarInfo.Text = StringManager.GetString("Forum.ProfilePage.lblAvatarInfo.Text"); lblSignature.Text = StringManager.GetString("Forum.ProfilePage.lblSignature.Text"); lblSignatureInfo.Text = StringManager.GetString("Forum.ProfilePage.lblSignatureInfo.Text"); } btnSaveAvatar.Command += OnCommand; btnSaveSignature.Command += OnCommand; base.OnInit(e); } protected override void OnLoadComplete(EventArgs e) { if(!IsPostBack) { txtAvatarUrl.Text = ForumHelper.GetUserForumAvatar(UserContext.Current.UserID); txtSignature.Text = ForumHelper.GetUserForumSignature(UserContext.Current.UserID); grdForumSubscriptionGrid.BindData(); ctlBreadcrumb.Items.Add(new Breadcrumb.Item(StringManager.GetString("Forum.HomePage.Title"), UrlHelper.GetUrl("forum"))); ctlBreadcrumb.Items.Add(new Breadcrumb.Item(StringManager.GetString("Forum.ProfilePage.Title"))); ctlBreadcrumb.BindData(); } base.OnLoadComplete(e); } protected override void OnPreRender(EventArgs e) { if(!IsPostBack) { lblAvatarInfo.Text = String.Format(StringManager.GetString("Forum.ProfilePage.lblAvatarInfo.Text"), SystemHelper.GetSystemParam("ForumAvatar.MaxFileSize")); } base.OnPreRender(e); } protected void OnCommand(object sender, CommandEventArgs e) { switch(e.CommandName) { case "Save": { try { if(sender.Equals(btnSaveAvatar)) { ForumHelper.SetUserForumAvatar(UserContext.Current.UserID, txtAvatarUrl.Text); } else if(sender.Equals(btnSaveSignature)) { ForumHelper.SetUserForumSignature(UserContext.Current.UserID, StringHelper.StripTags(txtSignature.Text)); } } catch(Exception ex) { ShowMessage(ex.Message); } } break; } } #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The MIT License