Skip to content

Commit 91843ba

Browse files
authored
Merge pull request #4289 from crazyserver/MOBILE-4690
Mobile 4690
2 parents d83fa5c + 91108ae commit 91843ba

File tree

73 files changed

+788
-631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+788
-631
lines changed

scripts/langindex.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,22 @@
11481148
"addon.privatefiles.files": "moodle",
11491149
"addon.privatefiles.privatefiles": "moodle",
11501150
"addon.privatefiles.sitefiles": "moodle",
1151+
"addon.qtype_ddimageortext.pleasedraganimagetoeachdropregion": "qtype_ddimageortext",
1152+
"addon.qtype_ddmarker.pleasedragatleastonemarker": "qtype_ddmarker",
11511153
"addon.qtype_essay.maxwordlimitboundary": "qtype_essay",
11521154
"addon.qtype_essay.minwordlimitboundary": "qtype_essay",
1155+
"addon.qtype_gapselect.pleaseputananswerineachbox": "qtype_gapselect",
1156+
"addon.qtype_match.pleaseananswerallparts": "qtype_match",
1157+
"addon.qtype_multianswer.pleaseananswerallparts": "qtype_multianswer",
1158+
"addon.qtype_multichoice.pleaseselectananswer": "qtype_multichoice",
1159+
"addon.qtype_multichoice.pleaseselectatleastoneanswer": "qtype_multichoice",
1160+
"addon.qtype_numerical.invalidnumber": "qtype_numerical",
1161+
"addon.qtype_numerical.invalidnumbernounit": "qtype_numerical",
1162+
"addon.qtype_numerical.pleaseenterananswer": "qtype_numerical",
1163+
"addon.qtype_numerical.unitnotselected": "qtype_numerical",
11531164
"addon.qtype_ordering.moved": "qtype_ordering",
1165+
"addon.qtype_shortanswer.pleaseenterananswer": "qtype_shortanswer",
1166+
"addon.qtype_truefalse.pleaseselectananswer": "qtype_truefalse",
11541167
"addon.report_insights.actionsaved": "report_insights",
11551168
"addon.report_insights.fixedack": "analytics",
11561169
"addon.report_insights.incorrectlyflagged": "analytics",

src/addons/mod/book/pages/contents/contents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1>
1010
</ion-title>
1111
<ion-buttons slot="end">
1212
<ion-button (click)="showToc()" [ariaLabel]="'addon.mod_book.toc' | translate" aria-haspopup="true" *ngIf="loaded">
13-
<ion-icon name="fas-bookmark" slot="icon-only" aria-hidden="true" />
13+
<ion-icon name="fas-list-ul" slot="icon-only" aria-hidden="true" />
1414
</ion-button>
1515
</ion-buttons>
1616
</ion-toolbar>
133 Bytes
Loading

src/addons/mod/imscp/pages/view/view.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1>
1111

1212
<ion-buttons slot="end">
1313
<ion-button *ngIf="loaded" (click)="showToc()" aria-haspopup="true" [ariaLabel]="'addon.mod_imscp.toc' | translate">
14-
<ion-icon name="fas-bookmark" slot="icon-only" aria-hidden="true" />
14+
<ion-icon name="fas-list-ul" slot="icon-only" aria-hidden="true" />
1515
</ion-button>
1616
</ion-buttons>
1717
</ion-toolbar>

src/addons/mod/lesson/pages/player/player.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1>
1111
<ion-buttons slot="end">
1212
<ion-button fill="clear" *ngIf="displayMenu || mediaFile" [ariaLabel]="'addon.mod_lesson.lessonmenu' | translate"
1313
(click)="showMenu()">
14-
<ion-icon name="fas-bookmark" slot="icon-only" aria-hidden="true" />
14+
<ion-icon name="fas-list-ul" slot="icon-only" aria-hidden="true" />
1515
</ion-button>
1616
</ion-buttons>
1717
</ion-toolbar>

src/addons/mod/quiz/accessrules/password/services/handlers/password.ts

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
3232
ruleName = 'quizaccess_password';
3333

3434
/**
35-
* Add preflight data that doesn't require user interaction. The data should be added to the preflightData param.
36-
*
37-
* @param quiz The quiz the rule belongs to.
38-
* @param preflightData Object where to add the preflight data.
39-
* @param attempt The attempt started/continued. If not supplied, user is starting a new attempt.
40-
* @param prefetch Whether the user is prefetching the quiz.
41-
* @param siteId Site ID. If not defined, current site.
42-
* @returns Promise resolved when done if async, void if it's synchronous.
35+
* @inheritdoc
4336
*/
4437
async getFixedPreflightData(
4538
quiz: AddonModQuizQuizWSData,
@@ -76,33 +69,21 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
7669
}
7770

7871
/**
79-
* Return the Component to use to display the access rule preflight.
80-
* Implement this if your access rule requires a preflight check with user interaction.
81-
* It's recommended to return the class of the component, but you can also return an instance of the component.
82-
*
83-
* @returns The component (or promise resolved with component) to use, undefined if not found.
72+
* @inheritdoc
8473
*/
8574
getPreflightComponent(): Type<unknown> | Promise<Type<unknown>> {
8675
return AddonModQuizAccessPasswordComponent;
8776
}
8877

