RegisterLayouts() public static method

Registers any layouts in a particular site's theme folder that do not currently have any layouts registered in Rock.
public static RegisterLayouts ( string physWebAppPath, SiteCache site ) : void
physWebAppPath string A containing the physical path to Rock on the server.
site SiteCache The site.
return void
Example #1
0
 private void LoadLayouts(SiteCache Site)
 {
     ddlLayout.Items.Clear();
     var layoutService = new LayoutService();
     layoutService.RegisterLayouts( Request.MapPath( "~" ), Site, CurrentPersonId );
     foreach ( var layout in layoutService.GetBySiteId( Site.Id ) )
     {
         ddlLayout.Items.Add( new ListItem( layout.Name, layout.Id.ToString() ) );
     }
 }
Example #2
0
        /// <summary>
        /// Binds the pages grid.
        /// </summary>
        protected void BindPagesGrid()
        {
            pnlPages.Visible = false;
            int siteId = PageParameter( "siteId" ).AsInteger() ?? 0;
            if ( siteId == 0 )
            {
                // quit if the siteId can't be determined
                return;
            }

            hfSiteId.SetValue( siteId );
            pnlPages.Visible = true;

            LayoutService layoutService = new LayoutService();
            layoutService.RegisterLayouts( Request.MapPath( "~" ), SiteCache.Read( siteId ), CurrentPersonId );
            var layouts = layoutService.Queryable().Where( a => a.SiteId.Equals( siteId ) ).Select( a => a.Id ).ToList();

            var siteService = new SiteService();
            var pageId = siteService.Get( siteId ).DefaultPageId;

            var pageService = new PageService();
            var qry = pageService.GetAllDescendents( (int)pageId ).AsQueryable().Where( a => layouts.Contains(a.LayoutId) );

            string layoutFilter = gPagesFilter.GetUserPreference( "Layout" );
            if ( !string.IsNullOrWhiteSpace( layoutFilter ) && layoutFilter != Rock.Constants.All.Text )
            {
                qry = qry.Where( a => a.Layout.ToString() == layoutFilter );
            }

            SortProperty sortProperty = gPages.SortProperty;
            if ( sortProperty != null )
            {
                qry = qry.Sort( sortProperty );
            }
            else
            {
                qry = qry.OrderBy( q => q.Id );
            }

            gPages.DataSource = qry.ToList();
            gPages.DataBind();
        }
Example #3
0
        /// <summary>
        /// Binds the group members grid.
        /// </summary>
        protected void BindLayoutsGrid()
        {
            pnlLayouts.Visible = false;

            int siteId = PageParameter( "siteId" ).AsInteger() ?? 0;
            if ( siteId == 0 )
            {
                // quit if the siteId can't be determined
                return;
            }

            hfSiteId.SetValue( siteId );

            pnlLayouts.Visible = true;

            LayoutService layoutService = new LayoutService();

            // Add any missing layouts
            layoutService.RegisterLayouts( Request.MapPath( "~" ), SiteCache.Read( siteId ), CurrentPersonId );

            var qry = layoutService.Queryable().Where( a => a.SiteId.Equals( siteId ) );

            SortProperty sortProperty = gLayouts.SortProperty;

            if ( sortProperty != null )
            {
                gLayouts.DataSource = qry.Sort( sortProperty ).ToList();
            }
            else
            {
                gLayouts.DataSource = qry.OrderBy( l => l.Name ).ToList();
            }

            gLayouts.DataBind();
        }
Example #4
0
 /// <summary>
 /// Binds the filter.
 /// </summary>
 private void BindFilter()
 {
     int siteId = PageParameter( "siteId" ).AsInteger() ?? 0;
     if ( siteId == 0 )
     {
         // quit if the siteId can't be determined
         return;
     }
     LayoutService layoutService = new LayoutService();
     layoutService.RegisterLayouts( Request.MapPath( "~" ), SiteCache.Read( siteId ), CurrentPersonId );
     var layouts = layoutService.Queryable().Where( a => a.SiteId.Equals( siteId ) ).ToList();
     ddlLayoutFilter.DataSource = layouts;
     ddlLayoutFilter.DataBind();
     ddlLayoutFilter.Items.Insert( 0, Rock.Constants.All.ListItem );
     ddlLayoutFilter.Visible = layouts.Any();
     ddlLayoutFilter.SetValue( gPagesFilter.GetUserPreference( "Layout" ) );
 }