Exemplo n.º 1
0
 public override IEnumerable<TemplateViewModel> PartEditorUpdate(ContentPartDefinitionBuilder builder, IUpdateModel updateModel)
 {
     var model = new ContentPartSettings();
     updateModel.TryUpdateModel(model, "ContentPartSettings", null, null);
     builder.Attachable(model.Attachable);
     yield return DefinitionTemplate(model);
 }
Exemplo n.º 2
0
        public async Task FilterAsync(IQuery<ContentItem> query, ListContentsViewModel model, PagerParameters pagerParameters, IUpdateModel updateModel)
        {
            var viewModel = new ListPartContentAdminFilterModel();
            if(await updateModel.TryUpdateModelAsync(viewModel, ""))
            {
                // Show list content items 
                if (viewModel.ShowListContentTypes)
                {
                    var listableTypes = _contentDefinitionManager
                        .ListTypeDefinitions()
                        .Where(x =>
                            x.Parts.Any(p =>
                                p.PartDefinition.Name == nameof(ListPart)))
                        .Select(x => x.Name);

                    query.With<ContentItemIndex>(x => x.ContentType.IsIn(listableTypes));
                }

                // Show contained elements for the specified list
                else if(viewModel.ListContentItemId != 0)
                {
                    query.With<ContainedPartIndex>(x => x.ListContentItemId == viewModel.ListContentItemId);
                }
            }
        }
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.FieldType != "ReferenceField") {
                yield break;
            }
            var model = new ReferenceFieldSettings();
            if (updateModel.TryUpdateModel(model, "ReferenceFieldSettings", null, null)) {
                UpdateSettings(model, builder, "ReferenceFieldSettings");

                if (model.QueryId <= 0) {
                    model.QueryId = CreateQuery(model.ContentTypeName.ToString(CultureInfo.InvariantCulture));
                }

                if (model.RelationshipId <= 0) {
                    var httpContext = _httpContextAccessor.Current();
                    var routeValues = httpContext.Request.RequestContext.RouteData.Values;
                    var entityName = routeValues["id"].ToString();
                    model.RelationshipId = _relationshipService.CreateOneToManyRelationship(builder.Name, model.RelationshipName, model.ContentTypeName, entityName);
                }

                if (model.QueryId <= 0 || model.RelationshipId <= 0) {
                    updateModel.AddModelError("QueryOrRelation", T("Invalid Query or Relationship Id"));
                    yield break;
                }

                UpdateSettings(model, builder, "ReferenceFieldSettings");
                builder.WithSetting("ReferenceFieldSettings.DisplayAsLink", model.DisplayAsLink.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.ContentTypeName", model.ContentTypeName.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.RelationshipName", model.RelationshipName.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.RelationshipId", model.RelationshipId.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.QueryId", model.QueryId.ToString(CultureInfo.InvariantCulture));
            }
            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (!builder.FieldType.Equals(typeof(MoneyField).Name)) yield break;

            var model = new MoneyFieldSettings();

            if (updateModel.TryUpdateModel(model, typeof(MoneyFieldSettings).Name, null, null))
            {
                if (string.IsNullOrEmpty(model.DefaultCurrency))
                {
                    builder.WithSetting("MoneyFieldSettings.DefaultCurrency", Currency.FromCurrentCulture().Iso3LetterCode);
                }
                else
                {
                    Currency parsedCurrency;
                    if (Currency.TryParse(model.DefaultCurrency, out parsedCurrency))
                    {
                        builder.WithSetting("MoneyFieldSettings.DefaultCurrency", model.DefaultCurrency);
                    }
                    else
                    {
                        updateModel.AddModelError("InvalidCurrencyIsoCode", T("MoneyField - Invalid currency iso code was given."));
                    }
                }

                builder.WithSetting("MoneyFieldSettings.IsCurrencyReadOnly", model.IsCurrencyReadOnly.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("MoneyFieldSettings.Hint", model.Hint);
                builder.WithSetting("MoneyFieldSettings.Required", model.Required.ToString(CultureInfo.InvariantCulture));
            }
            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.Name != typeof (TermPart).Name) yield break;

            var settings = new ExtraTermPartSettings();
            updateModel.TryUpdateModel(settings, typeof (ExtraTermPartSettings).Name, null, null);
            builder.WithSetting("ExtraTermPartSettings.OnlyDirectChildren", settings.OnlyDirectChildren.ToString());
        }
        public Task<dynamic> UpdateTypeEditorAsync(ContentTypeDefinition contentTypeDefinition, IUpdateModel updater, string groupId)
        {
            if (contentTypeDefinition == null)
            {
                throw new ArgumentNullException(nameof(contentTypeDefinition));
            }

            dynamic contentTypeDefinitionShape = CreateContentShape("ContentTypeDefinition_Edit");
            contentTypeDefinitionShape.ContentTypeDefinition = contentTypeDefinition;

            _contentDefinitionManager.AlterTypeDefinition(contentTypeDefinition.Name, typeBuilder =>
            {
                var typeContext = new UpdateTypeEditorContext(
                    typeBuilder,
                    contentTypeDefinitionShape,
                    groupId,
                    _shapeFactory,
                    _layoutAccessor.GetLayout(),
                    updater
                );

                BindPlacementAsync(typeContext).Wait();

                _handlers.InvokeAsync(handler => handler.UpdateTypeEditorAsync(contentTypeDefinition, typeContext), Logger).Wait();

            });

            return Task.FromResult<dynamic>(contentTypeDefinitionShape);
        }
 public dynamic UpdateSettings(IUpdateModel updater)
 {
     var settings = _contentManager.Get<SeoGlobalSettingsPart>(GetGlobalSettings().ContentItem.Id, VersionOptions.DraftRequired);
     var editor = _contentManager.UpdateEditor(settings, updater);
     _contentManager.Publish(settings.ContentItem);
     return editor;
 }
