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


C# TcmUri类代码示例

本文整理汇总了C#中TcmUri的典型用法代码示例。如果您正苦于以下问题:C# TcmUri类的具体用法?C# TcmUri怎么用?C# TcmUri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Transform

        public void Transform(Engine engine, Package package)
        {
            TemplatingLogger log = TemplatingLogger.GetLogger(GetType());
            if (package.GetByName(Package.OutputName) == null)
            {
                log.Error("Could not find \"Output\" item in Package. This template building block should be the last TBB in your template.");
                return;
            }
            Item output = package.GetByName(Package.OutputName);

            string outputText = output.GetAsString();

            bool outputchanged = false;
            foreach (Match m in TcmUriRegEx.Matches(outputText))
            {
                log.Debug("Found " + m.Value);
                TcmUri uri = new TcmUri(m.Value);
                if(uri.GetVersionlessUri().ToString().Equals(m.Value)) continue;
                log.Debug("Found version information on uri " + m.Value + ". Removing.");
                outputText = outputText.Replace(m.Value, uri.GetVersionlessUri().ToString());
                outputchanged = true;
            }
            if (outputchanged)
            {
                output.SetAsString(outputText);
                package.Remove(output);
                package.PushItem(Package.OutputName, output);
            }
        }
开发者ID:mhassan26,项目名称:SDL-Tridion-Template-Tools,代码行数:29,代码来源:RemoveDynamicVersionFromUri.cs

示例2: Article

 public Article(SessionAwareCoreServiceClient client, TcmUri location)
     : base(client)
 {
     ComponentData component = (ComponentData)Client.GetDefaultData(ItemType.Component, location, ReadOptions);
     component.Schema = new LinkToSchemaData { IdRef = ContentManager.ResolveUrl(Constants.ArticleSchemaUrl) };
     Content = component;
 }
开发者ID:NunoLinhares,项目名称:TridionWebData,代码行数:7,代码来源:Article.cs

示例3: ComponentPresentationModel

 /// <summary>
 /// Constrctor
 /// </summary>
 /// <param name="engine"></param>
 /// <param name="componentID"></param>
 /// <param name="templateID"></param>
 /// <param name="index"></param>
 public ComponentPresentationModel(Engine engine, TcmUri componentID, TcmUri templateID, int index)
 {
     _engine = engine;
     _componentID = componentID;
     _templateID = templateID;
     Index = index;
 }
开发者ID:alex-klock,项目名称:razor-mediator-4-tridion,代码行数:14,代码来源:ComponentPresentationModel.cs

示例4: ContentItem

 protected ContentItem(TcmUri itemId, SessionAwareCoreServiceClient client)
 {
     ReadOptions = new ReadOptions();
     Client = client;
     Content = (ComponentData) client.Read(itemId, ReadOptions);
     ContentManager = new ContentManager(Client);
 }
开发者ID:NunoLinhares,项目名称:TridionWebData,代码行数:7,代码来源:ContentItem.cs

示例5: ResolveLink

        public string ResolveLink(string componentUri)
        {
            TcmUri uri = new TcmUri(componentUri);

            if (!uri.Equals(emptyTcmUri))
            {
                Cache cache = HttpContext.Current.Cache;
                string cacheKey = String.Format(CACHEKEY_FORMAT, componentUri);
                if (cache[cacheKey] != null)
                {
                    return (String)cache[cacheKey];
                }
                else
                {
                    Link link = componentLink.GetLink(uri.ToString());
                    if (!link.IsResolved)
                    {
                        return null;
                    }
                    cache.Insert(cacheKey, link.Url, null, DateTime.Now.AddSeconds(30), TimeSpan.Zero); //TODO should this be configurable?
                    return link.Url;
                }
            }

            return null;
        }
开发者ID:rainmaker2k,项目名称:TridionMVCDotNet,代码行数:26,代码来源:TridionLinkFactory.cs

示例6: GetAssemblyKey

        /// <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;
        }
