/// <summary> /// AddLocalizedModuleMessage adds a localized module message /// </summary> /// <param name="message">The localized message</param> /// <param name="type">The type of message</param> /// <param name="display">A flag that determines whether the message should be displayed</param> protected void AddLocalizedModuleMessage(string message, ModuleMessage.ModuleMessageType type, bool display) { if (display) { UI.Skins.Skin.AddModuleMessage(this, message, type); } }
/// <summary> /// /// </summary> /// <param name="thisModule"></param> /// <param name="moduleContainer"></param> /// <returns></returns> public static ModuleMessage.ModuleMessageType LoadModuleControl(PortalModuleBase thisModule, PlaceHolder moduleContainer) { ModuleMessage.ModuleMessageType result = ModuleMessage.ModuleMessageType.RedError; try { Components.SettingsRepository _settingsCtrl = new Components.SettingsRepository(thisModule.ModuleContext.ModuleId, thisModule.ModuleContext.TabModuleId); if (!String.IsNullOrEmpty(_settingsCtrl.ModuleView)) { string modulePath = String.Format("{0}/{1}", thisModule.TemplateSourceDirectory, _settingsCtrl.ModuleView); var objControl = thisModule.LoadControl(modulePath) as PortalModuleBase; if (objControl != null) { moduleContainer.Controls.Clear(); objControl.ModuleContext.Configuration = thisModule.ModuleContext.Configuration; objControl.LocalResourceFile = thisModule.LocalResourceFile.Replace("Dispatch", _settingsCtrl.ModuleView.Replace(".ascx", "")); objControl.ID = System.IO.Path.GetFileNameWithoutExtension(modulePath); moduleContainer.Controls.Add(objControl); result = ModuleMessage.ModuleMessageType.GreenSuccess; } } if (result != ModuleMessage.ModuleMessageType.GreenSuccess) { result = ModuleMessage.ModuleMessageType.YellowWarning; } } catch (Exception ex) { Exceptions.LogException(ex); result = ModuleMessage.ModuleMessageType.RedError; } return(result); }
private void ShowMessage(PlaceHolder phMessage, string message, ModuleMessage.ModuleMessageType messageType) { HtmlGenericControl div = new HtmlGenericControl("div"); switch (messageType) { case ModuleMessage.ModuleMessageType.GreenSuccess: div.Attributes.Add("class", "dnnFormMessage dnnFormSuccess"); break; case ModuleMessage.ModuleMessageType.YellowWarning: div.Attributes.Add("class", "dnnFormMessage dnnFormWarning"); break; case ModuleMessage.ModuleMessageType.RedError: div.Attributes.Add("class", "dnnFormMessage dnnFormError"); break; case ModuleMessage.ModuleMessageType.BlueInfo: div.Attributes.Add("class", "dnnFormMessage dnnFormInfo"); break; default: throw new ArgumentOutOfRangeException("messageType"); } HtmlGenericControl span = new HtmlGenericControl("span"); span.InnerHtml = message; div.Controls.Add(span); phMessage.Controls.Add(div); }
protected void ShowMessage(string messageHeader, string message, ModuleMessage.ModuleMessageType messageType, bool localize) { if (!string.IsNullOrEmpty(message)) { if (localize) { messageHeader = LocalizeString(messageHeader); message = LocalizeString(message); } View.ShowMessage(messageHeader, message, messageType); } }
protected void Page_Load(object sender, EventArgs e) { ModuleMessage.ModuleMessageType result = FeatureController.LoadModuleControl(this, phModuleControl); if (result == ModuleMessage.ModuleMessageType.YellowWarning) { DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, LocalizeString("LoadControlWarning"), result); } else if (result == ModuleMessage.ModuleMessageType.RedError) { DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, LocalizeString("LoadControlError"), result); } }
/// <summary> /// Display a preview of the message to be sent out /// </summary> /// <param name="sender">ignored</param> /// <param name="e">ignores</param> /// <history> /// [vmasanas] 2007-09-07 added /// </history> protected void OnPreviewClick(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(txtSubject.Text) || String.IsNullOrEmpty(teMessage.Text)) { //no subject or message var strResult = Localization.GetString("MessageValidation", LocalResourceFile); const ModuleMessage.ModuleMessageType msgResult = ModuleMessage.ModuleMessageType.YellowWarning; UI.Skins.Skin.AddModuleMessage(this, strResult, msgResult); ((CDefault)Page).ScrollToControl(Page.Form); return; } //convert links to absolute var strBody = teMessage.Text; const string pattern = "<(a|link|img|script|object).[^>]*(href|src|action)=(\\\"|'|)(?<url>(.[^\\\"']*))(\\\"|'|)[^>]*>"; strBody = Regex.Replace(strBody, pattern, FormatUrls); if (chkReplaceTokens.Checked) { var objTr = new TokenReplace(); if (cboSendMethod.SelectedItem.Value == "TO") { objTr.User = UserInfo; objTr.AccessingUser = UserInfo; objTr.DebugMessages = true; } lblPreviewSubject.Text = objTr.ReplaceEnvironmentTokens(txtSubject.Text); lblPreviewBody.Text = objTr.ReplaceEnvironmentTokens(strBody); } else { lblPreviewSubject.Text = txtSubject.Text; lblPreviewBody.Text = strBody; } pnlPreview.Visible = true; } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// GetModuleMessageControl gets an existing Message Control and sets its properties. /// </summary> /// <param name="heading">The Message Heading.</param> /// <param name="message">The Message Text.</param> /// <param name="iconImage">The Message Icon.</param> /// <param name="moduleMessageType">The type of message.</param> /// <returns></returns> /// ----------------------------------------------------------------------------- public static ModuleMessage GetModuleMessageControl(string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType, string iconImage) { // Use this to get a module message control // with a standard DotNetNuke icon var s = new Skin(); var moduleMessage = (ModuleMessage)s.LoadControl("~/admin/skins/ModuleMessage.ascx"); moduleMessage.Heading = heading; moduleMessage.Text = message; moduleMessage.IconImage = iconImage; moduleMessage.IconType = moduleMessageType; return(moduleMessage); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetModuleMessageControl gets an existing Message Control and sets its properties. /// </summary> /// <param name="heading">The Message Heading.</param> /// <param name="message">The Message Text.</param> /// <param name="moduleMessageType">The type of message.</param> /// <returns></returns> /// ----------------------------------------------------------------------------- public static ModuleMessage GetModuleMessageControl(string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType) { return(GetModuleMessageControl(heading, message, moduleMessageType, Null.NullString)); }
/// ----------------------------------------------------------------------------- /// <summary> /// AddPageMessage adds a Page Message control to the Skin. /// </summary> /// <param name="heading">The Message Heading.</param> /// <param name="message">The Message Text.</param> /// <param name="page">The Page.</param> /// <param name="moduleMessageType">The type of the message.</param> /// ----------------------------------------------------------------------------- public static void AddPageMessage(Page page, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType) { AddPageMessage(page, heading, message, moduleMessageType, Null.NullString); }
protected void ShowMessage(string messageHeader, string message, ModuleMessage.ModuleMessageType messageType) { this.ShowMessage(messageHeader, message, messageType, true); }
protected void ShowMessage(string message, ModuleMessage.ModuleMessageType messageType, bool localize) { ShowMessage(string.Empty, message, messageType, localize); }
public void ShowMessage(string messageHeader, string message, ModuleMessage.ModuleMessageType messageType) { DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, messageHeader, message, messageType); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 5/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- private void cmdUpdate_Click(Object sender, EventArgs e) { if (Page.IsValid) { PortalController.PortalTemplateInfo template = LoadPortalTemplateInfoForSelectedItem(); try { bool blnChild; string strPortalAlias; string strChildPath = string.Empty; var closePopUpStr = string.Empty; var objPortalController = new PortalController(); //check template validity var messages = new ArrayList(); string schemaFilename = Server.MapPath(string.Concat(AppRelativeTemplateSourceDirectory, "portal.template.xsd")); string xmlFilename = template.TemplateFilePath; var xval = new PortalTemplateValidator(); if (!xval.Validate(xmlFilename, schemaFilename)) { UI.Skins.Skin.AddModuleMessage(this, "", String.Format(Localization.GetString("InvalidTemplate", LocalResourceFile), Path.GetFileName(template.TemplateFilePath)), ModuleMessage.ModuleMessageType.RedError); messages.AddRange(xval.Errors); lstResults.Visible = true; lstResults.DataSource = messages; lstResults.DataBind(); validationPanel.Visible = true; return; } //Set Portal Name txtPortalAlias.Text = txtPortalAlias.Text.ToLowerInvariant(); txtPortalAlias.Text = txtPortalAlias.Text.Replace("http://", ""); //Validate Portal Name if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { blnChild = true; strPortalAlias = txtPortalAlias.Text; } else { blnChild = (optType.SelectedValue == "C"); strPortalAlias = blnChild ? PortalController.GetPortalFolder(txtPortalAlias.Text) : txtPortalAlias.Text; } string message = String.Empty; ModuleMessage.ModuleMessageType messageType = ModuleMessage.ModuleMessageType.RedError; if (!PortalAliasController.ValidateAlias(strPortalAlias, blnChild)) { message = Localization.GetString("InvalidName", LocalResourceFile); } //check whether have conflict between tab path and portal alias. var checkTabPath = string.Format("//{0}", strPortalAlias); if (TabController.GetTabByTabPath(PortalSettings.PortalId, checkTabPath, string.Empty) != Null.NullInteger || TabController.GetTabByTabPath(Null.NullInteger, checkTabPath, string.Empty) != Null.NullInteger) { message = Localization.GetString("DuplicateWithTab", LocalResourceFile); } //Validate Password if (txtPassword.Text != txtConfirm.Text) { if (!String.IsNullOrEmpty(message)) { message += "<br/>"; } message += Localization.GetString("InvalidPassword", LocalResourceFile); } string strServerPath = Globals.GetAbsoluteServerPath(Request); //Set Portal Alias for Child Portals if (String.IsNullOrEmpty(message)) { if (blnChild) { strChildPath = strServerPath + strPortalAlias; if (Directory.Exists(strChildPath)) { message = Localization.GetString("ChildExists", LocalResourceFile); } else { if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { strPortalAlias = Globals.GetDomainName(Request, true) + "/" + strPortalAlias; } else { strPortalAlias = txtPortalAlias.Text; } } } } //Get Home Directory string homeDir = txtHomeDirectory.Text != @"Portals/[PortalID]" ? txtHomeDirectory.Text : ""; //Validate Home Folder if (!string.IsNullOrEmpty(homeDir)) { if (string.IsNullOrEmpty(String.Format("{0}\\{1}\\", Globals.ApplicationMapPath, homeDir).Replace("/", "\\"))) { message = Localization.GetString("InvalidHomeFolder", LocalResourceFile); } if (homeDir.Contains("admin") || homeDir.Contains("DesktopModules") || homeDir.ToLowerInvariant() == "portals/") { message = Localization.GetString("InvalidHomeFolder", LocalResourceFile); } } //Validate Portal Alias if (!string.IsNullOrEmpty(strPortalAlias)) { PortalAliasInfo portalAlias = PortalAliasController.GetPortalAliasLookup(strPortalAlias.ToLower()); if (portalAlias != null) { message = Localization.GetString("DuplicatePortalAlias", LocalResourceFile); } } //Create Portal if (String.IsNullOrEmpty(message)) { //Attempt to create the portal UserInfo adminUser = new UserInfo(); int intPortalId; try { if (useCurrent.Checked) { adminUser = UserInfo; intPortalId = objPortalController.CreatePortal(txtPortalName.Text, adminUser.UserID, txtDescription.Text, txtKeyWords.Text, template, homeDir, strPortalAlias, strServerPath, strChildPath, blnChild); } else { adminUser = new UserInfo { FirstName = txtFirstName.Text, LastName = txtLastName.Text, Username = txtUsername.Text, DisplayName = txtFirstName.Text + " " + txtLastName.Text, Email = txtEmail.Text, IsSuperUser = false, Membership = { Approved = true, Password = txtPassword.Text, PasswordQuestion = txtQuestion.Text, PasswordAnswer = txtAnswer.Text }, Profile = { FirstName = txtFirstName.Text, LastName = txtLastName.Text } }; intPortalId = objPortalController.CreatePortal(txtPortalName.Text, adminUser, txtDescription.Text, txtKeyWords.Text, template, homeDir, strPortalAlias, strServerPath, strChildPath, blnChild); } } catch (Exception ex) { intPortalId = Null.NullInteger; message = ex.Message; } if (intPortalId != -1) { //Create a Portal Settings object for the new Portal PortalInfo objPortal = objPortalController.GetPortal(intPortalId); var newSettings = new PortalSettings { PortalAlias = new PortalAliasInfo { HTTPAlias = strPortalAlias }, PortalId = intPortalId, DefaultLanguage = objPortal.DefaultLanguage }; string webUrl = Globals.AddHTTP(strPortalAlias); try { if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { message = Mail.SendMail(PortalSettings.Email, txtEmail.Text, PortalSettings.Email + ";" + Host.HostEmail, Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", adminUser), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", adminUser), "", "", "", "", "", ""); } else { message = Mail.SendMail(Host.HostEmail, txtEmail.Text, Host.HostEmail, Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", adminUser), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", adminUser), "", "", "", "", "", ""); } } catch (Exception exc) { Logger.Error(exc); closePopUpStr = (PortalSettings.EnablePopUps) ? "onclick=\"return " + UrlUtils.ClosePopUp(true, webUrl, true) + "\"" : ""; message = string.Format(Localization.GetString("UnknownSendMail.Error", LocalResourceFile), webUrl, closePopUpStr); } var objEventLog = new EventLogController(); objEventLog.AddLog(objPortalController.GetPortal(intPortalId), PortalSettings, UserId, "", EventLogController.EventLogType.PORTAL_CREATED); // mark default language as published if content localization is enabled bool ContentLocalizationEnabled = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", PortalId, false); if (ContentLocalizationEnabled) { LocaleController lc = new LocaleController(); lc.PublishLanguage(intPortalId, objPortal.DefaultLanguage, true); } //Redirect to this new site if (message == Null.NullString) { webUrl = (PortalSettings.EnablePopUps) ? UrlUtils.ClosePopUp(true, webUrl, false) : webUrl; Response.Redirect(webUrl, true); } else { closePopUpStr = (PortalSettings.EnablePopUps) ? "onclick=\"return " + UrlUtils.ClosePopUp(true, webUrl, true) + "\"" : ""; message = string.Format(Localization.GetString("SendMail.Error", LocalResourceFile), message, webUrl, closePopUpStr); messageType = ModuleMessage.ModuleMessageType.YellowWarning; } } } UI.Skins.Skin.AddModuleMessage(this, "", message, messageType); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } } }
private bool IsReadyToSend(List <string> roleNames, List <UserInfo> users, ref string message, ref ModuleMessage.ModuleMessageType messageType) { if (String.IsNullOrEmpty(txtSubject.Text) || String.IsNullOrEmpty(teMessage.Text)) { message = Localization.GetString("MessageValidation", LocalResourceFile); messageType = ModuleMessage.ModuleMessageType.RedError; return(false); } if (users.Count == 0 && roleNames.Count == 0) { message = string.Format(Localization.GetString("NoRecipients", LocalResourceFile), -1); messageType = ModuleMessage.ModuleMessageType.YellowWarning; return(false); } return(true); }
private bool PrepareEmail(SendTokenizedBulkEmail email, ref string message, ref ModuleMessage.ModuleMessageType messageType) { bool isValid = true; switch (teMessage.Mode) { case "RICH": email.BodyFormat = MailFormat.Html; break; default: email.BodyFormat = MailFormat.Text; break; } switch (cboPriority.SelectedItem.Value) { case "1": email.Priority = MailPriority.High; break; case "2": email.Priority = MailPriority.Normal; break; case "3": email.Priority = MailPriority.Low; break; default: isValid = false; break; } if (txtFrom.Text != string.Empty && email.SendingUser.Email != txtFrom.Text) { var myUser = email.SendingUser ?? new UserInfo(); myUser.Email = txtFrom.Text; email.SendingUser = myUser; } if (txtReplyTo.Text != string.Empty && email.ReplyTo.Email != txtReplyTo.Text) { var myUser = new UserInfo { Email = txtReplyTo.Text }; email.ReplyTo = myUser; } if (selLanguage.Visible && selLanguage.SelectedLanguages != null) { email.LanguageFilter = selLanguage.SelectedLanguages; } if (ctlAttachment.Url.StartsWith("FileID=")) { int fileId = int.Parse(ctlAttachment.Url.Substring(7)); var objFileInfo = FileManager.Instance.GetFile(fileId); //TODO: support secure storage locations for attachments! [sleupold 06/15/2007] email.AddAttachment(FileManager.Instance.GetFileContent(objFileInfo), new ContentType { MediaType = objFileInfo.ContentType, Name = objFileInfo.FileName }); } switch (cboSendMethod.SelectedItem.Value) { case "TO": email.AddressMethod = SendTokenizedBulkEmail.AddressMethods.Send_TO; break; case "BCC": email.AddressMethod = SendTokenizedBulkEmail.AddressMethods.Send_BCC; break; case "RELAY": email.AddressMethod = SendTokenizedBulkEmail.AddressMethods.Send_Relay; if (string.IsNullOrEmpty(txtRelayAddress.Text)) { message = string.Format(Localization.GetString("MessagesSentCount", LocalResourceFile), -1); messageType = ModuleMessage.ModuleMessageType.YellowWarning; isValid = false; } else { email.RelayEmailAddress = txtRelayAddress.Text; } break; } email.SuppressTokenReplace = !chkReplaceTokens.Checked; return(isValid); }
private void SendMailSynchronously(SendTokenizedBulkEmail email, out string strResult, out ModuleMessage.ModuleMessageType msgResult) { int mailsSent = email.SendMails(); if (mailsSent > 0) { strResult = string.Format(Localization.GetString("MessagesSentCount", LocalResourceFile), mailsSent); msgResult = ModuleMessage.ModuleMessageType.GreenSuccess; } else { strResult = string.Format(Localization.GetString("NoMessagesSent", LocalResourceFile), email.SendingUser.Email); msgResult = ModuleMessage.ModuleMessageType.YellowWarning; } }
private void SendMailAsyncronously(SendTokenizedBulkEmail email, out string message, out ModuleMessage.ModuleMessageType messageType) { //First send off a test message var strStartSubj = Localization.GetString("EMAIL_BulkMailStart_Subject.Text", Localization.GlobalResourceFile); if (!string.IsNullOrEmpty(strStartSubj)) { strStartSubj = string.Format(strStartSubj, txtSubject.Text); } var strStartBody = Localization.GetString("EMAIL_BulkMailStart_Body.Text", Localization.GlobalResourceFile); if (!string.IsNullOrEmpty(strStartBody)) { strStartBody = string.Format(strStartBody, txtSubject.Text, UserInfo.DisplayName, email.Recipients().Count); } var sendMailResult = Mail.SendMail(txtFrom.Text, txtFrom.Text, "", "", MailPriority.Normal, strStartSubj, MailFormat.Text, Encoding.UTF8, strStartBody, "", Host.SMTPServer, Host.SMTPAuthentication, Host.SMTPUsername, Host.SMTPPassword, Host.EnableSMTPSSL); if (string.IsNullOrEmpty(sendMailResult)) { var objThread = new Thread(() => SendAndDispose(email)); objThread.Start(); message = Localization.GetString("MessageSent", LocalResourceFile); messageType = ModuleMessage.ModuleMessageType.GreenSuccess; } else { message = string.Format(Localization.GetString("NoMessagesSentPlusError", LocalResourceFile), sendMailResult); messageType = ModuleMessage.ModuleMessageType.YellowWarning; } }
private void SendEmail(List <string> roleNames, List <UserInfo> users, ref string message, ref ModuleMessage.ModuleMessageType messageType) { //it is awkward to ensure that email is disposed correctly because when sent asynch it should be disposed by the asynch thread var email = new SendTokenizedBulkEmail(roleNames, users, /*removeDuplicates*/ true, txtSubject.Text, ConvertToAbsoluteUrls(teMessage.Text)); bool isValid; try { isValid = PrepareEmail(email, ref message, ref messageType); } catch (Exception) { email.Dispose(); throw; } if (isValid) { if (optSendAction.SelectedItem.Value == "S") { try { SendMailSynchronously(email, out message, out messageType); } finally { email.Dispose(); } } else { SendMailAsyncronously(email, out message, out messageType); //dispose will be handled by async thread } } }
protected string CompleteUserCreation(UserCreateStatus createStatus, UserInfo newUser, bool notify, bool register) { string strMessage = ""; ModuleMessage.ModuleMessageType message = ModuleMessage.ModuleMessageType.RedError; if (register) { //send notification to portal administrator of new user registration //check the receive notification setting first, but if register type is Private, we will always send the notification email. //because the user need administrators to do the approve action so that he can continue use the website. if (PortalSettings.EnableRegisterNotification || PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.PrivateRegistration) { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationAdmin, PortalSettings); SendAdminNotification(newUser, "NewUserRegistration", PortalSettings); } var loginStatus = UserLoginStatus.LOGIN_FAILURE; //complete registration switch (PortalSettings.UserRegistration) { case (int)Globals.PortalRegistrationType.PrivateRegistration: strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationPrivate, PortalSettings); //show a message that a portal administrator has to verify the user credentials if (string.IsNullOrEmpty(strMessage)) { strMessage += string.Format(Localization.GetString("PrivateConfirmationMessage", Localization.SharedResourceFile), newUser.Email); message = ModuleMessage.ModuleMessageType.GreenSuccess; } break; case (int)Globals.PortalRegistrationType.PublicRegistration: Mail.SendMail(newUser, MessageType.UserRegistrationPublic, PortalSettings); UserController.UserLogin(PortalSettings.PortalId, newUser.Username, newUser.Membership.Password, "", PortalSettings.PortalName, "", ref loginStatus, false); break; case (int)Globals.PortalRegistrationType.VerifiedRegistration: Mail.SendMail(newUser, MessageType.UserRegistrationVerified, PortalSettings); UserController.UserLogin(PortalSettings.PortalId, newUser.Username, newUser.Membership.Password, "", PortalSettings.PortalName, "", ref loginStatus, false); break; } //affiliate if (!Null.IsNull(User.AffiliateID)) { var objAffiliates = new AffiliateController(); objAffiliates.UpdateAffiliateStats(newUser.AffiliateID, 0, 1); } //store preferredlocale in cookie Localization.SetLanguage(newUser.Profile.PreferredLocale); if (IsRegister && message == ModuleMessage.ModuleMessageType.RedError) { AddLocalizedModuleMessage(string.Format(Localization.GetString("SendMail.Error", Localization.SharedResourceFile), strMessage), message, (!String.IsNullOrEmpty(strMessage))); } else { AddLocalizedModuleMessage(strMessage, message, (!String.IsNullOrEmpty(strMessage))); } } else { if (notify) { //Send Notification to User if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationVerified, PortalSettings); } else { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationPublic, PortalSettings); } } } return(strMessage); }
protected static ActionResult CompleteUserCreation(UserCreateStatus createStatus, UserInfo newUser, bool notify, bool register) { ActionResult actionResult = new ActionResult(); string strMessage = ""; ModuleMessage.ModuleMessageType message = ModuleMessage.ModuleMessageType.RedError; if (register) { //send notification to portal administrator of new user registration //check the receive notification setting first, but if register type is Private, we will always send the notification email. //because the user need administrators to do the approve action so that he can continue use the website. if (PortalSettings.Current.EnableRegisterNotification || PortalSettings.Current.UserRegistration == (int)Globals.PortalRegistrationType.PrivateRegistration) { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationAdmin, PortalController.Instance.GetCurrentSettings() as PortalSettings); SendAdminNotification(newUser, PortalController.Instance.GetCurrentSettings() as PortalSettings); } UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE; //complete registration switch (PortalSettings.Current.UserRegistration) { case (int)Globals.PortalRegistrationType.PrivateRegistration: strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationPrivate, PortalController.Instance.GetCurrentSettings() as PortalSettings); //show a message that a portal administrator has to verify the user credentials if (string.IsNullOrEmpty(strMessage)) { strMessage += Localization.GetString("PrivateConfirmationMessage", Localization.SharedResourceFile); message = ModuleMessage.ModuleMessageType.GreenSuccess; } break; case (int)Globals.PortalRegistrationType.PublicRegistration: Mail.SendMail(newUser, MessageType.UserRegistrationPublic, PortalController.Instance.GetCurrentSettings() as PortalSettings); UserController.UserLogin(PortalSettings.Current.PortalId, newUser.Username, newUser.Membership.Password, "", PortalSettings.Current.PortalName, "", ref loginStatus, false); break; case (int)Globals.PortalRegistrationType.VerifiedRegistration: Mail.SendMail(newUser, MessageType.UserRegistrationVerified, PortalController.Instance.GetCurrentSettings() as PortalSettings); UserController.UserLogin(PortalSettings.Current.PortalId, newUser.Username, newUser.Membership.Password, "", PortalSettings.Current.PortalName, "", ref loginStatus, false); break; } //store preferredlocale in cookie Localization.SetLanguage(newUser.Profile.PreferredLocale); if (!(HttpContext.Current.Request.IsAuthenticated && PortalSecurity.IsInRole(PortalSettings.Current.AdministratorRoleName)) && !(HttpContext.Current.Request.IsAuthenticated && (newUser.UserID == (PortalController.Instance.GetCurrentSettings() as PortalSettings).UserInfo.UserID)) && message == ModuleMessage.ModuleMessageType.RedError) { //HS Skin Messages //actionResult.AddError("SendMail_Error", string.Format(Localization.GetString("SendMail.Error", Localization.SharedResourceFile), newUser.Email)); Exceptions.LogException(new Exception("Skin Messages : " + string.Format(Localization.GetString("SendMail.Error", Localization.SharedResourceFile), newUser.Email))); actionResult.Message = strMessage; } else { if (message == ModuleMessage.ModuleMessageType.RedError) { actionResult.AddError("CompleteUserCreation", strMessage); } else { actionResult.Message = strMessage; } } } else { if (notify) { //Send Notification to User if (PortalSettings.Current.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationVerified, PortalController.Instance.GetCurrentSettings() as PortalSettings); } else { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationPublic, PortalController.Instance.GetCurrentSettings() as PortalSettings); } } } actionResult.Message = strMessage; return(actionResult); }
/// <summary> /// AddModuleMessage adds a module message /// </summary> /// <param name="message">The message</param> /// <param name="type">The type of message</param> /// <param name="display">A flag that determines whether the message should be displayed</param> protected void AddModuleMessage(string message, ModuleMessage.ModuleMessageType type, bool display) { AddLocalizedModuleMessage(Localization.GetString(message, LocalResourceFile), type, display); }
public static void AddModuleMessage(PortalModuleBase control, string message, ModuleMessage.ModuleMessageType moduleMessageType) { AddModuleMessage(control, string.Empty, message, moduleMessageType, Null.NullString); }
/// ----------------------------------------------------------------------------- /// <summary> /// AddModuleMessage adds a module message /// </summary> /// <param name="message">The message</param> /// <param name="type">The type of message</param> /// <history> /// [cnurse] 08/24/2006 /// </history> /// ----------------------------------------------------------------------------- private void AddModuleMessage(string message, ModuleMessage.ModuleMessageType type) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString(message, LocalResourceFile), type); }
private static void AddPageMessage(Control control, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType, string iconSrc) { if (!string.IsNullOrEmpty(message)) { Control contentPane = FindControlRecursive(control, Globals.glbDefaultPane); if (contentPane != null) { ModuleMessage moduleMessage = GetModuleMessageControl(heading, message, moduleMessageType, iconSrc); contentPane.Controls.AddAt(0, moduleMessage); } } }
protected void ShowMessage(string message, ModuleMessage.ModuleMessageType messageType) { ShowMessage(message, messageType, true); }
/// ----------------------------------------------------------------------------- /// <summary> /// AddModuleMessage adds a Moduel Message control to the Skin. /// </summary> /// <param name="heading">The Message Heading.</param> /// <param name="message">The Message Text.</param> /// <param name="control">The current control.</param> /// <param name="moduleMessageType">The type of the message.</param> /// ----------------------------------------------------------------------------- public static void AddModuleMessage(Control control, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType) { AddModuleMessage(control, heading, message, moduleMessageType, Null.NullString); }
private static void AddModuleMessage(Control control, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType, string iconSrc) { if (control != null) { if (!string.IsNullOrEmpty(message)) { var messagePlaceHolder = ControlUtilities.FindControl <PlaceHolder>(control, "MessagePlaceHolder", true); if (messagePlaceHolder != null) { messagePlaceHolder.Visible = true; ModuleMessage moduleMessage = GetModuleMessageControl(heading, message, moduleMessageType, iconSrc); messagePlaceHolder.Controls.Add(moduleMessage); } } } }
protected string CompleteUserCreation(UserCreateStatus createStatus, UserInfo newUser, bool notify, bool register) { string strMessage = ""; ModuleMessage.ModuleMessageType message = ModuleMessage.ModuleMessageType.RedError; if (register) { //send notification to portal administrator of new user registration strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationAdmin, PortalSettings); var loginStatus = UserLoginStatus.LOGIN_FAILURE; //complete registration switch (PortalSettings.UserRegistration) { case (int)Globals.PortalRegistrationType.PrivateRegistration: strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationPrivate, PortalSettings); //show a message that a portal administrator has to verify the user credentials if (string.IsNullOrEmpty(strMessage)) { strMessage += string.Format(Localization.GetString("PrivateConfirmationMessage", Localization.SharedResourceFile), newUser.Email); message = ModuleMessage.ModuleMessageType.GreenSuccess; } break; case (int)Globals.PortalRegistrationType.PublicRegistration: Mail.SendMail(newUser, MessageType.UserRegistrationPublic, PortalSettings); UserController.UserLogin(PortalSettings.PortalId, newUser.Username, newUser.Membership.Password, "", PortalSettings.PortalName, "", ref loginStatus, false); break; case (int)Globals.PortalRegistrationType.VerifiedRegistration: Mail.SendMail(newUser, MessageType.UserRegistrationVerified, PortalSettings); UserController.UserLogin(PortalSettings.PortalId, newUser.Username, newUser.Membership.Password, "", PortalSettings.PortalName, "", ref loginStatus, false); break; } //affiliate if (!Null.IsNull(User.AffiliateID)) { var objAffiliates = new AffiliateController(); objAffiliates.UpdateAffiliateStats(newUser.AffiliateID, 0, 1); } //store preferredlocale in cookie Localization.SetLanguage(newUser.Profile.PreferredLocale); if (IsRegister && message == ModuleMessage.ModuleMessageType.RedError) { AddLocalizedModuleMessage(string.Format(Localization.GetString("SendMail.Error", Localization.SharedResourceFile), strMessage), message, (!String.IsNullOrEmpty(strMessage))); } else { AddLocalizedModuleMessage(strMessage, message, (!String.IsNullOrEmpty(strMessage))); } } else { if (notify) { //Send Notification to User if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationVerified, PortalSettings); } else { strMessage += Mail.SendMail(newUser, MessageType.UserRegistrationPublic, PortalSettings); } } } //Log Event to Event Log var objEventLog = new EventLogController(); objEventLog.AddLog(newUser, PortalSettings, UserId, newUser.Username, EventLogController.EventLogType.USER_CREATED); return(strMessage); }