Exemplo n.º 8
0
 public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, string groupInfoId, IShapeFactory shapeFactory, ShapeTable shapeTable, string path)
     : base(model, content, groupInfoId, shapeFactory) {
     
     ShapeTable = shapeTable;
     Updater = updater;
     Path = path;
 }
        public override IDisplayResult Display(ContentItem contentItem, IUpdateModel updater)
        {
            var testContentPart = contentItem.As<TestContentPartA>();

            if (testContentPart == null)
            {
                return null;
            }

            return Combine(
                // A new shape is created and the properties of the object are bound to it when rendered
                Shape("TestContentPartA", testContentPart).Location("Detail", "Content"),
                // New shape, no initialization, custom location
                Shape("LowerDoll").Location("Detail", "Footer"),
                // New shape 
                Shape("TestContentPartA",
                    ctx => ctx.New.TestContentPartA().Creating(_creating++),
                    shape =>
                    {
                        shape.Processing = _processing++;
                        return Task.CompletedTask;
                    })
                    .Location("Detail", "Content")
                    .Cache("lowerdoll2", cache => cache.During(TimeSpan.FromSeconds(5))),
                // A strongly typed shape model is used and initialized when rendered
                Shape<TestContentPartAShape>(shape => { shape.Line = "Strongly typed shape"; return Task.CompletedTask; })
                    .Location("Detail", "Content:2"),
                // Cached shape
                Shape("LowerDoll")
                    .Location("Detail", "/Footer")
                    .Cache("lowerdoll", cache => cache.During(TimeSpan.FromSeconds(5)))
                );
        }
        public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "RelatedContentPart") yield break;

            var viewModel = new PropertyFieldsViewModel();
            updateModel.TryUpdateModel(viewModel, "PropertyFieldsViewModel", null, null);
            var settings = new RelatedContentRelationshipSettings();
            foreach (var relationshipFieldsModel in viewModel.Fields)
            {
                settings.DisplayName += String.Format("<field>{0}</field>", relationshipFieldsModel.DisplayName);
                settings.RelatedContentFields += String.Format("<field>{0}</field>", relationshipFieldsModel.RelatedContentFields);
                settings.RelatedcontentType += String.Format("<field>{0}</field>", relationshipFieldsModel.RelatedcontentType);
            }

            builder.WithSetting("RelatedContentRelationshipSettings.RelatedcontentType",
                settings.RelatedcontentType);
            builder.WithSetting("RelatedContentRelationshipSettings.RelatedContentFields",
                settings.RelatedContentFields);
            builder.WithSetting("RelatedContentRelationshipSettings.DisplayName",
                settings.DisplayName);

            var model = GetModel(settings);

            yield return DefinitionTemplate(model);
        }
 public dynamic UpdateEditor(IContent content, IUpdateModel updater, string groupInfoId) {
     var contentKey = "ContentUpdate:" + content.Id.ToString();
     _profiler.StepStart(contentKey, String.Format("Content Update: {0}", content.Id));
     var result = _innerContentDisplay.UpdateEditor(content, updater, groupInfoId);
     _profiler.StepStop(contentKey);
     return result;
 }
Exemplo n.º 12
0
 public dynamic UpdateEditor(IContent content, IUpdateModel updater, string groupId = "") {
     var shape = _origami.ContentShape(content, "", true);
     var builder = _origami.ContentBuilder(content).WithMode("Editor").WithUpdater(updater, "");
     if (!String.IsNullOrWhiteSpace(groupId)) builder.WithGroup(groupId);
     _origami.Build(builder, shape);
     return shape;
 }
Exemplo n.º 13
0
 public override IEnumerable<TemplateViewModel> PartEditorUpdate(ContentPartDefinitionBuilder builder, IUpdateModel updateModel)
 {
     var model = new ContentPartSettings();
     updateModel.TryUpdateModelAsync(model, "ContentPartSettings").Wait();
     builder.Attachable(model.Attachable);
     builder.WithDescription(model.Description);
     yield return DefinitionTemplate(model);
 }
