diff --git a/scripts/langindex.json b/scripts/langindex.json index 2b696380e..d5a8c1769 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1620,8 +1620,8 @@ "core.h5p.originator": "h5p", "core.h5p.pd": "h5p", "core.h5p.pddl": "h5p", - "core.h5p.play": "local_moodlemobileapp", "core.h5p.pdm": "h5p", + "core.h5p.play": "local_moodlemobileapp", "core.h5p.resizescript": "h5p", "core.h5p.resubmitScores": "h5p", "core.h5p.reuse": "h5p", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index 5a3093332..93693ba6f 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1328,7 +1328,7 @@ "core.back": "Back", "core.block.blocks": "Blocks", "core.cancel": "Cancel", - "core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.", + "core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle {{$a}} or later.", "core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.", "core.captureaudio": "Record audio", "core.capturedimage": "Taken picture.", @@ -1670,7 +1670,6 @@ "core.login.changepasswordinstructions": "You cannot change your password in the app. Please click the following button to open the site in a web browser to change your password. Take into account you need to close the browser after changing the password as you will not be redirected to the app.", "core.login.changepasswordlogoutinstructions": "If you prefer to change site or log out, please click the following button:", "core.login.changepasswordreconnectinstructions": "Click the following button to reconnect to the site. (Take into account that if you didn't change your password successfully, you would return to the previous screen).", - "core.login.checksiteversion": "Check that your site uses Moodle 3.1 or later.", "core.login.confirmdeletesite": "Are you sure you want to delete the site {{sitename}}?", "core.login.connect": "Connect!", "core.login.connecttomoodle": "Connect to Moodle", @@ -1700,7 +1699,7 @@ "core.login.invalidaccount": "Please check your login details or ask your site administrator to check the site configuration.", "core.login.invaliddate": "Invalid date", "core.login.invalidemail": "Invalid email address", - "core.login.invalidmoodleversion": "
Invalid Moodle site version. The Moodle app only supports Moodle systems 3.1 onwards.
\nYou can contact your site administrators and ask them to update their Moodle system.
\n\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.
", + "core.login.invalidmoodleversion": "Invalid Moodle site version. The Moodle app only supports Moodle systems {{$a}} onwards.
\nYou can contact your site administrators and ask them to update their Moodle system.
\n\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.
", "core.login.invalidsite": "The site URL is invalid.", "core.login.invalidtime": "Invalid time", "core.login.invalidurl": "Invalid URL specified", diff --git a/src/classes/site.ts b/src/classes/site.ts index 574f6be44..e7776a33c 100644 --- a/src/classes/site.ts +++ b/src/classes/site.ts @@ -212,6 +212,7 @@ export class CoreSite { 3.6: 2018120300, 3.7: 2019052000 }; + static MINIMUM_MOODLE_VERSION = 3.1; // Possible cache update frequencies. protected UPDATE_FREQUENCIES = [ @@ -657,7 +658,8 @@ export class CoreSite { const promise = this.getFromCache(method, data, preSets, false, originalData).catch(() => { if (preSets.forceOffline) { // Don't call the WS, just fail. - return Promise.reject(this.wsProvider.createFakeWSError('core.cannotconnect', true)); + return Promise.reject(this.wsProvider.createFakeWSError('core.cannotconnect', true, + {$a: CoreSite.MINIMUM_MOODLE_VERSION})); } // Call the WS. diff --git a/src/core/login/lang/en.json b/src/core/login/lang/en.json index 0e7cbf3cf..fe816b435 100644 --- a/src/core/login/lang/en.json +++ b/src/core/login/lang/en.json @@ -2,7 +2,6 @@ "auth_email": "Email-based self-registration", "authenticating": "Authenticating", "cancel": "Cancel", - "checksiteversion": "Check that your site uses Moodle 3.1 or later.", "changepassword": "Change password", "changepasswordbutton": "Open the change password page", "changepasswordhelp": "If you have problems changing your password, please contact your site administrator. \"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.", @@ -38,7 +37,7 @@ "invalidaccount": "Please check your login details or ask your site administrator to check the site configuration.", "invaliddate": "Invalid date", "invalidemail": "Invalid email address", - "invalidmoodleversion": "Invalid Moodle site version. The Moodle app only supports Moodle systems 3.1 onwards.
\nYou can contact your site administrators and ask them to update their Moodle system.
\n\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.
", + "invalidmoodleversion": "Invalid Moodle site version. The Moodle app only supports Moodle systems {{$a}} onwards.
\nYou can contact your site administrators and ask them to update their Moodle system.
\n\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.
", "invalidsite": "The site URL is invalid.", "invalidtime": "Invalid time", "invalidurl": "Invalid URL specified", diff --git a/src/lang/en.json b/src/lang/en.json index bb56a4a34..4701fe667 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -12,7 +12,7 @@ "areyousure": "Are you sure?", "back": "Back", "cancel": "Cancel", - "cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.", + "cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle {{$a}} or later.", "cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.", "captureaudio": "Record audio", "capturedimage": "Taken picture.", diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 857a52058..0dafd3e3c 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -371,7 +371,7 @@ export class CoreSitesProvider { } else if (this.textUtils.getErrorMessageFromError(secondError)) { return Promise.reject(secondError); } else { - return this.translate.instant('core.cannotconnect'); + return this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION}); } }); }); @@ -463,7 +463,8 @@ export class CoreSitesProvider { error.error = this.translate.instant('core.login.sitehasredirect'); } else { // We can't be sure if there is a redirect or not. Display cannot connect error. - error.error = this.translate.instant('core.cannotconnect'); + error.error = this.translate.instant('core.cannotconnect', + {$a: CoreSite.MINIMUM_MOODLE_VERSION}); } return Promise.reject(error); @@ -508,7 +509,7 @@ export class CoreSitesProvider { return this.http.post(siteUrl + '/login/token.php', {}).timeout(this.wsProvider.getRequestTimeout()).toPromise() .catch(() => { // Default error messages are kinda bad, return our own message. - return Promise.reject({error: this.translate.instant('core.cannotconnect')}); + return Promise.reject({error: this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION})}); }).then((data: any) => { if (data.errorcode && (data.errorcode == 'enablewsdescription' || data.errorcode == 'requirecorrectaccess')) { @@ -550,7 +551,7 @@ export class CoreSitesProvider { return promise.then((data: any): any => { if (typeof data == 'undefined') { - return Promise.reject(this.translate.instant('core.cannotconnect')); + return Promise.reject(this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION})); } else { if (typeof data.token != 'undefined') { return { token: data.token, siteUrl: siteUrl, privateToken: data.privatetoken }; @@ -582,7 +583,7 @@ export class CoreSitesProvider { } } }, () => { - return Promise.reject(this.translate.instant('core.cannotconnect')); + return Promise.reject(this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION})); }); } @@ -676,7 +677,8 @@ export class CoreSitesProvider { */ protected treatInvalidAppVersion(result: number, siteUrl: string, siteId?: string): Promise