开发者ID:mvlasenko,项目名称:TridionVSRazorExtension,代码行数:40,代码来源:CompoundTemplateWebServiceExtensions.cs

示例7: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // get the current logged in user
            string user = HttpContext.Current.User.Identity.Name;
            if (!String.IsNullOrEmpty(user))
            {
                // set LogonUser
                TridionTreeView.LogonUser = user;
            }

            // process querystring parameters
            string start = Request.QueryString["start"];
            string types = Request.QueryString["types"];
            string pubid = Request.QueryString["pubid"];

            if (!String.IsNullOrEmpty(start))
            {
                // override StartFromUri
                TridionTreeView.StartFromUri = start;
            }
            else if (!String.IsNullOrEmpty(pubid))
            {
                // override StartFromUri with current publication id
                TcmUri uri = new TcmUri(pubid);
                TridionTreeView.StartFromUri = uri.ToString();
            }

            if (!String.IsNullOrEmpty(types))
            {
                // override SelectTypes
                TridionTreeView.SelectTypes = Convert.ToInt32(types);
            }
        }
开发者ID:SGAnonymous,项目名称:sdl-tridion-world,代码行数:33,代码来源:ItemSelector.aspx.cs

示例8: GetComponentLink

 protected ComponentLink GetComponentLink(TcmUri uri)
 {
     if (!_componentLinks.ContainsKey(uri.PublicationId))
     {
         _componentLinks.Add(uri.PublicationId, new ComponentLink(uri.PublicationId));
     }
     return _componentLinks[uri.PublicationId];
 }
开发者ID:flaithbheartaigh,项目名称:dynamic-delivery-4-tridion,代码行数:8,代码来源:TridionLinkProvider.cs

示例9: AddComponent

 /// <summary>
 /// Add a new <see cref="T:Tridion.ContentManager.TcmUri"/> value to the current <see cref="T:Tridion.ContentManager.Templating.Package" />
 /// </summary>
 /// <param name="package"><see cref="T:Tridion.ContentManager.Templating.Package" /></param>
 /// <param name="name">Name.</param>
 /// <param name="value">Value.</param>
 public static void AddComponent(this Package package, String name, TcmUri value)
 {
     if (package != null)
     {
         Item packageItem = package.CreateTridionItem(ContentType.Component, value != null ? value : TcmUri.UriNull);
         package.PushItem(name, packageItem);
     }
 }
开发者ID:TcmExtensions,项目名称:TcmTemplating,代码行数:14,代码来源:PackageExtensions.cs

示例10: GetLocalUri

 public static TcmUri GetLocalUri(TcmUri uriPublication, TcmUri uriItem)
 {
    TcmUri uriReturn = new TcmUri(uriItem.ItemId, uriItem.ItemType, uriPublication.ItemId);
    TemplatingLogger log = TemplatingLogger.GetLogger(typeof(TemplateUtilities));
    log.Info("(getLocalUri)Old URI was:" + uriItem.ToString());
    log.Info("(getLocalUri)New URI is:" + uriReturn.ToString());
    return uriReturn;
 }
开发者ID:jhorsman,项目名称:DD4T.TridionTemplates,代码行数:8,代码来源:TridionUtils.cs

示例11: GetContent

        public string GetContent(string uri, string templateUri = "")
        {
            var tcmUri = new TcmUri(uri);
            string urlParameters = string.IsNullOrEmpty(templateUri) ?
                string.Format("{0}/GetContent/{1}/{2}", controller, tcmUri.PublicationId, tcmUri.ItemId) :
                string.Format("{0}/GetContent/{1}/{2}/{3}", controller, tcmUri.PublicationId, tcmUri.ItemId, new TcmUri(templateUri).ItemId);

            return Execute<string>(urlParameters);
        }
开发者ID:tgfl-tom,项目名称:DD4T.Providers.Rest,代码行数:9,代码来源:TridionComponentPresentationProvider.cs

