예제 #1
0
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        if (this.CurrentTemplateIdViewState != 0 && ButtonCancelSaveAs.Visible == false)
        {
            MailTemplate currentTemplate = MailTemplate.FromIdentity(this.CurrentTemplateIdViewState);
            currentTemplate.TemplateBody = RadEditor1.Content;
            currentTemplate.NormalizeHtml();
            currentTemplate.TemplateTitle = TextBoxSubject.Text;
            currentTemplate.NormalizeHtml();
            currentTemplate.RemovePlaceholderSpans();
            currentTemplate.Update();
            ShowTemplate(currentTemplate);
            BuildTemplateDropdowns();
        }
        else
        {
            string cntryCode = "";
            string cntryLang = "";
            if (DropDownCountry.SelectedValue != "")
            {
                Country cntry = Country.FromCode(DropDownCountry.SelectedValue);
                cntryCode = cntry.Code;
                cntryLang = cntry.Culture.Substring(0, 2);
            }

            int          orgId = WSOrgTreeDropDown1.SelectedOrganizationId;
            Organization org   = Organization.FromIdentity(orgId);

            if (_authority.HasPermission(Permission.CanSetUpAutomail, orgId, org.DefaultCountry.GeographyId, Authorization.Flag.Default))
            {
                if (orgId == Organization.RootIdentity)
                {
                    orgId = 0;
                }

                MailTemplate currentTemplate = MailTemplate.Create(DropDownName.SelectedValue, cntryLang,
                                                                   cntryCode, orgId, RadEditor1.Content);
                this.CurrentTemplateIdViewState   = currentTemplate.TemplateId;
                this.CurrentTemplateNameViewState = currentTemplate.TemplateName;
                currentTemplate.TemplateBody      = RadEditor1.Content;
                currentTemplate.NormalizeHtml();
                currentTemplate.TemplateTitle = TextBoxSubject.Text;
                currentTemplate.NormalizeHtml();
                currentTemplate.MarkPlaceholderSpans();
                currentTemplate.Update();
                ShowTemplate(currentTemplate);
                BuildTemplateDropdowns();
                SetUIState(pageUIState.edit);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "StartupMessage", "alert('You have to select an organization for wich you have permissions to edit templates for.');", true);
            }
        }
    }
예제 #2
0
 public void TestInitialize()
 {
     MailTemplateStore.Instance.Cleanup();
     MailTemplateStore.Instance.Add(MailTemplate.Create("Minimal", "Subject", "Text", "<html>Html</html>"));
     MailTemplateStore.Instance.Add(MailTemplate.Create("ToReplace", "S@(Model.SSS)S", "Text@(Model.TextStuff) and more", "<html>Ht @(Model.some) ml</html>"));
     MailTemplateStore.Instance.Add(MailTemplate.Create("ImageAdded", "Subject", "Text", "<html>Html<img src=\"cid:img.jpg\"></img></html>"));
     MailTemplateStore.Instance.Add(MailTemplate.Create("Activation", "Thriot - user activation",
                                                        "Dear @Raw(Model.Name)," +
                                                        "" +
                                                        "Please click the following link to activate your Thriot account:" +
                                                        "@Raw(Model.Url)" +
                                                        "" +
                                                        "" +
                                                        "Regards:" +
                                                        "Thriot team" +
                                                        "" +
                                                        "thriot@@kpocza.net",
                                                        "<!DOCTYPE html >" +
                                                        "<html xmlns = \"http://www.w3.org/1999/xhtml\">" +
                                                        "<head>" +
                                                        "    <title>Thriot - user activation</title>" +
                                                        "</head>" +
                                                        "<body>" +
                                                        "    <p>Dear @Model.Name,</p >" +
                                                        "    <p></p >" +
                                                        "    <p>Please click the following link to activate your Thriot account:</p>" +
                                                        "    <p><a href=\"@Model.Url\">@Model.Url</a></p>" +
                                                        "    <p></p>" +
                                                        "    <p>" +
                                                        "        Regards:<br />" +
                                                        "        Thriot team" +
                                                        "    </p >" +
                                                        "    <p>thriot@@kpocza.net</p>" +
                                                        "</body>" +
                                                        "</html>"));
 }