public override void Display(DisplayElement d_element) { Item itemElement = d_element.Element as Item; if (itemElement == null) { return; } d_element.Value = itemElement.Uri.ToString(); d_element.Header = itemElement.Name; for (int i = 0; i < Columns.Count; i++) { ASR.Interface.BaseColumn column = Columns[i]; string text = column.GetColumnText(itemElement, MaxLength); if (string.IsNullOrEmpty(text)) { d_element.AddColumn(column.Header, itemElement[column.Name]); } else { d_element.AddColumn(column.Header, text); } } d_element.Icon = itemElement.Appearance.Icon; }
private static void InitializeColumns(BaseViewer oViewer, string columnsXml) { oViewer.Columns = new List <BaseColumn>(); if (!string.IsNullOrEmpty(columnsXml)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(columnsXml); XmlNodeList columnNodes = doc.DocumentElement.SelectNodes("Column"); Database db = Sitecore.Configuration.Factory.GetDatabase(Settings.Instance.ConfigurationDatabase); Item ViewerColumnFolder = db.GetItem(Settings.Instance.ViewerColumnsFolder); SCDirector director = new SCDirector("master", "en"); for (int i = 0; i < columnNodes.Count; i++) { string name = columnNodes[i].Attributes["name"].Value; Item item = ViewerColumnFolder.Axes.GetItem(name); ColumnItem ci = director.LoadObjectFromItem <ColumnItem>(item); ci.Header = columnNodes[i].InnerText; //If this is the wildcard item populate the name too if (item.Name == "*") { ci.Name = name; } if (columnNodes[i].Attributes["attributes"] != null) { ci.Attributes = columnNodes[i].Attributes["attributes"].Value; } oViewer.Columns.Add(BaseColumn.Create(ci)); } } }