예제 #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            int pageId = PageParameter("EditPage").AsInteger() ?? 0;

            Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read(pageId);

            nbMessage.Visible = false;

            if (page.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson))
            {
                if (!Page.IsPostBack)
                {
                    BindGrids();
                    LoadBlockTypes();
                }
            }
            else
            {
                gPageBlocks.Visible = false;
                nbMessage.Text      = "You are not authorized to edit these blocks";
                nbMessage.Visible   = true;
            }

            base.OnLoad(e);
        }
예제 #2
0
        /// <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)
        {
            int pageId = PageParameter("EditPage").AsInteger() ?? 0;

            Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read(pageId);

            string zoneName = this.PageParameter("ZoneName");

            lAllPages.Text = string.Format("All Pages Using '{0}' Layout", page.Layout);

            // TODO: Managing layout block instances should probably be controlled by site security
            if (page.IsAuthorized("Administrate", CurrentPerson))
            {
                gLayoutBlocks.DataKeyNames      = new string[] { "id" };
                gLayoutBlocks.Actions.ShowAdd   = true;
                gLayoutBlocks.Actions.AddClick += LayoutBlocks_Add;
                gLayoutBlocks.GridReorder      += gLayoutBlocks_GridReorder;
                gLayoutBlocks.GridRebind       += gLayoutBlocks_GridRebind;
            }

            if (page.IsAuthorized("Administrate", CurrentPerson))
            {
                gPageBlocks.DataKeyNames      = new string[] { "id" };
                gPageBlocks.Actions.ShowAdd   = true;
                gPageBlocks.Actions.AddClick += gPageBlocks_GridAdd;
                gPageBlocks.GridReorder      += gPageBlocks_GridReorder;
                gPageBlocks.GridRebind       += gPageBlocks_GridRebind;
            }

            string script = string.Format(
                @"Sys.Application.add_load(function () {{
                    $('div.modal-header h3').html('{0} Zone');
                    $('#{1} a').click(function() {{ $('#{3}').val('Page'); }});
                    $('#{2} a').click(function() {{ $('#{3}').val('Layout'); }});
                }});",
                zoneName,
                liPage.ClientID,
                liLayout.ClientID,
                hfOption.ClientID);

            this.Page.ClientScript.RegisterStartupScript(this.GetType(), string.Format("zone-add-load-{0}", this.ClientID), script, true);

            base.OnInit(e);
        }
예제 #3
0
        protected override void OnInit(EventArgs e)
        {
            CurrentPage.AddScriptLink(Page, "~/Scripts/bootstrap-tabs.js");

            int pageId = Convert.ToInt32(PageParameter("EditPage"));

            _page     = Rock.Web.Cache.PageCache.Read(pageId);
            _zoneName = this.PageParameter("ZoneName");

            lAllPages.Text = string.Format("All Pages Using '{0}' Layout", CurrentPage.Layout);

            // TODO: Managing layout block instances should probably be controlled by site security
            if (_page.IsAuthorized("Administrate", CurrentPerson))
            {
                gLayoutBlocks.DataKeyNames         = new string[] { "id" };
                gLayoutBlocks.Actions.IsAddEnabled = true;
                gLayoutBlocks.Actions.AddClick    += LayoutBlocks_Add;
                gLayoutBlocks.GridReorder         += gLayoutBlocks_GridReorder;
                gLayoutBlocks.GridRebind          += gLayoutBlocks_GridRebind;
            }

            if (_page.IsAuthorized("Administrate", CurrentPerson))
            {
                gPageBlocks.DataKeyNames         = new string[] { "id" };
                gPageBlocks.Actions.IsAddEnabled = true;
                gPageBlocks.Actions.AddClick    += gPageBlocks_GridAdd;
                gPageBlocks.GridReorder         += gPageBlocks_GridReorder;
                gPageBlocks.GridRebind          += gPageBlocks_GridRebind;
            }

            string script = string.Format(@"
        Sys.Application.add_load(function () {{
            $('#modal-popup div.modal-header h3 small', window.parent.document).html('{0}');
            $('#{1} a').click(function() {{ $('#{3}').val('Page'); }});
            $('#{2} a').click(function() {{ $('#{3}').val('Layout'); }});
        }});
    ", _zoneName, liPage.ClientID, liLayout.ClientID, hfOption.ClientID);

            this.Page.ClientScript.RegisterStartupScript(this.GetType(), string.Format("zone-add-load-{0}", this.ClientID), script, true);

            base.OnInit(e);
        }
예제 #4
0
        /// <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)
        {
            int pageId = PageParameter("EditPage").AsInteger();

            Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read(pageId);

            string zoneName = this.PageParameter("ZoneName");

            lAllPages.Text = string.Format("All Pages Using '{0}' Layout", page.Layout.Name);

            if (page.Layout.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson))
            {
                gLayoutBlocks.DataKeyNames              = new string[] { "Id" };
                gLayoutBlocks.Actions.ShowAdd           = true;
                gLayoutBlocks.Actions.ShowExcelExport   = false;
                gLayoutBlocks.Actions.ShowMergeTemplate = false;
                gLayoutBlocks.Actions.AddClick         += LayoutBlocks_Add;
                gLayoutBlocks.GridReorder += gLayoutBlocks_GridReorder;
                gLayoutBlocks.GridRebind  += gLayoutBlocks_GridRebind;
            }

            if (page.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson))
            {
                gPageBlocks.DataKeyNames              = new string[] { "Id" };
                gPageBlocks.Actions.ShowAdd           = true;
                gPageBlocks.Actions.ShowExcelExport   = false;
                gPageBlocks.Actions.ShowMergeTemplate = false;
                gPageBlocks.Actions.AddClick         += gPageBlocks_GridAdd;
                gPageBlocks.GridReorder += gPageBlocks_GridReorder;
                gPageBlocks.GridRebind  += gPageBlocks_GridRebind;
            }

            string script = string.Format(
                @"Sys.Application.add_load(function () {{
                    $('div.modal-header h3').html('{0} Zone');
                    $('#{1} a').click(function() {{ $('#{3}').val('Page'); }});
                    $('#{2} a').click(function() {{ $('#{3}').val('Layout'); }});
                }});",
                zoneName,
                liPage.ClientID,
                liLayout.ClientID,
                hfOption.ClientID);

            this.Page.ClientScript.RegisterStartupScript(this.GetType(), string.Format("zone-add-load-{0}", this.ClientID), script, true);

            base.OnInit(e);
        }
