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.Page.Read( pageId ); if ( _page.Authorized( "Configure", CurrentUser ) ) { var attributeControls = Rock.Attribute.Helper.GetEditControls( _page, !Page.IsPostBack ); foreach ( HtmlGenericControl fs in attributeControls ) phAttributes.Controls.Add( fs ); } else { DisplayError( "You are not authorized to edit this page" ); } } catch ( SystemException ex ) { DisplayError( ex.Message ); } base.OnInit( e ); }
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.Page.Read(pageId); if (_page.Authorized("Configure", CurrentUser)) { var attributeControls = Rock.Attribute.Helper.GetEditControls(_page, !Page.IsPostBack); foreach (HtmlGenericControl fs in attributeControls) { phAttributes.Controls.Add(fs); } } else { DisplayError("You are not authorized to edit this page"); } } catch (SystemException ex) { DisplayError(ex.Message); } base.OnInit(e); }
protected override void OnInit(EventArgs e) { PageInstance.AddScriptLink(Page, "~/Scripts/bootstrap-tabs.js"); int pageId = Convert.ToInt32(PageParameter("EditPage")); _page = Rock.Web.Cache.Page.Read(pageId); _zoneName = this.PageParameter("ZoneName"); lAllPages.Text = string.Format("All Pages Using '{0}' Layout", PageInstance.Layout); // TODO: Managing layout block instances should probably be controlled by site security if (_page.Authorized("Configure", CurrentUser)) { gLayoutBlocks.DataKeyNames = new string[] { "id" }; gLayoutBlocks.Actions.EnableAdd = true; gLayoutBlocks.Actions.AddClick += LayoutBlocks_Add; gLayoutBlocks.GridReorder += gLayoutBlocks_GridReorder; gLayoutBlocks.GridRebind += gLayoutBlocks_GridRebind; } if (_page.Authorized("Configure", CurrentUser)) { gPageBlocks.DataKeyNames = new string[] { "id" }; gPageBlocks.Actions.EnableAdd = true; gPageBlocks.Actions.AddClick += gPageBlocks_GridAdd; gPageBlocks.GridReorder += gPageBlocks_GridReorder; gPageBlocks.GridRebind += gPageBlocks_GridRebind; } string script = string.Format(@" Sys.Application.add_load(function () {{ $('td.grid-icon-cell.delete a').click(function(){{ return confirm('Are you sure you want to delete this block?'); }}); $('#modal-popup div.modal-header h3 small', window.parent.document).html('{1}'); $('#{2} a').click(function() {{ $('#{4}').val('Page'); }}); $('#{3} a').click(function() {{ $('#{4}').val('Layout'); }}); }}); ", gPageBlocks.ClientID, _zoneName, liPage.ClientID, liLayout.ClientID, hfOption.ClientID); this.Page.ClientScript.RegisterStartupScript(this.GetType(), string.Format("grid-confirm-delete-{0}", gPageBlocks.ClientID), script, true); base.OnInit(e); }
protected override void OnInit(EventArgs e) { try { int pageId = Convert.ToInt32(PageParameter("EditPage")); _page = Rock.Web.Cache.Page.Read(pageId); if (_page != null) { canConfigure = _page.Authorized("Configure", CurrentUser); } else { canConfigure = PageInstance.Authorized("Configure", CurrentUser); } if (canConfigure) { rGrid.DataKeyNames = new string[] { "id" }; rGrid.Actions.EnableAdd = true; rGrid.Actions.AddClick += rGrid_GridAdd; rGrid.GridReorder += new GridReorderEventHandler(rGrid_GridReorder); rGrid.GridRebind += new GridRebindEventHandler(rGrid_GridRebind); string script = string.Format(@" Sys.Application.add_load(function () {{ $('td.grid-icon-cell.delete a').click(function(){{ return confirm('Are you sure you want to delete this page?'); }}); }}); ", rGrid.ClientID); this.Page.ClientScript.RegisterStartupScript(this.GetType(), string.Format("grid-confirm-delete-{0}", rGrid.ClientID), script, true); } else { DisplayError("You are not authorized to configure this page"); } } catch (SystemException ex) { DisplayError(ex.Message); } base.OnInit(e); }
protected override void OnLoad(EventArgs e) { nbMessage.Visible = false; if (_page.Authorized("Configure", CurrentUser)) { 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); }
protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack && _page.Authorized("Configure", CurrentUser)) { Rock.CMS.PageService pageService = new Rock.CMS.PageService(); Rock.CMS.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()); } base.OnLoad(e); if (Page.IsPostBack) { Rock.Attribute.Helper.SetErrorIndicators(phAttributes, _page); } }
protected override void OnInit( EventArgs e ) { try { int pageId = Convert.ToInt32( PageParameter( "EditPage" ) ); _page = Rock.Web.Cache.Page.Read( pageId ); if ( _page != null ) canConfigure = _page.Authorized( "Configure", CurrentUser ); else canConfigure = PageInstance.Authorized( "Configure", CurrentUser ); if ( canConfigure ) { rGrid.DataKeyNames = new string[] { "id" }; rGrid.Actions.EnableAdd = true; rGrid.Actions.AddClick += rGrid_GridAdd; rGrid.GridReorder += new GridReorderEventHandler( rGrid_GridReorder ); rGrid.GridRebind += new GridRebindEventHandler( rGrid_GridRebind ); string script = string.Format( @" Sys.Application.add_load(function () {{ $('td.grid-icon-cell.delete a').click(function(){{ return confirm('Are you sure you want to delete this page?'); }}); }}); ", rGrid.ClientID ); this.Page.ClientScript.RegisterStartupScript( this.GetType(), string.Format( "grid-confirm-delete-{0}", rGrid.ClientID ), script, true ); } else { DisplayError( "You are not authorized to configure this page" ); } } catch ( SystemException ex ) { DisplayError( ex.Message ); } base.OnInit( e ); }
protected override void OnInit( EventArgs e ) { PageInstance.AddScriptLink( Page, "~/Scripts/bootstrap-tabs.js" ); int pageId = Convert.ToInt32( PageParameter( "EditPage" ) ); _page = Rock.Web.Cache.Page.Read( pageId ); _zoneName = this.PageParameter( "ZoneName" ); lAllPages.Text = string.Format( "All Pages Using '{0}' Layout", PageInstance.Layout ); // TODO: Managing layout block instances should probably be controlled by site security if ( _page.Authorized( "Configure", CurrentUser ) ) { gLayoutBlocks.DataKeyNames = new string[] { "id" }; gLayoutBlocks.Actions.EnableAdd = true; gLayoutBlocks.Actions.AddClick += LayoutBlocks_Add; gLayoutBlocks.GridReorder += gLayoutBlocks_GridReorder; gLayoutBlocks.GridRebind += gLayoutBlocks_GridRebind; } if ( _page.Authorized( "Configure", CurrentUser ) ) { gPageBlocks.DataKeyNames = new string[] { "id" }; gPageBlocks.Actions.EnableAdd = true; gPageBlocks.Actions.AddClick += gPageBlocks_GridAdd; gPageBlocks.GridReorder += gPageBlocks_GridReorder; gPageBlocks.GridRebind += gPageBlocks_GridRebind; } string script = string.Format( @" Sys.Application.add_load(function () {{ $('td.grid-icon-cell.delete a').click(function(){{ return confirm('Are you sure you want to delete this block?'); }}); $('#modal-popup div.modal-header h3 small', window.parent.document).html('{1}'); $('#{2} a').click(function() {{ $('#{4}').val('Page'); }}); $('#{3} a').click(function() {{ $('#{4}').val('Layout'); }}); }}); ", gPageBlocks.ClientID, _zoneName, liPage.ClientID, liLayout.ClientID, hfOption.ClientID ); this.Page.ClientScript.RegisterStartupScript( this.GetType(), string.Format( "grid-confirm-delete-{0}", gPageBlocks.ClientID ), script, true ); base.OnInit( e ); }