示例12: ResolveLink

        public string ResolveLink(string sourcePageUri, string componentUri, string excludeComponentTemplateUri)
        {
            
            var compUri = new TcmUri(componentUri);
            var pageUri = new TcmUri(sourcePageUri);
            var templateUri = new TcmUri(excludeComponentTemplateUri);

            string urlParameters = string.Format("{0}/ResolveLink/{1}/{2}/{3}/{4}", controller, PublicationId, pageUri.ItemId, compUri.ItemId, templateUri.ItemId);
            return Execute<string>(urlParameters);
        }
开发者ID:Jeej,项目名称:DD4T.Providers.Rest,代码行数:10,代码来源:TridionLinkProvider.cs

示例13: GetContent

        public string GetContent(string uri, string templateUri = "")
        {
            LoggerService.Debug(">>GetContent({0})", LoggingCategory.Performance, uri);

            TcmUri tcmUri = new TcmUri(uri);

            TcmUri templateTcmUri = new TcmUri(templateUri);

            T.ComponentPresentationFactory cpFactory = GetComponentPresentationFactory(tcmUri.PublicationId);

            T.ComponentPresentation cp = null;

            if (!String.IsNullOrEmpty(templateUri))
            {
                cp = cpFactory.GetComponentPresentation(tcmUri.ItemId, templateTcmUri.ItemId);
                if (cp != null)
                    return cp.Content;
            }

            if (!string.IsNullOrEmpty(selectByComponentTemplateId))
            {
                cp = cpFactory.GetComponentPresentation(tcmUri.ItemId, Convert.ToInt32(selectByComponentTemplateId));
                if (cp != null)
                {
                    LoggerService.Debug("<<GetContent({0}) - by ct id", LoggingCategory.Performance, uri);
                    return cp.Content;
                }
            }
            if (!string.IsNullOrEmpty(selectByOutputFormat))
            {
                cp = cpFactory.GetComponentPresentationWithOutputFormat(tcmUri.ItemId, selectByOutputFormat);
                if (cp != null)
                {
                    LoggerService.Debug("<<GetContent({0}) - by output format", LoggingCategory.Performance, uri);
                    return cp.Content;
                }
            }

            LoggerService.Debug("GetContent: about to get component presentations with Highst Priority for {0}", LoggingCategory.Performance, tcmUri.ToString());
            cp = cpFactory.GetComponentPresentationWithHighestPriority(tcmUri.ItemId);
            LoggerService.Debug("GetContent: get component presentations with Highst Priority for {0}", LoggingCategory.Performance, tcmUri.ToString());
            if (cp != null)
                return cp.Content;
            //foreach (Tridion.ContentDelivery.DynamicContent.ComponentPresentation _cp in cps)
            //{
            //    if (_cp != null)
            //    {
            //        LoggerService.Debug("<<GetContent({0}) - find all", LoggingCategory.Performance, uri);
            //        return _cp.Content;
            //    }
            //}

            LoggerService.Debug("<<GetContent({0}) - not found", LoggingCategory.Performance, uri);
            return string.Empty;
        }
开发者ID:dd4t,项目名称:DD4T.Providers.SDLTridion2013,代码行数:55,代码来源:TridionComponentPresentationProvider.cs

示例14: ResolveLink

        public string ResolveLink(string componentUri)
        {
            TcmUri uri = new TcmUri(componentUri);

            if (!uri.Equals(emptyTcmUri))
            {
                Link link = componentLink.GetLink(uri.ToString());
                return link.IsResolved ? link.Url : null;
            }
    
            return null;
        }
开发者ID:flaithbheartaigh,项目名称:dynamic-delivery-4-tridion,代码行数:12,代码来源:TridionLinkProvider.cs

示例15: IsSiteEditEnabled

 public bool IsSiteEditEnabled(ITridionItemData item)
 {
     int publicationId = 0;
     try
     {
         publicationId = new TcmUri(item.TcmUri).PublicationId;
     }
     catch (Exception)
     {
         publicationId = 0;
     }
     return IsSiteEditEnabled(publicationId);
 }
开发者ID:kpmrafeeq,项目名称:DVM4T,代码行数:13,代码来源:XpmMarkupService.cs


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