Esempio n. 1
0
        private void UpdateRules(FunctionTypeAttribute functionTypeAttribute, WrappedPageType functionType)
        {
            RulesTimer.Start();

            int functionTypeID = functionType.ID;

            var filteredPageTypes   = _pageTypes;
            var filteredContetTypes = _contentTypes;

            if (functionTypeAttribute.AvailableOnPages == AvailableOn.Specific)
            {
                filteredPageTypes = PageTypeHelper.GetPageTypes(functionTypeAttribute.AvailableOnPageTypes);
            }

            if (functionTypeAttribute.AvailableOnContent == AvailableOn.Specific)
            {
                filteredContetTypes = PageTypeHelper.GetFunctionPageTypes(functionTypeAttribute.AvailableOnContentTypes);
            }

            var rules = new List <TypeIdContentAreaId>();

            foreach (var pageType in filteredPageTypes)
            {
                var realPageType = PageType.Load(pageType.ID);
                if (realPageType == null)
                {
                    continue;
                }
                var pageAreas = ContentAreaManager.GetAvailableContentAreasViaProperty(realPageType);

                foreach (var pageArea in pageAreas)
                {
                    rules.Add(new TypeIdContentAreaId(pageType.ID, pageArea.ID));
                }
            }

            foreach (var contentType in filteredContetTypes)
            {
                if (contentType.ID == functionTypeID)
                {
                    continue;
                }

                List <ContentAreaData> contentAreas = ContentAreaManager.GetAvailableContentAreasViaProperty(contentType.ID);

                foreach (var contentArea in contentAreas)
                {
                    rules.Add(new TypeIdContentAreaId(contentType.ID, contentArea.ID));
                }
            }

            SyncRules(functionTypeID, rules);

            RulesTimer.Stop();
        }
Esempio n. 2
0
        private void UpdateRules(FunctionTypeAttribute functionTypeAttribute, PageType functionType)
        {
            int functionTypeID = functionType.ID;

            RuleContentAreaCollection ruleCaCollection = RuleContentAreaManager.XMLRuleContentAreaList();

            ruleCaCollection.RemoveRuleContentFunction(functionTypeID);

            var filteredPageTypes   = _pageTypes;
            var filteredContetTypes = _contentTypes;

            if (functionTypeAttribute.AvailableOnPages == AvailableOn.Specific)
            {
                filteredPageTypes = PageTypeHelper.GetPageTypes(functionTypeAttribute.AvailableOnPageTypes);
            }

            if (functionTypeAttribute.AvailableOnContent == AvailableOn.Specific)
            {
                filteredContetTypes = PageTypeHelper.GetFunctionPageTypes(functionTypeAttribute.AvailableOnContentTypes);
            }

            foreach (var pageType in filteredPageTypes)
            {
                List <ContentAreaData> pageAreas = ContentAreaManager.GetAvailableContentAreasViaProperty(pageType);

                foreach (var pageArea in pageAreas)
                {
                    ruleCaCollection.AddRule(pageType.ID, pageArea.ID, functionTypeID);
                }
            }

            foreach (var contentType in filteredContetTypes)
            {
                if (contentType.ID == functionTypeID)
                {
                    continue;
                }

                List <ContentAreaData> contentAreas = ContentAreaManager.GetAvailableContentAreasViaProperty(contentType.ID);

                foreach (var contentArea in contentAreas)
                {
                    ruleCaCollection.AddRule(contentType.ID, contentArea.ID, functionTypeID);
                }
            }

            RuleContentAreaManager.SaveRuleContentAreaCollection(ruleCaCollection);
        }
Esempio n. 3
0
        public static void SetDefaultRulePageType(int pageTypeID)
        {
            RuleContentAreaCollection ruleCaCollection = RuleContentAreaManager.XMLRuleContentAreaList();
            PageType pageType = PageType.Load(pageTypeID);

            if (pageType != null)
            {
                List <ContentAreaData>      availableContentAreasViaProperty = ContentAreaManager.GetAvailableContentAreasViaProperty(pageType);
                IList <ContentFunctionType> list2 = ContentFunctionTypeManager.List();
                foreach (ContentAreaData data in availableContentAreasViaProperty)
                {
                    ruleCaCollection.RemoveRuleContentArea(pageType.ID, data.ID);
                    foreach (ContentFunctionType type2 in list2)
                    {
                        ruleCaCollection.AddRule(pageTypeID, data.ID, type2.FunctionTypeID);
                    }
                }
                RuleContentAreaManager.SaveRuleContentAreaCollection(ruleCaCollection);
            }
        }