/// <summary> /// add a folder to the list /// </summary> public void AddFolder(XmlNode AFolderNode, string AUserId, CheckAccessPermissionDelegate AHasAccessPermission) { TRbtNavigationButton rbt = new TRbtNavigationButton(FolderCheckChanging); this.sptNavigation.Panel2.Controls.Add(rbt); rbt.Dock = System.Windows.Forms.DockStyle.Bottom; rbt.Tag = AFolderNode; rbt.Name = "rbt" + AFolderNode.Name; rbt.Text = GetLabel(AFolderNode); // TODO: pick up icon from within the resx file, if it is available? if (TYml2Xml.HasAttribute(AFolderNode, "Icon") && System.IO.File.Exists(ResourceDirectory + System.IO.Path.DirectorySeparatorChar + TYml2Xml.GetAttribute(AFolderNode, "Icon"))) { rbt.Icon = ResourceDirectory + System.IO.Path.DirectorySeparatorChar + TYml2Xml.GetAttribute(AFolderNode, "Icon"); } rbt.CheckedChanged += new System.EventHandler(this.FolderCheckedChanged); if ((TYml2Xml.HasAttribute(AFolderNode, "Enabled")) && (TYml2Xml.GetAttribute(AFolderNode, "Enabled").ToLower() == "false")) { rbt.Enabled = false; } else { rbt.Enabled = AHasAccessPermission(AFolderNode, AUserId, false); } }
private void FolderCheckedChanged(object sender, EventArgs e) { bool PanelCreated; TRbtNavigationButton rbtFolder = (TRbtNavigationButton)sender; TPnlModuleNavigation CollPanelHoster = GetOrCreatePanel((XmlNode)rbtFolder.Tag, out PanelCreated); if (rbtFolder.Checked) { CollPanelHoster.Text = rbtFolder.Text; CollPanelHoster.Show(); if (PanelCreated) { CollPanelHoster.SelectFirstLink(); } else { CollPanelHoster.FireSelectedLinkEvent(); } } else { CollPanelHoster.Hide(); } }
/// <summary> /// Gets the index of the selected main menu item /// </summary> public int GetSelectedFolderIndex() { for (int i = 0; i < sptNavigation.Panel2.Controls.Count; i++) { TRbtNavigationButton btn = (TRbtNavigationButton)this.sptNavigation.Panel2.Controls[i]; if (btn.Checked) { return(i); } } return(-1); }
/// <summary> /// Selects a Module folder based on a UINavigation element name /// </summary> /// <param name="AFolderName">The name of a main folder (e.g. Partner, FinancialDevelopment). /// Note that this is not the display label name but the element name itself.</param> /// <returns>True if the folder could be selected. If the folder does not exist, or the user does not have permission, /// or the folder is not enabled, the method will return false.</returns> public bool SelectFolder(string AFolderName) { for (int i = 0; i < sptNavigation.Panel2.Controls.Count; i++) { TRbtNavigationButton btn = (TRbtNavigationButton)this.sptNavigation.Panel2.Controls[i]; XmlNode folderNode = (XmlNode)btn.Tag; if (folderNode.Name == AFolderName) { return(SelectFolder(i)); } } return(false); }
/// <summary> /// Select the given folder, if it is enabled /// </summary> /// <param name="AIndex"></param> public bool SelectFolder(Int32 AIndex) { TRbtNavigationButton btn = (TRbtNavigationButton)this.sptNavigation.Panel2.Controls[AIndex]; if (btn.Enabled) { btn.Checked = true; // just make sure the splitter is positioned correctly SptNavigationSplitterMoved(null, null); return(true); } return(false); }
private bool FolderCheckChanging(TRbtNavigationButton ANavigationButton) { bool ReturnValue = true; XmlNode ModuleXmlNode = (XmlNode)ANavigationButton.Tag; if (TXMLParser.GetAttribute(ModuleXmlNode, "DependsOnLedger").ToLower() == "true") { if (FCurrentLedger == LEDGERNUMBER_NO_ACCESS_TO_ANY_LEDGER) { ShowMessageNoAccessToFinanceModuleDueToNoLedgerEnabled(TXMLParser.GetAttribute(ModuleXmlNode, "Label")); ReturnValue = false; } } return(ReturnValue); }
private bool FolderCheckChanging(TRbtNavigationButton ANavigationButton) { bool ReturnValue = true; XmlNode ModuleXmlNode = (XmlNode)ANavigationButton.Tag; if (TXMLParser.GetAttribute(ModuleXmlNode, "DependsOnLedger").ToLower() == "true") { if (FCurrentLedger == LEDGERNUMBER_NO_ACCESS_TO_ANY_LEDGER) { MessageBox.Show(String.Format("Access to OpenPetra Module '{0}' is denied as you don't have access rights to any Ledger!" + "\r\n\r\n" + "Someone with OpenPetra System Administrator rights needs to grant you access rights to at least one Ledger " + "for you to be able to work with this Module.", TXMLParser.GetAttribute(ModuleXmlNode, "Label")), "Access to OpenPetra Module Denied", MessageBoxButtons.OK, MessageBoxIcon.Error); ReturnValue = false; } } return(ReturnValue); }
private bool FolderCheckChanging(TRbtNavigationButton ANavigationButton) { bool ReturnValue = true; XmlNode ModuleXmlNode = (XmlNode)ANavigationButton.Tag; if (TXMLParser.GetAttribute(ModuleXmlNode, "DependsOnLedger").ToLower() == "true") { if (FCurrentLedger == LEDGERNUMBER_NO_ACCESS_TO_ANY_LEDGER) { MessageBox.Show(String.Format("Access to OpenPetra Module '{0}' is denied as you don't have access rights to any Ledger!" + "\r\n\r\n" + "Someone with OpenPetra System Administrator rights needs to grant you access rights to at least one Ledger " + "for you to be able to work with this Module.", TXMLParser.GetAttribute(ModuleXmlNode, "Label")), "Access to OpenPetra Module Denied", MessageBoxButtons.OK, MessageBoxIcon.Error); ReturnValue = false; } } return ReturnValue; }
/// <summary> /// add a folder to the list /// </summary> public void AddFolder(XmlNode AFolderNode, string AUserId, CheckAccessPermissionDelegate AHasAccessPermission) { TRbtNavigationButton rbt = new TRbtNavigationButton(FolderCheckChanging); this.sptNavigation.Panel2.Controls.Add(rbt); rbt.Dock = System.Windows.Forms.DockStyle.Bottom; rbt.Tag = AFolderNode; rbt.Name = "rbt" + AFolderNode.Name; rbt.Text = GetLabel(AFolderNode); // TODO: pick up icon from within the resx file, if it is available? if (TYml2Xml.HasAttribute(AFolderNode, "Icon") && System.IO.File.Exists(ResourceDirectory + System.IO.Path.DirectorySeparatorChar + TYml2Xml.GetAttribute(AFolderNode, "Icon"))) { rbt.Icon = ResourceDirectory + System.IO.Path.DirectorySeparatorChar + TYml2Xml.GetAttribute(AFolderNode, "Icon"); } rbt.CheckedChanged += new System.EventHandler(this.FolderCheckedChanged); if ((TYml2Xml.HasAttribute(AFolderNode, "Enabled")) && (TYml2Xml.GetAttribute(AFolderNode, "Enabled").ToLower() == "false")) { rbt.Enabled = false; } else { rbt.Enabled = AHasAccessPermission(AFolderNode, AUserId, false); } }