8978
/**
90-
* Whether or not the handler is enabled on a site level.
91-
*
92-
* @returns True or promise resolved with true if enabled.
79+
* @inheritdoc
9380
*/
9481
async isEnabled(): Promise<boolean> {
9582
return true;
9683
}
9784

9885
/**
99-
* Whether the rule requires a preflight check when prefetch/start/continue an attempt.
100-
*
101-
* @param quiz The quiz the rule belongs to.
102-
* @param attempt The attempt started/continued. If not supplied, user is starting a new attempt.
103-
* @param prefetch Whether the user is prefetching the quiz.
104-
* @param siteId Site ID. If not defined, current site.
105-
* @returns Whether the rule requires a preflight check.
86+
* @inheritdoc
10687
*/
10788
async isPreflightCheckRequired(
10889
quiz: AddonModQuizQuizWSData,
@@ -117,14 +98,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
11798
}
11899

119100
/**
120-
* Function called when the preflight check has passed. This is a chance to record that fact in some way.
121-
*
122-
* @param quiz The quiz the rule belongs to.
123-
* @param attempt The attempt started/continued.
124-
* @param preflightData Preflight data gathered.
125-
* @param prefetch Whether the user is prefetching the quiz.
126-
* @param siteId Site ID. If not defined, current site.
127-
* @returns Promise resolved when done if async, void if it's synchronous.
101+
* @inheritdoc
128102
*/
129103
async notifyPreflightCheckPassed(
130104
quiz: AddonModQuizQuizWSData,
@@ -135,37 +109,29 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
135109
): Promise<void> {
136110
// The password is right, store it to use it automatically in following executions.
137111
if (preflightData.quizpassword !== undefined) {
138-
return this.storePassword(quiz.id, preflightData.quizpassword, siteId);
112+
await this.storePassword(quiz.id, preflightData.quizpassword, siteId);
139113
}
140114
}
141115

