Beispiel #1
0
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            mdEdit.Show();

            var rockContext = new RockContext();

            cblAllowedChannelTypes.DataSource = new ContentChannelTypeService(rockContext).Queryable()
                                                .OrderBy(c => c.Name)
                                                .Select(c => new { c.Guid, c.Name })
                                                .ToList();
            cblAllowedChannelTypes.DataBind();

            ddlLayout.SetValue(GetAttributeValue("Layout"));
            var ppFieldType = new PageReferenceFieldType();

            ppFieldType.SetEditValue(ppDetailPage, null, GetAttributeValue("DetailPage"));
            cblAllowedChannelTypes.SetValues(GetAttributeValues("AllowedChannelTypes"));
            ddlSortItemsBy.SetValue(GetAttributeValue("SortItemsBy"));

            var binaryFile = new BinaryFileService(rockContext).Get(GetAttributeValue("BackgroundImage").AsGuid());

            ftBackgroundImage.BinaryFileId = binaryFile != null ? ( int? )binaryFile.Id : null;
            tbBackgroundImageUrl.Text      = GetAttributeValue("BackgroundImageUrl");

            ceTemplate.Text = GetAttributeValue("Template");
        }
        /// <summary>
        /// Binds the workflow type picker.
        /// </summary>
        private void BindPagePickerControls()
        {
            if (_hasLaunched)
            {
                ppCommunicationPage.Visible = false;
                return;
            }

            // If a page parameter is set, then it overrides everything else
            var communicationPageId = PageParameter(PageParameterKey.CommunicationPageId).AsIntegerOrNull();
            var selectedPage        = GetAttributeValue(AttributeKey.CommunicationPage);

            if (communicationPageId.HasValue)
            {
                var communicationPage = PageCache.Get(communicationPageId.Value);

                if (communicationPage != null && communicationPage.IsAuthorized(Authorization.VIEW, CurrentPerson))
                {
                    ppCommunicationPage.Visible = false;
                    return;
                }
            }
            else if (selectedPage.IsNotNullOrWhiteSpace())
            {
                var ppFieldType = new PageReferenceFieldType();
                ppFieldType.SetEditValue(ppCommunicationPage, null, selectedPage);
            }
        }
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            pnlSettings.Visible              = true;
            cbShowBlockTitle.Checked         = GetAttributeValue(AttributeKey.ShowBlockTitle).AsBoolean();
            rtbBlockTitleText.Text           = GetAttributeValue(AttributeKey.BlockTitleText);
            rtbBlockTitleIconCssClass.Text   = GetAttributeValue(AttributeKey.BlockTitleIconCssClass);
            nbFiltersPerRow.Text             = GetAttributeValue(AttributeKey.FiltersPerRow);
            cbShowResetFiltersButton.Checked = GetAttributeValue(AttributeKey.ShowResetFiltersButton).AsBoolean();
            rtbFilterButtonText.Text         = GetAttributeValue(AttributeKey.FilterButtonText);
            ddlFilterButtonSize.SetValue(GetAttributeValue(AttributeKey.FilterButtonSize).AsInteger());
            var ppFieldType = new PageReferenceFieldType();

            ppFieldType.SetEditValue(ppRedirectPage, null, GetAttributeValue(AttributeKey.RedirectPage));
            cbDoesSelectionCausePostback.Checked = GetAttributeValue(AttributeKey.DoesSelectionCausePostback).AsBoolean();
            BindGrid();

            mdSettings.Show();
        }
Beispiel #4
0
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            // Switch does not automatically initialize again after a partial-postback.  This script
            // looks for any switch elements that have not been initialized and re-intializes them.
            string script = @"
$(document).ready(function() {
    $('.switch > input').each( function () {
        $(this).parent().switch('init');
    });
});
";

            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "toggle-switch-init", script, true);

            pnlEditModal.Visible = true;
            upnlContent.Update();
            mdEdit.Show();

            var rockContext = new RockContext();

            ddlGroup.DataSource = new GroupService(rockContext).Queryable()
                                  .OrderBy(c => c.Name)
                                  .Select(c => new { c.Guid, c.Name })
                                  .ToList();
            ddlGroup.DataBind();
            ddlGroup.Items.Insert(0, new ListItem("", ""));
            ddlGroup.SetValue(GetAttributeValue("Group"));
            GroupGuid = ddlGroup.SelectedValue.AsGuidOrNull();

            ceTemplate.Text            = GetAttributeValue("Template");
            nbItemCacheDuration.Text   = GetAttributeValue("CacheDuration");
            nbOutputCacheDuration.Text = GetAttributeValue("OutputCacheDuration");

            var ppFieldType = new PageReferenceFieldType();

            ppFieldType.SetEditValue(ppDetailPage, null, GetAttributeValue("DetailPage"));

            ShowEdit();

            upnlContent.Update();
        }
