Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.IsCallback)
     {
         var cm = PXCallbackManager.GetInstance();
         cm.PostGetCallbackResult += this.handle_getCallbackResult;
     }
     else
     {
         var tlbTools = this.Master.FindControl("usrCaption").FindControl("tlbTools") as PXToolBar;
         if (tlbTools != null)
         {
             var saveAs = tlbTools.Items["btnSavePivotAs"] as PXToolBarButton;
             if (saveAs != null)                 // can be null if user doesn't have access to Pivot Maint screen
             {
                 saveAs.PopupCommand.Handler = "handle_SaveAs";
             }
         }
     }
 }
Ejemplo n.º 2
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Load event handler.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        var ds = PXPage.GetDefaultDataSource(this.Page);

        if (ds != null && ds.HasActiveContext)
        {
            if (ControlHelper.IsReloadPage(this))
            {
                var ctx = ds.DataGraph.GetContextViewDescriptor();
                if (ctx != null)
                {
                    if (ctx.HeaderValues != null)
                    {
                        screenTitle = string.Join(" - ", ctx.HeaderValues).ToUpper();
                    }
                    if (this.Visible)
                    {
                        var cm = PXCallbackManager.GetInstance();
                        PXCallbackManager.RegisterJavaScript(
                            string.Format("px.elemByID('{0}').innerHTML = '{1}';", LabelScreen.ClientID, screenTitle));
                    }
                }
            }
            else
            {
                screenTitle = " ";
            }
        }

        if (!string.IsNullOrEmpty(screenTitle))
        {
            this.ScreenTitle = HttpUtility.HtmlDecode(screenTitle);
        }
        if (!Page.IsCallback)
        {
            Page.EnableViewState = false;
            RegisterSyncTreeVars();
        }
        if (!this.Visible)
        {
            return;
        }

        Page.ClientScript.RegisterClientScriptBlock(GetType(), "addToFavorites", "var addToFavorites=\"" + PXMessages.Localize(InfoMessages.AddToFavorites) + "\";", true);
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "removeFromFavorites", "var removeFromFavorites=\"" + PXMessages.Localize(InfoMessages.RemoveFromFavorites) + "\";", true);
        if (!this.Page.IsCallback || ControlHelper.IsReloadPage(tlbPath))
        {
            InitHelpMenu();
            RearrangeAuditMenu();
        }

        if (!willShowWelcomePage && this.Request.RawUrl.IndexOf("CS100000.aspx", StringComparison.InvariantCultureIgnoreCase) < 0 &&
            this.Request.RawUrl.IndexOf("/soap/", StringComparison.InvariantCultureIgnoreCase) == -1 &&
            this.Request.RawUrl.IndexOf("/wiki/", StringComparison.InvariantCultureIgnoreCase) == -1)
        {
            if (!PXAccess.FeatureSetInstalled("PX.Objects.CS.FeaturesSet"))
            {
                PXSiteMapNode cs = PXSiteMap.Provider.FindSiteMapNodeByScreenID("CS100000");
                if (cs != null)
                {
                    string navigateUrl = ResolveUrl(cs.Url);
                    if (!Page.IsCallback)
                    {
                        Response.Redirect(navigateUrl);
                    }
                }
            }
        }

        string localPath = Request.Url.LocalPath;

        if (!PXUrl.IsMainPage(Request.RawUrl) && !Request.Url.Query.Contains("PopupPanel=On"))
        {
            if (!localPath.EndsWith("Default.aspx"))
            {
                string lastUrl = (string)PXContext.Session["LastUrl"];
                if (String.IsNullOrEmpty(lastUrl) || lastUrl.EndsWith("Default.aspx"))
                {
                    Controls.Add(new LiteralControl("<script  type=\"text/javascript\">try { window.top.lastUrl=null; } catch (ex) {}</script>\n"));
                }
            }
            PXContext.Session.SetString("LastUrl", Request.RawUrl);
        }

        if (!Page.IsPostBack && !String.IsNullOrEmpty(ScreenID))
        {
            PX.Data.PXAuditJournal.Register(ScreenID);
        }

        if (!string.IsNullOrEmpty(screenTitle))
        {
            string relPath = ResolveUrl(Request.RawUrl);
            string url     = ResolveUrl(Request.RawUrl);
            LabelScreen.HRef = (Page != null && Page.GetType().Name == "wiki_showwiki_aspx") ? PXSessionStateStore.GetSessionUrl(HttpContext.Current, url) : url;

            if (PXSiteMap.CurrentNode != null && PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID))
            {
                string        listScreenID = PXList.Provider.GetListID(PXSiteMap.CurrentNode.ScreenID);
                PXSiteMapNode listNode     = PXSiteMap.Provider.FindSiteMapNodeByScreenID(listScreenID);
                if (listNode != null)
                {
                    LabelScreen.HRef         = ResolveUrl(listNode.Url);
                    LabelScreen.ServerClick += (o, args) =>
                    {
                        PXList.Provider.SetCurrentSearches(PXSiteMap.CurrentNode.ScreenID, null);
                        Response.Redirect(ControlHelper.FixHideScriptUrl(PXPageCache.FixPageUrl(ResolveUrl(listNode.Url)), false));
                    };
                }
            }
            if (screenUrl != null)
            {
                LabelScreen.HRef = screenUrl;
            }

            this.ScreenTitle = screenTitle;
        }

        if (!Page.IsCallback)
        {
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "toolbarNum", "var __toolbarID=\"" + this.tlbTools.ClientID + "\";", true);
        }
        if (ControlHelper.IsReloadPage(this))
        {
            SharedColumnSettings.SaveGrids();
        }
    }
Ejemplo n.º 3
0
    //---------------------------------------------------------------------------
    /// <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"));
    }
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Init event handler.
    /// </summary>
    protected void Page_Init(object sender, EventArgs e)
    {
        var serviceLocator = ServiceLocator.Current;

        screenRepository = serviceLocator.GetInstance <IScreenRepository>();
        uiModeService    = serviceLocator.GetInstance <IUIModeService>();
        JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle);

        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;

        if (!uiModeService.UseLegacyUIForCurrentUser)
        {
            tlbPath.Items["syncTOC"].Visible = false;
        }

        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;
            }
        }

        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");
        }
    }