private void ConfigureControls() { txtUserName.Focus(); string msgTitle = String.Empty; string msgDetail = String.Empty; if (UserController.RequiresQuestionAndAnswer) { msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Header; msgDetail = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Because_Question_Answer_Is_Enabled_Body; } if (!UserController.EnablePasswordRetrieval) { msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Header; msgDetail = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Because_Password_Retrieval_Is_Disabled_Body; } if (!String.IsNullOrEmpty(msgTitle)) { pnlMsgContainer.Controls.Clear(); GalleryServerPro.Web.Controls.usermessage msgBox = (GalleryServerPro.Web.Controls.usermessage)Page.LoadControl(Util.GetUrl("/controls/usermessage.ascx")); msgBox.IconStyle = GalleryServerPro.Web.MessageStyle.Warning; msgBox.MessageTitle = msgTitle; msgBox.MessageDetail = msgDetail; msgBox.CssClass = "um3ContainerCss gsp_rounded10 gsp_floatcontainer"; msgBox.HeaderCssClass = "um1HeaderCss"; msgBox.DetailCssClass = "um1DetailCss"; pnlMsgContainer.Controls.Add(msgBox); pnlPwdRecoverContainer.Visible = false; } }
private void DisplayMessage(string title, string detail, MessageStyle iconStyle) { pnlMsgContainer.Controls.Clear(); GalleryServerPro.Web.Controls.usermessage msgBox = (GalleryServerPro.Web.Controls.usermessage)Page.LoadControl(Util.GetUrl("/controls/usermessage.ascx")); msgBox.IconStyle = iconStyle; msgBox.MessageTitle = title; msgBox.MessageDetail = detail; msgBox.CssClass = "um3ContainerCss gsp_rounded10 gsp_floatcontainer"; msgBox.HeaderCssClass = "um1HeaderCss"; msgBox.DetailCssClass = "um1DetailCss"; pnlMsgContainer.Controls.Add(msgBox); pnlMsgContainer.Visible = true; }
private void RecoverPassword() { GalleryServerPro.Web.MessageStyle iconStyle = GalleryServerPro.Web.MessageStyle.Warning; string msgTitle; string msgDetail; IUserAccount user = UserController.GetUser(txtUserName.Text, true); if (user == null) { msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Header; msgDetail = String.Format(CultureInfo.CurrentCulture, "<p>{0}</p>", Resources.GalleryServerPro.Anon_Pwd_Recovery_GetUser_Throws_Exception_Message); } else { if (HelperFunctions.IsValidEmail(user.Email)) { // Send user's password in an email. try { EmailController.SendNotificationEmail(user, Entity.EmailTemplateForm.UserNotificationPasswordRecovery, GalleryId, false); msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Confirmation_Title; string url = String.Format(CultureInfo.CurrentCulture, " <a href='{0}'>{1}</a>", Web.Util.GetUrl(PageId.login), Resources.GalleryServerPro.Login_Button_Text); msgDetail = String.Concat(String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Anon_Pwd_Recovery_Confirmation_Body, user.Email), url); iconStyle = GalleryServerPro.Web.MessageStyle.Information; pnlPwdRecoverContainer.Visible = false; } catch (Exception ex) { string errorMsg; if (this.GallerySettings.ShowErrorDetails) { errorMsg = Util.GetExceptionDetails(ex); } else { errorMsg = Resources.GalleryServerPro.Error_Generic_Msg; } msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Header; msgDetail = "<p>" + String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Generic_Error, errorMsg) + "</p>"; } } else // User is valid but does not have a valid email { msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Header; msgDetail = String.Format(CultureInfo.CurrentCulture, "<p>{0}</p>", Resources.GalleryServerPro.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Invalid_Email); } } #region Render Confirmation Message pnlMsgContainer.Controls.Clear(); GalleryServerPro.Web.Controls.usermessage msgBox = (GalleryServerPro.Web.Controls.usermessage)Page.LoadControl(Util.GetUrl("/controls/usermessage.ascx")); msgBox.IconStyle = iconStyle; msgBox.MessageTitle = msgTitle; msgBox.MessageDetail = msgDetail; msgBox.CssClass = "um3ContainerCss"; msgBox.HeaderCssClass = "um1HeaderCss"; msgBox.DetailCssClass = "um1DetailCss"; pnlMsgContainer.Controls.Add(msgBox); #endregion }
protected void cbEditRole_Callback(object sender, ComponentArt.Web.UI.CallBackEventArgs e) { //return; // There should be two strings in the Parameters property. The first indicates the requested operation // (edit, save, etc). The second is the name of the role. try { if (e.Parameters.Length != 2) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "The cbEditRole_Callback is expecting two items in the parameter list, but received {0} items. The first item should be a string equal to 'add', 'edit', or 'save', and the second item should be a string containing the role name (should be empty if the first parameter = 'add').", e.Parameters.Length)); } string roleName = Util.HtmlDecode(e.Parameters[1]); switch (e.Parameter) { case "add": case "edit": { SetControlVisibility(roleName); PopulateControlsWithRoleData(roleName); // Render the controls with the updated information. FindControlRecursive(dgEditRole, "pnlDialogContent").RenderControl(e.Output); break; } case "save": { ValidateSaveRole(roleName); SaveRole(roleName); // Empty the cache so the next request will pull them from the data store. HelperFunctions.PurgeCache(); // Write a little javascript to set a page variable that will be used during the OnCallbackComplete // event to close the dialog when the call is successful. e.Output.Write("<script type=\"text/javascript\">callbackStatus = 'success';</script>"); break; } case "adminSelected": { // The user selected the Administer site permission. Since this permission applies to all albums, we need // to select all the checkboxes for all albums. I couldn't get this to work on the client by calling checkAll(), // so I resorted to invoking this callback. BindAlbumTreeview(true); // Render the controls with the updated information. FindControlRecursive(dgEditRole, "pnlDialogContent").RenderControl(e.Output); break; } } } catch (Exception ex) { GalleryServerPro.Web.Controls.usermessage msgBox = (GalleryServerPro.Web.Controls.usermessage)LoadControl(Util.GetUrl("/controls/usermessage.ascx")); msgBox.IconStyle = GalleryServerPro.Web.MessageStyle.Error; msgBox.MessageTitle = Resources.GalleryServerPro.Admin_Manage_Roles_Cannot_Save_Role_Msg; msgBox.MessageDetail = ex.Message; phMessage.Controls.Add(msgBox); FindControlRecursive(dgEditRole, "pnlDialogContent").RenderControl(e.Output); } }