/// <summary> /// Add a Menu Tree Node if user in in the list of Authorized roles. /// Thanks to abain for fixing authorization bug. /// </summary> /// <param name="tabIndex"> /// Index of the tab /// </param> /// <param name="mytab"> /// Tab to add to the MenuTreeNodes collection /// </param> protected override void AddMenuTreeNode(int tabIndex, PageStripDetails mytab) { if (!PortalSecurity.IsInRoles(mytab.AuthorizedRoles)) { return; } // get index and id from this page and transmit them // Obtain PortalSettings from Current Context var PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; var tabIdItemsRoot = PortalSettings.ActivePage.PageID; var mn = new MenuTreeNode(mytab.PageName) { // change the link to stay on the same page and call a category product Link = HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, tabIdItemsRoot, "ItemID=" + mytab.PageID), Width = this.Width }; // fixed by manu mn = this.RecourseMenu(tabIdItemsRoot, mytab.Pages, mn); this.Childs.Add(mn); }
/// <summary> /// Recourses the menu. /// modified to transmit the PageID and TabIndex for the shop page /// </summary> /// <param name="tabIdShop"> /// The tab ID shop. /// </param> /// <param name="t"> /// The pages box. /// </param> /// <param name="mn"> /// The menu tree node. /// </param> /// <returns> /// A menu tree node. /// </returns> private MenuTreeNode RecourseMenu(int tabIdShop, Collection<PageStripDetails> t, MenuTreeNode mn) { if (t.Count > 0) { foreach (var mnc in from mysubTab in t where PortalSecurity.IsInRoles(mysubTab.AuthorizedRoles) let mnc = new MenuTreeNode(mysubTab.PageName) { Link = HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, tabIdShop, "ItemID=" + mysubTab.PageID), Width = mn.Width } select this.RecourseMenu(tabIdShop, mysubTab.Pages, mnc)) { mn.Childs.Add(mnc); } } return mn; }
/// <summary> /// Adds the shop home node. /// </summary> private void AddShopHomeNode() { var PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; var tabIdShop = PortalSettings.ActivePage.PageID; var mn = new MenuTreeNode(General.GetString("PRODUCT_HOME", "Shop Home")) { // change the link to stay on the same page and call a category product Link = HttpUrlBuilder.BuildUrl(tabIdShop), Width = this.Width }; this.Childs.Add(mn); }
/// <summary> /// Adds an object to the collection (must be of type MenuTreeNode) /// </summary> /// <param name="o"></param> /// <returns></returns> public int Add(object o) { MenuTreeNode mn = (MenuTreeNode)o; return(InnerList.Add(mn)); }
/// <summary> /// Adds a MenuTreeNode item to the collection /// </summary> /// <param name="mn"></param> /// <returns></returns> public int Add(MenuTreeNode mn) { return(InnerList.Add(mn)); }
/// <summary> /// modified to transmit the PageID and TabIndex for the item page /// </summary> /// <param name="tabIdItemsRoot"> /// The tab ID items root. /// </param> /// <param name="t"> /// The pages box. /// </param> /// <param name="mn"> /// The menu tree node. /// </param> /// <returns> /// A menu tree node. /// </returns> protected override MenuTreeNode RecourseMenu(int tabIdItemsRoot, Collection<PageStripDetails> t, MenuTreeNode mn) { if (t.Count > 0) { foreach (var mnc in from mysubTab in t where PortalSecurity.IsInRoles(mysubTab.AuthorizedRoles) let mnc = new MenuTreeNode(mysubTab.PageName) { // change PageID into ItemID for the product module on the same page Link = HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, tabIdItemsRoot, string.Format("ItemID={0}", mysubTab.PageID)), Width = mn.Width } select this.RecourseMenu(tabIdItemsRoot, mysubTab.Pages, mnc)) { mn.Childs.Add(mnc); } } return mn; }
/// <summary> /// Add the current tab as top menu item. /// </summary> private void AddRootNode() { var PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; var tabItemsRoot = PortalSettings.ActivePage; using (var mn = new MenuTreeNode(tabItemsRoot.PageName)) { // change the link to stay on the same page and call a category product mn.Link = HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, tabItemsRoot.PageID); mn.Width = this.Width; this.Childs.Add(mn); } }
/// <summary> /// Adds a MenuTreeNode item to the collection /// </summary> /// <param name="mn"></param> /// <returns></returns> public int Add(MenuTreeNode mn) { return InnerList.Add(mn); }