/// <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) { base.OnInit(e); rFilter.ApplyFilterClick += rFilter_ApplyFilterClick; rFilter.DisplayFilterValue += rFilter_DisplayFilterValue; _canConfigure = RockPage.IsAuthorized("Edit", CurrentPerson); if (_canConfigure) { rGridTransactions.DataKeyNames = new string[] { "id" }; rGridTransactions.Actions.ShowAdd = true; rGridTransactions.Actions.AddClick += rGridTransactions_Add; rGridTransactions.GridRebind += rGridTransactions_GridRebind; // enable delete transaction rGridTransactions.Columns[rGridTransactions.Columns.Count - 1].Visible = true; } else { DisplayError("You are not authorized to edit these transactions"); } if (!string.IsNullOrEmpty(GetAttributeValue("Title"))) { lTitle.Text = "<h4>" + GetAttributeValue("Title") + "</h4>"; } }
/// <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) { base.OnInit(e); // Load Entity Type Filter var entityTypes = new EntityTypeService().GetEntities().OrderBy(t => t.FriendlyName).ToList(); entityTypeFilter.EntityTypes = entityTypes; entityTypePicker.EntityTypes = entityTypes; _canConfigure = RockPage.IsAuthorized("Administrate", CurrentPerson); BindFilter(); rFilter.ApplyFilterClick += rFilter_ApplyFilterClick; if (_canConfigure) { rGrid.DataKeyNames = new string[] { "id" }; rGrid.Actions.ShowAdd = true; rGrid.Actions.AddClick += rGrid_Add; rGrid.GridReorder += rGrid_GridReorder; rGrid.GridRebind += rGrid_GridRebind; rGrid.RowDataBound += rGrid_RowDataBound; modalDetails.SaveClick += modalDetails_SaveClick; modalDetails.OnCancelScript = string.Format("$('#{0}').val('');", hfIdValue.ClientID); } else { nbMessage.Text = "You are not authorized to configure this page"; nbMessage.Visible = true; } }
/// <summary> /// Handles the Click event of the lbLoginLogout control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void lbLoginLogout_Click(object sender, EventArgs e) { if (action == "Login") { var site = RockPage.Layout.Site; if (site.LoginPageId.HasValue) { site.RedirectToLoginPage(true); } else { FormsAuthentication.RedirectToLoginPage(); } } else { FormsAuthentication.SignOut(); // After logging out check to see if an anonymous user is allowed to view the current page. If so // redirect back to the current page, otherwise redirect to the site's default page if (RockPage.IsAuthorized("View", null)) { Response.Redirect(CurrentPageReference.BuildUrl()); Context.ApplicationInstance.CompleteRequest(); } else { RockPage.Layout.Site.RedirectToDefaultPage(); } } }
/// <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) { base.OnInit(e); rFilter.ApplyFilterClick += rFilter_ApplyFilterClick; BindFilter(); if (RockPage.IsAuthorized("Administrate", CurrentPerson)) { gEmailTemplates.DataKeyNames = new string[] { "id" }; gEmailTemplates.Actions.ShowAdd = true; gEmailTemplates.Actions.AddClick += gEmailTemplates_AddClick; gEmailTemplates.GridRebind += gEmailTemplates_GridRebind; } }
protected override void OnLoad(EventArgs e) { nbMessage.Visible = false; if (RockPage.IsAuthorized("Administrate", CurrentPerson)) { if (!Page.IsPostBack) { BindPackageListGrid(); } } else { nbMessage.Text = "You are not authorized to edit."; nbMessage.Visible = true; } base.OnLoad(e); }
/// <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) { base.OnInit(e); _canConfigure = RockPage.IsAuthorized("Administrate", CurrentPerson); if (_canConfigure) { Guid entityTypeGuid = Guid.Empty; if (Guid.TryParse(GetAttributeValue("EntityType"), out entityTypeGuid)) { _entityTypeId = Rock.Web.Cache.EntityTypeCache.Read(entityTypeGuid).Id; catpParentCategory.EntityTypeId = _entityTypeId; int parentCategoryId = int.MinValue; if (int.TryParse(PageParameter("CategoryId"), out parentCategoryId)) { _parentCategoryId = parentCategoryId; } gCategories.DataKeyNames = new string[] { "id" }; gCategories.Actions.ShowAdd = true; gCategories.Actions.AddClick += gCategories_Add; gCategories.GridReorder += gCategories_GridReorder; gCategories.GridRebind += gCategories_GridRebind; mdDetails.SaveClick += mdDetails_SaveClick; mdDetails.OnCancelScript = string.Format("$('#{0}').val('');", hfIdValue.ClientID); } else { pnlList.Visible = false; nbMessage.Text = "Block has not been configured for a valid Enity Type."; nbMessage.Visible = true; } } else { pnlList.Visible = false; nbMessage.Text = "You are not authorized to configure this page."; nbMessage.Visible = true; } }
/// <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 (RockPage.IsAuthorized("Administrate", CurrentPerson)) { if (!Page.IsPostBack) { BindGrid(); } } else { gEmailTemplates.Visible = false; nbMessage.Text = WarningMessage.NotAuthorizedToEdit(EmailTemplate.FriendlyTypeName); nbMessage.Visible = true; } base.OnLoad(e); }
/// <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) { base.OnInit(e); rFBFilter.ApplyFilterClick += rFBFilter_ApplyFilterClick; rFBFilter.DisplayFilterValue += rFBFilter_DisplayFilterValue; _canConfigure = RockPage.IsAuthorized("Edit", CurrentPerson); if (_canConfigure) { rGridBatch.DataKeyNames = new string[] { "id" }; rGridBatch.Actions.ShowAdd = true; rGridBatch.Actions.AddClick += rGridBatch_Add; rGridBatch.GridRebind += rGridBatch_GridRebind; rGridBatch.GridReorder += rGridBatch_GridReorder; } else { DisplayError("You are not authorized to edit these batches"); } }
/// <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) { base.OnInit(e); gfSettings.ApplyFilterClick += gfSettings_ApplyFilterClick; gfSettings.DisplayFilterValue += gfSettings_DisplayFilterValue; bool canEdit = RockPage.IsAuthorized("Edit", CurrentPerson); rGridGivingProfile.DataKeyNames = new string[] { "id" }; rGridGivingProfile.Actions.ShowAdd = canEdit; rGridGivingProfile.IsDeleteEnabled = canEdit; rGridGivingProfile.Actions.AddClick += rGridGivingProfile_Add; rGridGivingProfile.GridRebind += rGridGivingProfile_GridRebind; TargetPerson = ContextEntity <Person>(); if (TargetPerson == null) { TargetPerson = CurrentPerson; } }
/// <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) { nbWarning.Visible = false; if (RockPage.IsAuthorized("Administrate", CurrentPerson)) { if (!Page.IsPostBack) { new EntityTypeService().RegisterEntityTypes(Request.MapPath("~")); BindGrid(); } } else { gEntityTypes.Visible = false; nbWarning.Text = WarningMessage.NotAuthorizedToEdit(EntityType.FriendlyTypeName); nbWarning.Visible = true; } base.OnLoad(e); }
/// <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) { base.OnInit(e); if (RockPage.IsAuthorized("Administrate", CurrentPerson)) { gEntityTypes.DataKeyNames = new string[] { "id" }; gEntityTypes.Actions.ShowAdd = true; gEntityTypes.Actions.AddClick += Actions_AddClick; gEntityTypes.RowSelected += gEntityTypes_EditRow; gEntityTypes.GridRebind += gEntityTypes_GridRebind; gEntityTypes.RowDataBound += gEntityTypes_RowDataBound; } // wire up page naviagte RockPage page = Page as RockPage; if (page != null) { page.PageNavigate += page_PageNavigate; } }
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 = RockPage.IsAuthorized("Administrate", CurrentPerson); } if (canConfigure) { rGrid.DataKeyNames = new string[] { "id" }; rGrid.Actions.ShowAdd = 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); }
/// <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) { // this event gets fired after block settings are updated. it's nice to repaint the screen if these settings would alter it this.BlockUpdated += Block_BlockUpdated; this.AddConfigurationUpdateTrigger(upnlContent); base.OnInit(e); var person = ContextEntity <Person>(); if (person != null) { _personId = person.Id; // Hide the person name column gUserLogins.Columns[1].Visible = false; } _canEdit = RockPage.IsAuthorized("Edit", CurrentPerson); gfSettings.ApplyFilterClick += gfSettings_ApplyFilterClick; gfSettings.DisplayFilterValue += gfSettings_DisplayFilterValue; gUserLogins.DataKeyNames = new string[] { "id" }; gUserLogins.Actions.ShowAdd = _personId.HasValue && _canEdit; gUserLogins.Actions.AddClick += gUserLogins_Add; gUserLogins.IsDeleteEnabled = _canEdit; gUserLogins.GridRebind += gUserLogins_GridRebind; if (_canEdit) { gUserLogins.RowSelected += gUserLogins_Edit; } mdDetails.SaveClick += mdDetails_SaveClick; mdDetails.OnCancelScript = string.Format("$('#{0}').val('');", hfIdValue.ClientID); }
/// <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) { base.OnInit(e); if (!bool.TryParse(GetAttributeValue("ConfigureType"), out _configuredType)) { _configuredType = true; } Guid entityTypeGuid = Guid.Empty; if (Guid.TryParse(GetAttributeValue("Entity"), out entityTypeGuid)) { _entityTypeId = EntityTypeCache.Read(entityTypeGuid).Id; } _entityQualifierColumn = GetAttributeValue("EntityQualifierColumn"); _entityQualifierValue = GetAttributeValue("EntityQualifierValue"); _displayValueEdit = Convert.ToBoolean(GetAttributeValue("AllowSettingofValues")); string entityIdString = GetAttributeValue("EntityId"); if (!string.IsNullOrWhiteSpace(entityIdString)) { int entityIdint = 0; if (int.TryParse(entityIdString, out entityIdint) && entityIdint > 0) { _entityId = entityIdint; } } _canConfigure = RockPage.IsAuthorized("Administrate", CurrentPerson); rFilter.ApplyFilterClick += rFilter_ApplyFilterClick; if (_canConfigure) { rGrid.DataKeyNames = new string[] { "id" }; rGrid.Actions.ShowAdd = true; rGrid.Actions.AddClick += rGrid_Add; rGrid.GridRebind += rGrid_GridRebind; rGrid.RowDataBound += rGrid_RowDataBound; rGrid.Columns[1].Visible = !_configuredType; // qualifier rGrid.Columns[4].Visible = !_displayValueEdit; // default value / value rGrid.Columns[5].Visible = _displayValueEdit; // edit rGrid.Columns[6].Visible = _displayValueEdit; // secure SecurityField securityField = rGrid.Columns[7] as SecurityField; securityField.EntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id; modalDetails.SaveClick += modalDetails_SaveClick; modalDetails.OnCancelScript = string.Format("$('#{0}').val('');", hfIdValues.ClientID); string editAttributeId = Request.Form[hfIdValues.UniqueID]; if (Page.IsPostBack && editAttributeId != null && editAttributeId.Trim() != string.Empty) { ShowEditValue(int.Parse(editAttributeId), false); } if (!_configuredType) { var entityTypeList = new EntityTypeService().GetEntities().ToList(); ddlEntityType.EntityTypes = entityTypeList; ddlAttrEntityType.EntityTypes = entityTypeList; } BindFilter(); } else { nbMessage.Text = "You are not authorized to configure this page"; nbMessage.Visible = true; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); _isAuthorizedToConfigure = RockPage.IsAuthorized("Administrate", CurrentPerson); // wire up page naviagte RockPage page = Page as RockPage; if (page != null) { page.PageNavigate += page_PageNavigate; } Type containerType = Type.GetType(GetAttributeValue("ComponentContainer")); if (containerType != null) { PropertyInfo instanceProperty = containerType.GetProperty("Instance"); if (instanceProperty != null) { _container = instanceProperty.GetValue(null, null) as IContainer; if (_container != null) { BindFilter(); rFilter.ApplyFilterClick += rFilter_ApplyFilterClick; if (!Page.IsPostBack) { _container.Refresh(); } rGrid.DataKeyNames = new string[] { "id" }; if (_isAuthorizedToConfigure) { rGrid.GridReorder += rGrid_GridReorder; } rGrid.Columns[0].Visible = _isAuthorizedToConfigure; // Reorder rGrid.GridRebind += rGrid_GridRebind; rGrid.RowDataBound += rGrid_RowDataBound; if (containerType.BaseType.GenericTypeArguments.Length > 0) { rGrid.RowItemText = containerType.BaseType.GenericTypeArguments[0].Name.SplitCase(); } } else { DisplayError("Could not get ContainerManaged instance from Instance property"); } } else { DisplayError("ContainerManaged class does not have an 'Instance' property"); } } else { DisplayError("Could not get the type of the specified Manged Component Container"); } }