/// <summary> /// Initializes a new instance of the <see cref="RockBlockNotificationManager"/> class. /// </summary> /// <param name="block">The block.</param> /// <param name="notificationControl">The notification control.</param> /// <param name="detailContainerControl">The detail container control.</param> /// <exception cref="System.ArgumentNullException"> /// block /// or /// detailContainerControl /// or /// notificationControl /// </exception> /// <exception cref="System.Exception">NotificationControl cannot be a child of DetailContainerControl.</exception> public RockBlockNotificationManager(RockBlock block, NotificationBox notificationControl, Control detailContainerControl) { Block = block; if (Block == null) { throw new ArgumentNullException("block"); } DetailContainerControl = detailContainerControl; if (DetailContainerControl == null) { throw new ArgumentNullException("detailContainerControl"); } NotificationControl = notificationControl; if (NotificationControl == null) { throw new ArgumentNullException("notificationControl"); } // Verify that the notification control is not a child of the detail container. // This would cause the notification to be hidden when the content is disallowed. var invalidParent = notificationControl.FindFirstParentWhere(x => x.ID == detailContainerControl.ID); if (invalidParent != null) { throw new Exception("NotificationControl cannot be a child of DetailContainerControl."); } // Set the initial state of the controls. this.Clear(); }
/// <summary> /// Initializes a new instance of the <see cref="RockBlockWrapper"/> class. /// </summary> /// <param name="rockBlock">The rock block.</param> internal RockBlockWrapper( RockBlock rockBlock ) { _rockBlock = rockBlock; _adminControls = rockBlock.GetAdministrateControls( _rockBlock.UserCanAdministrate, _rockBlock.UserCanEdit ); }
/// <summary> /// Hides any secondary blocks. /// </summary> /// <param name="caller">The <see cref="Rock.Web.UI.RockBlock"/> that is the caller</param> /// <param name="hidden">A <see cref="System.Boolean"/> value that signifies if secondary blocks should be hidden.</param> public void HideSecondaryBlocks( RockBlock caller, bool hidden ) { foreach ( ISecondaryBlock secondaryBlock in this.RockBlocks.Where( a => a is ISecondaryBlock ) ) { if ( secondaryBlock != caller ) { secondaryBlock.SetVisible( !hidden ); } } }
// Adds the configuration html elements for editing a block /// <summary> /// Adds the block config. /// </summary> /// <param name="blockWrapper">A <see cref="Rock.Web.UI.Controls.HtmlGenericContainer"/> representing the block wrapper.</param> /// <param name="blockControl">The <see cref="Rock.Web.UI.RockBlock">block</see> control.</param> /// <param name="block">The block.</param> /// <param name="canAdministrate"> /// A <see cref="System.Boolean"/> value that is <c>true</c> if the block can be administered/configured; otherwise <c>false</c>. /// </param> /// <param name="canEdit">A <see cref="System.Boolean"/> that is <c>true</c> if the block can be edited; otherwise <c>false</c>.</param> private void AddBlockConfig( HtmlGenericContainer blockWrapper, RockBlock blockControl, Rock.Web.Cache.BlockCache block, bool canAdministrate, bool canEdit ) { if ( canAdministrate || canEdit ) { // Add the config buttons HtmlGenericControl blockConfig = new HtmlGenericControl( "div" ); blockConfig.ClientIDMode = ClientIDMode.AutoID; blockConfig.Attributes.Add( "class", "block-configuration config-bar" ); blockWrapper.Controls.Add( blockConfig ); HtmlGenericControl blockConfigLink = new HtmlGenericControl( "a" ); blockConfigLink.Attributes.Add( "href", "#" ); HtmlGenericControl iBlockConfig = new HtmlGenericControl( "i" ); iBlockConfig.Attributes.Add( "class", "fa fa-arrow-circle-right" ); blockConfigLink.Controls.Add( iBlockConfig ); blockConfig.Controls.Add( blockConfigLink ); HtmlGenericControl blockConfigBar = new HtmlGenericControl( "div" ); blockConfigBar.Attributes.Add( "class", "block-configuration-bar" ); blockConfig.Controls.Add( blockConfigBar ); HtmlGenericControl blockConfigTitle = new HtmlGenericControl( "span" ); if ( string.IsNullOrWhiteSpace( block.Name ) ) blockConfigTitle.InnerText = block.BlockType.Name; else blockConfigTitle.InnerText = block.Name; blockConfigBar.Controls.Add( blockConfigTitle ); foreach ( Control configControl in blockControl.GetAdministrateControls( canAdministrate, canEdit ) ) { configControl.ClientIDMode = ClientIDMode.AutoID; blockConfigBar.Controls.Add( configControl ); } } }
/// <summary> /// Initializes a new instance of the <see cref="RockBlockWrapper"/> class. /// </summary> /// <param name="rockBlock">The rock block.</param> internal RockBlockWrapper(RockBlock rockBlock) { _rockBlock = rockBlock; _adminControls = rockBlock.GetAdministrateControls(_rockBlock.UserCanAdministrate, _rockBlock.UserCanEdit); }