From 82be9521264d0917bb5ca7fc0c09c37acc2f575f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 22 Nov 2017 16:32:43 +0300 Subject: [PATCH] [DE] Change applying license. --- .../main/app/controller/Main.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f9fabd06c..0101869a9 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -912,6 +912,8 @@ define([ if (me.appOptions.canBrandingExt) Common.NotificationCenter.trigger('document:ready', 'main'); + + me.applyLicense(); } }, 50); } else { @@ -933,12 +935,24 @@ define([ Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); + }, + onLicenseChanged: function(params) { + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady) + this.applyLicense(); + }, + + applyLicense: function() { if (this._state.licenseWarning) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); - value = Common.localStorage.getItem("de-license-warning"); + var value = Common.localStorage.getItem("de-license-warning"); value = (value!==null) ? parseInt(value) : 0; var now = (new Date).getTime(); if (now - value > 86400000) { @@ -963,13 +977,6 @@ define([ } }, - onLicenseChanged: function(params) { - var licType = params.asc_getLicenseType(); - if ((licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { - this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; - } - }, - onOpenDocument: function(progress) { var elem = document.getElementById('loadmask-text'); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());