Exemplo n.º 14
0
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new ExperimentalSettings();
            updateModel.TryUpdateModel(model, "ExperimentalSettings", null, null);
            builder
                .WithSetting("ExperimentalSettings.ShowDebugLinks", model.ShowDebugLinks ? true.ToString() : null);

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new SecurableContentItemsSettingsViewModel();
            updateModel.TryUpdateModel(model, "SecurableContentItemsSettingsViewModel", null, null);

            builder.WithSetting("ContentPermissionsTypeSettings.SecurableContentItems", model.SecurableContentItems.ToString());

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 16
0
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new ContentTypeSettings();
            updateModel.TryUpdateModel(model, "ContentTypeSettings", null, null);
            builder.Creatable(model.Creatable);
            builder.Draftable(model.Draftable);

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var model = new AssociativyTaxonomiesAdapterTypeSettings();
            updateModel.TryUpdateModel(model, "AssociativyTaxonomiesAdapterTypeSettings", null, null);
            builder.WithSetting("AssociativyTaxonomiesAdapterTypeSettings.GraphNamesSerialized", model.GraphNamesSerialized);

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 18
0
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new DateTimeFieldSettings();
            if(updateModel.TryUpdateModel(model, "DateTimeFieldSettings", null, null)) {
                builder.WithSetting("DateTimeFieldSettings.Display", model.Display.ToString());
            }

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 19
0
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var model = new DynamicTypeSettingsViewModel();
            updateModel.TryUpdateModel(model, "DynamicTypeSettingsViewModel", null, null);

            builder.WithSetting("DynamicTypeSettings.IsDeployed", model.IsDeployed.ToString());

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var model = new HtmlFieldSettings();
            if (updateModel.TryUpdateModel(model, "HtmlFieldSettings", null, null)) {
                builder.WithSetting("HtmlFieldSettings.FlavorDefault", model.FlavorDefault);
            }

            yield return DefinitionTemplate(model);
        }
        public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.Name != typeof(AuthorablePart).Name) yield break;

            var model = new AuthorablePartSettings();
            updateModel.TryUpdateModel(model, typeof (AuthorablePartSettings).Name, null, null);
            builder.WithSetting(string.Format("{0}.{1}", typeof(AuthorablePartSettings).Name, model.AutomaticallyAssignEditorToAuthors.GetType().Name), model.AutomaticallyAssignEditorToAuthors.ToString());

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 22
0
 public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
     if (builder.Name == "CommonPart") {
         var model = new DateEditorSettings();
         if (updateModel.TryUpdateModel(model, "DateEditorSettings", null, null)) {
             builder.WithSetting("DateEditorSettings.ShowDateEditor", model.ShowDateEditor.ToString());
         }
         yield return DefinitionTemplate(model);
     }
 }
Exemplo n.º 23
0
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new FieldIndexing();
            updateModel.TryUpdateModel(model, "FieldIndexing", null, null);
            builder.WithSetting("FieldIndexing.Included", model.Included ? true.ToString() : null);

            CreateIndexingTasks();

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 24
0
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new TypeIndexing();
            updateModel.TryUpdateModel(model, "TypeIndexing", null, null);
            builder.WithSetting("TypeIndexing.Indexes", model.Indexes);

            CreateIndexingTasks();
            
            yield return DefinitionTemplate(model);
        }
Exemplo n.º 25
0
        public dynamic DisplayElement(
            Element element,
            IContent content,
            string displayType = null,
            IUpdateModel updater = null,
            string renderEventName = null,
            string renderEventArgs = null) {

            var createShapeContext = new ElementCreatingDisplayShapeContext {
                Element = element,
                DisplayType = displayType,
                Content = content,
            };

            element.Descriptor.CreatingDisplay(createShapeContext);

            var typeName = element.GetType().Name;
            var category = element.Category.ToSafeName();
            var drivers = element.Descriptor.GetDrivers();
            var elementShapeArguments = CreateArguments(element, content);
            var elementShape = (dynamic)_shapeFactory.Create("Element", elementShapeArguments, () => new ZoneHolding(() => _shapeFactory.Create("ElementZone")));
            

            elementShape.Metadata.DisplayType = displayType;
            elementShape.Metadata.Alternates.Add(String.Format("Elements_{0}", typeName));
            elementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}", typeName, displayType));
            elementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, category));
            elementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, category));

            var displayContext = new ElementDisplayContext {
                Element = element,
                ElementShape = elementShape,
                DisplayType = displayType,
                Content = content,
                Updater = updater,
                RenderEventName = renderEventName,
                RenderEventArgs = renderEventArgs
            };

            _elementEventHandlerHandler.Displaying(displayContext);
            InvokeDrivers(drivers, driver => driver.Displaying(displayContext));
            element.Descriptor.Display(displayContext);

            var container = element as Container;

            if (container != null) {
                if (container.Elements.Any()) {
                    foreach (var child in container.Elements) {
                        var childShape = DisplayElement(child, content, displayType: displayType, updater: updater);
                        childShape.Parent = elementShape;
                        elementShape.Add(childShape);
                    }
                }
            }

            return elementShape;
        }
        public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.Name != "ElementWrapperPart")
                yield break;

            var model = new ElementWrapperPartSettings();
            updateModel.TryUpdateModel(model, "ElementWrapperPartSettings", null, null);
            builder.WithSetting("ElementWrapperPartSettings.ElementTypeName", model.ElementTypeName);
            yield return DefinitionTemplate(model);
        }
