/// <summary>
 /// Overrides editor shown when part is attached to content type. Enables adding setting field to the content part
 /// attached.
 /// </summary>
 /// <param name="definition"></param>
 /// <returns></returns>
 public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
 {
     if (definition.PartDefinition.Name != "CreateNotificationPart")
         yield break;
     var model = definition.Settings.GetModel<CreateNotificationTypePartSettings>();
     yield return DefinitionTemplate(model);
 }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "ContainerPart")
                yield break;

            var model = definition.Settings.GetModel<ContainerTypePartSettings>();
            var partModel = definition.PartDefinition.Settings.GetModel<ContainerPartSettings>();
            
            if (model.ItemsShownDefault == null)
                model.ItemsShownDefault = partModel.ItemsShownDefault;

            if (model.PageSizeDefault == null)
                model.PageSizeDefault = partModel.PageSizeDefault;

            if (model.PaginatedDefault == null)
                model.PaginatedDefault = partModel.PaginatedDefault;

            var viewModel = new ContainerTypePartSettingsViewModel {
                ItemsShownDefault = model.ItemsShownDefault,
                PageSizeDefault = model.PageSizeDefault,
                PaginatedDefault = model.PaginatedDefault,
                RestrictedItemContentTypes = _contentDefinitionManager.ParseContentTypeDefinitions(model.RestrictedItemContentTypes).Select(x => x.Name).ToList(),
                RestrictItemContentTypes = model.RestrictItemContentTypes,
                EnablePositioning = model.EnablePositioning,
                AdminListViewName = model.AdminListViewName,
                AvailableItemContentTypes = _containerService.GetContainableTypes().ToList(),
                ListViewProviders = _listViewService.Providers.ToList()
            };

            yield return DefinitionTemplate(viewModel);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != typeof (TermPart).Name) yield break;

            var settings = definition.Settings.GetModel<ExtraTermPartSettings>();

            yield return DefinitionTemplate(settings);
        }
 public EditTypePartViewModel(int index, ContentTypePartDefinition part) {
     Index = index;
     PartDefinition = new EditPartViewModel(part.PartDefinition);
     Settings = part.Settings;
     PartSettings = part.PartDefinition.Settings;
     _Definition = part;
 }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "AssociativyTagNodesPart")
                yield break;

            yield return DefinitionTemplate(definition.Settings.GetModel<AssociativyTagNodesTypePartSettings>());
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "AuditTrailPart")
                yield break;

            var settings = definition.Settings.GetModel<AuditTrailPartSettings>();
            yield return DefinitionTemplate(settings);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != typeof (AuthorablePart).Name) yield break;

            var model = definition.Settings.GetModel<AuthorablePartSettings>();

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "RelatedContentPart") yield break;
            var settings = definition.Settings.GetModel<RelatedContentRelationshipSettings>();
            var model = GetModel(settings);

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "AdminMenuPart") {
                yield break;
            }

            var model = definition.Settings.GetModel<AdminMenuPartTypeSettings>();

            yield return DefinitionTemplate(model);
        }
 public Task BuildTypePartEditorAsync(ContentTypePartDefinition model, BuildEditorContext context)
 {
     return _typePartDisplayDrivers.InvokeAsync(async contentDisplay =>
     {
         var result = await contentDisplay.BuildEditorAsync(model, context);
         if (result != null)
             result.Apply(context);
     }, Logger);
 }
        public ContentPartDefinitionModel(ContentTypePartDefinition typePartDefinition) {
            Fields = new List<ContentFieldDefinitionModel>();
            Settings = new Dictionary<string, string>(typePartDefinition.Settings);
            Name = typePartDefinition.PartDefinition.Name;

            foreach (var field in typePartDefinition.PartDefinition.Fields) {
                Fields.Add(new ContentFieldDefinitionModel(field));
            }
        }
        public override IDisplayResult Edit(ContentTypePartDefinition model, IUpdateModel updater)
        {
            if (!String.Equals("BodyPart", model.PartDefinition.Name, StringComparison.Ordinal))
            {
                return null;
            }

            return Shape("BodyPartSettings_Edit", new { ContentPart = model }).Location("Content");
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != typeof (ProductPart).Name)
                yield break;

            var settings = definition.Settings.GetModel<ProductPartSettings>();

            var categories = _productService.GetTermCategories();
            settings.Categories = categories;
            yield return DefinitionTemplate(settings);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "AssociativyNodeLabelPart")
                yield break;

            var model = definition.Settings.GetModel<AssociativyNodeLabelTypePartSettings>();
            model.ContentType = _contentType;

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "AssociativyGraphLinksPart")
                yield break;

            var settings = definition.Settings.GetModel<AssociativyGraphLinksTypePartSettings>();
            settings.AllFrontendEngines = _engineManager.GetEngines();

            yield return DefinitionTemplate(settings);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "AutoroutePart")
                yield break;

            var settings = definition.Settings.GetModel<AutorouteSettings>();

            // add an empty pattern for the editor
            settings.Patterns.Add(new RoutePattern());

            yield return DefinitionTemplate(settings);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "ShapePart")
                yield break;

            var settings = definition.Settings.GetModel<ShapePartSettings>();
            var model = new ShapePartSettingsViewModel {
                Processor = settings.Processor,
                AvailableProcessors = _processors.ToArray()
            };
            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "CommentsPart")
                yield break;

            var model = new CommentsPartSettingsViewModel {
                Settings = definition.Settings.GetModel<CommentsPartSettings>(),
                HtmlFilters = _htmlFilters
            };

            yield return DefinitionTemplate(model);
        }
 public ContentTypeDefinitionBuilder WithPart(ContentPartDefinition partDefinition, Action<ContentTypePartDefinitionBuilder> configuration) {
     var existingPart = _parts.SingleOrDefault(x => x.PartDefinition.Name == partDefinition.Name);
     if (existingPart != null) {
         _parts.Remove(existingPart);
     }
     else {
         existingPart = new ContentTypePartDefinition(partDefinition, new SettingsDictionary());
     }
     var configurer = new PartConfigurerImpl(existingPart);
     configuration(configurer);
     _parts.Add(configurer.Build());
     return this;
 }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "LayoutPart")
                yield break;

            var model = definition.Settings.GetModel<LayoutTypePartSettings>();

            if (String.IsNullOrWhiteSpace(model.DefaultLayoutData)) {
                var defaultData = _serializer.Serialize(_layoutManager.CreateDefaultLayout());
                model.DefaultLayoutData = defaultData;
            }

            yield return DefinitionTemplate(model);
        }
