commit
4d22792e79
|
@ -639,6 +639,8 @@
|
||||||
"addon.mod_forum.erroremptysubject": "forum",
|
"addon.mod_forum.erroremptysubject": "forum",
|
||||||
"addon.mod_forum.errorgetforum": "local_moodlemobileapp",
|
"addon.mod_forum.errorgetforum": "local_moodlemobileapp",
|
||||||
"addon.mod_forum.errorgetgroups": "local_moodlemobileapp",
|
"addon.mod_forum.errorgetgroups": "local_moodlemobileapp",
|
||||||
|
"addon.mod_forum.errorloadingsortingorder": "local_moodlemobileapp",
|
||||||
|
"addon.mod_forum.errorloadingsortingorderdetails": "local_moodlemobileapp",
|
||||||
"addon.mod_forum.errorposttoallgroups": "local_moodlemobileapp",
|
"addon.mod_forum.errorposttoallgroups": "local_moodlemobileapp",
|
||||||
"addon.mod_forum.favourites": "forum",
|
"addon.mod_forum.favourites": "forum",
|
||||||
"addon.mod_forum.favouriteupdated": "forum",
|
"addon.mod_forum.favouriteupdated": "forum",
|
||||||
|
|
|
@ -62,14 +62,14 @@
|
||||||
|
|
||||||
<!-- Reset search. -->
|
<!-- Reset search. -->
|
||||||
<ng-container *ngIf="search.searching && !isEmpty">
|
<ng-container *ngIf="search.searching && !isEmpty">
|
||||||
<ion-item (click)="searchReset()" button detail="false" *ngIf="!foundRecordsTranslationData">
|
<ion-item (click)="searchReset($event)" button detail="false" *ngIf="!foundRecordsTranslationData">
|
||||||
<ion-label color="info">
|
<ion-label color="info">
|
||||||
{{ 'addon.mod_data.resetsettings' | translate}}
|
{{ 'addon.mod_data.resetsettings' | translate}}
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-card class="core-success-card" *ngIf="foundRecordsTranslationData">
|
<ion-card class="core-success-card" *ngIf="foundRecordsTranslationData">
|
||||||
<ion-item (click)="searchReset()" button detail="false">
|
<ion-item (click)="searchReset($event)" button detail="false">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p [innerHTML]="'addon.mod_data.foundrecords' | translate:{$a: foundRecordsTranslationData}"></p>
|
<p [innerHTML]="'addon.mod_data.foundrecords' | translate:{$a: foundRecordsTranslationData}"></p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
<core-empty-box *ngIf="isEmpty && search.searching" icon="fas-database" [message]="'addon.mod_data.nomatch' | translate"
|
<core-empty-box *ngIf="isEmpty && search.searching" icon="fas-database" [message]="'addon.mod_data.nomatch' | translate"
|
||||||
class="core-empty-box-clickable">
|
class="core-empty-box-clickable">
|
||||||
<button class="as-link" (click)="searchReset()">{{ 'addon.mod_data.resetsettings' | translate}}</button>
|
<button class="as-link" (click)="searchReset($event)">{{ 'addon.mod_data.resetsettings' | translate}}</button>
|
||||||
</core-empty-box>
|
</core-empty-box>
|
||||||
|
|
||||||
</core-loading>
|
</core-loading>
|
||||||
|
|
|
@ -426,8 +426,13 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset all search filters and closes the modal.
|
* Reset all search filters and closes the modal.
|
||||||
|
*
|
||||||
|
* @param ev Event.
|
||||||
*/
|
*/
|
||||||
searchReset(): void {
|
searchReset(ev: Event): void {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
|
||||||
this.search.sortBy = '0';
|
this.search.sortBy = '0';
|
||||||
this.search.sortDirection = 'DESC';
|
this.search.sortDirection = 'DESC';
|
||||||
this.search.text = '';
|
this.search.text = '';
|
||||||
|
|
|
@ -44,6 +44,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
||||||
groupInfo?: CoreGroupInfo;
|
groupInfo?: CoreGroupInfo;
|
||||||
allPartsPermissions?: AddonModForumCanAddDiscussion;
|
allPartsPermissions?: AddonModForumCanAddDiscussion;
|
||||||
canAddDiscussionToGroup = true;
|
canAddDiscussionToGroup = true;
|
||||||
|
errorLoadingDiscussions = false;
|
||||||
|
|
||||||
constructor(courseId: number, cmId: number, discussionsPathPrefix: string) {
|
constructor(courseId: number, cmId: number, discussionsPathPrefix: string) {
|
||||||
super();
|
super();
|
||||||
|
@ -222,13 +223,27 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
||||||
throw new Error('Can\'t load discussions without a forum or selected sort order');
|
throw new Error('Can\'t load discussions without a forum or selected sort order');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let discussions: AddonModForumDiscussion[] = [];
|
||||||
|
let canLoadMore = false;
|
||||||
|
try {
|
||||||
const response = await AddonModForum.getDiscussions(this.forum.id, {
|
const response = await AddonModForum.getDiscussions(this.forum.id, {
|
||||||
cmId: this.forum.cmid,
|
cmId: this.forum.cmid,
|
||||||
sortOrder: this.selectedSortOrder.value,
|
sortOrder: this.selectedSortOrder.value,
|
||||||
page,
|
page,
|
||||||
groupId: this.groupId,
|
groupId: this.groupId,
|
||||||
});
|
});
|
||||||
let discussions = response.discussions;
|
|
||||||
|
discussions = response.discussions;
|
||||||
|
canLoadMore = response.canLoadMore;
|
||||||
|
this.errorLoadingDiscussions = false;
|
||||||
|
} catch (error) {
|
||||||
|
if (page > 0 || CoreUtils.isWebServiceError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error loading first discussions, use an empty list.
|
||||||
|
this.errorLoadingDiscussions = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.usesGroups) {
|
if (this.usesGroups) {
|
||||||
discussions = await AddonModForum.formatDiscussionsGroups(this.forum.cmid, discussions);
|
discussions = await AddonModForum.formatDiscussionsGroups(this.forum.cmid, discussions);
|
||||||
|
@ -254,7 +269,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { discussions, canLoadMore: response.canLoadMore };
|
return { discussions, canLoadMore };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,17 +54,22 @@
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
||||||
<ng-container *ngIf="forum">
|
<ng-container *ngIf="forum">
|
||||||
<core-empty-box *ngIf="!discussions || !discussions.hasDiscussions" icon="far-comments"
|
<div *ngIf="discussions && sortingAvailable && selectedSortOrder" class="ion-text-wrap">
|
||||||
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
|
||||||
</core-empty-box>
|
|
||||||
|
|
||||||
<div *ngIf="discussions?.hasDiscussions && sortingAvailable && selectedSortOrder" class="ion-text-wrap">
|
|
||||||
<core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector"
|
<core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector"
|
||||||
[label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate"
|
[label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate"
|
||||||
interface="modal">
|
interface="modal">
|
||||||
</core-combobox>
|
</core-combobox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<core-empty-box *ngIf="!discussions || (!discussions.hasDiscussions && !errorLoadingDiscussions)" icon="far-comments"
|
||||||
|
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
||||||
|
</core-empty-box>
|
||||||
|
|
||||||
|
<core-empty-box *ngIf="errorLoadingDiscussions" icon="fas-exclamation-triangle"
|
||||||
|
[message]="'addon.mod_forum.errorloadingsortingorder' | translate">
|
||||||
|
<p>{{ 'addon.mod_forum.errorloadingsortingorderdetails' | translate }}</p>
|
||||||
|
</core-empty-box>
|
||||||
|
|
||||||
<ion-item *ngFor="let discussion of discussionsItems" class="addon-mod-forum-discussion" detail="true"
|
<ion-item *ngFor="let discussion of discussionsItems" class="addon-mod-forum-discussion" detail="true"
|
||||||
[lines]="discussion.groupname && 'none'" [attr.aria-current]="discussions?.getItemAriaCurrent(discussion)"
|
[lines]="discussion.groupname && 'none'" [attr.aria-current]="discussions?.getItemAriaCurrent(discussion)"
|
||||||
(click)="discussions?.select(discussion)" button>
|
(click)="discussions?.select(discussion)" button>
|
||||||
|
|
|
@ -152,6 +152,10 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
|
||||||
return !!(this.forum && this.canAddDiscussion && this.discussions?.getSource().canAddDiscussionToGroup);
|
return !!(this.forum && this.canAddDiscussion && this.discussions?.getSource().canAddDiscussionToGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get errorLoadingDiscussions(): boolean {
|
||||||
|
return !!this.discussions?.getSource().errorLoadingDiscussions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a discussion is online.
|
* Check whether a discussion is online.
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
"erroremptysubject": "Post subject cannot be empty.",
|
"erroremptysubject": "Post subject cannot be empty.",
|
||||||
"errorgetforum": "Error getting forum data.",
|
"errorgetforum": "Error getting forum data.",
|
||||||
"errorgetgroups": "Error getting group settings.",
|
"errorgetgroups": "Error getting group settings.",
|
||||||
|
"errorloadingsortingorder": "Forum not available in this sorting order",
|
||||||
|
"errorloadingsortingorderdetails": "Try changing the sorting order or going online to view this forum.",
|
||||||
"errorposttoallgroups": "Could not create new discussion in all groups.",
|
"errorposttoallgroups": "Could not create new discussion in all groups.",
|
||||||
"favourites": "Starred",
|
"favourites": "Starred",
|
||||||
"favouriteupdated": "Your star option has been updated.",
|
"favouriteupdated": "Your star option has been updated.",
|
||||||
|
|
|
@ -811,13 +811,13 @@ export class AddonModLessonProvider {
|
||||||
const matches = studentAnswer.match(new RegExp(expectedAnswer, 'g' + ignoreCase));
|
const matches = studentAnswer.match(new RegExp(expectedAnswer, 'g' + ignoreCase));
|
||||||
if (matches) {
|
if (matches) {
|
||||||
isMatch = true;
|
isMatch = true;
|
||||||
const nb = matches[0].length;
|
const nb = matches.length;
|
||||||
const original: string[] = [];
|
const original: string[] = [];
|
||||||
const marked: string[] = [];
|
const marked: string[] = [];
|
||||||
|
|
||||||
for (let j = 0; j < nb; j++) {
|
for (let j = 0; j < nb; j++) {
|
||||||
original.push(matches[0][j]);
|
original.push(matches[j]);
|
||||||
marked.push('<span class="incorrect matches">' + matches[0][j] + '</span>');
|
marked.push('<span class="incorrect matches">' + matches[j] + '</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let j = 0; j < original.length; j++) {
|
for (let j = 0; j < original.length; j++) {
|
||||||
|
|
Loading…
Reference in New Issue