Exemple #1
0
        private MediaType SecureFile()
        {
            var mediaType = new MediaType(-1)
            {
                Alias               = "secureFile",
                Name                = "Secure File",
                Description         = "Only members who have logged in can view this file",
                Icon                = "icon-lock color-red",
                Thumbnail           = "doc.png",
                SortOrder           = 21,
                CreatorId           = 0,
                Trashed             = false,
                IsContainer         = false,
                AllowedAsRoot       = true,
                AllowedContentTypes = Enumerable.Empty <ContentTypeSort>()
            };

            var umbracoDataType = new UmbracoDataTypes(ApplicationContext.Current.Services.DataTypeService);

            mediaType.AddPropertyType(
                new PropertyType(umbracoDataType.TrueFalse, MemberOnlyAlias)
            {
                Name                = "Member Only",
                Description         = "Only members who have logged in can view this image",
                SortOrder           = 0,
                PropertyEditorAlias = Umbraco.Core.Constants.PropertyEditors.TrueFalseAlias,
            }, "Image");

            mediaType.AddPropertyType(
                new PropertyType(umbracoDataType.Upload, Umbraco.Core.Constants.Conventions.Media.File)
            {
                Name                = "Upload file",
                Description         = string.Empty,
                SortOrder           = 1,
                PropertyEditorAlias = Umbraco.Core.Constants.PropertyEditors.UploadFieldAlias,
            }, "Image");

            mediaType.AddPropertyType(
                new PropertyType(umbracoDataType.Label, Umbraco.Core.Constants.Conventions.Media.Extension)
            {
                Name                = "Type",
                Description         = string.Empty,
                SortOrder           = 2,
                PropertyEditorAlias = Umbraco.Core.Constants.PropertyEditors.NoEditAlias,
            }, "Image");

            mediaType.AddPropertyType(
                new PropertyType(umbracoDataType.Label, Umbraco.Core.Constants.Conventions.Media.Bytes)
            {
                Name                = "Size",
                Description         = string.Empty,
                SortOrder           = 3,
                PropertyEditorAlias = Umbraco.Core.Constants.PropertyEditors.NoEditAlias,
            }, "Image");

            return(mediaType);
        }
Exemple #2
0
        private MediaType SecureFolder()
        {
            var mediaType = new MediaType(-1)
            {
                Alias               = "secureFolder",
                Name                = "Secure Folder",
                Description         = "Only members who have logged in can access media stored within this folder",
                Icon                = "icon-combination-lock color-red",
                Thumbnail           = "doc.png",
                SortOrder           = 22,
                CreatorId           = 0,
                Trashed             = false,
                IsContainer         = false,
                AllowedAsRoot       = true,
                AllowedContentTypes = Enumerable.Empty <ContentTypeSort>()
            };

            var umbracoDataType = new UmbracoDataTypes(ApplicationContext.Current.Services.DataTypeService);

            mediaType.AddPropertyType(
                new PropertyType(umbracoDataType.TrueFalse, MemberOnlyAlias)
            {
                Name                = "Member Only",
                Description         = "Only members who have logged in can view media stored within this folder",
                SortOrder           = 0,
                PropertyEditorAlias = Umbraco.Core.Constants.PropertyEditors.TrueFalseAlias,
            }, "Contents");

            mediaType.AddPropertyType(
                new PropertyType(umbracoDataType.MediaListView, "contents")
            {
                Name                = "Contents",
                Description         = string.Empty,
                SortOrder           = 1,
                PropertyEditorAlias = Umbraco.Core.Constants.PropertyEditors.ListViewAlias,
            }, "Contents");

            return(mediaType);
        }