[DE mobile] Change applying the license (disable editing when connections are over the limitations).
This commit is contained in:
parent
82be952126
commit
20cc14ae5c
|
@ -237,6 +237,7 @@ define([
|
|||
}
|
||||
|
||||
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
|
||||
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
|
||||
this.api.asc_setDocInfo(docInfo);
|
||||
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
||||
|
||||
|
@ -551,10 +552,26 @@ define([
|
|||
me.api.zoomFitToWidth();
|
||||
}
|
||||
|
||||
DE.getController('Toolbar').activateControls();
|
||||
me.applyLicense();
|
||||
},
|
||||
|
||||
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._state.licenseWarning)
|
||||
this.applyLicense();
|
||||
},
|
||||
|
||||
applyLicense: function() {
|
||||
var me = this;
|
||||
if (me._state.licenseWarning) {
|
||||
value = Common.localStorage.getItem("de-license-warning");
|
||||
DE.getController('Toolbar').deactivateControls();
|
||||
Common.NotificationCenter.trigger('api:disconnect');
|
||||
|
||||
var value = Common.localStorage.getItem("de-license-warning");
|
||||
value = (value!==null) ? parseInt(value) : 0;
|
||||
var now = (new Date).getTime();
|
||||
|
||||
|
@ -577,10 +594,11 @@ define([
|
|||
window.open('mailto:sales@onlyoffice.com', "_blank");
|
||||
}
|
||||
}
|
||||
],
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
} else
|
||||
DE.getController('Toolbar').activateControls();
|
||||
},
|
||||
|
||||
onOpenDocument: function(progress) {
|
||||
|
@ -638,8 +656,6 @@ define([
|
|||
me.appOptions.canDownload = me.permissions.download !== false && (!type || typeof type[1] !== 'string');
|
||||
me.appOptions.canReader = (!type || typeof type[1] !== 'string');
|
||||
|
||||
me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
|
||||
|
||||
me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object');
|
||||
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
|
||||
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
|
||||
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
},
|
||||
|
||||
setMode: function (mode) {
|
||||
|
@ -138,6 +139,8 @@ define([
|
|||
// API handlers
|
||||
|
||||
onApiCanRevert: function(which, can) {
|
||||
if (this.isDisconnected) return;
|
||||
|
||||
if (which == 'undo') {
|
||||
$('#toolbar-undo').toggleClass('disabled', !can);
|
||||
} else {
|
||||
|
@ -146,6 +149,8 @@ define([
|
|||
},
|
||||
|
||||
onApiFocusObject: function (objects) {
|
||||
if (this.isDisconnected) return;
|
||||
|
||||
if (objects.length > 0) {
|
||||
var topObject = _.find(objects.reverse(), function (obj) {
|
||||
return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck;
|
||||
|
@ -161,6 +166,14 @@ define([
|
|||
$('#toolbar-edit, #toolbar-add, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
|
||||
},
|
||||
|
||||
deactivateControls: function() {
|
||||
$('#toolbar-edit, #toolbar-add, #toolbar-settings, #toolbar-search, #document-back').addClass('disabled');
|
||||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.isDisconnected = true;
|
||||
},
|
||||
|
||||
dlgLeaveTitleText : 'You leave the application',
|
||||
dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||
leaveButtonText : 'Leave this Page',
|
||||
|
|
Loading…
Reference in a new issue