コード例 #1
0
        /// <summary>
        /// Renders the item.
        /// </summary>
        /// <param name="currentNode">The current node.</param>
        /// <param name="writer">The writer.</param>
        /// <param name="IsChild">if set to <c>true</c> [is child].</param>
        private void RenderItem(ProductMappingLinkItem currentNode, HtmlTextWriter writer, bool IsChild)
        {
            writer.RenderBeginTag(HtmlTextWriterTag.Li);
            if (IsChild)
            {
                int j = 0;
                while (j < i)
                {
                    writer.Write("&nbsp;&nbsp;");
                    j++;
                }
                writer.Write("<span class=\"catMark\">" + this.Bullet + "</span>");
                writer.Write("&nbsp;&nbsp;");
            }
            HyperLink lnk = new HyperLink();

            lnk.Text        = XmlCommon.GetLocaleEntry(currentNode.Name, Customer.Current.LocaleSetting, false);
            lnk.NavigateUrl = currentNode.Url;
            if (currentNode.Selected)
            {
                lnk.Style.Add("font-weight", "bold");
            }
            lnk.RenderControl(writer);

            if (currentNode.ChildItems.Count > 0)
            {
                i++;
                RenderList(currentNode.ChildItems, writer, true, this.EntityType);
                i--;
            }

            writer.RenderEndTag();
        }
コード例 #2
0
        private void InitializeDataSource()
        {
            // check the current entity if viewing on an entity page
            int id = ID_NOT_DEFINED;

            if (HasDefinedInQueryString(out id) ||
                HasDefinedInProfile(out id))
            {
                ProductMappingLinkItem selectedEntity = ProductMappingLinkItem.Find(id, this.EntityType);
                if (selectedEntity != null)
                {
                    selectedEntity.LoadChildren();
                    this.DataSource = LinkItemCollection.BuildFrom(selectedEntity, selectedEntity.Type);
                    return;
                }
            }

            // by default load the root level entities
            this.DataSource = LinkItemCollection.GetAllFirstLevel(this.EntityType, this.MaxMenuSize, Customer.Current.LocaleSetting);
        }
コード例 #3
0
        /// <summary>
        /// Renders the list.
        /// </summary>
        /// <param name="nodes">The nodes.</param>
        /// <param name="writer">The writer.</param>
        /// <param name="IsChild">if set to <c>true</c> [is child].</param>
        private void RenderList(LinkItemCollection nodes, HtmlTextWriter writer, bool IsChild, string Type)
        {
            int maxSize = this.MaxMenuSize;
            LinkItemCollection NewNodes = new LinkItemCollection();
            bool AllowEntityFiltering   = AppLogic.GlobalConfigBool("AllowEntityfiltering");

            if (AllowEntityFiltering)
            {
                foreach (ILinkItem LI in nodes)
                {
                    if (!Entity.ExistsInEntityStore(AppLogic.StoreID(), LI.ID, Type))
                    {
                    }
                    else
                    {
                        NewNodes.Add(LI);
                    }
                }
            }
            else
            {
                foreach (ILinkItem LI in nodes)
                {
                    NewNodes.Add(LI);
                }
            }

            writer.Write("<ul class=\"tame\">");
            for (int ctr = 0; ctr < NewNodes.Count; ctr++)
            {
                if (ctr == maxSize)
                {
                    break;
                }

                ProductMappingLinkItem node = NewNodes[ctr] as ProductMappingLinkItem;
                RenderItem(node, writer, IsChild);
            }
            writer.Write("</ul>");
        }