Exemplo n.º 27
0
        public override IEnumerable<TemplateViewModel> PartEditorUpdate(ContentPartDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.Name != "BodyPart")
                yield break;

            var model = new BodyPartSettings();
            updateModel.TryUpdateModel(model, "BodyPartSettings", null, null);
            builder.WithSetting("BodyPartSettings.FlavorDefault", !string.IsNullOrWhiteSpace(model.FlavorDefault) ? model.FlavorDefault : null);
            yield return DefinitionTemplate(model);
        }
Exemplo n.º 28
0
 protected BuildShapeContext(IShape shape, string groupId, IShapeFactory shapeFactory, IShape layout, IUpdateModel updater)
 {
     Shape = shape;
     ShapeFactory = shapeFactory;
     GroupId = groupId;
     Layout = layout;
     FindPlacement = FindDefaultPlacement;
     Updater = updater;
 }
        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> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
     var settings = builder.Current.Settings;
     if (settings.ContainsKey("Stereotype") && settings["Stereotype"] == "Media") {
         var model = new MediaFileNameEditorSettings();
         if (updateModel.TryUpdateModel(model, "MediaFileNameEditorSettings", null, null)) {
             builder.WithSetting("MediaFileNameEditorSettings.ShowFileNameEditor", model.ShowFileNameEditor.ToString());
         }
     }
     return base.TypeEditorUpdate(builder, updateModel);
 }
        public override async Task <IDisplayResult> UpdateAsync(BooleanField field, IUpdateModel updater, UpdateFieldEditorContext context)
        {
            await updater.TryUpdateModelAsync(field, Prefix, f => f.Value);

            return(Edit(field, context));
        }
        public override async Task <IDisplayResult> UpdateAsync(LayerSettings settings, IUpdateModel updater, string groupId)
        {
            if (groupId == GroupId)
            {
                var model = new LayerSettingsViewModel();

                await updater.TryUpdateModelAsync(model, Prefix);

                settings.Zones = model.Zones.Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
            }

            return(Edit(settings));
        }
        public override IDisplayResult Edit(ContentTypePartDefinition contentTypePartDefinition, IUpdateModel updater)
        {
            if (!String.Equals(nameof(MarkdownBodyPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            return(Initialize <MarkdownBodyPartSettingsViewModel>("MarkdownBodyPartSettings_Edit", model =>
            {
                var settings = contentTypePartDefinition.GetSettings <MarkdownBodyPartSettings>();

                model.Editor = settings.Editor;
                model.MarkdownBodyPartSettings = settings;
            }).Location("Content"));
        }
Exemplo n.º 34
0
        public override async Task <IDisplayResult> UpdateAsync(ResponsiveMediaField field, IUpdateModel updater, UpdateFieldEditorContext context)
        {
            if (await updater.TryUpdateModelAsync(field, Prefix, f => f.Data))
            {
                var settings = context.PartFieldDefinition.GetSettings <ResponsiveMediaFieldSettings>();

                if (settings.Required && !JsonConvert.DeserializeObject <IList <ResponsiveMediaItem> >(field.Data).Any())
                {
                    updater.ModelState.AddModelError(Prefix, S["{0}: Media is required.", context.PartFieldDefinition.DisplayName()]);
                }
            }

            return(Edit(field, context));
        }
Exemplo n.º 35
0
 public virtual Task <IDisplayResult> UpdateAsync(TModel model, IUpdateModel updater)
 {
     return(EditAsync(model, updater));
 }
        public static async Task <IHtmlContent> DisplayAsync(this OrchardRazorHelper razorHelper, ContentItem content, string displayType = "", string groupId = "", IUpdateModel updater = null)
        {
            var displayManager = razorHelper.HttpContext.RequestServices.GetService <IContentItemDisplayManager>();
            var shape          = await displayManager.BuildDisplayAsync(content, updater, displayType, groupId);

            return(await razorHelper.DisplayHelper(shape));
        }
Exemplo n.º 37
0
 public virtual IDisplayResult Edit(TModel model, IUpdateModel updater)
 {
     return(Edit(model));
 }
Exemplo n.º 38
0
 public override Task <bool> ValidateModelAsync(DocComment comment, IUpdateModel updater)
 {
     // ensure tags are optional
     return(Task.FromResult(true));
 }
Exemplo n.º 39
0
        protected override DriverResult Editor(ContentPart part, Fields.DbFilesField field, IUpdateModel updater, dynamic shapeHelper)
        {
            var viewModel = new DbFilesFieldEditViewModel();

            if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null))
            {
                if (!string.IsNullOrEmpty(viewModel.DeleteIds))
                {
                    var idsToDelete = viewModel.DeleteIds.Split(',');
                    foreach (var id in idsToDelete)
                    {
                        _dbFilesService.DeleteFile(id);
                    }
                }
                var request     = ((Controller)updater).Request;
                var settings    = field.PartFieldDefinition.Settings.GetModel <DbFilesFieldSettings>();
                var keyName     = "DbFiles-" + field.Name;
                var postedFiles = new List <HttpPostedFileBase>();
                for (var i = 0; i < request.Files.Count; i++)
                {
                    if (request.Files.GetKey(i).Equals(keyName))
                    {
                        var postedFile = request.Files[i];
                        if (postedFile != null && postedFile.InputStream.Length > 0)
                        {
                            postedFiles.Add(postedFile);
                        }
                    }
                }
                if (settings.Required)
                {
                    var existingFiles = _dbFilesService.GetFilesForField(field.Name, part.ContentItem.Id);
                    if (!existingFiles.Any() && !postedFiles.Any())
                    {
                        updater.AddModelError(GetPrefix(field, part), T("{0} is required.", field.DisplayName));
                        return(Editor(part, field, shapeHelper));
                    }
                }
                try {
                    foreach (var postedFile in postedFiles)
                    {
                        if (postedFile.ContentLength / 1000 > settings.MaxKb)
                        {
                            updater.AddModelError(GetPrefix(field, part), T("{0} is too large.", postedFile.FileName));
                        }
                        else
                        {
                            var document = new byte[postedFile.ContentLength];
                            postedFile.InputStream.Read(document, 0, postedFile.ContentLength);
                            var record = new FileUploadRecord {
                                FileData    = document,
                                IdContent   = part.ContentItem.Id,
                                FieldName   = field.Name,
                                FileName    = Path.GetFileName(postedFile.FileName),
                                ContentType = postedFile.ContentType
                            };
                            _fileUploadRepository.Create(record);
                        }
                    }
                }
                catch (Exception ex) {
                    updater.AddModelError(GetPrefix(field, part), T("Failed to save {0} - {1}.", field.DisplayName, ex.Message));
                }
            }
            return(Editor(part, field, shapeHelper));
        }
Exemplo n.º 40
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var previous = builder.Current.Settings.GetModel <FieldIndexing>();

            var model = new FieldIndexing();

            updateModel.TryUpdateModel(model, "FieldIndexing", null, null);
            builder.WithSetting("FieldIndexing.Included", model.Included ? true.ToString() : null);

            // create indexing tasks only if settings have changed
            if (model.Included != previous.Included)
            {
                // if a field setting has changed, all existing content items need to be re-indexed
                CreateIndexingTasks();
            }

            yield return(DefinitionTemplate(model));
        }
 // POST
 protected override DriverResult Editor(AvatarsSettingsPart part, IUpdateModel updater, dynamic shapeHelper)
 {
     updater.TryUpdateModel(part, Prefix, null, null);
     return(Editor(part, shapeHelper));
 }