Beispiel #5
0
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            pnlSettings.Visible = true;
            ddlContentChannel.Items.Clear();
            ddlContentChannel.Items.Add(new ListItem());
            foreach (var contentChannel in ContentChannelCache.All().OrderBy(a => a.Name))
            {
                ddlContentChannel.Items.Add(new ListItem(contentChannel.Name, contentChannel.Guid.ToString()));
            }

            ddlLaunchWorkflowCondition.Items.Clear();
            foreach (LaunchWorkflowCondition launchWorkflowCondition in Enum.GetValues(typeof(LaunchWorkflowCondition)))
            {
                ddlLaunchWorkflowCondition.Items.Add(new ListItem(launchWorkflowCondition.ConvertToString(true), launchWorkflowCondition.ConvertToInt().ToString()));
            }

            var channelGuid = this.GetAttributeValue("ContentChannel").AsGuidOrNull();

            ddlContentChannel.SetValue(channelGuid);
            UpdateSocialMediaDropdowns(channelGuid);

            cblStatus.BindToEnum <ContentChannelItemStatus>();
            foreach (string status in GetAttributeValue("Status").SplitDelimitedValues())
            {
                var li = cblStatus.Items.FindByValue(status);
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            var ppFieldType = new PageReferenceFieldType();

            ppFieldType.SetEditValue(ppDetailPage, null, GetAttributeValue("DetailPage"));
            tbContentChannelQueryParameter.Text = this.GetAttributeValue("ContentChannelQueryParameter");
            ceLavaTemplate.Text        = this.GetAttributeValue("LavaTemplate");
            nbOutputCacheDuration.Text = this.GetAttributeValue("OutputCacheDuration");
            nbItemCacheDuration.Text   = this.GetAttributeValue("ItemCacheDuration");

            DefinedValueService definedValueService = new DefinedValueService(new RockContext());

            cblCacheTags.DataSource = definedValueService.GetByDefinedTypeGuid(Rock.SystemGuid.DefinedType.CACHE_TAGS.AsGuid()).Select(v => v.Value).ToList();
            cblCacheTags.DataBind();
            string[] selectedCacheTags = this.GetAttributeValue("CacheTags").SplitDelimitedValues();
            foreach (ListItem cacheTag in cblCacheTags.Items)
            {
                cacheTag.Selected = selectedCacheTags.Contains(cacheTag.Value);
            }

            cbSetPageTitle.Checked = this.GetAttributeValue("SetPageTitle").AsBoolean();
            cbMergeContent.Checked = GetAttributeValue("MergeContent").AsBoolean();

            if (this.GetAttributeValue("LogInteractions").AsBoolean())
            {
                cbLogInteractions.Checked = true;
                cbWriteInteractionOnlyIfIndividualLoggedIn.Visible = true;
                cbWriteInteractionOnlyIfIndividualLoggedIn.Checked = this.GetAttributeValue("WriteInteractionOnlyIfIndividualLoggedIn").AsBoolean();
            }
            else
            {
                cbLogInteractions.Checked = false;
                cbWriteInteractionOnlyIfIndividualLoggedIn.Visible = false;
                cbWriteInteractionOnlyIfIndividualLoggedIn.Checked = false;
            }

            var rockContext = new RockContext();

            // Workflow
            Guid?workflowTypeGuid = this.GetAttributeValue("WorkflowType").AsGuidOrNull();

            if (workflowTypeGuid.HasValue)
            {
                wtpWorkflowType.SetValue(new WorkflowTypeService(rockContext).GetNoTracking(workflowTypeGuid.Value));
            }
            else
            {
                wtpWorkflowType.SetValue(null);
            }

            ShowHideControls();

            cbLaunchWorkflowOnlyIfIndividualLoggedIn.Checked = this.GetAttributeValue("LaunchWorkflowOnlyIfIndividualLoggedIn").AsBoolean();
            ddlLaunchWorkflowCondition.SetValue(this.GetAttributeValue("LaunchWorkflowCondition"));

            // Social Media
            ddlMetaDescriptionAttribute.SetValue(this.GetAttributeValue("MetaDescriptionAttribute"));
            ddlOpenGraphType.SetValue(this.GetAttributeValue("OpenGraphType"));
            ddlOpenGraphTitleAttribute.SetValue(this.GetAttributeValue("OpenGraphTitleAttribute"));
            ddlOpenGraphDescriptionAttribute.SetValue(this.GetAttributeValue("OpenGraphDescriptionAttribute"));
            ddlOpenGraphImageAttribute.SetValue(this.GetAttributeValue("OpenGraphImageAttribute"));

            ddlTwitterTitleAttribute.SetValue(this.GetAttributeValue("TwitterTitleAttribute"));
            ddlTwitterDescriptionAttribute.SetValue(this.GetAttributeValue("TwitterDescriptionAttribute"));
            ddlTwitterImageAttribute.SetValue(this.GetAttributeValue("TwitterImageAttribute"));
            ddlTwitterCard.SetValue(this.GetAttributeValue("TwitterCard"));

            mdSettings.Show();
        }
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            // Switch does not automatically initialize again after a partial-postback.  This script
            // looks for any switch elements that have not been initialized and re-intializes them.
            string script = @"
