Exemplo n.º 1
0
        public static IEnumerable <Node> GetNewItemNodes(GenericContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            return(GetNewItemNodes(content, content.GetAllowedChildTypes().ToArray()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if a content of the given ContentType is allowed under a given parent content
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="contentTypeName"></param>
        /// <returns></returns>
        public static bool CheckAllowedContentType(GenericContent parent, string contentTypeName)
        {
            // check allowed content types
            // true: allowed list is empty, but current user is administrator (if allowed types list is empty: only administrator should upload any type.)
            // true: if this type is allowed
            var cTypes = parent.GetAllowedChildTypes().ToList();

            if ((cTypes.Count == 0 && PortalContext.Current.ArbitraryContentTypeCreationAllowed) || (cTypes.Any(ct => ct.Name == contentTypeName)))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        //public static ServiceAction GetServiceAction(Content context, string backUrl, string methodName, string title, string iconName, int index)
        //{
        //    var act = ActionFramework.GetAction("ServiceAction", context, backUrl, new { path = context.Path }) as ServiceAction;

        //    if (act != null)
        //    {
        //        act.Name = methodName;
        //        act.ServiceName = "ContentStore.mvc";
        //        act.MethodName = methodName;
        //        act.Text = title;
        //        act.Icon = iconName;
        //        act.Index = index;
        //    }

        //    return act;
        //}

        public static IEnumerable <Node> GetNewItemNodes(GenericContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            var types = content.GetAllowedChildTypes();

            if (types is AllContentTypes)
            {
                return(new Node[0]);
            }

            return(GetNewItemNodes(content, types.ToArray()));
        }