Exemplo n.º 42
0
        public override IEnumerable <TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var previous = builder.Current.Settings.GetModel <TypeIndexing>();

            var model = new TypeIndexing();

            updateModel.TryUpdateModel(model, "TypeIndexing", null, null);
            builder.WithSetting("TypeIndexing.Indexes", model.Indexes);

            // create indexing tasks only if settings have changed
            if (Clean(model.Indexes) != Clean(previous.Indexes))
            {
                // if a an index is added, all existing content items need to be re-indexed
                CreateIndexingTasks();
            }

            yield return(DefinitionTemplate(model));
        }
        public override async Task <IDisplayResult> UpdateAsync(HttpsSettings settings, IUpdateModel updater, string groupId)
        {
            if (groupId == SettingsGroupId)
            {
                var model = new HttpsSettingsViewModel();

                await updater.TryUpdateModelAsync(model, Prefix);

                settings.RequireHttps          = model.RequireHttps;
                settings.RequireHttpsPermanent = model.RequireHttpsPermanent;
                settings.SslPort = model.SslPort;
            }

            if (_memoryCache.Get(RestartPendingCacheKey) == null)
            {
                var entry = _memoryCache.CreateEntry(RestartPendingCacheKey);
                _memoryCache.Set(entry.Key, entry, new MemoryCacheEntryOptions {
                    Priority = CacheItemPriority.NeverRemove
                });
            }

            return(Edit(settings));
        }
