private void AddBreadCrumbs(bool addGroupName) { if (this.MasterPage != null) { Micajah.Common.Bll.Action item = null; if (addGroupName) { item = this.MasterPage.ActiveAction.Clone(); item.Name = this.GroupName; item.NavigateUrl += "?GroupId=" + this.GroupId.ToString("N"); } else { item = new Micajah.Common.Bll.Action(); item.ActionId = Guid.NewGuid(); item.Name = Resources.GroupsInstancesRolesControl_ActionsTable_Caption; item.ParentAction = this.MasterPage.ActiveAction; } UserContext.Breadcrumbs.Add(item); this.MasterPage.UpdateBreadcrumbs(false); } }
private HyperLink CreateItemLink(Micajah.Common.Bll.Action item, string text, bool showToolTip, Control innerControl, bool raiseItemDataBound) { using (HyperLink link = new HyperLink()) { if (innerControl != null) { link.Controls.Add(innerControl); } else { link.Text = (text == null) ? item.CustomName : text; } link.NavigateUrl = this.GetItemLinkNavigateUrl(item); if (showToolTip) { string customDescription = item.CustomDescription; if (!string.IsNullOrEmpty(customDescription)) { link.ToolTip = customDescription; } } if (raiseItemDataBound) { if (this.ItemDataBound != null) { this.ItemDataBound(link, new CommandEventArgs("ItemDataBound", item)); } } return(link); } }
private static Image CreateItemIcon(Micajah.Common.Bll.Action item, IconSize iconSize) { Image img = null; try { img = new Image(); img.ImageAlign = ImageAlign.AbsMiddle; img.ImageUrl = CustomUrlProvider.CreateApplicationAbsoluteUrl(item.IconUrl); if (iconSize != IconSize.NotSet) { img.Height = img.Width = Unit.Pixel((int)iconSize); } string descr = item.CustomDescription; if (!string.IsNullOrEmpty(descr)) { img.ToolTip = descr; } return(img); } finally { if (img != null) { img.Dispose(); } } }
private void Redirect() { if (UserContext.Current.OrganizationId == (Guid)EditForm.DataKey[0]) { Micajah.Common.Bll.Action action = ActionProvider.PagesAndControls.FindByActionId(ActionProvider.OrganizationsPageActionId); if (action != null) { Response.Redirect(action.AbsoluteNavigateUrl); } } }
private void AddBreadcrumbs() { if (this.MasterPage != null) { Micajah.Common.Bll.Action item = new Micajah.Common.Bll.Action(); item.ActionId = Guid.NewGuid(); item.Name = RecurrenceScheduleControl.Description; item.ParentAction = this.MasterPage.ActiveAction; UserContext.Breadcrumbs.Add(item); } }
protected virtual void AddBreadcrumbs() { if (this.MasterPage != null) { Micajah.Common.Bll.Action item = new Micajah.Common.Bll.Action(); item.ActionId = Guid.NewGuid(); item.Name = EditForm.Caption; item.ParentAction = this.MasterPage.ActiveAction; UserContext.Breadcrumbs.Add(item); this.MasterPage.UpdateBreadcrumbs(); } }
private static Control CreateLinkAsListItem(Micajah.Common.Bll.Action action, string cssClass) { bool moderTheme = (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == MasterPageTheme.Modern); using (HtmlGenericControl li = new HtmlGenericControl("li")) { if (!string.IsNullOrEmpty(cssClass)) { li.Attributes["class"] = cssClass; } li.Controls.Add(Submenu.CreateLink(action, moderTheme)); return(li); } }
private HtmlGenericControl CreateSimpleItem(Micajah.Common.Bll.Action item, bool rootAndGroup) { HtmlGenericControl div = null; Label lbl = null; try { div = new HtmlGenericControl("div"); if (rootAndGroup) { lbl = new Label(); lbl.Text = item.CustomName; div.Controls.Add(lbl); } else { div.Controls.Add(CreateItemLink(item)); } if ((!item.GroupInDetailMenu) && item.ShowDescriptionInDetailMenu && (this.Theme != DetailMenuTheme.Decorated)) { string descr = item.CustomDescription; if (!string.IsNullOrEmpty(descr)) { div.Controls.Add(CreateItemDescription(descr)); } } Control ctrl = CreateChildItems(item); if (ctrl != null) { div.Controls.Add(ctrl); } return(div); } finally { if (div != null) { div.Dispose(); } if (lbl != null) { lbl.Dispose(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.LoadResources(); UserListRow.Visible = false; Micajah.Common.Bll.Action action = ActionProvider.PagesAndControls.FindByActionId(ActionProvider.ConfigurationPageActionId); if (action != null) { CancelLink.NavigateUrl = action.CustomAbsoluteNavigateUrl; } this.ApplyFilters(); } }
private Control CreateChildItems(Micajah.Common.Bll.Action item) { HtmlGenericControl div = null; if (item.ShowChildrenInDetailMenu) { ActionCollection availableChildActions = item.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); if (availableChildActions.Count > 0) { ControlList list = null; try { div = new HtmlGenericControl("div"); div.Attributes["class"] = "C"; list = new ControlList(); list.Delimiter = ", "; foreach (Micajah.Common.Bll.Action childItem in availableChildActions) { if (list.Count < MaxChildItems) { list.Add(CreateItemLink(childItem)); } else { list.Add(CreateItemLink(item, Resources.DetailMenu_Ellipsis, false)); break; } } div.Controls.Add(list); } finally { if (div != null) { div.Dispose(); } if (list != null) { list.Dispose(); } } } } return(div); }
protected void UserDetailMenu_ItemClick(object sender, CommandEventArgs e) { if (e == null) { return; } Micajah.Common.Bll.Action action = e.CommandArgument as Micajah.Common.Bll.Action; if (action == null) { return; } if (action.ActionId == ActionProvider.UserNameAndEmailPageActionId) { UserDetailMenu.Visible = false; EditForm.Visible = true; EditForm_ShowDetails(true); EditForm.Fields[19].Visible = false; EditForm.ChangeMode(DetailsViewMode.Edit); EditForm.DataBind(); this.AddBreadCrumbs(action, EditForm); } else if (action.ActionId == ActionProvider.UserPasswordPageActionId) { UserDetailMenu.Visible = false; PasswordForm.Visible = true; PasswordForm.LoginId = this.SelectedUserId; this.AddBreadCrumbs(action, PasswordForm.EditForm); } else if (action.ActionId == ActionProvider.UserGroupsPageActionId) { UserDetailMenu.Visible = false; EditUserGroupsForm.Visible = true; EditUserGroupsForm.ChangeMode(DetailsViewMode.Edit); EditUserGroupsForm.DataBind(); this.AddBreadCrumbs(action, EditUserGroupsForm); } else if (action.ActionId == ActionProvider.UserActivateInactivatePageActionId) { UserDetailMenu.Visible = false; EditUserActiveForm.Visible = true; EditUserActiveForm.ChangeMode(DetailsViewMode.Edit); EditUserActiveForm.DataBind(); this.AddBreadCrumbs(action, EditUserActiveForm); } }
private HyperLink CreateItemIconLink(Micajah.Common.Bll.Action item) { using (HyperLink link = new HyperLink()) { link.NavigateUrl = this.GetItemLinkNavigateUrl(item); string customDescription = item.CustomDescription; if (!string.IsNullOrEmpty(customDescription)) { link.ToolTip = customDescription; } link.Controls.Add(CreateItemIcon(item, this.IconSize)); return(link); } }
//public override bool AccessDenied(Micajah.Common.Bll.Action action) //{ // return (action.Name == "BWD Time"); //} public override string GetDescription(Micajah.Common.Bll.Action action) { string description = null; if (action != null) { switch (action.Name.ToLower(CultureInfo.CurrentCulture)) { case "my open tickets": description = action.Description + ". It's the custom string that can be added to the description of the action."; break; default: description = base.GetDescription(action); break; } } return(description); }
/// <summary> /// Raises when a security module has established the identity of the user. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains the event data.</param> protected virtual void Application_AuthenticateRequest(object sender, EventArgs e) { string pageUrl = Request.AppRelativeCurrentExecutionFilePath; if (ResourceProvider.IsResourceUrl(pageUrl)) { Context.SkipAuthorization = true; } else if (ActionProvider.IsPublicPage(pageUrl)) { if ((!FrameworkConfiguration.Current.WebApplication.Password.EnablePasswordRetrieval) && (string.Compare(pageUrl, ResourceProvider.PasswordRecoveryPageVirtualPath, StringComparison.OrdinalIgnoreCase) == 0)) { throw new HttpException(404, Resources.Error_404); } else { Micajah.Common.Bll.Action action = ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery)); if (action != null) { Context.SkipAuthorization = (!action.AuthenticationRequired); } else { Context.SkipAuthorization = true; } switch (FrameworkConfiguration.Current.WebApplication.AuthenticationMode) { case AuthenticationMode.Forms: HttpCookie authCookie = Context.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie == null) { FormsIdentity id = new FormsIdentity(new FormsAuthenticationTicket(string.Empty, false, FrameworkConfiguration.Current.WebApplication.Login.Timeout)); GenericPrincipal principal = new GenericPrincipal(id, null); Context.User = principal; } break; } } } }
private string GetItemLinkNavigateUrl(Micajah.Common.Bll.Action item) { if (item.NavigateUrl != null) { string url = item.CustomAbsoluteNavigateUrl; if (!string.IsNullOrEmpty(this.ObjectId)) { if (url.Contains("?")) { url += "&ObjectId=" + HttpUtility.UrlEncode(this.ObjectId); } else { url += "?ObjectId=" + HttpUtility.UrlEncode(this.ObjectId); } } return(url); } return(this.Page.ClientScript.GetPostBackClientHyperlink(this, item.ActionId.ToString("N"), false)); }
private bool FindWarningMessage(Micajah.Common.Bll.Action action) { ActionCollection accColl = action.GetAvailableChildActions(Micajah.Common.Security.UserContext.Current.ActionIdList, false, true); foreach (Micajah.Common.Bll.Action act in accColl) { if (act.Description == "DispayAsWarningMessage") { if ((m_StartMenuCheckedItems != null) && m_StartMenuCheckedItems.Contains(act.ActionId)) { ((Micajah.Common.Pages.MasterPage)Page.Master).MessageType = NoticeMessageType.Warning; ((Micajah.Common.Pages.MasterPage)Page.Master).Message = act.CustomName; } return(true); } if (FindWarningMessage(act)) { return(true); } } return(false); }
// Just validates the access rights of current user to specified URL. internal static void ValidateRedirectUrl(ref string redirectUrl) { if (!string.IsNullOrEmpty(redirectUrl)) { if (string.Compare(CustomUrlProvider.CreateApplicationRelativeUrl(redirectUrl), "/", StringComparison.OrdinalIgnoreCase) == 0) { redirectUrl = null; } else { Guid actionId = Guid.Empty; object obj = Support.ConvertStringToType(Support.ExtractQueryStringParameterValue(redirectUrl, "pageid"), typeof(Guid)); if (obj != null) { actionId = (Guid)obj; } Micajah.Common.Bll.Action action = ActionProvider.FindAction(actionId, CustomUrlProvider.CreateApplicationAbsoluteUrl(redirectUrl)); if (action != null) { if (action.AuthenticationRequired) { UserContext user = UserContext.Current; if (user != null && user.OrganizationId != Guid.Empty) { if (!user.ActionIdList.Contains(action.ActionId)) { redirectUrl = null; } } } } else { redirectUrl = null; } } } }
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)); } }
public override string GetName(Micajah.Common.Bll.Action action) { string name = null; if (action != null) { switch (action.Name.ToLower(CultureInfo.CurrentCulture)) { case "my open tickets": name = action.Name + " (8)"; break; case "my closed tickets": name = action.Name + " (141)"; break; default: name = base.GetName(action); break; } } return(name); }
protected void StartMenu_ItemClick(object sender, CommandEventArgs e) { if (e == null) { return; } Micajah.Common.Bll.Action action = (Micajah.Common.Bll.Action)e.CommandArgument; if (m_StartMenuCheckedItems == null) { m_StartMenuCheckedItems = new List <Guid>(); } if (!m_StartMenuCheckedItems.Contains(action.ActionId)) { m_StartMenuCheckedItems.Add(action.ActionId); SaveStartMenuCheckedItems(action.ActionId.ToString("N")); this.RegisterFancyBoxInitScript(); } }
private void AddBreadCrumbs(Micajah.Common.Bll.Action action, object sender) { if (this.MasterPage != null) { Guid actionId = Guid.NewGuid(); Micajah.Common.Bll.Action item = this.MasterPage.ActiveAction.Clone(); item.ActionId = actionId; item.Name = UserDetailMenu.Title; item.Description = UserDetailMenu.Title; item.ParentAction = this.MasterPage.ActiveAction; if (sender != null) { Control ctl = sender as Control; if (ctl != null) { ctl = ctl.FindControl("btnCancel"); if (ctl != null) { item.NavigateUrl = this.Page.ClientScript.GetPostBackClientHyperlink(ctl, null); } } } UserContext.Breadcrumbs.Add(item); if (action != null) { action.ParentActionId = actionId; UserContext.Breadcrumbs.Add(action); } this.MasterPage.UpdateBreadcrumbs(false); } }
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; } }
private HyperLink CreateItemLink(Micajah.Common.Bll.Action item, string text, bool showToolTip) { return(this.CreateItemLink(item, text, showToolTip, null, true)); }
private HyperLink CreateItemLink(Micajah.Common.Bll.Action item) { return(CreateItemLink(item, null, true)); }
/// <summary> /// Occurs when the request state (for example, session state) that is associated with the current request has been obtained. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains the event data.</param> protected virtual void Application_PostAcquireRequestState(object sender, EventArgs e) { HttpContext http = HttpContext.Current; if (http == null) { return; } if (http.Session == null) { return; } UserContext user = null; Micajah.Common.Bll.Action action = null; CustomUrlElement customUrlSettings = FrameworkConfiguration.Current.WebApplication.CustomUrl; string host = http.Request.Url.Host; bool isDefaultPartialCustomUrl = false; if (customUrlSettings.Enabled) { isDefaultPartialCustomUrl = CustomUrlProvider.IsDefaultVanityUrl(host); } if (!isDefaultPartialCustomUrl) { if (http.Session.IsNewSession) { user = UserContext.Current; if (user != null) { LoginProvider.Current.UpdateSession(user.UserId, http.Session.SessionID); } } if (!http.SkipAuthorization) { if (user == null) { user = UserContext.Current; } if (user == null) { action = ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery)); if (action != null) { if (action.AuthenticationRequired) { LoginProvider.Current.SignOut(true, Request.Url.PathAndQuery); } } } else if (!customUrlSettings.Enabled) { if (!LoginProvider.Current.ValidateSession(user.UserId, http.Session.SessionID)) { LoginProvider.Current.SignOut(true, true, true); } } } } if (!customUrlSettings.Enabled) { return; } if (!((http.User != null) && (http.User.Identity != null) && http.User.Identity.IsAuthenticated)) { return; } string redirectUrl = string.Empty; Guid organizationId = Guid.Empty; Guid instanceId = Guid.Empty; if (http.Session.IsNewSession || (string.Compare(host, UserContext.VanityUrl, StringComparison.OrdinalIgnoreCase) != 0)) { if (isDefaultPartialCustomUrl) { return; } string vanityUrl = null; bool setAuthCookie = true; CustomUrlProvider.ParseHost(host, ref organizationId, ref instanceId); if (organizationId == Guid.Empty) { Guid userId = Guid.Empty; LoginProvider.ParseUserIdentityName(out userId, out organizationId, out instanceId); if (userId != Guid.Empty) { setAuthCookie = false; vanityUrl = CustomUrlProvider.GetVanityUrl(organizationId, instanceId); } } else { vanityUrl = host; UserContext.VanityUrl = host; } if (string.IsNullOrEmpty(vanityUrl)) { if (!isDefaultPartialCustomUrl) { http.Session.Abandon(); // Important fix of the issue with the same SessionID for all the child domains. redirectUrl = CustomUrlProvider.CreateApplicationUri(http.Request.Url.PathAndQuery); } } else { if (string.Compare(host, vanityUrl, StringComparison.OrdinalIgnoreCase) == 0) { if (user == null) { user = UserContext.Current; } if (user != null) { try { if (user.OrganizationId != organizationId) { user.SelectOrganization(organizationId, setAuthCookie, null, null); user.SelectInstance(instanceId, setAuthCookie, null); } else if (user.InstanceId != instanceId) { user.SelectInstance(instanceId, setAuthCookie, null); } } catch (AuthenticationException) { redirectUrl = LoginProvider.Current.GetLoginUrl(null, null, Guid.Empty, Guid.Empty, null, CustomUrlProvider.CreateApplicationUri(host, null)); } } } if (string.IsNullOrEmpty(redirectUrl)) { if (string.Compare(host, customUrlSettings.PartialCustomUrlRootAddressesFirst, StringComparison.OrdinalIgnoreCase) == 0) { http.Session.Abandon(); // Important fix of the issue with the same SessionID for all the child domains. } redirectUrl = CustomUrlProvider.CreateApplicationUri(vanityUrl, http.Request.Url.PathAndQuery); } } } else { if (user == null) { user = UserContext.Current; } if (user != null) { CustomUrlProvider.ParseHost(host, ref organizationId, ref instanceId); if (user.OrganizationId != Guid.Empty) { if (user.OrganizationId != organizationId) { redirectUrl = LoginProvider.Current.GetLoginUrl(null, null, organizationId, instanceId, null); } else { if (instanceId == Guid.Empty) { if (user.InstanceId != Guid.Empty) { try { user.SelectOrganization(organizationId, true, null, null); } catch (AuthenticationException) { redirectUrl = LoginProvider.Current.GetLoginUrl(null, null, organizationId, Guid.Empty, null); } } } else if (user.InstanceId != instanceId) { redirectUrl = LoginProvider.Current.GetLoginUrl(null, null, organizationId, instanceId, null); } } } else if (organizationId != Guid.Empty) { redirectUrl = LoginProvider.Current.GetLoginUrl(Guid.Empty, organizationId); } } } if (!string.IsNullOrEmpty(redirectUrl)) { if ((redirectUrl.IndexOf(http.Request.Url.ToString(), StringComparison.OrdinalIgnoreCase) == -1) && (http.Request.Url.ToString().IndexOf(redirectUrl, StringComparison.OrdinalIgnoreCase) == -1)) { http.Response.Redirect(redirectUrl); } } }
private Control CreateItem(Micajah.Common.Bll.Action item, bool root) { HtmlGenericControl div = null; HtmlTable table = null; HtmlTableRow tr = null; HtmlTableCell td = null; HyperLink lnk = null; Label lbl = null; try { bool rootAndGroup = (root && item.GroupInDetailMenu); if ((!string.IsNullOrEmpty(item.IconUrl)) || (this.Theme == DetailMenuTheme.SideBySide)) { div = new HtmlGenericControl("div"); div.Attributes["class"] = "P"; table = new HtmlTable(); table.CellPadding = table.CellSpacing = 0; tr = new HtmlTableRow(); td = new HtmlTableCell(); if (!string.IsNullOrEmpty(item.IconUrl)) { td.Attributes["class"] = "P"; if (rootAndGroup) { td.Controls.Add(CreateItemIcon(item, this.IconSize)); } else { td.Controls.Add(CreateItemIconLink(item)); } tr.Cells.Add(td); td = new HtmlTableCell(); } if (rootAndGroup) { lbl = new Label(); lbl.Text = item.CustomName; td.Controls.Add(lbl); } else { lnk = CreateItemLink(item, null, ((this.Theme != DetailMenuTheme.SideBySide) || this.ShowDescriptionAsToolTip.GetValueOrDefault(false))); td.Controls.Add(lnk); } if (item.ShowDescriptionInDetailMenu && (this.Theme != DetailMenuTheme.SideBySide)) { if (!item.GroupInDetailMenu) { string descr = item.CustomDescription; if (!string.IsNullOrEmpty(descr)) { td.Controls.Add(CreateItemDescription(descr)); } } } Control ctrl = CreateChildItems(item); if (ctrl != null) { td.Controls.Add(ctrl); } tr.Cells.Add(td); if (this.Theme == DetailMenuTheme.SideBySide) { if (!this.ShowDescriptionAsToolTip.GetValueOrDefault(false)) { if (!(root && item.GroupInDetailMenu) && item.ShowDescriptionInDetailMenu) { td.Width = "35%"; td = new HtmlTableCell(); td.Attributes["class"] = "D"; td.Width = "65%"; td.InnerHtml = item.CustomDescription; tr.Cells.Add(td); } } } table.Rows.Add(tr); div.Controls.Add(table); } else { div = CreateSimpleItem(item, rootAndGroup); } return(div); } finally { if (div != null) { div.Dispose(); } if (table != null) { table.Dispose(); } if (tr != null) { tr.Dispose(); } if (td != null) { td.Dispose(); } if (lnk != null) { lnk.Dispose(); } if (lbl != null) { lbl.Dispose(); } } }
protected void Page_Load(object sender, EventArgs e) { m_IsModernTheme = (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern); m_UserContext = UserContext.Current; this.LoadResources(); if (!this.IsPostBack) { this.EnsureActiveInstance(); } this.List_DataBind(); if (!string.IsNullOrEmpty(this.ReturnUrl)) { CancelLink.NavigateUrl = this.ReturnUrl; } DetailMenu1.ShowDescriptionAsToolTip = true; if (this.DisplayedSettingLevel != SettingLevels.Group) { if (this.MasterPage != null) { if (this.ActionId != Guid.Empty) { this.MasterPage.CustomName = this.Action.CustomName; } Micajah.Common.Bll.Action action = this.MasterPage.ActiveAction; while ((action != null) && (action.ActionId != ActionProvider.ConfigurationPageActionId)) { action = action.ParentAction; if (action != null) { if (!action.GroupInDetailMenu) { break; } } } if (string.IsNullOrEmpty(this.ReturnUrl)) { if (action != null) { CancelLink.NavigateUrl = action.CustomAbsoluteNavigateUrl; } } } if (this.Action == null) { DetailMenu1.Visible = false; } else { DetailMenu1.ParentActionId = m_Action.ActionId; } } else { if (string.IsNullOrEmpty(this.ReturnUrl)) { CancelLink.NavigateUrl = string.Concat(CustomUrlProvider.CreateApplicationAbsoluteUrl(ResourceProvider.GroupsInstancesRolesPageVirtualPath), "?GroupId=", GroupId.ToString("N")); } DetailMenu1.Visible = false; if (this.DiagnoseConflictingSettings) { CommandBar.Visible = false; } } if (m_IsModernTheme) { CancelLink.Visible = false; } else { AutoGeneratedButtonsField.InsertButtonSeparator(ButtonsSeparator); } }
private void Redirect() { Micajah.Common.Bll.Action action = ActionProvider.PagesAndControls.FindByActionId(ActionProvider.MyAccountPageActionId); Response.Redirect((action != null) ? action.AbsoluteNavigateUrl : UserContext.Current.StartPageUrl); }
/// <summary> /// Occurs when the page is being loaded. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains no event data.</param> protected void Page_Load(object sender, EventArgs e) { Micajah.Common.Pages.MasterPage.CreatePageHeader(this.Page, false, false); if (!IsPostBack) { Micajah.Common.Bll.Action action = ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery)); Micajah.Common.Pages.MasterPage.SetPageTitle(this.Page, action); if (string.Compare(Request.QueryString["ao"], "1", StringComparison.OrdinalIgnoreCase) == 0) { ActiveInstanceControl.ShowError(Resources.ActiveOrganizationControl_YouAreLoggedIntoAnotherOrganization, ErrorPanel); } LogOffLink.Text = Resources.ActiveOrganizationControl_LogoffLink_Text; UserContext user = UserContext.Current; if (user.IsFrameworkAdministrator) { OrLabel1.Text = Resources.ActiveOrganizationControl_OrText; SetupLinkContainer.Visible = true; SetupLink.Text = Resources.ActiveOrganizationControl_SetupLink_Text; action = ActionProvider.PagesAndControls.FindByActionId(ActionProvider.SetupPageActionId); if (action != null) { SetupLink.NavigateUrl = action.AbsoluteNavigateUrl; } } if (user.CanLogOnAsUser) { OrLabel2.Text = Resources.ActiveOrganizationControl_OrText; LogOnAsAnotherUserLinkContainer.Visible = true; LogOnAsAnotherUserLink.Text = Resources.ActiveOrganizationControl_LogOnAsAnotherUserLink_Text; action = ActionProvider.GlobalNavigationLinks.FindByActionId(ActionProvider.LoginAsUserGlobalNavigationLinkActionId); if (action != null) { LogOnAsAnotherUserLink.NavigateUrl = action.AbsoluteNavigateUrl; } } OrganizationCollection coll = LoginProvider.Current.GetOrganizationsByLoginId(user.UserId); int count = 0; if (coll != null) { count = coll.Count; if (count > 1) { coll = coll.FindAllVisible(); count = coll.Count; if (count == 1) { if (user.OrganizationId != Guid.Empty) { if (coll[0].OrganizationId != user.OrganizationId) { count = 2; } } } } } if (count == 0) { if (user.IsFrameworkAdministrator) { OrLabel1.Visible = false; } else if (user.CanLogOnAsUser) { OrLabel2.Visible = false; } } if (count == 0) { ActiveInstanceControl.ShowError(Resources.UserContext_ErrorMessage_YouAreNotAssociatedWithOrganizations, ErrorPanel); } else if ((count == 1) && (!user.CanLogOnAsUser)) { OrganizationArea.Visible = false; OrLabel3.Visible = false; ErrorPanel.Style.Add(HtmlTextWriterStyle.PaddingBottom, "7px"); SelectOrganization(coll[0].OrganizationId, Request.QueryString["returnurl"], true, ErrorPanel); } else { DescriptionLabel.Text = Resources.ActiveOrganizationControl_DescriptionLabel_Text; OrLabel3.Text = Resources.ActiveOrganizationControl_OrText; coll.SortByExpiration(); OrganizationList.DataSource = coll; OrganizationList.DataBind(); } } if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern) { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnModernStyleSheet, true))); } else { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnStyleSheet, true))); } }
/// <summary> /// Creates the global navigation links. /// </summary> /// <param name="isSecureConnection">The flag indicating whether the HTTP connection uses secure sockets.</param> /// <returns>The control that represents the global navigation links.</returns> private Control CreateGlobalNavigation(bool isSecureConnection) { ControlList links = null; HyperLink link = null; HyperLink link2 = null; HtmlGenericControl ul = null; HtmlGenericControl ul2 = null; HtmlGenericControl li = null; HtmlGenericControl li2 = null; try { if (m_ModernTheme) { ul = new HtmlGenericControl("ul"); ul.Attributes["class"] = "nav pull-right"; } else { links = new ControlList(); } Micajah.Common.Bll.ActionCollection items = ActionProvider.GlobalNavigationLinks.FindByActionId(ActionProvider.GlobalNavigationLinksActionId).GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); if (m_ModernTheme) { li = (HtmlGenericControl)CreateApplicationLogoListItem("Al"); ul.Controls.Add(li); } else { Micajah.Common.Bll.Action item = items.FindByActionId(ActionProvider.MyAccountMenuGlobalNavigationLinkActionId); if (item != null) { Micajah.Common.Bll.ActionCollection items2 = item.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); items.AddRange(items2); items.Sort(); } } foreach (Micajah.Common.Bll.Action item in items) { link = new HyperLink(); link.NavigateUrl = item.CustomAbsoluteNavigateUrl; link.ToolTip = item.Description; if (m_ModernTheme) { li = new HtmlGenericControl("li"); string iconUrl = null; string text = item.CustomName; string cssClass = "Icon"; if (item.ActionId == ActionProvider.MyAccountMenuGlobalNavigationLinkActionId) { iconUrl = string.Format(CultureInfo.InvariantCulture, "{0}{1}www.gravatar.com/avatar/{2}?s=24" , (isSecureConnection ? Uri.UriSchemeHttps : Uri.UriSchemeHttp), Uri.SchemeDelimiter, Support.CalculateMD5Hash(m_UserContext.Email.ToLowerInvariant())); cssClass += " Avtr"; } else { if (item.ActionId == ActionProvider.PageHelpGlobalNavigationLinkActionId) { if (!m_MasterPage.VisibleHelpLink) { continue; } link.Attributes["onclick"] = m_MasterPage.HelpLinkOnClick; } if (!string.IsNullOrEmpty(item.IconUrl)) { iconUrl = item.IconUrl; if (iconUrl.IndexOf("glyphicon", StringComparison.OrdinalIgnoreCase) == -1) { iconUrl = CustomUrlProvider.CreateApplicationAbsoluteUrl(iconUrl); } else { using (Label label = new Label()) { label.CssClass = "glyphicon " + iconUrl; if (string.IsNullOrEmpty(text)) { label.CssClass += " no-margin"; } link.Controls.Add(label); } iconUrl = null; } } } if (!string.IsNullOrEmpty(iconUrl)) { using (Image image = new Image()) { image.ImageUrl = iconUrl; image.CssClass = cssClass; link.Controls.Add(image); } } if (!string.IsNullOrEmpty(text)) { using (LiteralControl literal = new LiteralControl(text)) { link.Controls.Add(literal); } } li.Controls.Add(link); ul.Controls.Add(li); ActionCollection childActions = item.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); if (childActions.Count > 0) { link.CssClass = "dropdown-toggle"; link.Attributes["data-toggle"] = "dropdown"; using (Label label = new Label()) { label.CssClass = "caret"; link.Controls.Add(label); } ul2 = new HtmlGenericControl("ul"); ul2.Attributes["class"] = "dropdown-menu blue"; foreach (Micajah.Common.Bll.Action item2 in childActions) { li2 = new HtmlGenericControl("li"); link2 = new HyperLink(); link2.Text = item2.CustomName; link2.NavigateUrl = item2.CustomAbsoluteNavigateUrl; link2.ToolTip = item2.Description; li2.Controls.Add(link2); ul2.Controls.Add(li2); } li.Attributes["class"] = "dropdown"; li.Controls.Add(ul2); } } else { if (item.ActionId == ActionProvider.MyAccountMenuGlobalNavigationLinkActionId) { if ((m_UserContext != null) && (m_UserContext.OrganizationId == Guid.Empty)) { continue; } } link.Text = item.CustomName; links.Add(link); } } if (m_ModernTheme) { return(ul); } else { return((links.Count > 0) ? links : null); } } finally { if (ul2 != null) { ul2.Dispose(); } if (li2 != null) { li2.Dispose(); } if (ul != null) { ul.Dispose(); } if (li != null) { li.Dispose(); } if (link != null) { link.Dispose(); } if (links != null) { links.Dispose(); } } }