MOBILE-2253 core: Use core prefix instead of mm in lang strings

main
Dani Palou 2017-12-08 15:53:27 +01:00
parent e4ed9301fb
commit 03f1614856
36 changed files with 248 additions and 248 deletions

View File

@ -62,13 +62,13 @@ function treatMergedData(data) {
if (filepath.indexOf('lang/') === 0 || filepath.indexOf('core/lang') === 0) { if (filepath.indexOf('lang/') === 0 || filepath.indexOf('core/lang') === 0) {
addProperties(merged, data[filepath], 'mm.core.'); addProperties(merged, data[filepath], 'core.');
} else if (filepath.indexOf('core/') === 0) { } else if (filepath.indexOf('core/') === 0) {
var componentName = filepath.replace('core/', ''); var componentName = filepath.replace('core/', '');
componentName = componentName.substr(0, componentName.indexOf('/')); componentName = componentName.substr(0, componentName.indexOf('/'));
addProperties(merged, data[filepath], 'mm.'+componentName+'.'); addProperties(merged, data[filepath], 'core.'+componentName+'.');
} else if (filepath.indexOf('addons') === 0) { } else if (filepath.indexOf('addons') === 0) {
@ -86,11 +86,11 @@ function treatMergedData(data) {
} else if (filepath.indexOf('assets/countries') === 0) { } else if (filepath.indexOf('assets/countries') === 0) {
addProperties(merged, data[filepath], 'mm.core.country-'); addProperties(merged, data[filepath], 'core.country-');
} else if (filepath.indexOf('assets/mimetypes') === 0) { } else if (filepath.indexOf('assets/mimetypes') === 0) {
addProperties(merged, data[filepath], 'mm.core.mimetype-'); addProperties(merged, data[filepath], 'core.mimetype-');
} }
} }

View File

