MOBILE-2984 config: Allow overriding site name

main
Dani Palou 2019-04-18 08:51:28 +02:00
parent 265f4a40f4
commit dd4688f3d4
11 changed files with 27 additions and 7 deletions

View File

@ -1342,6 +1342,7 @@
"core.favourites": "Starred", "core.favourites": "Starred",
"core.filename": "Filename", "core.filename": "Filename",
"core.filenameexist": "File name already exists: {{$a}}", "core.filenameexist": "File name already exists: {{$a}}",
"core.filenotfound": "File not found, sorry.",
"core.fileuploader.addfiletext": "Add file", "core.fileuploader.addfiletext": "Add file",
"core.fileuploader.audio": "Audio", "core.fileuploader.audio": "Audio",
"core.fileuploader.camera": "Camera", "core.fileuploader.camera": "Camera",

View File

@ -305,6 +305,20 @@ export class CoreSite {
return this.infos && this.infos.siteid || 1; return this.infos && this.infos.siteid || 1;
} }
/**
* Get site name.
*
* @return {string} Site name.
*/
getSiteName(): string {
if (CoreConfigConstants.sitename) {
// Overridden by config.
return CoreConfigConstants.sitename;
} else {
return this.infos && this.infos.sitename || '';
}
}
/** /**
* Set site ID. * Set site ID.
* *

View File

@ -67,6 +67,7 @@
}, },
"customurlscheme": "moodlemobile", "customurlscheme": "moodlemobile",
"siteurl": "", "siteurl": "",
"sitename": "",
"multisitesdisplay": "", "multisitesdisplay": "",
"skipssoconfirmation": false, "skipssoconfirmation": false,
"forcedefaultlanguage": false, "forcedefaultlanguage": false,

View File

@ -131,7 +131,7 @@ export class CoreCoursesDashboardPage implements OnDestroy {
* Load the site name. * Load the site name.
*/ */
protected loadSiteName(): void { protected loadSiteName(): void {
this.siteName = this.sitesProvider.getCurrentSite().getInfo().sitename; this.siteName = this.sitesProvider.getCurrentSite().getSiteName();
} }
/** /**

View File

@ -24,6 +24,7 @@ import { CoreLoginHelperProvider } from '../../providers/helper';
import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate';
import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { CoreConfigConstants } from '../../../../configconstants';
/** /**
* Page to enter the user credentials. * Page to enter the user credentials.
@ -142,7 +143,7 @@ export class CoreLoginCredentialsPage {
*/ */
protected treatSiteConfig(): void { protected treatSiteConfig(): void {
if (this.siteConfig) { if (this.siteConfig) {
this.siteName = this.siteConfig.sitename; this.siteName = CoreConfigConstants.sitename ? CoreConfigConstants.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('core.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);

View File

@ -23,6 +23,7 @@ import { CoreWSProvider } from '@providers/ws';
import { CoreLoginHelperProvider } from '../../providers/helper'; import { CoreLoginHelperProvider } from '../../providers/helper';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { CoreUserProfileFieldDelegate } from '@core/user/providers/user-profile-field-delegate'; import { CoreUserProfileFieldDelegate } from '@core/user/providers/user-profile-field-delegate';
import { CoreConfigConstants } from '../../../../configconstants';
/** /**
* Page to signup using email. * Page to signup using email.
@ -191,7 +192,7 @@ export class CoreLoginEmailSignupPage {
*/ */
protected treatSiteConfig(siteConfig: any): boolean { protected treatSiteConfig(siteConfig: any): boolean {
if (siteConfig && siteConfig.registerauth == 'email' && !this.loginHelper.isEmailSignupDisabled(siteConfig)) { if (siteConfig && siteConfig.registerauth == 'email' && !this.loginHelper.isEmailSignupDisabled(siteConfig)) {
this.siteName = siteConfig.sitename; this.siteName = CoreConfigConstants.sitename ? CoreConfigConstants.sitename : siteConfig.sitename;
this.authInstructions = siteConfig.authinstructions; this.authInstructions = siteConfig.authinstructions;
this.ageDigitalConsentVerification = siteConfig.agedigitalconsentverification; this.ageDigitalConsentVerification = siteConfig.agedigitalconsentverification;
this.supportName = siteConfig.supportname; this.supportName = siteConfig.supportname;

View File

@ -80,7 +80,7 @@ export class CoreLoginReconnectPage {
this.username = site.infos.username; this.username = site.infos.username;
this.siteUrl = site.infos.siteurl; this.siteUrl = site.infos.siteurl;
this.siteName = site.infos.sitename; this.siteName = site.getSiteName();
// Check logoURL if user avatar is not set. // Check logoURL if user avatar is not set.
if (this.site.avatar.startsWith(site.infos.siteurl + '/theme/image.php')) { if (this.site.avatar.startsWith(site.infos.siteurl + '/theme/image.php')) {

View File

@ -1,6 +1,6 @@
<ion-header> <ion-header>
<ion-navbar core-back-button> <ion-navbar core-back-button>
<ion-title><core-format-text [text]="siteInfo.sitename"></core-format-text></ion-title> <ion-title><core-format-text [text]="siteName"></core-format-text></ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content> <ion-content>

View File

@ -31,6 +31,7 @@ export class CoreMainMenuMorePage implements OnDestroy {
handlers: CoreMainMenuHandlerData[]; handlers: CoreMainMenuHandlerData[];
handlersLoaded: boolean; handlersLoaded: boolean;
siteInfo: any; siteInfo: any;
siteName: string;
logoutLabel: string; logoutLabel: string;
showWeb: boolean; showWeb: boolean;
showHelp: boolean; showHelp: boolean;
@ -91,6 +92,7 @@ export class CoreMainMenuMorePage implements OnDestroy {
config = currentSite.getStoredConfig(); config = currentSite.getStoredConfig();
this.siteInfo = currentSite.getInfo(); this.siteInfo = currentSite.getInfo();
this.siteName = currentSite.getSiteName();
this.logoutLabel = 'core.mainmenu.' + (config && config.tool_mobile_forcelogout == '1' ? 'logout' : 'changesite'); this.logoutLabel = 'core.mainmenu.' + (config && config.tool_mobile_forcelogout == '1' ? 'logout' : 'changesite');
this.showWeb = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_website'); this.showWeb = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_website');
this.showHelp = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_help'); this.showHelp = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_help');

View File

@ -50,7 +50,7 @@ export class CoreSettingsSynchronizationPage implements OnDestroy {
const siteEntry = this.sites.find((siteEntry) => siteEntry.id == site.id); const siteEntry = this.sites.find((siteEntry) => siteEntry.id == site.id);
if (siteEntry) { if (siteEntry) {
siteEntry.siteUrl = siteInfo.siteurl; siteEntry.siteUrl = siteInfo.siteurl;
siteEntry.siteName = siteInfo.sitename; siteEntry.siteName = site.getSiteName();
siteEntry.fullName = siteInfo.fullname; siteEntry.fullName = siteInfo.fullname;
} }
}); });

View File

@ -1009,7 +1009,7 @@ export class CoreSitesProvider {
id: site.id, id: site.id,
siteUrl: site.siteUrl, siteUrl: site.siteUrl,
fullName: siteInfo && siteInfo.fullname, fullName: siteInfo && siteInfo.fullname,
siteName: siteInfo && siteInfo.sitename, siteName: CoreConfigConstants.sitename ? CoreConfigConstants.sitename : siteInfo && siteInfo.sitename,
avatar: siteInfo && siteInfo.userpictureurl avatar: siteInfo && siteInfo.userpictureurl
}; };
formattedSites.push(basicInfo); formattedSites.push(basicInfo);