Merge pull request #1703 from crazyserver/MOBILE-2795

Mobile 2795
main
Juan Leyva 2019-01-04 16:20:48 +01:00 committed by GitHub
commit b83656655a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 32 deletions

View File

@ -57,7 +57,7 @@
"searchnomessagesfound": "No messages found", "searchnomessagesfound": "No messages found",
"searchnononcontactsfound": "No non contacts found", "searchnononcontactsfound": "No non contacts found",
"sendcontactrequest": "Send contact request", "sendcontactrequest": "Send contact request",
"showdeletemessages": "Show delete messages", "showdeletemessages": "Show delete options",
"type_blocked": "Blocked", "type_blocked": "Blocked",
"type_offline": "Offline", "type_offline": "Offline",
"type_online": "Online", "type_online": "Online",

View File

@ -1,8 +1,8 @@
<ion-header> <ion-header>
<ion-navbar core-back-button> <ion-navbar core-back-button>
<ion-title> <ion-title>
<img *ngIf="!otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" alt="" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null"> <img *ngIf="loaded && !otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" alt="" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
<ion-avatar *ngIf="otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar> <ion-avatar *ngIf="loaded && otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar>
<core-format-text [text]="title" (click)="showInfo && !isGroup && viewInfo()"></core-format-text> <core-format-text [text]="title" (click)="showInfo && !isGroup && viewInfo()"></core-format-text>
<core-icon *ngIf="conversation && conversation.isfavourite" name="fa-star"></core-icon> <core-icon *ngIf="conversation && conversation.isfavourite" name="fa-star"></core-icon>
</ion-title> </ion-title>

View File

@ -2,7 +2,7 @@
<ion-navbar core-back-button> <ion-navbar core-back-button>
<ion-title><core-format-text [text]="title"></core-format-text></ion-title> <ion-title><core-format-text [text]="title"></core-format-text></ion-title>
<ion-buttons end> <ion-buttons end>
<button ion-button clear (click)="save()" [attr.aria-label]="'core.save' | translate"> <button ion-button clear (click)="save($event)" [attr.aria-label]="'core.save' | translate">
{{ 'core.save' | translate }} {{ 'core.save' | translate }}
</button> </button>
</ion-buttons> </ion-buttons>

View File

@ -113,7 +113,7 @@
{{ 'addon.mod_feedback.preview' | translate }} {{ 'addon.mod_feedback.preview' | translate }}
</button> </button>
</ion-col> </ion-col>
<ion-col *ngIf="access.cancomplete && access.cansubmit"> <ion-col *ngIf="access.cancomplete && access.cansubmit && access.isopen">
<button ion-button block icon-end *ngIf="!goPage" (click)="gotoAnswerQuestions()"> <button ion-button block icon-end *ngIf="!goPage" (click)="gotoAnswerQuestions()">
{{ 'addon.mod_feedback.complete_the_form' | translate }} {{ 'addon.mod_feedback.complete_the_form' | translate }}
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward"></ion-icon>

View File

@ -138,7 +138,7 @@ export class AddonModFeedbackHelperProvider {
responses[name] = value; responses[name] = value;
}); });
} else { } else {
if (itemData.typ == 'multichoice') { if (itemData.typ == 'multichoice' && itemData.subtype != 'r') {
name = nameTemp + '[0]'; name = nameTemp + '[0]';
} else { } else {
name = nameTemp; name = nameTemp;

View File

@ -55,7 +55,7 @@ export class MoodleMobileApp implements OnInit {
desktopClass += this.appProvider.isMac() ? ' platform-mac' : ''; desktopClass += this.appProvider.isMac() ? ' platform-mac' : '';
desktopClass += this.appProvider.isLinux() ? ' platform-linux' : ''; desktopClass += this.appProvider.isLinux() ? ' platform-linux' : '';
desktopClass += this.appProvider.isWindows() ? ' platform-windows' : ''; desktopClass += this.appProvider.isWindows() ? ' platform-windows' : '';
app.setElementClass(desktopClass, true); desktopClass != '' ? app.setElementClass(desktopClass, true) : false;
}); });
} }

View File

@ -411,6 +411,10 @@ ion-app.app-root {
} }
} }
.col > .button-block {
contain: content;
}
// File uploader. // File uploader.
// ------------------------- // -------------------------

View File

