From 717d01f6660f35d48cbb018386bb48fbaa9b7982 Mon Sep 17 00:00:00 2001 From: Divyansh Agarwal Date: Wed, 12 Jun 2024 23:43:06 +0530 Subject: [PATCH 1/6] Upload bloom format files in studio --- .../frontend/shared/leUtils/FormatPresets.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js index 4dc73e8fa4..6977336323 100644 --- a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js +++ b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js @@ -464,6 +464,22 @@ const FormatPresetsMap = new Map([ associated_mimetypes: ['image/jpeg', 'image/png'], }, ], + [ + 'bloompub', + { + id: 'bloompub', + readable_name: 'Bloom Document', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'document', + allowed_formats: ['bloompub'], + associated_mimetypes: ['application/bloompub+zip'], + }, + ], ]); export default FormatPresetsMap; @@ -500,4 +516,5 @@ export const FormatPresetsNames = { VIDEO_THUMBNAIL: 'video_thumbnail', ZIM: 'zim', ZIM_THUMBNAIL: 'zim_thumbnail', + BLOOMPUB: 'bloompub', }; From 8311a7ca24fb8ed4db635644282cf61750882ab4 Mon Sep 17 00:00:00 2001 From: Divyansh Agarwal Date: Thu, 13 Jun 2024 00:28:27 +0530 Subject: [PATCH 2/6] Add migrations for bloom format --- .../migrations/0149_auto_20240612_1847.py | 23 +++++++++++++++ .../migrations/0021_auto_20240612_1847.py | 28 +++++++++++++++++++ .../migrations/0004_auto_20240612_1847.py | 23 +++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py create mode 100644 contentcuration/kolibri_content/migrations/0021_auto_20240612_1847.py create mode 100644 contentcuration/kolibri_public/migrations/0004_auto_20240612_1847.py diff --git a/contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py b/contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py new file mode 100644 index 0000000000..f4748d5a76 --- /dev/null +++ b/contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.24 on 2024-06-12 18:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contentcuration', '0148_flagfeedbackevent_recommendationsevent_recommendationsinteractionevent'), + ] + + operations = [ + migrations.AlterField( + model_name='fileformat', + name='extension', + field=models.CharField(choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'bloom Document')], max_length=40, primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='formatpreset', + name='id', + field=models.CharField(choices=[('high_res_video', 'High Resolution'), ('low_res_video', 'Low Resolution'), ('video_thumbnail', 'Thumbnail'), ('video_subtitle', 'Subtitle'), ('video_dependency', 'Video (dependency)'), ('audio', 'Audio'), ('audio_thumbnail', 'Thumbnail'), ('audio_dependency', 'audio (dependency)'), ('document', 'Document'), ('epub', 'ePub Document'), ('document_thumbnail', 'Thumbnail'), ('exercise', 'Exercise'), ('exercise_thumbnail', 'Thumbnail'), ('exercise_image', 'Exercise Image'), ('exercise_graphie', 'Exercise Graphie'), ('channel_thumbnail', 'Channel Thumbnail'), ('topic_thumbnail', 'Thumbnail'), ('html5_zip', 'HTML5 Zip'), ('html5_dependency', 'HTML5 Dependency (Zip format)'), ('html5_thumbnail', 'HTML5 Thumbnail'), ('h5p', 'H5P Zip'), ('h5p_thumbnail', 'H5P Thumbnail'), ('zim', 'Zim'), ('zim_thumbnail', 'Zim Thumbnail'), ('qti', 'QTI Zip'), ('qti_thumbnail', 'QTI Thumbnail'), ('slideshow_image', 'Slideshow Image'), ('slideshow_thumbnail', 'Slideshow Thumbnail'), ('slideshow_manifest', 'Slideshow Manifest'), ('imscp_zip', 'IMSCP Zip'), ('bloompub', 'Bloom Document')], max_length=150, primary_key=True, serialize=False), + ), + ] diff --git a/contentcuration/kolibri_content/migrations/0021_auto_20240612_1847.py b/contentcuration/kolibri_content/migrations/0021_auto_20240612_1847.py new file mode 100644 index 0000000000..8795b6bbd2 --- /dev/null +++ b/contentcuration/kolibri_content/migrations/0021_auto_20240612_1847.py @@ -0,0 +1,28 @@ +# Generated by Django 3.2.24 on 2024-06-12 18:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('content', '0020_alter_file_preset'), + ] + + operations = [ + migrations.AlterField( + model_name='file', + name='extension', + field=models.CharField(blank=True, choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'bloom Document')], max_length=40), + ), + migrations.AlterField( + model_name='file', + name='preset', + field=models.CharField(blank=True, choices=[('high_res_video', 'High Resolution'), ('low_res_video', 'Low Resolution'), ('video_thumbnail', 'Thumbnail'), ('video_subtitle', 'Subtitle'), ('video_dependency', 'Video (dependency)'), ('audio', 'Audio'), ('audio_thumbnail', 'Thumbnail'), ('audio_dependency', 'audio (dependency)'), ('document', 'Document'), ('epub', 'ePub Document'), ('document_thumbnail', 'Thumbnail'), ('exercise', 'Exercise'), ('exercise_thumbnail', 'Thumbnail'), ('exercise_image', 'Exercise Image'), ('exercise_graphie', 'Exercise Graphie'), ('channel_thumbnail', 'Channel Thumbnail'), ('topic_thumbnail', 'Thumbnail'), ('html5_zip', 'HTML5 Zip'), ('html5_dependency', 'HTML5 Dependency (Zip format)'), ('html5_thumbnail', 'HTML5 Thumbnail'), ('h5p', 'H5P Zip'), ('h5p_thumbnail', 'H5P Thumbnail'), ('zim', 'Zim'), ('zim_thumbnail', 'Zim Thumbnail'), ('qti', 'QTI Zip'), ('qti_thumbnail', 'QTI Thumbnail'), ('slideshow_image', 'Slideshow Image'), ('slideshow_thumbnail', 'Slideshow Thumbnail'), ('slideshow_manifest', 'Slideshow Manifest'), ('imscp_zip', 'IMSCP Zip'), ('bloompub', 'Bloom Document')], max_length=150), + ), + migrations.AlterField( + model_name='localfile', + name='extension', + field=models.CharField(blank=True, choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'bloom Document')], max_length=40), + ), + ] diff --git a/contentcuration/kolibri_public/migrations/0004_auto_20240612_1847.py b/contentcuration/kolibri_public/migrations/0004_auto_20240612_1847.py new file mode 100644 index 0000000000..2c3110c2d8 --- /dev/null +++ b/contentcuration/kolibri_public/migrations/0004_auto_20240612_1847.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.24 on 2024-06-12 18:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kolibri_public', '0003_alter_file_preset'), + ] + + operations = [ + migrations.AlterField( + model_name='file', + name='preset', + field=models.CharField(blank=True, choices=[('high_res_video', 'High Resolution'), ('low_res_video', 'Low Resolution'), ('video_thumbnail', 'Thumbnail'), ('video_subtitle', 'Subtitle'), ('video_dependency', 'Video (dependency)'), ('audio', 'Audio'), ('audio_thumbnail', 'Thumbnail'), ('audio_dependency', 'audio (dependency)'), ('document', 'Document'), ('epub', 'ePub Document'), ('document_thumbnail', 'Thumbnail'), ('exercise', 'Exercise'), ('exercise_thumbnail', 'Thumbnail'), ('exercise_image', 'Exercise Image'), ('exercise_graphie', 'Exercise Graphie'), ('channel_thumbnail', 'Channel Thumbnail'), ('topic_thumbnail', 'Thumbnail'), ('html5_zip', 'HTML5 Zip'), ('html5_dependency', 'HTML5 Dependency (Zip format)'), ('html5_thumbnail', 'HTML5 Thumbnail'), ('h5p', 'H5P Zip'), ('h5p_thumbnail', 'H5P Thumbnail'), ('zim', 'Zim'), ('zim_thumbnail', 'Zim Thumbnail'), ('qti', 'QTI Zip'), ('qti_thumbnail', 'QTI Thumbnail'), ('slideshow_image', 'Slideshow Image'), ('slideshow_thumbnail', 'Slideshow Thumbnail'), ('slideshow_manifest', 'Slideshow Manifest'), ('imscp_zip', 'IMSCP Zip'), ('bloompub', 'Bloom Document')], max_length=150), + ), + migrations.AlterField( + model_name='localfile', + name='extension', + field=models.CharField(blank=True, choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'bloom Document')], max_length=40), + ), + ] From e7e51c88d6c9b96ab67e618341c4828963eb5f70 Mon Sep 17 00:00:00 2001 From: Divyansh Agarwal Date: Sun, 15 Sep 2024 20:01:21 +0530 Subject: [PATCH 3/6] Update the le-utils version to include blood format --- .../frontend/shared/leUtils/FormatPresets.js | 888 ++++++++---------- .../0150_alter_fileformat_extension.py | 18 + .../migrations/0022_auto_20240915_1414.py | 23 + .../0005_alter_localfile_extension.py | 18 + requirements.txt | 2 +- 5 files changed, 466 insertions(+), 483 deletions(-) create mode 100644 contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py create mode 100644 contentcuration/kolibri_content/migrations/0022_auto_20240915_1414.py create mode 100644 contentcuration/kolibri_public/migrations/0005_alter_localfile_extension.py diff --git a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js index 6977336323..aab545d54c 100644 --- a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js +++ b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js @@ -1,488 +1,411 @@ // Constant values for FormatPresets sorted by id const FormatPresetsMap = new Map([ - [ - 'audio', - { - id: 'audio', - readable_name: 'Audio', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: 'audio', - allowed_formats: ['mp3'], - associated_mimetypes: ['.mp3'], - }, - ], - [ - 'audio_dependency', - { - id: 'audio_dependency', - readable_name: 'Audio', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: 'audio', - allowed_formats: ['mp3'], - associated_mimetypes: ['.mp3'], - }, - ], - [ - 'audio_thumbnail', - { - id: 'audio_thumbnail', - readable_name: 'Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: 'audio', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'channel_thumbnail', - { - id: 'channel_thumbnail', - readable_name: 'Channel Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 0, - kind_id: null, - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'document', - { - id: 'document', - readable_name: 'Document', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 2, - kind_id: 'document', - allowed_formats: ['pdf'], - associated_mimetypes: ['application/pdf'], - }, - ], - [ - 'document_thumbnail', - { - id: 'document_thumbnail', - readable_name: 'Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 3, - kind_id: 'document', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'epub', - { - id: 'epub', - readable_name: 'ePub Document', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: 'document', - allowed_formats: ['epub'], - associated_mimetypes: ['application/epub+zip'], - }, - ], - [ - 'exercise', - { - id: 'exercise', - readable_name: 'Exercise', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: 'exercise', - allowed_formats: ['perseus'], - associated_mimetypes: ['application/perseus+zip'], - }, - ], - [ - 'exercise_graphie', - { - id: 'exercise_graphie', - readable_name: 'Exercise Graphie', - multi_language: false, - supplementary: true, - thumbnail: false, - subtitle: false, - display: false, - order: 4, - kind_id: 'exercise', - allowed_formats: ['svg', 'json', 'graphie'], - associated_mimetypes: ['image/svg', '.graphie', 'application/json'], - }, - ], - [ - 'exercise_image', - { - id: 'exercise_image', - readable_name: 'Exercise Image', - multi_language: false, - supplementary: true, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: 'exercise', - allowed_formats: ['png', 'jpg', 'jpeg', 'gif', 'svg'], - associated_mimetypes: ['image/svg', 'image/gif', 'image/jpeg', 'image/png'], - }, - ], - [ - 'exercise_thumbnail', - { - id: 'exercise_thumbnail', - readable_name: 'Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: 'exercise', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'h5p', - { - id: 'h5p', - readable_name: 'H5P', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: 'h5p', - allowed_formats: ['h5p'], - associated_mimetypes: ['.h5p'], - }, - ], - [ - 'h5p_thumbnail', - { - id: 'h5p_thumbnail', - readable_name: 'H5P Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: 'h5p', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'high_res_video', - { - id: 'high_res_video', - readable_name: 'High Resolution', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: 'video', - allowed_formats: ['mp4', 'webm'], - associated_mimetypes: ['video/webm', 'video/mp4'], - }, - ], - [ - 'html5_dependency', - { - id: 'html5_dependency', - readable_name: 'HTML5 Zip Dependency', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: 'html5', - allowed_formats: ['zip'], - associated_mimetypes: ['.zip'], - }, - ], - [ - 'html5_thumbnail', - { - id: 'html5_thumbnail', - readable_name: 'HTML5 Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: 'html5', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'html5_zip', - { - id: 'html5_zip', - readable_name: 'HTML5 Zip', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: 'html5', - allowed_formats: ['zip'], - associated_mimetypes: ['.zip'], - }, - ], - [ - 'low_res_video', - { - id: 'low_res_video', - readable_name: 'Low Resolution', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 2, - kind_id: 'video', - allowed_formats: ['mp4', 'webm'], - associated_mimetypes: ['video/webm', 'video/mp4'], - }, - ], - [ - 'qti', - { - id: 'qti', - readable_name: 'QTI', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: 'exercise', - allowed_formats: ['zip'], - associated_mimetypes: ['.zip'], - }, - ], - [ - 'qti_thumbnail', - { - id: 'qti_thumbnail', - readable_name: 'QTI Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: 'exercise', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'slideshow_image', - { - id: 'slideshow_image', - readable_name: 'Slideshow Slide Image', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: 'slideshow', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'slideshow_manifest', - { - id: 'slideshow_manifest', - readable_name: 'Slideshow Manifest', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: 'slideshow', - allowed_formats: ['json'], - associated_mimetypes: ['application/json'], - }, - ], - [ - 'slideshow_thumbnail', - { - id: 'slideshow_thumbnail', - readable_name: 'Slideshow Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: false, - order: 2, - kind_id: 'slideshow', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'topic_thumbnail', - { - id: 'topic_thumbnail', - readable_name: 'Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 1, - kind_id: 'topic', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'video_dependency', - { - id: 'video_dependency', - readable_name: 'Video Dependency', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: 'video', - allowed_formats: ['mp4', 'webm'], - associated_mimetypes: ['video/webm', 'video/mp4'], - }, - ], - [ - 'video_subtitle', - { - id: 'video_subtitle', - readable_name: 'Subtitle', - multi_language: true, - supplementary: true, - thumbnail: false, - subtitle: true, - display: true, - order: 4, - kind_id: 'video', - allowed_formats: ['vtt'], - associated_mimetypes: ['.vtt'], - }, - ], - [ - 'video_thumbnail', - { - id: 'video_thumbnail', - readable_name: 'Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 3, - kind_id: 'video', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'zim', - { - id: 'zim', - readable_name: 'Zim', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: 'zim', - allowed_formats: ['zim'], - associated_mimetypes: ['.zim'], - }, - ], - [ - 'zim_thumbnail', - { - id: 'zim_thumbnail', - readable_name: 'Zim Thumbnail', - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: 'zim', - allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/jpeg', 'image/png'], - }, - ], - [ - 'bloompub', - { - id: 'bloompub', - readable_name: 'Bloom Document', - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: 'document', - allowed_formats: ['bloompub'], - associated_mimetypes: ['application/bloompub+zip'], - }, - ], + ["audio", { + id: "audio", + readable_name: "Audio", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "audio", + allowed_formats: ["mp3"], + associated_mimetypes: [".mp3"], + }], + ["audio_dependency", { + id: "audio_dependency", + readable_name: "Audio", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: "audio", + allowed_formats: ["mp3"], + associated_mimetypes: [".mp3"], + }], + ["audio_thumbnail", { + id: "audio_thumbnail", + readable_name: "Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: "audio", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["bloompub", { + id: "bloompub", + readable_name: "Bloom Document", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "document", + allowed_formats: ["bloompub", "bloomd"], + associated_mimetypes: ["application/bloompub+zip"], + }], + ["channel_thumbnail", { + id: "channel_thumbnail", + readable_name: "Channel Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 0, + kind_id: null, + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["document", { + id: "document", + readable_name: "Document", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 2, + kind_id: "document", + allowed_formats: ["pdf"], + associated_mimetypes: ["application/pdf"], + }], + ["document_thumbnail", { + id: "document_thumbnail", + readable_name: "Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 3, + kind_id: "document", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["epub", { + id: "epub", + readable_name: "ePub Document", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "document", + allowed_formats: ["epub"], + associated_mimetypes: ["application/epub+zip"], + }], + ["exercise", { + id: "exercise", + readable_name: "Exercise", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: "exercise", + allowed_formats: ["perseus"], + associated_mimetypes: ["application/perseus+zip"], + }], + ["exercise_graphie", { + id: "exercise_graphie", + readable_name: "Exercise Graphie", + multi_language: false, + supplementary: true, + thumbnail: false, + subtitle: false, + display: false, + order: 4, + kind_id: "exercise", + allowed_formats: ["svg", "json", "graphie"], + associated_mimetypes: ["application/json", "image/svg", ".graphie"], + }], + ["exercise_image", { + id: "exercise_image", + readable_name: "Exercise Image", + multi_language: false, + supplementary: true, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: "exercise", + allowed_formats: ["png", "jpg", "jpeg", "gif", "svg"], + associated_mimetypes: ["image/png", "image/jpeg", "image/svg", "image/gif"], + }], + ["exercise_thumbnail", { + id: "exercise_thumbnail", + readable_name: "Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: "exercise", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["h5p", { + id: "h5p", + readable_name: "H5P", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "h5p", + allowed_formats: ["h5p"], + associated_mimetypes: [".h5p"], + }], + ["h5p_thumbnail", { + id: "h5p_thumbnail", + readable_name: "H5P Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: "h5p", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["high_res_video", { + id: "high_res_video", + readable_name: "High Resolution", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "video", + allowed_formats: ["mp4", "webm"], + associated_mimetypes: ["video/webm", "video/mp4"], + }], + ["html5_dependency", { + id: "html5_dependency", + readable_name: "HTML5 Zip Dependency", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: "html5", + allowed_formats: ["zip"], + associated_mimetypes: [".zip"], + }], + ["html5_thumbnail", { + id: "html5_thumbnail", + readable_name: "HTML5 Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: "html5", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["html5_zip", { + id: "html5_zip", + readable_name: "HTML5 Zip", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "html5", + allowed_formats: ["zip"], + associated_mimetypes: [".zip"], + }], + ["imscp_zip", { + id: "imscp_zip", + readable_name: "IMSCP Zip", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: "html5", + allowed_formats: ["zip"], + associated_mimetypes: [".zip"], + }], + ["low_res_video", { + id: "low_res_video", + readable_name: "Low Resolution", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 2, + kind_id: "video", + allowed_formats: ["mp4", "webm"], + associated_mimetypes: ["video/webm", "video/mp4"], + }], + ["qti", { + id: "qti", + readable_name: "QTI", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: "exercise", + allowed_formats: ["zip"], + associated_mimetypes: [".zip"], + }], + ["qti_thumbnail", { + id: "qti_thumbnail", + readable_name: "QTI Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: "exercise", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["slideshow_image", { + id: "slideshow_image", + readable_name: "Slideshow Slide Image", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: "slideshow", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["slideshow_manifest", { + id: "slideshow_manifest", + readable_name: "Slideshow Manifest", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: "slideshow", + allowed_formats: ["json"], + associated_mimetypes: ["application/json"], + }], + ["slideshow_thumbnail", { + id: "slideshow_thumbnail", + readable_name: "Slideshow Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: false, + order: 2, + kind_id: "slideshow", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["topic_thumbnail", { + id: "topic_thumbnail", + readable_name: "Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 1, + kind_id: "topic", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["video_dependency", { + id: "video_dependency", + readable_name: "Video Dependency", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: "video", + allowed_formats: ["mp4", "webm"], + associated_mimetypes: ["video/webm", "video/mp4"], + }], + ["video_subtitle", { + id: "video_subtitle", + readable_name: "Subtitle", + multi_language: true, + supplementary: true, + thumbnail: false, + subtitle: true, + display: true, + order: 4, + kind_id: "video", + allowed_formats: ["vtt"], + associated_mimetypes: [".vtt"], + }], + ["video_thumbnail", { + id: "video_thumbnail", + readable_name: "Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 3, + kind_id: "video", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], + ["zim", { + id: "zim", + readable_name: "Zim", + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: "zim", + allowed_formats: ["zim"], + associated_mimetypes: [".zim"], + }], + ["zim_thumbnail", { + id: "zim_thumbnail", + readable_name: "Zim Thumbnail", + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: "zim", + allowed_formats: ["png", "jpg", "jpeg"], + associated_mimetypes: ["image/png", "image/jpeg"], + }], ]); -export default FormatPresetsMap; +export default FormatPresetsMap export const FormatPresetsList = Array.from(FormatPresetsMap.values()); @@ -490,6 +413,7 @@ export const FormatPresetsNames = { AUDIO: 'audio', AUDIO_DEPENDENCY: 'audio_dependency', AUDIO_THUMBNAIL: 'audio_thumbnail', + BLOOMPUB: 'bloompub', CHANNEL_THUMBNAIL: 'channel_thumbnail', DOCUMENT: 'document', DOCUMENT_THUMBNAIL: 'document_thumbnail', @@ -504,6 +428,7 @@ export const FormatPresetsNames = { HTML5_DEPENDENCY: 'html5_dependency', HTML5_THUMBNAIL: 'html5_thumbnail', HTML5_ZIP: 'html5_zip', + IMSCP_ZIP: 'imscp_zip', LOW_RES_VIDEO: 'low_res_video', QTI: 'qti', QTI_THUMBNAIL: 'qti_thumbnail', @@ -516,5 +441,4 @@ export const FormatPresetsNames = { VIDEO_THUMBNAIL: 'video_thumbnail', ZIM: 'zim', ZIM_THUMBNAIL: 'zim_thumbnail', - BLOOMPUB: 'bloompub', }; diff --git a/contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py b/contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py new file mode 100644 index 0000000000..3859d3bfec --- /dev/null +++ b/contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.24 on 2024-09-15 14:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contentcuration', '0149_auto_20240612_1847'), + ] + + operations = [ + migrations.AlterField( + model_name='fileformat', + name='extension', + field=models.CharField(choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'Bloom Document'), ('bloomd', 'Bloom Document')], max_length=40, primary_key=True, serialize=False), + ), + ] diff --git a/contentcuration/kolibri_content/migrations/0022_auto_20240915_1414.py b/contentcuration/kolibri_content/migrations/0022_auto_20240915_1414.py new file mode 100644 index 0000000000..c090382987 --- /dev/null +++ b/contentcuration/kolibri_content/migrations/0022_auto_20240915_1414.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.24 on 2024-09-15 14:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('content', '0021_auto_20240612_1847'), + ] + + operations = [ + migrations.AlterField( + model_name='file', + name='extension', + field=models.CharField(blank=True, choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'Bloom Document'), ('bloomd', 'Bloom Document')], max_length=40), + ), + migrations.AlterField( + model_name='localfile', + name='extension', + field=models.CharField(blank=True, choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'Bloom Document'), ('bloomd', 'Bloom Document')], max_length=40), + ), + ] diff --git a/contentcuration/kolibri_public/migrations/0005_alter_localfile_extension.py b/contentcuration/kolibri_public/migrations/0005_alter_localfile_extension.py new file mode 100644 index 0000000000..cbdc55dce3 --- /dev/null +++ b/contentcuration/kolibri_public/migrations/0005_alter_localfile_extension.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.24 on 2024-09-15 14:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kolibri_public', '0004_auto_20240612_1847'), + ] + + operations = [ + migrations.AlterField( + model_name='localfile', + name='extension', + field=models.CharField(blank=True, choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'Bloom Document'), ('bloomd', 'Bloom Document')], max_length=40), + ), + ] diff --git a/requirements.txt b/requirements.txt index 09dce49a93..525d9d2e57 100644 --- a/requirements.txt +++ b/requirements.txt @@ -155,7 +155,7 @@ jsonschema==4.17.3 # via -r requirements.in kombu==5.2.4 # via celery -le-utils==0.2.5 +le-utils==0.2.7 # via -r requirements.in packaging==24.0 # via From 6a2259b131bea90a7f60c487320c984021be38a4 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 17 Sep 2024 09:38:26 -0700 Subject: [PATCH 4/6] Update migrations. --- .../0150_alter_fileformat_extension.py | 18 ------------------ ...7.py => 0150_bloompub_format_and_preset.py} | 10 +++++----- 2 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py rename contentcuration/contentcuration/migrations/{0149_auto_20240612_1847.py => 0150_bloompub_format_and_preset.py} (87%) diff --git a/contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py b/contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py deleted file mode 100644 index 3859d3bfec..0000000000 --- a/contentcuration/contentcuration/migrations/0150_alter_fileformat_extension.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.24 on 2024-09-15 14:14 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('contentcuration', '0149_auto_20240612_1847'), - ] - - operations = [ - migrations.AlterField( - model_name='fileformat', - name='extension', - field=models.CharField(choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'Bloom Document'), ('bloomd', 'Bloom Document')], max_length=40, primary_key=True, serialize=False), - ), - ] diff --git a/contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py b/contentcuration/contentcuration/migrations/0150_bloompub_format_and_preset.py similarity index 87% rename from contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py rename to contentcuration/contentcuration/migrations/0150_bloompub_format_and_preset.py index f4748d5a76..e1ffc389ef 100644 --- a/contentcuration/contentcuration/migrations/0149_auto_20240612_1847.py +++ b/contentcuration/contentcuration/migrations/0150_bloompub_format_and_preset.py @@ -1,19 +1,19 @@ -# Generated by Django 3.2.24 on 2024-06-12 18:47 - -from django.db import migrations, models +# Generated by Django 3.2.24 on 2024-09-17 16:37 +from django.db import migrations +from django.db import models class Migration(migrations.Migration): dependencies = [ - ('contentcuration', '0148_flagfeedbackevent_recommendationsevent_recommendationsinteractionevent'), + ('contentcuration', '0149_unpublishable_change_field'), ] operations = [ migrations.AlterField( model_name='fileformat', name='extension', - field=models.CharField(choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'bloom Document')], max_length=40, primary_key=True, serialize=False), + field=models.CharField(choices=[('mp4', 'MP4 Video'), ('webm', 'WEBM Video'), ('vtt', 'VTT Subtitle'), ('mp3', 'MP3 Audio'), ('pdf', 'PDF Document'), ('jpg', 'JPG Image'), ('jpeg', 'JPEG Image'), ('png', 'PNG Image'), ('gif', 'GIF Image'), ('json', 'JSON'), ('svg', 'SVG Image'), ('perseus', 'Perseus Exercise'), ('graphie', 'Graphie Exercise'), ('zip', 'HTML5 Zip'), ('h5p', 'H5P'), ('zim', 'ZIM'), ('epub', 'ePub Document'), ('bloompub', 'Bloom Document'), ('bloomd', 'Bloom Document')], max_length=40, primary_key=True, serialize=False), ), migrations.AlterField( model_name='formatpreset', From de70311bf69d7e9c1ce77754caaee3f5e11f04a6 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 17 Sep 2024 12:04:30 -0700 Subject: [PATCH 5/6] Fix linting and brittle file upload tests for bloompub upload. --- .../views/files/__tests__/fileUpload.spec.js | 8 +- .../frontend/shared/leUtils/FormatPresets.js | 901 ++++++++++-------- 2 files changed, 501 insertions(+), 408 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUpload.spec.js b/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUpload.spec.js index 9929ff4872..6eb2bd69b7 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUpload.spec.js +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUpload.spec.js @@ -71,9 +71,9 @@ describe('fileUpload', () => { }); describe('computed', () => { it('should map the files to the correct presets', () => { - expect(wrapper.vm.primaryFileMapping[0].file.id).toBe('file-3'); - expect(wrapper.vm.primaryFileMapping[1].file.id).toBe('file-1'); - expect(wrapper.vm.primaryFileMapping).toHaveLength(2); + expect(wrapper.vm.primaryFileMapping[1].file.id).toBe('file-3'); + expect(wrapper.vm.primaryFileMapping[2].file.id).toBe('file-1'); + expect(wrapper.vm.primaryFileMapping).toHaveLength(3); }); it('should disallow file removal if there is only one primary file', () => { const testFiles2 = [ @@ -95,7 +95,7 @@ describe('fileUpload', () => { describe('methods', () => { let uploadItem; beforeEach(() => { - uploadItem = wrapper.findAll(FileUploadItem).at(1); + uploadItem = wrapper.findAll(FileUploadItem).at(2); }); it('should automatically select the first file on load', () => { expect(wrapper.vm.selected).toBe('file-3'); diff --git a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js index aab545d54c..a5897d1902 100644 --- a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js +++ b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js @@ -1,411 +1,504 @@ // Constant values for FormatPresets sorted by id const FormatPresetsMap = new Map([ - ["audio", { - id: "audio", - readable_name: "Audio", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "audio", - allowed_formats: ["mp3"], - associated_mimetypes: [".mp3"], - }], - ["audio_dependency", { - id: "audio_dependency", - readable_name: "Audio", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: "audio", - allowed_formats: ["mp3"], - associated_mimetypes: [".mp3"], - }], - ["audio_thumbnail", { - id: "audio_thumbnail", - readable_name: "Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: "audio", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["bloompub", { - id: "bloompub", - readable_name: "Bloom Document", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "document", - allowed_formats: ["bloompub", "bloomd"], - associated_mimetypes: ["application/bloompub+zip"], - }], - ["channel_thumbnail", { - id: "channel_thumbnail", - readable_name: "Channel Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 0, - kind_id: null, - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["document", { - id: "document", - readable_name: "Document", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 2, - kind_id: "document", - allowed_formats: ["pdf"], - associated_mimetypes: ["application/pdf"], - }], - ["document_thumbnail", { - id: "document_thumbnail", - readable_name: "Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 3, - kind_id: "document", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["epub", { - id: "epub", - readable_name: "ePub Document", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "document", - allowed_formats: ["epub"], - associated_mimetypes: ["application/epub+zip"], - }], - ["exercise", { - id: "exercise", - readable_name: "Exercise", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: "exercise", - allowed_formats: ["perseus"], - associated_mimetypes: ["application/perseus+zip"], - }], - ["exercise_graphie", { - id: "exercise_graphie", - readable_name: "Exercise Graphie", - multi_language: false, - supplementary: true, - thumbnail: false, - subtitle: false, - display: false, - order: 4, - kind_id: "exercise", - allowed_formats: ["svg", "json", "graphie"], - associated_mimetypes: ["application/json", "image/svg", ".graphie"], - }], - ["exercise_image", { - id: "exercise_image", - readable_name: "Exercise Image", - multi_language: false, - supplementary: true, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: "exercise", - allowed_formats: ["png", "jpg", "jpeg", "gif", "svg"], - associated_mimetypes: ["image/png", "image/jpeg", "image/svg", "image/gif"], - }], - ["exercise_thumbnail", { - id: "exercise_thumbnail", - readable_name: "Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: "exercise", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["h5p", { - id: "h5p", - readable_name: "H5P", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "h5p", - allowed_formats: ["h5p"], - associated_mimetypes: [".h5p"], - }], - ["h5p_thumbnail", { - id: "h5p_thumbnail", - readable_name: "H5P Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: "h5p", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["high_res_video", { - id: "high_res_video", - readable_name: "High Resolution", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "video", - allowed_formats: ["mp4", "webm"], - associated_mimetypes: ["video/webm", "video/mp4"], - }], - ["html5_dependency", { - id: "html5_dependency", - readable_name: "HTML5 Zip Dependency", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: "html5", - allowed_formats: ["zip"], - associated_mimetypes: [".zip"], - }], - ["html5_thumbnail", { - id: "html5_thumbnail", - readable_name: "HTML5 Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: "html5", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["html5_zip", { - id: "html5_zip", - readable_name: "HTML5 Zip", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "html5", - allowed_formats: ["zip"], - associated_mimetypes: [".zip"], - }], - ["imscp_zip", { - id: "imscp_zip", - readable_name: "IMSCP Zip", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 1, - kind_id: "html5", - allowed_formats: ["zip"], - associated_mimetypes: [".zip"], - }], - ["low_res_video", { - id: "low_res_video", - readable_name: "Low Resolution", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: true, - order: 2, - kind_id: "video", - allowed_formats: ["mp4", "webm"], - associated_mimetypes: ["video/webm", "video/mp4"], - }], - ["qti", { - id: "qti", - readable_name: "QTI", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: "exercise", - allowed_formats: ["zip"], - associated_mimetypes: [".zip"], - }], - ["qti_thumbnail", { - id: "qti_thumbnail", - readable_name: "QTI Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: "exercise", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["slideshow_image", { - id: "slideshow_image", - readable_name: "Slideshow Slide Image", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: "slideshow", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["slideshow_manifest", { - id: "slideshow_manifest", - readable_name: "Slideshow Manifest", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: "slideshow", - allowed_formats: ["json"], - associated_mimetypes: ["application/json"], - }], - ["slideshow_thumbnail", { - id: "slideshow_thumbnail", - readable_name: "Slideshow Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: false, - order: 2, - kind_id: "slideshow", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["topic_thumbnail", { - id: "topic_thumbnail", - readable_name: "Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 1, - kind_id: "topic", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["video_dependency", { - id: "video_dependency", - readable_name: "Video Dependency", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 3, - kind_id: "video", - allowed_formats: ["mp4", "webm"], - associated_mimetypes: ["video/webm", "video/mp4"], - }], - ["video_subtitle", { - id: "video_subtitle", - readable_name: "Subtitle", - multi_language: true, - supplementary: true, - thumbnail: false, - subtitle: true, - display: true, - order: 4, - kind_id: "video", - allowed_formats: ["vtt"], - associated_mimetypes: [".vtt"], - }], - ["video_thumbnail", { - id: "video_thumbnail", - readable_name: "Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 3, - kind_id: "video", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], - ["zim", { - id: "zim", - readable_name: "Zim", - multi_language: false, - supplementary: false, - thumbnail: false, - subtitle: false, - display: false, - order: 1, - kind_id: "zim", - allowed_formats: ["zim"], - associated_mimetypes: [".zim"], - }], - ["zim_thumbnail", { - id: "zim_thumbnail", - readable_name: "Zim Thumbnail", - multi_language: false, - supplementary: true, - thumbnail: true, - subtitle: false, - display: true, - order: 2, - kind_id: "zim", - allowed_formats: ["png", "jpg", "jpeg"], - associated_mimetypes: ["image/png", "image/jpeg"], - }], + [ + 'audio', + { + id: 'audio', + readable_name: 'Audio', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'audio', + allowed_formats: ['mp3'], + associated_mimetypes: ['.mp3'], + }, + ], + [ + 'audio_dependency', + { + id: 'audio_dependency', + readable_name: 'Audio', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: 'audio', + allowed_formats: ['mp3'], + associated_mimetypes: ['.mp3'], + }, + ], + [ + 'audio_thumbnail', + { + id: 'audio_thumbnail', + readable_name: 'Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: 'audio', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'bloompub', + { + id: 'bloompub', + readable_name: 'Bloom Document', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'document', + allowed_formats: ['bloompub', 'bloomd'], + associated_mimetypes: ['application/bloompub+zip'], + }, + ], + [ + 'channel_thumbnail', + { + id: 'channel_thumbnail', + readable_name: 'Channel Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 0, + kind_id: null, + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'document', + { + id: 'document', + readable_name: 'Document', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 2, + kind_id: 'document', + allowed_formats: ['pdf'], + associated_mimetypes: ['application/pdf'], + }, + ], + [ + 'document_thumbnail', + { + id: 'document_thumbnail', + readable_name: 'Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 3, + kind_id: 'document', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'epub', + { + id: 'epub', + readable_name: 'ePub Document', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'document', + allowed_formats: ['epub'], + associated_mimetypes: ['application/epub+zip'], + }, + ], + [ + 'exercise', + { + id: 'exercise', + readable_name: 'Exercise', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: 'exercise', + allowed_formats: ['perseus'], + associated_mimetypes: ['application/perseus+zip'], + }, + ], + [ + 'exercise_graphie', + { + id: 'exercise_graphie', + readable_name: 'Exercise Graphie', + multi_language: false, + supplementary: true, + thumbnail: false, + subtitle: false, + display: false, + order: 4, + kind_id: 'exercise', + allowed_formats: ['svg', 'json', 'graphie'], + associated_mimetypes: ['application/json', 'image/svg', '.graphie'], + }, + ], + [ + 'exercise_image', + { + id: 'exercise_image', + readable_name: 'Exercise Image', + multi_language: false, + supplementary: true, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: 'exercise', + allowed_formats: ['png', 'jpg', 'jpeg', 'gif', 'svg'], + associated_mimetypes: ['image/png', 'image/jpeg', 'image/svg', 'image/gif'], + }, + ], + [ + 'exercise_thumbnail', + { + id: 'exercise_thumbnail', + readable_name: 'Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: 'exercise', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'h5p', + { + id: 'h5p', + readable_name: 'H5P', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'h5p', + allowed_formats: ['h5p'], + associated_mimetypes: ['.h5p'], + }, + ], + [ + 'h5p_thumbnail', + { + id: 'h5p_thumbnail', + readable_name: 'H5P Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: 'h5p', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'high_res_video', + { + id: 'high_res_video', + readable_name: 'High Resolution', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'video', + allowed_formats: ['mp4', 'webm'], + associated_mimetypes: ['video/webm', 'video/mp4'], + }, + ], + [ + 'html5_dependency', + { + id: 'html5_dependency', + readable_name: 'HTML5 Zip Dependency', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: 'html5', + allowed_formats: ['zip'], + associated_mimetypes: ['.zip'], + }, + ], + [ + 'html5_thumbnail', + { + id: 'html5_thumbnail', + readable_name: 'HTML5 Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: 'html5', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'html5_zip', + { + id: 'html5_zip', + readable_name: 'HTML5 Zip', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'html5', + allowed_formats: ['zip'], + associated_mimetypes: ['.zip'], + }, + ], + [ + 'imscp_zip', + { + id: 'imscp_zip', + readable_name: 'IMSCP Zip', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'html5', + allowed_formats: ['zip'], + associated_mimetypes: ['.zip'], + }, + ], + [ + 'low_res_video', + { + id: 'low_res_video', + readable_name: 'Low Resolution', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 2, + kind_id: 'video', + allowed_formats: ['mp4', 'webm'], + associated_mimetypes: ['video/webm', 'video/mp4'], + }, + ], + [ + 'qti', + { + id: 'qti', + readable_name: 'QTI', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: 'exercise', + allowed_formats: ['zip'], + associated_mimetypes: ['.zip'], + }, + ], + [ + 'qti_thumbnail', + { + id: 'qti_thumbnail', + readable_name: 'QTI Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: 'exercise', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'slideshow_image', + { + id: 'slideshow_image', + readable_name: 'Slideshow Slide Image', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: 'slideshow', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'slideshow_manifest', + { + id: 'slideshow_manifest', + readable_name: 'Slideshow Manifest', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: 'slideshow', + allowed_formats: ['json'], + associated_mimetypes: ['application/json'], + }, + ], + [ + 'slideshow_thumbnail', + { + id: 'slideshow_thumbnail', + readable_name: 'Slideshow Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: false, + order: 2, + kind_id: 'slideshow', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'topic_thumbnail', + { + id: 'topic_thumbnail', + readable_name: 'Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 1, + kind_id: 'topic', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'video_dependency', + { + id: 'video_dependency', + readable_name: 'Video Dependency', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 3, + kind_id: 'video', + allowed_formats: ['mp4', 'webm'], + associated_mimetypes: ['video/webm', 'video/mp4'], + }, + ], + [ + 'video_subtitle', + { + id: 'video_subtitle', + readable_name: 'Subtitle', + multi_language: true, + supplementary: true, + thumbnail: false, + subtitle: true, + display: true, + order: 4, + kind_id: 'video', + allowed_formats: ['vtt'], + associated_mimetypes: ['.vtt'], + }, + ], + [ + 'video_thumbnail', + { + id: 'video_thumbnail', + readable_name: 'Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 3, + kind_id: 'video', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], + [ + 'zim', + { + id: 'zim', + readable_name: 'Zim', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: false, + order: 1, + kind_id: 'zim', + allowed_formats: ['zim'], + associated_mimetypes: ['.zim'], + }, + ], + [ + 'zim_thumbnail', + { + id: 'zim_thumbnail', + readable_name: 'Zim Thumbnail', + multi_language: false, + supplementary: true, + thumbnail: true, + subtitle: false, + display: true, + order: 2, + kind_id: 'zim', + allowed_formats: ['png', 'jpg', 'jpeg'], + associated_mimetypes: ['image/png', 'image/jpeg'], + }, + ], ]); -export default FormatPresetsMap +export default FormatPresetsMap; export const FormatPresetsList = Array.from(FormatPresetsMap.values()); From 69be8e5176e2c0437493b31b05d12503e57656ce Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 17 Sep 2024 13:19:11 -0700 Subject: [PATCH 6/6] Ensure that we can upload and display bloompub files properly. --- .../contentcuration/frontend/shared/mixins.js | 1 + .../frontend/shared/views/files/Uploader.vue | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/mixins.js b/contentcuration/contentcuration/frontend/shared/mixins.js index 5f200ef18c..01095f6df2 100644 --- a/contentcuration/contentcuration/frontend/shared/mixins.js +++ b/contentcuration/contentcuration/frontend/shared/mixins.js @@ -117,6 +117,7 @@ export const constantStrings = createTranslator('ConstantStrings', { mp3: 'MP3 audio', pdf: 'PDF document', epub: 'EPub document', + bloompub: 'BloomPub document', jpg: 'JPG image', jpeg: 'JPEG image', png: 'PNG image', diff --git a/contentcuration/contentcuration/frontend/shared/views/files/Uploader.vue b/contentcuration/contentcuration/frontend/shared/views/files/Uploader.vue index 3d4997e1c6..7e208cc82f 100644 --- a/contentcuration/contentcuration/frontend/shared/views/files/Uploader.vue +++ b/contentcuration/contentcuration/frontend/shared/views/files/Uploader.vue @@ -14,7 +14,7 @@ ref="fileUpload" style="display: none;" type="file" - :accept="acceptedMimetypes" + :accept="acceptedFileTypes" :multiple="allowMultiple" data-test="upload-dialog" @change="handleFiles($event.target.files)" @@ -129,8 +129,12 @@ : !fp.supplementary && (!this.displayOnly || fp.display) ); }, - acceptedMimetypes() { - return flatMap(this.acceptedFiles, f => f.associated_mimetypes).join(','); + acceptedFileTypes() { + return uniq( + flatMap(this.acceptedFiles, f => f.associated_mimetypes).concat( + this.acceptedExtensions.map(ext => `.${ext}`) + ) + ).join(','); }, acceptedExtensions() { return uniq(flatMap(this.acceptedFiles, f => f.allowed_formats));