@ -441,7 +441,7 @@ export class CoreSite {
method = compatibilityMethod; method = compatibilityMethod;
} else { } else {
this.logger.error(`WS function '${method}' is not available, even in compatibility mode.`); this.logger.error(`WS function '${method}' is not available, even in compatibility mode.`);
return Promise.reject(this.wsProvider.createFakeWSError('mm.core.wsfunctionnotavailable', true)); return Promise.reject(this.wsProvider.createFakeWSError('core.wsfunctionnotavailable', true));
} }
} }
@ -455,7 +455,7 @@ export class CoreSite {
if (wsPreSets.cleanUnicode && this.textUtils.hasUnicodeData(data)) { if (wsPreSets.cleanUnicode && this.textUtils.hasUnicodeData(data)) {
// Data will be cleaned, notify the user. // Data will be cleaned, notify the user.
this.domUtils.showToast('mm.core.unicodenotsupported', true, 3000); this.domUtils.showToast('core.unicodenotsupported', true, 3000);
} else { } else {
// No need to clean data in this call. // No need to clean data in this call.
wsPreSets.cleanUnicode = false; wsPreSets.cleanUnicode = false;
@ -470,7 +470,7 @@ export class CoreSite {
data = this.wsProvider.convertValuesToString(data, wsPreSets.cleanUnicode); data = this.wsProvider.convertValuesToString(data, wsPreSets.cleanUnicode);
} catch (e) { } catch (e) {
// Empty cleaned text found. // Empty cleaned text found.
return Promise.reject(this.wsProvider.createFakeWSError('mm.core.unicodenotsupportedcleanerror', true)); return Promise.reject(this.wsProvider.createFakeWSError('core.unicodenotsupportedcleanerror', true));
} }
return this.getFromCache(method, data, preSets).catch(() => { return this.getFromCache(method, data, preSets).catch(() => {
@ -499,26 +499,26 @@ export class CoreSite {
// Session expired, trigger event. // Session expired, trigger event.
this.eventsProvider.trigger(CoreEventsProvider.SESSION_EXPIRED, {siteId: this.id}); this.eventsProvider.trigger(CoreEventsProvider.SESSION_EXPIRED, {siteId: this.id});
// Change error message. We'll try to get data from cache. // Change error message. We'll try to get data from cache.
error.message = this.translate.instant('mm.core.lostconnection'); error.message = this.translate.instant('core.lostconnection');
} else if (error.errorcode === 'userdeleted') { } else if (error.errorcode === 'userdeleted') {
// User deleted, trigger event. // User deleted, trigger event.
this.eventsProvider.trigger(CoreEventsProvider.USER_DELETED, {siteId: this.id, params: data}); this.eventsProvider.trigger(CoreEventsProvider.USER_DELETED, {siteId: this.id, params: data});
error.message = this.translate.instant('mm.core.userdeleted'); error.message = this.translate.instant('core.userdeleted');
return Promise.reject(error); return Promise.reject(error);
} else if (error.errorcode === 'forcepasswordchangenotice') { } else if (error.errorcode === 'forcepasswordchangenotice') {
// Password Change Forced, trigger event. // Password Change Forced, trigger event.
this.eventsProvider.trigger(CoreEventsProvider.PASSWORD_CHANGE_FORCED, {siteId: this.id}); this.eventsProvider.trigger(CoreEventsProvider.PASSWORD_CHANGE_FORCED, {siteId: this.id});
error.message = this.translate.instant('mm.core.forcepasswordchangenotice'); error.message = this.translate.instant('core.forcepasswordchangenotice');
return Promise.reject(error); return Promise.reject(error);
} else if (error.errorcode === 'usernotfullysetup') { } else if (error.errorcode === 'usernotfullysetup') {
// User not fully setup, trigger event. // User not fully setup, trigger event.
this.eventsProvider.trigger(CoreEventsProvider.USER_NOT_FULLY_SETUP, {siteId: this.id}); this.eventsProvider.trigger(CoreEventsProvider.USER_NOT_FULLY_SETUP, {siteId: this.id});
error.message = this.translate.instant('mm.core.usernotfullysetup'); error.message = this.translate.instant('core.usernotfullysetup');
return Promise.reject(error); return Promise.reject(error);
} else if (error.errorcode === 'sitepolicynotagreed') { } else if (error.errorcode === 'sitepolicynotagreed') {
// Site policy not agreed, trigger event. // Site policy not agreed, trigger event.
this.eventsProvider.trigger(CoreEventsProvider.SITE_POLICY_NOT_AGREED, {siteId: this.id}); this.eventsProvider.trigger(CoreEventsProvider.SITE_POLICY_NOT_AGREED, {siteId: this.id});
error.message = this.translate.instant('mm.core.sitepolicynotagreederror'); error.message = this.translate.instant('core.sitepolicynotagreederror');
return Promise.reject(error); return Promise.reject(error);
} else if (error.errorcode === 'dmlwriteexception' && this.textUtils.hasUnicodeData(data)) { } else if (error.errorcode === 'dmlwriteexception' && this.textUtils.hasUnicodeData(data)) {
if (!this.cleanUnicode) { if (!this.cleanUnicode) {
@ -527,7 +527,7 @@ export class CoreSite {
return this.request(method, data, preSets); return this.request(method, data, preSets);
} }
// This should not happen. // This should not happen.
error.message = this.translate.instant('mm.core.unicodenotsupported'); error.message = this.translate.instant('core.unicodenotsupported');
return Promise.reject(error); return Promise.reject(error);
} else if (typeof preSets.emergencyCache !== 'undefined' && !preSets.emergencyCache) { } else if (typeof preSets.emergencyCache !== 'undefined' && !preSets.emergencyCache) {
this.logger.debug(`WS call '${method}' failed. Emergency cache is forbidden, rejecting.`); this.logger.debug(`WS call '${method}' failed. Emergency cache is forbidden, rejecting.`);
@ -887,7 +887,7 @@ export class CoreSite {
} }
} else if (typeof data == 'undefined' || typeof data.code == 'undefined') { } else if (typeof data == 'undefined' || typeof data.code == 'undefined') {
// local_mobile returned something we didn't expect. Let's assume it's not installed. // local_mobile returned something we didn't expect. Let's assume it's not installed.
return {code: 0, warning: 'mm.login.localmobileunexpectedresponse'}; return {code: 0, warning: 'core.login.localmobileunexpectedresponse'};
} }
const code = parseInt(data.code, 10); const code = parseInt(data.code, 10);
@ -895,18 +895,18 @@ export class CoreSite {
switch (code) { switch (code) {
case 1: case 1:
// Site in maintenance mode. // Site in maintenance mode.
return Promise.reject(this.translate.instant('mm.login.siteinmaintenance')); return Promise.reject(this.translate.instant('core.login.siteinmaintenance'));
case 2: case 2:
// Web services not enabled. // Web services not enabled.
return Promise.reject(this.translate.instant('mm.login.webservicesnotenabled')); return Promise.reject(this.translate.instant('core.login.webservicesnotenabled'));
case 3: case 3:
// Extended service not enabled, but the official is enabled. // Extended service not enabled, but the official is enabled.
return {code: 0}; return {code: 0};
case 4: case 4:
// Neither extended or official services enabled. // Neither extended or official services enabled.
return Promise.reject(this.translate.instant('mm.login.mobileservicesnotenabled')); return Promise.reject(this.translate.instant('core.login.mobileservicesnotenabled'));
default: default:
return Promise.reject(this.translate.instant('mm.core.unexpectederror')); return Promise.reject(this.translate.instant('core.unexpectederror'));
} }
} else { } else {
return {code: code, service: service, coresupported: !!data.coresupported}; return {code: code, service: service, coresupported: !!data.coresupported};
@ -1054,7 +1054,7 @@ export class CoreSite {
} }
if (alertMessage) { if (alertMessage) {
let alert = this.domUtils.showAlert('mm.core.notice', alertMessage, null, 3000); let alert = this.domUtils.showAlert('core.notice', alertMessage, null, 3000);
alert.onDidDismiss(() => { alert.onDidDismiss(() => {
if (inApp) { if (inApp) {
resolve(this.utils.openInApp(url, options)); resolve(this.utils.openInApp(url, options));

View File

@ -70,7 +70,7 @@ export class CoreIframeComponent implements OnInit {
iframe.addEventListener('error', () => { iframe.addEventListener('error', () => {
this.loading = false; this.loading = false;
this.domUtils.showErrorModal('mm.core.errorloadingcontent', true); this.domUtils.showErrorModal('core.errorloadingcontent', true);
}); });
setTimeout(() => { setTimeout(() => {

View File

@ -33,7 +33,7 @@ import { TranslateService } from '@ngx-translate/core';
* Example usage: * Example usage:
* *
* <ion-item text-wrap> * <ion-item text-wrap>
* <ion-label stacked core-mark-required="true">{{ 'mm.login.username' | translate }}</ion-label> * <ion-label stacked core-mark-required="true">{{ 'core.login.username' | translate }}</ion-label>
* <ion-input type="text" name="username" formControlName="username"></ion-input> * <ion-input type="text" name="username" formControlName="username"></ion-input>
* <core-input-errors item-content [control]="myForm.controls.username" [errorMessages]="usernameErrors"></core-input-errors> * <core-input-errors item-content [control]="myForm.controls.username" [errorMessages]="usernameErrors"></core-input-errors>
* </ion-item> * </ion-item>
@ -64,13 +64,13 @@ export class CoreInputErrorsComponent implements OnInit {
protected initErrorMessages() { protected initErrorMessages() {
this.errorMessages = this.errorMessages || {}; this.errorMessages = this.errorMessages || {};
this.errorMessages.required = this.errorMessages.required || this.translate.instant('mm.core.required'); this.errorMessages.required = this.errorMessages.required || this.translate.instant('core.required');
this.errorMessages.email = this.errorMessages.email || this.translate.instant('mm.login.invalidemail'); this.errorMessages.email = this.errorMessages.email || this.translate.instant('core.login.invalidemail');
this.errorMessages.date = this.errorMessages.date || this.translate.instant('mm.login.invaliddate'); this.errorMessages.date = this.errorMessages.date || this.translate.instant('core.login.invaliddate');
this.errorMessages.datetime = this.errorMessages.datetime || this.translate.instant('mm.login.invaliddate'); this.errorMessages.datetime = this.errorMessages.datetime || this.translate.instant('core.login.invaliddate');
this.errorMessages.datetimelocal = this.errorMessages.datetimelocal || this.translate.instant('mm.login.invaliddate'); this.errorMessages.datetimelocal = this.errorMessages.datetimelocal || this.translate.instant('core.login.invaliddate');
this.errorMessages.time = this.errorMessages.time || this.translate.instant('mm.login.invalidtime'); this.errorMessages.time = this.errorMessages.time || this.translate.instant('core.login.invalidtime');
this.errorMessages.url = this.errorMessages.url || this.translate.instant('mm.login.invalidurl'); this.errorMessages.url = this.errorMessages.url || this.translate.instant('core.login.invalidurl');
// @todo: Check how to handle min/max errors once we have a test case to use. Also, review previous errors. // @todo: Check how to handle min/max errors once we have a test case to use. Also, review previous errors.
// ['min', 'max'].forEach((type) => { // ['min', 'max'].forEach((type) => {
@ -81,13 +81,13 @@ export class CoreInputErrorsComponent implements OnInit {
// if (input.type == 'date' || input.type == 'datetime' || input.type == 'datetime-local') { // if (input.type == 'date' || input.type == 'datetime' || input.type == 'datetime-local') {
// var date = moment(value); // var date = moment(value);
// if (date.isValid()) { // if (date.isValid()) {
// value = moment(value).format($translate.instant('mm.core.dfdaymonthyear')); // value = moment(value).format($translate.instant('core.dfdaymonthyear'));
// } // }
// } // }
// scope.errorMessages[type] = $translate.instant('mm.login.invalidvalue' + type, {$a: value}); // scope.errorMessages[type] = $translate.instant('core.login.invalidvalue' + type, {$a: value});
// } else { // } else {
// scope.errorMessages[type] = $translate.instant('mm.login.profileinvaliddata'); // scope.errorMessages[type] = $translate.instant('core.login.profileinvaliddata');
// } // }
// } // }
// }); // });

View File

@ -20,7 +20,7 @@ import { TranslateService } from '@ngx-translate/core';
* *
* It will show a spinner with a message and hide all the content until 'dataLoaded' variable is set to true. * It will show a spinner with a message and hide all the content until 'dataLoaded' variable is set to true.
* If 'message' and 'dynMessage' attributes aren't set, default message "Loading" is shown. * If 'message' and 'dynMessage' attributes aren't set, default message "Loading" is shown.
* 'message' attribute accepts hardcoded strings, variables, filters, etc. E.g. message="'mm.core.loading' | translate". * 'message' attribute accepts hardcoded strings, variables, filters, etc. E.g. message="'core.loading' | translate".
* *
* Usage: * Usage:
* <core-loading [message]="loadingMessage" [hideUntil]="dataLoaded"> * <core-loading [message]="loadingMessage" [hideUntil]="dataLoaded">
@ -43,7 +43,7 @@ export class CoreLoadingComponent implements OnInit {
ngOnInit() { ngOnInit() {
if (!this.message) { if (!this.message) {
// Default loading message. // Default loading message.
this.message = this.translate.instant('mm.core.loading'); this.message = this.translate.instant('core.loading');
} }
} }

View File

@ -25,7 +25,7 @@ import { CoreUtilsProvider } from '../../providers/utils/utils';
* *
* This directive should be applied in the label. Example: * This directive should be applied in the label. Example:
* *
* <ion-label core-mark-required="{{field.required}}">{{ 'mm.login.username' | translate }}</ion-label> * <ion-label core-mark-required="{{field.required}}">{{ 'core.login.username' | translate }}</ion-label>
*/ */
@Component({ @Component({
selector: '[core-mark-required]', selector: '[core-mark-required]',
@ -39,7 +39,7 @@ export class CoreMarkRequiredComponent implements OnInit, AfterViewInit {
constructor(element: ElementRef, private translate: TranslateService, private textUtils: CoreTextUtilsProvider, constructor(element: ElementRef, private translate: TranslateService, private textUtils: CoreTextUtilsProvider,
private utils: CoreUtilsProvider) { private utils: CoreUtilsProvider) {
this.element = element.nativeElement; this.element = element.nativeElement;
this.requiredLabel = this.translate.instant('mm.core.required'); this.requiredLabel = this.translate.instant('core.required');
} }
/** /**

View File

@ -90,7 +90,7 @@ export class CoreShowPasswordComponent implements OnInit, AfterViewInit {
* Set label, icon name and input type. * Set label, icon name and input type.
*/ */
protected setData() { protected setData() {
this.label = this.shown ? 'mm.core.hide' : 'mm.core.show'; this.label = this.shown ? 'core.hide' : 'core.show';
this.iconName = this.shown ? 'eye-off' : 'eye'; this.iconName = this.shown ? 'eye-off' : 'eye';
if (this.input) { if (this.input) {
this.input.type = this.shown ? 'text' : 'password'; this.input.type = this.shown ? 'text' : 'password';

View File

@ -1,6 +1,6 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.login' | translate }}</ion-title> <ion-title>{{ 'core.login.login' | translate }}</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content padding class="mm-center-view"> <ion-content padding class="mm-center-view">
@ -19,23 +19,23 @@
</ion-item> </ion-item>
<form [formGroup]="credForm" (ngSubmit)="login()"> <form [formGroup]="credForm" (ngSubmit)="login()">
<ion-item *ngIf="siteChecked && !isBrowserSSO"> <ion-item *ngIf="siteChecked && !isBrowserSSO">
<ion-input type="text" name="username" placeholder="{{ 'mm.login.username' | translate }}" formControlName="username" autocapitalize="none" autocorrect="off"></ion-input> <ion-input type="text" name="username" placeholder="{{ 'core.login.username' | translate }}" formControlName="username" autocapitalize="none" autocorrect="off"></ion-input>
</ion-item> </ion-item>
<ion-item *ngIf="siteChecked && !isBrowserSSO"> <ion-item *ngIf="siteChecked && !isBrowserSSO">
<core-show-password item-content [name]="'password'"> <core-show-password item-content [name]="'password'">
<ion-input class="mm-ioninput-password" name="password" type="password" placeholder="{{ 'mm.login.password' | translate }}" formControlName="password" mm-show-password></ion-input> <ion-input class="mm-ioninput-password" name="password" type="password" placeholder="{{ 'core.login.password' | translate }}" formControlName="password" mm-show-password></ion-input>
</core-show-password> </core-show-password>
</ion-item> </ion-item>
<button ion-button block color="primary" [disabled]="siteChecked && !isBrowserSSO && !credForm.valid">{{ 'mm.login.loginbutton' | translate }}</button> <button ion-button block color="primary" [disabled]="siteChecked && !isBrowserSSO && !credForm.valid">{{ 'core.login.loginbutton' | translate }}</button>
</form> </form>
<!-- Forgotten password button. --> <!-- Forgotten password button. -->
<div padding-top> <div padding-top>
<button ion-button block text-wrap (click)="forgottenPassword()">{{ 'mm.login.forgotten' | translate }}</button> <button ion-button block text-wrap (click)="forgottenPassword()">{{ 'core.login.forgotten' | translate }}</button>
</div> </div>
<div *ngIf="identityProviders && identityProviders.length" padding-top> <div *ngIf="identityProviders && identityProviders.length" padding-top>
<p>{{ 'mm.login.potentialidps' | translate }}</p> <p>{{ 'core.login.potentialidps' | translate }}</p>
<ion-item *ngFor="let provider of identityProviders" text-wrap class="mm-oauth-icon" (click)="oauthClicked(provider)" title="{{provider.name}}"> <ion-item *ngFor="let provider of identityProviders" text-wrap class="mm-oauth-icon" (click)="oauthClicked(provider)" title="{{provider.name}}">
<img [src]="provider.iconurl" alt="{{provider.name}}"> <img [src]="provider.iconurl" alt="{{provider.name}}">
<span>{{provider.name}}</span> <span>{{provider.name}}</span>
@ -45,10 +45,10 @@
<div *ngIf="canSignup"> <div *ngIf="canSignup">
<ion-item text-wrap> <ion-item text-wrap>
<p class="item-heading">{{ 'mm.login.firsttime' | translate }}</p> <p class="item-heading">{{ 'core.login.firsttime' | translate }}</p>
<p *ngIf="authInstructions"><core-format-text [text]="authInstructions"></core-format-text></p> <p *ngIf="authInstructions"><core-format-text [text]="authInstructions"></core-format-text></p>
</ion-item> </ion-item>
<button ion-button block (click)="signup()">{{ 'mm.login.startsignup' | translate }}</button> <button ion-button block (click)="signup()">{{ 'core.login.startsignup' | translate }}</button>
</div> </div>
</ion-list> </ion-list>
</core-loading> </core-loading>

View File

@ -140,7 +140,7 @@ export class CoreLoginCredentialsPage {
if (this.siteConfig) { if (this.siteConfig) {
this.siteName = this.siteConfig.sitename; this.siteName = this.siteConfig.sitename;
this.logoUrl = this.siteConfig.logourl || this.siteConfig.compactlogourl; this.logoUrl = this.siteConfig.logourl || this.siteConfig.compactlogourl;
this.authInstructions = this.siteConfig.authinstructions || this.translate.instant('mm.login.loginsteps'); this.authInstructions = this.siteConfig.authinstructions || this.translate.instant('core.login.loginsteps');
this.canSignup = this.siteConfig.registerauth == 'email' && !this.loginHelper.isEmailSignupDisabled(this.siteConfig); this.canSignup = this.siteConfig.registerauth == 'email' && !this.loginHelper.isEmailSignupDisabled(this.siteConfig);
this.identityProviders = this.loginHelper.getValidIdentityProviders(this.siteConfig); this.identityProviders = this.loginHelper.getValidIdentityProviders(this.siteConfig);
@ -182,16 +182,16 @@ export class CoreLoginCredentialsPage {
} }
if (!username) { if (!username) {
this.domUtils.showErrorModal('mm.login.usernamerequired', true); this.domUtils.showErrorModal('core.login.usernamerequired', true);
return; return;
} }
if (!password) { if (!password) {
this.domUtils.showErrorModal('mm.login.passwordrequired', true); this.domUtils.showErrorModal('core.login.passwordrequired', true);
return; return;
} }
if (!this.appProvider.isOnline()) { if (!this.appProvider.isOnline()) {
this.domUtils.showErrorModal('mm.core.networkerrormsg', true); this.domUtils.showErrorModal('core.networkerrormsg', true);
return; return;
} }

View File

@ -1,9 +1,9 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.newaccount' | translate }}</ion-title> <ion-title>{{ 'core.login.newaccount' | translate }}</ion-title>
<ion-buttons end> <ion-buttons end>
<button ion-button icon-only *ngIf="authInstructions" (click)="showAuthInstructions()" [attr.aria-label]="'mm.login.instructions' | translate"> <button ion-button icon-only *ngIf="authInstructions" (click)="showAuthInstructions()" [attr.aria-label]="'core.login.instructions' | translate">
<ion-icon name="help-circle"></ion-icon> <ion-icon name="help-circle"></ion-icon>
</button> </button>
</ion-buttons> </ion-buttons>
@ -11,7 +11,7 @@
</ion-header> </ion-header>
<ion-content> <ion-content>
<ion-refresher [enabled]="settingsLoaded" (ionRefresh)="refreshSettings($event)"> <ion-refresher [enabled]="settingsLoaded" (ionRefresh)="refreshSettings($event)">
<ion-refresher-content pullingText="{{ 'mm.core.pulltorefresh' | translate }}"></ion-refresher-content> <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher> </ion-refresher>
<core-loading [hideUntil]="settingsLoaded"> <core-loading [hideUntil]="settingsLoaded">
@ -27,17 +27,17 @@
<!-- Username and password. --> <!-- Username and password. -->
<ion-item-divider text-wrap color="light"> <ion-item-divider text-wrap color="light">
{{ 'mm.login.createuserandpass' | translate }} {{ 'core.login.createuserandpass' | translate }}
</ion-item-divider> </ion-item-divider>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked core-mark-required="true">{{ 'mm.login.username' | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.login.username' | translate }}</ion-label>
<ion-input type="text" name="username" placeholder="{{ 'mm.login.username' | translate }}" formControlName="username" autocapitalize="none" autocorrect="off"></ion-input> <ion-input type="text" name="username" placeholder="{{ 'core.login.username' | translate }}" formControlName="username" autocapitalize="none" autocorrect="off"></ion-input>
<core-input-errors item-content [control]="signupForm.controls.username" [errorMessages]="usernameErrors"></core-input-errors> <core-input-errors item-content [control]="signupForm.controls.username" [errorMessages]="usernameErrors"></core-input-errors>
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked core-mark-required="true">{{ 'mm.login.password' | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.login.password' | translate }}</ion-label>
<core-show-password item-content [name]="'password'"> <core-show-password item-content [name]="'password'">
<ion-input type="password" name="password" placeholder="{{ 'mm.login.password' | translate }}" formControlName="password"></ion-input> <ion-input type="password" name="password" placeholder="{{ 'core.login.password' | translate }}" formControlName="password"></ion-input>
</core-show-password> </core-show-password>
<p *ngIf="settings.passwordpolicy" item-content class="core-input-footnote"> <p *ngIf="settings.passwordpolicy" item-content class="core-input-footnote">
{{settings.passwordpolicy}} {{settings.passwordpolicy}}
@ -47,31 +47,31 @@
<!-- More details. --> <!-- More details. -->
<ion-item-divider text-wrap color="light"> <ion-item-divider text-wrap color="light">
{{ 'mm.login.supplyinfo' | translate }} {{ 'core.login.supplyinfo' | translate }}
</ion-item-divider> </ion-item-divider>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked core-mark-required="true">{{ 'mm.user.email' | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.user.email' | translate }}</ion-label>
<ion-input type="email" name="email" placeholder="{{ 'mm.user.email' | translate }}" formControlName="email" autocapitalize="none" autocorrect="off"></ion-input> <ion-input type="email" name="email" placeholder="{{ 'core.user.email' | translate }}" formControlName="email" autocapitalize="none" autocorrect="off"></ion-input>
<core-input-errors item-content [control]="signupForm.controls.email" [errorMessages]="emailErrors"></core-input-errors> <core-input-errors item-content [control]="signupForm.controls.email" [errorMessages]="emailErrors"></core-input-errors>
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked core-mark-required="true">{{ 'mm.user.emailagain' | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.user.emailagain' | translate }}</ion-label>
<ion-input type="email" name="email2" placeholder="{{ 'mm.user.emailagain' | translate }}" formControlName="email2" autocapitalize="none" autocorrect="off" pattern="{{signupForm.controls.email.value}}"></ion-input> <ion-input type="email" name="email2" placeholder="{{ 'core.user.emailagain' | translate }}" formControlName="email2" autocapitalize="none" autocorrect="off" pattern="{{signupForm.controls.email.value}}"></ion-input>
<core-input-errors item-content [control]="signupForm.controls.email2" [errorMessages]="email2Errors"></core-input-errors> <core-input-errors item-content [control]="signupForm.controls.email2" [errorMessages]="email2Errors"></core-input-errors>
</ion-item> </ion-item>
<ion-item *ngFor="let nameField of settings.namefields" text-wrap> <ion-item *ngFor="let nameField of settings.namefields" text-wrap>
<ion-label stacked core-mark-required="true">{{ 'mm.user.' + nameField | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.user.' + nameField | translate }}</ion-label>
<ion-input type="text" name="nameField" placeholder="{{ 'mm.user.' + nameField | translate }}" formControlName="{{nameField}}" autocorrect="off"></ion-input> <ion-input type="text" name="nameField" placeholder="{{ 'core.user.' + nameField | translate }}" formControlName="{{nameField}}" autocorrect="off"></ion-input>
<core-input-errors item-content [control]="signupForm.controls[nameField]" [errorMessages]="namefieldsErrors[nameField]"></core-input-errors> <core-input-errors item-content [control]="signupForm.controls[nameField]" [errorMessages]="namefieldsErrors[nameField]"></core-input-errors>
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked>{{ 'mm.user.city' | translate }}</ion-label> <ion-label stacked>{{ 'core.user.city' | translate }}</ion-label>
<ion-input type="text" name="city" placeholder="{{ 'mm.user.city' | translate }}" formControlName="city" autocorrect="off"></ion-input> <ion-input type="text" name="city" placeholder="{{ 'core.user.city' | translate }}" formControlName="city" autocorrect="off"></ion-input>
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked id="core-login-signup-country">{{ 'mm.user.country' | translate }}</ion-label> <ion-label stacked id="core-login-signup-country">{{ 'core.user.country' | translate }}</ion-label>
<ion-select name="country" formControlName="country" aria-labelledby="core-login-signup-country"> <ion-select name="country" formControlName="country" aria-labelledby="core-login-signup-country">
<ion-option value="">{{ 'mm.login.selectacountry' | translate }}</ion-option> <ion-option value="">{{ 'core.login.selectacountry' | translate }}</ion-option>
<ion-option *ngFor="let key of countriesKeys" [value]="key">{{countries[key]}}</ion-option> <ion-option *ngFor="let key of countriesKeys" [value]="key">{{countries[key]}}</ion-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
@ -84,29 +84,29 @@
<!-- ReCAPTCHA --> <!-- ReCAPTCHA -->
<div *ngIf="settings.recaptchachallengehash && settings.recaptchachallengeimage"> <div *ngIf="settings.recaptchachallengehash && settings.recaptchachallengeimage">
<ion-item-divider text-wrap color="light">{{ 'mm.login.security_question' | translate }}</ion-item-divider> <ion-item-divider text-wrap color="light">{{ 'core.login.security_question' | translate }}</ion-item-divider>
<ion-item> <ion-item>
<img [src]="settings.recaptchachallengeimage" alt="{{ 'mm.login.recaptchachallengeimage' | translate }}"> <img [src]="settings.recaptchachallengeimage" alt="{{ 'core.login.recaptchachallengeimage' | translate }}">
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked core-mark-required="true">{{ 'mm.login.enterthewordsabove' | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.login.enterthewordsabove' | translate }}</ion-label>
<ion-input type="text" name="recaptcharesponse" placeholder="{{ 'mm.login.enterthewordsabove' | translate }}" formControlName="recaptcharesponse" autocapitalize="none" autocorrect="off"></ion-input> <ion-input type="text" name="recaptcharesponse" placeholder="{{ 'core.login.enterthewordsabove' | translate }}" formControlName="recaptcharesponse" autocapitalize="none" autocorrect="off"></ion-input>
<core-input-errors item-content [control]="signupForm.controls.recaptcharesponse"></core-input-errors> <core-input-errors item-content [control]="signupForm.controls.recaptcharesponse"></core-input-errors>
</ion-item> </ion-item>
<ion-item padding> <ion-item padding>
<!-- Use anchor instead of button to prevent marking form as submitted. --> <!-- Use anchor instead of button to prevent marking form as submitted. -->
<a ion-button block (click)="requestCaptcha()">{{ 'mm.login.getanothercaptcha' | translate }}</a> <a ion-button block (click)="requestCaptcha()">{{ 'core.login.getanothercaptcha' | translate }}</a>
</ion-item> </ion-item>
</div> </div>
<!-- Site policy (if any). --> <!-- Site policy (if any). -->
<div *ngIf="settings.sitepolicy"> <div *ngIf="settings.sitepolicy">
<ion-item-divider text-wrap color="light">{{ 'mm.login.policyagreement' | translate }}</ion-item-divider> <ion-item-divider text-wrap color="light">{{ 'core.login.policyagreement' | translate }}</ion-item-divider>
<ion-item text-wrap> <ion-item text-wrap>
<p><a [href]="settings.sitepolicy" core-link capture="false">{{ 'mm.login.policyagreementclick' | translate }}</a></p> <p><a [href]="settings.sitepolicy" core-link capture="false">{{ 'core.login.policyagreementclick' | translate }}</a></p>
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label core-mark-required="true">{{ 'mm.login.policyaccept' | translate }}</ion-label> <ion-label core-mark-required="true">{{ 'core.login.policyaccept' | translate }}</ion-label>
<ion-checkbox item-right name="policyagreed" formControlName="policyagreed"></ion-checkbox> <ion-checkbox item-right name="policyagreed" formControlName="policyagreed"></ion-checkbox>
<core-input-errors [control]="signupForm.controls.policyagreed" [errorMessages]="policyErrors"></core-input-errors> <core-input-errors [control]="signupForm.controls.policyagreed" [errorMessages]="policyErrors"></core-input-errors>
</ion-item> </ion-item>
@ -114,7 +114,7 @@
<!-- Submit button. --> <!-- Submit button. -->
<ion-item padding> <ion-item padding>
<button ion-button block color="primary">{{ 'mm.login.createaccount' | translate }}</button> <button ion-button block color="primary">{{ 'core.login.createaccount' | translate }}</button>
</ion-item> </ion-item>
</ion-list> </ion-list>
</form> </form>

View File

@ -68,11 +68,11 @@ export class CoreLoginEmailSignupPage {
}); });
// Setup validation errors. // Setup validation errors.
this.usernameErrors = this.loginHelper.getErrorMessages('mm.login.usernamerequired'); this.usernameErrors = this.loginHelper.getErrorMessages('core.login.usernamerequired');
this.passwordErrors = this.loginHelper.getErrorMessages('mm.login.passwordrequired'); this.passwordErrors = this.loginHelper.getErrorMessages('core.login.passwordrequired');
this.emailErrors = this.loginHelper.getErrorMessages('mm.login.missingemail'); this.emailErrors = this.loginHelper.getErrorMessages('core.login.missingemail');
this.email2Errors = this.loginHelper.getErrorMessages('mm.login.missingemail', null, 'mm.login.emailnotmatch'); this.email2Errors = this.loginHelper.getErrorMessages('core.login.missingemail', null, 'core.login.emailnotmatch');
this.policyErrors = this.loginHelper.getErrorMessages('mm.login.policyagree'); this.policyErrors = this.loginHelper.getErrorMessages('core.login.policyagree');
} }
/** /**
@ -139,7 +139,7 @@ export class CoreLoginEmailSignupPage {
this.namefieldsErrors = {}; this.namefieldsErrors = {};
if (settings.namefields) { if (settings.namefields) {
settings.namefields.forEach((field) => { settings.namefields.forEach((field) => {
this.namefieldsErrors[field] = this.loginHelper.getErrorMessages('mm.login.missing' + field); this.namefieldsErrors[field] = this.loginHelper.getErrorMessages('core.login.missing' + field);
}); });
} }
@ -162,7 +162,7 @@ export class CoreLoginEmailSignupPage {
return true; return true;
} else { } else {
this.domUtils.showErrorModal( this.domUtils.showErrorModal(
this.translate.instant('mm.login.signupplugindisabled', {$a: this.translate.instant('mm.login.auth_email')})); this.translate.instant('core.login.signupplugindisabled', {$a: this.translate.instant('core.login.auth_email')}));
this.navCtrl.pop(); this.navCtrl.pop();
return false; return false;
} }
@ -203,7 +203,7 @@ export class CoreLoginEmailSignupPage {
// Form not valid. Scroll to the first element with errors. // Form not valid. Scroll to the first element with errors.
if (!this.domUtils.scrollToInputError(this.content, document.body)) { if (!this.domUtils.scrollToInputError(this.content, document.body)) {
// Input not found, show an error modal. // Input not found, show an error modal.
this.domUtils.showErrorModal('mm.core.errorinvalidform', true); this.domUtils.showErrorModal('core.errorinvalidform', true);
} }
} else { } else {
let params: any = { let params: any = {
@ -215,7 +215,7 @@ export class CoreLoginEmailSignupPage {
city: this.textUtils.cleanTags(this.signupForm.value.city), city: this.textUtils.cleanTags(this.signupForm.value.city),
country: this.signupForm.value.country country: this.signupForm.value.country
}, },
modal = this.domUtils.showModalLoading('mm.core.sending', true); modal = this.domUtils.showModalLoading('core.sending', true);
if (this.siteConfig.launchurl) { if (this.siteConfig.launchurl) {
let service = this.sitesProvider.determineService(this.siteUrl); let service = this.sitesProvider.determineService(this.siteUrl);
@ -235,21 +235,21 @@ export class CoreLoginEmailSignupPage {
this.wsProvider.callAjax('auth_email_signup_user', params, {siteUrl: this.siteUrl}).then((result) => { this.wsProvider.callAjax('auth_email_signup_user', params, {siteUrl: this.siteUrl}).then((result) => {
if (result.success) { if (result.success) {
// Show alert and ho back. // Show alert and ho back.
let message = this.translate.instant('mm.login.emailconfirmsent', {$a: params.email}); let message = this.translate.instant('core.login.emailconfirmsent', {$a: params.email});
this.domUtils.showAlert('mm.core.success', message); this.domUtils.showAlert('core.success', message);
this.navCtrl.pop(); this.navCtrl.pop();
} else { } else {
if (result.warnings && result.warnings.length) { if (result.warnings && result.warnings.length) {
this.domUtils.showErrorModal(result.warnings[0].message); this.domUtils.showErrorModal(result.warnings[0].message);
} else { } else {
this.domUtils.showErrorModal('mm.login.usernotaddederror', true); this.domUtils.showErrorModal('core.login.usernotaddederror', true);
} }
// Error sending, request another capctha since the current one is probably invalid now. // Error sending, request another capctha since the current one is probably invalid now.
this.requestCaptcha(true); this.requestCaptcha(true);
} }
}).catch((error) => { }).catch((error) => {
this.domUtils.showErrorModalDefault(error && error.error, 'mm.login.usernotaddederror', true); this.domUtils.showErrorModalDefault(error && error.error, 'core.login.usernotaddederror', true);
// Error sending, request another capctha since the current one is probably invalid now. // Error sending, request another capctha since the current one is probably invalid now.
this.requestCaptcha(true); this.requestCaptcha(true);
@ -263,6 +263,6 @@ export class CoreLoginEmailSignupPage {
* Show authentication instructions. * Show authentication instructions.
*/ */
protected showAuthInstructions() { protected showAuthInstructions() {
this.textUtils.expandText(this.translate.instant('mm.login.instructions'), this.authInstructions, true); this.textUtils.expandText(this.translate.instant('core.login.instructions'), this.authInstructions, true);
} }
} }

View File

@ -1,32 +1,32 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.passwordforgotten' | translate }}</ion-title> <ion-title>{{ 'core.login.passwordforgotten' | translate }}</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
<ion-item text-wrap> <ion-item text-wrap>
{{ 'mm.login.passwordforgotteninstructions2' | translate }} {{ 'core.login.passwordforgotteninstructions2' | translate }}
</ion-item> </ion-item>
<ion-card> <ion-card>
<form [formGroup]="myForm" (ngSubmit)="resetPassword()"> <form [formGroup]="myForm" (ngSubmit)="resetPassword()">
<ion-item-divider class="mm-bold" text-wrap color="light"> <ion-item-divider class="mm-bold" text-wrap color="light">
{{ 'mm.login.searchby' | translate }} {{ 'core.login.searchby' | translate }}
</ion-item-divider> </ion-item-divider>
<div radio-group formControlName="field"> <div radio-group formControlName="field">
<ion-item> <ion-item>
<ion-label>{{ 'mm.login.username' | translate }}</ion-label> <ion-label>{{ 'core.login.username' | translate }}</ion-label>
<ion-radio value="username"></ion-radio> <ion-radio value="username"></ion-radio>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label>{{ 'mm.user.email' | translate }}</ion-label> <ion-label>{{ 'core.user.email' | translate }}</ion-label>
<ion-radio value="email"></ion-radio> <ion-radio value="email"></ion-radio>
</ion-item> </ion-item>
</div> </div>
<ion-item> <ion-item>
<ion-input type="text" name="value" placeholder="{{ 'mm.login.usernameoremail' | translate }}" formControlName="value" autocapitalize="none" autocorrect="off"></ion-input> <ion-input type="text" name="value" placeholder="{{ 'core.login.usernameoremail' | translate }}" formControlName="value" autocapitalize="none" autocorrect="off"></ion-input>
</ion-item> </ion-item>
<ion-item padding text-wrap> <ion-item padding text-wrap>
<button ion-button block color="primary" [disabled]="!myForm.valid">{{ 'mm.courses.search' | translate }}</button> <button ion-button block color="primary" [disabled]="!myForm.valid">{{ 'core.courses.search' | translate }}</button>
</ion-item> </ion-item>
</form> </form>
</ion-card> </ion-card>

View File

@ -49,11 +49,11 @@ export class CoreLoginForgottenPasswordPage {
value = this.myForm.value.value; value = this.myForm.value.value;
if (!value) { if (!value) {
this.domUtils.showErrorModal('mm.login.usernameoremail', true); this.domUtils.showErrorModal('core.login.usernameoremail', true);
return; return;
} }
let modal = this.domUtils.showModalLoading('mm.core.sending', true), let modal = this.domUtils.showModalLoading('core.sending', true),
isMail = field == 'email'; isMail = field == 'email';
this.loginHelper.requestPasswordReset(this.siteUrl, isMail ? '' : value, isMail ? value : '').then((response) => { this.loginHelper.requestPasswordReset(this.siteUrl, isMail ? '' : value, isMail ? value : '').then((response) => {
@ -65,7 +65,7 @@ export class CoreLoginForgottenPasswordPage {
this.domUtils.showErrorModal(response.notice); this.domUtils.showErrorModal(response.notice);
} else { } else {
// Success. // Success.
this.domUtils.showAlert(this.translate.instant('mm.core.success'), response.notice); this.domUtils.showAlert(this.translate.instant('core.success'), response.notice);
this.navCtrl.pop(); this.navCtrl.pop();
} }
}).catch((error) => { }).catch((error) => {

View File

@ -1,6 +1,6 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.reconnect' | translate }}</ion-title> <ion-title>{{ 'core.login.reconnect' | translate }}</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content padding class="mm-center-view"> <ion-content padding class="mm-center-view">
@ -8,7 +8,7 @@
<ion-item *ngIf="site" text-wrap class="item-avatar-center" [ngClass]="{'item-avatar-center': site.avatar, 'text-center': !site.avatar}"> <ion-item *ngIf="site" text-wrap class="item-avatar-center" [ngClass]="{'item-avatar-center': site.avatar, 'text-center': !site.avatar}">
<ion-avatar *ngIf="site.avatar"> <ion-avatar *ngIf="site.avatar">
<!-- Show user avatar. --> <!-- Show user avatar. -->
<img [src]="site.avatar" class="avatar" core-external-content [siteId]="site.id" alt="{{ 'mm.core.pictureof' | translate:{$a: site.fullname} }}" role="presentation"> <img [src]="site.avatar" class="avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation">
</ion-avatar> </ion-avatar>
<!-- Show site logo or a default image. --> <!-- Show site logo or a default image. -->
@ -22,28 +22,28 @@
<p *ngIf="siteName" class="mm-siteurl">{{siteUrl}}</p> <p *ngIf="siteName" class="mm-siteurl">{{siteUrl}}</p>
<p *ngIf="!isLoggedOut"> <p *ngIf="!isLoggedOut">
<ion-icon padding name="alert"></ion-icon> {{ 'mm.login.reconnectdescription' | translate }} <ion-icon padding name="alert"></ion-icon> {{ 'core.login.reconnectdescription' | translate }}
</p> </p>
</ion-item> </ion-item>
<ion-item padding text-wrap class="mm-username"> <ion-item padding text-wrap class="mm-username">
<p class="item-heading">{{ 'mm.login.username' | translate }}</p> <p class="item-heading">{{ 'core.login.username' | translate }}</p>
<p>{{username}}</p> <p>{{username}}</p>
</ion-item> </ion-item>
<form [formGroup]="credForm" (ngSubmit)="login()"> <form [formGroup]="credForm" (ngSubmit)="login()">
<ion-item> <ion-item>
<core-show-password item-content [name]="'password'"> <core-show-password item-content [name]="'password'">
<ion-input class="mm-ioninput-password" name="password" type="password" placeholder="{{ 'mm.login.password' | translate }}" formControlName="password" mm-show-password></ion-input> <ion-input class="mm-ioninput-password" name="password" type="password" placeholder="{{ 'core.login.password' | translate }}" formControlName="password" mm-show-password></ion-input>
</core-show-password> </core-show-password>
</ion-item> </ion-item>
<ion-buttons class="button-bar"> <ion-buttons class="button-bar">
<a ion-button (click)="cancel()">{{ 'mm.login.cancel' | translate }}</a> <a ion-button (click)="cancel()">{{ 'core.login.cancel' | translate }}</a>
<button ion-button color="primary" [disabled]="!credForm.valid">{{ 'mm.login.loginbutton' | translate }}</button> <button ion-button color="primary" [disabled]="!credForm.valid">{{ 'core.login.loginbutton' | translate }}</button>
</ion-buttons> </ion-buttons>
</form> </form>
<!-- Identity providers. --> <!-- Identity providers. -->
<div *ngIf="identityProviders && identityProviders.length" padding-top> <div *ngIf="identityProviders && identityProviders.length" padding-top>
<p>{{ 'mm.login.potentialidps' | translate }}</p> <p>{{ 'core.login.potentialidps' | translate }}</p>
<ion-item *ngFor="let provider of identityProviders" text-wrap class="mm-oauth-icon" (click)="oauthClicked(provider)" title="{{provider.name}}"> <ion-item *ngFor="let provider of identityProviders" text-wrap class="mm-oauth-icon" (click)="oauthClicked(provider)" title="{{provider.name}}">
<img [src]="provider.iconurl" alt="{{provider.name}}"> <img [src]="provider.iconurl" alt="{{provider.name}}">
<span>{{provider.name}}</span> <span>{{provider.name}}</span>

View File

@ -117,12 +117,12 @@ export class CoreLoginReconnectPage {
password = this.credForm.value.password; password = this.credForm.value.password;
if (!password) { if (!password) {
this.domUtils.showErrorModal('mm.login.passwordrequired', true); this.domUtils.showErrorModal('core.login.passwordrequired', true);
return; return;
} }
if (!this.appProvider.isOnline()) { if (!this.appProvider.isOnline()) {
this.domUtils.showErrorModal('mm.core.networkerrormsg', true); this.domUtils.showErrorModal('core.networkerrormsg', true);
return; return;
} }
@ -144,7 +144,7 @@ export class CoreLoginReconnectPage {
} }
}).catch((error) => { }).catch((error) => {
// Site deleted? Go back to login page. // Site deleted? Go back to login page.
this.domUtils.showErrorModal('mm.login.errorupdatesite', true); this.domUtils.showErrorModal('core.login.errorupdatesite', true);
this.cancel(); this.cancel();
}); });
}); });

View File

@ -1,24 +1,24 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.core.error' | translate }}</ion-title> <ion-title>{{ 'core.error' | translate }}</ion-title>
<ion-buttons end> <ion-buttons end>
<button ion-button icon-only (click)="closeModal()" [attr.aria-label]="'mm.core.close' | translate"> <button ion-button icon-only (click)="closeModal()" [attr.aria-label]="'core.close' | translate">
<ion-icon name="close"></ion-icon> <ion-icon name="close"></ion-icon>
</button> </button>
</ion-buttons> </ion-buttons>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<h3>{{ 'mm.core.whoops' | translate }}</h3> <h3>{{ 'core.whoops' | translate }}</h3>
<p>{{ 'mm.login.problemconnectingerror' | translate }}</p> <p>{{ 'core.login.problemconnectingerror' | translate }}</p>
<p padding>{{siteUrl}}</p> <p padding>{{siteUrl}}</p>
<p>{{ 'mm.login.problemconnectingerrorcontinue' | translate }}</p> <p>{{ 'core.login.problemconnectingerrorcontinue' | translate }}</p>
<button ion-button block (click)="closeModal()">{{ 'mm.core.tryagain' | translate }}</button> <button ion-button block (click)="closeModal()">{{ 'core.tryagain' | translate }}</button>
<h3>{{ 'mm.login.stillcantconnect' | translate }}</h3> <h3>{{ 'core.login.stillcantconnect' | translate }}</h3>
<p>{{ 'mm.login.contactyouradministrator' | translate }}</p> <p>{{ 'core.login.contactyouradministrator' | translate }}</p>
<p *ngIf="issue"> <p *ngIf="issue">
{{ 'mm.login.contactyouradministratorissue' | translate:{$a: ''} }} {{ 'core.login.contactyouradministratorissue' | translate:{$a: ''} }}
</p> </p>
<p *ngIf="issue"> <p *ngIf="issue">
<core-format-text [text]="issue"></core-format-text> <core-format-text [text]="issue"></core-format-text>

View File

@ -1,14 +1,14 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.help' | translate }}</ion-title> <ion-title>{{ 'core.login.help' | translate }}</ion-title>
<ion-buttons end> <ion-buttons end>
<button ion-button icon-only (click)="closeHelp()" [attr.aria-label]="'mm.core.close' | translate"> <button ion-button icon-only (click)="closeHelp()" [attr.aria-label]="'core.close' | translate">
<ion-icon name="close"></ion-icon> <ion-icon name="close"></ion-icon>
</button> </button>
</ion-buttons> </ion-buttons>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<core-format-text [text]="'mm.login.helpmelogin' | translate"></core-format-text> <core-format-text [text]="'core.login.helpmelogin' | translate"></core-format-text>
</ion-content> </ion-content>

View File

@ -1,23 +1,23 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.policyagreement' | translate }}</ion-title> <ion-title>{{ 'core.login.policyagreement' | translate }}</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
<core-loading [hideUntil]="policyLoaded"> <core-loading [hideUntil]="policyLoaded">
<ion-list> <ion-list>
<ion-item text-wrap> <ion-item text-wrap>
{{ 'mm.login.policyagree' | translate }} {{ 'core.login.policyagree' | translate }}
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<p><a [href]="sitePolicy" core-link [capture]="false">{{ 'mm.login.policyagreementclick' | translate }}</a></p> <p><a [href]="sitePolicy" core-link [capture]="false">{{ 'core.login.policyagreementclick' | translate }}</a></p>
</ion-item> </ion-item>
<ion-card *ngIf="showInline"> <ion-card *ngIf="showInline">
<core-iframe [src]="sitePolicy"></core-iframe> <core-iframe [src]="sitePolicy"></core-iframe>
</ion-card> </ion-card>
<ion-item text-wrap padding> <ion-item text-wrap padding>
<button ion-button block color="primary" (click)="accept()">{{ 'mm.login.policyaccept' | translate }}</button> <button ion-button block color="primary" (click)="accept()">{{ 'core.login.policyaccept' | translate }}</button>
<button ion-button block (click)="cancel()">{{ 'mm.login.cancel' | translate }}</button> <button ion-button block (click)="cancel()">{{ 'core.login.cancel' | translate }}</button>
</ion-item> </ion-item>
</ion-list> </ion-list>
</core-loading> </core-loading>

View File

@ -103,7 +103,7 @@ export class CoreLoginSitePolicyPage {
* Accept the site policy. * Accept the site policy.
*/ */
accept() : void { accept() : void {
let modal = this.domUtils.showModalLoading('mm.core.sending', true); let modal = this.domUtils.showModalLoading('core.sending', true);
this.loginHelper.acceptSitePolicy(this.siteId).then(() => { this.loginHelper.acceptSitePolicy(this.siteId).then(() => {
// Success accepting, go to site initial page. // Success accepting, go to site initial page.
// Invalidate cache since some WS don't return error if site policy is not accepted. // Invalidate cache since some WS don't return error if site policy is not accepted.

View File

@ -1,9 +1,9 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.login.connecttomoodle' | translate }}</ion-title> <ion-title>{{ 'core.login.connecttomoodle' | translate }}</ion-title>
<ion-buttons end> <ion-buttons end>
<button ion-button icon-only (click)="showHelp()" [attr.aria-label]="'mm.core.help' | translate"> <button ion-button icon-only (click)="showHelp()" [attr.aria-label]="'core.help' | translate">
<ion-icon name="help-circle"></ion-icon> <ion-icon name="help-circle"></ion-icon>
</button> </button>
</ion-buttons> </ion-buttons>
@ -18,9 +18,9 @@
<!-- Form to input the site URL if there are no fixed sites. --> <!-- Form to input the site URL if there are no fixed sites. -->
<div *ngIf="!fixedSites"> <div *ngIf="!fixedSites">
<p padding>{{ 'mm.login.newsitedescription' | translate }}</p> <p padding>{{ 'core.login.newsitedescription' | translate }}</p>
<ion-item> <ion-item>
<ion-input type="url" name="url" placeholder="{{ 'mm.login.siteaddress' | translate }}" formControlName="siteUrl" core-auto-focus></ion-input> <ion-input type="url" name="url" placeholder="{{ 'core.login.siteaddress' | translate }}" formControlName="siteUrl" core-auto-focus></ion-input>
</ion-item> </ion-item>
</div> </div>
@ -29,21 +29,21 @@
<!-- Display them using a select. --> <!-- Display them using a select. -->
<ion-item *ngIf="!displayAsButtons"> <ion-item *ngIf="!displayAsButtons">
<!-- @todo: Display label and select in different lines. --> <!-- @todo: Display label and select in different lines. -->
<ion-label for="siteSelect">{{ 'mm.login.selectsite' | translate }}</ion-label> <ion-label for="siteSelect">{{ 'core.login.selectsite' | translate }}</ion-label>
<ion-select formControlName="siteUrl" name="url" placeholder="{{ 'mm.login.siteaddress' | translate }}"> <ion-select formControlName="siteUrl" name="url" placeholder="{{ 'core.login.siteaddress' | translate }}">
<ion-option *ngFor="let site of fixedSites" [value]="site.url">{{site.name}}</ion-option> <ion-option *ngFor="let site of fixedSites" [value]="site.url">{{site.name}}</ion-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<!-- Display them using buttons. --> <!-- Display them using buttons. -->
<div *ngIf="displayAsButtons"> <div *ngIf="displayAsButtons">
<p class="padding no-padding-bottom">{{ 'mm.login.selectsite' | translate }}</p> <p class="padding no-padding-bottom">{{ 'core.login.selectsite' | translate }}</p>
<a *ngFor="let site of fixedSites" ion-button block (click)="connect(site.url)" title="{{site.name}}">{{site.name}}</a> <a *ngFor="let site of fixedSites" ion-button block (click)="connect(site.url)" title="{{site.name}}">{{site.name}}</a>
</div> </div>
</div> </div>
<div *ngIf="!fixedSites || !displayAsButtons"> <div *ngIf="!fixedSites || !displayAsButtons">
<button ion-button block color="primary" [disabled]="!siteForm.valid">{{ 'mm.login.connect' | translate }}</button> <button ion-button block color="primary" [disabled]="!siteForm.valid">{{ 'core.login.connect' | translate }}</button>
</div> </div>
</ion-list> </ion-list>
</form> </form>

View File

@ -58,12 +58,12 @@ export class CoreLoginSitePage {
this.appProvider.closeKeyboard(); this.appProvider.closeKeyboard();
if (!url) { if (!url) {
this.domUtils.showErrorModal('mm.login.siteurlrequired', true); this.domUtils.showErrorModal('core.login.siteurlrequired', true);
return; return;
} }
if (!this.appProvider.isOnline()) { if (!this.appProvider.isOnline()) {
this.domUtils.showErrorModal('mm.core.networkerrormsg', true); this.domUtils.showErrorModal('core.networkerrormsg', true);
return; return;
} }

View File

@ -1,12 +1,12 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>{{ 'mm.settings.sites' | translate }}</ion-title> <ion-title>{{ 'core.settings.sites' | translate }}</ion-title>
<ion-buttons end> <ion-buttons end>
<button *ngIf="sites && sites.length > 0" ion-button icon-only (click)="toggleDelete()" [attr.aria-label]="'mm.core.delete' | translate"> <button *ngIf="sites && sites.length > 0" ion-button icon-only (click)="toggleDelete()" [attr.aria-label]="'core.delete' | translate">
<ion-icon name="create" ios="md-create"></ion-icon> <ion-icon name="create" ios="md-create"></ion-icon>
</button> </button>
<button ion-button icon-only (click)="add()" [attr.aria-label]="'mm.core.add' | translate"> <button ion-button icon-only (click)="add()" [attr.aria-label]="'core.add' | translate">
<ion-icon name="add"></ion-icon> <ion-icon name="add"></ion-icon>
</button> </button>
</ion-buttons> </ion-buttons>
@ -16,13 +16,13 @@
<ion-list> <ion-list>
<ion-item (click)="login(site.id)" *ngFor="let site of sites; let idx = index"> <ion-item (click)="login(site.id)" *ngFor="let site of sites; let idx = index">
<ion-avatar item-start> <ion-avatar item-start>
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'mm.core.pictureof' | translate:{$a: site.fullname} }}" role="presentation"> <img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation">
</ion-avatar> </ion-avatar>
<h2>{{site.fullName}}</h2> <h2>{{site.fullName}}</h2>
<p><core-format-text [text]="site.siteName" clean="true" watch="true" [siteId]="site.id"></core-format-text></p> <p><core-format-text [text]="site.siteName" clean="true" watch="true" [siteId]="site.id"></core-format-text></p>
<p>{{site.siteUrl}}</p> <p>{{site.siteUrl}}</p>
<ion-badge item-end *ngIf="!showDelete && site.badge">{{site.badge}}</ion-badge> <ion-badge item-end *ngIf="!showDelete && site.badge">{{site.badge}}</ion-badge>
<button *ngIf="showDelete" item-end ion-button icon-only clear color="danger" (click)="deleteSite($event, idx)" [attr.aria-label]="'mm.core.delete' | translate"> <button *ngIf="showDelete" item-end ion-button icon-only clear color="danger" (click)="deleteSite($event, idx)" [attr.aria-label]="'core.delete' | translate">
<ion-icon name="trash"></ion-icon> <ion-icon name="trash"></ion-icon>
</button> </button>
</ion-item> </ion-item>

View File

@ -101,7 +101,7 @@ export class CoreLoginSitesPage {
siteName = site.siteName; siteName = site.siteName;
this.textUtils.formatText(siteName).then((siteName) => { this.textUtils.formatText(siteName).then((siteName) => {
this.domUtils.showConfirm(this.translate.instant('mm.login.confirmdeletesite', {sitename: siteName})).then(() => { this.domUtils.showConfirm(this.translate.instant('core.login.confirmdeletesite', {sitename: siteName})).then(() => {
this.sitesProvider.deleteSite(site.id).then(() => { this.sitesProvider.deleteSite(site.id).then(() => {
this.sites.splice(index, 1); this.sites.splice(index, 1);
this.showDelete = false; this.showDelete = false;
@ -113,7 +113,7 @@ export class CoreLoginSitesPage {
}).catch((error) => { }).catch((error) => {
this.logger.error('Error deleting site ' + site.id, error); this.logger.error('Error deleting site ' + site.id, error);
this.domUtils.showErrorModalDefault(error, 'Delete site failed.'); this.domUtils.showErrorModalDefault(error, 'Delete site failed.');
this.domUtils.showErrorModal('mm.login.errordeletesite', true); this.domUtils.showErrorModal('core.login.errordeletesite', true);
}); });
}).catch(() => { }).catch(() => {
// User cancelled, nothing to do. // User cancelled, nothing to do.

View File

@ -130,7 +130,7 @@ export class CoreLoginHelperProvider {
return false; return false;
} }
let modal = this.domUtils.showModalLoading('mm.login.authenticating', true), let modal = this.domUtils.showModalLoading('core.login.authenticating', true),
siteData: CoreLoginSSOData; siteData: CoreLoginSSOData;
// Wait for app to be ready. // Wait for app to be ready.
@ -198,7 +198,7 @@ export class CoreLoginHelperProvider {
promise; promise;
if (showConfirmation) { if (showConfirmation) {
promise = this.domUtils.showConfirm(this.translate.instant('mm.login.logininsiterequired')); promise = this.domUtils.showConfirm(this.translate.instant('core.login.logininsiterequired'));
} else { } else {
promise = Promise.resolve(); promise = Promise.resolve();
} }
@ -442,10 +442,10 @@ export class CoreLoginHelperProvider {
this.sitesProvider.updateSiteInfoByUrl(info.siteurl, info.username); this.sitesProvider.updateSiteInfoByUrl(info.siteurl, info.username);
}).catch(() => { }).catch(() => {
// Error updating token, return proper error message. // Error updating token, return proper error message.
return Promise.reject(this.translate.instant('mm.login.errorupdatesite')); return Promise.reject(this.translate.instant('core.login.errorupdatesite'));
}); });
} }
return Promise.reject(this.translate.instant('mm.login.errorupdatesite')); return Promise.reject(this.translate.instant('core.login.errorupdatesite'));
} else { } else {
return this.sitesProvider.newSite(siteUrl, token, privateToken); return this.sitesProvider.newSite(siteUrl, token, privateToken);
} }
@ -667,7 +667,7 @@ export class CoreLoginHelperProvider {
if (this.isSSOEmbeddedBrowser(typeOfLogin)) { if (this.isSSOEmbeddedBrowser(typeOfLogin)) {
let options = { let options = {
clearsessioncache: 'yes', // Clear the session cache to allow for multiple logins. clearsessioncache: 'yes', // Clear the session cache to allow for multiple logins.
closebuttoncaption: this.translate.instant('mm.login.cancel'), closebuttoncaption: this.translate.instant('core.login.cancel'),
} }
this.utils.openInApp(loginUrl, options); this.utils.openInApp(loginUrl, options);
} else { } else {
@ -685,7 +685,7 @@ export class CoreLoginHelperProvider {
* @param {string} error Error message. * @param {string} error Error message.
*/ */
openChangePassword(siteUrl: string, error: string) : void { openChangePassword(siteUrl: string, error: string) : void {
let alert = this.domUtils.showAlert(this.translate.instant('mm.core.notice'), error, null, 3000); let alert = this.domUtils.showAlert(this.translate.instant('core.notice'), error, null, 3000);
alert.onDidDismiss(() => { alert.onDidDismiss(() => {
this.utils.openInApp(siteUrl + '/login/change_password.php'); this.utils.openInApp(siteUrl + '/login/change_password.php');
}); });
@ -728,7 +728,7 @@ export class CoreLoginHelperProvider {
} }
// Open change password. // Open change password.
alertMessage = this.translate.instant(alertMessage) + '<br>' + this.translate.instant('mm.core.redirectingtosite'); alertMessage = this.translate.instant(alertMessage) + '<br>' + this.translate.instant('core.redirectingtosite');
currentSite.openInAppWithAutoLogin(siteUrl + path, undefined, alertMessage).then(() => { currentSite.openInAppWithAutoLogin(siteUrl + path, undefined, alertMessage).then(() => {
this.waitingForBrowser = true; this.waitingForBrowser = true;
}).finally(() => { }).finally(() => {
@ -823,7 +823,7 @@ export class CoreLoginHelperProvider {
this.isSSOConfirmShown = true; this.isSSOConfirmShown = true;
if (this.shouldShowSSOConfirm(result.code)) { if (this.shouldShowSSOConfirm(result.code)) {
promise = this.domUtils.showConfirm(this.translate.instant('mm.login.' + promise = this.domUtils.showConfirm(this.translate.instant('core.login.' +
(currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription'))); (currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription')));
} else { } else {
promise = Promise.resolve(); promise = Promise.resolve();
@ -857,7 +857,7 @@ export class CoreLoginHelperProvider {
// Error checking site. // Error checking site.
if (currentSite.isLoggedOut()) { if (currentSite.isLoggedOut()) {
// Site is logged out, show error and logout the user. // Site is logged out, show error and logout the user.
this.domUtils.showErrorModalDefault(error, 'mm.core.networkerrormsg', true); this.domUtils.showErrorModalDefault(error, 'core.networkerrormsg', true);
this.sitesProvider.logout(); this.sitesProvider.logout();
} }
}); });
@ -966,7 +966,7 @@ export class CoreLoginHelperProvider {
} else { } else {
this.logger.debug('Invalid signature in the URL request yours: ' + params[0] + ' mine: ' this.logger.debug('Invalid signature in the URL request yours: ' + params[0] + ' mine: '
+ signature + ' for passport ' + passport); + signature + ' for passport ' + passport);
return Promise.reject(this.translate.instant('mm.core.unexpectederror')); return Promise.reject(this.translate.instant('core.unexpectederror'));
} }
}); });
} }

View File

@ -3,7 +3,7 @@
<ion-title>{{ title }}</ion-title> <ion-title>{{ title }}</ion-title>
<ion-buttons end *ngIf="isModal"> <ion-buttons end *ngIf="isModal">
<button ion-button icon-only (click)="closeModal()" [attr.aria-label]="'mm.core.close' | translate"> <button ion-button icon-only (click)="closeModal()" [attr.aria-label]="'core.close' | translate">
<ion-icon name="close"></ion-icon> <ion-icon name="close"></ion-icon>
</button> </button>
</ion-buttons> </ion-buttons>

View File

@ -124,7 +124,7 @@ export class CoreFormatTextDirective implements OnInit {
if (imgWidth > elWidth) { if (imgWidth > elWidth) {
let imgSrc = this.textUtils.escapeHTML(img.getAttribute('src')), let imgSrc = this.textUtils.escapeHTML(img.getAttribute('src')),
label = this.textUtils.escapeHTML(this.translate.instant('mm.core.openfullimage')); label = this.textUtils.escapeHTML(this.translate.instant('core.openfullimage'));
// @todo: Implement image viewer. Maybe we can add the listener here directly? // @todo: Implement image viewer. Maybe we can add the listener here directly?
container.innerHTML += '<a href="#" class="mm-image-viewer-icon" mm-image-viewer img="' + imgSrc + container.innerHTML += '<a href="#" class="mm-image-viewer-icon" mm-image-viewer img="' + imgSrc +
@ -170,7 +170,7 @@ export class CoreFormatTextDirective implements OnInit {
if (!height || height > this.maxHeight) { if (!height || height > this.maxHeight) {
let expandInFullview = this.utils.isTrueOrOne(this.fullOnClick) || false; let expandInFullview = this.utils.isTrueOrOne(this.fullOnClick) || false;
this.element.innerHTML += '<div class="mm-show-more">' + this.translate.instant('mm.core.showmore') + '</div>'; this.element.innerHTML += '<div class="mm-show-more">' + this.translate.instant('core.showmore') + '</div>';
if (expandInFullview) { if (expandInFullview) {
this.element.classList.add('mm-expand-in-fullview'); this.element.classList.add('mm-expand-in-fullview');
@ -195,7 +195,7 @@ export class CoreFormatTextDirective implements OnInit {
// Open a new state with the contents. // Open a new state with the contents.
// @todo: brOnFull is needed? // @todo: brOnFull is needed?
this.textUtils.expandText(this.fullTitle || this.translate.instant('mm.core.description'), this.text, this.textUtils.expandText(this.fullTitle || this.translate.instant('core.description'), this.text,
false, this.component, this.componentId); false, this.component, this.componentId);
}); });
} }

View File

@ -58,9 +58,9 @@ export class CoreDateDayOrTimePipe implements PipeTransform {
} }
return moment(timestamp * 1000).calendar(null, { return moment(timestamp * 1000).calendar(null, {
sameDay: this.translate.instant('mm.core.dftimedate'), sameDay: this.translate.instant('core.dftimedate'),
lastDay: this.translate.instant('mm.core.dflastweekdate'), lastDay: this.translate.instant('core.dflastweekdate'),
lastWeek: this.translate.instant('mm.core.dflastweekdate') lastWeek: this.translate.instant('core.dflastweekdate')
}); });
} }
} }

View File

@ -34,8 +34,8 @@ export class CoreFormatDatePipe implements PipeTransform {
* Format a date. * Format a date.
* *
* @param {string|number} timestamp Timestamp to format (in milliseconds). If not defined, use current time. * @param {string|number} timestamp Timestamp to format (in milliseconds). If not defined, use current time.
* @param {string} format Format to use. It should be a string code to handle i18n (e.g. mm.core.dftimedate). If the code * @param {string} format Format to use. It should be a string code to handle i18n (e.g. core.dftimedate). If the code
* doesn't have a prefix, 'mm.core' will be used by default. E.g. 'dftimedate' -> 'mm.core.dftimedate'. * doesn't have a prefix, 'core' will be used by default. E.g. 'dftimedate' -> 'core.dftimedate'.
* @return {String} Formatted date. * @return {String} Formatted date.
*/ */
transform(timestamp: string|number, format: string) { transform(timestamp: string|number, format: string) {
@ -52,7 +52,7 @@ export class CoreFormatDatePipe implements PipeTransform {
} }
if (format.indexOf('.') == -1) { if (format.indexOf('.') == -1) {
format = 'mm.core.' + format; format = 'core.' + format;
} }
return moment(timestamp).format(this.translate.instant(format)); return moment(timestamp).format(this.translate.instant(format));
} }

View File

@ -138,7 +138,7 @@ export class CoreGroupsProvider {
groupInfo.visibleGroups = false; groupInfo.visibleGroups = false;
} else { } else {
if (addAllParts || groupInfo.visibleGroups) { if (addAllParts || groupInfo.visibleGroups) {
groupInfo.groups.push({id: 0, name: this.translate.instant('mm.core.allparticipants')}); groupInfo.groups.push({id: 0, name: this.translate.instant('core.allparticipants')});
} }
groupInfo.groups = groupInfo.groups.concat(groups); groupInfo.groups = groupInfo.groups.concat(groups);
} }

View File

@ -168,9 +168,9 @@ export class CoreSitesProvider {
siteUrl = this.urlUtils.formatURL(siteUrl); siteUrl = this.urlUtils.formatURL(siteUrl);
if (!this.urlUtils.isHttpURL(siteUrl)) { if (!this.urlUtils.isHttpURL(siteUrl)) {
return Promise.reject(this.translate.instant('mm.login.invalidsite')); return Promise.reject(this.translate.instant('core.login.invalidsite'));
} else if (!this.appProvider.isOnline()) { } else if (!this.appProvider.isOnline()) {
return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); return Promise.reject(this.translate.instant('core.networkerrormsg'));
} else { } else {
return this.checkSiteWithProtocol(siteUrl, protocol).catch((error) => { return this.checkSiteWithProtocol(siteUrl, protocol).catch((error) => {
// Do not continue checking if a critical error happened. // Do not continue checking if a critical error happened.
@ -187,7 +187,7 @@ export class CoreSitesProvider {
} else if (error.error) { } else if (error.error) {
return Promise.reject(error.error); return Promise.reject(error.error);
} }
return Promise.reject(this.translate.instant('mm.login.checksiteversion')); return Promise.reject(this.translate.instant('core.login.checksiteversion'));
}); });
}); });
} }
@ -241,11 +241,11 @@ export class CoreSitesProvider {
// Check that the user can authenticate. // Check that the user can authenticate.
if (!config.enablewebservices) { if (!config.enablewebservices) {
return rejectWithCriticalError(this.translate.instant('mm.login.webservicesnotenabled')); return rejectWithCriticalError(this.translate.instant('core.login.webservicesnotenabled'));
} else if (!config.enablemobilewebservice) { } else if (!config.enablemobilewebservice) {
return rejectWithCriticalError(this.translate.instant('mm.login.mobileservicesnotenabled')); return rejectWithCriticalError(this.translate.instant('core.login.mobileservicesnotenabled'));
} else if (config.maintenanceenabled) { } else if (config.maintenanceenabled) {
let message = this.translate.instant('mm.core.sitemaintenance'); let message = this.translate.instant('core.sitemaintenance');
if (config.maintenancemessage) { if (config.maintenancemessage) {
message += config.maintenancemessage; message += config.maintenancemessage;
} }
@ -327,7 +327,7 @@ export class CoreSitesProvider {
getUserToken(siteUrl: string, username: string, password: string, service?: string, retry?: boolean) getUserToken(siteUrl: string, username: string, password: string, service?: string, retry?: boolean)
: Promise<CoreSiteUserTokenResponse> { : Promise<CoreSiteUserTokenResponse> {
if (!this.appProvider.isOnline()) { if (!this.appProvider.isOnline()) {
return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); return Promise.reject(this.translate.instant('core.networkerrormsg'));
} }
if (!service) { if (!service) {
@ -343,7 +343,7 @@ export class CoreSitesProvider {
return this.utils.observableToPromise(observable).then((data: any) : any => { return this.utils.observableToPromise(observable).then((data: any) : any => {
if (typeof data == 'undefined') { if (typeof data == 'undefined') {
return Promise.reject(this.translate.instant('mm.core.cannotconnect')); return Promise.reject(this.translate.instant('core.cannotconnect'));
} else { } else {
if (typeof data.token != 'undefined') { if (typeof data.token != 'undefined') {
return {token: data.token, siteUrl: siteUrl, privateToken: data.privatetoken}; return {token: data.token, siteUrl: siteUrl, privateToken: data.privatetoken};
@ -359,12 +359,12 @@ export class CoreSitesProvider {
return Promise.reject(data.error); return Promise.reject(data.error);
} }
} else { } else {
return Promise.reject(this.translate.instant('mm.login.invalidaccount')); return Promise.reject(this.translate.instant('core.login.invalidaccount'));
} }
} }
} }
}, () => { }, () => {
return Promise.reject(this.translate.instant('mm.core.cannotconnect')); return Promise.reject(this.translate.instant('core.cannotconnect'));
}); });
} }
@ -410,7 +410,7 @@ export class CoreSitesProvider {
} else if (result == this.LEGACY_APP_VERSION) { } else if (result == this.LEGACY_APP_VERSION) {
return Promise.reject(this.translate.instant('mm.login.legacymoodleversion')); return Promise.reject(this.translate.instant('mm.login.legacymoodleversion'));
} else { } else {
return Promise.reject(this.translate.instant('mm.login.invalidmoodleversion')); return Promise.reject(this.translate.instant('core.login.invalidmoodleversion'));
} }
}); });
} }
@ -508,7 +508,7 @@ export class CoreSitesProvider {
protected validateSiteInfo(info: any) : any { protected validateSiteInfo(info: any) : any {
if (!info.firstname || !info.lastname) { if (!info.firstname || !info.lastname) {
const moodleLink = `<a mm-link href="${info.siteurl}">${info.siteurl}</a>`; const moodleLink = `<a mm-link href="${info.siteurl}">${info.siteurl}</a>`;
return {error: 'mm.core.requireduserdatamissing', params: {'$a': moodleLink}}; return {error: 'core.requireduserdatamissing', params: {'$a': moodleLink}};
} }
return true; return true;
} }

View File

@ -91,7 +91,7 @@ export class CoreDomUtilsProvider {
* If the download size is higher than a certain threshold shows a confirm dialog. * If the download size is higher than a certain threshold shows a confirm dialog.
* *
* @param {any} size Object containing size to download and a boolean to indicate if its totally or partialy calculated. * @param {any} size Object containing size to download and a boolean to indicate if its totally or partialy calculated.
* @param {string} [message] Code of the message to show. Default: 'mm.course.confirmdownload'. * @param {string} [message] Code of the message to show. Default: 'core.course.confirmdownload'.
* @param {string} [unknownMessage] ID of the message to show if size is unknown. * @param {string} [unknownMessage] ID of the message to show if size is unknown.
* @param {number} [wifiThreshold] Threshold to show confirm in WiFi connection. Default: CoreWifiDownloadThreshold. * @param {number} [wifiThreshold] Threshold to show confirm in WiFi connection. Default: CoreWifiDownloadThreshold.
* @param {number} [limitedThreshold] Threshold to show confirm in limited connection. Default: CoreDownloadThreshold. * @param {number} [limitedThreshold] Threshold to show confirm in limited connection. Default: CoreDownloadThreshold.
@ -104,14 +104,14 @@ export class CoreDomUtilsProvider {
if (size.size < 0 || (size.size == 0 && !size.total)) { if (size.size < 0 || (size.size == 0 && !size.total)) {
// Seems size was unable to be calculated. Show a warning. // Seems size was unable to be calculated. Show a warning.
unknownMessage = unknownMessage || 'mm.course.confirmdownloadunknownsize'; unknownMessage = unknownMessage || 'core.course.confirmdownloadunknownsize';
return this.showConfirm(this.translate.instant(unknownMessage)); return this.showConfirm(this.translate.instant(unknownMessage));
} else if (!size.total) { } else if (!size.total) {
// Filesize is only partial. // Filesize is only partial.
let readableSize = this.textUtils.bytesToSize(size.size, 2); let readableSize = this.textUtils.bytesToSize(size.size, 2);
return this.showConfirm(this.translate.instant('mm.course.confirmpartialdownloadsize', {size: readableSize})); return this.showConfirm(this.translate.instant('core.course.confirmpartialdownloadsize', {size: readableSize}));
} else if (size.size >= wifiThreshold || (this.appProvider.isNetworkAccessLimited() && size.size >= limitedThreshold)) { } else if (size.size >= wifiThreshold || (this.appProvider.isNetworkAccessLimited() && size.size >= limitedThreshold)) {
message = message || 'mm.course.confirmdownload'; message = message || 'core.course.confirmdownload';
let readableSize = this.textUtils.bytesToSize(size.size, 2); let readableSize = this.textUtils.bytesToSize(size.size, 2);
return this.showConfirm(this.translate.instant(message, {size: readableSize})); return this.showConfirm(this.translate.instant(message, {size: readableSize}));
} }
@ -380,12 +380,12 @@ export class CoreDomUtilsProvider {
* @return {string} Title. * @return {string} Title.
*/ */
private getErrorTitle(message: string) : string { private getErrorTitle(message: string) : string {
if (message == this.translate.instant('mm.core.networkerrormsg') || if (message == this.translate.instant('core.networkerrormsg') ||
message == this.translate.instant('mm.fileuploader.errormustbeonlinetoupload')) { message == this.translate.instant('core.fileuploader.errormustbeonlinetoupload')) {
return '<span class="mm-icon-with-badge"><i class="icon ion-wifi"></i>\ return '<span class="mm-icon-with-badge"><i class="icon ion-wifi"></i>\
<i class="icon ion-alert-circled mm-icon-badge"></i></span>'; <i class="icon ion-alert-circled mm-icon-badge"></i></span>';
} }
return this.textUtils.decodeHTML(this.translate.instant('mm.core.error')); return this.textUtils.decodeHTML(this.translate.instant('core.error'));
} }
/** /**
@ -610,7 +610,7 @@ export class CoreDomUtilsProvider {
let alert = this.alertCtrl.create({ let alert = this.alertCtrl.create({
title: title, title: title,
message: this.addFormatTextIfNeeded(message), // Add format-text to handle links. message: this.addFormatTextIfNeeded(message), // Add format-text to handle links.
buttons: [buttonText || this.translate.instant('mm.core.ok')] buttons: [buttonText || this.translate.instant('core.ok')]
}); });
alert.present(); alert.present();
@ -662,14 +662,14 @@ export class CoreDomUtilsProvider {
} }
options.buttons = [ options.buttons = [
{ {
text: cancelText || this.translate.instant('mm.core.cancel'), text: cancelText || this.translate.instant('core.cancel'),
role: 'cancel', role: 'cancel',
handler: () => { handler: () => {
reject(); reject();
} }
}, },
{ {
text: okText || this.translate.instant('mm.core.ok'), text: okText || this.translate.instant('core.ok'),
handler: () => { handler: () => {
resolve(); resolve();
} }
@ -734,7 +734,7 @@ export class CoreDomUtilsProvider {
/** /**
* Displays a loading modal window. * Displays a loading modal window.
* *
* @param {string} [text] The text of the modal window. Default: mm.core.loading. * @param {string} [text] The text of the modal window. Default: core.loading.
* @param {boolean} [needsTranslate] Whether the 'text' needs to be translated. * @param {boolean} [needsTranslate] Whether the 'text' needs to be translated.
* @return {Loading} Loading modal instance. * @return {Loading} Loading modal instance.
* @description * @description
@ -745,7 +745,7 @@ export class CoreDomUtilsProvider {
*/ */
showModalLoading(text?: string, needsTranslate?: boolean) : Loading { showModalLoading(text?: string, needsTranslate?: boolean) : Loading {
if (!text) { if (!text) {
text = this.translate.instant('mm.core.loading'); text = this.translate.instant('core.loading');
} else if (needsTranslate) { } else if (needsTranslate) {
text = this.translate.instant(text); text = this.translate.instant(text);
} }
@ -776,20 +776,20 @@ export class CoreDomUtilsProvider {
inputs: [ inputs: [
{ {
name: 'promptinput', name: 'promptinput',
placeholder: placeholder || this.translate.instant('mm.login.password'), placeholder: placeholder || this.translate.instant('core.login.password'),
type: type type: type
} }
], ],
buttons: [ buttons: [
{ {
text: this.translate.instant('mm.core.cancel'), text: this.translate.instant('core.cancel'),
role: 'cancel', role: 'cancel',
handler: () => { handler: () => {
reject(); reject();
} }
}, },
{ {
text: this.translate.instant('mm.core.ok'), text: this.translate.instant('core.ok'),
handler: (data) => { handler: (data) => {
resolve(data.promptinput); resolve(data.promptinput);
} }

View File

@ -323,7 +323,7 @@ export class CoreMimetypeUtilsProvider {
let filename = '', let filename = '',
mimetype = '', mimetype = '',
extension = '', extension = '',
langPrefix = 'mm.core.mimetype-'; langPrefix = 'core.mimetype-';
if (typeof obj == 'object' && typeof obj.file == 'function') { if (typeof obj == 'object' && typeof obj.file == 'function') {
// It's a FileEntry. Don't use the file function because it's asynchronous and the type isn't reliable. // It's a FileEntry. Don't use the file function because it's asynchronous and the type isn't reliable.
@ -422,7 +422,7 @@ export class CoreMimetypeUtilsProvider {
* @return {string} Translated name. * @return {string} Translated name.
*/ */
getTranslatedGroupName(name: string) : string { getTranslatedGroupName(name: string) : string {
let key = 'mm.core.mimetype-group:' + name, let key = 'core.mimetype-group:' + name,
translated = this.translate.instant(key); translated = this.translate.instant(key);
return translated != key ? translated : name; return translated != key ? translated : name;
} }

View File

@ -52,14 +52,14 @@ export class CoreTextUtilsProvider {
bytesToSize(bytes: number, precision = 2) : string { bytesToSize(bytes: number, precision = 2) : string {
if (typeof bytes == 'undefined' || bytes < 0) { if (typeof bytes == 'undefined' || bytes < 0) {
return this.translate.instant('mm.core.notapplicable'); return this.translate.instant('core.notapplicable');
} }
if (precision < 0) { if (precision < 0) {
precision = 2; precision = 2;
} }
let keys = ['mm.core.sizeb', 'mm.core.sizekb', 'mm.core.sizemb', 'mm.core.sizegb', 'mm.core.sizetb'], let keys = ['core.sizeb', 'core.sizekb', 'core.sizemb', 'core.sizegb', 'core.sizetb'],
units = this.translate.instant(keys), units = this.translate.instant(keys),
pos = 0; pos = 0;
@ -71,7 +71,7 @@ export class CoreTextUtilsProvider {
// Round to "precision" decimals if needed. // Round to "precision" decimals if needed.
bytes = Number(Math.round(parseFloat(bytes + 'e+' + precision)) + 'e-' + precision); bytes = Number(Math.round(parseFloat(bytes + 'e+' + precision)) + 'e-' + precision);
} }
return this.translate.instant('mm.core.humanreadablesize', {size: bytes, unit: units[keys[pos]]}); return this.translate.instant('core.humanreadablesize', {size: bytes, unit: units[keys[pos]]});
} }
/** /**

View File

@ -44,11 +44,11 @@ export class CoreTimeUtilsProvider {
let mins = Math.floor(remainder / CoreConstants.secondsMinute), let mins = Math.floor(remainder / CoreConstants.secondsMinute),
secs = remainder - (mins * CoreConstants.secondsMinute), secs = remainder - (mins * CoreConstants.secondsMinute),
ss = this.translate.instant('mm.core.' + (secs == 1 ? 'sec' : 'secs')), ss = this.translate.instant('core.' + (secs == 1 ? 'sec' : 'secs')),
sm = this.translate.instant('mm.core.' + (mins == 1 ? 'min' : 'mins')), sm = this.translate.instant('core.' + (mins == 1 ? 'min' : 'mins')),
sh = this.translate.instant('mm.core.' + (hours == 1 ? 'hour' : 'hours')), sh = this.translate.instant('core.' + (hours == 1 ? 'hour' : 'hours')),
sd = this.translate.instant('mm.core.' + (days == 1 ? 'day' : 'days')), sd = this.translate.instant('core.' + (days == 1 ? 'day' : 'days')),
sy = this.translate.instant('mm.core.' + (years == 1 ? 'year' : 'years')), sy = this.translate.instant('core.' + (years == 1 ? 'year' : 'years')),
oyears = '', oyears = '',
odays = '', odays = '',
ohours = '', ohours = '',
@ -87,7 +87,7 @@ export class CoreTimeUtilsProvider {
return osecs; return osecs;
} }
return this.translate.instant('mm.core.now'); return this.translate.instant('core.now');
} }
/** /**

View File

@ -286,7 +286,7 @@ export class CoreUtilsProvider {
copyToClipboard(text: string) : Promise<any> { copyToClipboard(text: string) : Promise<any> {
return this.clipboard.copy(text).then(() => { return this.clipboard.copy(text).then(() => {
// Show toast using ionicLoading. // Show toast using ionicLoading.
return this.domUtils.showToast('mm.core.copiedtoclipboard', true); return this.domUtils.showToast('core.copiedtoclipboard', true);
}).catch(() => { }).catch(() => {
// Ignore errors. // Ignore errors.
}); });
@ -453,7 +453,7 @@ export class CoreUtilsProvider {
return ''; return '';
} }
let localeSeparator = this.translate.instant('mm.core.decsep'); let localeSeparator = this.translate.instant('core.decsep');
// Convert float to string. // Convert float to string.
float += ''; float += '';
@ -525,7 +525,7 @@ export class CoreUtilsProvider {
* @return {string} Country name. If the country is not found, return the country code. * @return {string} Country name. If the country is not found, return the country code.
*/ */
getCountryName(code: string) : string { getCountryName(code: string) : string {
let countryKey = 'mm.core.country-' + code, let countryKey = 'core.country-' + code,
countryName = this.translate.instant(countryKey); countryName = this.translate.instant(countryKey);
return countryName !== countryKey ? countryName : code; return countryName !== countryKey ? countryName : code;
@ -553,8 +553,8 @@ export class CoreUtilsProvider {
let countries = {}; let countries = {};
for (let name in table) { for (let name in table) {
if (name.indexOf('mm.core.country-') === 0) { if (name.indexOf('core.country-') === 0) {
let code = name.replace('mm.core.country-', ''); let code = name.replace('core.country-', '');
countries[code] = table[name]; countries[code] = table[name];
} }
} }
@ -580,7 +580,7 @@ export class CoreUtilsProvider {
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
let name = files[i].filename || files[i].name; let name = files[i].filename || files[i].name;
if (names.indexOf(name) > -1) { if (names.indexOf(name) > -1) {
return this.translate.instant('mm.core.filenameexist', {$a: name}); return this.translate.instant('core.filenameexist', {$a: name});
} else { } else {
names.push(name); names.push(name);
} }
@ -641,17 +641,17 @@ export class CoreUtilsProvider {
*/ */
isWebServiceError(error: string) : boolean { isWebServiceError(error: string) : boolean {
let localErrors = [ let localErrors = [
this.translate.instant('mm.core.wsfunctionnotavailable'), this.translate.instant('core.wsfunctionnotavailable'),
this.translate.instant('mm.core.lostconnection'), this.translate.instant('core.lostconnection'),
this.translate.instant('mm.core.userdeleted'), this.translate.instant('core.userdeleted'),
this.translate.instant('mm.core.unexpectederror'), this.translate.instant('core.unexpectederror'),
this.translate.instant('mm.core.networkerrormsg'), this.translate.instant('core.networkerrormsg'),
this.translate.instant('mm.core.serverconnection'), this.translate.instant('core.serverconnection'),
this.translate.instant('mm.core.errorinvalidresponse'), this.translate.instant('core.errorinvalidresponse'),
this.translate.instant('mm.core.sitemaintenance'), this.translate.instant('core.sitemaintenance'),
this.translate.instant('mm.core.upgraderunning'), this.translate.instant('core.upgraderunning'),
this.translate.instant('mm.core.nopasswordchangeforced'), this.translate.instant('core.nopasswordchangeforced'),
this.translate.instant('mm.core.unicodenotsupported') this.translate.instant('core.unicodenotsupported')
]; ];
return error && localErrors.indexOf(error) == -1; return error && localErrors.indexOf(error) == -1;
} }
@ -687,7 +687,7 @@ export class CoreUtilsProvider {
if (require('electron').ipcRenderer.sendSync('openItem', path)) { if (require('electron').ipcRenderer.sendSync('openItem', path)) {
resolve(); resolve();
} else { } else {
reject(this.translate.instant('mm.core.erroropenfilenoapp')); reject(this.translate.instant('core.erroropenfilenoapp'));
} }
} else if ((<any>window).plugins) { } else if ((<any>window).plugins) {
// @todo // @todo
@ -717,9 +717,9 @@ export class CoreUtilsProvider {
// if (!extension || extension.indexOf('/') > -1 || extension.indexOf('\\') > -1) { // if (!extension || extension.indexOf('/') > -1 || extension.indexOf('\\') > -1) {
// // Extension not found. // // Extension not found.
// $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoextension'); // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoextension');
// } else { // } else {
// $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoapp'); // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoapp');
// } // }
// } // }
// ); // );
@ -859,7 +859,7 @@ export class CoreUtilsProvider {
// }).then(function(mimetype) { // }).then(function(mimetype) {
// if (!mimetype) { // if (!mimetype) {
// // Couldn't retrieve mimetype. Return error. // // Couldn't retrieve mimetype. Return error.
// $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoextension'); // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoextension');
// return; // return;
// } // }
@ -881,7 +881,7 @@ export class CoreUtilsProvider {
// $log.debug('url: ' + iParams.url); // $log.debug('url: ' + iParams.url);
// $log.debug('type: ' + iParams.type); // $log.debug('type: ' + iParams.type);
// $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoapp'); // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoapp');
// } // }
// ); // );
// }); // });
@ -1120,7 +1120,7 @@ export class CoreUtilsProvider {
return ''; return '';
} }
let localeSeparator = this.translate.instant('mm.core.decsep'); let localeSeparator = this.translate.instant('core.decsep');
localeFloat = localeFloat.replace(' ', ''); // No spaces - those might be used as thousand separators. localeFloat = localeFloat.replace(' ', ''); // No spaces - those might be used as thousand separators.
localeFloat = localeFloat.replace(localeSeparator, '.'); localeFloat = localeFloat.replace(localeSeparator, '.');

View File

@ -116,9 +116,9 @@ export class CoreWSProvider {
let siteUrl; let siteUrl;
if (!preSets) { if (!preSets) {
return Promise.reject(this.createFakeWSError('mm.core.unexpectederror', true)); return Promise.reject(this.createFakeWSError('core.unexpectederror', true));
} else if (!this.appProvider.isOnline()) { } else if (!this.appProvider.isOnline()) {
return Promise.reject(this.createFakeWSError('mm.core.networkerrormsg', true)); return Promise.reject(this.createFakeWSError('core.networkerrormsg', true));
} }
preSets.typeExpected = preSets.typeExpected || 'object'; preSets.typeExpected = preSets.typeExpected || 'object';
@ -161,9 +161,9 @@ export class CoreWSProvider {
ajaxData; ajaxData;
if (typeof preSets.siteUrl == 'undefined') { if (typeof preSets.siteUrl == 'undefined') {
return rejectWithError(this.translate.instant('mm.core.unexpectederror')); return rejectWithError(this.translate.instant('core.unexpectederror'));
} else if (!this.appProvider.isOnline()) { } else if (!this.appProvider.isOnline()) {
return rejectWithError(this.translate.instant('mm.core.networkerrormsg')); return rejectWithError(this.translate.instant('core.networkerrormsg'));
} }
if (typeof preSets.responseExpected == 'undefined') { if (typeof preSets.responseExpected == 'undefined') {
@ -188,7 +188,7 @@ export class CoreWSProvider {
// Check if error. Ajax layer should always return an object (if error) or an array (if success). // Check if error. Ajax layer should always return an object (if error) or an array (if success).
if (!data || typeof data != 'object') { if (!data || typeof data != 'object') {
return rejectWithError(this.translate.instant('mm.core.serverconnection')); return rejectWithError(this.translate.instant('core.serverconnection'));
} else if (data.error) { } else if (data.error) {
return rejectWithError(data.error, data.errorcode); return rejectWithError(data.error, data.errorcode);
} }
@ -203,7 +203,7 @@ export class CoreWSProvider {
return data.data; return data.data;
}, (data) => { }, (data) => {
let available = data.status == 404 ? -1 : 0; let available = data.status == 404 ? -1 : 0;
return rejectWithError(this.translate.instant('mm.core.serverconnection'), '', available); return rejectWithError(this.translate.instant('core.serverconnection'), '', available);
}); });
// Convenience function to return an error. // Convenience function to return an error.
@ -286,7 +286,7 @@ export class CoreWSProvider {
this.logger.debug('Downloading file', url, path, addExtension); this.logger.debug('Downloading file', url, path, addExtension);
if (!this.appProvider.isOnline()) { if (!this.appProvider.isOnline()) {
return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); return Promise.reject(this.translate.instant('core.networkerrormsg'));
} }
// Use a tmp path to download the file and then move it to final location. This is because if the download fails, // Use a tmp path to download the file and then move it to final location. This is because if the download fails,
@ -463,10 +463,10 @@ export class CoreWSProvider {
} }
if (!data) { if (!data) {
return Promise.reject(this.createFakeWSError('mm.core.serverconnection', true)); return Promise.reject(this.createFakeWSError('core.serverconnection', true));
} else if (typeof data != preSets.typeExpected) { } else if (typeof data != preSets.typeExpected) {
this.logger.warn('Response of type "' + typeof data + `" received, expecting "${preSets.typeExpected}"`); this.logger.warn('Response of type "' + typeof data + `" received, expecting "${preSets.typeExpected}"`);
return Promise.reject(this.createFakeWSError('mm.core.errorinvalidresponse', true)); return Promise.reject(this.createFakeWSError('core.errorinvalidresponse', true));
} }
if (typeof data.exception !== 'undefined') { if (typeof data.exception !== 'undefined') {
@ -502,7 +502,7 @@ export class CoreWSProvider {
return retryPromise; return retryPromise;
} }
return Promise.reject(this.createFakeWSError('mm.core.serverconnection', true)); return Promise.reject(this.createFakeWSError('core.serverconnection', true));
}); });
promise = this.setPromiseHttp(promise, 'post', preSets.siteUrl, ajaxData); promise = this.setPromiseHttp(promise, 'post', preSets.siteUrl, ajaxData);
@ -574,10 +574,10 @@ export class CoreWSProvider {
}; };
if (!preSets) { if (!preSets) {
errorResponse.message = this.translate.instant('mm.core.unexpectederror'); errorResponse.message = this.translate.instant('core.unexpectederror');
return errorResponse; return errorResponse;
} else if (!this.appProvider.isOnline()) { } else if (!this.appProvider.isOnline()) {
errorResponse.message = this.translate.instant('mm.core.networkerrormsg'); errorResponse.message = this.translate.instant('core.networkerrormsg');
return errorResponse; return errorResponse;
} }
@ -590,7 +590,7 @@ export class CoreWSProvider {
data = this.convertValuesToString(data, preSets.cleanUnicode); data = this.convertValuesToString(data, preSets.cleanUnicode);
} catch (e) { } catch (e) {
// Empty cleaned text found. // Empty cleaned text found.
errorResponse.message = this.translate.instant('mm.core.unicodenotsupportedcleanerror'); errorResponse.message = this.translate.instant('core.unicodenotsupportedcleanerror');
return errorResponse; return errorResponse;
} }
@ -631,10 +631,10 @@ export class CoreWSProvider {
} }
if (!data) { if (!data) {
errorResponse.message = this.translate.instant('mm.core.serverconnection'); errorResponse.message = this.translate.instant('core.serverconnection');
} else if (typeof data != preSets.typeExpected) { } else if (typeof data != preSets.typeExpected) {
this.logger.warn('Response of type "' + typeof data + '" received, expecting "' + preSets.typeExpected + '"'); this.logger.warn('Response of type "' + typeof data + '" received, expecting "' + preSets.typeExpected + '"');
errorResponse.message = this.translate.instant('mm.core.errorinvalidresponse'); errorResponse.message = this.translate.instant('core.errorinvalidresponse');
} }
if (typeof data.exception != 'undefined' || typeof data.debuginfo != 'undefined') { if (typeof data.exception != 'undefined' || typeof data.debuginfo != 'undefined') {
@ -666,7 +666,7 @@ export class CoreWSProvider {
} }
if (!this.appProvider.isOnline()) { if (!this.appProvider.isOnline()) {
return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); return Promise.reject(this.translate.instant('core.networkerrormsg'));
} }
let uploadUrl = preSets.siteUrl + '/webservice/upload.php', let uploadUrl = preSets.siteUrl + '/webservice/upload.php',
@ -691,14 +691,14 @@ export class CoreWSProvider {
data = JSON.parse(data); data = JSON.parse(data);
} catch(err) { } catch(err) {
this.logger.error('Error parsing response from upload:', err, data); this.logger.error('Error parsing response from upload:', err, data);
return Promise.reject(this.translate.instant('mm.core.errorinvalidresponse')); return Promise.reject(this.translate.instant('core.errorinvalidresponse'));
} }
if (!data) { if (!data) {
return Promise.reject(this.translate.instant('mm.core.serverconnection')); return Promise.reject(this.translate.instant('core.serverconnection'));
} else if (typeof data != 'object') { } else if (typeof data != 'object') {
this.logger.warn('Upload file: Response of type "' + typeof data + '" received, expecting "object"'); this.logger.warn('Upload file: Response of type "' + typeof data + '" received, expecting "object"');
return Promise.reject(this.translate.instant('mm.core.errorinvalidresponse')); return Promise.reject(this.translate.instant('core.errorinvalidresponse'));
} }
if (typeof data.exception !== 'undefined') { if (typeof data.exception !== 'undefined') {
@ -714,7 +714,7 @@ export class CoreWSProvider {
return data[0]; return data[0];
}).catch((error) => { }).catch((error) => {
this.logger.error('Error while uploading file', filePath, error); this.logger.error('Error while uploading file', filePath, error);
return Promise.reject(this.translate.instant('mm.core.errorinvalidresponse')); return Promise.reject(this.translate.instant('core.errorinvalidresponse'));
}); });
} }
} }