예제 #1
0
        /// <summary>
        /// PopupMenu构造函数
        /// </summary>
        /// <remarks></remarks>
		public DeluxeMenu()
            : base(true, HtmlTextWriterTag.Div)
        {
            this.items = new MenuItemCollection(null);
            //this.Style.Add("Width", "0");

        }
예제 #2
0
        private void BuildItems(HtmlTextWriter writer, MenuItemCollection items, bool isRoot = false)
        {
            if (items.Count <= 0)
            {
                return;
            }

            string cssClass = "submenu";

            if (isRoot)
            {
                cssClass = "nav sidebar-menu";
                if (!string.IsNullOrEmpty(this.CssClass))
                {
                    cssClass += " " + this.CssClass;
                }
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            if (isRoot)
                items = items[0].ChildItems;

            foreach (MenuItem item in items)
            {
                this.BuildItem(writer, item);
            }

            writer.RenderEndTag(); // </ul>
        }
예제 #3
0
 private void SaveNodes(System.Web.UI.WebControls.MenuItemCollection destNodes, System.Windows.Forms.TreeNodeCollection sourceNodes)
 {
     this.ValidatePropertyGrid();
     destNodes.Clear();
     foreach (MenuItemContainer container in sourceNodes)
     {
         System.Web.UI.WebControls.MenuItem webMenuItem = container.WebMenuItem;
         destNodes.Add(webMenuItem);
         if (container.Nodes.Count > 0)
         {
             this.SaveNodes(webMenuItem.ChildItems, container.Nodes);
         }
     }
 }
예제 #4
0
		MenuItem FindSelectedItem(MenuItemCollection items)
		{
			foreach (MenuItem item in items)
			{
				if (item.NavigateUrl.Length > 0 && Request.Path.Contains(item.NavigateUrl.Replace("~", "")))
				{
					return item;
				}
				MenuItem childSelected = FindSelectedItem(item.ChildItems);
				if (childSelected != null)
					return childSelected;
			}
			return null;
		}
예제 #5
0
 private void LoadNodes(System.Windows.Forms.TreeNodeCollection destNodes, System.Web.UI.WebControls.MenuItemCollection sourceNodes)
 {
     foreach (System.Web.UI.WebControls.MenuItem item in sourceNodes)
     {
         MenuItemContainer node = new MenuItemContainer();
         destNodes.Add(node);
         node.Text = item.Text;
         System.Web.UI.WebControls.MenuItem clone = (System.Web.UI.WebControls.MenuItem)((ICloneable)item).Clone();
         this._menuDesigner.RegisterClone(item, clone);
         node.WebMenuItem = clone;
         if (item.ChildItems.Count > 0)
         {
             this.LoadNodes(node.Nodes, item.ChildItems);
         }
     }
 }
예제 #6
0
            private void RenderItems(HtmlTextWriter writer, bool staticOnly, MenuItemCollection items, int level, bool needsAccessKey)
            {
                if (level == 1 || level > Menu.StaticDisplayLevels)    // Render a <UL> to start, and for all dynamic descendents
                {
                    if (Menu.DesignMode && Menu.Orientation == Orientation.Horizontal)
                    {
                        writer.AddStyleAttribute("float", "left");
                    }
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetMenuCssClass(level));
                    writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                }

                foreach (MenuItem item in items)
                {
                    if (Menu.DesignMode && Menu.Orientation == Orientation.Horizontal)
                    {
                        writer.AddStyleAttribute("float", "left");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Li);

                    needsAccessKey = RenderItem(writer, item, level, GetMenuItemCssClass(item, level), needsAccessKey);

                    if (level < Menu.StaticDisplayLevels)    // Close off <LI> if we (and our direct descendents) are static
                    {
                        writer.RenderEndTag();
                    }

                    if (item.ChildItems.Count > 0 && !IsChildPastMaximumDepth(item) && item.Enabled)
                    {
                        if (level < Menu.StaticDisplayLevels || !staticOnly)
                        {
                            RenderItems(writer, staticOnly, item.ChildItems, level + 1, needsAccessKey);
                        }
                    }

                    if (level >= Menu.StaticDisplayLevels)    // Close off <LI> if we (or our direct descendents) are dynamic
                    {
                        writer.RenderEndTag();
                    }
                }

                if (level == 1 || level > Menu.StaticDisplayLevels)
                {
                    writer.RenderEndTag();
                }
            }
        public void BindMenu(MenuItemCollection items)
        {
            if ((PackageId <= 0) || (ItemID <= 0))
                return;

            //Organization menu group;
            if (Cntx.Groups.ContainsKey(ResourceGroups.HostedOrganizations))
                PrepareOrganizationMenuRoot(items);

            //Exchange menu group;
            if (Cntx.Groups.ContainsKey(ResourceGroups.Exchange))
                PrepareExchangeMenuRoot(items);

            //BlackBerry Menu
            if (Cntx.Groups.ContainsKey(ResourceGroups.BlackBerry))
                PrepareBlackBerryMenuRoot(items);

            //SharePoint menu group;
            if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointFoundationServer))
                PrepareSharePointMenuRoot(items);

            if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer))
                PrepareSharePointEnterpriseMenuRoot(items);

            //CRM Menu
            if (Cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
                PrepareCRM2013MenuRoot(items);
            else if (Cntx.Groups.ContainsKey(ResourceGroups.HostedCRM))
                PrepareCRMMenuRoot(items);

            //OCS Menu
            if (Cntx.Groups.ContainsKey(ResourceGroups.OCS))
                PrepareOCSMenuRoot(items);

            //Lync Menu
            if (Cntx.Groups.ContainsKey(ResourceGroups.Lync))
                PrepareLyncMenuRoot(items);

            //EnterpriseStorage Menu
            if (Cntx.Groups.ContainsKey(ResourceGroups.EnterpriseStorage))
                PrepareEnterpriseStorageMenuRoot(items);

            //Remote Desktop Services Menu
            if (Cntx.Groups.ContainsKey(ResourceGroups.RDS))
                PrepareRDSMenuRoot(items);
        }
