/// <summary> /// Handles the different root. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> /// <param name="xmlNode">The XML node.</param> private static void HandleDifferentRoot(ControlList control, ref String value, XmlNode xmlNode) { String realName; String treeRootName; if (value.IndexOf("|", StringComparison.Ordinal) > 0) { treeRootName = value.Substring(0, value.IndexOf("|", StringComparison.Ordinal)); value = value.Substring(value.IndexOf("|", StringComparison.Ordinal) + 1); realName = GetTreeRootName(value); } else { treeRootName = GetTreeRootName(value); realName = treeRootName; } XmlDocument ownerDocument = control["sitetree"].OwnerDocument; if (ownerDocument != null) { XmlNode treeNode = ownerDocument.CreateElement(treeRootName); XmlNode copyNode = xmlNode.SelectSingleNode(value); if (copyNode != null) { treeNode.InnerXml = copyNode.InnerXml; } CommonXml.AppendAttribute(treeNode, "realname", realName); control["sitetree"].AppendChild(treeNode); } }
/// <summary> /// Creates the in tree. /// </summary> /// <param name="path">The path.</param> /// <param name="name">The name.</param> /// <param name="menuName">Name of the menu.</param> /// <returns></returns> private XmlNode CreateInTree(string path, string name, string menuName) { XmlNode parentNode = GetPageNode(path); XmlNode pageNode = _treeDocument.CreateElement(name); parentNode.AppendChild(pageNode); CommonXml.AppendAttribute(pageNode, "menuname", menuName); return(pageNode); }
/// <summary> /// Handles the save. /// </summary> private void HandleSave() { String elementName = String.Empty; Page currentPage = new SiteTree(Process).GetPage(Process.QueryData["pageidentifier"]); for (int i = 0; i < Process.QueryData.Count; i++) { Query query = Process.QueryData[i]; String[] queryParts = query.Name.Split('_'); if (queryParts.Length > 1) { switch (queryParts[0]) { case "attribute": if (queryParts[1].EndsWith("-list")) { XmlNode xmlNode = currentPage.GetAttribute(queryParts[1]); xmlNode.InnerText = String.Empty; foreach (String tmpString in query.Value.Split('\n')) { CommonXml.GetNode(xmlNode, "item", EmptyNodeHandling.ForceCreateNew).InnerText = tmpString; } } else { currentPage[queryParts[1]] = query.Value; } break; case "element": Container container = currentPage.Containers[int.Parse(queryParts[1]) - 1]; if (queryParts[3].EndsWith("-list")) { XmlNode xmlNode = CommonXml.GetNode(container.Elements[int.Parse(queryParts[2]) - 1].Node, queryParts[3]); xmlNode.InnerText = String.Empty; foreach (String tmpString in query.Value.Split('\n')) { if (tmpString != String.Empty) { XmlNode tmpNode = CommonXml.GetNode(xmlNode, "item", EmptyNodeHandling.ForceCreateNew); tmpNode.InnerText = tmpString; CommonXml.AppendAttribute(tmpNode, "id", Common.CleanToSafeString(tmpString)); } } } else { if (elementName != query.Name.Substring(0, query.Name.LastIndexOf('_'))) { elementName = query.Name.Substring(0, query.Name.LastIndexOf('_')); container.Elements[int.Parse(queryParts[2]) - 1].Publish = false.ToString(CultureInfo.InvariantCulture).ToLower(); } if (query.Name.EndsWith("elementtitle")) { container.Elements[int.Parse(queryParts[2]) - 1].Name = query.Value; } else if (query.Name.EndsWith("elementpublish")) { container.Elements[int.Parse(queryParts[2]) - 1].Publish = query.Value.ToLower() == "publish" ? true.ToString(CultureInfo.InvariantCulture).ToLower() : false.ToString(CultureInfo.InvariantCulture).ToLower(); } else { container.Elements[int.Parse(queryParts[2]) - 1][queryParts[3]] = query.Value; } } break; } } } currentPage.Save(); }