commit
						aebbe3365c
					
				@ -426,6 +426,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        this.eolData = data.data;
 | 
			
		||||
        this.messages = this.messages.concat(data.messages);
 | 
			
		||||
        this.processData = undefined;
 | 
			
		||||
        this.endTime = undefined;
 | 
			
		||||
 | 
			
		||||
        CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'lesson' });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -128,7 +128,7 @@
 | 
			
		||||
                            <ng-container *ngIf="page.isQuestion">
 | 
			
		||||
                                <!-- 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"
 | 
			
		||||
                                    [ngClass]="{'addon-mod_lesson-highlight': answer[0].highlight}">
 | 
			
		||||
                                    <ion-label>
 | 
			
		||||
@ -138,12 +138,15 @@
 | 
			
		||||
                                                [courseId]="courseId">
 | 
			
		||||
                                            </core-format-text>
 | 
			
		||||
                                        </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"
 | 
			
		||||
                                                [text]="answer[1]" contextLevel="module" [contextInstanceId]="lesson?.coursemodule"
 | 
			
		||||
                                                [courseId]="courseId">
 | 
			
		||||
                                            </core-format-text>
 | 
			
		||||
                                        </ion-badge>
 | 
			
		||||
                                        <ion-badge *ngIf="answer[0].successBadge" color="success" class="addon-mod_lesson-answer-success">
 | 
			
		||||
                                            {{ answer[0].successBadge }}
 | 
			
		||||
                                        </ion-badge>
 | 
			
		||||
                                    </ion-label>
 | 
			
		||||
                                    <ion-checkbox [attr.name]="answer[0].name" [ngModel]="answer[0].checked" [disabled]="true" slot="end">
 | 
			
		||||
                                    </ion-checkbox>
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,5 @@
 | 
			
		||||
@import "~theme/globals";
 | 
			
		||||
 | 
			
		||||
:host {
 | 
			
		||||
    .button-disabled {
 | 
			
		||||
        opacity: 0.4;
 | 
			
		||||
@ -14,4 +16,8 @@
 | 
			
		||||
    .item-interactive-disabled ion-label {
 | 
			
		||||
        opacity: 0.5;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .addon-mod_lesson-answer-success {
 | 
			
		||||
        @include margin-horizontal(4px, null);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -461,25 +461,28 @@ export class AddonModLessonHelperProvider {
 | 
			
		||||
        const element = CoreDomUtils.convertToElement(html);
 | 
			
		||||
 | 
			
		||||
        // 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) {
 | 
			
		||||
            // Truefalse or multichoice.
 | 
			
		||||
            const successBadge = element.querySelector<HTMLElement>('.badge.badge-success');
 | 
			
		||||
            const data: AddonModLessonCheckboxAnswerData = {
 | 
			
		||||
                isCheckbox: true,
 | 
			
		||||
                checked: !!input.checked,
 | 
			
		||||
                name: input.name,
 | 
			
		||||
                highlight: !!element.querySelector('.highlight'),
 | 
			
		||||
                content: '',
 | 
			
		||||
                successBadge: successBadge?.innerText,
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            input.remove();
 | 
			
		||||
            successBadge?.remove();
 | 
			
		||||
            data.content = element.innerHTML.trim();
 | 
			
		||||
 | 
			
		||||
            return data;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 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) {
 | 
			
		||||
            // Short answer or numeric.
 | 
			
		||||
            return {
 | 
			
		||||
@ -700,6 +703,7 @@ export type AddonModLessonCheckboxAnswerData = {
 | 
			
		||||
    name: string;
 | 
			
		||||
    highlight: boolean;
 | 
			
		||||
    content: string;
 | 
			
		||||
    successBadge?: string;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -606,6 +606,7 @@ Feature: Test attempts and grading settings of SCORM activity in app
 | 
			
		||||
    And I press the back button 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
 | 
			
		||||
    Given the following "activities" exist:
 | 
			
		||||
      | activity | name          | course | idnumber | packagefilepath                             | maxattempt | whatgrade | grademethod | forcenewattempt |
 | 
			
		||||
 | 
			
		||||
@ -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     | Future SCORM  | mod/scorm/tests/packages/singlesco_scorm12.zip | ##tomorrow##  | ##+2 days##   |
 | 
			
		||||
 | 
			
		||||
  @lms_from4.1
 | 
			
		||||
  Scenario: Only open SCORMs can be played
 | 
			
		||||
    Given I entered the course "Course 1" as "student1" in the app
 | 
			
		||||
    When I press "Past SCORM" in the app
 | 
			
		||||
 | 
			
		||||
@ -223,6 +223,7 @@ Feature: Test basic usage of SCORM activity in app
 | 
			
		||||
      | activity | name        | course | idnumber | packagefilepath                                               |
 | 
			
		||||
      | 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 change viewport size to "1200x640" in the app
 | 
			
		||||
    When I press "Basic SCORM" in the app
 | 
			
		||||
    And I press "Enter" 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"
 | 
			
		||||
    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 "user" to "Student student"
 | 
			
		||||
    And I press "Get these logs"
 | 
			
		||||
 | 
			
		||||
@ -232,7 +232,7 @@ export class CoreIframeUtilsProvider {
 | 
			
		||||
     */
 | 
			
		||||
    getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } {
 | 
			
		||||
        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.
 | 
			
		||||
            return { window: null, document: null };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user