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); } } }
public static PageResult From(PageData item, ISessionAwareCoreService client, string currentUserId) { var template = (PageTemplateData)client.Read(item.PageTemplate.IdRef, new ReadOptions()); string extension = template.FileExtension; var result = new PageResult { Template = LinkEntry.From(item.PageTemplate, Resources.LabelTemplate, currentUserId), FileName = TextEntry.From(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", item.FileName, extension), Resources.LabelFileName), }; if (result.FileName != null) { result.PathOnWebsite = GetPublishPath(item.LocationInfo as PublishLocationInfo, result.FileName.Value); } string componentPresentations = Resources.None; if (item.ComponentPresentations.Any()) { int count = item.ComponentPresentations.Count(); int templateCount = item.ComponentPresentations.DistinctBy(cp => cp.ComponentTemplate.IdRef).Count(); componentPresentations = (templateCount == 1) ? string.Format(CultureInfo.InvariantCulture, Resources.ComponentPresentationSummarySameTemplate, count) : string.Format(CultureInfo.InvariantCulture, Resources.ComponentPresentationSummary, count, templateCount); } result.ComponentPresentations = TextEntry.From(componentPresentations, Resources.LabelComponentPresentations); AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }
public static FolderResult From(FolderData item, string currentUserId) { var result = new FolderResult { LinkedSchema = LinkEntry.From(item.LinkedSchema, Resources.LabelLinkedSchema, currentUserId) }; AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }
public static TemplateBuildingBlockResult From(TemplateBuildingBlockData item, ISessionAwareCoreService client, string currentUserId) { var result = new TemplateBuildingBlockResult { ParametersSchema = LinkEntry.From(item.ParameterSchema, Resources.LabelParametersSchema, currentUserId), MetadataSchema = LinkEntry.From(item.MetadataSchema, Resources.LabelMetadataSchema, currentUserId), TemplateType = TextEntry.From(LookUpTemplateType(item.TemplateType, ItemType.TemplateBuildingBlock, client), Resources.LabelTemplateType) }; AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }
public static TargetGroupResult From(TargetGroupData item, string currentUserId) { int count = item.Conditions.Count(); var result = new TargetGroupResult { Description = TextEntry.From(item.Description, Resources.LabelDescription), MetadataSchema = LinkEntry.From(item.MetadataSchema, Resources.LabelMetadataSchema, currentUserId), Conditions = TextEntry.From(count > 0 ? count.ToString(CultureInfo.InvariantCulture) : Resources.None, Resources.LabelConditions) }; AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }
public static ComponentResult From(ComponentData item, string currentUserId) { var result = new ComponentResult { Schema = LinkEntry.From(item.Schema, Resources.LabelSchema, currentUserId) }; if (item.ComponentType == ComponentType.Multimedia) { if (item.BinaryContent.FileSize != null) { result.FileSize = TextEntry.From(FormatFileSize((long)item.BinaryContent.FileSize), Resources.LabelFileSize); } result.FileName = TextEntry.From(item.BinaryContent.Filename, Resources.LabelFileName); } AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }
public static StructureGroupResult From(StructureGroupData item, string currentUserId) { var result = new StructureGroupResult { Directory = TextEntry.From(string.IsNullOrWhiteSpace(item.Directory) ? Resources.EmptyLabel : item.Directory, Resources.LabelDirectory), Template = LinkEntry.From(item.DefaultPageTemplate, Resources.LabelTemplate, currentUserId), PathOnWebsite = GetPublishPath(item.LocationInfo as PublishLocationInfo, item.Directory) }; if (item.IsActiveResolvedValue == false) { string publishable = Resources.CannotBePublished; if (item.IsActive == true) { publishable = Resources.CannotBePublishedDueToAncestor; } result.Publishable = TextEntry.From(publishable, Resources.LabelPublishable); } AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }
public static CategoryResult From(CategoryData item, ISessionAwareCoreService client, string currentUserId) { var result = new CategoryResult { Description = TextEntry.From(item.Description, Resources.LabelDescription), XmlName = TextEntry.From(item.XmlName, Resources.LabelXmlName) }; if (item.UseForNavigation == false) { result.Publishable = TextEntry.From(Resources.CannotBePublished, Resources.LabelPublishable); } if (item.UseForIdentification == true) { result.UseForIdentification = TextEntry.From(Resources.Yes, Resources.LabelUseForIdentification); } result.LinkedSchema = LinkEntry.From(item.KeywordMetadataSchema, Resources.LabelLinkedSchema, currentUserId); AddCommonProperties(item, result); AddPropertiesForRepositoryLocalObject(item, result, currentUserId); return(result); }