Exemple #21
0
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "BodyPart")
                yield break;

            var model = definition.Settings.GetModel<BodyTypePartSettings>();

            if (string.IsNullOrWhiteSpace(model.Flavor)) {
                var partModel = definition.PartDefinition.Settings.GetModel<BodyPartSettings>();
                model.Flavor = partModel.FlavorDefault;
            }

            yield return DefinitionTemplate(model);
        }
Exemple #22
0
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "ContainerPart")
                yield break;

            var model = definition.Settings.GetModel<ContainerTypePartSettings>();
            var partModel = definition.PartDefinition.Settings.GetModel<ContainerPartSettings>();

            if (model.PageSizeDefault == null)
                model.PageSizeDefault = partModel.PageSizeDefault;

            if (model.PaginatedDefault == null)
                model.PaginatedDefault = partModel.PaginatedDefault;

            yield return DefinitionTemplate(model);
        }
Exemple #23
0
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
            if (definition.PartDefinition.Name != "ForumPart")
                yield break;

            var settings = definition.Settings.GetModel<ForumPartSettings>();

            if (string.IsNullOrWhiteSpace(settings.PostType)) {
                settings.PostType = Constants.Parts.Post;
            }

            if (string.IsNullOrWhiteSpace(settings.ThreadType)) {
                settings.ThreadType = Constants.Parts.Thread;
            }

            yield return DefinitionTemplate(settings);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "DisqusPart")
                yield break;

            var settings = definition.Settings.GetModel<DisqusPartSettings>();
            var settingsPart = _services.WorkContext.CurrentSite.As<DisqusSettingsPart>();
            if (string.IsNullOrWhiteSpace(settings.Identifier))
            {
                settings.Identifier = "{Content.Id}";
            }
            if (string.IsNullOrWhiteSpace(settings.Url))
            {
                //settings.Url = "{Content.DisplayUrl.Absolute}";
                settings.Url = "~/Contents/Item/Display/{Content.Id}";
            }
            yield return DefinitionTemplate(settings);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "HeadPart") 
                yield break;

            var model = new HeadTypePartSettings();

            // This is the way you are supposed to do it according to piedonne:
            //var model = definition.Settings.GetModel<HeadTypePartSettings>();

            // but this is what I found works:
            try
            {
                model.RawElements = definition.Settings["HeadTypePartSettings.RawElements"];
                model.Elements = HeadElementSerializer.Deserialize(model.RawElements);
            }
            catch { }

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "ContentWidgetsPart")
                yield break;

            var settings = definition.Settings.GetModel<ContentWidgetsTypePartSettings>();

            var attachedWidgetIds = IdSerializer.DeserializeIds(settings.AttachedWidgetIdsDefinition);

            var viewModel = new ContentWidgetsViewModel();
            viewModel.Widgets = (from widget in _widgetService.GetWidgets()
                                 select new ContentWidget
                                 {
                                     Id = widget.Id,
                                     Title = widget.Title,
                                     IsAttached = attachedWidgetIds.Contains(widget.Id)
                                 }).ToList();

            yield return DefinitionTemplate(viewModel, "ContentWidgetsTypePartSettings", Prefix);
        }
Exemple #27
0
 public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
     if (definition.PartDefinition.Name == "CommonPart") {
         var model = definition.Settings.GetModel<DateEditorSettings>();
         yield return DefinitionTemplate(model);
     }
 }
 protected ContentTypePartDefinitionBuilder(ContentTypePartDefinition part) {
     Name = part.PartDefinition.Name;
     TypeName = part.ContentTypeDefinition != null ? part.ContentTypeDefinition.Name : default(string);
     _settings = new SettingsDictionary(part.Settings.ToDictionary(kv => kv.Key, kv => kv.Value));
 }
        public ContentTypeDefinitionBuilder WithPart(string partName, int index)
        {
            var existingPart = _parts.SingleOrDefault(x => x.PartName == partName);
            if (existingPart != null)
            {
                _parts.Remove(existingPart);
            }
            else
            {
                existingPart = new ContentTypePartDefinition(partName);
            }

            existingPart.Index = index;
            _parts.Add(existingPart);
            return this;
        }
        public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition)
        {
            if (definition.PartDefinition.Name != "InfiniteAjaxScrollingPart")
                yield break;
            var model = definition.Settings.GetModel<InfiniteAjaxScrollingTypePartSettings>();

            yield return DefinitionTemplate(model);
        }