$(document).ready(function() {
    $('.switch > input').each( function () {
        $(this).parent().switch('init');
    });
});
";

            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "toggle-switch-init", script, true);

            pnlEditModal.Visible = true;
            upnlContent.Update();
            mdEdit.Show();

            var rockContext = new RockContext();

            ddlChannel.DataSource = new ContentChannelService(rockContext).Queryable()
                                    .OrderBy(c => c.Name)
                                    .Select(c => new { c.Guid, c.Name })
                                    .ToList();
            ddlChannel.DataBind();
            ddlChannel.Items.Insert(0, new ListItem("", ""));
            ddlChannel.SetValue(GetAttributeValue("Channel"));
            ChannelGuid = ddlChannel.SelectedValue.AsGuidOrNull();

            cblStatus.BindToEnum <ContentChannelItemStatus>();
            foreach (string status in GetAttributeValue("Status").SplitDelimitedValues())
            {
                var li = cblStatus.Items.FindByValue(status);
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            nbCount.Text               = GetAttributeValue("Count");
            nbItemCacheDuration.Text   = GetAttributeValue("CacheDuration");
            nbOutputCacheDuration.Text = GetAttributeValue("OutputCacheDuration");
            hfDataFilterId.Value       = GetAttributeValue("FilterId");

            tbTitleLava.Text    = GetAttributeValue("TitleLava");
            tbIconLava.Text     = GetAttributeValue("IconLava");
            tbImageLava.Text    = GetAttributeValue("ImageLava");
            tbSubtitleLava.Text = GetAttributeValue("SubtitleLava");

            var ppFieldType = new PageReferenceFieldType();

            ppFieldType.SetEditValue(ppDetailPage, null, GetAttributeValue("DetailPage"));

            var directions = new Dictionary <string, string>();

            directions.Add("", "");
            directions.Add(SortDirection.Ascending.ConvertToInt().ToString(), "Ascending");
            directions.Add(SortDirection.Descending.ConvertToInt().ToString(), "Descending");
            kvlOrder.CustomValues = directions;
            kvlOrder.Value        = GetAttributeValue("Order");
            kvlOrder.Required     = true;

            ShowEdit();

            upnlContent.Update();
        }
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            // Switch does not automatically initialize again after a partial-postback.  This script
            // looks for any switch elements that have not been initialized and re-intializes them.
            string script = @"
;$(document).ready(function() {
    $('.switch > input').each( function () {
        $(this).parent().switch('init');
    });
});
";

            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "toggle-switch-init", script, true);

            mdEdit.Show();

            var rockContext = new RockContext();

            ddlChannel.DataSource = new ContentChannelService(rockContext).Queryable()
                                    .OrderBy(c => c.Name)
                                    .Select(c => new { c.Guid, c.Name })
                                    .ToList();
            ddlChannel.DataBind();
            ddlChannel.Items.Insert(0, new ListItem("", ""));
            ddlChannel.SetValue(GetAttributeValue("ContentChannel"));

            cblStatus.BindToEnum <ContentChannelItemStatus>();
            foreach (string status in GetAttributeValue("Status").SplitDelimitedValues())
            {
                var li = cblStatus.Items.FindByValue(status);
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            ddlLayout.SetValue(GetAttributeValue("Layout"));

            var ppFieldType = new PageReferenceFieldType();

            ppFieldType.SetEditValue(ppDetailPage, null, GetAttributeValue("DetailPage"));

            hfDataFilterId.Value = GetAttributeValue("FilterId");

            var directions = new Dictionary <string, string>
            {
                { "", "" },
                { SortDirection.Ascending.ConvertToInt().ToString(), "Ascending" },
                { SortDirection.Descending.ConvertToInt().ToString(), "Descending" }
            };

            kvlOrder.CustomValues = directions;
            kvlOrder.Value        = GetAttributeValue("Order");
            kvlOrder.Required     = true;

            var binaryFile = new BinaryFileService(rockContext).Get(GetAttributeValue("BackgroundImage").AsGuid());

            ftBackgroundImage.BinaryFileId = binaryFile != null ? ( int? )binaryFile.Id : null;
            tbBackgroundImageUrl.Text      = GetAttributeValue("BackgroundImageUrl");

            ceTemplate.Text = GetAttributeValue("Template");

            ShowEdit(ddlChannel.SelectedValue.AsGuidOrNull());
        }