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)); } } }
internal static BaseViewer Create(string type, string parameters) { Assert.ArgumentNotNull(type, "type"); Assert.ArgumentNotNull(parameters, "parameters"); BaseViewer oViewer = BaseViewer.Create(type); oViewer.AddParameters(parameters); return(oViewer); }
internal static BaseViewer Create(string type, string parameters, string columnsXml) { Assert.ArgumentNotNull(type, "type"); Assert.ArgumentNotNull(parameters, "parameters"); BaseViewer oViewer = BaseViewer.Create(type); oViewer.AddParameters(parameters); InitializeColumns(oViewer, columnsXml); return(oViewer); }
internal static BaseViewer Create(string type, string parameters, string columnsXml) { Assert.ArgumentNotNull(type, "type"); Assert.ArgumentNotNull(parameters, "parameters"); BaseViewer oViewer = BaseViewer.Create(type); oViewer.AddParameters(parameters); InitializeColumns(oViewer, columnsXml); //backwards compatibility if (oViewer.Columns.Count == 0) { InitializeColumnsOld(oViewer); } return(oViewer); }
private static void InitializeColumnsOld(BaseViewer baseViewer) { var columns = baseViewer.getParameter("columns"); if (!string.IsNullOrEmpty(columns)) { var cols = columns.Split(','); foreach (var col in cols) { var c = new Column() { Name = col, Header = col }; baseViewer.Columns.Add(c); } } }
private static void InitializeColumns(BaseViewer oViewer, string columnsXml) { oViewer.Columns = new List <Column>(); if (!string.IsNullOrEmpty(columnsXml)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(columnsXml); XmlNodeList columnNodes = doc.DocumentElement.SelectNodes("Column"); for (int i = 0; i < columnNodes.Count; i++) { Column column = new Column { Name = columnNodes[i].Attributes["name"].Value, Header = columnNodes[i].InnerText }; oViewer.Columns.Add(column); } } }
private static void InitializeColumns(BaseViewer oViewer, string columnsXml) { oViewer.Columns = new List<Column>(); if (!string.IsNullOrEmpty(columnsXml)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(columnsXml); XmlNodeList columnNodes = doc.DocumentElement.SelectNodes("Column"); for (int i = 0; i < columnNodes.Count; i++) { Column column = new Column { Name = columnNodes[i].Attributes["name"].Value, Header = columnNodes[i].InnerText }; oViewer.Columns.Add(column); } } }
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)); } } }