Merge pull request #3814 from dpalou/MOBILE-4362

Mobile 4362
main
Noel De Martin 2023-10-10 18:00:50 +02:00 committed by GitHub
commit aebbe3365c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 6 deletions

View File

@ -426,6 +426,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
this.eolData = data.data; this.eolData = data.data;
this.messages = this.messages.concat(data.messages); this.messages = this.messages.concat(data.messages);
this.processData = undefined; this.processData = undefined;
this.endTime = undefined;
CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'lesson' }); CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'lesson' });

View File

@ -128,7 +128,7 @@
<ng-container *ngIf="page.isQuestion"> <ng-container *ngIf="page.isQuestion">
<!-- Question page, show the right input for the answer. --> <!-- Question page, show the right input for the answer. -->
<!-- Truefalse or matching. --> <!-- Truefalse or multichoice. -->
<ion-item class="ion-text-wrap" *ngIf="answer[0].isCheckbox" <ion-item class="ion-text-wrap" *ngIf="answer[0].isCheckbox"
[ngClass]="{'addon-mod_lesson-highlight': answer[0].highlight}"> [ngClass]="{'addon-mod_lesson-highlight': answer[0].highlight}">
<ion-label> <ion-label>
@ -138,12 +138,15 @@
[courseId]="courseId"> [courseId]="courseId">
</core-format-text> </core-format-text>
</p> </p>
<ion-badge *ngIf="answer[1]" color="dark"> <ion-badge *ngIf="answer[1]" color="dark" class="addon-mod_lesson-answer-stats">
<core-format-text [component]="component" [componentId]="lesson?.coursemodule" <core-format-text [component]="component" [componentId]="lesson?.coursemodule"
[text]="answer[1]" contextLevel="module" [contextInstanceId]="lesson?.coursemodule" [text]="answer[1]" contextLevel="module" [contextInstanceId]="lesson?.coursemodule"
[courseId]="courseId"> [courseId]="courseId">
</core-format-text> </core-format-text>
</ion-badge> </ion-badge>
<ion-badge *ngIf="answer[0].successBadge" color="success" class="addon-mod_lesson-answer-success">
{{ answer[0].successBadge }}
</ion-badge>
</ion-label> </ion-label>
<ion-checkbox [attr.name]="answer[0].name" [ngModel]="answer[0].checked" [disabled]="true" slot="end"> <ion-checkbox [attr.name]="answer[0].name" [ngModel]="answer[0].checked" [disabled]="true" slot="end">
</ion-checkbox> </ion-checkbox>

View File