@ -205,7 +205,7 @@
"addon.messages.searchnomessagesfound": "No messages found", "addon.messages.searchnomessagesfound": "No messages found",
"addon.messages.searchnononcontactsfound": "No non contacts found", "addon.messages.searchnononcontactsfound": "No non contacts found",
"addon.messages.sendcontactrequest": "Send contact request", "addon.messages.sendcontactrequest": "Send contact request",
"addon.messages.showdeletemessages": "Show delete messages", "addon.messages.showdeletemessages": "Show delete options",
"addon.messages.type_blocked": "Blocked", "addon.messages.type_blocked": "Blocked",
"addon.messages.type_offline": "Offline", "addon.messages.type_offline": "Offline",
"addon.messages.type_online": "Online", "addon.messages.type_online": "Online",
@ -1165,7 +1165,7 @@
"core.areyousure": "Are you sure?", "core.areyousure": "Are you sure?",
"core.back": "Back", "core.back": "Back",
"core.cancel": "Cancel", "core.cancel": "Cancel",
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL.", "core.cannotconnect": "Cannot connect: Verify that you have typed the URL correctly.",
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.", "core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
"core.captureaudio": "Record audio", "core.captureaudio": "Record audio",
"core.capturedimage": "Taken picture.", "core.capturedimage": "Taken picture.",
@ -1460,7 +1460,7 @@
"core.login.selectsite": "Please select your site:", "core.login.selectsite": "Please select your site:",
"core.login.signupplugindisabled": "{{$a}} is not enabled.", "core.login.signupplugindisabled": "{{$a}} is not enabled.",
"core.login.siteaddress": "Site address", "core.login.siteaddress": "Site address",
"core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.", "core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects and so cannot connect to your site.",
"core.login.siteinmaintenance": "Your site is in maintenance mode", "core.login.siteinmaintenance": "Your site is in maintenance mode",
"core.login.sitepolicynotagreederror": "Site policy not agreed.", "core.login.sitepolicynotagreederror": "Site policy not agreed.",
"core.login.siteurl": "Site URL", "core.login.siteurl": "Site URL",
@ -1522,7 +1522,7 @@
"core.nograde": "No grade", "core.nograde": "No grade",
"core.none": "None", "core.none": "None",
"core.nopasswordchangeforced": "You cannot proceed without changing your password.", "core.nopasswordchangeforced": "You cannot proceed without changing your password.",
"core.nopermissionerror": "Sorry, but you do not currently have permissions to do that", "core.nopermissionerror": "Sorry, but you do not currently have permissions to do that.",
"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",
@ -1596,7 +1596,7 @@
"core.settings.cordovaversion": "Cordova version", "core.settings.cordovaversion": "Cordova version",
"core.settings.currentlanguage": "Current language", "core.settings.currentlanguage": "Current language",
"core.settings.debugdisplay": "Display debug messages", "core.settings.debugdisplay": "Display debug messages",
"core.settings.debugdisplaydescription": "If enabled, error modals will display more data about the error if possible.", "core.settings.debugdisplaydescription": "If enabled, additional information about errors will be displayed.",
"core.settings.deletesitefiles": "Are you sure that you want to delete the downloaded files from the site '{{sitename}}'?", "core.settings.deletesitefiles": "Are you sure that you want to delete the downloaded files from the site '{{sitename}}'?",
"core.settings.deletesitefilestitle": "Delete site files", "core.settings.deletesitefilestitle": "Delete site files",
"core.settings.deviceinfo": "Device info", "core.settings.deviceinfo": "Device info",

View File

@ -12,11 +12,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { Component, Input, OnInit, OnChanges, SimpleChange } from '@angular/core'; import { Component, Input, OnInit, OnChanges, OnDestroy, SimpleChange } from '@angular/core';
import { NavController } from 'ionic-angular'; import { NavController } from 'ionic-angular';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { CoreAppProvider } from '@providers/app'; import { CoreAppProvider } from '@providers/app';
import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreEventsProvider } from '@providers/events';
import { CoreUserProvider } from '@core/user/providers/user';
/** /**
* Component to display a "user avatar". * Component to display a "user avatar".
@ -27,7 +29,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
selector: 'ion-avatar[core-user-avatar]', selector: 'ion-avatar[core-user-avatar]',
templateUrl: 'core-user-avatar.html' templateUrl: 'core-user-avatar.html'
}) })
export class CoreUserAvatarComponent implements OnInit, OnChanges { export class CoreUserAvatarComponent implements OnInit, OnChanges, OnDestroy {
@Input() user: any; @Input() user: any;
// The following params will override the ones in user object. // The following params will override the ones in user object.
@Input() profileUrl?: string; @Input() profileUrl?: string;
@ -42,10 +44,17 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
protected timetoshowusers = 300000; // Miliseconds default. protected timetoshowusers = 300000; // Miliseconds default.
protected myUser = false; protected myUser = false;
protected currentUserId: number; protected currentUserId: number;
protected pictureObs;
constructor(private navCtrl: NavController, private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider, constructor(private navCtrl: NavController, private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider,
private appProvider: CoreAppProvider) { private appProvider: CoreAppProvider, eventsProvider: CoreEventsProvider) {
this.currentUserId = this.sitesProvider.getCurrentSiteUserId(); this.currentUserId = this.sitesProvider.getCurrentSiteUserId();
this.pictureObs = eventsProvider.on(CoreUserProvider.PROFILE_PICTURE_UPDATED, (data) => {
if (data.userId == this.userId) {
this.profileUrl = data.picture;
}
}, this.sitesProvider.getCurrentSiteId());
} }
/** /**
@ -69,11 +78,11 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
* Set fields from user. * Set fields from user.
*/ */
protected setFields(): void { protected setFields(): void {
this.profileUrl = this.profileUrl || (this.user && (this.user.profileimageurl || this.user.userprofileimageurl || const profileUrl = this.profileUrl || (this.user && (this.user.profileimageurl || this.user.userprofileimageurl ||
this.user.userpictureurl || this.user.profileimageurlsmall)); this.user.userpictureurl || this.user.profileimageurlsmall));
if (typeof this.profileUrl != 'string') { if (typeof profileUrl == 'string') {
this.profileUrl = ''; this.profileUrl = profileUrl;
} }
this.fullname = this.fullname || (this.user && (this.user.fullname || this.user.userfullname)); this.fullname = this.fullname || (this.user && (this.user.fullname || this.user.userfullname));
@ -117,4 +126,11 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
this.navCtrl.push('CoreUserProfilePage', { userId: this.userId, courseId: this.courseId }); this.navCtrl.push('CoreUserProfilePage', { userId: this.userId, courseId: this.courseId });
} }
} }
/**
* Component destroyed.
*/
ngOnDestroy(): void {
this.pictureObs && this.pictureObs.off();
}
} }