예제 #8
0
        private void PopulateNodes(DataTable dt, MenuItemCollection items)
        {
            foreach (DataRow dr in dt.Rows)
            {
                MenuItem mi = new MenuItem();

                mi.Text = dr["menu"].ToString();
                mi.Value = dr["menuid"].ToString();
                mi.NavigateUrl = dr["url"].ToString();
                items.Add(mi);
                //If node has child nodes, then enable on-demand populating
                bool flag = ((int)(dr["childnodecount"]) > 0);
                if (flag)
                {
                    menuCreate(mi);
                }
            }
        }
예제 #9
0
        private void QuitarItems(MenuItemCollection items)
        {
            MenuItem[] itemsToRemove = new MenuItem[items.Count];
            int i = 0;
            if (UsuarioLogueado.TipoPersona == Persona.TiposPersonas.Alumno)
            {
                foreach (MenuItem item in items)
                {
                    if((item.Value=="Alumno") || (item.Value=="Ambos"))
                    {
                        if (item.ChildItems.Count > 0) QuitarItems(item.ChildItems);
                    }
                    else
                    {
                        itemsToRemove[i] = item;
                        i++;
                    }
                }
                for (int j = 0; j < i; j++)
                {
                    items.Remove(itemsToRemove[j]);
                }
            }

            if (UsuarioLogueado.TipoPersona == Persona.TiposPersonas.Docente)
            {
                foreach (MenuItem item in items)
                {
                    if ((item.Value == "Profesor") || (item.Value == "Ambos"))
                    {
                        if (item.ChildItems.Count > 0) QuitarItems(item.ChildItems);
                    }
                    else
                    {
                        itemsToRemove[i] = item;
                        i++;
                    }
                }
                for (int j = 0; j < i; j++)
                {
                    items.Remove(itemsToRemove[j]);
                }
            }
        }
예제 #10
0
        public override void RenderMenuBody(HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, bool notLast)
        {
            Menu owner = Owner;
            int  count = items.Count;
            var  oc    = new OwnerContext(this);

            for (int n = 0; n < count; n++)
            {
                MenuItem             item    = items [n];
                Adapters.MenuAdapter adapter = owner.Adapter as Adapters.MenuAdapter;
                if (adapter != null)
                {
                    adapter.RenderItem(writer, item, n);
                }
                else
                {
                    RenderMenuItem(writer, item, vertical, (n + 1) == count ? notLast : true, n == 0, oc);
                }
            }
        }
