public static string GetSubledgerTitle(this PXGraph graph, string subledgerPrefix) { using (new PXLoginScope(PXAccess.GetFullUserName(), PXAccess.GetAdministratorRoles())) { return(((PXDatabaseSiteMapProvider)PXSiteMap.Provider).FindSiteMapNodeByScreenID($"{subledgerPrefix ?? string.Empty}000000")?.Title); } }
void ITitleModuleController.AppendToolbarItem(PXToolBarItem item) { tlbTools.Items.Insert(1, item); if (item.Key == "reminder") { item.Visible = false; } if (PXSiteMap.IsPortal) { if (!System.Web.Security.Roles.IsUserInRole(PXAccess.GetAdministratorRoles().First())) { item.Visible = false; } } }
public CBAPIService(String endpoint, string version) { EntityHelper = ServiceLocator.Current.GetInstance <Func <string, string, IEntityHelper> >()(endpoint, version); string userName = "******"; if (PXDatabase.Companies.Length > 0) { var company = PXAccess.GetCompanyName(); if (string.IsNullOrEmpty(company)) { company = PXDatabase.Companies[0]; } userName = userName + "@" + company; } LoginScope = new PXLoginScope(userName, PXAccess.GetAdministratorRoles()); CultureScope = new PX.Common.PXInvariantCultureScope(); if (PXContext.GetSlot <System.Web.SessionState.ISessionStateItemCollection>() == null) { PXContext.SetSlot <System.Web.SessionState.ISessionStateItemCollection>(new System.Web.SessionState.SessionStateItemCollection()); } }
protected void Page_Load(object sender, EventArgs e) { var request = HttpContext.Current.Request; var locale = request.QueryString["locale"]; if (!string.IsNullOrWhiteSpace(locale)) { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(locale); } var result = request.QueryString["result"]; string login = "******"; if (PXDatabase.Companies.Length > 0) { string company = PXDatabase.Companies[0]; login += "@" + company; } using (new PXLoginScope(login, PXAccess.GetAdministratorRoles())) { if (string.Equals(result, "success", StringComparison.OrdinalIgnoreCase)) { lblSuccess.Visible = true; imgSuccess.Visible = true; lblSuccess.Text = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.MobileAuthScreen .AuthenticationSuccessfull); } if (string.Equals(result, "fail", StringComparison.OrdinalIgnoreCase)) { lblFail.Visible = true; imgFail.Visible = true; lblFail.Text = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.MobileAuthScreen.AuthenticationFailed); } } }
//--------------------------------------------------------------------------- /// <summary> /// Initialize the user name button. /// </summary> private void InitHelpMenu() { PXToolBarButton btn = (PXToolBarButton)tlbTools.Items[_TOOLBAR_HELP]; Func <string, string, string, string> func = delegate(string txt, string val, string labelID) { return(string.Format( "<div class='size-xs inline-block'>{0}</div> <span id='{1}'>{2}</span>", txt, labelID, val)); }; Func <PXMenuItem, PXMenuItem> addItem = delegate(PXMenuItem item) { btn.MenuItems.Add(item); return(item); }; var prefix = ""; if (Page is PXPage) { bool isCustomized = ((PXPage)Page).IsPageCustomized; if (isCustomized) { prefix = "CST."; } } PXMenuItem lastItem; string menuText = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.PageTitle.ScreenID); lastItem = addItem(new PXMenuItem(func(menuText, prefix + ControlHelper.SanitizeHtml(this.screenID), "screenID"))); lastItem.HtmlEncode = false; lastItem = addItem(new PXMenuItem(Msg.GetLink) { CommandSourceID = "tlbDataView", CommandName = "LinkShow" }); PXMenuItem webItem = null; PXSiteMapNode siteMapNode = null; if (!String.IsNullOrEmpty(this.screenID)) { siteMapNode = PXSiteMap.Provider.FindSiteMapNodeByScreenID(screenID.Replace(".", "")); if (WebServicesAvailable && (siteMapNode != null && !String.IsNullOrEmpty(siteMapNode.GraphType) && System.Web.Compilation.PXBuildManager.GetType(siteMapNode.GraphType, false) != null) || (siteMapNode != null && siteMapNode.Url.ToLower().Contains("frames/reportlauncher.aspx")) || (siteMapNode != null && siteMapNode.Url.ToLower().Contains("frames/rmlauncher.aspx"))) { PXMenuItem item = new PXMenuItem(ActionsMessages.WebService); item.NavigateUrl = "~/Soap/" + screenID.Replace(".", "") + ".asmx"; item.OpenFrameset = false; item.Target = "_blank"; item.ShowSeparator = true; btn.MenuItems.Add(webItem = item); } } if (webItem == null) { lastItem.ShowSeparator = true; } if (!String.IsNullOrEmpty(this.screenID) && PXSiteMap.CurrentNode != null) { PXSiteMapNode node = PXSiteMap.CurrentNode; if (PXList.Provider.IsList(screenID)) { string entryScreenID = PXList.Provider.GetEntryScreenID(screenID); node = PXSiteMap.Provider.FindSiteMapNodeByScreenID(entryScreenID) ?? node; } string accessUrl = string.Format("~/Pages/SM/SM201020.aspx?Screen={0}", node.NodeID.ToString()); addItem(new PXMenuItem("Access Rights...") { NavigateUrl = accessUrl, Target = "_blank" }); } if (System.Web.Security.Roles.IsUserInRole(PXAccess.GetAdministratorRoles().First())) { PXSiteMapNode node = siteMapNode ?? PXSiteMap.CurrentNode; var hideSharing = node is PX.Data.PXWikiMapNode || PX.Data.PXSiteMap.IsDashboard(node) || PX.Data.PXSiteMap.IsReport(node.Url) || PX.Data.PXSiteMap.IsARmReport(node.Url) || Page.Request.Url.AbsolutePath.StartsWith(PX.Common.PXUrl.RemoveSessionSplit(Page.ResolveUrl(PX.Olap.Maintenance.PXPivotTableGraph.PivotUri))); if (!hideSharing) { addItem(new PXMenuItem("Share Column Configuration") { PopupPanel = "shareColumnsDlg" }); } } addItem(new PXMenuItem("Trace...") { NavigateUrl = "~/Frames/Trace.aspx?preserveSession=true", Target = "_blank", Value = "trace" }); addItem(new PXMenuItem("About...") { PopupPanel = "pnlAbout" }); btn.Text = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.PageTitle.Tools); btn.Tooltip = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.PageTitle.ToolsTip); btn.AlreadyLocalized = true; }
//--------------------------------------------------------------------------- /// <summary> /// The page Init event handler. /// </summary> protected void Page_Init(object sender, EventArgs e) { var lifetimeScope = this.Context.GetLifetimeScope(); if (lifetimeScope != null) { screenRepository = lifetimeScope.Resolve <IScreenRepository>(); } else { var serviceLocator = ServiceLocator.Current; screenRepository = serviceLocator.GetInstance <IScreenRepository>(); } JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle); if (screenID == null) { this.screenID = ControlHelper.GetScreenID(); } if (screenTitle == null) { if (System.Web.SiteMap.CurrentNode != null) { if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null) { screenTitle = PXSiteMap.CurrentNode.Title; } else { screenTitle = company; } } } string hide = this.Page.Request.QueryString[PXUrl.HidePageTitle]; if (!string.IsNullOrEmpty(hide)) { this.Visible = false; return; } this.Page.InitComplete += new EventHandler(Page_InitComplete); PXCallbackManager.GetInstance().PreGetCallbackResult += PreGetCallbackResult; tlbPath.Items["syncTOC"].Visible = false; tlbPath.Items["branch"].Visible = false; if (!this.Page.IsCallback) { ((WebControl)LabelScreen.Parent).CssClass = "pageTitleCont"; } if (PXDataSource.RedirectHelper.IsPopupPage(Page)) { if (!PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID)) { tlbPath.Items["syncTOC"].Visible = false; } this.FavoriteAvailable = false; if (!PXDataSource.RedirectHelper.IsPopupInline(Page)) { GetBranchCombo().Enabled = false; } } if (PXSiteMap.IsPortal) { this.CustomizationAvailable = PXAccess.GetAdministratorRoles().Any(System.Web.Security.Roles.IsUserInRole); this.BranchAvailable = false; this.FavoriteAvailable = false; pnlTBR.CssClass = "panelTBRSP"; } if (PXContext.PXIdentity.Authenticated) { userName = PXContext.PXIdentity.IdentityName; string branch = PXAccess.GetBranchCD(); if (!string.IsNullOrEmpty(branch)) { userName += ":" + branch; } } var date = PXContext.GetBusinessDate(); if (date != null) { PXDateTimeEdit.SetDefaultDate((DateTime)date); } if (!Page.IsCallback) { Session.Remove("StoredSearch"); } Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jq", VirtualPathUtility.ToAbsolute("~/Scripts/jquery-3.1.1.min.js")); Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jqsr", VirtualPathUtility.ToAbsolute("~/Scripts/jquery.signalR-2.2.1.min.js")); Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "hb", VirtualPathUtility.ToAbsolute("~/signalr/hubs")); }
protected override void Write(Stream stream, ProcessBag bag) { var calendar = bag.Data as vCalendarIcs; if (calendar == null) { var calendarSettingsId = bag.Parameters[_CALENDAR_SETTINGS_KEY]; var companyId = bag.Parameters[_COMPANY_KEY]; if (!string.IsNullOrEmpty(calendarSettingsId)) { var syncGraph = new EPCalendarSync(); try { using (new PXLoginScope(string.IsNullOrEmpty(companyId) ? "admin" : ("admin@" + companyId), PXAccess.GetAdministratorRoles())) { var events = syncGraph.GetCalendarEvents(new Guid(calendarSettingsId)); calendar = (vCalendarIcs)VCalendarProcessor.CreateVCalendar(events); } } catch (FormatException) { } } } if (calendar == null) { calendar = new vCalendarIcs(); } using (var sw = new StreamWriter(stream)) { calendar.Write(sw); } }
//--------------------------------------------------------------------------- /// <summary> /// The page Init event handler. /// </summary> protected void Page_Init(object sender, EventArgs e) { string hide = this.Page.Request.QueryString[PXUrl.HidePageTitle]; if (!string.IsNullOrEmpty(hide)) { this.Visible = false; return; } this.Page.InitComplete += new EventHandler(Page_InitComplete); if (PXDataSource.RedirectHelper.IsPopupPage(Page)) { if (!PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID)) { tlbPath.Items["syncTOC"].Visible = false; } this.FavoriteAvailable = false; if (!PXDataSource.RedirectHelper.IsPopupInline(Page)) { GetBranchCombo().Enabled = false; } } if (PXSiteMap.IsPortal) { this.CustomizationAvailable = PXAccess.GetAdministratorRoles().Any(System.Web.Security.Roles.IsUserInRole); this.BranchAvailable = false; this.FavoriteAvailable = false; pnlTBR.CssClass = "panelTBRSP"; } JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle); if (PXContext.PXIdentity.Authenticated) { userName = PXContext.PXIdentity.IdentityName; string branch = PXAccess.GetBranchCD(); if (!string.IsNullOrEmpty(branch)) { userName += ":" + branch; } } if (screenID == null) { this.screenID = ControlHelper.GetScreenID(); } if (screenTitle == null) { this.screenID = ControlHelper.GetScreenID(); //PX.Common.PXContext.SetScreenID(screenID); // moved to data source if (System.Web.SiteMap.CurrentNode != null) { if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null) { screenTitle = PXSiteMap.CurrentNode.Title; } else { screenTitle = company; } } } var date = PXContext.GetBusinessDate(); if (date != null) { PXDateTimeEdit.SetDefaultDate((DateTime)date); } if (!Page.IsCallback) { Session.Remove("StoredSearch"); } Uploader.FileUploadFinished += Uploader_FileUploadFinished; tlbTools.ItemCreate += tlbTools_ItemCreate; }