当前位置: 首页>>代码示例>>C#>>正文


C# Document.ToPreviewXml方法代码示例

本文整理汇总了C#中umbraco.cms.businesslogic.web.Document.ToPreviewXml方法的典型用法代码示例。如果您正苦于以下问题:C# Document.ToPreviewXml方法的具体用法?C# Document.ToPreviewXml怎么用?C# Document.ToPreviewXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umbraco.cms.businesslogic.web.Document的用法示例。


在下文中一共展示了Document.ToPreviewXml方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTaskNode

        private XmlElement CreateTaskNode(Task t, XmlDocument xd)
        {
            Document d = new Document(t.Node.Id);
            XmlNode x = d.ToPreviewXml(xd);//  xd.CreateNode(XmlNodeType.Element, "node", "");

            XmlElement xTask = xd.CreateElement("task");
            xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "Id", t.Id.ToString()));
            xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "Date", t.Date.ToString("s")));
            xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "NodeId", t.Node.Id.ToString()));
            xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "TotalWords", cms.businesslogic.translation.Translation.CountWords(d.Id).ToString()));
            xTask.AppendChild(xmlHelper.addCDataNode(xd, "Comment", t.Comment));
            string protocol = GlobalSettings.UseSSL ? "https" : "http";
            xTask.AppendChild(xmlHelper.addTextNode(xd, "PreviewUrl", protocol + "://" + Request.ServerVariables["SERVER_NAME"] + SystemDirectories.Umbraco + "/translation/preview.aspx?id=" + t.Id.ToString()));
            //            d.XmlPopulate(xd, ref x, false);
            xTask.AppendChild(x);

            return xTask;
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:18,代码来源:xml.aspx.cs

示例2: PrepareDocument

        public void PrepareDocument(User user, Document documentObject, bool includeSubs)
        {
            _userId = user.Id;

            // clone xml
            XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();

            // inject current document xml
            int parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;
            XmlContent = content.AppendDocumentXml(documentObject.Id, documentObject.Level, parentId, documentObject.ToPreviewXml(XmlContent), XmlContent);

            if (includeSubs)
            {
                foreach (CMSPreviewNode prevNode in documentObject.GetNodesForPreview(true))
                {
                    XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml))), XmlContent);
                }
            }

        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:20,代码来源:PreviewContent.cs

示例3: PrepareDocument

        public void PrepareDocument(User user, Document documentObject, bool includeSubs)
        {
            _userId = user.Id;

            // clone xml
            XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();

            var previewNodes = new List<Document>();

            var parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;

            while (parentId > 0 && XmlContent.GetElementById(parentId.ToString(CultureInfo.InvariantCulture)) == null)
            {
                var document = new Document(parentId);
                previewNodes.Insert(0, document);
                parentId = document.ParentId;
            }

            previewNodes.Add(documentObject);

            foreach (var document in previewNodes)
            {
                //Inject preview xml
                parentId = document.Level == 1 ? -1 : document.Parent.Id;
                var previewXml = document.ToPreviewXml(XmlContent);
                content.AppendDocumentXml(document.Id, document.Level, parentId, previewXml, XmlContent);
            }

            if (includeSubs)
            {
                foreach (var prevNode in documentObject.GetNodesForPreview(true))
                {
                    XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml))), XmlContent);
                }
            }

        }
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:37,代码来源:PreviewContent.cs

示例4: getPreviewOrPublishedNode

 private static XmlNode getPreviewOrPublishedNode(Document d, XmlDocument xmlContentCopy, bool isPreview)
 {
     if (isPreview)
     {
         return d.ToPreviewXml(xmlContentCopy);
     }
     else
     {
         return d.ToXml(xmlContentCopy, false);
     }
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:11,代码来源:content.cs

示例5: OnRenderNode

        /// <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);
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:35,代码来源:FilteredContentTree.cs

示例6: GetContentXmlNode

        private XmlNode GetContentXmlNode(string nodeId)
        {
            // try to get node from XML cache
            XmlNode xmlNode = content.Instance.XmlContent.GetElementById(nodeId);

            if (xmlNode == null)
            {
                // if unpublished, get from Document (database)
                var doc = new Document(int.Parse(nodeId));
                if (doc != null)
                {
                    // get the preview XML
                    xmlNode = doc.ToPreviewXml(new XmlDocument());
                }
            }

            return xmlNode;
        }
开发者ID:umBristol,项目名称:umbraco-page-state-icons,代码行数:18,代码来源:Application.cs

示例7: PrepareDocument

        public void PrepareDocument(User user, Document documentObject, bool includeSubs)
        {
            _userId = user.Id;

            // clone xml
            XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();

            var previewNodes = new List<Document>();

            var parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;

            while (parentId > 0 && XmlContent.GetElementById(parentId.ToString(CultureInfo.InvariantCulture)) == null)
            {
                var document = new Document(parentId);
                previewNodes.Insert(0, document);
                parentId = document.ParentId;
            }

            previewNodes.Add(documentObject);

            foreach (var document in previewNodes)
            {
                //Inject preview xml
                parentId = document.Level == 1 ? -1 : document.Parent.Id;
                var previewXml = document.ToPreviewXml(XmlContent);
                if (document.Content.Published == false 
                    && ApplicationContext.Current.Services.ContentService.HasPublishedVersion(document.Id))
                    previewXml.Attributes.Append(XmlContent.CreateAttribute("isDraft"));
                content.AppendDocumentXml(document.Id, document.Level, parentId, previewXml, XmlContent);
            }

            if (includeSubs)
            {
                foreach (var prevNode in documentObject.GetNodesForPreview(true))
                {
                    var previewXml = XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml)));
                    if (prevNode.IsDraft)
                        previewXml.Attributes.Append(XmlContent.CreateAttribute("isDraft"));
                    XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, previewXml, XmlContent);
                }
            }

        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:43,代码来源:PreviewContent.cs


注:本文中的umbraco.cms.businesslogic.web.Document.ToPreviewXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。