Exemplo n.º 44
0
        public void AlterType(EditTypeViewModel typeViewModel, IUpdateModel updateModel)
        {
            var updater = new PrefixedModelUpdater(updateModel);

            _contentDefinitionManager.AlterTypeDefinition(typeViewModel.Name, typeBuilder =>
            {
                typeBuilder.DisplayedAs(typeViewModel.DisplayName);

                // allow extensions to alter type configuration
                _contentDefinitionEditorEvents.Invoke(x => x.TypeEditorUpdating(typeBuilder), Logger);
                typeViewModel.Templates = _contentDefinitionEditorEvents.Invoke(x => x.TypeEditorUpdate(typeBuilder, updater), Logger);
                _contentDefinitionEditorEvents.Invoke(x => x.TypeEditorUpdated(typeBuilder), Logger);

                foreach (var part in typeViewModel.Parts)
                {
                    var partViewModel = part;

                    // enable updater to be aware of changing part prefix
                    updater.Prefix = secondHalf => String.Format("{0}.{1}", partViewModel.Prefix, secondHalf);

                    // allow extensions to alter typePart configuration
                    typeBuilder.WithPart(partViewModel.PartDefinition.Name, typePartBuilder =>
                    {
                        _contentDefinitionEditorEvents.Invoke(x => x.TypePartEditorUpdating(typePartBuilder), Logger);
                        partViewModel.Templates = _contentDefinitionEditorEvents.Invoke(x => x.TypePartEditorUpdate(typePartBuilder, updater), Logger);
                        _contentDefinitionEditorEvents.Invoke(x => x.TypePartEditorUpdated(typePartBuilder), Logger);
                    });

                    if (!partViewModel.PartDefinition.Fields.Any())
                    {
                        continue;
                    }

                    _contentDefinitionManager.AlterPartDefinition(partViewModel.PartDefinition.Name, partBuilder =>
                    {
                        var fieldFirstHalf = String.Format("{0}.{1}", partViewModel.Prefix, partViewModel.PartDefinition.Prefix);
                        foreach (var field in partViewModel.PartDefinition.Fields)
                        {
                            var fieldViewModel = field;

                            // enable updater to be aware of changing field prefix
                            updater.Prefix = secondHalf =>
                                             String.Format("{0}.{1}.{2}", fieldFirstHalf, fieldViewModel.Prefix, secondHalf);
                            // allow extensions to alter partField configuration
                            partBuilder.WithField(fieldViewModel.Name, partFieldBuilder =>
                            {
                                _contentDefinitionEditorEvents.Invoke(x => x.PartFieldEditorUpdating(partFieldBuilder), Logger);
                                fieldViewModel.Templates = _contentDefinitionEditorEvents.Invoke(x => x.PartFieldEditorUpdate(partFieldBuilder, updater), Logger);
                                _contentDefinitionEditorEvents.Invoke(x => x.PartFieldEditorUpdated(partFieldBuilder), Logger);
                            });
                        }
                    });
                }

                if (typeViewModel.Fields.Any())
                {
                    _contentDefinitionManager.AlterPartDefinition(typeViewModel.Name, partBuilder =>
                    {
                        foreach (var field in typeViewModel.Fields)
                        {
                            var fieldViewModel = field;

                            // enable updater to be aware of changing field prefix
                            updater.Prefix = secondHalf =>
                                             string.Format("{0}.{1}", fieldViewModel.Prefix, secondHalf);

                            // allow extensions to alter partField configuration
                            partBuilder.WithField(fieldViewModel.Name, partFieldBuilder =>
                            {
                                _contentDefinitionEditorEvents.Invoke(x => x.PartFieldEditorUpdating(partFieldBuilder), Logger);
                                fieldViewModel.Templates = _contentDefinitionEditorEvents.Invoke(x => x.PartFieldEditorUpdate(partFieldBuilder, updater), Logger);
                                _contentDefinitionEditorEvents.Invoke(x => x.PartFieldEditorUpdated(partFieldBuilder), Logger);
                            });
                        }
                    });
                }
            });
        }
        public override async Task <IDisplayResult> UpdateAsync(FacebookPluginPart model, IUpdateModel updater)
        {
            var viewModel = new FacebookPluginPartViewModel();

            if (await updater.TryUpdateModelAsync(viewModel, Prefix, t => t.Liquid))
            {
                if (!string.IsNullOrEmpty(viewModel.Liquid) && !_liquidTemplatemanager.Validate(viewModel.Liquid, out var errors))
                {
                    updater.ModelState.AddModelError(nameof(model.Liquid), T["The FaceBook Body doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]);
                }
                else
                {
                    model.Liquid = viewModel.Liquid;
                }
            }

            return(Edit(model));
        }
Exemplo n.º 46
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "DataRestrictionsPart")
            {
                yield break;
            }
            var model = new DataRestrictionsPartSettings();

            updateModel.TryUpdateModel(model, "DataRestrictionsPartSettings", null, null);
            builder.WithSetting("DataRestrictionsPartSettings.RestrictionsDefault", model.RestricitonsDefault);
            builder.WithSetting("DataRestrictionsPartSettings.ForceDefault", ((bool)model.ForceDefault).ToString());
            yield return(DefinitionTemplate(model));
        }
Exemplo n.º 47
0
        public override void UpdateFieldSettings(string fieldType, string fieldName, SettingsDictionary settingsDictionary, IUpdateModel updateModel)
        {
            if (fieldType != "CurrencyField")
            {
                return;
            }
            var model = new CurrencyFieldSettings();

            if (updateModel.TryUpdateModel(model, "CurrencyFieldSettings", null, null))
            {
                UpdateSettings(model, settingsDictionary, "CurrencyFieldSettings");
                settingsDictionary["CurrencyFieldSettings.Length"]        = model.Length.ToString("D");
                settingsDictionary["CurrencyFieldSettings.DecimalPlaces"] = model.DecimalPlaces.ToString("D");
                settingsDictionary["CurrencyFieldSettings.DefaultValue"]  = model.DefaultValue.ToString();
            }
        }
        public override async Task <IDisplayResult> UpdateAsync(CommentatorPart model, IUpdateModel updater)
        {
            var settings = GetCommentatorPartSettings(model);

            await updater.TryUpdateModelAsync(model, Prefix, t => t.AllowComments);

            return(Edit(model));
        }
Exemplo n.º 49
0
        public override async Task <IDisplayResult> UpdateAsync(JavascriptCondition condition, IUpdateModel updater)
        {
            var model = new JavascriptConditionViewModel();

            if (await updater.TryUpdateModelAsync(model, Prefix))
            {
                // TODO is empty.
                condition.Script = model.Script;
            }

            return(Edit(condition));
        }
