예제 #1
0
        public static MediaType CreateVideoMediaType()
        {
            var        builder   = new MediaTypeBuilder();
            IMediaType mediaType = builder
                                   .WithAlias("video")
                                   .WithName("Video")
                                   .AddPropertyGroup()
                                   .WithName("Media")
                                   .WithSortOrder(1)
                                   .AddPropertyType()
                                   .WithAlias("title")
                                   .WithName("Title")
                                   .WithSortOrder(1)
                                   .Done()
                                   .AddPropertyType()
                                   .WithAlias("videoFile")
                                   .WithName("Video file")
                                   .WithSortOrder(1)
                                   .Done()
                                   .Done()
                                   .Build();

            // Ensure that nothing is marked as dirty
            mediaType.ResetDirtyProperties(false);

            return((MediaType)mediaType);
        }
예제 #2
0
        private static MediaType CreateImageMediaType(string alias, string imageFieldPropertyEditorAlias, int imageFieldDataTypeId)
        {
            var        builder   = new MediaTypeBuilder();
            IMediaType mediaType = builder
                                   .WithAlias(alias)
                                   .WithName("Image")
                                   .AddPropertyGroup()
                                   .WithName("Media")
                                   .WithSortOrder(1)
                                   .AddPropertyType()
                                   .WithPropertyEditorAlias(imageFieldPropertyEditorAlias)
                                   .WithAlias(Constants.Conventions.Media.File)
                                   .WithName("File")
                                   .WithSortOrder(1)
                                   .WithDataTypeId(imageFieldDataTypeId)
                                   .Done()
                                   .AddPropertyType()
                                   .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label)
                                   .WithAlias(Constants.Conventions.Media.Width)
                                   .WithName("Width")
                                   .WithSortOrder(2)
                                   .WithDataTypeId(Constants.System.DefaultLabelDataTypeId)
                                   .Done()
                                   .AddPropertyType()
                                   .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label)
                                   .WithAlias(Constants.Conventions.Media.Height)
                                   .WithName("Height")
                                   .WithSortOrder(3)
                                   .WithDataTypeId(Constants.System.DefaultLabelDataTypeId)
                                   .Done()
                                   .AddPropertyType()
                                   .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label)
                                   .WithAlias(Constants.Conventions.Media.Bytes)
                                   .WithName("Bytes")
                                   .WithSortOrder(4)
                                   .WithDataTypeId(Constants.System.DefaultLabelDataTypeId)
                                   .Done()
                                   .AddPropertyType()
                                   .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label)
                                   .WithAlias(Constants.Conventions.Media.Extension)
                                   .WithName("File Extension")
                                   .WithSortOrder(5)
                                   .WithDataTypeId(Constants.System.DefaultLabelDataTypeId)
                                   .Done()
                                   .Done()
                                   .Build();

            // Ensure that nothing is marked as dirty
            mediaType.ResetDirtyProperties(false);

            return((MediaType)mediaType);
        }
예제 #3
0
        public static MediaType CreateSimpleMediaType(string alias, string name, IMediaType parent = null, bool randomizeAliases = false, string propertyGroupAlias = "content", string propertyGroupName = "Content")
        {
            var        builder   = new MediaTypeBuilder();
            IMediaType mediaType = builder
                                   .WithAlias(alias)
                                   .WithName(name)
                                   .WithParentContentType(parent)
                                   .AddPropertyGroup()
                                   .WithAlias(propertyGroupAlias)
                                   .WithName(propertyGroupName)
                                   .WithSortOrder(1)
                                   .AddPropertyType()
                                   .WithAlias(RandomAlias("title", randomizeAliases))
                                   .WithName("Title")
                                   .WithSortOrder(1)
                                   .Done()
                                   .AddPropertyType()
                                   .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.TinyMce)
                                   .WithValueStorageType(ValueStorageType.Ntext)
                                   .WithAlias(RandomAlias("bodyText", randomizeAliases))
                                   .WithName("Body text")
                                   .WithSortOrder(2)
                                   .WithDataTypeId(-87)
                                   .Done()
                                   .AddPropertyType()
                                   .WithAlias(RandomAlias("author", randomizeAliases))
                                   .WithName("Author")
                                   .WithSortOrder(3)
                                   .Done()
                                   .Done()
                                   .Build();

            // Ensure that nothing is marked as dirty
            mediaType.ResetDirtyProperties(false);

            return((MediaType)mediaType);
        }