/// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="assetStorageProviderId">The asset storage provider identifier.</param>
        public void ShowDetail(int assetStorageProviderId)
        {
            if (!IsUserAuthorized(Authorization.VIEW))
            {
                nbEditModeMessage.Text = EditModeMessage.NotAuthorizedToView(AssetStorageProvider.FriendlyTypeName);
                return;
            }

            AssetStorageProvider assetStorageProvider = null;
            var rockContext = new RockContext();

            if (assetStorageProviderId == 0)
            {
                assetStorageProvider   = new AssetStorageProvider();
                pdAuditDetails.Visible = false;
            }
            else
            {
                var assetStorageProviderService = new AssetStorageProviderService(rockContext);
                assetStorageProvider = assetStorageProviderService.Get(assetStorageProviderId);
                pdAuditDetails.SetEntity(assetStorageProvider, ResolveRockUrl("~"));

                if (assetStorageProvider == null)
                {
                    assetStorageProvider   = new AssetStorageProvider();
                    pdAuditDetails.Visible = false;
                }
            }

            if (assetStorageProvider.Id == 0)
            {
                lActionTitle.Text = ActionTitle.Add(AssetStorageProvider.FriendlyTypeName).FormatAsHtmlTitle();
            }
            else
            {
                lActionTitle.Text = assetStorageProvider.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !assetStorageProvider.IsActive;

            tbName.Text        = assetStorageProvider.Name;
            cbIsActive.Checked = assetStorageProvider.IsActive;
            tbDescription.Text = assetStorageProvider.Description;
            cpAssetStorageType.SetValue(assetStorageProvider.EntityType != null ? assetStorageProvider.EntityType.Guid.ToString().ToUpper() : string.Empty);

            BuildDynamicControls(assetStorageProvider, true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="contentChannelId">The content channel identifier.</param>
        public void ShowDetail(int contentChannelId)
        {
            ContentChannel contentChannel = null;

            cbIndexChannel.Visible = IndexContainer.IndexingEnabled;

            bool editAllowed = IsUserAuthorized(Authorization.EDIT);

            var rockContext = new RockContext();

            if (!contentChannelId.Equals(0))
            {
                contentChannel = GetContentChannel(contentChannelId);
                if (contentChannel != null)
                {
                    editAllowed = editAllowed || contentChannel.IsAuthorized(Authorization.EDIT, CurrentPerson);
                }
                pdAuditDetails.SetEntity(contentChannel, ResolveRockUrl("~"));
            }

            if (contentChannel == null)
            {
                contentChannel = new ContentChannel {
                    Id = 0
                };
                contentChannel.ChildContentChannels = new List <ContentChannel>();
                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }

            if (contentChannel != null && contentChannel.IsAuthorized(Authorization.VIEW, CurrentPerson))
            {
                hfId.Value = contentChannel.Id.ToString();

                bool readOnly = false;
                nbEditModeMessage.Text = string.Empty;

                if (!editAllowed)
                {
                    readOnly = true;
                    nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(ContentChannel.FriendlyTypeName);
                }

                if (readOnly)
                {
                    lbEdit.Visible = false;
                    ShowReadonlyDetails(contentChannel);
                }
                else
                {
                    lbEdit.Visible = true;
                    if (contentChannel.Id > 0)
                    {
                        ShowReadonlyDetails(contentChannel);
                    }
                    else
                    {
                        ShowEditDetails(contentChannel);
                    }
                }

                btnSecurity.Visible  = contentChannel.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson);
                btnSecurity.Title    = contentChannel.Name;
                btnSecurity.EntityId = contentChannel.Id;

                lbSave.Visible = !readOnly;
            }
            else
            {
                nbEditModeMessage.Text      = EditModeMessage.NotAuthorizedToView(ContentChannel.FriendlyTypeName);
                pnlEditDetails.Visible      = false;
                fieldsetViewSummary.Visible = false;
            }
        }
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="personalLinkSectionId">The personal link section element identifier.</param>
        public void ShowDetail(int personalLinkSectionId)
        {
            var rockContext = new RockContext();
            var personalLinkSectionService          = new PersonalLinkSectionService(rockContext);
            PersonalLinkSection personalLinkSection = null;
            bool isNew = false;

            if (!personalLinkSectionId.Equals(0))
            {
                personalLinkSection = personalLinkSectionService.Get(personalLinkSectionId);
            }

            if (personalLinkSection == null)
            {
                personalLinkSection = new PersonalLinkSection {
                    Id = 0
                };
                isNew = true;
            }

            hfPersonalLinkSectionId.SetValue(personalLinkSection.Id);

            if (personalLinkSection != null && personalLinkSection.IsAuthorized(Authorization.VIEW, CurrentPerson))
            {
                hfPersonalLinkSectionId.Value = personalLinkSection.Id.ToString();

                bool readOnly    = false;
                bool editAllowed = isNew || personalLinkSection.IsAuthorized(Authorization.EDIT, CurrentPerson);
                nbEditModeMessage.Text = string.Empty;

                if (!editAllowed)
                {
                    readOnly = true;
                    nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(ContentChannel.FriendlyTypeName);
                }

                if (readOnly)
                {
                    btnEdit.Visible = false;
                    ShowReadonlyDetails(personalLinkSection);
                }
                else
                {
                    btnEdit.Visible = true;
                    if (personalLinkSection.Id > 0)
                    {
                        ShowReadonlyDetails(personalLinkSection);
                    }
                    else
                    {
                        ShowEditDetails(personalLinkSection);
                    }
                }

                btnSecurity.Visible  = personalLinkSection.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson);
                btnSecurity.Title    = personalLinkSection.Name;
                btnSecurity.EntityId = personalLinkSection.Id;

                btnSave.Visible = !readOnly;
            }
            else
            {
                nbEditModeMessage.Text = EditModeMessage.NotAuthorizedToView(ContentChannel.FriendlyTypeName);
                pnlEditDetails.Visible = false;
                pnlViewDetails.Visible = false;
                this.HideSecondaryBlocks(true);
            }
        }
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="contentChannelId">The marketing campaign ad type identifier.</param>
        public void ShowDetail(int contentChannelId)
        {
            ContentChannel contentChannel = null;

            bool editAllowed = IsUserAuthorized(Authorization.EDIT);

            var rockContext = new RockContext();

            if (!contentChannelId.Equals(0))
            {
                contentChannel = GetContentChannel(contentChannelId);
                if (contentChannel != null)
                {
                    editAllowed = editAllowed || contentChannel.IsAuthorized(Authorization.EDIT, CurrentPerson);
                }
            }

            if (contentChannel == null)
            {
                contentChannel = new ContentChannel {
                    Id = 0
                };
            }

            if (contentChannel != null && contentChannel.IsAuthorized(Authorization.VIEW, CurrentPerson))
            {
                hfId.Value = contentChannel.Id.ToString();

                bool readOnly = false;
                nbEditModeMessage.Text = string.Empty;

                if (!editAllowed)
                {
                    readOnly = true;
                    nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(ContentChannel.FriendlyTypeName);
                }

                if (readOnly)
                {
                    lbEdit.Visible = false;
                    ShowReadonlyDetails(contentChannel);
                }
                else
                {
                    lbEdit.Visible = true;
                    if (contentChannel.Id > 0)
                    {
                        ShowReadonlyDetails(contentChannel);
                    }
                    else
                    {
                        ShowEditDetails(contentChannel);
                    }
                }

                lbSave.Visible = !readOnly;
            }
            else
            {
                nbEditModeMessage.Text      = EditModeMessage.NotAuthorizedToView(ContentChannel.FriendlyTypeName);
                pnlEditDetails.Visible      = false;
                fieldsetViewSummary.Visible = false;
            }
        }