Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string message          = Request.Params["message"];
        string exceptionID      = Request.Params["exceptionID"];
        string errorcode        = Request.Params["errorcode"];
        string typeID           = Request.Params["typeID"];
        bool   showLogoutButton = (!string.IsNullOrEmpty(Request.Params["showLogoutButton"]) && Request.Params["showLogoutButton"].Trim().ToLower() == "true");

        this.Title = ErrorMessages.GetLocal(ErrorMessages.ErrorHasOccurred);

        ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Text = ErrorMessages.GetLocal(ErrorMessages.ShowTrace);

        if (typeID != null)
        {
            SetUserFriendlyInfoWarning(errorcode, exceptionID);
        }
        else if (exceptionID != null && PXContext.Session.Exception[exceptionID] != null)
        {
            PXException exception = (PXException)PXContext.Session.Exception[exceptionID];
            PXSetupNotEnteredException setPropException = exception as PXSetupNotEnteredException;

            if (setPropException != null)
            {
                string url = GetNextUrl(ref setPropException);
                if (url != null)
                {
                    url = PXPageCache.FixPageUrl(ControlHelper.FixHideScriptUrl(url, null));
                }
                SetUserFriendlyInfo(url, setPropException.NavigateTo, setPropException.ExceptionNumber.ToString(), setPropException.MessageNoPrefix);
            }
            else
            {
                SetDefaultExceptionInfo(exception.ExceptionNumber.ToString(), exception.MessageNoPrefix);
            }
        }
        else if (!String.IsNullOrEmpty(message))
        {
            SetDefaultExceptionInfo(null, message);
        }
        else
        {
            SetDefaultVisibility();
        }

        if (this.User.IsAnonymous())
        {
            ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Visible = false;
        }

        ((Button)this.frmBottom.FindControl("btnLogout")).Visible =
            User != null &&
            User.Identity != null &&
            User.Identity.IsAuthenticated &&
            User.Identity.Name != "anonymous" &&
            showLogoutButton;

        this.Server.ClearError();
    }
Ejemplo n.º 2
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Load event handler.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsCallback)
        {
            return;
        }


        var projectBroser = (ProjectBrowserMaint)this.DefaultDataSource.DataGraph;
        var filter        = projectBroser.Filter.Current;

        ProjectBrowserMaint.ContextControlID = null;
        if (filter.InitSession != true && filter.ProjectID.HasValue)
        {
            projectBroser.InitSession();
            filter.InitSession = true;
            var navigateGraph = filter.InnerScreenConfig;

            if (navigateGraph != null)
            {
                //filter.InnerScreenConfig.Unload();
                var node = PXSiteMap.Provider.FindSiteMapNode(navigateGraph.GetType());
                this.panelF.InnerPageUrl = PXPageCache.FixPageUrl(node.Url);
                //PXContext.Session.PageInfo[PXUrl.ToAbsoluteUrl(node.Url)] = navigateGraph.GetType();

                //инициализация двумя путями. либо редиректом либо из url
                //на загрузке следует инициализировать сессию

                filter.InnerScreenConfig = null;
            }
        }

        this.project = ProjectBrowserMaint.ContextProjectName;

        if (!string.IsNullOrEmpty(project))
        {
            projectLink.InnerText = project;
        }

        if (string.IsNullOrEmpty(panelF.InnerPageUrl))
        {
            panelF.InnerPageUrl = this.GetLastUrl();
        }

        logoImg.ImageUrl = "~/App_Themes/" + this.StyleSheetTheme + "/Images/logo.png";
        string hideNavigationPane = PX.Web.Controls.Messages.GetLocal(PX.Web.Controls.Messages.HideNavigationPane);
        string showNavigationPane = PX.Web.Controls.Messages.GetLocal(PX.Web.Controls.Messages.ShowNavigationPane);

        hideFrameBox.Attributes["title"] = hideNavigationPane;
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "hideNavigationPane", "var hideNavigationPane=\"" + hideNavigationPane + "\";", true);
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "showNavigationPane", "var showNavigationPane=\"" + showNavigationPane + "\";", true);
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string message     = Request.Params["message"];
        string exceptionID = Request.Params["exceptionID"];
        string errorcode   = Request.Params["errorcode"];
        string typeID      = Request.Params["typeID"];

        ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Text = ErrorMessages.GetLocal(ErrorMessages.ShowTrace);

        if (typeID != null)
        {
            SetUserFriendlyInfoWarning(errorcode, System.Web.HttpUtility.HtmlEncode(exceptionID));
        }
        else if (exceptionID != null && PXContext.Session.Exception[exceptionID] != null)
        {
            PXException exception = (PXException)PXContext.Session.Exception[exceptionID];
            PXSetupNotEnteredException setPropException = exception as PXSetupNotEnteredException;

            if (setPropException != null)
            {
                string url = GetNextUrl(ref setPropException);
                if (url != null)
                {
                    url = PXPageCache.FixPageUrl(ControlHelper.FixHideScriptUrl(url, null));
                }
                SetUserFriendlyInfo(url, setPropException.NavigateTo, setPropException.ExceptionNumber.ToString(), setPropException.MessageNoPrefix);
            }
            else
            {
                SetDefaultExceptionInfo(exception.ExceptionNumber.ToString(), exception.MessageNoPrefix);
            }
        }
        else if (!String.IsNullOrEmpty(message))
        {
            SetDefaultExceptionInfo(null, message);
        }
        else
        {
            SetDefaultVisibility();
        }

        if (this.User == null || this.User.Identity == null || !this.User.Identity.IsAuthenticated || this.User.Identity.Name == "anonymous")
        {
            ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Visible = false;
        }

        this.Server.ClearError();
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string exceptionID = Request.Params["exceptionID"];
        string errorcode   = Request.Params["errorcode"];
        string typeID      = Request.Params["typeID"];

        if (typeID != null)
        {
            SetUserFriendlyInfoWarning(errorcode, exceptionID);
        }
        else
        {
            if (exceptionID != null && PXContext.Session.Exception[exceptionID] != null)
            {
                PXException exception = (PXException)PXContext.Session.Exception[exceptionID];
                PXSetupNotEnteredException setPropException = exception as PXSetupNotEnteredException;

                if (setPropException != null)
                {
                    string url = GetNextUrl(ref setPropException);
                    if (url != null)
                    {
                        url = PXPageCache.FixPageUrl(ControlHelper.FixHideScriptUrl(url, null));
                    }
                    SetUserFriendlyInfo(url, setPropException.NavigateTo, setPropException.ExceptionNumber.ToString(), setPropException.MessageNoPrefix);
                }
                else
                {
                    SetDefaultExceptionInfo(exception.ExceptionNumber.ToString(), exception.MessageNoPrefix);
                }
            }
            else
            {
                SetDefaultVisibility();
            }
        }
        this.Server.ClearError();
    }
Ejemplo n.º 5
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();
        }
    }