public PageTypePropertyDefinition(string name, Type propertyType, IPageType pageType, PageTypePropertyAttribute pageTypePropertyAttribute) { Name = name; PropertyType = propertyType; PageType = pageType; PageTypePropertyAttribute = pageTypePropertyAttribute; }
private void editCodeActivity_ValidateBindings(object sender, ConditionalEventArgs e) { IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data; List <Guid> selectedPageTemplateIds = this.GetBinding <List <Guid> >("TemplateRestrictionSelected"); List <Guid> selectedPageTypeParentRestrictions = this.GetBinding <List <Guid> >("PageTypeChildRestrictionSelected"); if (pageType.DefaultTemplateId != Guid.Empty && selectedPageTemplateIds.Count > 0 && !selectedPageTemplateIds.Contains(pageType.DefaultTemplateId)) { this.ShowFieldMessage("DefaultTemplateSelected", Texts.PageType_EditPageTypeWorkflow_ValidationError_DefaultTemplateNotInRestrictions); SetSaveStatus(false); e.Result = false; return; } if (pageType.HomepageRelation == nameof(PageTypeHomepageRelation.OnlyHomePages) && selectedPageTypeParentRestrictions.Count > 0) { this.ShowFieldMessage("PageType.HomepageRelation", Texts.PageType_EditPageTypeWorkflow_ValidationError_HomepageRelationConflictsWithParentRestrictions); SetSaveStatus(false); e.Result = false; return; } e.Result = true; }
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); } }
private void UpdatePageTypeTreeLinks(IPageType pageType) { List <string> selectedTreeIds = this.GetBinding <List <string> >("ApplicationSelected"); var pageTypeTreeLinks = DataFacade.GetData <IPageTypeTreeLink>() .Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypeTreeLink treeLink in pageTypeTreeLinks) { if (!selectedTreeIds.Contains(treeLink.TreeId)) { DataFacade.Delete <IPageTypeTreeLink>(treeLink); } } // Add newly selected foreach (string treeId in selectedTreeIds) { if (!pageTypeTreeLinks.Any(f => f.TreeId == treeId)) { IPageTypeTreeLink pageTypeTreeLink = DataFacade.BuildNew <IPageTypeTreeLink>(); pageTypeTreeLink.Id = Guid.NewGuid(); pageTypeTreeLink.PageTypeId = pageType.Id; pageTypeTreeLink.TreeId = treeId; DataFacade.AddNew <IPageTypeTreeLink>(pageTypeTreeLink); } } }
private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e) { IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>("NewMetaDataTypeLink"); IData newDataTemplate; this.TryGetBinding("NewDataTemplate", out newDataTemplate); string metaDataDefinitionName = this.GetBinding<string>("CompositionDescriptionName"); pageTypeMetaDataTypeLink.Name = metaDataDefinitionName; using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope()) { DataFacade.AddNew<IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink); PageMetaDataFacade.AddDefinition( pageTypeMetaDataTypeLink.PageTypeId, metaDataDefinitionName, this.GetBinding<string>("CompositionDescriptionLabel"), pageTypeMetaDataTypeLink.DataTypeId, this.GetBinding<Guid>("CompositionContainerId") ); if (newDataTemplate != null) { IPageType pageType = DataFacade.GetData<IPageType>().Single(f => f.Id == pageTypeMetaDataTypeLink.PageTypeId); PageMetaDataFacade.AddNewMetaDataToExistingPages(pageType, metaDataDefinitionName, newDataTemplate); } transactionScope.Complete(); } this.RefreshCurrentEntityToken(); }
private FakePageType GetPageTypeToReturn(IPageType pageTypeRecord) { var pageTypeToReturn = new FakePageType(pageDefinitionRepository); Mapper.Map(pageTypeRecord, pageTypeToReturn); return(pageTypeToReturn); }
protected internal virtual void UpdatePageTypePropertyDefinitions(IPageType pageType, PageTypeDefinition pageTypeDefinition) { IEnumerable<PageTypePropertyDefinition> definitions = pageTypePropertyDefinitionLocator.GetPageTypePropertyDefinitions(pageType, pageTypeDefinition.Type); foreach (PageTypePropertyDefinition propertyDefinition in definitions) { PageDefinition pageDefinition = GetExistingPageDefinition(pageType, propertyDefinition); if (pageDefinition == null) { using (new TimingsLogger(string.Format("Creating new page definition '{0}' for page type {1}: ", propertyDefinition.Name, pageType.Name))) { pageDefinitionUpdater.CreateNewPageDefinition(propertyDefinition); pageDefinition = GetExistingPageDefinition(pageType, propertyDefinition); } } else { pageDefinitionUpdater.UpdateExistingPageDefinition(pageDefinition, propertyDefinition); } pageDefinitionSpecificPropertySettingsUpdater.UpdatePropertySettings(pageTypeDefinition, propertyDefinition, pageDefinition); } }
public PageTypeAction( IPageType pageType, IMigrationContext context) { this.pageType = pageType; this.context = context; }
private void UpdatePageTypeDataFolderTypeLinks(IPageType pageType) { List <Guid> selectedDataFolderTypeIds = this.GetBinding <List <Guid> >("DataFolderSelected"); var pageTypeDateFolderTypeLinks = DataFacade.GetData <IPageTypeDataFolderTypeLink>() .Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypeDataFolderTypeLink dataFolderTypeLink in pageTypeDateFolderTypeLinks) { if (!selectedDataFolderTypeIds.Contains(dataFolderTypeLink.DataTypeId)) { DataFacade.Delete(dataFolderTypeLink); } } // Add newly selected foreach (Guid dataFolderTypeId in selectedDataFolderTypeIds) { if (!pageTypeDateFolderTypeLinks.Any(f => f.DataTypeId == dataFolderTypeId)) { IPageTypeDataFolderTypeLink pageTypeDateFolderTypeLink = DataFacade.BuildNew <IPageTypeDataFolderTypeLink>(); pageTypeDateFolderTypeLink.Id = Guid.NewGuid(); pageTypeDateFolderTypeLink.PageTypeId = pageType.Id; pageTypeDateFolderTypeLink.DataTypeId = dataFolderTypeId; DataFacade.AddNew(pageTypeDateFolderTypeLink); } } }
private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e) { using (var transactionScope = TransactionsFacade.CreateNewScope()) { var args = new ConditionalEventArgs(); editCodeActivity_ValidateBindings(this, args); if (!args.Result) { return; } IPageType pageType = this.GetBinding <IPageType>("PageType"); UpdatePageTemplateResctrictions(pageType); UpdatePageTypeParentResctrictions(pageType); UpdatePageTypeDataFolderTypeLinks(pageType); UpdatePageTypeTreeLinks(pageType); DataFacade.Update(pageType); transactionScope.Complete(); } this.RefreshParentEntityToken(); SetSaveStatus(true); }
protected internal virtual void UpdateFrame(IPageType pageType, PageTypeAttribute attribute) { if (attribute.DefaultFrameID != 0) { pageType.DefaultFrameID = attribute.DefaultFrameID; } }
private void UpdatePageTypeParentResctrictions(IPageType pageType) { List <Guid> selectedPageTypeParentRestrictions = this.GetBinding <List <Guid> >("PageTypeChildRestrictionSelected"); var pageTypeParentRestrictions = DataFacade.GetData <IPageTypeParentRestriction>() .Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypeParentRestriction restriction in pageTypeParentRestrictions) { if (!selectedPageTypeParentRestrictions.Contains(restriction.AllowedParentPageTypeId)) { DataFacade.Delete(restriction); } } // Add newly selected foreach (Guid templateId in selectedPageTypeParentRestrictions) { if (!pageTypeParentRestrictions.Any(f => f.AllowedParentPageTypeId == templateId)) { var pageTypeParentRestriction = DataFacade.BuildNew <IPageTypeParentRestriction>(); pageTypeParentRestriction.Id = Guid.NewGuid(); pageTypeParentRestriction.PageTypeId = pageType.Id; pageTypeParentRestriction.AllowedParentPageTypeId = templateId; DataFacade.AddNew(pageTypeParentRestriction); } } }
private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e) { IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = DataFacade.BuildNew<IPageTypeMetaDataTypeLink>(); pageTypeMetaDataTypeLink.Id = Guid.NewGuid(); Dictionary<string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload); DataEntityToken dataEntityToken = piggybag.GetParentEntityTokens().FindDataEntityToken(typeof(IPageType)); IPageType parentPageType = (IPageType)dataEntityToken.Data; pageTypeMetaDataTypeLink.PageTypeId = parentPageType.Id; this.Bindings.Add("CompositionDescriptionName", ""); this.Bindings.Add("CompositionDescriptionLabel", ""); this.Bindings.Add("NewMetaDataTypeLink", pageTypeMetaDataTypeLink); List<KeyValuePair<Guid, string>> metaDataTypeOptions = PageMetaDataFacade.GetAllMetaDataTypes(). ToList(f => new KeyValuePair<Guid, string>(f.GetImmutableTypeId(), f.GetTypeTitle())); this.Bindings.Add("MetaDataTypeOptions", metaDataTypeOptions); List<KeyValuePair<Guid, string>> metaDataContainerOptions = PageMetaDataFacade.GetAllMetaDataContainers(); this.Bindings.Add("MetaDataContainerOptions", metaDataContainerOptions); this.Bindings.Add("CompositionContainerId", metaDataContainerOptions.First().Key); this.BindingsValidationRules.Add("CompositionDescriptionName", new List<ClientValidationRule> { new NotNullClientValidationRule(), new StringLengthClientValidationRule(1, 128) }); this.BindingsValidationRules.Add("CompositionDescriptionLabel", new List<ClientValidationRule> { new NotNullClientValidationRule(), new StringLengthClientValidationRule(1, 256) }); }
private void UpdatePageTemplateResctrictions(IPageType pageType) { List <Guid> selectedPageTemplateIds = this.GetBinding <List <Guid> >("TemplateRestrictionSelected"); IEnumerable <IPageTypePageTemplateRestriction> pageTypePageTemplateRestrictions = DataFacade.GetData <IPageTypePageTemplateRestriction>().Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypePageTemplateRestriction restriction in pageTypePageTemplateRestrictions) { if (selectedPageTemplateIds.Contains(restriction.PageTemplateId) == false) { DataFacade.Delete <IPageTypePageTemplateRestriction>(restriction); } } // Add newly selected foreach (Guid templateId in selectedPageTemplateIds) { if (pageTypePageTemplateRestrictions.Where(f => f.PageTemplateId == templateId).Any() == false) { IPageTypePageTemplateRestriction pageTypePageTemplateRestriction = DataFacade.BuildNew <IPageTypePageTemplateRestriction>(); pageTypePageTemplateRestriction.Id = Guid.NewGuid(); pageTypePageTemplateRestriction.PageTypeId = pageType.Id; pageTypePageTemplateRestriction.PageTemplateId = templateId; DataFacade.AddNew <IPageTypePageTemplateRestriction>(pageTypePageTemplateRestriction); } } }
private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e) { IPageTypeDefaultPageContent defaultPageContent = this.GetBinding <IPageTypeDefaultPageContent>("DefaultPageContent"); Dictionary <string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload); DataEntityToken dataEntityToken = piggybag.GetParentEntityTokens().FindDataEntityToken(typeof(IPageType)); IPageType parentPageType = (IPageType)dataEntityToken.Data; defaultPageContent.PageTypeId = parentPageType.Id; defaultPageContent.Content = " "; defaultPageContent = DataFacade.AddNew <IPageTypeDefaultPageContent>(defaultPageContent); this.CloseCurrentView(); this.RefreshCurrentEntityToken(); if (!AnyTemplatesContainingPlaceholderId()) { ShowMessage(C1Console.Events.DialogType.Message, string.Format(RS.GetString("Composite.Plugins.PageTypeElementProvider", "PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Title"), defaultPageContent.PlaceHolderId), string.Format(RS.GetString("Composite.Plugins.PageTypeElementProvider", "PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Message"), defaultPageContent.PlaceHolderId)); } this.ExecuteWorklow(defaultPageContent.GetDataEntityToken(), WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider.EditPageTypeDefaultPageContentWorkflow")); }
public void GivenPageTypeWithSpecifiedNameAndNoGuid_GetExistingPageType_ReturnsPageTypeReturnedFromPageTypeFactoryLoad() { MockRepository mockRepository = new MockRepository(); Type pageTypeType = typeof(object); PageTypeDefinition pageTypeDefinition = new PageTypeDefinition { Type = pageTypeType, Attribute = new PageTypeAttribute { Name = Guid.NewGuid().ToString() } }; PageTypeRepository fakePageTypeRepository = mockRepository.Stub <PageTypeRepository>(); IPageType pageTypeFromFactory = new NativePageType(); pageTypeFromFactory.ID = 1; fakePageTypeRepository.Expect(factory => factory.Load(pageTypeDefinition.Attribute.Name)).Return(pageTypeFromFactory); fakePageTypeRepository.Replay(); PageTypeUpdater pageTypeUpdater = PageTypeUpdaterFactory.Create( PageTypeDefinitionLocatorFactory.Stub(), fakePageTypeRepository); IPageType returnedPageType = pageTypeUpdater.GetExistingPageType(pageTypeDefinition); fakePageTypeRepository.AssertWasCalled(factory => factory.Load(pageTypeDefinition.Attribute.Name)); Assert.Equal <int>(pageTypeFromFactory.ID, returnedPageType.ID); }
protected internal virtual IPageType CreateNewPageType(PageTypeDefinition definition) { IPageType pageType = PageTypeRepository.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; PageTypeRepository.Save(pageType); NewlyCreatedPageTypes.Add(pageType); return(pageType); }
protected internal virtual void AddPageTypesToResolver(IEnumerable <PageTypeDefinition> pageTypeDefinitions) { foreach (PageTypeDefinition definition in pageTypeDefinitions) { IPageType pageType = _pageTypeLocator.GetExistingPageType(definition); PageTypeResolver.AddPageType(pageType.ID, definition.Type); } }
protected internal virtual void UpdatePageTypePropertyDefinitions(IEnumerable <PageTypeDefinition> pageTypeDefinitions) { foreach (PageTypeDefinition definition in pageTypeDefinitions) { IPageType pageType = _pageTypeLocator.GetExistingPageType(definition); PageTypePropertyUpdater.UpdatePageTypePropertyDefinitions(pageType, definition); } }
private FakePageType GetPageTypeToReturn(IPageType pageTypeRecord) { var definitions = new PageDefinitionCollection(); definitions.AddRange(pageDefinitionFactory.List(pageTypeRecord.ID)); var pageTypeToReturn = new FakePageType(definitions); Mapper.Map(pageTypeRecord, pageTypeToReturn); return pageTypeToReturn; }
protected internal virtual void UpdateDefaultChildOrderRule(IPageType pageType, PageTypeAttribute attribute) { if (!CanModifyProperty(pageType, attribute.DefaultChildSortOrderSet)) { return; } pageType.DefaultChildOrderRule = attribute.DefaultChildSortOrder; }
protected internal virtual void UpdateDefaultStopPublishOffset(IPageType pageType, PageTypeAttribute attribute) { if (!CanModifyProperty(pageType, attribute.DefaultStopPublishOffsetMinutesSet)) { return; } pageType.DefaultStopPublishOffset = new TimeSpan(0, 0, attribute.DefaultStopPublishOffsetMinutes, 0); }
protected internal virtual void UpdateDefaultPageName(IPageType pageType, PageTypeAttribute attribute) { if (!CanModifyProperty(pageType, attribute.DefaultPageNameSet)) { return; } pageType.DefaultPageName = attribute.DefaultPageName; }
protected internal virtual void UpdateDescription(IPageType pageType, PageTypeAttribute attribute) { if (!CanModifyProperty(pageType, attribute.DescriptionSet)) { return; } pageType.Description = attribute.Description; }
protected internal virtual void UpdateIsAvailable(IPageType pageType, PageTypeAttribute attribute) { if (!CanModifyProperty(pageType, attribute.AvailableInEditModeSet)) { return; } pageType.IsAvailable = attribute.AvailableInEditMode; }
protected internal virtual void UpdateSortOrder(IPageType pageType, PageTypeAttribute attribute) { if (!CanModifyProperty(pageType, attribute.SortOrderSet)) { return; } pageType.SortOrder = attribute.SortOrder; }
public void Delete(IPageType pageType) { if (pageType == null) { throw new ArgumentNullException("pageType"); } var record = pageTypes.Where(p => p.ID == pageType.ID).FirstOrDefault(); pageTypes.Remove(record); }
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); } }
protected internal virtual void UpdateDefaultVisibleInMenu(IPageType pageType, PageTypeAttribute attribute) { if (attribute.DefaultVisibleInMenu != PageTypeAttribute.DefaultDefaultVisibleInMenu) { pageType.DefaultVisibleInMenu = attribute.DefaultVisibleInMenu; } else { pageType.DefaultVisibleInMenu = DefaultDefaultVisibleInMenu; } }
public void GivenDefinitionWithNoSpecifiedName_CreateNewPageType_ReturnsNewPageTypeWithNameSetToTheNameOfTheTypeName() { PageTypeDefinition definition = PageTypeUpdaterTestsUtility.CreateBasicPageTypeDefinition(); PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater(); SetupPageTypeUpdaterWithFakePageTypeFactory(pageTypeUpdater); IPageType returnedPageType = pageTypeUpdater.CreateNewPageType(definition); Assert.Equal(typeof(object).Name, returnedPageType.Name); }
/// <summary> /// Using the given pageType this methods adds meta data instances that are missing /// </summary> /// <param name="definingPageType"></param> /// <param name="metaDataDefinitionName"></param> /// <param name="newDataTemplate"></param> public static void AddNewMetaDataToExistingPages(this IPageType definingPageType, string metaDataDefinitionName, IData newDataTemplate) { IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(definingPageType.Id, metaDataDefinitionName); DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageMetaDataDefinition.MetaDataTypeId); Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName); IEnumerable <IPage> affectedPages = PageMetaDataFacade.GetMetaDataAffectedPagesByPageTypeId(definingPageType.Id); AddNewMetaDataToExistingPages(affectedPages, metaDataDefinitionName, metaDataType, newDataTemplate); }
protected internal virtual void UpdateDefaultPeerOrder(IPageType pageType, PageTypeAttribute attribute) { if (attribute.DefaultSortIndex != PageTypeAttribute.DefaultDefaultSortIndex) { pageType.DefaultPeerOrder = attribute.DefaultSortIndex; } else { pageType.DefaultPeerOrder = DefaultDefaultPageTypePeerOrder; } }
protected internal virtual void UpdatePageTypePropertyDefinitions(IPageType pageType, PageTypeDefinition pageTypeDefinition) { IEnumerable<PageTypePropertyDefinition> definitions = PageTypePropertyDefinitionLocator.GetPageTypePropertyDefinitions(pageType, pageTypeDefinition.Type); foreach (PageTypePropertyDefinition propertyDefinition in definitions) { PageDefinition pageDefinition = GetExistingPageDefinition(pageType, propertyDefinition); if (pageDefinition == null) pageDefinition = CreateNewPageDefinition(propertyDefinition); UpdatePageDefinition(pageDefinition, propertyDefinition); } }
public virtual IEnumerable<PageTypePropertyDefinition> GetPageTypePropertyDefinitions(IPageType pageType, Type pageTypeType) { var properties = pageTypeType.GetAllValidPageTypePropertiesFromClassAndImplementedInterfaces(); List<PageTypePropertyDefinition> pageTypePropertyDefinitions = new List<PageTypePropertyDefinition>(); foreach (PropertyInfo property in properties) { PageTypePropertyAttribute attribute = GetPageTypePropertyAttribute(property); if (attribute == null) continue; pageTypePropertyDefinitions.Add(new PageTypePropertyDefinition(property.Name, property.PropertyType, pageType, attribute)); } return pageTypePropertyDefinitions; }
public void Save(IPageType pageTypeToSave) { if (pageTypeToSave.IsNew) { pageTypeToSave.ID = nextId; nextId++; var pageTypeRecord = new FakePageType(pageDefinitionRepository); Mapper.Map(pageTypeToSave, pageTypeRecord); pageTypes.Add(pageTypeRecord); } else { var pageTypeRecord = pageTypes.FirstOrDefault(pageType => pageType.ID == pageTypeToSave.ID); Mapper.Map(pageTypeToSave, pageTypeRecord); } numberOfSavesPerPageTypeIdCounter.IncrementNumberOfSaves(pageTypeToSave.ID); }
protected internal virtual void UpdatePageTypePropertyDefinitions(IPageType pageType, PageTypeDefinition pageTypeDefinition) { IEnumerable<PageTypePropertyDefinition> definitions = pageTypePropertyDefinitionLocator.GetPageTypePropertyDefinitions(pageType, pageTypeDefinition.Type); foreach (PageTypePropertyDefinition propertyDefinition in definitions) { PageDefinition pageDefinition = GetExistingPageDefinition(pageType, propertyDefinition); if (pageDefinition == null) { pageDefinitionUpdater.CreateNewPageDefinition(propertyDefinition); pageDefinition = GetExistingPageDefinition(pageType, propertyDefinition); } else { pageDefinitionUpdater.UpdateExistingPageDefinition(pageDefinition, propertyDefinition); } pageDefinitionSpecificPropertySettingsUpdater.UpdatePropertySettings(pageTypeDefinition, propertyDefinition, pageDefinition); } }
protected internal virtual void UpdateFilename(IPageType pageType, PageTypeAttribute attribute) { string filename = GetFilename(attribute); pageType.FileName = filename; }
private FakePageType GetPageTypeToReturn(IPageType pageTypeRecord) { var pageTypeToReturn = new FakePageType(pageDefinitionRepository); Mapper.Map(pageTypeRecord, pageTypeToReturn); return pageTypeToReturn; }
protected internal virtual void UpdateDescription(IPageType pageType, PageTypeAttribute attribute) { pageType.Description = attribute.Description; }
private void UpdatePageTypeTreeLinks(IPageType pageType) { List<string> selectedTreeIds = this.GetBinding<List<string>>("ApplicationSelected"); IEnumerable<IPageTypeTreeLink> pageTypeTreeLinks = DataFacade.GetData<IPageTypeTreeLink>().Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypeTreeLink treeLink in pageTypeTreeLinks) { if (selectedTreeIds.Contains(treeLink.TreeId) == false) { DataFacade.Delete<IPageTypeTreeLink>(treeLink); } } // Add newly selected foreach (string treeId in selectedTreeIds) { if (pageTypeTreeLinks.Where(f => f.TreeId == treeId).Any() == false) { IPageTypeTreeLink pageTypeTreeLink = DataFacade.BuildNew<IPageTypeTreeLink>(); pageTypeTreeLink.Id = Guid.NewGuid(); pageTypeTreeLink.PageTypeId = pageType.Id; pageTypeTreeLink.TreeId = treeId; DataFacade.AddNew<IPageTypeTreeLink>(pageTypeTreeLink); } } }
private void UpdatePageTypeParentResctrictions(IPageType pageType) { List<Guid> selectedPageTypeParentRestrictions = this.GetBinding<List<Guid>>("PageTypeChildRestrictionSelected"); IEnumerable<IPageTypeParentRestriction> pageTypeParentRestrictions = DataFacade.GetData<IPageTypeParentRestriction>().Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypeParentRestriction restriction in pageTypeParentRestrictions) { if (selectedPageTypeParentRestrictions.Contains(restriction.AllowedParentPageTypeId) == false) { DataFacade.Delete<IPageTypeParentRestriction>(restriction); } } // Add newly selected foreach (Guid templateId in selectedPageTypeParentRestrictions) { if (pageTypeParentRestrictions.Where(f => f.AllowedParentPageTypeId == templateId).Any() == false) { IPageTypeParentRestriction pageTypeParentRestriction = DataFacade.BuildNew<IPageTypeParentRestriction>(); pageTypeParentRestriction.Id = Guid.NewGuid(); pageTypeParentRestriction.PageTypeId = pageType.Id; pageTypeParentRestriction.AllowedParentPageTypeId = templateId; DataFacade.AddNew<IPageTypeParentRestriction>(pageTypeParentRestriction); } } }
protected internal virtual void UpdateDefaultStopPublishOffset(IPageType pageType, PageTypeAttribute attribute) { pageType.DefaultStopPublishOffset = new TimeSpan(0, 0, attribute.DefaultStopPublishOffsetMinutes, 0); }
protected internal virtual void UpdateDefaultVisibleInMenu(IPageType pageType, PageTypeAttribute attribute) { if (attribute.DefaultVisibleInMenu != PageTypeAttribute.DefaultDefaultVisibleInMenu) pageType.DefaultVisibleInMenu = attribute.DefaultVisibleInMenu; else pageType.DefaultVisibleInMenu = DefaultDefaultVisibleInMenu; }
protected internal virtual void UpdateDefaultPageName(IPageType pageType, PageTypeAttribute attribute) { pageType.DefaultPageName = attribute.DefaultPageName; }
protected internal virtual void UpdateDefaultPeerOrder(IPageType pageType, PageTypeAttribute attribute) { if (attribute.DefaultSortIndex != PageTypeAttribute.DefaultDefaultSortIndex) pageType.DefaultPeerOrder = attribute.DefaultSortIndex; else pageType.DefaultPeerOrder = DefaultDefaultPageTypePeerOrder; }
protected internal virtual void UpdateDefaultChildOrderRule(IPageType pageType, PageTypeAttribute attribute) { pageType.DefaultChildOrderRule = attribute.DefaultChildSortOrder; }
protected internal virtual void UpdateDefaultArchivePageLink(IPageType pageType, PageTypeAttribute attribute) { if(attribute.DefaultArchiveToPageID != PageTypeAttribute.DefaultDefaultArchiveToPageID) pageType.DefaultArchivePageLink = new PageReference(attribute.DefaultArchiveToPageID); else pageType.DefaultArchivePageLink = null; }
protected internal virtual void UpdateIsAvailable(IPageType pageType, PageTypeAttribute attribute) { pageType.IsAvailable = attribute.AvailableInEditMode; }
protected internal virtual PageDefinition GetExistingPageDefinition(IPageType pageType, PageTypePropertyDefinition propertyDefinition) { return pageType.Definitions.FirstOrDefault(definition => definition.Name == propertyDefinition.Name); }
protected internal virtual void UpdateFrame(IPageType pageType, PageTypeAttribute attribute) { if (attribute.DefaultFrameID != 0) pageType.DefaultFrameID = attribute.DefaultFrameID; }
protected internal virtual void UpdateName(IPageType pageType, PageTypeDefinition definition) { pageType.Name = definition.GetPageTypeName(); }
protected internal virtual void UpdateAvailablePageTypes(IPageType pageType, Type[] availablePageTypes) { if(availablePageTypes == null) { pageType.AllowedPageTypes = null; return; } int[] availablePageTypeIDs = new int[availablePageTypes.Length]; for (int i = 0; i < availablePageTypes.Length; i++) { Type availablePageTypeType = availablePageTypes[i]; PageTypeDefinition availablePageTypeDefinition = _pageTypeDefinitions.First( definitions => definitions.Type.GUID == availablePageTypeType.GUID); IPageType availablePageType = GetExistingPageType(availablePageTypeDefinition); availablePageTypeIDs[i] = availablePageType.ID; } pageType.AllowedPageTypes = availablePageTypeIDs; }
private void UpdatePageTypeDataFolderTypeLinks(IPageType pageType) { List<Guid> selectedDataFolderTypeIds = this.GetBinding<List<Guid>>("DataFolderSelected"); IEnumerable<IPageTypeDataFolderTypeLink> pageTypeDateFolderTypeLinks = DataFacade.GetData<IPageTypeDataFolderTypeLink>().Where(f => f.PageTypeId == pageType.Id).Evaluate(); // Remove deselected foreach (IPageTypeDataFolderTypeLink dataFolderTypeLink in pageTypeDateFolderTypeLinks) { if (selectedDataFolderTypeIds.Contains(dataFolderTypeLink.DataTypeId) == false) { DataFacade.Delete<IPageTypeDataFolderTypeLink>(dataFolderTypeLink); } } // Add newly selected foreach (Guid dataFolderTypeId in selectedDataFolderTypeIds) { if (pageTypeDateFolderTypeLinks.Where(f => f.DataTypeId == dataFolderTypeId).Any() == false) { IPageTypeDataFolderTypeLink pageTypeDateFolderTypeLink = DataFacade.BuildNew<IPageTypeDataFolderTypeLink>(); pageTypeDateFolderTypeLink.Id = Guid.NewGuid(); pageTypeDateFolderTypeLink.PageTypeId = pageType.Id; pageTypeDateFolderTypeLink.DataTypeId = dataFolderTypeId; DataFacade.AddNew<IPageTypeDataFolderTypeLink>(pageTypeDateFolderTypeLink); } } }
protected internal virtual string SerializeValues(IPageType pageType) { StringBuilder builder = new StringBuilder(); builder.Append(pageType.Name); builder.Append("|"); builder.Append(_pageTypeValueExtractor.GetFileName(pageType)); builder.Append("|"); builder.Append(pageType.SortOrder); builder.Append("|"); builder.Append(pageType.Description); builder.Append("|"); builder.Append(pageType.IsAvailable); builder.Append("|"); builder.Append(pageType.DefaultArchivePageLink); builder.Append("|"); builder.Append(pageType.DefaultChildOrderRule); builder.Append("|"); builder.Append(pageType.DefaultPageName); builder.Append("|"); builder.Append(pageType.DefaultPeerOrder); builder.Append("|"); builder.Append(pageType.DefaultStartPublishOffset); builder.Append("|"); builder.Append(pageType.DefaultStopPublishOffset); builder.Append("|"); builder.Append(pageType.DefaultVisibleInMenu); builder.Append("|"); builder.Append(_pageTypeValueExtractor.GetDefaultFrameId(pageType)); builder.Append("|"); foreach (int pageTypeID in pageType.AllowedPageTypes.OrderBy(id => id)) { builder.Append(pageTypeID); builder.Append("||"); } return builder.ToString(); }
public virtual void Save(IPageType pageTypeToSave) { pageTypeToSave.Save(); }
public void Delete(IPageType pageType) { if(pageType == null) { throw new ArgumentNullException("pageType"); } var record = pageTypes.Where(p => p.ID == pageType.ID).FirstOrDefault(); pageTypes.Remove(record); }
private IPage CreatePage(IPageType pageType, string pageName) { IPage page = this.CreateContent(pageType, pageName) as IPage; page.Route = "/" + pageName; page.ParentId = null; return page; }
protected internal virtual void UpdateSortOrder(IPageType pageType, PageTypeAttribute attribute) { pageType.SortOrder = attribute.SortOrder; }