Ejemplo n.º 1
0
    private void RearrangeAuditMenu()
    {
        PXToolBarButton btn = (PXToolBarButton)tlbTools.Items[_TOOLBAR_HELP];

        if (btn != null && btn.MenuItems != null && btn.MenuItems.Count >= 3 && auditMenuEnabled)
        {
            PXMenuItem auditItem = btn.MenuItems[0];
            btn.MenuItems.RemoveAt(0);
            btn.MenuItems.Insert(btn.MenuItems.Count - 3, auditItem);
        }
    }
Ejemplo n.º 2
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        var page = this.Page as PXPage;

        if (page != null && page.DefaultDataSource != null && page.DefaultDataSource.EnableAttributes)
        {
            var menuItem = new PXMenuItem("Manage User Defined Fields");
            menuItem.AutoCallBack.Command = "ManageAttributes";
            menuItem.AutoCallBack.Target  = "DsControlProps";
            (PXToolBar1.Items[0] as PXToolBarButton).MenuItems.Insert(2, menuItem);
        }
    }
Ejemplo n.º 3
0
    private void InitAuditMenu()
    {
        auditMenuEnabled = false;
        PXToolBarButton btn = (PXToolBarButton)tlbTools.Items[_TOOLBAR_HELP];

        if (AuditHistoryAvailable && !String.IsNullOrEmpty(this.screenID) && PX.Data.Process.PXAuditHelper.IsUserAuditor)
        {
            PXMenuItem item = null;
            if (PX.Data.PXDatabase.AuditRequired(this.screenID.Replace(".", "")))
            {
                item = new PXMenuItem("Audit History...");
                item.AutoCallBack.Command           = "auditHistory";
                item.AutoCallBack.ActiveBehavior    = true;
                item.AutoCallBack.Behavior.PostData = PostDataMode.Page;
                item.AutoCallBack.Behavior.Name     = "auditHistory";
                item.Value = "auditHistory";
            }
            else if (this.Page is PXPage)
            {
                //Don't initialize Audit History button on wiki page
                if (!(PXSiteMap.CurrentNode is PXWikiMapNode))
                {
                    PXDataSource datasource = ((PXPage)this.Page).DefaultDataSource;
                    if (datasource != null && PX.Data.Process.PXAuditHelper.IsInfoAvailable(datasource.DataGraph, datasource.PrimaryView))
                    {
                        PXCache cache = datasource.DataGraph.Views[datasource.PrimaryView].Cache;
                        item = new PXMenuItem("Audit History...")
                        {
                            PopupPanel = "pnlAudit"
                        };
                    }
                }
            }

            if (item != null)
            {
                btn.MenuItems.Add(item);
                auditMenuEnabled = true;
            }
        }
    }
Ejemplo n.º 4
0
    //---------------------------------------------------------------------------
    /// <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;
    }
Ejemplo n.º 5
0
    //---------------------------------------------------------------------------
    /// <summary>
    ///
    /// </summary>
    private PXToolBarButton GetAttachedFiles()
    {
        PXToolBarButton btn = Button(_TOOLBAR_FILES);
        string          url = Page.AppRelativeVirtualPath;

        btn.MenuItems.Clear();
        if (string.IsNullOrEmpty(url))
        {
            btn.Visible = false;
            return(btn);
        }

        UploadFileMaintenance filesAccessor = PXGraph.CreateInstance <UploadFileMaintenance>();

        foreach (string filename in filesAccessor.GetFileNamesAttachedToScreen(PXSiteMap.CurrentScreenID))
        {
            PXMenuItem item = new PXMenuItem(FileInfo.GetShortName(filename));
            item.NavigateUrl    = ResolveUrl("~/Frames/GetFile.ashx") + "?file=" + HttpUtility.UrlEncode(filename);
            item.Target         = "_blank";
            item.RenderLink     = false;
            item.Style.CssClass = "MenuItem";
            item.Value          = ResolveUrl("~/Pages/SM/SM202510.aspx") + "?fileID=" + HttpUtility.UrlEncode(filename);
            btn.MenuItems.Add(item);
        }

        PXMenuItem mi = new PXMenuItem("Attach file...");

        mi.ShowSeparator = true;
        mi.PopupPanel    = "Uploader";
        mi.Value         = "notfilelink";
        btn.MenuItems.Add(mi);


        String[] importScenarios = PX.Api.SYImportMaint.GetAvailableMappings(this.ScreenID);
        String[] exportScenarios = PX.Api.SYExportMaint.GetAvailableMappings(this.ScreenID);
        if (importScenarios.Length > 0)
        {
            mi             = new PXMenuItem("Import Scenarios");
            mi.NavigateUrl = "~/pages/sm/SM206036.aspx";
            foreach (String scenario in importScenarios)
            {
                PXMenuItem submi = new PXMenuItem(scenario);
                submi.NavigateUrl = ResolveUrl("~/Main.aspx?ScreenId=SM206036&Name=") + HttpUtility.UrlEncode(scenario);
                submi.Target      = "_blank";
                submi.RenderLink  = false;
                mi.ChildItems.Add(submi);
            }
            if (exportScenarios.Length <= 0)
            {
                mi.ShowSeparator = true;
            }
            btn.MenuItems.Add(mi);
        }
        if (exportScenarios.Length > 0)
        {
            mi             = new PXMenuItem("Export Scenarios");
            mi.NavigateUrl = "~/pages/sm/SM207036.aspx";
            foreach (String scenario in exportScenarios)
            {
                PXMenuItem submi = new PXMenuItem(scenario);
                submi.NavigateUrl = ResolveUrl("~/Main.aspx?ScreenId=SM207036&Name=") + HttpUtility.UrlEncode(scenario);
                submi.Target      = "_blank";
                submi.RenderLink  = false;
                mi.ChildItems.Add(submi);
            }
            mi.ShowSeparator = true;
            btn.MenuItems.Add(mi);
        }

        if (!this.Page.IsCallback)
        {
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "filesMenuIndex", "var __filesMenuIndex=" + tlbTools.Items.IndexOf(Button(_TOOLBAR_FILES)).ToString() + ";", true);
        }
        return(btn);
    }
