commit
3f9375a2ea
|
@ -1266,9 +1266,11 @@
|
||||||
"core.course.activitynotyetviewablesiteupgradeneeded": "local_moodlemobileapp",
|
"core.course.activitynotyetviewablesiteupgradeneeded": "local_moodlemobileapp",
|
||||||
"core.course.allsections": "local_moodlemobileapp",
|
"core.course.allsections": "local_moodlemobileapp",
|
||||||
"core.course.askadmintosupport": "local_moodlemobileapp",
|
"core.course.askadmintosupport": "local_moodlemobileapp",
|
||||||
|
"core.course.availablespace": "local_moodlemobileapp",
|
||||||
"core.course.confirmdeletemodulefiles": "local_moodlemobileapp",
|
"core.course.confirmdeletemodulefiles": "local_moodlemobileapp",
|
||||||
"core.course.confirmdownload": "local_moodlemobileapp",
|
"core.course.confirmdownload": "local_moodlemobileapp",
|
||||||
"core.course.confirmdownloadunknownsize": "local_moodlemobileapp",
|
"core.course.confirmdownloadunknownsize": "local_moodlemobileapp",
|
||||||
|
"core.course.confirmlimiteddownload": "local_moodlemobileapp",
|
||||||
"core.course.confirmpartialdownloadsize": "local_moodlemobileapp",
|
"core.course.confirmpartialdownloadsize": "local_moodlemobileapp",
|
||||||
"core.course.contents": "local_moodlemobileapp",
|
"core.course.contents": "local_moodlemobileapp",
|
||||||
"core.course.couldnotloadsectioncontent": "local_moodlemobileapp",
|
"core.course.couldnotloadsectioncontent": "local_moodlemobileapp",
|
||||||
|
@ -1280,6 +1282,8 @@
|
||||||
"core.course.errorgetmodule": "local_moodlemobileapp",
|
"core.course.errorgetmodule": "local_moodlemobileapp",
|
||||||
"core.course.hiddenfromstudents": "moodle",
|
"core.course.hiddenfromstudents": "moodle",
|
||||||
"core.course.hiddenoncoursepage": "moodle",
|
"core.course.hiddenoncoursepage": "moodle",
|
||||||
|
"core.course.insufficientavailablequota": "local_moodlemobileapp",
|
||||||
|
"core.course.insufficientavailablespace": "local_moodlemobileapp",
|
||||||
"core.course.manualcompletionnotsynced": "local_moodlemobileapp",
|
"core.course.manualcompletionnotsynced": "local_moodlemobileapp",
|
||||||
"core.course.nocontentavailable": "local_moodlemobileapp",
|
"core.course.nocontentavailable": "local_moodlemobileapp",
|
||||||
"core.course.overriddennotice": "grades",
|
"core.course.overriddennotice": "grades",
|
||||||
|
@ -1586,6 +1590,7 @@
|
||||||
"core.nopermissions": "error",
|
"core.nopermissions": "error",
|
||||||
"core.noresults": "moodle",
|
"core.noresults": "moodle",
|
||||||
"core.notapplicable": "local_moodlemobileapp",
|
"core.notapplicable": "local_moodlemobileapp",
|
||||||
|
"core.notenrolledprofile": "moodle",
|
||||||
"core.notice": "moodle",
|
"core.notice": "moodle",
|
||||||
"core.notingroup": "moodle",
|
"core.notingroup": "moodle",
|
||||||
"core.notsent": "local_moodlemobileapp",
|
"core.notsent": "local_moodlemobileapp",
|
||||||
|
|
|
@ -72,7 +72,7 @@ export class AddonNotesUserHandler implements CoreUserProfileHandler {
|
||||||
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
|
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
|
||||||
// Active course required.
|
// Active course required.
|
||||||
if (!courseId || user.id == this.sitesProvider.getCurrentSiteUserId()) {
|
if (!courseId || user.id == this.sitesProvider.getCurrentSiteUserId()) {
|
||||||
return Promise.resolve(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.noteEnabledCache[courseId] != 'undefined') {
|
if (typeof this.noteEnabledCache[courseId] != 'undefined') {
|
||||||
|
|
|
@ -1590,6 +1590,7 @@
|
||||||
"core.nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).",
|
"core.nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).",
|
||||||
"core.noresults": "No results",
|
"core.noresults": "No results",
|
||||||
"core.notapplicable": "n/a",
|
"core.notapplicable": "n/a",
|
||||||
|
"core.notenrolledprofile": "This profile is not available because this user is not enrolled in this course.",
|
||||||
"core.notice": "Notice",
|
"core.notice": "Notice",
|
||||||
"core.notingroup": "Sorry, but you need to be part of a group to see this page.",
|
"core.notingroup": "Sorry, but you need to be part of a group to see this page.",
|
||||||
"core.notsent": "Not sent",
|
"core.notsent": "Not sent",
|
||||||
|
|
|
@ -794,6 +794,17 @@ export class CoreSite {
|
||||||
request.deferred.reject = reject;
|
request.deferred.reject = reject;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return this.enqueueRequest(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a request to the queue.
|
||||||
|
*
|
||||||
|
* @param {RequestQueueItem} request The request to enqueue.
|
||||||
|
* @returns {Promise<any>} Promise resolved with the response when the WS is called.
|
||||||
|
*/
|
||||||
|
protected enqueueRequest(request: RequestQueueItem): Promise<any> {
|
||||||
|
|
||||||
this.requestQueue.push(request);
|
this.requestQueue.push(request);
|
||||||
|
|
||||||
if (this.requestQueue.length >= CoreSite.REQUEST_QUEUE_LIMIT) {
|
if (this.requestQueue.length >= CoreSite.REQUEST_QUEUE_LIMIT) {
|
||||||
|
@ -875,7 +886,7 @@ export class CoreSite {
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
// Request not executed, enqueue again.
|
// Request not executed, enqueue again.
|
||||||
this.callOrEnqueueRequest(request.method, request.data, request.preSets, request.wsPreSets);
|
this.enqueueRequest(request);
|
||||||
} else if (response.error) {
|
} else if (response.error) {
|
||||||
request.deferred.reject(this.textUtils.parseJSON(response.exception));
|
request.deferred.reject(this.textUtils.parseJSON(response.exception));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<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]="userLoaded">
|
<core-loading [hideUntil]="userLoaded">
|
||||||
<ion-list *ngIf="user && !isDeleted">
|
<ion-list *ngIf="user && !isDeleted && isEnrolled">
|
||||||
<ion-item text-center>
|
<ion-item text-center>
|
||||||
<ion-avatar core-user-avatar class="item-avatar-center" [user]="user" [userId]="user.id" [linkProfile]="false" [checkOnline]="true">
|
<ion-avatar core-user-avatar class="item-avatar-center" [user]="user" [userId]="user.id" [linkProfile]="false" [checkOnline]="true">
|
||||||
<ion-icon name="create" class="core-icon-foreground" *ngIf="canChangeProfilePicture" (click)="changeProfilePicture()"></ion-icon>
|
<ion-icon name="create" class="core-icon-foreground" *ngIf="canChangeProfilePicture" (click)="changeProfilePicture()"></ion-icon>
|
||||||
|
@ -58,8 +58,9 @@
|
||||||
</button>
|
</button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
<core-empty-box *ngIf="!user && !isDeleted" icon="person" [message]=" 'core.user.detailsnotavailable' | translate"></core-empty-box>
|
<core-empty-box *ngIf="!user && !isDeleted && isEnrolled" icon="person" [message]=" 'core.user.detailsnotavailable' | translate"></core-empty-box>
|
||||||
|
|
||||||
<core-empty-box *ngIf="isDeleted" icon="person" [message]="'core.userdeleted' | translate"></core-empty-box>
|
<core-empty-box *ngIf="isDeleted" icon="person" [message]="'core.userdeleted' | translate"></core-empty-box>
|
||||||
|
<core-empty-box *ngIf="!isEnrolled" icon="person" [message]="'core.notenrolledprofile' | translate"></core-empty-box>
|
||||||
</core-loading>
|
</core-loading>
|
||||||
</ion-content>
|
</ion-content>
|
|
@ -46,6 +46,7 @@ export class CoreUserProfilePage {
|
||||||
user: any;
|
user: any;
|
||||||
title: string;
|
title: string;
|
||||||
isDeleted = false;
|
isDeleted = false;
|
||||||
|
isEnrolled = true;
|
||||||
canChangeProfilePicture = false;
|
canChangeProfilePicture = false;
|
||||||
actionHandlers: CoreUserProfileHandlerData[] = [];
|
actionHandlers: CoreUserProfileHandlerData[] = [];
|
||||||
newPageHandlers: CoreUserProfileHandlerData[] = [];
|
newPageHandlers: CoreUserProfileHandlerData[] = [];
|
||||||
|
@ -85,6 +86,7 @@ export class CoreUserProfilePage {
|
||||||
this.fetchUser().then(() => {
|
this.fetchUser().then(() => {
|
||||||
return this.userProvider.logView(this.userId, this.courseId).catch((error) => {
|
return this.userProvider.logView(this.userId, this.courseId).catch((error) => {
|
||||||
this.isDeleted = error.errorcode === 'userdeleted';
|
this.isDeleted = error.errorcode === 'userdeleted';
|
||||||
|
this.isEnrolled = error.errorcode !== 'notenrolledprofile';
|
||||||
});
|
});
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.userLoaded = true;
|
this.userLoaded = true;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { Injectable } from '@angular/core';
|
||||||
import { NavController } from 'ionic-angular';
|
import { NavController } from 'ionic-angular';
|
||||||
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
|
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
|
||||||
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
||||||
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { CoreLoggerProvider } from '@providers/logger';
|
import { CoreLoggerProvider } from '@providers/logger';
|
||||||
import { CoreSitesProvider } from '@providers/sites';
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreEventsProvider } from '@providers/events';
|
import { CoreEventsProvider } from '@providers/events';
|
||||||
|
@ -173,7 +174,8 @@ export class CoreUserDelegate extends CoreDelegate {
|
||||||
}} = {};
|
}} = {};
|
||||||
|
|
||||||
constructor(protected loggerProvider: CoreLoggerProvider, protected sitesProvider: CoreSitesProvider,
|
constructor(protected loggerProvider: CoreLoggerProvider, protected sitesProvider: CoreSitesProvider,
|
||||||
private coursesProvider: CoreCoursesProvider, protected eventsProvider: CoreEventsProvider) {
|
private coursesProvider: CoreCoursesProvider, protected eventsProvider: CoreEventsProvider,
|
||||||
|
protected utils: CoreUtilsProvider) {
|
||||||
super('CoreUserDelegate', loggerProvider, sitesProvider, eventsProvider);
|
super('CoreUserDelegate', loggerProvider, sitesProvider, eventsProvider);
|
||||||
|
|
||||||
eventsProvider.on(CoreUserDelegate.UPDATE_HANDLER_EVENT, (data) => {
|
eventsProvider.on(CoreUserDelegate.UPDATE_HANDLER_EVENT, (data) => {
|
||||||
|
@ -266,25 +268,23 @@ export class CoreUserDelegate extends CoreDelegate {
|
||||||
for (const name in this.enabledHandlers) {
|
for (const name in this.enabledHandlers) {
|
||||||
// Checks if the handler is enabled for the user.
|
// Checks if the handler is enabled for the user.
|
||||||
const handler = <CoreUserProfileHandler> this.handlers[name],
|
const handler = <CoreUserProfileHandler> this.handlers[name],
|
||||||
isEnabledForUser = handler.isEnabledForUser(user, courseId, navOptions, admOptions),
|
isEnabledForUser = handler.isEnabledForUser(user, courseId, navOptions, admOptions);
|
||||||
promise = Promise.resolve(isEnabledForUser).then((enabled) => {
|
|
||||||
if (enabled) {
|
promises.push(Promise.resolve(isEnabledForUser).then((enabled) => {
|
||||||
userData.handlers.push({
|
if (enabled) {
|
||||||
name: name,
|
userData.handlers.push({
|
||||||
data: handler.getDisplayData(user, courseId),
|
name: name,
|
||||||
priority: handler.priority,
|
data: handler.getDisplayData(user, courseId),
|
||||||
type: handler.type || CoreUserDelegate.TYPE_NEW_PAGE
|
priority: handler.priority,
|
||||||
});
|
type: handler.type || CoreUserDelegate.TYPE_NEW_PAGE
|
||||||
} else {
|
});
|
||||||
return Promise.reject(null);
|
}
|
||||||
}
|
}).catch(() => {
|
||||||
}).catch(() => {
|
// Nothing to do here, it is not enabled for this user.
|
||||||
// Nothing to do here, it is not enabled for this user.
|
}));
|
||||||
});
|
|
||||||
promises.push(promise);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises).then(() => {
|
return this.utils.allPromises(promises).then(() => {
|
||||||
// Sort them by priority.
|
// Sort them by priority.
|
||||||
userData.handlers.sort((a, b) => {
|
userData.handlers.sort((a, b) => {
|
||||||
return b.priority - a.priority;
|
return b.priority - a.priority;
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class CoreUserProfileMailHandler implements CoreUserProfileHandler {
|
||||||
*/
|
*/
|
||||||
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
|
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
|
||||||
// Not current user required.
|
// Not current user required.
|
||||||
return user.id != this.sitesProvider.getCurrentSite().getUserId() && user.email;
|
return user.id != this.sitesProvider.getCurrentSite().getUserId() && !!user.email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
"nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).",
|
"nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).",
|
||||||
"noresults": "No results",
|
"noresults": "No results",
|
||||||
"notapplicable": "n/a",
|
"notapplicable": "n/a",
|
||||||
|
"notenrolledprofile": "This profile is not available because this user is not enrolled in this course.",
|
||||||
"notice": "Notice",
|
"notice": "Notice",
|
||||||
"notingroup": "Sorry, but you need to be part of a group to see this page.",
|
"notingroup": "Sorry, but you need to be part of a group to see this page.",
|
||||||
"notsent": "Not sent",
|
"notsent": "Not sent",
|
||||||
|
|
Loading…
Reference in New Issue