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 6eb2bd69b7..a95ed0ab46 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,13 @@ describe('fileUpload', () => { }); describe('computed', () => { it('should map the files to the correct presets', () => { - 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); + expect(wrapper.vm.primaryFileMapping.find(m => m.preset.id === 'epub').file.id).toBe( + 'file-3' + ); + expect(wrapper.vm.primaryFileMapping.find(m => m.preset.id === 'document').file.id).toBe( + 'file-1' + ); + expect(wrapper.vm.primaryFileMapping).toHaveLength(4); }); it('should disallow file removal if there is only one primary file', () => { const testFiles2 = [ diff --git a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js index a5897d1902..e75e2be73f 100644 --- a/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js +++ b/contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js @@ -45,7 +45,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'audio', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -58,7 +58,7 @@ const FormatPresetsMap = new Map([ thumbnail: false, subtitle: false, display: true, - order: 1, + order: 3, kind_id: 'document', allowed_formats: ['bloompub', 'bloomd'], associated_mimetypes: ['application/bloompub+zip'], @@ -77,7 +77,7 @@ const FormatPresetsMap = new Map([ order: 0, kind_id: null, allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -106,10 +106,10 @@ const FormatPresetsMap = new Map([ thumbnail: true, subtitle: false, display: true, - order: 3, + order: 4, kind_id: 'document', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -173,7 +173,7 @@ const FormatPresetsMap = new Map([ order: 3, kind_id: 'exercise', allowed_formats: ['png', 'jpg', 'jpeg', 'gif', 'svg'], - associated_mimetypes: ['image/png', 'image/jpeg', 'image/svg', 'image/gif'], + associated_mimetypes: ['image/jpeg', 'image/gif', 'image/png', 'image/svg'], }, ], [ @@ -189,7 +189,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'exercise', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -221,7 +221,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'h5p', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -237,7 +237,7 @@ const FormatPresetsMap = new Map([ order: 1, kind_id: 'video', allowed_formats: ['mp4', 'webm'], - associated_mimetypes: ['video/webm', 'video/mp4'], + associated_mimetypes: ['video/mp4', 'video/webm'], }, ], [ @@ -269,7 +269,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'html5', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -304,6 +304,22 @@ const FormatPresetsMap = new Map([ associated_mimetypes: ['.zip'], }, ], + [ + 'kpub', + { + id: 'kpub', + readable_name: 'Kolibri HTML5 Article', + multi_language: false, + supplementary: false, + thumbnail: false, + subtitle: false, + display: true, + order: 1, + kind_id: 'document', + allowed_formats: ['kpub'], + associated_mimetypes: ['application/kpub+zip'], + }, + ], [ 'low_res_video', { @@ -317,7 +333,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'video', allowed_formats: ['mp4', 'webm'], - associated_mimetypes: ['video/webm', 'video/mp4'], + associated_mimetypes: ['video/mp4', 'video/webm'], }, ], [ @@ -349,7 +365,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'exercise', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -365,7 +381,7 @@ const FormatPresetsMap = new Map([ order: 3, kind_id: 'slideshow', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -397,7 +413,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'slideshow', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -413,7 +429,7 @@ const FormatPresetsMap = new Map([ order: 1, kind_id: 'topic', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -429,7 +445,7 @@ const FormatPresetsMap = new Map([ order: 3, kind_id: 'video', allowed_formats: ['mp4', 'webm'], - associated_mimetypes: ['video/webm', 'video/mp4'], + associated_mimetypes: ['video/mp4', 'video/webm'], }, ], [ @@ -461,7 +477,7 @@ const FormatPresetsMap = new Map([ order: 3, kind_id: 'video', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], [ @@ -493,7 +509,7 @@ const FormatPresetsMap = new Map([ order: 2, kind_id: 'zim', allowed_formats: ['png', 'jpg', 'jpeg'], - associated_mimetypes: ['image/png', 'image/jpeg'], + associated_mimetypes: ['image/jpeg', 'image/png'], }, ], ]); @@ -522,6 +538,7 @@ export const FormatPresetsNames = { HTML5_THUMBNAIL: 'html5_thumbnail', HTML5_ZIP: 'html5_zip', IMSCP_ZIP: 'imscp_zip', + KPUB: 'kpub', LOW_RES_VIDEO: 'low_res_video', QTI: 'qti', QTI_THUMBNAIL: 'qti_thumbnail', diff --git a/contentcuration/contentcuration/frontend/shared/leUtils/Languages.js b/contentcuration/contentcuration/frontend/shared/leUtils/Languages.js index a3b5373ea2..32365b7132 100644 --- a/contentcuration/contentcuration/frontend/shared/leUtils/Languages.js +++ b/contentcuration/contentcuration/frontend/shared/leUtils/Languages.js @@ -100,10 +100,10 @@ const LanguagesMap = new Map([ }, ], [ - 'ig', + 'ibo', { - id: 'ig', - lang_code: 'ig', + id: 'ibo', + lang_code: 'ibo', lang_subcode: null, readable_name: 'Igbo', native_name: 'As\u1ee5s\u1ee5 Igbo', @@ -111,10 +111,10 @@ const LanguagesMap = new Map([ }, ], [ - 'ibo', + 'ig', { - id: 'ibo', - lang_code: 'ibo', + id: 'ig', + lang_code: 'ig', lang_subcode: null, readable_name: 'Igbo', native_name: 'As\u1ee5s\u1ee5 Igbo', @@ -143,6 +143,17 @@ const LanguagesMap = new Map([ lang_direction: 'ltr', }, ], + [ + 'bog', + { + id: 'bog', + lang_code: 'bog', + lang_subcode: null, + readable_name: 'Bamako Sign Language', + native_name: 'Bamako Sign Language', + lang_direction: 'ltr', + }, + ], [ 'su', { @@ -903,10 +914,10 @@ const LanguagesMap = new Map([ }, ], [ - 'ln', + 'lin', { - id: 'ln', - lang_code: 'ln', + id: 'lin', + lang_code: 'lin', lang_subcode: null, readable_name: 'Lingala', native_name: 'Ling\u00e1la', @@ -914,10 +925,10 @@ const LanguagesMap = new Map([ }, ], [ - 'lin', + 'ln', { - id: 'lin', - lang_code: 'lin', + id: 'ln', + lang_code: 'ln', lang_subcode: null, readable_name: 'Lingala', native_name: 'Ling\u00e1la', @@ -1012,6 +1023,17 @@ const LanguagesMap = new Map([ lang_direction: 'ltr', }, ], + [ + 'lws', + { + id: 'lws', + lang_code: 'lws', + lang_subcode: null, + readable_name: 'Malawian Sign Language', + native_name: 'Malawian Sign Language', + lang_direction: 'ltr', + }, + ], [ 'mt', { @@ -1023,6 +1045,17 @@ const LanguagesMap = new Map([ lang_direction: 'ltr', }, ], + [ + 'myk', + { + id: 'myk', + lang_code: 'myk', + lang_subcode: null, + readable_name: 'Mamara Senoufo', + native_name: 'Mamara Senoufo', + lang_direction: 'ltr', + }, + ], [ 'mul', { @@ -1155,6 +1188,17 @@ const LanguagesMap = new Map([ lang_direction: 'ltr', }, ], + [ + 'pgz', + { + id: 'pgz', + lang_code: 'pgz', + lang_subcode: null, + readable_name: 'Papua New Guinean Sign Language', + native_name: 'Papua New Guinean Sign Language', + lang_direction: 'ltr', + }, + ], [ 'pms', { @@ -1310,10 +1354,10 @@ const LanguagesMap = new Map([ }, ], [ - 'st', + 'sot', { - id: 'st', - lang_code: 'st', + id: 'sot', + lang_code: 'sot', lang_subcode: null, readable_name: 'Southern Sotho', native_name: 'Sesotho', @@ -1321,10 +1365,10 @@ const LanguagesMap = new Map([ }, ], [ - 'sot', + 'st', { - id: 'sot', - lang_code: 'sot', + id: 'st', + lang_code: 'st', lang_subcode: null, readable_name: 'Southern Sotho', native_name: 'Sesotho', @@ -1386,6 +1430,17 @@ const LanguagesMap = new Map([ lang_direction: 'ltr', }, ], + [ + 'snk', + { + id: 'snk', + lang_code: 'snk', + lang_subcode: null, + readable_name: 'Soninke', + native_name: 'Soninke', + lang_direction: 'ltr', + }, + ], [ 'som', { @@ -1431,22 +1486,22 @@ const LanguagesMap = new Map([ }, ], [ - 'sv-SE', + 'sv-FI', { - id: 'sv-SE', + id: 'sv-FI', lang_code: 'sv', - lang_subcode: 'SE', + lang_subcode: 'FI', readable_name: 'Swedish', native_name: 'Svenska', lang_direction: 'ltr', }, ], [ - 'sv-FI', + 'sv-SE', { - id: 'sv-FI', + id: 'sv-SE', lang_code: 'sv', - lang_subcode: 'FI', + lang_subcode: 'SE', readable_name: 'Swedish', native_name: 'Svenska', lang_direction: 'ltr', @@ -1464,11 +1519,11 @@ const LanguagesMap = new Map([ }, ], [ - 'be-tara', + 'be-tarask', { - id: 'be-tara', + id: 'be-tarask', lang_code: 'be', - lang_subcode: 'tara', + lang_subcode: 'tarask', readable_name: 'Belarusian, Classical Orthography', native_name: 'Tara\u0161kievica, \u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f \u043a\u043b\u044f\u0441\u044b\u0447\u043d\u044b \u043f\u0440\u0430\u0432\u0430\u043f\u0456\u0441', @@ -2964,37 +3019,80 @@ const LanguagesMap = new Map([ lang_direction: 'ltr', }, ], + [ + 'zh', + { + id: 'zh', + lang_code: 'zh', + lang_subcode: null, + readable_name: 'Chinese', + native_name: '\u4e2d\u6587', + lang_direction: 'ltr', + }, + ], [ 'zh-CN', { id: 'zh-CN', lang_code: 'zh', lang_subcode: 'CN', - readable_name: 'Chinese, Simplified', - native_name: '\u4e2d\u56fd\u5927\u9646', + readable_name: 'Chinese (China)', + native_name: '\u4e2d\u6587\uff08\u4e2d\u56fd\uff09', lang_direction: 'ltr', }, ], [ - 'zh', + 'zh-Hans', { - id: 'zh', + id: 'zh-Hans', lang_code: 'zh', - lang_subcode: null, - readable_name: 'Chinese', - native_name: '\u4e2d\u6587, \u6c49\u8bed, \u6f22\u8a9e', + lang_subcode: 'Hans', + readable_name: 'Chinese (Simplified)', + native_name: '\u4e2d\u6587\uff08\u7b80\u4f53\uff09', lang_direction: 'ltr', }, ], [ - 'ja', + 'zh-Hans-CN', { - id: 'ja', - lang_code: 'ja', - lang_subcode: null, - readable_name: 'Japanese', - native_name: - '\u65e5\u672c\u8a9e (\u306b\u307b\u3093\u3054\uff0f\u306b\u3063\u307d\u3093\u3054)', + id: 'zh-Hans-CN', + lang_code: 'zh', + lang_subcode: 'Hans-CN', + readable_name: 'Chinese (Simplified, China)', + native_name: '\u4e2d\u6587\uff08\u7b80\u4f53\uff0c\u4e2d\u56fd\uff09', + lang_direction: 'ltr', + }, + ], + [ + 'zh-Hans-TW', + { + id: 'zh-Hans-TW', + lang_code: 'zh', + lang_subcode: 'Hans-TW', + readable_name: 'Chinese (Simplified, Taiwan)', + native_name: '\u4e2d\u6587\uff08\u7b80\u4f53\uff0c\u53f0\u6e7e\uff09', + lang_direction: 'ltr', + }, + ], + [ + 'zh-Hant-CN', + { + id: 'zh-Hant-CN', + lang_code: 'zh', + lang_subcode: 'Hant-CN', + readable_name: 'Chinese (Traditional, China)', + native_name: '\u4e2d\u6587\uff08\u7e41\u9ad4, \u4e2d\u570b\uff09', + lang_direction: 'ltr', + }, + ], + [ + 'zh-Hant-TW', + { + id: 'zh-Hant-TW', + lang_code: 'zh', + lang_subcode: 'Hant-TW', + readable_name: 'Chinese (Traditional, Taiwan)', + native_name: '\u4e2d\u6587\uff08\u7e41\u9ad4, \u53f0\u7063\uff09', lang_direction: 'ltr', }, ], @@ -3004,8 +3102,20 @@ const LanguagesMap = new Map([ id: 'zh-Hant', lang_code: 'zh', lang_subcode: 'Hant', - readable_name: 'Chinese, Traditional', - native_name: '\u6f22\u8a9e (\u7e41\u9ad4\u5b57)', + readable_name: 'Chinese (Traditional)', + native_name: '\u4e2d\u6587\uff08\u7e41\u9ad4\uff09', + lang_direction: 'ltr', + }, + ], + [ + 'ja', + { + id: 'ja', + lang_code: 'ja', + lang_subcode: null, + readable_name: 'Japanese', + native_name: + '\u65e5\u672c\u8a9e (\u306b\u307b\u3093\u3054\uff0f\u306b\u3063\u307d\u3093\u3054)', lang_direction: 'ltr', }, ], @@ -3059,10 +3169,11 @@ export const LanguagesNames = { RSN: 'rsn', AN: 'an', EN_PT: 'en-PT', - IG: 'ig', IBO: 'ibo', + IG: 'ig', GN: 'gn', ID: 'id', + BOG: 'bog', SU: 'su', BI: 'bi', BRH: 'brh', @@ -3132,8 +3243,8 @@ export const LanguagesNames = { LKT: 'lkt', BMA: 'bma', LI: 'li', - LN: 'ln', LIN: 'lin', + LN: 'ln', LUA: 'lua', LU: 'lu', LG: 'lg', @@ -3142,7 +3253,9 @@ export const LanguagesNames = { LB: 'lb', HU: 'hu', MG: 'mg', + LWS: 'lws', MT: 'mt', + MYK: 'myk', MUL: 'mul', NL: 'nl', TUV: 'tuv', @@ -3155,6 +3268,7 @@ export const LanguagesNames = { IE: 'ie', HZ: 'hz', NG: 'ng', + PGZ: 'pgz', PMS: 'pms', FIL: 'fil', PL: 'pl', @@ -3169,21 +3283,22 @@ export const LanguagesNames = { SCO: 'sco', SRR: 'srr', NSO: 'nso', - ST: 'st', SOT: 'sot', + ST: 'st', TN: 'tn', TSN: 'tsn', SQ: 'sq', SS: 'ss', SID: 'sid', + SNK: 'snk', SOM: 'som', SO: 'so', BCC: 'bcc', PBT: 'pbt', - SV_SE: 'sv-SE', SV_FI: 'sv-FI', + SV_SE: 'sv-SE', XKI: 'xki', - BE_TARA: 'be-tara', + BE_TARASK: 'be-tarask', VI: 'vi', TPI: 'tpi', VE: 've', @@ -3318,10 +3433,15 @@ export const LanguagesNames = { OJI: 'oji', CR: 'cr', KM: 'km', - ZH_CN: 'zh-CN', ZH: 'zh', - JA: 'ja', + ZH_CN: 'zh-CN', + ZH_HANS: 'zh-Hans', + ZH_HANS_CN: 'zh-Hans-CN', + ZH_HANS_TW: 'zh-Hans-TW', + ZH_HANT_CN: 'zh-Hant-CN', + ZH_HANT_TW: 'zh-Hant-TW', ZH_HANT: 'zh-Hant', + JA: 'ja', ZH_TW: 'zh-TW', II: 'ii', KO: 'ko',