Beispiel #1
0
        /// <summary>
        /// Whether a container can have a version in this system
        /// </summary>
        /// <param name="container">The container object</param>
        /// <returns>True if it can be versioned</returns>
        public virtual bool Versionable(object container)
        {
            Type contentType        = Collator.GetContentType(container);
            bool contentVersionable = this.IsVersionable == null || this.IsVersionable(contentType);

            if (!contentVersionable || ContentTypeHierarchy.ExcludeFromVersioning.Contains(contentType))
            {
                return(false);
            }
            return(Versionable(container.GetType()));
        }
Beispiel #2
0
        /// <summary>
        /// Get the url(s) of a container or content item with option to process through
        /// processes registered to GenerateUrl event
        /// </summary>
        /// <param name="o">container or content item</param>
        /// <param name="transform">whether to process through GenerateUrl event</param>
        /// <returns>All the possible urls</returns>
        public IEnumerable <string> GetUrls(object o, bool transform)
        {
            Type type = Collator.GetContentType(o);

            ICollator collator = Collator.Instance.Registered(type);
            var       address  = collator.GetAddress(o);

            var urls = GetUrls(address);

            if (transform)
            {
                var         container = Collator.Instance.GetContainer(o);
                ItemVersion iv        = new ItemVersion(container);
                urls = urls.Select(url => transform ? UrlTransform(url, iv) : url);
            }

            return(urls);
        }
Beispiel #3
0
        /// <summary>
        /// Whether a container can have a version in this system
        /// </summary>
        /// <param name="container">The container object</param>
        /// <returns>True if it can be versioned</returns>
        public virtual bool Versionable(object container)
        {
            bool contentVersionable = this.IsVersionable == null || this.IsVersionable(Collator.GetContentType(container));

            return(Versionable(container.GetType()) && contentVersionable);
        }