Exemplo n.º 50
0
 public virtual Task <IDisplayResult> EditAsync(TModel model, IUpdateModel updater)
 {
     return(Task.FromResult(Edit(model, updater)));
 }
Exemplo n.º 51
0
 public virtual IDisplayResult Display(TModel model, IUpdateModel updater)
 {
     return(Display(model));
 }
        public override async Task <IDisplayResult> UpdateAsync(LocalizationSetContentPickerField field, IUpdateModel updater, UpdateFieldEditorContext context)
        {
            var viewModel = new EditLocalizationSetContentPickerFieldViewModel();

            var modelUpdated = await updater.TryUpdateModelAsync(viewModel, Prefix, f => f.LocalizationSets);

            if (!modelUpdated)
            {
                return(Edit(field, context));
            }

            field.LocalizationSets = viewModel.LocalizationSets == null
                ? new string[0] : viewModel.LocalizationSets.Split(',', StringSplitOptions.RemoveEmptyEntries);

            var settings = context.PartFieldDefinition.GetSettings <LocalizationSetContentPickerFieldSettings>();

            if (settings.Required && field.LocalizationSets.Length == 0)
            {
                updater.ModelState.AddModelError(Prefix, nameof(field.LocalizationSets), S["The {0} field is required.", context.PartFieldDefinition.DisplayName()]);
            }

            if (!settings.Multiple && field.LocalizationSets.Length > 1)
            {
                updater.ModelState.AddModelError(Prefix, nameof(field.LocalizationSets), S["The {0} field cannot contain multiple items.", context.PartFieldDefinition.DisplayName()]);
            }

            return(Edit(field, context));
        }
Exemplo n.º 53
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "SeoPart")
            {
                yield break;
            }

            var settings = new SeoPartSettings();

            if (updateModel.TryUpdateModel(settings, "SeoPartSettings", null, null))
            {
                builder.WithSetting("SeoPartSettings.AddCanonicalLink", settings.AddCanonicalLink.ToString());
                builder.WithSetting("SeoPartSettings.DefaultDescriptionPattern", settings.DefaultDescriptionPattern);
                builder.WithSetting("SeoPartSettings.DefaultKeywordsPattern", settings.DefaultKeywordsPattern);
                builder.WithSetting("SeoPartSettings.DefaultRobotsMeta", settings.DefaultRobotsMeta.ToString());
            }

            yield return(DefinitionTemplate(settings));
        }
Exemplo n.º 54
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "ContentPermissionsPart")
            {
                yield break;
            }

            if (!_authorizer.Authorize(Permissions.GrantPermission))
            {
                yield break;
            }

            var allRoles = _roleService.GetRoles().Select(x => x.Name).OrderBy(x => x).ToList();

            var model = new ContentPermissionsPartViewModel();

            updateModel.TryUpdateModel(model, "ContentPermissionsPartViewModel", null, null);

            // update permissions only for those the current user is granted
            if (_authorizer.Authorize(Core.Contents.Permissions.ViewContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.View", ContentPermissionsPartViewModel.SerializePermissions(model.ViewRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.ViewOwnContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.ViewOwn", ContentPermissionsPartViewModel.SerializePermissions(model.ViewOwnRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.PublishContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.Publish", ContentPermissionsPartViewModel.SerializePermissions(model.PublishRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.PublishOwnContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.PublishOwn", ContentPermissionsPartViewModel.SerializePermissions(model.PublishOwnRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.EditContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.Edit", ContentPermissionsPartViewModel.SerializePermissions(model.EditRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.EditOwnContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.EditOwn", ContentPermissionsPartViewModel.SerializePermissions(model.EditOwnRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.DeleteContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.Delete", ContentPermissionsPartViewModel.SerializePermissions(model.DeleteRoles));
            }

            if (_authorizer.Authorize(Core.Contents.Permissions.DeleteOwnContent))
            {
                builder.WithSetting("ContentPermissionsPartSettings.DeleteOwn", ContentPermissionsPartViewModel.SerializePermissions(model.DeleteOwnRoles));
            }

            builder.WithSetting("ContentPermissionsPartSettings.DisplayedRoles", ContentPermissionsPartViewModel.SerializePermissions(model.AllRoles));

            // disable permissions the current user doesn't have
            model.ViewRoles = model.ViewRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.ViewContent)
            }).ToList();
            model.ViewOwnRoles = model.ViewOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.ViewOwnContent)
            }).ToList();
            model.PublishRoles = model.PublishRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.PublishContent)
            }).ToList();
            model.PublishOwnRoles = model.PublishOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.PublishOwnContent)
            }).ToList();
            model.EditRoles = model.EditRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.EditContent)
            }).ToList();
            model.EditOwnRoles = model.EditOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.EditOwnContent)
            }).ToList();
            model.DeleteRoles = model.DeleteRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.DeleteContent)
            }).ToList();
            model.DeleteOwnRoles = model.DeleteOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = _authorizer.Authorize(Core.Contents.Permissions.DeleteOwnContent)
            }).ToList();

            // initialize default value
            model.ViewRoles = model.ViewRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.ViewContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.ViewOwnRoles = model.ViewOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.ViewOwnContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.PublishRoles = model.PublishRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.PublishContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.PublishOwnRoles = model.PublishOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.PublishOwnContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.EditRoles = model.EditRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.EditContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.EditOwnRoles = model.EditOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.EditOwnContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.DeleteRoles = model.DeleteRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.DeleteContent, UserSimulation.Create(x.Role), null)
            }).ToList();
            model.DeleteOwnRoles = model.DeleteOwnRoles.Select(x => new RoleEntry {
                Role = x.Role, Checked = x.Checked, Enabled = x.Enabled, Default = _authorizationService.TryCheckAccess(Core.Contents.Permissions.DeleteOwnContent, UserSimulation.Create(x.Role), null)
            }).ToList();

            yield return(DefinitionTemplate(model));
        }
