/// <summary> /// Called when [render node]. /// </summary> /// <param name="xNode">The x node.</param> /// <param name="doc">The doc.</param> protected override void OnRenderNode(ref XmlTreeNode xNode, Document doc) { base.OnRenderNode(ref xNode, doc); var dataTypeId = this.GetDataTypeId(); var xpath = this.GetXPathFromCookie(dataTypeId); var xPathType = this.GetXPathFilterTypeFromCookie(dataTypeId); // resolves any Umbraco params in the XPath xpath = uQuery.ResolveXPath(xpath); var xDoc = new XmlDocument(); XmlNode xmlDoc; if (!doc.Published) { xmlDoc = doc.ToPreviewXml(xDoc); } else { xmlDoc = doc.ToXml(xDoc, false); } var xmlString = "<root>" + xmlDoc.OuterXml + "</root>"; var xml = XElement.Parse(xmlString); xNode.DetermineClickable(xpath, xPathType, xml); //ensure that the NodeKey is passed through xNode.Source = this.GetTreeServiceUrlWithParams(int.Parse(xNode.NodeID), dataTypeId); }
/// <summary> /// Called when [before node render]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="node">The node.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnBeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e) { var xpath = this.GetXPathFromCookie(this.GetDataTypeId()); var xPathType = this.GetXPathFilterTypeFromCookie(this.GetDataTypeId()); var xDoc = new XmlDocument(); var xmlNode = umbraco.library.GetMedia(int.Parse(node.NodeID), false).Current.OuterXml; var xmlString = "<root>" + xmlNode + "</root>"; var xml = XElement.Parse(xmlString); node.DetermineClickable(xpath, xPathType, xml); //ensure that the NodeKey is passed through node.Source = this.GetTreeServiceUrlWithParams(int.Parse(node.NodeID), this.GetDataTypeId()); base.OnBeforeNodeRender(ref sender, ref node, e); }