@ -1,3 +1,5 @@
@import "~theme/globals";
:host { :host {
.button-disabled { .button-disabled {
opacity: 0.4; opacity: 0.4;
@ -14,4 +16,8 @@
.item-interactive-disabled ion-label { .item-interactive-disabled ion-label {
opacity: 0.5; opacity: 0.5;
} }
.addon-mod_lesson-answer-success {
@include margin-horizontal(4px, null);
}
} }

View File

@ -461,25 +461,28 @@ export class AddonModLessonHelperProvider {
const element = CoreDomUtils.convertToElement(html); const element = CoreDomUtils.convertToElement(html);
// Check if it has a checkbox. // Check if it has a checkbox.
let input = <HTMLInputElement> element.querySelector('input[type="checkbox"][name*="answer"]'); let input = element.querySelector<HTMLInputElement>('input[type="checkbox"][name*="answer"]');
if (input) { if (input) {
// Truefalse or multichoice. // Truefalse or multichoice.
const successBadge = element.querySelector<HTMLElement>('.badge.badge-success');
const data: AddonModLessonCheckboxAnswerData = { const data: AddonModLessonCheckboxAnswerData = {
isCheckbox: true, isCheckbox: true,
checked: !!input.checked, checked: !!input.checked,
name: input.name, name: input.name,
highlight: !!element.querySelector('.highlight'), highlight: !!element.querySelector('.highlight'),
content: '', content: '',
successBadge: successBadge?.innerText,
}; };
input.remove(); input.remove();
successBadge?.remove();
data.content = element.innerHTML.trim(); data.content = element.innerHTML.trim();
return data; return data;
} }
// Check if it has an input text or number. // Check if it has an input text or number.
input = <HTMLInputElement> element.querySelector('input[type="number"],input[type="text"]'); input = element.querySelector<HTMLInputElement>('input[type="number"],input[type="text"]');
if (input) { if (input) {
// Short answer or numeric. // Short answer or numeric.
return { return {
@ -700,6 +703,7 @@ export type AddonModLessonCheckboxAnswerData = {
name: string; name: string;
highlight: boolean; highlight: boolean;
content: string; content: string;
successBadge?: string;
}; };
/** /**

View File

@ -606,6 +606,7 @@ Feature: Test attempts and grading settings of SCORM activity in app
And I press the back button in the app And I press the back button in the app
Then I should find "74%" within "Grade reported" "ion-item" in the app Then I should find "74%" within "Grade reported" "ion-item" in the app
@lms_from4.1
Scenario: SCORM grade is calculated right based on 'Attempts grading' setting Scenario: SCORM grade is calculated right based on 'Attempts grading' setting
Given the following "activities" exist: Given the following "activities" exist:
| activity | name | course | idnumber | packagefilepath | maxattempt | whatgrade | grademethod | forcenewattempt | | activity | name | course | idnumber | packagefilepath | maxattempt | whatgrade | grademethod | forcenewattempt |

View File

@ -20,6 +20,7 @@ Feature: Test availability options of SCORM activity in app
| scorm | C1 | Current SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##yesterday## | ##tomorrow## | | scorm | C1 | Current SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##yesterday## | ##tomorrow## |
| scorm | C1 | Future SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##tomorrow## | ##+2 days## | | scorm | C1 | Future SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##tomorrow## | ##+2 days## |
@lms_from4.1
Scenario: Only open SCORMs can be played Scenario: Only open SCORMs can be played
Given I entered the course "Course 1" as "student1" in the app Given I entered the course "Course 1" as "student1" in the app
When I press "Past SCORM" in the app When I press "Past SCORM" in the app

View File

@ -223,6 +223,7 @@ Feature: Test basic usage of SCORM activity in app
| activity | name | course | idnumber | packagefilepath | | activity | name | course | idnumber | packagefilepath |
| scorm | Basic SCORM | C1 | scorm | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip | | scorm | Basic SCORM | C1 | scorm | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip |
And I entered the course "Course 1" as "student1" in the app And I entered the course "Course 1" as "student1" in the app
And I change viewport size to "1200x640" in the app
When I press "Basic SCORM" in the app When I press "Basic SCORM" in the app
And I press "Enter" in the app And I press "Enter" in the app
And I press "Disable fullscreen" in the app And I press "Disable fullscreen" in the app
@ -230,7 +231,7 @@ Feature: Test basic usage of SCORM activity in app
When I open a browser tab with url "$WWWROOT" When I open a browser tab with url "$WWWROOT"
And I log in as "admin" And I log in as "admin"
And I am on the "System logs report" page And I navigate to "Reports > Reports > Logs" in site administration
And I set the field "id" to "Course 1" And I set the field "id" to "Course 1"
And I set the field "user" to "Student student" And I set the field "user" to "Student student"
And I press "Get these logs" And I press "Get these logs"

View File

@ -232,7 +232,7 @@ export class CoreIframeUtilsProvider {
*/ */
getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } { getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } {
const src = 'src' in element ? element.src : element.data; const src = 'src' in element ? element.src : element.data;
if (!CoreUrlUtils.isLocalFileUrl(src)) { if (src !== 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src)) {
// No permissions to access the iframe. // No permissions to access the iframe.
return { window: null, document: null }; return { window: null, document: null };
} }