Content Studio Web Content Management System
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
This is the standard implementation of the WriteSections method
provided by Content Studio.
[This is preliminary documentation and is subject to change.]
Write sections of document, grouped on their first letter, for the web
map. This method is called via the Invoke method. Inheriting
classes can override this method to supply their own rendering code
Namespace: ContentStudio.Site.ActiveScripting.Menu
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
protected virtual void WriteSections( TextWriter writer, string[] source, StringComparer stringComparer )
Parameters
- writer
- Type: System.IOTextWriter
A TextWriter to write HTML content to - source
- Type: SystemString
The entities that form the web map. Each member in the array is a string with the document name and the its ID separated by a pipe (|) character (example: "My document|1278") - stringComparer
- Type: SystemStringComparer
A StringComparer object used when sorting the source data.
Examples
C#
protected virtual void WriteSections(TextWriter Writer, string[] Source, StringComparer StringCo) { Writer.Write("<div"); WriteAttribute(Writer, " id", "CS_WebMapSkipLink" + _ComponentCount.ToString()); if (CSSPrefix.Length > 0) WriteAttribute(Writer, " class", CSSPrefix + "_ContentLists"); Writer.Write(">" + Environment.NewLine); //Write sections of document grouped on their first letter. Each new section starts with a letter. bool HasStartedList = false; string OldChar = " "; for (int i = 0; i < Source.Length; i++) { if (Source[i].Length > 0) { int LinePos = Source[i].IndexOf("|") + 1; if ((LinePos > 0)) { string CurrentChar = Source[i].Substring(0, (Source[i].IndexOf("|") + 1) - 1).Trim(); string CurrentId = Source[i].Substring(Source[i].IndexOf("|") + 1).Trim(); if ((OldChar.Length > 0) && (StringCo.Compare(CurrentChar.Substring(0, 1), OldChar) != 0)) { if (HasStartedList) Writer.Write(" </ul>" + Environment.NewLine); HasStartedList = true; Writer.Write(" <h" + _HeaderLevel.ToString()); WriteAttribute(Writer, " id", CreateCharIndex(CurrentChar) + _ComponentCount); Writer.Write(">"); Writer.Write(CurrentChar.Substring(0, 1)); Writer.Write("</h" + _HeaderLevel.ToString() + ">" + Environment.NewLine); Writer.Write(" <ul>" + Environment.NewLine); } Writer.Write(" <li>" + Environment.NewLine); Writer.Write(" <a"); WriteAttribute(Writer, " href", "default.aspx?" + Page.CS_QueryStringPrefix + "=" + CurrentId); WriteAttribute(Writer, " title", CurrentChar); Writer.Write(">"); Writer.Write(CurrentChar); Writer.Write("</a>" + Environment.NewLine); Writer.Write(" </li>" + Environment.NewLine); OldChar = CurrentChar.Substring(0, 1); } } } //for if (HasStartedList) Writer.Write(" </ul>" + Environment.NewLine); Writer.Write("</div>" + Environment.NewLine); } private string CreateCharIndex(string sData) { sData = System.Web.HttpUtility.HtmlEncode(sData.Substring(0, 1)); //* Take the string "charIndex", //* Add the sData after you have removed all occurences of the & # and ; characters //* Finally return the result. return "charIndex" + (sData.Replace("&", "").Replace("#", "").Replace(";", "")); }
See Also