View File

@ -78,20 +78,16 @@ export class CoreCommentsViewerPage {
// Get the user profile image. // Get the user profile image.
this.userProvider.getProfile(comment.userid, undefined, true).then((user) => { this.userProvider.getProfile(comment.userid, undefined, true).then((user) => {
comment.profileimageurl = user.profileimageurl; comment.profileimageurl = user.profileimageurl;
}).catch(() => {
// Ignore errors.
}); });
}); });
}).catch((error) => { }).catch((error) => {
if (error) { if (error && this.component == 'assignsubmission_comments') {
if (this.component == 'assignsubmission_comments') { this.domUtils.showAlertTranslated('core.notice', 'core.commentsnotworking');
this.domUtils.showAlertTranslated('core.notice', 'core.commentsnotworking');
} else {
this.domUtils.showErrorModal(error);
}
} else { } else {
this.domUtils.showErrorModal(this.translate.instant('core.error') + ': get_comments'); this.domUtils.showErrorModalDefault(error, this.translate.instant('core.error') + ': get_comments');
} }
return Promise.reject(null);
}); });
} }

View File

@ -77,7 +77,7 @@
"selectsite": "Please select your site:", "selectsite": "Please select your site:",
"signupplugindisabled": "{{$a}} is not enabled.", "signupplugindisabled": "{{$a}} is not enabled.",
"siteaddress": "Site address", "siteaddress": "Site address",
"sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.", "sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects and so cannot connect to your site.",
"siteinmaintenance": "Your site is in maintenance mode", "siteinmaintenance": "Your site is in maintenance mode",
"sitepolicynotagreederror": "Site policy not agreed.", "sitepolicynotagreederror": "Site policy not agreed.",
"siteurl": "Site URL", "siteurl": "Site URL",

View File

@ -11,7 +11,7 @@
"cordovaversion": "Cordova version", "cordovaversion": "Cordova version",
"currentlanguage": "Current language", "currentlanguage": "Current language",
"debugdisplay": "Display debug messages", "debugdisplay": "Display debug messages",
"debugdisplaydescription": "If enabled, error modals will display more data about the error if possible.", "debugdisplaydescription": "If enabled, additional information about errors will be displayed.",
"deletesitefiles": "Are you sure that you want to delete the downloaded files from the site '{{sitename}}'?", "deletesitefiles": "Are you sure that you want to delete the downloaded files from the site '{{sitename}}'?",
"deletesitefilestitle": "Delete site files", "deletesitefilestitle": "Delete site files",
"deviceinfo": "Device info", "deviceinfo": "Device info",

View File

@ -148,7 +148,7 @@ export class CoreUserProfilePage {
this.eventsProvider.trigger(CoreUserProvider.PROFILE_PICTURE_UPDATED, { this.eventsProvider.trigger(CoreUserProvider.PROFILE_PICTURE_UPDATED, {
userId: this.userId, userId: this.userId,
picture: profileImageURL picture: profileImageURL
}); }, this.site.getId());
this.sitesProvider.updateSiteInfo(this.site.getId()); this.sitesProvider.updateSiteInfo(this.site.getId());
this.refreshUser(); this.refreshUser();
}).finally(() => { }).finally(() => {

View File

@ -11,7 +11,7 @@
"areyousure": "Are you sure?", "areyousure": "Are you sure?",
"back": "Back", "back": "Back",
"cancel": "Cancel", "cancel": "Cancel",
"cannotconnect": "Cannot connect: Verify that you have correctly typed the URL.", "cannotconnect": "Cannot connect: Verify that you have typed the URL correctly.",
"cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.", "cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
"captureaudio": "Record audio", "captureaudio": "Record audio",
"capturedimage": "Taken picture.", "capturedimage": "Taken picture.",
@ -164,7 +164,7 @@
"nograde": "No grade", "nograde": "No grade",
"none": "None", "none": "None",
"nopasswordchangeforced": "You cannot proceed without changing your password.", "nopasswordchangeforced": "You cannot proceed without changing your password.",
"nopermissionerror": "Sorry, but you do not currently have permissions to do that", "nopermissionerror": "Sorry, but you do not currently have permissions to do that.",
"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",