protected static void AddPropertiesForRepositoryLocalObject(RepositoryLocalObjectData rlo, PeekResult result, string currentUserId) { if (rlo == null) { return; } result.LockedBy = LinkEntry.From(rlo.LockInfo.LockUser, Resources.LabelLockedBy, currentUserId); result.MetadataSchema = LinkEntry.From(rlo.MetadataSchema, Resources.LabelMetadataSchema, currentUserId); if (rlo.LocationInfo != null) { result.WebDavUrl = TextEntry.From(rlo.LocationInfo.WebDavUrl, Resources.LabelWebDavUrl); } FullVersionInfo versionInfo = rlo.VersionInfo as FullVersionInfo; if (versionInfo != null) { if (result.CreationDate != null) { result.CreationDate.User = GetUserTitle(versionInfo.Creator, currentUserId); } if (result.RevisionDate != null) { result.RevisionDate.User = GetUserTitle(versionInfo.Revisor, currentUserId); } if (versionInfo.LastVersion != null && versionInfo.LastVersion.Value > 1) { result.Versions = NumberEntry.From(versionInfo.LastVersion.Value, Resources.LabelVersions); } } }
protected static void AddPropertiesForRepositoryLocalObject(RepositoryLocalObjectData rlo, PeekResult result, string currentUserId) { if (rlo == null) return; result.LockedBy = LinkEntry.From(rlo.LockInfo.LockUser, Resources.LabelLockedBy, currentUserId); result.MetadataSchema = LinkEntry.From(rlo.MetadataSchema, Resources.LabelMetadataSchema, currentUserId); if (rlo.LocationInfo != null) { result.WebDavUrl = TextEntry.From(rlo.LocationInfo.WebDavUrl, Resources.LabelWebDavUrl); } FullVersionInfo versionInfo = rlo.VersionInfo as FullVersionInfo; if (versionInfo != null) { if (result.CreationDate != null) { result.CreationDate.User = GetUserTitle(versionInfo.Creator, currentUserId); } if (result.RevisionDate != null) { result.RevisionDate.User = GetUserTitle(versionInfo.Revisor, currentUserId); } if (versionInfo.LastVersion != null && versionInfo.LastVersion.Value > 1) { result.Versions = NumberEntry.From(versionInfo.LastVersion.Value, Resources.LabelVersions); } } }
/// <summary> /// Initializes a new instance of the <see cref="RepositoryLocalObject"/> class. /// </summary> /// <param name="client"><see cref="TcmCoreService.Client" /></param> /// <param name="repositoryLocalObjectData"><see cref="T:Tridion.ContentManager.CoreService.Client.RepositoryLocalObjectData" /></param> protected RepositoryLocalObject(Client client, RepositoryLocalObjectData repositoryLocalObjectData) : base(client, repositoryLocalObjectData) { if (repositoryLocalObjectData == null) throw new ArgumentNullException("repositoryLocalObjectData"); mRepositoryLocalObjectData = repositoryLocalObjectData; }
/// <summary> /// Initializes a new instance of the <see cref="RepositoryLocalObject"/> class. /// </summary> /// <param name="client"><see cref="TcmCoreService.Client" /></param> /// <param name="repositoryLocalObjectData"><see cref="T:Tridion.ContentManager.CoreService.Client.RepositoryLocalObjectData" /></param> protected RepositoryLocalObject(Client client, RepositoryLocalObjectData repositoryLocalObjectData) : base(client, repositoryLocalObjectData) { if (repositoryLocalObjectData == null) { throw new ArgumentNullException("repositoryLocalObjectData"); } mRepositoryLocalObjectData = repositoryLocalObjectData; }
/// <summary> /// Gets tcm id of first localized or original item up the blue print. /// </summary> /// <param name="dataItem">Tridion item.</param> /// <returns></returns> public static string GetBluePrintLocalizedTcmId(RepositoryLocalObjectData dataItem) { if (dataItem.BluePrintInfo.OwningRepository == null) { return(dataItem.Id); } string localizedPublication = dataItem.BluePrintInfo.OwningRepository.IdRef; return(TextHelper.GetBluePrintItemTcmId(dataItem.Id, localizedPublication)); }
private void Localize(SessionAwareCoreServiceClient tridionClient, string objectID) { /* this is just the basic code */ RepositoryLocalObjectData item = (RepositoryLocalObjectData)tridionClient.Read(objectID, new ReadOptions()); // if object is localized already, return if ((bool)item.BluePrintInfo.IsLocalized) { return; } tridionClient.Localize(objectID, new ReadOptions()); }
/// <summary> /// Reload the <see cref="RepositoryLocalObject" /> with the specified <see cref="T:Tridion.ContentManager.CoreService.Client.RepositoryLocalObjectData" /> /// </summary> /// <param name="repositoryLocalObjectData"><see cref="T:Tridion.ContentManager.CoreService.Client.RepositoryLocalObjectData" /></param> protected void Reload(RepositoryLocalObjectData repositoryLocalObjectData) { if (repositoryLocalObjectData == null) { throw new ArgumentNullException("repositoryLocalObjectData"); } mRepositoryLocalObjectData = repositoryLocalObjectData; base.Reload(repositoryLocalObjectData); mLocation = null; mLockInfo = null; mBluePrint = null; mMetadataSchema = null; mCreator = null; }
/// <summary> /// Gets the web dav of Tridion item. /// </summary> /// <param name="item">Tridion item.</param> /// <returns></returns> public static string GetWebDav(this RepositoryLocalObjectData item) { if (item.LocationInfo == null || string.IsNullOrEmpty(item.LocationInfo.WebDavUrl)) { return(string.Empty); } string webDav = HttpUtility.UrlDecode(item.LocationInfo.WebDavUrl.Replace("/webdav/", string.Empty)); if (string.IsNullOrEmpty(webDav)) { return(string.Empty); } int dotIndex = webDav.LastIndexOf(".", StringComparison.Ordinal); int slashIndex = webDav.LastIndexOf("/", StringComparison.Ordinal); return(dotIndex >= 0 && dotIndex > slashIndex?webDav.Substring(0, dotIndex) : webDav); }
/// <summary> /// To the item. /// </summary> /// <param name="dataItem">Tridion item.</param> /// <returns></returns> public static ItemInfo ToItem(this RepositoryLocalObjectData dataItem) { ItemInfo item = new ItemInfo(); item.TcmId = dataItem.Id; item.ItemType = GetItemType(dataItem.Id); item.Title = dataItem.Title; string webDav = dataItem.GetWebDav(); item.Path = string.IsNullOrEmpty(webDav) ? string.Empty : webDav.Substring(0, webDav.LastIndexOf('/')).Replace('/', '\\'); item.Modified = dataItem.VersionInfo != null ? dataItem.VersionInfo.RevisionDate : null; if (dataItem.IsPublishedInContext != null) { item.IsPublished = dataItem.IsPublishedInContext.Value; } item.Icon = "T" + (int)item.ItemType + "L0P" + (item.IsPublished ? "1" : "0"); if (item.ItemType == ItemType.Component) { ComponentData componentDataItem = (ComponentData)dataItem; if (componentDataItem.ComponentType == ComponentType.Multimedia) { item.MimeType = componentDataItem.BinaryContent.MimeType; if (componentDataItem.BinaryContent.Filename != null) { string ext = Path.GetExtension(componentDataItem.BinaryContent.Filename); item.Icon += "M" + ext.Trim('.'); } } } return(item); }
public static TcmFields ForMetadataOf(SchemaFieldsData _data, RepositoryLocalObjectData _item) { return(new TcmFields(_data, _data.MetadataFields, _item.Metadata, "Metadata")); }
/// <summary> /// Reload the <see cref="RepositoryLocalObject" /> with the specified <see cref="T:Tridion.ContentManager.CoreService.Client.RepositoryLocalObjectData" /> /// </summary> /// <param name="repositoryLocalObjectData"><see cref="T:Tridion.ContentManager.CoreService.Client.RepositoryLocalObjectData" /></param> protected void Reload(RepositoryLocalObjectData repositoryLocalObjectData) { if (repositoryLocalObjectData == null) throw new ArgumentNullException("repositoryLocalObjectData"); mRepositoryLocalObjectData = repositoryLocalObjectData; base.Reload(repositoryLocalObjectData); mLocation = null; mLockInfo = null; mBluePrint = null; mMetadataSchema = null; mCreator = null; }
public static Fields ForMetadataOf(SchemaFieldsData data, RepositoryLocalObjectData item) { return(new Fields(data, data.MetadataFields, item.Metadata, "Metadata")); }