/// <summary> /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param> public override void RenderControl(HtmlTextWriter writer) { tbFromName.Required = !IsTemplate; ebFromAddress.Required = !IsTemplate; tbSubject.Required = !IsTemplate; writer.AddAttribute(HtmlTextWriterAttribute.Class, "row"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (!UseSimpleMode) { tbFromName.RenderControl(writer); ebFromAddress.RenderControl(writer); ebReplyToAddress.RenderControl(writer); } else { lFromName.RenderControl(writer); lFromAddress.RenderControl(writer); } tbSubject.RenderControl(writer); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6"); writer.RenderBeginTag(HtmlTextWriterTag.Div); fuAttachments.RenderControl(writer); hfAttachments.RenderControl(writer); writer.AddAttribute(HtmlTextWriterAttribute.Class, "attachment"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "attachment-content"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); foreach (var attachment in Attachments) { writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute(HtmlTextWriterAttribute.Target, "_blank"); writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("{0}GetFile.ashx?id={1}", System.Web.VirtualPathUtility.ToAbsolute("~"), attachment.Key)); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(attachment.Value); writer.RenderEndTag(); writer.Write(" "); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("removeAttachment( this, '{0}', '{1}' );", hfAttachments.ClientID, attachment.Key)); writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-times"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderEndTag(); // li } writer.RenderEndTag(); // ul writer.RenderEndTag(); // attachment div writer.RenderEndTag(); // span6 div writer.RenderEndTag(); // row div // Html and Text properties writer.AddAttribute(HtmlTextWriterAttribute.Class, "row"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-12"); writer.RenderBeginTag(HtmlTextWriterTag.Div); htmlMessage.MergeFields.Clear(); if (!UseSimpleMode) { htmlMessage.MergeFields.Add("GlobalAttribute"); } htmlMessage.MergeFields.Add("Rock.Model.Person"); if (!UseSimpleMode) { htmlMessage.MergeFields.Add("Communication.MediumData.FromName|From Name"); htmlMessage.MergeFields.Add("Communication.MediumData.FromAddress|From Address"); htmlMessage.MergeFields.Add("Communication.MediumData.ReplyTo|Reply To"); htmlMessage.MergeFields.Add("UnsubscribeOption"); } htmlMessage.RenderControl(writer); if (!UseSimpleMode) { tbTextMessage.RenderControl(writer); } writer.RenderEndTag(); writer.RenderEndTag(); RegisterClientScript(); }
/// <summary> /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param> public override void RenderControl(HtmlTextWriter writer) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "row"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6"); writer.RenderBeginTag(HtmlTextWriterTag.Div); tbFromName.RenderControl(writer); tbFromAddress.RenderControl(writer); tbReplyToAddress.RenderControl(writer); tbSubject.RenderControl(writer); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6"); writer.RenderBeginTag(HtmlTextWriterTag.Div); fuAttachments.RenderControl(writer); hfAttachments.RenderControl(writer); writer.AddAttribute(HtmlTextWriterAttribute.Class, "attachment"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "attachment-content"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); foreach (var attachment in Attachments) { writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute(HtmlTextWriterAttribute.Target, "_blank"); writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("{0}GetFile.ashx?{1}", System.Web.VirtualPathUtility.ToAbsolute("~"), attachment.Key)); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(attachment.Value); writer.RenderEndTag(); writer.Write(" "); removeButtons[attachment.Key].RenderBeginTag(writer); writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-times"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); removeButtons[attachment.Key].RenderEndTag(writer); writer.RenderEndTag(); // li } writer.RenderEndTag(); // ul writer.RenderEndTag(); // attachment div writer.RenderEndTag(); // span6 div writer.RenderEndTag(); // row div writer.AddAttribute(HtmlTextWriterAttribute.Class, "row"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-12"); writer.RenderBeginTag(HtmlTextWriterTag.Div); htmlMessage.RenderControl(writer); tbTextMessage.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); }