Exemplo n.º 1
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;
	}
Exemplo n.º 2
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;
			}
		}
	}
Exemplo n.º 3
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;
	}
Exemplo 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.";
			}

		}


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