Carrotware.CMS.UI.Controls.SiteMetaWordList.RenderContents C# (CSharp) Метод

RenderContents() защищенный Метод

protected RenderContents ( System.Web.UI.HtmlTextWriter output ) : void
output System.Web.UI.HtmlTextWriter
Результат void
        protected override void RenderContents(HtmlTextWriter output)
        {
            int indent = output.Indent;

            List<IContentMetaInfo> lstNav = GetMetaInfo();

            output.Indent = indent + 3;
            output.WriteLine();

            if (lstNav != null && lstNav.Any() && !String.IsNullOrEmpty(this.MetaDataTitle)) {
                output.WriteLine("<" + this.HeadWrapTag.ToString().ToLowerInvariant() + " class=\"meta-caption\">" + this.MetaDataTitle + "</" + this.HeadWrapTag.ToString().ToLowerInvariant() + ">\r\n");
            }

            string sCSS = String.Empty;
            if (!String.IsNullOrEmpty(this.CssClass)) {
                sCSS = " class=\"" + this.CssClass + "\" ";
            }

            string sItemCSS = String.Empty;
            if (!String.IsNullOrEmpty(this.CSSItem)) {
                sItemCSS = String.Format(" {0} ", this.CSSItem);
            }

            output.WriteLine("<ul" + sCSS + " id=\"" + this.ClientID + "\"> ");
            output.Indent++;

            int contentCount = 0;

            if (this.ContentType == MetaDataType.DateMonth) {
                contentCount = navHelper.GetSitePageCount(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry)
                                + navHelper.GetSitePageCount(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
            } else {
                contentCount = navHelper.GetSitePageCount(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
            }

            foreach (IContentMetaInfo c in lstNav) {
                string sText = c.MetaInfoText;
                string sCount = "0";

                if (SecurityData.IsAuthEditor) {
                    sCount = c.MetaInfoCount.ToString();
                } else {
                    sCount = c.MetaPublicInfoCount.ToString();
                }
                if (this.ShowUseCount) {
                    sText = String.Format("{0}  ({1})", c.MetaInfoText, sCount);
                }

                double percUsed = Math.Ceiling(100 * (float)c.MetaInfoCount / (((float)contentCount + 0.000001)));
                percUsed = Math.Round(percUsed / 5) * 5;
                if (percUsed < 1 && c.MetaInfoCount > 0) {
                    percUsed = 1;
                }
                if (c.MetaInfoCount <= 0) {
                    percUsed = 0;
                }
                if (percUsed > 100) {
                    percUsed = 100;
                }

                if (SiteData.IsFilenameCurrentPage(c.MetaInfoURL)) {
                    output.WriteLine("<li class=\"meta-item meta-perc-used-" + percUsed.ToString() + " meta-used-" + sCount + sItemCSS + " selected\"><a href=\"" + c.MetaInfoURL + "\">" + sText + "</a></li> ");
                } else {
                    output.WriteLine("<li class=\"meta-item meta-perc-used-" + percUsed.ToString() + " meta-used-" + sCount + sItemCSS + "\"><a href=\"" + c.MetaInfoURL + "\">" + sText + "</a></li> ");
                }
            }

            output.Indent--;
            output.WriteLine("</ul> ");

            output.Indent = indent;
        }