コード例 #1
0
        /// <summary>
        /// Publishes the specified tcm uri as a binary component
        /// </summary>
        /// <param name="uri">TCM URI.</param>
        /// <returns>Published Url or String.Empty</returns>
        public String PublishBinary(String uri)
        {
            IdentifiableObject identifiableObject = mEngine.GetObject(uri);

            if (identifiableObject is Component)
            {
                return(mTemplateBase.PublishBinary(identifiableObject as Component));
            }

            return(String.Empty);
        }
コード例 #2
0
        /// <summary>
        /// Resolves an application specific Tridion image for a given <see cref="T:Tridion.ContentManager.ContentManagement.Component" />
        /// </summary>
        /// <param name="templateBase"><see cref="T:TcmTemplate.TemplateBase" /></param>
        /// <param name="xhtml"><see cref="T:System.Linq.Xml.XElement" /> with XHTML to transform</param>
        /// <param name="component"><see cref="T:Tridion.ContentManager.ContentManagement.Component" /></param>
        public virtual void Resolve(TemplateBase templateBase, XElement xhtml, Component component)
        {
            xhtml.SetAttributeValue("title", LinkTitle(component));

            // Publish multi-media components
            if (component.ComponentType == ComponentType.Multimedia)
            {
                String binaryUrl = templateBase.PublishBinary(component);

                if (String.Equals(xhtml.Name.LocalName, "img", StringComparison.OrdinalIgnoreCase))
                    xhtml.SetAttributeValue("src", PrefixLink(binaryUrl));
                else
                    xhtml.SetAttributeValue("href", PrefixLink(binaryUrl));

                return;
            }

            // Normal component link, render as <a href="tcm:5-22">
            xhtml.SetAttributeValue("href", component.Id);
        }
コード例 #3
0
        /// <summary>
        /// Resolves an application specific Tridion image for a given <see cref="T:Tridion.ContentManager.ContentManagement.Component" />
        /// </summary>
        /// <param name="templateBase"><see cref="T:TcmTemplate.TemplateBase" /></param>
        /// <param name="xhtml"><see cref="T:System.Linq.Xml.XElement" /> with XHTML to transform</param>
        /// <param name="component"><see cref="T:Tridion.ContentManager.ContentManagement.Component" /></param>
        public virtual void Resolve(TemplateBase templateBase, XElement xhtml, Component component)
        {
            xhtml.SetAttributeValue("title", LinkTitle(component));

            // Publish multi-media components
            if (component.ComponentType == ComponentType.Multimedia)
            {
                String binaryUrl = templateBase.PublishBinary(component);

                if (String.Equals(xhtml.Name.LocalName, "img", StringComparison.OrdinalIgnoreCase))
                {
                    xhtml.SetAttributeValue("src", PrefixLink(binaryUrl));
                }
                else
                {
                    xhtml.SetAttributeValue("href", PrefixLink(binaryUrl));
                }

                return;
            }

            // Normal component link, render as <a href="tcm:5-22">
            xhtml.SetAttributeValue("href", component.Id);
        }