/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); var mediumControl = MediumControl.GetMediumControl(CommunicationType.PushNotification); mediumControl.ID = "mediumControl"; mediumControl.IsTemplate = false; mediumControl.ValidationGroup = vsPushEditor.ValidationGroup; phPushControl.Controls.Add(mediumControl); }
/// <summary> /// Shows the detail. /// </summary> /// <param name="templateId">The template identifier.</param> private void ShowDetail(int templateId) { Rock.Model.CommunicationTemplate template = null; if (!templateId.Equals(0)) { template = new CommunicationTemplateService(new RockContext()) .Queryable() .Where(c => c.Id == templateId) .FirstOrDefault(); if (template != null) { lTitle.Text = template.Name.FormatAsHtmlTitle(); } } if (template == null) { template = new Rock.Model.CommunicationTemplate(); RockPage.PageTitle = "New Communication Template"; lTitle.Text = "New Communication Template".FormatAsHtmlTitle(); } CommunicationTemplateId = template.Id; tbName.Text = template.Name; tbDescription.Text = template.Description; MediumEntityTypeId = template.MediumEntityTypeId; BindMediums(); MediumData = template.MediumData; MediumData.Add("Subject", template.Subject); MediumControl control = LoadMediumControl(true); }
/// <summary> /// Shows the detail. /// </summary> /// <param name="communication">The communication.</param> private void ShowDetail(Rock.Model.Communication communication) { Recipients.Clear(); if (communication != null) { this.AdditionalMergeFields = communication.AdditionalMergeFields.ToList(); lTitle.Text = (communication.Subject ?? "New Communication").FormatAsHtmlTitle(); foreach (var recipient in new CommunicationRecipientService(new RockContext()) .Queryable("PersonAlias.Person.PhoneNumbers") .Where(r => r.CommunicationId == communication.Id)) { Recipients.Add(new Recipient(recipient.PersonAlias.Person, recipient.Status, recipient.StatusNote, recipient.OpenedClient, recipient.OpenedDateTime)); } } else { communication = new Rock.Model.Communication() { Status = CommunicationStatus.Transient }; lTitle.Text = "New Communication".FormatAsHtmlTitle(); int?personId = PageParameter("Person").AsIntegerOrNull(); if (personId.HasValue) { communication.IsBulkCommunication = false; var person = new PersonService(new RockContext()).Get(personId.Value); if (person != null) { Recipients.Add(new Recipient(person, CommunicationRecipientStatus.Pending, string.Empty, string.Empty, null)); } } } CommunicationId = communication.Id; MediumEntityTypeId = communication.MediumEntityTypeId; BindMediums(); MediumData = communication.MediumData; MediumData.Add("Subject", communication.Subject); if (communication.Status == CommunicationStatus.Transient && !string.IsNullOrWhiteSpace(GetAttributeValue("DefaultTemplate"))) { var template = new CommunicationTemplateService(new RockContext()).Get(GetAttributeValue("DefaultTemplate").AsGuid()); // If a template guid was passed in, it overrides any default template. string templateGuid = PageParameter("templateGuid"); if (!string.IsNullOrEmpty(templateGuid)) { var guid = new Guid(templateGuid); template = new CommunicationTemplateService(new RockContext()).Queryable().Where(t => t.Guid == guid).FirstOrDefault(); } if (template != null && template.MediumEntityTypeId == MediumEntityTypeId) { foreach (ListItem item in ddlTemplate.Items) { if (item.Value == template.Id.ToString()) { item.Selected = true; GetTemplateData(template.Id, false); } else { item.Selected = false; } } } } cbBulk.Checked = communication.IsBulkCommunication; MediumControl control = LoadMediumControl(true); if (control != null && CurrentPerson != null) { control.InitializeFromSender(CurrentPerson); } dtpFutureSend.SelectedDateTime = communication.FutureSendDateTime; ShowStatus(communication); ShowActions(communication); }