Skip to content

Commit 1016852

Browse files
authored
Merge pull request #4590 from nikkuAg/bloomPub
Upload bloom format files in studio
2 parents 45bf94e + 69be8e5 commit 1016852

File tree

10 files changed

+176
-22
lines changed

10 files changed

+176
-22
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUpload.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ describe('fileUpload', () => {
7171
});
7272
describe('computed', () => {
7373
it('should map the files to the correct presets', () => {
74-
expect(wrapper.vm.primaryFileMapping[0].file.id).toBe('file-3');
75-
expect(wrapper.vm.primaryFileMapping[1].file.id).toBe('file-1');
76-
expect(wrapper.vm.primaryFileMapping).toHaveLength(2);
74+
expect(wrapper.vm.primaryFileMapping[1].file.id).toBe('file-3');
75+
expect(wrapper.vm.primaryFileMapping[2].file.id).toBe('file-1');
76+
expect(wrapper.vm.primaryFileMapping).toHaveLength(3);
7777
});
7878
it('should disallow file removal if there is only one primary file', () => {
7979
const testFiles2 = [
@@ -95,7 +95,7 @@ describe('fileUpload', () => {
9595
describe('methods', () => {
9696
let uploadItem;
9797
beforeEach(() => {
98-
uploadItem = wrapper.findAll(FileUploadItem).at(1);
98+
uploadItem = wrapper.findAll(FileUploadItem).at(2);
9999
});
100100
it('should automatically select the first file on load', () => {
101101
expect(wrapper.vm.selected).toBe('file-3');

contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,23 @@ const FormatPresetsMap = new Map([
4545
order: 2,
4646
kind_id: 'audio',
4747
allowed_formats: ['png', 'jpg', 'jpeg'],
48-
associated_mimetypes: ['image/jpeg', 'image/png'],
48+
associated_mimetypes: ['image/png', 'image/jpeg'],
49+
},
50+
],
51+
[
52+
'bloompub',
53+
{
54+
id: 'bloompub',
55+
readable_name: 'Bloom Document',
56+
multi_language: false,
57+
supplementary: false,
58+
thumbnail: false,
59+
subtitle: false,
60+
display: true,
61+
order: 1,
62+
kind_id: 'document',
63+
allowed_formats: ['bloompub', 'bloomd'],
64+
associated_mimetypes: ['application/bloompub+zip'],
4965
},
5066
],
5167
[
@@ -61,7 +77,7 @@ const FormatPresetsMap = new Map([
6177
order: 0,
6278
kind_id: null,
6379
allowed_formats: ['png', 'jpg', 'jpeg'],
64-
associated_mimetypes: ['image/jpeg', 'image/png'],
80+
associated_mimetypes: ['image/png', 'image/jpeg'],
6581
},
6682
],
6783
[
@@ -93,7 +109,7 @@ const FormatPresetsMap = new Map([
93109
order: 3,
94110
kind_id: 'document',
95111
allowed_formats: ['png', 'jpg', 'jpeg'],
96-
associated_mimetypes: ['image/jpeg', 'image/png'],
112+
associated_mimetypes: ['image/png', 'image/jpeg'],
97113
},
98114
],
99115
[
@@ -141,7 +157,7 @@ const FormatPresetsMap = new Map([
141157
order: 4,
142158
kind_id: 'exercise',
143159
allowed_formats: ['svg', 'json', 'graphie'],
144-
associated_mimetypes: ['image/svg', '.graphie', 'application/json'],
160+
associated_mimetypes: ['application/json', 'image/svg', '.graphie'],
145161
},
146162
],
147163
[
@@ -157,7 +173,7 @@ const FormatPresetsMap = new Map([
157173
order: 3,
158174
kind_id: 'exercise',
159175
allowed_formats: ['png', 'jpg', 'jpeg', 'gif', 'svg'],
160-
associated_mimetypes: ['image/svg', 'image/gif', 'image/jpeg', 'image/png'],
176+
associated_mimetypes: ['image/png', 'image/jpeg', 'image/svg', 'image/gif'],
161177
},
162178
],
163179
[
@@ -173,7 +189,7 @@ const FormatPresetsMap = new Map([
173189
order: 2,
174190
kind_id: 'exercise',
175191
allowed_formats: ['png', 'jpg', 'jpeg'],
176-
associated_mimetypes: ['image/jpeg', 'image/png'],
192+
associated_mimetypes: ['image/png', 'image/jpeg'],
177193
},
178194
],
179195
[
@@ -205,7 +221,7 @@ const FormatPresetsMap = new Map([
205221
order: 2,
206222
kind_id: 'h5p',
207223
allowed_formats: ['png', 'jpg', 'jpeg'],
208-
associated_mimetypes: ['image/jpeg', 'image/png'],
224+
associated_mimetypes: ['image/png', 'image/jpeg'],
209225
},
210226
],
211227
[
@@ -253,7 +269,7 @@ const FormatPresetsMap = new Map([
253269
order: 2,
254270
kind_id: 'html5',
255271
allowed_formats: ['png', 'jpg', 'jpeg'],
256-
associated_mimetypes: ['image/jpeg', 'image/png'],
272+
associated_mimetypes: ['image/png', 'image/jpeg'],
257273
},
258274
],
259275
[
@@ -272,6 +288,22 @@ const FormatPresetsMap = new Map([
272288
associated_mimetypes: ['.zip'],
273289
},
274290
],
291+
[
292+
'imscp_zip',
293+
{
294+
id: 'imscp_zip',
295+
readable_name: 'IMSCP Zip',
296+
multi_language: false,
297+
supplementary: false,
298+
thumbnail: false,
299+
subtitle: false,
300+
display: true,
301+
order: 1,
302+
kind_id: 'html5',
303+
allowed_formats: ['zip'],
304+
associated_mimetypes: ['.zip'],
305+
},
306+
],
275307
[
276308
'low_res_video',
277309
{
@@ -317,7 +349,7 @@ const FormatPresetsMap = new Map([
317349
order: 2,
318350
kind_id: 'exercise',
319351
allowed_formats: ['png', 'jpg', 'jpeg'],
320-
associated_mimetypes: ['image/jpeg', 'image/png'],
352+
associated_mimetypes: ['image/png', 'image/jpeg'],
321353
},
322354
],
323355
[
@@ -333,7 +365,7 @@ const FormatPresetsMap = new Map([
333365
order: 3,
334366
kind_id: 'slideshow',
335367
allowed_formats: ['png', 'jpg', 'jpeg'],
336-
associated_mimetypes: ['image/jpeg', 'image/png'],
368+
associated_mimetypes: ['image/png', 'image/jpeg'],
337369
},
338370
],
339371
[
@@ -365,7 +397,7 @@ const FormatPresetsMap = new Map([
365397
order: 2,
366398
kind_id: 'slideshow',
367399
allowed_formats: ['png', 'jpg', 'jpeg'],
368-
associated_mimetypes: ['image/jpeg', 'image/png'],
400+
associated_mimetypes: ['image/png', 'image/jpeg'],
369401
},
370402
],
371403
[
@@ -381,7 +413,7 @@ const FormatPresetsMap = new Map([
381413
order: 1,
382414
kind_id: 'topic',
383415
allowed_formats: ['png', 'jpg', 'jpeg'],
384-
associated_mimetypes: ['image/jpeg', 'image/png'],
416+
associated_mimetypes: ['image/png', 'image/jpeg'],
385417
},
386418
],
387419
[
@@ -429,7 +461,7 @@ const FormatPresetsMap = new Map([
429461
order: 3,
430462
kind_id: 'video',
431463
allowed_formats: ['png', 'jpg', 'jpeg'],
432-
associated_mimetypes: ['image/jpeg', 'image/png'],
464+
associated_mimetypes: ['image/png', 'image/jpeg'],
433465
},
434466
],
435467
[
@@ -461,7 +493,7 @@ const FormatPresetsMap = new Map([
461493
order: 2,
462494
kind_id: 'zim',
463495
allowed_formats: ['png', 'jpg', 'jpeg'],
464-
associated_mimetypes: ['image/jpeg', 'image/png'],
496+
associated_mimetypes: ['image/png', 'image/jpeg'],
465497
},
466498
],
467499
]);
@@ -474,6 +506,7 @@ export const FormatPresetsNames = {
474506
AUDIO: 'audio',
475507
AUDIO_DEPENDENCY: 'audio_dependency',
476508
AUDIO_THUMBNAIL: 'audio_thumbnail',
509+
BLOOMPUB: 'bloompub',
477510
CHANNEL_THUMBNAIL: 'channel_thumbnail',
478511
DOCUMENT: 'document',
479512
DOCUMENT_THUMBNAIL: 'document_thumbnail',
@@ -488,6 +521,7 @@ export const FormatPresetsNames = {
488521
HTML5_DEPENDENCY: 'html5_dependency',
489522
HTML5_THUMBNAIL: 'html5_thumbnail',
490523
HTML5_ZIP: 'html5_zip',
524+
IMSCP_ZIP: 'imscp_zip',
491525
LOW_RES_VIDEO: 'low_res_video',
492526
QTI: 'qti',
493527
QTI_THUMBNAIL: 'qti_thumbnail',

contentcuration/contentcuration/frontend/shared/mixins.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const constantStrings = createTranslator('ConstantStrings', {
117117
mp3: 'MP3 audio',
118118
pdf: 'PDF document',
119119
epub: 'EPub document',
120+
bloompub: 'BloomPub document',
120121
jpg: 'JPG image',
121122
jpeg: 'JPEG image',
122123
png: 'PNG image',

contentcuration/contentcuration/frontend/shared/views/files/Uploader.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
ref="fileUpload"
1515
style="display: none;"
1616
type="file"
17-
:accept="acceptedMimetypes"
17+
:accept="acceptedFileTypes"
1818
:multiple="allowMultiple"
1919
data-test="upload-dialog"
2020
@change="handleFiles($event.target.files)"
@@ -129,8 +129,12 @@
129129
: !fp.supplementary && (!this.displayOnly || fp.display)
130130
);
131131
},
132-
acceptedMimetypes() {
133-
return flatMap(this.acceptedFiles, f => f.associated_mimetypes).join(',');
132+
acceptedFileTypes() {
133+
return uniq(
134+
flatMap(this.acceptedFiles, f => f.associated_mimetypes).concat(
135+
this.acceptedExtensions.map(ext => `.${ext}`)
136+
)
137+
).join(',');
134138
},
135139
acceptedExtensions() {
136140
return uniq(flatMap(this.acceptedFiles, f => f.allowed_formats));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 3.2.24 on 2024-09-17 16:37
2+
from django.db import migrations
3+
from django.db import models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('contentcuration', '0149_unpublishable_change_field'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='fileformat',
15+
name='extension',
16+
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),
17+
),
18+
migrations.AlterField(
19+
model_name='formatpreset',
20+
name='id',
21+
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),
22+
),
23+
]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 3.2.24 on 2024-06-12 18:47
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('content', '0020_alter_file_preset'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='file',
15+
name='extension',
16+
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),
17+
),
18+
migrations.AlterField(
19+
model_name='file',
20+
name='preset',
21+
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),
22+
),
23+
migrations.AlterField(
24+
model_name='localfile',
25+
name='extension',
26+
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),
27+
),
28+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 3.2.24 on 2024-09-15 14:14
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('content', '0021_auto_20240612_1847'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='file',
15+
name='extension',
16+
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),
17+
),
18+
migrations.AlterField(
19+
model_name='localfile',
20+
name='extension',
21+
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),
22+
),
23+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 3.2.24 on 2024-06-12 18:47
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('kolibri_public', '0003_alter_file_preset'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='file',
15+
name='preset',
16+
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),
17+
),
18+
migrations.AlterField(
19+
model_name='localfile',
20+
name='extension',
21+
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),
22+
),
23+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.24 on 2024-09-15 14:14
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('kolibri_public', '0004_auto_20240612_1847'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='localfile',
15+
name='extension',
16+
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),
17+
),
18+
]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jsonschema==4.17.3
155155
# via -r requirements.in
156156
kombu==5.2.4
157157
# via celery
158-
le-utils==0.2.5
158+
le-utils==0.2.7
159159
# via -r requirements.in
160160
packaging==24.0
161161
# via

0 commit comments

Comments
 (0)