protected void Page_Init(object sender, EventArgs e) { // WARN IF SMTP SERVER NOT CONFIGURED if (IsSmtpServerConfigured()) { // FIND THE DATASOURCE FOR THE EMAILS LocateRecipientSource(); // INITIALIZE THE EMAIL TEMPLATES EmailTemplates.DataSource = EmailTemplateDataSource.LoadAll("Name"); EmailTemplates.DataBind(); EmailTemplates.Attributes.Add("onchange", "if(!confirm('Changing the email template will reset any message text entered below. Continue?')) return false;"); // INITIALIZE THE MAIL FORM ToAddress.Text = GetRecipientList(); if (!Page.IsPostBack) { FromAddress.Text = AbleContext.Current.Store.Settings.DefaultEmailAddress; } MailFormat.Attributes.Add("onchange", "$get('" + MessageHtml.ClientID + "').style.visibility=(this.selectedIndex==0?'visible':'hidden');"); MessageHtml.OnClientClick = "if(/^\\s*#.*?\\n/gm.test($get('" + Message.ClientID + "').value)){if(!confirm('WARNING: HTML editor may corrupt NVelocity script if you make changes in WYSIWYG mode. Continue?'))return false;}"; AbleCommerce.Code.PageHelper.SetHtmlEditor(Message, MessageHtml); // SHOW/hide the restock notification subscriptions removal option trRemoveNotificationSubscriptions.Visible = _RestockNotifyList != null; } else { // SMTP IS NOT CONFIGURED ComposePanel.Visible = false; PreviewPanel.Visible = false; ConfirmationPanel.Visible = false; SmtpErrorPanel.Visible = true; } // SET CANCEL LINKS TO CALLING PAGE OKButton.NavigateUrl = GetReturnUrl(); CancelLink.NavigateUrl = GetReturnUrl(); }