Exemplo n.º 55
0
        public override async Task <IDisplayResult> UpdateAsync(PlaceholderAdminNode treeNode, IUpdateModel updater)
        {
            var model = new PlaceholderAdminNodeViewModel();

            if (await updater.TryUpdateModelAsync(model, Prefix, x => x.LinkText, x => x.IconClass, x => x.PermissionIds))
            {
                treeNode.LinkText  = model.LinkText;
                treeNode.IconClass = model.IconClass;
                var modifiedPermissions = (model.PermissionIds == null ? new string[0] : model.PermissionIds.Split(',', StringSplitOptions.RemoveEmptyEntries));
                //clear the old permissions to insert all every time
                treeNode.Permissions.Clear();

                //change permissions only if one is inserted
                if (modifiedPermissions.Length > 0)
                {
                    var permissions = await _permissionService.GetInstalledPermissionsAsync();

                    foreach (var permissionName in modifiedPermissions)
                    {
                        var perm = permissions.Where(p => p.Name == permissionName).FirstOrDefault();

                        if (perm != null)
                        {
                            treeNode.Permissions.Add(perm);
                        }
                    }
                }
                treeNode.RenderIfEmpty = model.RenderIfEmpty;
            }
            ;

            return(Edit(treeNode));
        }
Exemplo n.º 56
0
        public override async Task <IDisplayResult> UpdateAsync(MarkdownPart model, IUpdateModel updater)
        {
            await updater.TryUpdateModelAsync(model, Prefix, t => t.Markdown);

            return(Edit(model));
        }
Exemplo n.º 57
0
        private ElementEditorContext CreateEditorContext(IContent content, Element element, ElementDataDictionary elementData, IUpdateModel updater, dynamic shapeFactory)
        {
            var context = new ElementEditorContext {
                Content       = content,
                Element       = element,
                Updater       = updater,
                ValueProvider = elementData.ToValueProvider(_cultureAccessor.CurrentCulture),
                ElementData   = elementData,
                ShapeFactory  = shapeFactory,
                Prefix        = Prefix
            };

            return(context);
        }
Exemplo n.º 58
0
        public override async Task <IDisplayResult> UpdateAsync(LinkAdminNode treeNode, IUpdateModel updater)
        {
            var model = new LinkAdminNodeViewModel();

            if (await updater.TryUpdateModelAsync(model, Prefix, x => x.LinkUrl, x => x.LinkText, x => x.IconClass))
            {
                treeNode.LinkText  = model.LinkText;
                treeNode.LinkUrl   = model.LinkUrl;
                treeNode.IconClass = model.IconClass;
            }
            ;

            return(Edit(treeNode));
        }
        public override IDisplayResult Edit(ContentTypePartDefinition contentTypePartDefinition, IUpdateModel updater)
        {
            if (!String.Equals(nameof(ListPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            return(Shape <ListPartSettingsViewModel>("ListPartSettings_Edit", model =>
            {
                model.ListPartSettings = contentTypePartDefinition.Settings.ToObject <ListPartSettings>();
                model.PageSize = model.ListPartSettings.PageSize;
                model.ContainedContentTypes = model.ListPartSettings.ContainedContentTypes;
                model.ContentTypes = new NameValueCollection();

                foreach (var contentTypeDefinition in _contentDefinitionManager.ListTypeDefinitions())
                {
                    model.ContentTypes.Add(contentTypeDefinition.Name, contentTypeDefinition.DisplayName);
                }
            }).Location("Content"));
        }
Exemplo n.º 60
0
        protected override DriverResult Editor(ContentPart part, Fields.ContentPickerField field, IUpdateModel updater, dynamic shapeHelper)
        {
            var model = new ContentPickerFieldViewModel {
                SelectedIds = string.Join(",", field.Ids)
            };

            updater.TryUpdateModel(model, GetPrefix(field, part), null, null);

            var settings = field.PartFieldDefinition.Settings.GetModel <ContentPickerFieldSettings>();

            if (String.IsNullOrEmpty(model.SelectedIds))
            {
                field.Ids = new int[0];
            }
            else
            {
                field.Ids = model.SelectedIds.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
            }

            if (settings.Required && field.Ids.Length == 0)
            {
                updater.AddModelError("Id", T("The {0} field is required.", field.Name.CamelFriendly()));
            }

            return(Editor(part, field, shapeHelper));
        }