Ejemplo n.º 6
0
    //---------------------------------------------------------------------------
    /// <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.";
            }
        }


        var lastItem = addItem(new PXMenuItem(func(btn.Text, prefix + this.screenID, "screenID")));

        lastItem.NavigateUrl  = this.HelpUrl;
        lastItem.OpenFrameset = true;
        lastItem = addItem(new PXMenuItem(
                               Msg.GetLocal(Msg.GetLink))
        {
            CommandSourceID = "tlbDataView", CommandName = "LinkShow"
        });

        PXMenuItem webItem = null;

        if (!String.IsNullOrEmpty(this.screenID))
        {
            PXSiteMapNode node = PXSiteMap.Provider.FindSiteMapNodeByScreenID(screenID.Replace(".", ""));
            if ((node != null && !String.IsNullOrEmpty(node.GraphType) &&
                 System.Web.Compilation.BuildManager.GetType(node.GraphType, false) != null) || (node != null && node.Url.ToLower().Contains("frames/reportlauncher.aspx")) || (node != null && node.Url.ToLower().Contains("frames/rmlauncher.aspx")))
            {
                PXMenuItem item = new PXMenuItem(PXMessages.LocalizeNoPrefix(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;
        }

        addItem(new PXMenuItem("Trace...")
        {
            NavigateUrl = "~/Frames/Trace.aspx?preserveSession=true", Target = "_blank", Value = "trace"
        });
        addItem(new PXMenuItem("About...")
        {
            PopupPanel = "pnlAbout"
        });
    }
Ejemplo n.º 7
0
	/// <summary>
	/// Create menu item with specified parameters.
	/// </summary>
	private static PXMenuItem CreateMenuItem(
		PXToolBarButton btn, string text, string key, string imageSet, string imageKey)
	{
		var item = new PXMenuItem() { Text = text, Value = key };
		item.ImageSet = imageSet; item.ImageKey = imageKey;
		if (btn != null) btn.MenuItems.Add(item);
		return item;
	}
Ejemplo n.º 8
0
	//---------------------------------------------------------------------------
	/// <summary>
	/// 
	/// </summary>
	private PXToolBarButton GetAttachedFiles()
	{
		PXToolBarButton btn = Button(_TOOLBAR_FILES);
		string url = Page.AppRelativeVirtualPath;

		btn.MenuItems.Clear();
		if (string.IsNullOrEmpty(url))
		{
			btn.Visible = false;
			return btn;
		}

		UploadFileMaintenance filesAccessor = PXGraph.CreateInstance<UploadFileMaintenance>();
		foreach (string filename in filesAccessor.GetFileNamesAttachedToScreen(PXSiteMap.CurrentScreenID))
		{
			PXMenuItem item = new PXMenuItem(FileInfo.GetShortName(filename));
			item.NavigateUrl = ResolveUrl("~/Frames/GetFile.ashx") + "?file=" + HttpUtility.UrlEncode(filename);
			item.Target = "_blank";
			item.RenderLink = false;
			item.Style.CssClass = "MenuItem";
			item.Value = ResolveUrl("~/Pages/SM/SM202510.aspx") + "?fileID=" + HttpUtility.UrlEncode(filename);
			btn.MenuItems.Add(item);
		}

		PXMenuItem mi = new PXMenuItem("Attach file...");
		mi.ShowSeparator = true;
		mi.PopupPanel = "Uploader";
		mi.Value = "notfilelink";
		btn.MenuItems.Add(mi);


		String[] importScenarios = PX.Api.SYImportMaint.GetAvailableMappings(this.ScreenID);
		String[] exportScenarios = PX.Api.SYExportMaint.GetAvailableMappings(this.ScreenID);
		if (importScenarios.Length > 0)
		{
			mi = new PXMenuItem("Import Scenarios");
			mi.NavigateUrl = "~/pages/sm/SM206036.aspx";
			foreach (String scenario in importScenarios)
			{
				PXMenuItem submi = new PXMenuItem(scenario);
				submi.NavigateUrl = ResolveUrl("~/Main.aspx?ScreenId=SM206036&Name=") + HttpUtility.UrlEncode(scenario);
				submi.Target = "_blank";
				submi.RenderLink = false;
				mi.ChildItems.Add(submi);
			}
			if (exportScenarios.Length <= 0) mi.ShowSeparator = true;
			btn.MenuItems.Add(mi);
		}
		if (exportScenarios.Length> 0)
		{
			mi = new PXMenuItem("Export Scenarios");
			mi.NavigateUrl = "~/pages/sm/SM207036.aspx";
			foreach (String scenario in exportScenarios)
			{
				PXMenuItem submi = new PXMenuItem(scenario);
				submi.NavigateUrl = ResolveUrl("~/Main.aspx?ScreenId=SM207036&Name=") + HttpUtility.UrlEncode(scenario);
				submi.Target = "_blank";
				submi.RenderLink = false;
				mi.ChildItems.Add(submi);
			}
			mi.ShowSeparator = true;
			btn.MenuItems.Add(mi);
		}

		if (!this.Page.IsCallback)
			Page.ClientScript.RegisterClientScriptBlock(GetType(), "filesMenuIndex", "var __filesMenuIndex=" + tlbTools.Items.IndexOf(Button(_TOOLBAR_FILES)).ToString() + ";", true);
		return btn;
	}
Ejemplo n.º 9
0
	private void InitAuditMenu()
	{
		auditMenuEnabled = false;
		PXToolBarButton btn = (PXToolBarButton)tlbTools.Items[_TOOLBAR_HELP];

		if (!String.IsNullOrEmpty(this.screenID) && PX.Data.Process.PXAuditHelper.IsUserAuditor)
		{
			PXMenuItem item = null;
			if (PX.Data.PXDatabase.AuditRequired(this.screenID.Replace(".", "")))
			{
				item = new PXMenuItem("Audit History...");
				item.AutoCallBack.Command = "auditHistory";
				item.AutoCallBack.ActiveBehavior = true;
				item.AutoCallBack.Behavior.PostData = PostDataMode.Page;
				item.AutoCallBack.Behavior.Name = "auditHistory";
				item.Value = "auditHistory";
			}
			else if (this.Page is PXPage)
			{
				//Don't initialize Audit History button on wiki page
				if (!(PXSiteMap.CurrentNode is PXWikiMapNode))
				{
					PXDataSource datasource = ((PXPage)this.Page).DefaultDataSource;
					if (datasource != null && PX.Data.Process.PXAuditHelper.IsInfoAvailable(datasource.DataGraph, datasource.PrimaryView))
					{
						PXCache cache = datasource.DataGraph.Views[datasource.PrimaryView].Cache;
						item = new PXMenuItem("Audit History...") { PopupPanel = "pnlAudit" };
					}
				}
			}

			if (item != null)
			{
				btn.MenuItems.Add(item);
				auditMenuEnabled = true;
			}
		}
	}
Ejemplo n.º 10
0
	//---------------------------------------------------------------------------
	/// <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.";
			}

		}


		var lastItem = addItem(new PXMenuItem(func(btn.Text, prefix + this.screenID, "screenID")));
		lastItem.NavigateUrl = this.HelpUrl;
		lastItem.OpenFrameset = true;
		lastItem = addItem(new PXMenuItem(
			Msg.GetLocal(Msg.GetLink)) { CommandSourceID = "tlbDataView", CommandName = "LinkShow" });

		PXMenuItem webItem = null;
		if (!String.IsNullOrEmpty(this.screenID))
		{
			PXSiteMapNode node = PXSiteMap.Provider.FindSiteMapNodeByScreenID(screenID.Replace(".", ""));
			if ((node != null && !String.IsNullOrEmpty(node.GraphType)
				&& System.Web.Compilation.BuildManager.GetType(node.GraphType, false) != null) || (node != null && node.Url.ToLower().Contains("frames/reportlauncher.aspx")) || (node != null && node.Url.ToLower().Contains("frames/rmlauncher.aspx")))
			{
				PXMenuItem item = new PXMenuItem(PXMessages.LocalizeNoPrefix(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;

		addItem(new PXMenuItem("Trace...") { NavigateUrl = "~/Frames/Trace.aspx?preserveSession=true", Target = "_blank", Value = "trace" });
		addItem(new PXMenuItem("About...") { PopupPanel = "pnlAbout" });
	}