コード例 #1
0
        protected internal virtual IPageType CreateNewPageType(PageTypeDefinition definition)
        {
            IPageType pageType = PageTypeFactory.CreateNew();

            PageTypeAttribute attribute = definition.Attribute;

            string name = attribute.Name;

            if (name == null)
            {
                name = definition.Type.Name;
            }
            pageType.Name = name;

            if (definition.Attribute.Guid.HasValue)
            {
                pageType.GUID = definition.Attribute.Guid.Value;
            }

            string filename = attribute.Filename;

            if (string.IsNullOrEmpty(filename))
            {
                filename = DefaultFilename;
            }
            pageType.FileName = filename;

            PageTypeFactory.Save(pageType);

            return(pageType);
        }
コード例 #2
0
        protected internal virtual void UpdatePageType(PageTypeDefinition definition)
        {
            IPageType         pageType       = GetExistingPageType(definition);
            PageTypeAttribute attribute      = definition.Attribute;
            string            oldValueString = SerializeValues(pageType);

            UpdateName(pageType, definition);
            UpdateFilename(pageType, attribute);
            UpdateSortOrder(pageType, attribute);
            UpdateDescription(pageType, attribute);
            UpdateIsAvailable(pageType, attribute);
            UpdateDefaultArchivePageLink(pageType, attribute);
            UpdateDefaultChildOrderRule(pageType, attribute);
            UpdateDefaultPageName(pageType, attribute);
            UpdateDefaultPeerOrder(pageType, attribute);
            UpdateDefaultStartPublishOffset(pageType, attribute);
            UpdateDefaultStopPublishOffset(pageType, attribute);
            UpdateDefaultVisibleInMenu(pageType, attribute);
            UpdateFrame(pageType, attribute);
            UpdateAvailablePageTypes(pageType, attribute.AvailablePageTypes);

            string newValuesString = SerializeValues(pageType);

            if (newValuesString != oldValueString)
            {
                PageTypeFactory.Save(pageType);
            }
        }
コード例 #3
0
 protected internal virtual void SortPageTypesAlphabetically()
 {
     _pageTypeDefinitions = _pageTypeDefinitions.OrderBy(p => p.GetPageTypeName());
     for (int i = 0; i < _pageTypeDefinitions.Count(); i++)
     {
         IPageType pageType = GetExistingPageType(_pageTypeDefinitions.ElementAt(i));
         pageType.SortOrder = i;
         PageTypeFactory.Save(pageType);
     }
 }