예제 #5
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            nbMessage.Visible = false;

            if (_Page != null && _Page.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson))
            {
                if (!Page.IsPostBack)
                {
                    BindGrids();
                }
            }
            else
            {
                pnlLists.Visible  = false;
                nbMessage.Text    = "You are not authorized to edit these blocks";
                nbMessage.Visible = true;
            }

            base.OnLoad(e);
        }
예제 #6
0
        protected override void OnLoad(EventArgs e)
        {
            nbMessage.Visible = false;

            if (_page.IsAuthorized("Administrate", CurrentPerson))
            {
                if (!Page.IsPostBack)
                {
                    BindGrids();
                    LoadBlockTypes();
                }
            }
            else
            {
                gPageBlocks.Visible = false;
                nbMessage.Text      = "You are not authorized to edit these blocks";
                nbMessage.Visible   = true;
            }

            base.OnLoad(e);
        }
예제 #7
0
        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack && _page.IsAuthorized("Administrate", CurrentPerson))
            {
                Rock.Model.PageService pageService = new Rock.Model.PageService();
                Rock.Model.Page        page        = pageService.Get(_page.Id);

                rptProperties.DataSource = tabs;
                rptProperties.DataBind();

                LoadDropdowns();

                tbPageName.Text             = _page.Name;
                tbPageTitle.Text            = _page.Title;
                ddlParentPage.SelectedValue = _page.ParentPage != null?_page.ParentPage.Id.ToString() : "0";

                ddlLayout.Text               = _page.Layout;
                ddlMenuWhen.SelectedValue    = (( Int32 )_page.DisplayInNavWhen).ToString();
                cbMenuDescription.Checked    = _page.MenuDisplayDescription;
                cbMenuIcon.Checked           = _page.MenuDisplayIcon;
                cbMenuChildPages.Checked     = _page.MenuDisplayChildPages;
                cbRequiresEncryption.Checked = _page.RequiresEncryption;
                cbEnableViewState.Checked    = _page.EnableViewState;
                cbIncludeAdminFooter.Checked = _page.IncludeAdminFooter;
                tbCacheDuration.Text         = _page.OutputCacheDuration.ToString();
                tbDescription.Text           = _page.Description;
                tbPageRoute.Text             = string.Join(",", page.PageRoutes.Select(route => route.Route).ToArray());
                imgIcon.ImageId              = page.IconFileId;
            }

            base.OnLoad(e);

            if (Page.IsPostBack)
            {
                Rock.Attribute.Helper.SetErrorIndicators(phAttributes, _page);
            }
        }
예제 #8
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                int pageId = Convert.ToInt32(PageParameter("EditPage"));
                _page = Rock.Web.Cache.PageCache.Read(pageId);

                if (_page != null)
                {
                    canConfigure = _page.IsAuthorized("Administrate", CurrentPerson);
                }
                else
                {
                    canConfigure = CurrentPage.IsAuthorized("Administrate", CurrentPerson);
                }

                if (canConfigure)
                {
                    rGrid.DataKeyNames         = new string[] { "id" };
                    rGrid.Actions.IsAddEnabled = true;
                    rGrid.Actions.AddClick    += rGrid_GridAdd;
                    rGrid.GridReorder         += new GridReorderEventHandler(rGrid_GridReorder);
                    rGrid.GridRebind          += new GridRebindEventHandler(rGrid_GridRebind);
                }
                else
                {
                    DisplayError("You are not authorized to configure this page");
                }
            }
            catch (SystemException ex)
            {
                DisplayError(ex.Message);
            }

            base.OnInit(e);
        }