예제 #11
0
        public void RemovePermissaoMenu(MenuItemCollection items)
        {
            ISeguranca iseguranca = Factory.GetInstance<ISeguranca>();
            IList<int> indices = new List<int>();
            for (int i = items.Count - 1; i >= 0; i--)
            {
                if (items[i].ChildItems.Count > 0)
                {
                    RemovePermissaoMenu(items[i].ChildItems);
                }

                if (items[i].Value != "EMPTY" && !iseguranca.VerificarPermissao(((ViverMais.Model.Usuario)Session["Usuario"]).Codigo, items[i].Value.Split(':')[0].ToString(), int.Parse(items[i].Value.Split(':')[1].ToString())))
                {
                    indices.Add(i);
                }
            }
            foreach (int i in indices)
            {
                items.RemoveAt(i);
            }
        }
예제 #12
0
        protected void RenderDropDownMenu(HtmlTextWriter writer, MenuItemCollection items, string submenuClientId)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            DynamicMenuStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, submenuClientId);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            for (int i = 0; i < items.Count; i++)
            {
                var childItem = items[i];
                RenderDropDownMenuItem(writer, childItem, submenuClientId, i);
            }

            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
예제 #13
0
        private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {
                writer.WriteLine();

                writer.WriteBeginTag("ul");
                if (isRoot)
                {
                    writer.WriteAttribute("class", "navig twolevel");
                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                foreach (MenuItem item in items)
                {
                    BuildItem(item, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
예제 #14
0
        /// <summary>
        /// Loops through the list items in the MyNiem List and gets the navigation based on access.
        /// </summary>
        /// <param name="List"></param>
        protected void LoadNavigation(SPList List)
        {
            try
            {
                if (Page.User.Identity.IsAuthenticated)
                {
                    SPListItemCollection Items = List.Items;
                    var PersonalNav = LoginView1.FindControl("PersonalNav") as AspMenu;
                    MenuItemCollection MenuItems = new MenuItemCollection();

                    //grabs the items in the list then loops through the webs the user currently has access too
                    foreach (SPListItem Item in Items)
                    {
                        //old code to recursively check if the user has access to the subweb
                        //if (Web.Url.ToLower() == SPContext.Current.Web.Site.RootWeb.Url.ToLower() + "/" + Item["Title"].ToString().ToLower())
                        //    FoundWeb = true;
                        //else
                        //    FoundWeb = GetSubWebs(Web, SPContext.Current.Web.Site.RootWeb.Url.ToLower() + "/" + Item["Title"].ToString().ToLower(), FoundWeb);
                        //Guid SiteGuid = SPContext.Current.Site.ID;
                        string SiteURL = SPContext.Current.Web.Site.RootWeb.Url.ToLower();
                        SPUser CurrentUser = SPContext.Current.Web.CurrentUser;
                        SPSecurity.RunWithElevatedPrivileges(delegate()
                        {
                            #region OldCode
                            //    if (FoundWeb)
                            //    {
                            //        using (SPSite Site = new SPSite(SPContext.Current.Web.Site.RootWeb.Url.ToLower() + "/" + Item["Title"].ToString()))
                            //        {
                            //            using (SPWeb FoundSubWeb = Site.OpenWeb())
                            //            {
                            //                MenuItem MyNiemItem = new MenuItem(FoundSubWeb.Title, FoundSubWeb.Title, "", FoundSubWeb.Url);
                            //                int CompareNumber = 0;
                            //                for(int i=0;i<MenuItems.Count && CompareNumber>=0;i++)
                            //                {
                            //                    string CompareItem = MyNiemItem.Text;
                            //                    CompareNumber = CompareItem.CompareTo(MenuItems[i].Text);
                            //                    if(CompareNumber < 0)
                            //                        MenuItems.AddAt(i, MyNiemItem);
                            //                }
                            //                if(CompareNumber>=0)
                            //                    MenuItems.Add(MyNiemItem);
                            //                FoundWeb = false;
                            //            }
                            //        }
                            //    }
                            //}
                            //foreach (MenuItem Item in MenuItems)
                            //{
                            //    PersonalNav.Items.Add(Item);
                            //}
                            #endregion

                            //new code to check against site
                            using (SPSite Site = new SPSite(SiteURL + "/" + Item["Title"].ToString()))
                            {
                                using (SPWeb Web = Site.OpenWeb())
                                {
                                    if (Web.DoesUserHavePermissions(CurrentUser.LoginName, SPBasePermissions.Open))
                                    {
                                        MenuItem MyNiemItem = new MenuItem(Web.Title, Web.Title, "", Web.Url);
                                        int CompareNumber = 0;
                                        for (int i = 0; i < MenuItems.Count && CompareNumber >= 0; i++)
                                        {
                                            string CompareItem = MyNiemItem.Text;
                                            CompareNumber = CompareItem.CompareTo(MenuItems[i].Text);
                                            if (CompareNumber < 0)
                                                MenuItems.AddAt(i, MyNiemItem);
                                        }
                                        if (CompareNumber >= 0)
                                            MenuItems.Add(MyNiemItem);
                                    }
                                }
                            }

                        });
                    }
                    foreach (MenuItem Item in MenuItems)
                    {
                        PersonalNav.Items.Add(Item);
                    }
                }
            }
            catch (SPException ex)
            {
                UpdateErrorLog(ex);
            }
        }
        /// <summary>
        /// RSnyder (LCG) - 02/14/2013 - This function was created to test to see if a node was about to be added
        /// to the menuitem collection that already exists
        /// </summary>
        /// <param name="curMenuItems"></param>
        /// <param name="menuItemToAdd"></param>
        /// <returns></returns>
        private bool MenuItemContains(MenuItemCollection curMenuItems, MenuItem menuItemToAdd)
        {
            bool found = false;

            foreach (MenuItem menuItem in curMenuItems)
            {

                if (menuItemToAdd.NavigateUrl.ToLower() != String.Empty)
                {
                    // first check the url
                    if (menuItem.NavigateUrl.ToLower() == menuItemToAdd.NavigateUrl.ToLower())
                    {
                        // now check the caption if the caption and title are the same then consider it a duplicate
                        if (menuItem.Text.ToLower() == menuItemToAdd.Text.ToLower())
                        {
                            found = true;
                            break;
                        }
                    }
                }
                else
                {
                    //Assume a heading so just check the caption
                    if (menuItem.Text.ToLower() == menuItemToAdd.Text.ToLower())
                    {
                        found = true;
                        break;
                    }
                }
            }

            return found;
        }
예제 #16
0
        //private bool renderMenuText = true;
        private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {
               // renderMenuText = WebConfigSettings.RenderMenuText;

                writer.WriteLine();

                writer.WriteBeginTag("ul");
                if (isRoot)
                {
                    //
                    writer.WriteAttribute("class", "sf-menu sf-navbar");
                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                foreach (MenuItem item in items)
                {
                    BuildItem(item, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
예제 #17
0
        public MenuItemCollection GetIconsDataSource(int packageId)
        {
            // load package context
            PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);

            // init collection
            MenuItemCollection items = new MenuItemCollection();

            // get icons list
            foreach (XmlNode xmlNode in xmlIcons)
            {
                // create icon item
                MenuItem iconItem = CreateMenuItem(cntx, xmlNode);
                if (iconItem == null)
                    continue;

                // add into list
                items.Add(iconItem);
            }

            return items;
        }
        private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {
                writer.WriteLine();

                writer.WriteBeginTag("ul");
                if (isRoot)
                {
                    //  Outer list menu
                    writer.WriteAttribute("class", "nav");
                }
                else
                {
                    //  Sub Menue
                    writer.WriteAttribute("class", "dropdown-menu");
                }

                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                foreach (MenuItem item in items)
                {
                    BuildItem(item, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
예제 #19
0
 private void setMenuItemChild(MenuItemCollection mic, params MenuInfo[] menuItems)
 {
     try
     {
         mic.Clear();
         foreach (MenuInfo menuItem in menuItems)
         {
             if (menuItem.Text != "-")
             {
                 MenuItem mi = new MenuItem(menuItem.Text, menuItem.Text);
                 mi.Enabled = menuItem.Enabled;
                 if (
                     String.IsNullOrEmpty(menuItem.NavigateUrl)
                     && menuItem.Text != "Storage connection"
                     && menuItem.Text != "Refresh"
                     && menuItem.SubMenus.Count == 0
                     )
                 {
                     mi.NavigateUrl = String.Format("javascript:openDialog('ModalDialogHandler.aspx?MenuItem={0}&MenuValue={1}');", mi.Text, mi.Value);
                 }
                 else if (!String.IsNullOrEmpty(menuItem.NavigateUrl))
                 {
                     mi.NavigateUrl = menuItem.NavigateUrl;
                     if (!mi.NavigateUrl.StartsWith("javascript:", StringComparison.CurrentCultureIgnoreCase))
                         mi.Target = "_blank";
                 }
                 mi.ToolTip = menuItem.ToolTip;
                 switch (menuItem.Text)
                 {
                     case "Storage connection": mi.ImageUrl = this.getImageUrl("db.gif"); break;
                     case "Options": mi.ImageUrl = this.getImageUrl("Options_16x16.gif"); break;
                     case "Invalidate WCF Cache Service": mi.ImageUrl = this.getImageUrl("Cache_16x16.gif"); break;
                     case "New Store":
                     case "New Application":
                     case "New Store Group":
                     case "New Application Group":
                     case "New Role":
                     case "New Task":
                     case "New Operation":
                         mi.ImageUrl = this.getImageUrl("new.gif"); break;
                     case "Import Store from AzMan":
                         mi.ImageUrl = this.getImageUrl("azman.gif"); break;
                     case "Import Stores":
                     case "Import Store Groups/Application":
                     case "Import Application Groups/Items":
                     case "Import Store Groups":
                     case "Import Application Groups":
                     case "Import Items":
                         mi.ImageUrl = this.getImageUrl("import.gif"); break;
                     case "Export Stores":
                     case "Export Store":
                     case "Export Application":
                     case "Export Store Group":
                     case "Export Application Group":
                     case "Export Items":
                         mi.ImageUrl = this.getImageUrl("export.gif"); break;
                     case "Refresh": mi.ImageUrl = this.getImageUrl("refresh.gif"); break;
                     case "Store Properties": mi.ImageUrl = this.getImageUrl("Store_16x16.gif"); break;
                     case "Items Hierarchical View":
                     case "Items Hierarchy":
                         mi.ImageUrl = this.getImageUrl("Hierarchy_16x16.gif"); break;
                     case "Reports": mi.ImageUrl = this.getImageUrl("print.gif"); break;
                     case "Delete": mi.ImageUrl = this.getImageUrl("delete.gif"); break;
                     case "Items Authorizations": mi.ImageUrl = this.getImageUrl("ItemAuthorization_16x16.gif"); break;
                     case "Mode and Logging": mi.ImageUrl = this.getImageUrl("NetSqlAzMan_16x16.gif"); break;
                     case "Auditing": mi.ImageUrl = this.getImageUrl("SqlAudit_16x16.gif"); break;
                     case "Application Properties": mi.ImageUrl = this.getImageUrl("Application_16x16.gif"); break;
                     case "Generate CheckAccessHelper": mi.ImageUrl = this.getImageUrl("vsnet_16x16.gif"); break;
                     case "Check Access Test": mi.ImageUrl = this.getImageUrl("CheckAccessTest_16x16.gif"); break;
                     case "Application Group Properties":
                     case "Store Group Properties": mi.ImageUrl = this.getImageUrl("StoreApplicationGroup_16x16.gif"); break;
                     case "Role Properties": mi.ImageUrl = this.getImageUrl("Role_16x16.gif"); break;
                     case "Task Properties": mi.ImageUrl = this.getImageUrl("Task_16x16.gif"); break;
                     case "Operation Properties": mi.ImageUrl = this.getImageUrl("Operation_16x16.gif"); break;
                     case "Effective Permissions": mi.ImageUrl = this.getImageUrl("EffectivePermissions_16x16.gif"); break;
                     case "Manage Authorizations": mi.ImageUrl = this.getImageUrl("ItemAuthorization_16x16.gif"); break;
                     default: mi.ImageUrl = this.getImageUrl("blank.gif"); break;
                 }
                 mic.Add(mi);
                 this.setMenuItemChild(mi.ChildItems, menuItem.SubMenus.ToArray());
             }
             else
             {
                 mic[mic.Count - 1].SeparatorImageUrl = "Images/Separator.jpg";
             }
         }
     }
     catch (Exception ex)
     {
         this.ShowError(ex.Message);
     }
 }
예제 #20
0
		public override void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, bool notLast)
		{
			Menu owner = Owner;
			if (!vertical)
				writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			int count = items.Count;
			var oc = new OwnerContext (this);
			
			for (int n = 0; n < count; n++) {
				MenuItem item = items [n];
				Adapters.MenuAdapter adapter = owner.Adapter as Adapters.MenuAdapter;
				if (adapter != null)
					adapter.RenderItem (writer, item, n);
				else
					RenderMenuItem (writer, item, vertical, (n + 1) == count ? notLast : true, n == 0, oc);
			}

			if (!vertical)
				writer.RenderEndTag ();	// TR
		}
 public LogItem(MenuItemCollection.LogItemType type, int index, bool tracked)
 {
     this._type = type;
     this._index = index;
     this._tracked = tracked;
 }
예제 #22
0
 public abstract void RenderMenuBody(HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, bool notLast);
예제 #23
0
		void RenderMenu (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, int menuLevel)
		{
			RenderMenuBeginTag (writer, dynamic, menuLevel);
			RenderMenuBody (writer, items, vertical, dynamic);
			RenderMenuEndTag (writer);
		}
예제 #24
0
		void FillBoundChildren ()
		{
			items = new MenuItemCollection (this);
			if (hierarchyData == null || !hierarchyData.HasChildren) return;

			IHierarchicalEnumerable e = hierarchyData.GetChildren ();
			foreach (object obj in e) {
				IHierarchyData hdata = e.GetHierarchyData (obj);
				MenuItem item = new MenuItem ();
				item.Bind (hdata);
				items.Add (item);
			}
		}
예제 #25
0
		void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic)
		{
			if (!vertical) writer.RenderBeginTag (HtmlTextWriterTag.Tr);
			
			for (int n=0; n<items.Count; n++) {
				MenuItem item = items [n];
				if (n > 0) {
					Unit itemSpacing = GetItemSpacing (item, dynamic);
					if (itemSpacing != Unit.Empty) {
						if (vertical) {
							writer.AddAttribute ("height", itemSpacing.ToString());
							writer.RenderBeginTag (HtmlTextWriterTag.Tr);
							writer.RenderEndTag ();
						} else {
							writer.AddAttribute ("width", itemSpacing.ToString());
							writer.RenderBeginTag (HtmlTextWriterTag.Td);
							writer.RenderEndTag ();
						}
					}
				}
				RenderMenuItem (writer, item);
			}
			
			if (!vertical) writer.RenderEndTag ();	// TR
		}
예제 #26
0
        private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {
                writer.WriteLine();

                writer.WriteBeginTag("ul");
                if (isRoot)
                {
                    //writer.WriteAttribute("class", "AspNet-Menu");
                    writer.WriteAttribute("class", "");
                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                for (int i = 0; i < items.Count; i++)
                {
                    if (!items[i].NavigateUrl.ToLower().Contains("feedback"))
                        BuildItem(items[i],writer, i);
                }
                //foreach (MenuItem item in items)
                //{
                //    BuildItem(item, writer);
                //}

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
 internal MenuItemCollectionEnumerator(MenuItemCollection list) {
     this.list = list;
     this.index = -1;
     version = list._version;
 }
예제 #28
0
		void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, MenuItemCollection itemCollection)
		{
			if (hEnumerable == null)
				return;
			foreach (object obj in hEnumerable) {
				IHierarchyData hdata = hEnumerable.GetHierarchyData (obj);
				MenuItem item = new MenuItem ();
				itemCollection.Add (item);
				item.Bind (hdata);

				SiteMapNode siteMapNode = hdata as SiteMapNode;
				if (siteMapNode != null) {
					if (_currSiteMapNode == null)
						_currSiteMapNode = siteMapNode.Provider.CurrentNode;
					if (siteMapNode == _currSiteMapNode)
						item.Selected = true;
				}
				
				OnMenuItemDataBound (new MenuEventArgs (item));

				if (hdata == null || !hdata.HasChildren)
					continue;

				IHierarchicalEnumerable e = hdata.GetChildren ();
				FillBoundChildrenRecursive (e, item.ChildItems);
			}
		}
예제 #29
0
        private bool IsChildItemSelected(MenuItemCollection items)
        {
            bool bRet = false;

            if (items != null)
            {
                foreach (MenuItem item in items)
                {
                    if (item.Selected || IsChildItemSelected(item.ChildItems))
                    {
                        bRet = true;
                        break;
                    }
                }
            }

            return bRet;
        }
        private void BuildItems(MenuItem currentItem, MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {

                writer.WriteLine();

                writer.WriteBeginTag("ul");
                if (isRoot)
                {
                    writer.WriteAttribute("class", "art-vmenu");
                }
                else if(currentItem != null)
                {
                    string classname = GetSelectStatusClass(currentItem);
                    if (classname.Length > 0) { writer.WriteAttribute("class", classname); }

                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                foreach (MenuItem item in items)
                {
                    BuildItem(item, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
예제 #31
0
		void CreateChildControlsForItems (MenuItemCollection items ) {
			foreach (MenuItem item in items) {
				bool isDynamicItem = IsDynamicItem (item);
				if (isDynamicItem && dynamicItemTemplate != null) {
					MenuItemTemplateContainer cter = new MenuItemTemplateContainer (item.Index, item);
					dynamicItemTemplate.InstantiateIn (cter);
					_menuItemControls [item] = cter;
					Controls.Add (cter);
				}
				else if (!isDynamicItem && staticItemTemplate != null) {
					MenuItemTemplateContainer cter = new MenuItemTemplateContainer (item.Index, item);
					staticItemTemplate.InstantiateIn (cter);
					_menuItemControls [item] = cter;
					Controls.Add (cter);
				}
				if (item.HasChildData)
					CreateChildControlsForItems (item.ChildItems);
			}
		}
예제 #32
0
        private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {
                writer.WriteLine();

                writer.WriteBeginTag("ul");
                if (isRoot)
                {
                    if (!string.IsNullOrEmpty(Control.CssClass))
                    {
                        writer.WriteAttribute("class", Control.CssClass);
                    }
                    if (Control.ID != "SubNavMenu")
                    {
                        writer.WriteAttribute("id", Control.ID);
                    }
                }
                else if (_nextingLevel < Control.StaticDisplayLevels)
                {
                    writer.WriteAttribute("style", "position: relative !important; visibility: visible !important;");
                }
                else if (items[0].Parent.Text == "Contact Us")
                {
                    writer.WriteAttribute("style", "width: 128px !important;");
                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                foreach (MenuItem item in items)
                {
                    BuildItem(item, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
예제 #33
0
		public abstract void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, bool notLast);
예제 #34
0
		void RenderDynamicMenu (HtmlTextWriter writer, MenuItemCollection items) {
			for (int n = 0; n < items.Count; n++) {
				if (DisplayChildren (items [n])) {
					RenderDynamicMenu (writer, items [n]);
					RenderDynamicMenu (writer, items [n].ChildItems);
				}
			}
		}
예제 #35
0
		void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, bool notLast) {
			if (!vertical)
				writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			int count = items.Count;
			for (int n = 0; n < count; n++) {
				MenuItem item = items [n];
				Adapters.MenuAdapter adapter = Adapter as Adapters.MenuAdapter;
				if (adapter != null)
					adapter.RenderItem (writer, item, n);
				else
					RenderMenuItem (writer, item, (n + 1 == count) ? notLast : true, n == 0);
			}

			if (!vertical)
				writer.RenderEndTag ();	// TR
		}
예제 #36
0
 internal MenuItemCollectionEnumerator(MenuItemCollection list)
 {
     this.list  = list;
     this.index = -1;
     version    = list._version;
 }