142116
/**
143-
* Function called when the preflight check fails. This is a chance to record that fact in some way.
144-
*
145-
* @param quiz The quiz the rule belongs to.
146-
* @param attempt The attempt started/continued.
147-
* @param preflightData Preflight data gathered.
148-
* @param prefetch Whether the user is prefetching the quiz.
149-
* @param siteId Site ID. If not defined, current site.
150-
* @returns Promise resolved when done if async, void if it's synchronous.
117+
* @inheritdoc
151118
*/
152-
notifyPreflightCheckFailed?(
119+
async notifyPreflightCheckFailed?(
153120
quiz: AddonModQuizQuizWSData,
154121
attempt: AddonModQuizAttemptWSData | undefined,
155122
preflightData: Record<string, string>,
156123
prefetch?: boolean,
157124
siteId?: string,
158125
): Promise<void> {
159126
// The password is wrong, remove it from DB if it's there.
160-
return this.removePassword(quiz.id, siteId);
127+
await this.removePassword(quiz.id, siteId);
161128
}
162129

163130
/**
164131
* Remove a password from DB.
165132
*
166133
* @param quizId Quiz ID.
167134
* @param siteId Site ID. If not defined, current site.
168-
* @returns Promise resolved when done.
169135
*/
170136
protected async removePassword(quizId: number, siteId?: string): Promise<void> {
171137
const site = await CoreSites.getSite(siteId);
@@ -179,7 +145,6 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
179145
* @param quizId Quiz ID.
180146
* @param password Password.
181147
* @param siteId Site ID. If not defined, current site.
182-
* @returns Promise resolved when done.
183148
*/
184149
protected async storePassword(quizId: number, password: string, siteId?: string): Promise<void> {
185150
const site = await CoreSites.getSite(siteId);

src/addons/mod/quiz/components/index/index.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
130130

131131
/**
132132
* Attempt the quiz.
133-
*
134-
* @returns Promise resolved when done.
135133
*/
136134
async attemptQuiz(): Promise<void> {
137135
if (this.showStatusSpinner || !this.quiz) {
@@ -141,7 +139,9 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
141139

142140
if (!AddonModQuiz.isQuizOffline(this.quiz)) {
143141
// Quiz isn't offline, just open it.
144-
return this.openQuiz();
142+
this.openQuiz();
143+
144+
return;
145145
}
146146

147147
// Quiz supports offline, check if it needs to be downloaded.
@@ -150,7 +150,9 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
150150

151151
if (isDownloaded) {
152152
// Already downloaded, open it.
153-
return this.openQuiz();
153+
this.openQuiz();
154+
155+
return;
154156
}
155157

156158
// Prefetch the quiz.
@@ -242,7 +244,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
242244
* Get the user attempts in the quiz and the result info.
243245
*
244246
* @param quiz Quiz instance.
245-
* @returns Promise resolved when done.
246247
*/
247248
protected async getAttempts(
248249
quiz: AddonModQuizQuizData,
@@ -326,7 +327,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
326327
* Get result info to show.
327328
*
328329
* @param quiz Quiz.
329-
* @returns Promise resolved when done.
330330
*/
331331
protected async getResultInfo(quiz: AddonModQuizQuizData): Promise<void> {
332332
if (!this.attempts.length || !quiz.showAttemptsGrades || !this.bestGrade?.hasgrade ||
@@ -382,8 +382,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
382382

383383
/**
384384
* Go to review an attempt that has just been finished.
385-
*
386-
* @returns Promise resolved when done.
387385
*/
388386
protected async goToAutoReview(attempts: AddonModQuizAttemptWSData[]): Promise<void> {
389387
if (!this.autoReview) {
@@ -505,10 +503,10 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
505503
/**
506504
* Open a quiz to attempt it.
507505
*/
508-
protected openQuiz(): void {
506+
protected async openQuiz(): Promise<void> {
509507
this.hasPlayed = true;
510508

511-
CoreNavigator.navigateToSitePath(
509+
await CoreNavigator.navigateToSitePath(
512510
`${ADDON_MOD_QUIZ_PAGE_NAME}/${this.courseId}/${this.module.id}/player`,
513511
{
514512
params: {
@@ -554,7 +552,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
554552
* @param quiz Quiz data.
555553
* @param accessInfo Quiz access information.
556554
* @param attempts The attempts to treat.
557-
* @returns Promise resolved when done.
555+
* @returns Formatted attempts.
558556
*/
559557
protected async treatAttempts(
560558
quiz: AddonModQuizQuizData,
@@ -630,8 +628,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
630628

631629
/**
632630
* Get quiz grade data.
633-
*
634-
* @returns Promise resolved when done.
635631
*/
636632
protected async getQuizGrade(): Promise<void> {
637633
try {
@@ -656,8 +652,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
656652

657653
/**
658654
* Go to page to review the attempt.
659-
*
660-
* @returns Promise resolved when done.
661655
*/
662656
async reviewAttempt(attemptId: number): Promise<void> {
663657
await CoreNavigator.navigateToSitePath(

src/addons/mod/quiz/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,11 @@ export const enum AddonModQuizDisplayOptionsAttemptStates {
5454
LATER_WHILE_OPEN = 0x00100,
5555
AFTER_CLOSE = 0x00010,
5656
}
57+
58+
/**
59+
* Possible navigation methods for a quiz.
60+
*/
61+
export const enum AddonModQuizNavMethods {
62+
FREE = 'free',
63+
SEQ = 'sequential',
64+
}

src/addons/mod/quiz/pages/player/player.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ <h1>
1515
(click)="showConnectionError($event)" [ariaLabel]="'addon.mod_quiz.connectionerror' | translate" aria-haspopup="dialog">
1616
<ion-icon name="fas-circle-exclamation" slot="icon-only" aria-hidden="true" />
1717
</ion-button>
18-
<ion-button *ngIf="navigation.length && !showSummary" [ariaLabel]="'addon.mod_quiz.opentoc' | translate"
18+
<ion-button *ngIf="attemptSummary.length && !showSummary" [ariaLabel]="'addon.mod_quiz.opentoc' | translate"
1919
(click)="openNavigation()">
20-
<ion-icon name="fas-bookmark" slot="icon-only" aria-hidden="true" />
20+
<ion-icon name="fas-list-ul" slot="icon-only" aria-hidden="true" />
2121
</ion-button>
2222
</ion-buttons>
2323
</ion-toolbar>
@@ -64,13 +64,13 @@ <h1>
6464
</ion-row>
6565

6666
<!-- Summary -->
67-
<ion-card *ngIf="!quizAborted && showSummary && summaryQuestions.length" class="addon-mod_quiz-table">
67+
<ion-card *ngIf="!quizAborted && showSummary && attemptSummary.length" class="addon-mod_quiz-table">
6868
<ion-card-header class="ion-text-wrap">
6969
<ion-card-title>{{ 'addon.mod_quiz.summaryofattempt' | translate }}</ion-card-title>
7070
</ion-card-header>
7171

7272
<!-- List of questions of the summary table. -->
73-
<ng-container *ngFor="let question of summaryQuestions">
73+
<ng-container *ngFor="let question of attemptSummary">
7474
<ion-item *ngIf="question.type !== 'description' && question.questionnumber"
7575
(click)="!isSequential && canReturn && changePage(question.page, false, question.slot)"
7676
[detail]="!isSequential && canReturn" [button]="!isSequential && canReturn"
@@ -123,7 +123,7 @@ <h1>
123123
</ion-button>
124124
</ion-card>
125125

126-
<div collapsible-footer appearOnBottom *ngIf="!quizAborted && showSummary && summaryQuestions.length && loaded" slot="fixed">
126+
<div collapsible-footer appearOnBottom *ngIf="!quizAborted && showSummary && attemptSummary.length && loaded" slot="fixed">
127127
<div class="list-item-limited-width">
128128
<ion-button *ngIf="preventSubmitMessages.length" expand="block" class="ion-margin ion-text-wrap" [href]="moduleUrl"
129129
core-link [showBrowserWarning]="false">

0 commit comments

Comments
 (0)