Пример #1
0
 public DebugEngine() : base()
 {
     // Initialize the CompoundTemplateWebService, we use this to retrieve ItemXml from Tridion CMS for DebugSession initialization
     mCompoundService = new CompoundTemplateWebService()
     {
         Url = VirtualPathUtility.AppendTrailingSlash(DebuggerConfig.Instance.CMS.Url) + "templating/compoundtemplatewebservice.asmx",
         UseDefaultCredentials = true
     };
 }
 public DebugEngine()
     : base()
 {
     // Initialize the CompoundTemplateWebService, we use this to retrieve ItemXml from Tridion CMS for DebugSession initialization
     mCompoundService = new CompoundTemplateWebService()
     {
         Url = VirtualPathUtility.AppendTrailingSlash(DebuggerConfig.Instance.CMS.Url) + "templating/compoundtemplatewebservice.asmx",
         UseDefaultCredentials = true
     };
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompoundTemplateStub"/> class.
        /// </summary>
        /// <param name="targetHost">SDL Tridion target host.</param>
        public CompoundTemplateStub(String targetHost)
        {
            mTargetHost = targetHost;

            // Initialize the CompoundTemplateWebService, we use this to retrieve ItemXml from Tridion CMS for DebugSession initialization
            mCompoundService = new CompoundTemplateWebService()
            {
                Url = VirtualPathUtility.AppendTrailingSlash(mTargetHost) + "templating/compoundtemplatewebservice.asmx",
                UseDefaultCredentials = true
            };

            Initialize(mCompoundService);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompoundTemplateStub"/> class.
        /// </summary>
        /// <param name="targetHost">SDL Tridion target host.</param>
        public CompoundTemplateStub(String targetHost)
        {
            mTargetHost = targetHost;

            // Initialize the CompoundTemplateWebService, we use this to retrieve ItemXml from Tridion CMS for DebugSession initialization
            mCompoundService = new CompoundTemplateWebService()
            {
                Url = VirtualPathUtility.AppendTrailingSlash(mTargetHost) + "templating/compoundtemplatewebservice.asmx",
                UseDefaultCredentials = true
            };

            Initialize(mCompoundService);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompoundTemplateStub"/> class.
        /// </summary>
        /// <param name="targetHost">SDL Tridion target host.</param>
        public CompoundTemplateService2011() : base()
        {
            // Initialize the CompoundTemplateWebService, we use this to retrieve ItemXml from Tridion CMS for DebugSession initialization
            mCompoundService = new CompoundTemplateWebService()
            {
                Url = DebuggerConfig.WebServiceUrl,
                UseDefaultCredentials = false,
                EnableDecompression   = true,
                PreAuthenticate       = true
            };

            Initialize(mCompoundService);
        }
Пример #6
0
        /// <summary>
        /// Retrieves the Compound Template invocation XML for a given page or component template Uri
        /// </summary>
        /// <param name="compoundTemplateWebService"><see cref="T:Tridion.ContentManager.Templating.CompoundTemplates.DomainModel.Proxy.CompoundTemplateWebService" /></param>
        /// <param name="templateUri">Tridion template URI.</param>
        /// <returns>Compound Template invocation XML as <see cref="T:String.String" /></returns>
        /// <exception cref="System.NotSupportedException">Unsupported template type</exception>
        public static String GetCompoundTemplateXml(this CompoundTemplateWebService compoundTemplateWebService, String templateUri)
        {
            if (compoundTemplateWebService != null)
            {
                XmlElement templateXml = compoundTemplateWebService.ReadItem(templateUri, EnumOpenMode.OpenModeView, 1919);

                String templateType = templateXml.SelectSingleNode("/tcm:Data/tcm:Type", namespaceManager).InnerText;

                if (!String.Equals(templateType, "CompoundTemplate", StringComparison.OrdinalIgnoreCase))
                {
                    throw new NotSupportedException("Unsupported template type: " + templateType);
                }

                return(templateXml.SelectSingleNode("/tcm:Data/tcm:Content/tcm:PublisherScript", namespaceManager).InnerText);
            }

            return(String.Empty);
        }
Пример #7
0
        /// <summary>
        /// Retrieves the Compound Template invocation XML for a given page or component template Uri
        /// </summary>
        /// <param name="compoundTemplateWebService"><see cref="T:Tridion.ContentManager.Templating.CompoundTemplates.DomainModel.Proxy.CompoundTemplateWebService" /></param>
        /// <param name="templateUri">Tridion template URI.</param>
        /// <returns>Compound Template invocation XML as <see cref="T:String.String" /></returns>
        /// <exception cref="System.NotSupportedException">Unsupported template type</exception>
        public static String GetAssemblyKey(this CompoundTemplateWebService compoundTemplateWebService, String templateUri)
        {
            if (compoundTemplateWebService != null)
            {
                XmlElement templateXml = compoundTemplateWebService.ReadItem(templateUri, EnumOpenMode.OpenModeView, 1919);

                String templateType = templateXml.SelectSingleNode("/tcm:Data/tcm:Type", namespaceManager).InnerText;

                if (!String.Equals(templateType, "CompoundTemplate", StringComparison.OrdinalIgnoreCase))
                {
                    throw new NotSupportedException("Unsupported template type: " + templateType);
                }

                String owningPublication = templateXml.SelectSingleNode("/tcm:Info/tcm:BluePrintInfo/tcm:OwningPublication/@xlink:href", namespaceManager).InnerText;
                String version           = templateXml.SelectSingleNode("/tcm:Info/tcm:VersionInfo/tcm:Version", namespaceManager).InnerText;
                String revision          = templateXml.SelectSingleNode("/tcm:Info/tcm:VersionInfo/tcm:Revision", namespaceManager).InnerText;
                String content           = templateXml.SelectSingleNode("/tcm:Data/tcm:Content/tcm:PublisherScript", namespaceManager).InnerText;

                content = content.Replace("\n", "\r\n");

                TcmUri tcmPublication = new TcmUri(owningPublication);
                TcmUri tcmTemplate    = new TcmUri(templateUri);

                TcmUri tcmParent = new TcmUri(tcmTemplate.ItemId, tcmTemplate.ItemType, tcmPublication.ItemId);

                int hashCode = 0;

                if (!String.IsNullOrEmpty(content))
                {
                    hashCode = content.GetHashCode();
                }

                return(String.Format("{0}/{1}.{2}/{3:X}", tcmParent, version, revision, hashCode));
            }

            return(String.Empty);
        }