예제 #9
0
        protected override void OnInit( EventArgs e )
        {
            try
            {
                int pageId = Convert.ToInt32( PageParameter( "EditPage" ) );
                _page = Rock.Web.Cache.PageCache.Read( pageId );

                if ( _page != null )
                    canConfigure = _page.IsAuthorized( "Administrate", CurrentPerson );
                else
                    canConfigure = CurrentPage.IsAuthorized( "Administrate", CurrentPerson );

                if ( canConfigure )
                {
                    rGrid.DataKeyNames = new string[] { "id" };
                    rGrid.Actions.IsAddEnabled = true;
                    rGrid.Actions.AddClick += rGrid_GridAdd;
                    rGrid.GridReorder += new GridReorderEventHandler( rGrid_GridReorder );
                    rGrid.GridRebind += new GridRebindEventHandler( rGrid_GridRebind );
                }
                else
                {
                    DisplayError( "You are not authorized to configure this page" );
                }
            }
            catch ( SystemException ex )
            {
                DisplayError( ex.Message );
            }

            base.OnInit( e );
        }
예제 #10
0
        protected override void OnInit( EventArgs e )
        {
            CurrentPage.AddScriptLink( Page, "~/Scripts/bootstrap-tabs.js" );

            int pageId = Convert.ToInt32( PageParameter( "EditPage" ) );
            _page = Rock.Web.Cache.PageCache.Read( pageId );
            _zoneName = this.PageParameter( "ZoneName" );

            lAllPages.Text = string.Format( "All Pages Using '{0}' Layout", CurrentPage.Layout );

            // TODO: Managing layout block instances should probably be controlled by site security
            if ( _page.IsAuthorized( "Administrate", CurrentPerson ) )
            {
                gLayoutBlocks.DataKeyNames = new string[] { "id" };
                gLayoutBlocks.Actions.IsAddEnabled = true;
                gLayoutBlocks.Actions.AddClick += LayoutBlocks_Add;
                gLayoutBlocks.GridReorder += gLayoutBlocks_GridReorder;
                gLayoutBlocks.GridRebind += gLayoutBlocks_GridRebind;
            }

            if ( _page.IsAuthorized( "Administrate", CurrentPerson ) )
            {
                gPageBlocks.DataKeyNames = new string[] { "id" };
                gPageBlocks.Actions.IsAddEnabled = true;
                gPageBlocks.Actions.AddClick += gPageBlocks_GridAdd;
                gPageBlocks.GridReorder += gPageBlocks_GridReorder;
                gPageBlocks.GridRebind += gPageBlocks_GridRebind;
            }

            string script = string.Format( @"
            Sys.Application.add_load(function () {{
            $('#modal-popup div.modal-header h3 small', window.parent.document).html('{0}');
            $('#{1} a').click(function() {{ $('#{3}').val('Page'); }});
            $('#{2} a').click(function() {{ $('#{3}').val('Layout'); }});
            }});
            ", _zoneName, liPage.ClientID, liLayout.ClientID, hfOption.ClientID );

            this.Page.ClientScript.RegisterStartupScript( this.GetType(), string.Format( "zone-add-load-{0}", this.ClientID ), script, true );

            base.OnInit( e );
        }
예제 #11
0
        protected override void OnInit(EventArgs e)
        {
            Rock.Web.UI.DialogMasterPage masterPage = this.Page.Master as Rock.Web.UI.DialogMasterPage;
            if (masterPage != null)
            {
                masterPage.OnSave += new EventHandler <EventArgs>(masterPage_OnSave);
            }

            try
            {
                int pageId = Convert.ToInt32(PageParameter("Page"));
                _page = Rock.Web.Cache.PageCache.Read(pageId);

                if (_page.IsAuthorized("Administrate", CurrentPerson))
                {
                    phAttributes.Controls.Clear();
                    Rock.Attribute.Helper.AddEditControls(_page, phAttributes, !Page.IsPostBack);

                    List <string> blockContexts = new List <string>();
                    foreach (var block in _page.Blocks)
                    {
                        var blockControl = TemplateControl.LoadControl(block.BlockType.Path) as Rock.Web.UI.RockBlock;
                        if (blockControl != null)
                        {
                            blockControl.CurrentPage  = _page;
                            blockControl.CurrentBlock = block;
                            foreach (var context in blockControl.ContextTypesRequired)
                            {
                                if (!blockContexts.Contains(context))
                                {
                                    blockContexts.Add(context);
                                }
                            }
                        }
                    }

                    phContextPanel.Visible = blockContexts.Count > 0;

                    int i = 0;
                    foreach (string context in blockContexts)
                    {
                        var tbContext = new LabeledTextBox();
                        tbContext.ID        = string.Format("context_{0}", i++);
                        tbContext.Required  = true;
                        tbContext.LabelText = context;

                        if (_page.PageContexts.ContainsKey(context))
                        {
                            tbContext.Text = _page.PageContexts[context];
                        }

                        phContext.Controls.Add(tbContext);
                    }
                }
                else
                {
                    DisplayError("You are not authorized to edit this page");
                }
            }
            catch (SystemException ex)
            {
                DisplayError(ex.Message);
            }

            base.OnInit(e);
        }