Merge pull request #3139 from dpalou/MOBILE-3780

Mobile 3780
main
Pau Ferrer Ocaña 2022-02-24 12:26:41 +01:00 committed by GitHub
commit 89d8750e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 261 additions and 150 deletions

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -122,10 +122,11 @@
</ng-container>
<!-- If it's a student, display his submission. -->
<addon-mod-assign-submission *ngIf="loaded && !canViewAllSubmissions && canViewOwnSubmission" [courseId]="courseId"
<addon-mod-assign-submission *ngIf="!showLoading && !canViewAllSubmissions && canViewOwnSubmission" [courseId]="courseId"
[moduleId]="module.id">
</addon-mod-assign-submission>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -36,6 +36,7 @@ import {
import { AddonModAssignHelper } from '../../services/assign-helper';
import { AddonModAssignOffline } from '../../services/assign-offline';
import { AddonModAssignSync } from '../../services/assign-sync';
import { CoreUtils } from '@services/utils/utils';
/**
* Page that allows adding or editing an assigment submission.
@ -255,7 +256,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
this.hasOffline,
);
} catch (error) {
if (this.allowOffline && !this.saveOffline) {
if (this.allowOffline && !this.saveOffline && !CoreUtils.isWebServiceError(error)) {
// Cannot submit in online, prepare for offline usage.
this.saveOffline = true;

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -15,7 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { FileEntry } from '@ionic-native/file/ngx';
import { FileEntry, DirectoryEntry } from '@ionic-native/file/ngx';
import {
AddonModAssignProvider,
AddonModAssignAssign,

View File

@ -187,7 +187,8 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
plugin: AddonModAssignPlugin,
): Promise<number> {
// Check if there's any change.
if (this.hasDataChanged(assign, submission, plugin)) {
const hasChanged = await this.hasDataChanged(assign, submission, plugin);
if (hasChanged) {
const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
return CoreFileHelper.getTotalFilesSize(files);

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-page">
<core-loading [hideUntil]="!showLoading" class="safe-area-page">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -112,5 +112,6 @@
</ng-container>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -115,14 +115,14 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
return;
}
this.loaded = false;
this.showLoading = true;
try {
await AddonModBBB.invalidateAllGroupsMeetingInfo(this.bbb.id);
await this.fetchMeetingInfo();
} finally {
this.loaded = true;
this.showLoading = false;
}
}
@ -148,14 +148,14 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
* @return Promise resolved when done.
*/
async groupChanged(): Promise<void> {
this.loaded = false;
this.showLoading = true;
try {
await this.fetchMeetingInfo();
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {
this.loaded = true;
this.showLoading = false;
}
}

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -41,5 +41,6 @@
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -30,5 +30,6 @@
</ng-container>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -135,7 +135,8 @@
</ion-card>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>
<!-- Template to render a choice option label. -->

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -18,7 +18,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -120,7 +120,8 @@
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">

View File

@ -133,7 +133,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
// Refresh entries on change.
this.entryChangedObserver = CoreEvents.on(AddonModDataProvider.ENTRY_CHANGED, (eventData) => {
if (this.database?.id == eventData.dataId) {
this.loaded = false;
this.showLoading = true;
return this.loadContent(true);
}
@ -191,7 +191,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
*/
protected isRefreshSyncNeeded(syncEventData: AddonModDataAutoSyncData): boolean {
if (this.database && syncEventData.dataId == this.database.id && syncEventData.entryId === undefined) {
this.loaded = false;
this.showLoading = true;
// Refresh the data.
this.content?.scrollToTop();
@ -404,7 +404,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
* @return Resolved when done.
*/
async searchEntries(page: number): Promise<void> {
this.loaded = false;
this.showLoading = true;
this.search.page = page;
try {
@ -414,7 +414,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
} finally {
this.loaded = true;
this.showLoading = false;
}
}

View File

@ -266,9 +266,10 @@ export class AddonModDataEditPage implements OnInit {
this.offline,
);
} catch (error) {
if (this.offline) {
if (this.offline || CoreUtils.isWebServiceError(error)) {
throw error;
}
// Cannot submit in online, prepare for offline usage.
this.offline = true;

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -35,7 +35,8 @@
</core-tabs>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>
<ng-template #basicInfo>

View File

@ -97,7 +97,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
this.tabsLoaded.analysis = false;
this.tabsLoaded.overview = false;
this.loaded = false;
this.showLoading = true;
// Prefetch data if needed.
if (!data.offline && this.isPrefetched()) {

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info *ngIf="!subfolder" [module]="module" [description]="description" [component]="component"
@ -32,5 +32,6 @@
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -55,7 +55,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
this.description = this.folderInstance ? this.folderInstance.intro : this.module.description;
this.contents = this.subfolder;
this.loaded = true;
this.showLoading = false;
return;
}
@ -70,7 +70,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
// Ignore errors.
}
} finally {
this.loaded = true;
this.showLoading = false;
}
}

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="subfolder || !activityComponent?.loaded"
<ion-refresher slot="fixed" [disabled]="subfolder || activityComponent?.showLoading"
(ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -7,11 +7,11 @@
<!-- Content. -->
<core-split-view>
<ion-refresher slot="fixed" [disabled]="discussions && !discussions.loaded" (ionRefresh)="doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="showLoading || (discussions && !discussions.loaded)" (ionRefresh)="doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>
<core-loading [hideUntil]="discussions && discussions.loaded">
<core-loading [hideUntil]="!showLoading && discussions && discussions.loaded">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="forum && forum.type != 'single' && description" [component]="component"
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
@ -114,7 +114,7 @@
</ng-container>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module"
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -364,7 +364,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
);
} catch (error) {
// Cannot upload them in online, save them in offline.
if (!this.forum.id || isEditOnline) {
if (!this.forum.id || isEditOnline || CoreUtils.isWebServiceError(error)) {
// Cannot store them in offline. Reject.
throw error;
}

View File

@ -106,6 +106,10 @@ export class AddonModForumHelperProvider {
try {
await Promise.all(promises);
} catch (error) {
if (CoreUtils.isWebServiceError(error)) {
throw error;
}
// Cannot upload them in online, save them in offline.
saveOffline = true;

View File

@ -16,7 +16,7 @@
<!-- Content. -->
<core-split-view>
<ion-refresher slot="fixed" [disabled]="!loaded" (ionRefresh)="doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="showLoading" (ionRefresh)="doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>
@ -24,7 +24,7 @@
[autoFocus]="true" [lengthCheck]="2" (onClear)="toggleSearch()" searchArea="AddonModGlossary-{{module.id}}">
</core-search-box>
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info *ngIf="!isSearch" [module]="module" [description]="description" [component]="component"
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
@ -72,7 +72,7 @@
</core-infinite-loading>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module"
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -393,7 +393,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
this.loadingMessage = Translate.instant('core.loading');
this.content?.scrollToTop();
this.switchMode(mode);
this.loaded = false;
this.showLoading = true;
this.loadContent();
}
@ -411,7 +411,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
*/
search(query: string): void {
this.loadingMessage = Translate.instant('core.searching');
this.loaded = false;
this.showLoading = true;
this.entries?.getSource().search(query);
this.loadContent();

View File

@ -25,6 +25,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreForms } from '@singletons/form';
@ -392,7 +393,11 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave {
saveOffline: false,
attachmentsResult,
};
} catch {
} catch (error) {
if (CoreUtils.isWebServiceError(error)) {
throw error;
}
// Cannot upload them in online, save them in offline.
const attachmentsResult = await AddonModGlossaryHelper.storeFiles(
this.glossary.id,

View File

@ -16,7 +16,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -68,5 +68,6 @@
</core-h5p-iframe>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -1,6 +1,6 @@
<!-- Buttons to add to the header. -->
<core-navbar-buttons slot="end">
<ion-button *ngIf="loaded" (click)="showToc()" aria-haspopup="true" [attr.aria-label]="'addon.mod_imscp.toc' | translate">
<ion-button *ngIf="!showLoading" (click)="showToc()" aria-haspopup="true" [attr.aria-label]="'addon.mod_imscp.toc' | translate">
<ion-icon name="fas-bookmark" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
@ -10,7 +10,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module">
@ -26,9 +26,10 @@
<div class="addon-mod-imscp-container">
<core-navigation-bar [items]="navigationItems" (action)="loadItem($event)">
</core-navigation-bar>
<core-iframe *ngIf="loaded" [src]="src" [showFullscreenOnToolbar]="true" [autoFullscreenOnRotate]="true"></core-iframe>
<core-iframe *ngIf="!showLoading" [src]="src" [showFullscreenOnToolbar]="true" [autoFullscreenOnRotate]="true"></core-iframe>
</div>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -6,8 +6,8 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-tabs [hideUntil]="loaded" [selectedIndex]="selectedTab">
<core-loading [hideUntil]="!showLoading">
<core-tabs [hideUntil]="!showLoading" [selectedIndex]="selectedTab">
<!-- Index/Preview tab. -->
<core-tab [title]="'addon.mod_lesson.preview' | translate" (ionSelect)="indexSelected()">
<ng-template>
@ -279,5 +279,6 @@
</core-tabs>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -618,7 +618,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
return;
}
this.loaded = false;
this.showLoading = true;
try {
await this.validatePassword(<string> password);
@ -635,7 +635,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {
this.loaded = true;
this.showLoading = false;
CoreForms.triggerFormSubmittedEvent(this.formElement, true, this.siteId);
}

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
@ -21,5 +21,6 @@
</div>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
@ -32,5 +32,6 @@
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -206,5 +206,6 @@
</ion-card>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -455,13 +455,13 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
}
// Refresh data.
this.loaded = false;
this.showLoading = true;
this.content?.scrollToTop();
await promise;
await CoreUtils.ignoreErrors(this.refreshContent(true));
this.loaded = true;
this.showLoading = false;
}
/**
@ -547,8 +547,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
if (status == CoreConstants.DOWNLOADED && previousStatus == CoreConstants.DOWNLOADING) {
// Quiz downloaded now, maybe a new attempt was created. Load content again.
this.loaded = false;
this.loadContent();
this.showLoadingAndFetch();
}
}

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [courseId]="courseId" [description]="displayDescription && description"
@ -97,5 +97,6 @@
</ng-container>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded || activityComponent?.mode == 'iframe'"
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading || activityComponent?.mode == 'iframe'"
(ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -21,7 +21,7 @@
</ion-item>
</ion-card>
<ng-container *ngIf="scorm && loaded && !scorm.warningMessage">
<ng-container *ngIf="scorm && !showLoading && !scorm.warningMessage">
<!-- Attempts status. -->
<ion-card *ngIf="(scorm.displayattemptstatus || offlineAttempts.length) && !skip">
<ion-card-header class="ion-text-wrap">
@ -217,5 +217,6 @@
</ng-container>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-padding">
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="survey && !survey.surveydone && !hasOffline && description"
@ -131,5 +131,6 @@
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
@ -46,5 +46,6 @@
</ion-list>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -7,7 +7,7 @@
<ion-icon *ngIf="groupWiki" name="fas-users" aria-hidden="true"></ion-icon>
</ion-button>
<ion-button *ngIf="loaded && currentPageObj" (click)="openMap()" [attr.aria-label]="'addon.mod_wiki.map' | translate"
<ion-button *ngIf="!showLoading && currentPageObj" (click)="openMap()" [attr.aria-label]="'addon.mod_wiki.map' | translate"
aria-haspopup="true">
<ion-icon name="fas-map" aria-hidden="true"></ion-icon>
</ion-button>
@ -27,7 +27,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
@ -71,7 +71,8 @@
</div>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canEdit">

View File

@ -16,7 +16,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -304,7 +304,11 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe
files,
saveOffline,
);
} catch {
} catch (error) {
if (CoreUtils.isWebServiceError(error)) {
throw error;
}
// Cannot upload them in online, save them in offline.
saveOffline = true;
allowOffline = true;

View File

@ -6,7 +6,7 @@
</core-navbar-buttons>
<!-- Content. -->
<core-loading [hideUntil]="loaded">
<core-loading [hideUntil]="!showLoading">
<!-- Activity info. -->
<core-course-module-info [module]="module" [hasDataToSync]="hasOffline">
@ -233,5 +233,6 @@
</div>
</core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
<core-course-module-navigation [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -25,6 +25,7 @@ import { CoreSites } from '@services/sites';
import { CoreSync } from '@services/sync';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { CoreForms } from '@singletons/form';
@ -349,7 +350,11 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
inputData.attachmentfiles,
false,
);
} catch {
} catch (error) {
if (CoreUtils.isWebServiceError(error)) {
throw error;
}
// Cannot upload them in online, save them in offline.
saveOffline = true;
allowOffline = true;

View File

@ -15,7 +15,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher slot="fixed" [disabled]="activityComponent?.showLoading" (ionRefresh)="activityComponent?.doRefresh($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>

View File

@ -24,6 +24,7 @@ import { CoreCaptureError } from './captureerror';
import { CoreNetworkError } from './network-error';
import { CoreSiteError } from './siteerror';
import { CoreErrorWithTitle } from './errorwithtitle';
import { CoreHttpError } from './httperror';
export const CORE_ERRORS_CLASSES: Type<unknown>[] = [
CoreAjaxError,
@ -36,4 +37,5 @@ export const CORE_ERRORS_CLASSES: Type<unknown>[] = [
CoreSiteError,
CoreWSError,
CoreErrorWithTitle,
CoreHttpError,
];

View File

@ -0,0 +1,30 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreError } from '@classes/errors/error';
/**
* HTTP error.
*/
export class CoreHttpError extends CoreError {
status: number; // HTTP status. 0 if cannot connect or similar errors.
constructor(message: string, status?: number) {
super(message);
this.status = status ?? 0;
}
}

View File

@ -116,7 +116,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR
* @return Resolved when done.
*/
protected async showLoadingAndFetch(sync: boolean = false, showErrors: boolean = false): Promise<void> {
this.loaded = false;
this.showLoading = true;
this.content?.scrollToTop();
await this.loadContent(false, sync, showErrors);
@ -130,7 +130,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR
* @return Resolved when done.
*/
protected showLoadingAndRefresh(sync: boolean = false, showErrors: boolean = false): Promise<void> {
this.loaded = false;
this.showLoading = true;
this.content?.scrollToTop();
return this.refreshContent(sync, showErrors);
@ -177,7 +177,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
} finally {
this.loaded = true;
this.showLoading = false;
}
}

View File

@ -52,7 +52,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
@Input() courseId!: number; // Course ID the component belongs to.
@Output() dataRetrieved = new EventEmitter<unknown>(); // Called to notify changes the index page from the main component.
loaded = false; // If the component has been loaded.
showLoading = true; // Whether to show loading.
component?: string; // Component name.
componentId?: number; // Component ID.
hasOffline = false; // Resources don't have any data to sync.
@ -199,7 +199,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
} finally {
this.loaded = true;
this.showLoading = false;
}
}
@ -416,12 +416,12 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
});
if (data) {
if (this.loaded && (data.action == 'refresh' || data.action == 'sync')) {
this.loaded = false;
if (!this.showLoading && (data.action == 'refresh' || data.action == 'sync')) {
this.showLoading = true;
try {
await this.doRefresh(undefined, data.action == 'sync');
} finally {
this.loaded = true;
this.showLoading = false;
}
}
}

View File

@ -530,6 +530,18 @@ export class CoreTextUtilsProvider {
return error.message || error.error || error.content || error.body;
}
/**
* Given some HTML code, return the HTML code inside <body> tags. If there are no body tags, return the whole HTML.
*
* @param html HTML text.
* @return Body HTML.
*/
getHTMLBodyContent(html: string): string {
const matches = html.match(/<body>([\s\S]*)<\/body>/im);
return matches?.[1] ?? html;
}
/**
* Get the pluginfile URL to replace @@PLUGINFILE@@ wildcards.
*

View File

@ -858,12 +858,17 @@ export class CoreUtilsProvider {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
isWebServiceError(error: any): boolean {
return error && (error.warningcode !== undefined || (error.errorcode !== undefined &&
error.errorcode != 'userdeleted' && error.errorcode != 'upgraderunning' &&
return error && (
error.warningcode !== undefined ||
(
error.errorcode !== undefined && error.errorcode != 'userdeleted' && error.errorcode != 'upgraderunning' &&
error.errorcode != 'forcepasswordchangenotice' && error.errorcode != 'usernotfullysetup' &&
error.errorcode != 'sitepolicynotagreed' && error.errorcode != 'sitemaintenance' &&
error.errorcode != 'wsaccessusersuspended' && error.errorcode != 'wsaccessuserdeleted' &&
!this.isExpiredTokenError(error)));
!this.isExpiredTokenError(error)
) ||
error.status && error.status >= 400 // CoreHttpError, assume status 400 and above are like WebService errors.
);
}
/**

View File

@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
import { HttpResponse, HttpParams } from '@angular/common/http';
import { FileEntry } from '@ionic-native/file/ngx';
import { FileUploadOptions } from '@ionic-native/file-transfer/ngx';
import { FileUploadOptions, FileUploadResult } from '@ionic-native/file-transfer/ngx';
import { Md5 } from 'ts-md5/dist/md5';
import { Observable } from 'rxjs';
import { timeout } from 'rxjs/operators';
@ -25,7 +25,7 @@ import { CoreNativeToAngularHttpResponse } from '@classes/native-to-angular-http
import { CoreApp } from '@services/app';
import { CoreFile, CoreFileFormat } from '@services/file';
import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { CoreTextUtils } from '@services/utils/text';
import { CoreTextErrorObject, CoreTextUtils } from '@services/utils/text';
import { CoreUtils, PromiseDefer } from '@services/utils/utils';
import { CoreConstants } from '@/core/constants';
import { CoreError } from '@classes/errors/error';
@ -38,6 +38,7 @@ import { CoreAjaxError } from '@classes/errors/ajaxerror';
import { CoreAjaxWSError } from '@classes/errors/ajaxwserror';
import { CoreNetworkError } from '@classes/errors/network-error';
import { CoreSite } from '@classes/site';
import { CoreHttpError } from '@classes/errors/httperror';
/**
* This service allows performing WS calls and download/upload files.
@ -693,6 +694,8 @@ export class CoreWSProvider {
return retryPromise;
} else if (error.status === -2) {
throw new CoreError(this.getCertificateErrorMessage(error.error));
} else if (error.status > 0) {
throw this.createHttpError(error, error.status);
}
throw new CoreError(Translate.instant('core.serverconnection'));
@ -885,51 +888,69 @@ export class CoreWSProvider {
options.headers = {};
options['Connection'] = 'close';
let success: FileUploadResult;
try {
const success = await transfer.upload(filePath, uploadUrl, options, true);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const data = CoreTextUtils.parseJSON<any>(
success.response,
null,
this.logger.error.bind(this.logger, 'Error parsing response from upload', success.response),
);
if (data === null) {
throw new CoreError(Translate.instant('core.errorinvalidresponse'));
}
if (!data) {
throw new CoreError(Translate.instant('core.serverconnection'));
} else if (typeof data != 'object') {
this.logger.warn('Upload file: Response of type "' + typeof data + '" received, expecting "object"');
throw new CoreError(Translate.instant('core.errorinvalidresponse'));
}
if (data.exception !== undefined) {
throw new CoreWSError(data);
} else if (data.error !== undefined) {
throw new CoreWSError({
errorcode: data.errortype,
message: data.error,
});
} else if (data[0] && data[0].error !== undefined) {
throw new CoreWSError({
errorcode: data[0].errortype,
message: data[0].error,
});
}
// We uploaded only 1 file, so we only return the first file returned.
this.logger.debug('Successfully uploaded file', filePath);
return data[0];
success = await transfer.upload(filePath, uploadUrl, options, true);
} catch (error) {
this.logger.error('Error while uploading file', filePath, error);
throw this.createHttpError(error, error.http_status ?? 0);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const data = CoreTextUtils.parseJSON<any>(
success.response,
null,
this.logger.error.bind(this.logger, 'Error parsing response from upload', success.response),
);
if (data === null) {
throw new CoreError(Translate.instant('core.errorinvalidresponse'));
}
if (!data) {
throw new CoreError(Translate.instant('core.serverconnection'));
} else if (typeof data != 'object') {
this.logger.warn('Upload file: Response of type "' + typeof data + '" received, expecting "object"');
throw new CoreError(Translate.instant('core.errorinvalidresponse'));
}
if (data.exception !== undefined) {
throw new CoreWSError(data);
} else if (data.error !== undefined) {
throw new CoreWSError({
errorcode: data.errortype,
message: data.error,
});
} else if (data[0] && data[0].error !== undefined) {
throw new CoreWSError({
errorcode: data[0].errortype,
message: data[0].error,
});
}
// We uploaded only 1 file, so we only return the first file returned.
this.logger.debug('Successfully uploaded file', filePath);
return data[0];
}
/**
* Create a CoreHttpError based on a certain error.
*
* @param error Original error.
* @param status Status code (if any).
* @return CoreHttpError.
*/
protected createHttpError(error: CoreTextErrorObject, status: number): CoreHttpError {
const message = CoreTextUtils.buildSeveralParagraphsMessage([
Translate.instant('core.cannotconnecttrouble'),
CoreTextUtils.getHTMLBodyContent(CoreTextUtils.getErrorMessageFromError(error) || ''),
]);
return new CoreHttpError(message, status);
}
/**

View File

@ -22,6 +22,7 @@ information provided here is intended especially for developers.
- The parameters of the following functions in CoreCourseHelper have changed: navigateToModuleByInstance, navigateToModule, openModule.
- fillContextMenu, expandDescription, gotoBlog, prefetch and removeFiles functions have been removed from CoreCourseModuleMainResourceComponent.
- contextMenuPrefetch and fillContextMenu have been removed from CoreCourseHelper.
-The variable "loaded" in CoreCourseModuleMainResourceComponent has been changed to "showLoading" to reflect its purpose better.