[Embedded] Customize header logo depending on the license
This commit is contained in:
parent
9a5632668f
commit
19617d9943
|
@ -595,27 +595,12 @@ DE.ApplicationController = new(function(){
|
|||
}
|
||||
|
||||
function onEditorPermissions(params) {
|
||||
if ( (params.asc_getLicenseType() === Asc.c_oLicenseResult.Success) && (typeof config.customization == 'object') &&
|
||||
config.customization && config.customization.logo ) {
|
||||
|
||||
var logo = $('#header-logo');
|
||||
if (config.customization.logo.image || config.customization.logo.imageEmbedded) {
|
||||
logo.html('<img src="'+(config.customization.logo.image || config.customization.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
|
||||
config.customization.logo.imageEmbedded && console.log("Obsolete: The 'imageEmbedded' parameter of the 'customization.logo' section is deprecated. Please use 'image' parameter instead.");
|
||||
}
|
||||
|
||||
if (config.customization.logo.url) {
|
||||
logo.attr('href', config.customization.logo.url);
|
||||
} else if (config.customization.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
var licType = params.asc_getLicenseType();
|
||||
appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
|
||||
appOptions.canFillForms = appOptions.canLicense && (permissions.fillForms===true) && (config.mode !== 'view');
|
||||
appOptions.canSubmitForms = appOptions.canLicense && (typeof (config.customization) == 'object') && !!config.customization.submitForm;
|
||||
appOptions.canBranding = params.asc_getCustomization();
|
||||
appOptions.canBranding && setBranding(config.customization);
|
||||
|
||||
api.asc_setViewMode(!appOptions.canFillForms);
|
||||
|
||||
|
@ -821,6 +806,24 @@ DE.ApplicationController = new(function(){
|
|||
function onBeforeUnload () {
|
||||
common.localStorage.save();
|
||||
}
|
||||
|
||||
function setBranding(value) {
|
||||
if ( value && value.logo) {
|
||||
var logo = $('#header-logo');
|
||||
if (value.logo.image || value.logo.imageEmbedded) {
|
||||
logo.html('<img src="'+(value.logo.image || value.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
|
||||
value.logo.imageEmbedded && console.log("Obsolete: The 'imageEmbedded' parameter of the 'customization.logo' section is deprecated. Please use 'image' parameter instead.");
|
||||
}
|
||||
|
||||
if (value.logo.url) {
|
||||
logo.attr('href', value.logo.url);
|
||||
} else if (value.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Helpers
|
||||
// -------------------------
|
||||
|
||||
|
|
|
@ -433,22 +433,6 @@ define([
|
|||
|
||||
if ( this.onServerVersion(params.asc_getBuildVersion())) return;
|
||||
|
||||
if ( (licType === Asc.c_oLicenseResult.Success) && (typeof this.appOptions.customization == 'object') &&
|
||||
this.appOptions.customization && this.appOptions.customization.logo ) {
|
||||
|
||||
var logo = $('#header-logo');
|
||||
if (this.appOptions.customization.logo.image) {
|
||||
logo.html('<img src="'+this.appOptions.customization.logo.image+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
}
|
||||
|
||||
if (this.appOptions.customization.logo.url) {
|
||||
logo.attr('href', this.appOptions.customization.logo.url);
|
||||
} else if (this.appOptions.customization.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
|
||||
this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review;
|
||||
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
||||
this.permissions.edit = this.permissions.review = false;
|
||||
|
@ -460,6 +444,9 @@ define([
|
|||
this.appOptions.canFillForms = this.appOptions.canLicense && (this.permissions.fillForms===true) && (this.editorConfig.mode !== 'view');
|
||||
this.api.asc_setViewMode(!this.appOptions.canFillForms);
|
||||
|
||||
this.appOptions.canBranding = params.asc_getCustomization();
|
||||
this.appOptions.canBranding && this.setBranding(this.appOptions.customization);
|
||||
|
||||
this.appOptions.canDownload = this.permissions.download !== false;
|
||||
this.appOptions.canPrint = (this.permissions.print !== false);
|
||||
|
||||
|
@ -582,6 +569,22 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
setBranding: function (value) {
|
||||
if ( value && value.logo) {
|
||||
var logo = $('#header-logo');
|
||||
if (value.logo.image) {
|
||||
logo.html('<img src="'+value.logo.image+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
}
|
||||
|
||||
if (value.logo.url) {
|
||||
logo.attr('href', value.logo.url);
|
||||
} else if (value.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onLongActionBegin: function(type, id) {
|
||||
var action = {id: id, type: type};
|
||||
this.stackLongActions.push(action);
|
||||
|
|
|
@ -37,6 +37,7 @@ PE.ApplicationController = new(function(){
|
|||
docConfig = {},
|
||||
embedConfig = {},
|
||||
permissions = {},
|
||||
appOptions = {},
|
||||
maxPages = 0,
|
||||
created = false,
|
||||
currentPage = 0,
|
||||
|
@ -453,23 +454,8 @@ PE.ApplicationController = new(function(){
|
|||
}
|
||||
|
||||
function onEditorPermissions(params) {
|
||||
if ( (params.asc_getLicenseType() === Asc.c_oLicenseResult.Success) && (typeof config.customization == 'object') &&
|
||||
config.customization && config.customization.logo ) {
|
||||
|
||||
var logo = $('#header-logo');
|
||||
if (config.customization.logo.image || config.customization.logo.imageEmbedded) {
|
||||
logo.html('<img src="'+(config.customization.logo.image || config.customization.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
|
||||
config.customization.logo.imageEmbedded && console.log("Obsolete: The 'imageEmbedded' parameter of the 'customization.logo' section is deprecated. Please use 'image' parameter instead.");
|
||||
}
|
||||
|
||||
if (config.customization.logo.url) {
|
||||
logo.attr('href', config.customization.logo.url);
|
||||
} else if (config.customization.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
appOptions.canBranding = params.asc_getCustomization();
|
||||
appOptions.canBranding && setBranding(config.customization);
|
||||
|
||||
var $parent = labelDocName.parent();
|
||||
var _left_width = $parent.position().left,
|
||||
|
@ -655,6 +641,24 @@ PE.ApplicationController = new(function(){
|
|||
function onBeforeUnload () {
|
||||
common.localStorage.save();
|
||||
}
|
||||
|
||||
function setBranding(value) {
|
||||
if ( value && value.logo) {
|
||||
var logo = $('#header-logo');
|
||||
if (value.logo.image || value.logo.imageEmbedded) {
|
||||
logo.html('<img src="'+(value.logo.image || value.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
|
||||
value.logo.imageEmbedded && console.log("Obsolete: The 'imageEmbedded' parameter of the 'customization.logo' section is deprecated. Please use 'image' parameter instead.");
|
||||
}
|
||||
|
||||
if (value.logo.url) {
|
||||
logo.attr('href', value.logo.url);
|
||||
} else if (value.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Helpers
|
||||
// -------------------------
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ SSE.ApplicationController = new(function(){
|
|||
docConfig = {},
|
||||
embedConfig = {},
|
||||
permissions = {},
|
||||
appOptions = {},
|
||||
maxPages = 0,
|
||||
created = false,
|
||||
iframePrint = null;
|
||||
|
@ -349,23 +350,8 @@ SSE.ApplicationController = new(function(){
|
|||
}
|
||||
|
||||
function onEditorPermissions(params) {
|
||||
if ( (params.asc_getLicenseType() === Asc.c_oLicenseResult.Success) && (typeof config.customization == 'object') &&
|
||||
config.customization && config.customization.logo ) {
|
||||
|
||||
var logo = $('#header-logo');
|
||||
if (config.customization.logo.image || config.customization.logo.imageEmbedded) {
|
||||
logo.html('<img src="'+(config.customization.logo.image || config.customization.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
|
||||
config.customization.logo.imageEmbedded && console.log("Obsolete: The 'imageEmbedded' parameter of the 'customization.logo' section is deprecated. Please use 'image' parameter instead.");
|
||||
}
|
||||
|
||||
if (config.customization.logo.url) {
|
||||
logo.attr('href', config.customization.logo.url);
|
||||
} else if (config.customization.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
appOptions.canBranding = params.asc_getCustomization();
|
||||
appOptions.canBranding && setBranding(config.customization);
|
||||
|
||||
var $parent = labelDocName.parent();
|
||||
var _left_width = $parent.position().left,
|
||||
|
@ -608,6 +594,24 @@ SSE.ApplicationController = new(function(){
|
|||
function onBeforeUnload () {
|
||||
common.localStorage.save();
|
||||
}
|
||||
|
||||
function setBranding(value) {
|
||||
if ( value && value.logo) {
|
||||
var logo = $('#header-logo');
|
||||
if (value.logo.image || value.logo.imageEmbedded) {
|
||||
logo.html('<img src="'+(value.logo.image || value.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
|
||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
||||
|
||||
value.logo.imageEmbedded && console.log("Obsolete: The 'imageEmbedded' parameter of the 'customization.logo' section is deprecated. Please use 'image' parameter instead.");
|
||||
}
|
||||
|
||||
if (value.logo.url) {
|
||||
logo.attr('href', value.logo.url);
|
||||
} else if (value.logo.url!==undefined) {
|
||||
logo.removeAttr('href');logo.removeAttr('target');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Helpers
|
||||
// -------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue