protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e) { msg.ClearMessage(); if (this.NewNameField.Text.Trim().Length < 1) { msg.ShowWarning("Please enter a name for the new column."); } else { ContentColumn c = new ContentColumn(); c.DisplayName = this.NewNameField.Text.Trim(); c.SystemColumn = false; if (MTApp.ContentServices.Columns.Create(c) == true) { Response.Redirect("Columns_Edit.aspx?id=" + c.Bvin); } else { msg.ShowError("Unable to create column. Please see event log for details"); EventLog.LogEvent("Create Content Column Button", "Unable to create column", EventLogSeverity.Error); } } }
private void AddColumn(string columnbvin, ref XmlWriter xw) { ContentColumn col = MTApp.ContentServices.Columns.Find(columnbvin); if (col != null) { col.ToXmlWriter(ref xw); } }
private void InstallColumn(string xmlData) { if (xmlData == string.Empty) { return; } XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(xmlData); // Find Column XmlNode bvinNode = xdoc.SelectSingleNode("/ContentColumn/Bvin"); if (bvinNode == null) { return; } string columnBvin = bvinNode.InnerText; ContentColumn col = MTApp.ContentServices.Columns.Find(columnBvin); if (col == null) { return; } if (col.SystemColumn == false) { return; } // remove existing blocks col.Blocks.Clear(); MTApp.ContentServices.Columns.Update(col); // add blocks from xml XmlNodeList blockNodes; blockNodes = xdoc.SelectNodes("/ContentColumn/Blocks/ContentBlock"); if (blockNodes != null) { for (int i = 0; i <= blockNodes.Count - 1; i++) { ContentBlock b = new ContentBlock(); b.FromXmlString(blockNodes[i].OuterXml); b.Bvin = string.Empty; col.Blocks.Add(b); } } MTApp.ContentServices.Columns.Update(col); }