commit
89d8750e82
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -122,10 +122,11 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- If it's a student, display his submission. -->
|
<!-- 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">
|
[moduleId]="module.id">
|
||||||
</addon-mod-assign-submission>
|
</addon-mod-assign-submission>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -36,6 +36,7 @@ import {
|
||||||
import { AddonModAssignHelper } from '../../services/assign-helper';
|
import { AddonModAssignHelper } from '../../services/assign-helper';
|
||||||
import { AddonModAssignOffline } from '../../services/assign-offline';
|
import { AddonModAssignOffline } from '../../services/assign-offline';
|
||||||
import { AddonModAssignSync } from '../../services/assign-sync';
|
import { AddonModAssignSync } from '../../services/assign-sync';
|
||||||
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that allows adding or editing an assigment submission.
|
* Page that allows adding or editing an assigment submission.
|
||||||
|
@ -255,7 +256,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
||||||
this.hasOffline,
|
this.hasOffline,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.allowOffline && !this.saveOffline) {
|
if (this.allowOffline && !this.saveOffline && !CoreUtils.isWebServiceError(error)) {
|
||||||
// Cannot submit in online, prepare for offline usage.
|
// Cannot submit in online, prepare for offline usage.
|
||||||
this.saveOffline = true;
|
this.saveOffline = true;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
|
import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
|
||||||
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
|
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
|
||||||
import { FileEntry } from '@ionic-native/file/ngx';
|
import { FileEntry, DirectoryEntry } from '@ionic-native/file/ngx';
|
||||||
import {
|
import {
|
||||||
AddonModAssignProvider,
|
AddonModAssignProvider,
|
||||||
AddonModAssignAssign,
|
AddonModAssignAssign,
|
||||||
|
|
|
@ -187,7 +187,8 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
plugin: AddonModAssignPlugin,
|
plugin: AddonModAssignPlugin,
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
// Check if there's any change.
|
// 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);
|
const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||||
|
|
||||||
return CoreFileHelper.getTotalFilesSize(files);
|
return CoreFileHelper.getTotalFilesSize(files);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-page">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-page">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -112,5 +112,6 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -115,14 +115,14 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await AddonModBBB.invalidateAllGroupsMeetingInfo(this.bbb.id);
|
await AddonModBBB.invalidateAllGroupsMeetingInfo(this.bbb.id);
|
||||||
|
|
||||||
await this.fetchMeetingInfo();
|
await this.fetchMeetingInfo();
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,14 +148,14 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
|
||||||
* @return Promise resolved when done.
|
* @return Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
async groupChanged(): Promise<void> {
|
async groupChanged(): Promise<void> {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.fetchMeetingInfo();
|
await this.fetchMeetingInfo();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModal(error);
|
CoreDomUtils.showErrorModal(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -41,5 +41,6 @@
|
||||||
|
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -30,5 +30,6 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -135,7 +135,8 @@
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
||||||
<!-- Template to render a choice option label. -->
|
<!-- Template to render a choice option label. -->
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -120,7 +120,8 @@
|
||||||
|
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
||||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">
|
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">
|
||||||
|
|
|
@ -133,7 +133,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
// Refresh entries on change.
|
// Refresh entries on change.
|
||||||
this.entryChangedObserver = CoreEvents.on(AddonModDataProvider.ENTRY_CHANGED, (eventData) => {
|
this.entryChangedObserver = CoreEvents.on(AddonModDataProvider.ENTRY_CHANGED, (eventData) => {
|
||||||
if (this.database?.id == eventData.dataId) {
|
if (this.database?.id == eventData.dataId) {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
|
|
||||||
return this.loadContent(true);
|
return this.loadContent(true);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
*/
|
*/
|
||||||
protected isRefreshSyncNeeded(syncEventData: AddonModDataAutoSyncData): boolean {
|
protected isRefreshSyncNeeded(syncEventData: AddonModDataAutoSyncData): boolean {
|
||||||
if (this.database && syncEventData.dataId == this.database.id && syncEventData.entryId === undefined) {
|
if (this.database && syncEventData.dataId == this.database.id && syncEventData.entryId === undefined) {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
// Refresh the data.
|
// Refresh the data.
|
||||||
this.content?.scrollToTop();
|
this.content?.scrollToTop();
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
* @return Resolved when done.
|
* @return Resolved when done.
|
||||||
*/
|
*/
|
||||||
async searchEntries(page: number): Promise<void> {
|
async searchEntries(page: number): Promise<void> {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
this.search.page = page;
|
this.search.page = page;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -414,7 +414,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
|
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,9 +266,10 @@ export class AddonModDataEditPage implements OnInit {
|
||||||
this.offline,
|
this.offline,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.offline) {
|
if (this.offline || CoreUtils.isWebServiceError(error)) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cannot submit in online, prepare for offline usage.
|
// Cannot submit in online, prepare for offline usage.
|
||||||
this.offline = true;
|
this.offline = true;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -35,7 +35,8 @@
|
||||||
</core-tabs>
|
</core-tabs>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
||||||
<ng-template #basicInfo>
|
<ng-template #basicInfo>
|
||||||
|
|
|
@ -97,7 +97,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
|
||||||
|
|
||||||
this.tabsLoaded.analysis = false;
|
this.tabsLoaded.analysis = false;
|
||||||
this.tabsLoaded.overview = false;
|
this.tabsLoaded.overview = false;
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
|
|
||||||
// Prefetch data if needed.
|
// Prefetch data if needed.
|
||||||
if (!data.offline && this.isPrefetched()) {
|
if (!data.offline && this.isPrefetched()) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info *ngIf="!subfolder" [module]="module" [description]="description" [component]="component"
|
<core-course-module-info *ngIf="!subfolder" [module]="module" [description]="description" [component]="component"
|
||||||
|
@ -32,5 +32,6 @@
|
||||||
|
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
|
||||||
this.description = this.folderInstance ? this.folderInstance.intro : this.module.description;
|
this.description = this.folderInstance ? this.folderInstance.intro : this.module.description;
|
||||||
this.contents = this.subfolder;
|
this.contents = this.subfolder;
|
||||||
|
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-refresher slot="fixed" [disabled]="subfolder || !activityComponent?.loaded"
|
<ion-refresher slot="fixed" [disabled]="subfolder || activityComponent?.showLoading"
|
||||||
(ionRefresh)="activityComponent?.doRefresh($event.target)">
|
(ionRefresh)="activityComponent?.doRefresh($event.target)">
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-split-view>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
<core-loading [hideUntil]="discussions && discussions.loaded">
|
<core-loading [hideUntil]="!showLoading && discussions && discussions.loaded">
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="forum && forum.type != 'single' && description" [component]="component"
|
<core-course-module-info [module]="module" [description]="forum && forum.type != 'single' && description" [component]="component"
|
||||||
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</core-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()">
|
(completionChanged)="onCompletionChange()">
|
||||||
</core-course-module-navigation>
|
</core-course-module-navigation>
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Cannot upload them in online, save them in offline.
|
// 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.
|
// Cannot store them in offline. Reject.
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,10 @@ export class AddonModForumHelperProvider {
|
||||||
try {
|
try {
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (CoreUtils.isWebServiceError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot upload them in online, save them in offline.
|
// Cannot upload them in online, save them in offline.
|
||||||
saveOffline = true;
|
saveOffline = true;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-split-view>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
[autoFocus]="true" [lengthCheck]="2" (onClear)="toggleSearch()" searchArea="AddonModGlossary-{{module.id}}">
|
[autoFocus]="true" [lengthCheck]="2" (onClear)="toggleSearch()" searchArea="AddonModGlossary-{{module.id}}">
|
||||||
</core-search-box>
|
</core-search-box>
|
||||||
|
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info *ngIf="!isSearch" [module]="module" [description]="description" [component]="component"
|
<core-course-module-info *ngIf="!isSearch" [module]="module" [description]="description" [component]="component"
|
||||||
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
</core-infinite-loading>
|
</core-infinite-loading>
|
||||||
</core-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()">
|
(completionChanged)="onCompletionChange()">
|
||||||
</core-course-module-navigation>
|
</core-course-module-navigation>
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
|
||||||
this.loadingMessage = Translate.instant('core.loading');
|
this.loadingMessage = Translate.instant('core.loading');
|
||||||
this.content?.scrollToTop();
|
this.content?.scrollToTop();
|
||||||
this.switchMode(mode);
|
this.switchMode(mode);
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
this.loadContent();
|
this.loadContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
|
||||||
*/
|
*/
|
||||||
search(query: string): void {
|
search(query: string): void {
|
||||||
this.loadingMessage = Translate.instant('core.searching');
|
this.loadingMessage = Translate.instant('core.searching');
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
|
|
||||||
this.entries?.getSource().search(query);
|
this.entries?.getSource().search(query);
|
||||||
this.loadContent();
|
this.loadContent();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreTextUtils } from '@services/utils/text';
|
import { CoreTextUtils } from '@services/utils/text';
|
||||||
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { CoreForms } from '@singletons/form';
|
import { CoreForms } from '@singletons/form';
|
||||||
|
@ -392,7 +393,11 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave {
|
||||||
saveOffline: false,
|
saveOffline: false,
|
||||||
attachmentsResult,
|
attachmentsResult,
|
||||||
};
|
};
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
if (CoreUtils.isWebServiceError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot upload them in online, save them in offline.
|
// Cannot upload them in online, save them in offline.
|
||||||
const attachmentsResult = await AddonModGlossaryHelper.storeFiles(
|
const attachmentsResult = await AddonModGlossaryHelper.storeFiles(
|
||||||
this.glossary.id,
|
this.glossary.id,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -68,5 +68,6 @@
|
||||||
</core-h5p-iframe>
|
</core-h5p-iframe>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<!-- Buttons to add to the header. -->
|
<!-- Buttons to add to the header. -->
|
||||||
<core-navbar-buttons slot="end">
|
<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-icon name="fas-bookmark" slot="icon-only" aria-hidden="true"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module">
|
<core-course-module-info [module]="module">
|
||||||
|
@ -26,9 +26,10 @@
|
||||||
<div class="addon-mod-imscp-container">
|
<div class="addon-mod-imscp-container">
|
||||||
<core-navigation-bar [items]="navigationItems" (action)="loadItem($event)">
|
<core-navigation-bar [items]="navigationItems" (action)="loadItem($event)">
|
||||||
</core-navigation-bar>
|
</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>
|
</div>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
<core-tabs [hideUntil]="loaded" [selectedIndex]="selectedTab">
|
<core-tabs [hideUntil]="!showLoading" [selectedIndex]="selectedTab">
|
||||||
<!-- Index/Preview tab. -->
|
<!-- Index/Preview tab. -->
|
||||||
<core-tab [title]="'addon.mod_lesson.preview' | translate" (ionSelect)="indexSelected()">
|
<core-tab [title]="'addon.mod_lesson.preview' | translate" (ionSelect)="indexSelected()">
|
||||||
<ng-template>
|
<ng-template>
|
||||||
|
@ -279,5 +279,6 @@
|
||||||
</core-tabs>
|
</core-tabs>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -618,7 +618,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.validatePassword(<string> password);
|
await this.validatePassword(<string> password);
|
||||||
|
@ -635,7 +635,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModal(error);
|
CoreDomUtils.showErrorModal(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
|
|
||||||
CoreForms.triggerFormSubmittedEvent(this.formElement, true, this.siteId);
|
CoreForms.triggerFormSubmittedEvent(this.formElement, true, this.siteId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
||||||
|
@ -21,5 +21,6 @@
|
||||||
</div>
|
</div>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
||||||
|
@ -32,5 +32,6 @@
|
||||||
|
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -206,5 +206,6 @@
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -455,13 +455,13 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh data.
|
// Refresh data.
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
this.content?.scrollToTop();
|
this.content?.scrollToTop();
|
||||||
|
|
||||||
await promise;
|
await promise;
|
||||||
await CoreUtils.ignoreErrors(this.refreshContent(true));
|
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) {
|
if (status == CoreConstants.DOWNLOADED && previousStatus == CoreConstants.DOWNLOADING) {
|
||||||
// Quiz downloaded now, maybe a new attempt was created. Load content again.
|
// Quiz downloaded now, maybe a new attempt was created. Load content again.
|
||||||
this.loaded = false;
|
this.showLoadingAndFetch();
|
||||||
this.loadContent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [courseId]="courseId" [description]="displayDescription && description"
|
<core-course-module-info [module]="module" [courseId]="courseId" [description]="displayDescription && description"
|
||||||
|
@ -97,5 +97,6 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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)">
|
(ionRefresh)="activityComponent?.doRefresh($event.target)">
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
||||||
<ng-container *ngIf="scorm && loaded && !scorm.warningMessage">
|
<ng-container *ngIf="scorm && !showLoading && !scorm.warningMessage">
|
||||||
<!-- Attempts status. -->
|
<!-- Attempts status. -->
|
||||||
<ion-card *ngIf="(scorm.displayattemptstatus || offlineAttempts.length) && !skip">
|
<ion-card *ngIf="(scorm.displayattemptstatus || offlineAttempts.length) && !skip">
|
||||||
<ion-card-header class="ion-text-wrap">
|
<ion-card-header class="ion-text-wrap">
|
||||||
|
@ -217,5 +217,6 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded" class="safe-area-padding">
|
<core-loading [hideUntil]="!showLoading" class="safe-area-padding">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="survey && !survey.surveydone && !hasOffline && description"
|
<core-course-module-info [module]="module" [description]="survey && !survey.surveydone && !hasOffline && description"
|
||||||
|
@ -131,5 +131,6 @@
|
||||||
|
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
||||||
|
@ -46,5 +46,6 @@
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<ion-icon *ngIf="groupWiki" name="fas-users" aria-hidden="true"></ion-icon>
|
<ion-icon *ngIf="groupWiki" name="fas-users" aria-hidden="true"></ion-icon>
|
||||||
</ion-button>
|
</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">
|
aria-haspopup="true">
|
||||||
<ion-icon name="fas-map" aria-hidden="true"></ion-icon>
|
<ion-icon name="fas-map" aria-hidden="true"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||||
|
@ -71,7 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
||||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canEdit">
|
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canEdit">
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,11 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe
|
||||||
files,
|
files,
|
||||||
saveOffline,
|
saveOffline,
|
||||||
);
|
);
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
if (CoreUtils.isWebServiceError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot upload them in online, save them in offline.
|
// Cannot upload them in online, save them in offline.
|
||||||
saveOffline = true;
|
saveOffline = true;
|
||||||
allowOffline = true;
|
allowOffline = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<!-- Content. -->
|
<!-- Content. -->
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="!showLoading">
|
||||||
|
|
||||||
<!-- Activity info. -->
|
<!-- Activity info. -->
|
||||||
<core-course-module-info [module]="module" [hasDataToSync]="hasOffline">
|
<core-course-module-info [module]="module" [hasDataToSync]="hasOffline">
|
||||||
|
@ -233,5 +233,6 @@
|
||||||
</div>
|
</div>
|
||||||
</core-loading>
|
</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>
|
</core-course-module-navigation>
|
||||||
|
|
|
@ -25,6 +25,7 @@ import { CoreSites } from '@services/sites';
|
||||||
import { CoreSync } from '@services/sync';
|
import { CoreSync } from '@services/sync';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreTextUtils } from '@services/utils/text';
|
import { CoreTextUtils } from '@services/utils/text';
|
||||||
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreEvents } from '@singletons/events';
|
import { CoreEvents } from '@singletons/events';
|
||||||
import { CoreForms } from '@singletons/form';
|
import { CoreForms } from '@singletons/form';
|
||||||
|
@ -349,7 +350,11 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
||||||
inputData.attachmentfiles,
|
inputData.attachmentfiles,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
if (CoreUtils.isWebServiceError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot upload them in online, save them in offline.
|
// Cannot upload them in online, save them in offline.
|
||||||
saveOffline = true;
|
saveOffline = true;
|
||||||
allowOffline = true;
|
allowOffline = true;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<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-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { CoreCaptureError } from './captureerror';
|
||||||
import { CoreNetworkError } from './network-error';
|
import { CoreNetworkError } from './network-error';
|
||||||
import { CoreSiteError } from './siteerror';
|
import { CoreSiteError } from './siteerror';
|
||||||
import { CoreErrorWithTitle } from './errorwithtitle';
|
import { CoreErrorWithTitle } from './errorwithtitle';
|
||||||
|
import { CoreHttpError } from './httperror';
|
||||||
|
|
||||||
export const CORE_ERRORS_CLASSES: Type<unknown>[] = [
|
export const CORE_ERRORS_CLASSES: Type<unknown>[] = [
|
||||||
CoreAjaxError,
|
CoreAjaxError,
|
||||||
|
@ -36,4 +37,5 @@ export const CORE_ERRORS_CLASSES: Type<unknown>[] = [
|
||||||
CoreSiteError,
|
CoreSiteError,
|
||||||
CoreWSError,
|
CoreWSError,
|
||||||
CoreErrorWithTitle,
|
CoreErrorWithTitle,
|
||||||
|
CoreHttpError,
|
||||||
];
|
];
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -116,7 +116,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR
|
||||||
* @return Resolved when done.
|
* @return Resolved when done.
|
||||||
*/
|
*/
|
||||||
protected async showLoadingAndFetch(sync: boolean = false, showErrors: boolean = false): Promise<void> {
|
protected async showLoadingAndFetch(sync: boolean = false, showErrors: boolean = false): Promise<void> {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
this.content?.scrollToTop();
|
this.content?.scrollToTop();
|
||||||
|
|
||||||
await this.loadContent(false, sync, showErrors);
|
await this.loadContent(false, sync, showErrors);
|
||||||
|
@ -130,7 +130,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR
|
||||||
* @return Resolved when done.
|
* @return Resolved when done.
|
||||||
*/
|
*/
|
||||||
protected showLoadingAndRefresh(sync: boolean = false, showErrors: boolean = false): Promise<void> {
|
protected showLoadingAndRefresh(sync: boolean = false, showErrors: boolean = false): Promise<void> {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
this.content?.scrollToTop();
|
this.content?.scrollToTop();
|
||||||
|
|
||||||
return this.refreshContent(sync, showErrors);
|
return this.refreshContent(sync, showErrors);
|
||||||
|
@ -177,7 +177,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR
|
||||||
|
|
||||||
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
|
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
|
||||||
@Input() courseId!: number; // Course ID the component belongs to.
|
@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.
|
@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.
|
component?: string; // Component name.
|
||||||
componentId?: number; // Component ID.
|
componentId?: number; // Component ID.
|
||||||
hasOffline = false; // Resources don't have any data to sync.
|
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);
|
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,12 +416,12 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
if (this.loaded && (data.action == 'refresh' || data.action == 'sync')) {
|
if (!this.showLoading && (data.action == 'refresh' || data.action == 'sync')) {
|
||||||
this.loaded = false;
|
this.showLoading = true;
|
||||||
try {
|
try {
|
||||||
await this.doRefresh(undefined, data.action == 'sync');
|
await this.doRefresh(undefined, data.action == 'sync');
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,6 +530,18 @@ export class CoreTextUtilsProvider {
|
||||||
return error.message || error.error || error.content || error.body;
|
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.
|
* Get the pluginfile URL to replace @@PLUGINFILE@@ wildcards.
|
||||||
*
|
*
|
||||||
|
|
|
@ -858,12 +858,17 @@ export class CoreUtilsProvider {
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
isWebServiceError(error: any): boolean {
|
isWebServiceError(error: any): boolean {
|
||||||
return error && (error.warningcode !== undefined || (error.errorcode !== undefined &&
|
return error && (
|
||||||
error.errorcode != 'userdeleted' && error.errorcode != 'upgraderunning' &&
|
error.warningcode !== undefined ||
|
||||||
|
(
|
||||||
|
error.errorcode !== undefined && error.errorcode != 'userdeleted' && error.errorcode != 'upgraderunning' &&
|
||||||
error.errorcode != 'forcepasswordchangenotice' && error.errorcode != 'usernotfullysetup' &&
|
error.errorcode != 'forcepasswordchangenotice' && error.errorcode != 'usernotfullysetup' &&
|
||||||
error.errorcode != 'sitepolicynotagreed' && error.errorcode != 'sitemaintenance' &&
|
error.errorcode != 'sitepolicynotagreed' && error.errorcode != 'sitemaintenance' &&
|
||||||
error.errorcode != 'wsaccessusersuspended' && error.errorcode != 'wsaccessuserdeleted' &&
|
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.
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
|
||||||
import { HttpResponse, HttpParams } from '@angular/common/http';
|
import { HttpResponse, HttpParams } from '@angular/common/http';
|
||||||
|
|
||||||
import { FileEntry } from '@ionic-native/file/ngx';
|
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 { Md5 } from 'ts-md5/dist/md5';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { timeout } from 'rxjs/operators';
|
import { timeout } from 'rxjs/operators';
|
||||||
|
@ -25,7 +25,7 @@ import { CoreNativeToAngularHttpResponse } from '@classes/native-to-angular-http
|
||||||
import { CoreApp } from '@services/app';
|
import { CoreApp } from '@services/app';
|
||||||
import { CoreFile, CoreFileFormat } from '@services/file';
|
import { CoreFile, CoreFileFormat } from '@services/file';
|
||||||
import { CoreMimetypeUtils } from '@services/utils/mimetype';
|
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 { CoreUtils, PromiseDefer } from '@services/utils/utils';
|
||||||
import { CoreConstants } from '@/core/constants';
|
import { CoreConstants } from '@/core/constants';
|
||||||
import { CoreError } from '@classes/errors/error';
|
import { CoreError } from '@classes/errors/error';
|
||||||
|
@ -38,6 +38,7 @@ import { CoreAjaxError } from '@classes/errors/ajaxerror';
|
||||||
import { CoreAjaxWSError } from '@classes/errors/ajaxwserror';
|
import { CoreAjaxWSError } from '@classes/errors/ajaxwserror';
|
||||||
import { CoreNetworkError } from '@classes/errors/network-error';
|
import { CoreNetworkError } from '@classes/errors/network-error';
|
||||||
import { CoreSite } from '@classes/site';
|
import { CoreSite } from '@classes/site';
|
||||||
|
import { CoreHttpError } from '@classes/errors/httperror';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This service allows performing WS calls and download/upload files.
|
* This service allows performing WS calls and download/upload files.
|
||||||
|
@ -693,6 +694,8 @@ export class CoreWSProvider {
|
||||||
return retryPromise;
|
return retryPromise;
|
||||||
} else if (error.status === -2) {
|
} else if (error.status === -2) {
|
||||||
throw new CoreError(this.getCertificateErrorMessage(error.error));
|
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'));
|
throw new CoreError(Translate.instant('core.serverconnection'));
|
||||||
|
@ -885,8 +888,15 @@ export class CoreWSProvider {
|
||||||
options.headers = {};
|
options.headers = {};
|
||||||
options['Connection'] = 'close';
|
options['Connection'] = 'close';
|
||||||
|
|
||||||
|
let success: FileUploadResult;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const success = await transfer.upload(filePath, uploadUrl, options, true);
|
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
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const data = CoreTextUtils.parseJSON<any>(
|
const data = CoreTextUtils.parseJSON<any>(
|
||||||
|
@ -925,11 +935,22 @@ export class CoreWSProvider {
|
||||||
this.logger.debug('Successfully uploaded file', filePath);
|
this.logger.debug('Successfully uploaded file', filePath);
|
||||||
|
|
||||||
return data[0];
|
return data[0];
|
||||||
} catch (error) {
|
|
||||||
this.logger.error('Error while uploading file', filePath, error);
|
|
||||||
|
|
||||||
throw new CoreError(Translate.instant('core.errorinvalidresponse'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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.
|
- 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.
|
- fillContextMenu, expandDescription, gotoBlog, prefetch and removeFiles functions have been removed from CoreCourseModuleMainResourceComponent.
|
||||||
- contextMenuPrefetch and fillContextMenu have been removed from CoreCourseHelper.
|
- contextMenuPrefetch and fillContextMenu have been removed from CoreCourseHelper.
|
||||||
|
-The variable "loaded" in CoreCourseModuleMainResourceComponent has been changed to "showLoading" to reflect its purpose better.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue