From 2b4ebdefa1f3e34b54a9224d5ae6f7f8a0c566c1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 28 Oct 2016 16:38:33 +0300 Subject: [PATCH] Changed branding permissions. Use canBranding from license to hiding panels. --- apps/api/documents/api.js | 3 ++- .../documenteditor/main/app/controller/Main.js | 18 +++++++++++++----- apps/documenteditor/main/app/view/Toolbar.js | 2 +- .../main/app/controller/Main.js | 16 ++++++++++++---- .../main/app/view/Toolbar.js | 4 ++-- .../main/app/controller/Main.js | 16 ++++++++++++---- .../spreadsheeteditor/main/app/view/Toolbar.js | 4 ++-- 7 files changed, 44 insertions(+), 19 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 38554517a..62e2961ba 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -108,7 +108,8 @@ comments: false, leftMenu: true, rightMenu: true, - toolbar: true + toolbar: true, + header: true }, plugins: { autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}', diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 371d90fff..09fd6c3b9 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -61,10 +61,14 @@ define([ var mapCustomizationElements = { about: 'button#left-btn-about', feedback: 'button#left-btn-support', - goback: '#fm-btn-back > a, #header-back > div', + goback: '#fm-btn-back > a, #header-back > div' + }; + + var mapCustomizationExtElements = { toolbar: '#viewport #toolbar', - leftMenu: '#viewport #left-menu', - rightMenu: '#viewport #right-menu' + leftMenu: '#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings', + rightMenu: '#viewport #right-menu', + header: '#viewport #header' }; Common.localStorage.setId('text'); @@ -965,12 +969,14 @@ define([ this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; - this.appOptions.canBranding = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object'); + this.appOptions.canBranding = (licType!==Asc.c_oLicenseResult.Error) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) this.getApplication().getController('Viewport').getView('Common.Views.Header').setBranding(this.editorConfig.customization); params.asc_getTrial() && this.getApplication().getController('Viewport').getView('Common.Views.Header').setDeveloperMode(true); - + + this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object'); + this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -1403,6 +1409,8 @@ define([ if (!this.appOptions.isDesktopApp) this.appOptions.customization.about = true; Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements); + if (this.appOptions.canBrandingExt) + Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements); } Common.NotificationCenter.trigger('layout:changed', 'main'); diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 7e49aea01..7298b55ab 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1195,7 +1195,7 @@ define([ ] }) ); - if (this.mode.isDesktopApp) + if (this.mode.isDesktopApp || this.mode.canBrandingExt && this.mode.customization && this.mode.customization.header===false) this.mnuitemHideTitleBar.hide(); this.btnMarkers.setMenu( diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index d199878aa..4e3c0d5fb 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -59,10 +59,14 @@ define([ var mapCustomizationElements = { about: 'button#left-btn-about', feedback: 'button#left-btn-support', - goback: '#fm-btn-back > a, #header-back > div', + goback: '#fm-btn-back > a, #header-back > div' + }; + + var mapCustomizationExtElements = { toolbar: '#viewport #toolbar', - leftMenu: '#viewport #left-menu', - rightMenu: '#viewport #right-menu' + leftMenu: '#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings', + rightMenu: '#viewport #right-menu', + header: '#viewport #header' }; Common.localStorage.setId('presentation'); @@ -744,12 +748,14 @@ define([ this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; - this.appOptions.canBranding = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object'); + this.appOptions.canBranding = (licType!==Asc.c_oLicenseResult.Error) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) this.getApplication().getController('Viewport').getView('Common.Views.Header').setBranding(this.editorConfig.customization); params.asc_getTrial() && this.getApplication().getController('Viewport').getView('Common.Views.Header').setDeveloperMode(true); + this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object'); + this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -1170,6 +1176,8 @@ define([ if (!this.appOptions.isDesktopApp) this.appOptions.customization.about = true; Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements); + if (this.appOptions.canBrandingExt) + Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements); } Common.NotificationCenter.trigger('layout:changed', 'main'); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 8d2b9802e..0c6a93e00 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1282,10 +1282,10 @@ define([ } } - if (mode.isDesktopApp) { + if (mode.isDesktopApp) $('.toolbar-group-native').hide(); + if (mode.isDesktopApp || mode.canBrandingExt && mode.customization && mode.customization.header===false) this.mnuitemHideTitleBar.hide(); - } this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 4d1b9f8dc..7b0aa2d2e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -65,10 +65,14 @@ define([ var mapCustomizationElements = { about: 'button#left-btn-about', feedback: 'button#left-btn-support', - goback: '#fm-btn-back > a, #header-back > div', + goback: '#fm-btn-back > a, #header-back > div' + }; + + var mapCustomizationExtElements = { toolbar: '#viewport #toolbar', - leftMenu: '#viewport #left-menu', - rightMenu: '#viewport #right-menu' + leftMenu: '#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings', + rightMenu: '#viewport #right-menu', + header: '#viewport #header' }; Common.localStorage.setId('table'); @@ -761,10 +765,12 @@ define([ this.appOptions.canComments = this.appOptions.canLicense && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); - this.appOptions.canBranding = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object'); + this.appOptions.canBranding = (licType!==Asc.c_oLicenseResult.Error) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) this.headerView.setBranding(this.editorConfig.customization); + this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object'); + params.asc_getTrial() && this.headerView.setDeveloperMode(true); } @@ -1297,6 +1303,8 @@ define([ if (!this.appOptions.isDesktopApp) this.appOptions.customization.about = true; Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements); + if (this.appOptions.canBrandingExt) + Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements); } this.stackLongActions.pop({id: InitApplication, type: Asc.c_oAscAsyncActionType.BlockInteraction}); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 6aaa5c58a..442e939bb 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1650,10 +1650,10 @@ define([ } } - if (mode.isDesktopApp) { + if (mode.isDesktopApp) $('.toolbar-group-native').hide(); + if (mode.isDesktopApp || mode.canBrandingExt && mode.customization && mode.customization.header===false) this.mnuitemHideTitleBar.hide(); - } this.lockToolbar(SSE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); }