/// <summary> /// Adds the Home page action. /// </summary> private void AddHomePageAction() { if (this.Count == 0) { return; } Action homeItem = null; Action firstItem = this[0]; UserContext user = UserContext.Current; if (user != null) { homeItem = ActionProvider.FindAction(user.StartPageUrl); } else { homeItem = ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl("~/default.aspx")); if (homeItem != null) { if (homeItem.AuthenticationRequired) { homeItem = null; } } } if (Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern) { if (homeItem != null) { if ((homeItem != null) && (firstItem.ActionId == homeItem.ActionId)) { base.Remove(firstItem); } } } else { if ((homeItem != null) && (firstItem.ActionId != homeItem.ActionId)) { base.Insert(0, homeItem.Clone()); } } }
public void RaisePostBackEvent(string eventArgument) { if (this.ItemClick != null) { Guid actionId = Guid.Empty; Micajah.Common.Bll.Action action = null; object obj = Support.ConvertStringToType(eventArgument, typeof(Guid)); if (obj != null) { actionId = (Guid)obj; } if (actionId != Guid.Empty) { action = ActionProvider.PagesAndControls.FindByActionId(actionId); if (action != null) { action = action.Clone(); } } this.ItemClick(this, new CommandEventArgs("ItemClick", action)); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { ActionCollection actions = new ActionCollection(); Micajah.Common.Bll.Action organizationPageAction = null; Micajah.Common.Bll.Action action = null; string descriptionFormat = null; Micajah.Common.Bll.Action organizationNodeTypePageAction = ActionProvider.FindAction(ActionProvider.NodeTypePageActionId); if (this.DisplayedEntityType == EntityType.Hierarchical) { organizationPageAction = ActionProvider.FindAction(ActionProvider.TreePageActionId); descriptionFormat = Resources.EntitiesControl_ActionDescriptionFormat; } else { organizationPageAction = ActionProvider.FindAction(ActionProvider.EntityFieldsPageActionId); descriptionFormat = Resources.EntitiesControl_EntityFieldsActionDescriptionFormat; } foreach (Entity entity in EntityFieldProvider.Entities) { if (this.DisplayedEntityType == EntityType.Hierarchical) { if (entity.EnableHierarchy) { UserContext user = UserContext.Current; if (user != null) { switch (entity.HierarchyStartLevel) { case EntityLevel.Instance: if (!user.IsInstanceAdministrator()) { continue; } break; case EntityLevel.Organization: if (!user.IsOrganizationAdministrator) { continue; } break; } } } else { continue; } } else if (entity.EnableHierarchy) { continue; } action = organizationPageAction.Clone(); action.Name = entity.Name; action.Description = string.Format(CultureInfo.CurrentCulture, descriptionFormat, entity.Name); if (string.IsNullOrEmpty(entity.CustomNavigateUrl)) { action.NavigateUrl = action.NavigateUrl + "?EntityId=" + entity.Id.ToString("N"); } else { action.NavigateUrl = entity.CustomNavigateUrl; } actions.Add(action); if (entity.EnableHierarchy && string.IsNullOrEmpty(entity.CustomNavigateUrl)) { action = organizationNodeTypePageAction.Clone(); action.Name = entity.Name + Resources.EntitiesControl_NodeTypes; action.Description = string.Format(CultureInfo.CurrentCulture, Resources.NodeTypesControl_ActionDescriptionFormat, action.Name); action.NavigateUrl = action.NavigateUrl + "?EntityId=" + entity.Id.ToString("N"); actions.Add(action); } } EntitiesMenu.DataSource = actions; } }