Merge pull request #3765 from alfonso-salces/MOBILE-4191
MOBILE-4191 scorm: Check scormstandard to change CMI_STRING_256main
commit
5ba622a999
|
@ -25,8 +25,8 @@ import {
|
|||
} from '../services/scorm';
|
||||
|
||||
// Standard Data Type Definition.
|
||||
const CMI_STRING_256 = '^[\\u0000-\\uFFFF]{0,64000}$';
|
||||
const CMI_STRING_4096 = '^[\\u0000-\\uFFFF]{0,64000}$';
|
||||
let CMI_STRING_256 = '^[\\u0000-\\uFFFF]{0,255}$';
|
||||
let CMI_STRING_4096 = '^[\\u0000-\\uFFFF]{0,4096}$';
|
||||
const CMI_TIME = '^([0-2]{1}[0-9]{1}):([0-5]{1}[0-9]{1}):([0-5]{1}[0-9]{1})(.[0-9]{1,2})?$';
|
||||
const CMI_TIMESPAN = '^([0-9]{2,4}):([0-9]{2}):([0-9]{2})(.[0-9]{1,2})?$';
|
||||
const CMI_INTEGER = '^\\d+$'; // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
|
@ -255,6 +255,11 @@ export class AddonModScormDataModel12 {
|
|||
* @param userData The user default data.
|
||||
*/
|
||||
protected init(userData: AddonModScormUserDataMap): void {
|
||||
if (!this.scorm.scormStandard) {
|
||||
CMI_STRING_256 = '^[\\u0000-\\uFFFF]{0,64000}$';
|
||||
CMI_STRING_4096 = CMI_STRING_256;
|
||||
}
|
||||
|
||||
// Prepare the definition array containing the default values.
|
||||
for (const scoId in userData) {
|
||||
const sco = userData[scoId];
|
||||
|
|
|
@ -1124,6 +1124,12 @@ export class AddonModScormProvider {
|
|||
currentScorm.warningMessage = warning?.message;
|
||||
}
|
||||
|
||||
const scormOptions = CoreUtils.objectToKeyValueMap(response.options, 'name', 'value');
|
||||
|
||||
if (scormOptions.scormstandard) {
|
||||
currentScorm.scormStandard = Number(scormOptions.scormstandard);
|
||||
}
|
||||
|
||||
currentScorm.moduleurl = options.moduleUrl;
|
||||
|
||||
return currentScorm;
|
||||
|
@ -1865,10 +1871,19 @@ export type AddonModScormGetScormsByCoursesWSParams = {
|
|||
* Data returned by mod_scorm_get_scorms_by_courses WS.
|
||||
*/
|
||||
export type AddonModScormGetScormsByCoursesWSResponse = {
|
||||
options: AddonModScormOptions[];
|
||||
scorms: AddonModScormScormWSData[];
|
||||
warnings?: CoreWSExternalWarning[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Scorm options returned by mod_scorm_get_scorms_by_courses WS.
|
||||
*/
|
||||
export type AddonModScormOptions = {
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scorm data returned by mod_scorm_get_scorms_by_courses WS.
|
||||
*/
|
||||
|
@ -1931,6 +1946,7 @@ export type AddonModScormScormWSData = {
|
|||
export type AddonModScormScorm = AddonModScormScormWSData & {
|
||||
warningMessage?: string;
|
||||
moduleurl?: string;
|
||||
scormStandard?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue