[PE] Change applying the license (disable editing when connections are over the limitations).
This commit is contained in:
parent
20cc14ae5c
commit
620c4ab5c2
|
@ -319,6 +319,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
|
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_setDocInfo(docInfo);
|
||||||
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
||||||
|
|
||||||
|
@ -695,6 +696,8 @@ define([
|
||||||
|
|
||||||
if (me.appOptions.canBrandingExt)
|
if (me.appOptions.canBrandingExt)
|
||||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||||
|
|
||||||
|
me.applyLicense();
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
} else {
|
} else {
|
||||||
|
@ -715,9 +718,24 @@ define([
|
||||||
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
|
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
|
||||||
|
|
||||||
$(document).on('contextmenu', _.bind(me.onContextMenu, me));
|
$(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) {
|
if (this._state.licenseWarning) {
|
||||||
value = Common.localStorage.getItem("pe-license-warning");
|
this.disableEditing(true);
|
||||||
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
|
|
||||||
|
var value = Common.localStorage.getItem("pe-license-warning");
|
||||||
value = (value!==null) ? parseInt(value) : 0;
|
value = (value!==null) ? parseInt(value) : 0;
|
||||||
var now = (new Date).getTime();
|
var now = (new Date).getTime();
|
||||||
if (now - value > 86400000) {
|
if (now - value > 86400000) {
|
||||||
|
@ -725,7 +743,7 @@ define([
|
||||||
Common.UI.info({
|
Common.UI.info({
|
||||||
width: 500,
|
width: 500,
|
||||||
title: this.textNoLicenseTitle,
|
title: this.textNoLicenseTitle,
|
||||||
msg : this.warnNoLicense,
|
msg : this._state.licenseWarning,
|
||||||
buttons: [
|
buttons: [
|
||||||
{value: 'buynow', caption: this.textBuyNow},
|
{value: 'buynow', caption: this.textBuyNow},
|
||||||
{value: 'contact', caption: this.textContactUs}
|
{value: 'contact', caption: this.textContactUs}
|
||||||
|
@ -742,6 +760,15 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableEditing: function(disable) {
|
||||||
|
var app = this.getApplication();
|
||||||
|
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
||||||
|
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||||
|
app.getController('Toolbar').DisableToolbar(disable);
|
||||||
|
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onOpenDocument: function(progress) {
|
onOpenDocument: function(progress) {
|
||||||
var elem = document.getElementById('loadmask-text');
|
var elem = document.getElementById('loadmask-text');
|
||||||
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
|
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
|
||||||
|
@ -788,8 +815,6 @@ define([
|
||||||
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
|
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
|
||||||
this.appOptions.trialMode = params.asc_getLicenseMode();
|
this.appOptions.trialMode = params.asc_getLicenseMode();
|
||||||
|
|
||||||
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
|
|
||||||
|
|
||||||
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
|
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
|
||||||
if (this.appOptions.canBranding)
|
if (this.appOptions.canBranding)
|
||||||
appHeader.setBranding(this.editorConfig.customization);
|
appHeader.setBranding(this.editorConfig.customization);
|
||||||
|
@ -1910,7 +1935,8 @@ define([
|
||||||
textChangesSaved: 'All changes saved',
|
textChangesSaved: 'All changes saved',
|
||||||
saveTitleText: 'Saving Document',
|
saveTitleText: 'Saving Document',
|
||||||
saveTextText: 'Saving document...',
|
saveTextText: 'Saving document...',
|
||||||
txtLoading: 'Loading...'
|
txtLoading: 'Loading...',
|
||||||
|
warnNoLicenseUsers: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -217,6 +217,7 @@ define([
|
||||||
var onContextMenu = function(event){
|
var onContextMenu = function(event){
|
||||||
_.delay(function(){
|
_.delay(function(){
|
||||||
if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) {
|
if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) {
|
||||||
|
if (me.mode.isEdit)
|
||||||
showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
|
showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
|
||||||
} else {
|
} else {
|
||||||
showObjectMenu.call(me, event);
|
showObjectMenu.call(me, event);
|
||||||
|
|
|
@ -303,6 +303,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
|
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
|
||||||
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
|
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
|
||||||
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
|
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
|
||||||
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -344,7 +345,7 @@ define([
|
||||||
this.langMenu.doLayout();
|
this.langMenu.doLayout();
|
||||||
if (this.langMenu.items.length>0) {
|
if (this.langMenu.items.length>0) {
|
||||||
this.btnLanguage.setDisabled(false || this._state.no_paragraph);
|
this.btnLanguage.setDisabled(false || this._state.no_paragraph);
|
||||||
this.btnDocLanguage.setDisabled(false);
|
this.btnDocLanguage.setDisabled(!!this.mode.isDisconnected);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -388,6 +389,11 @@ define([
|
||||||
this.btnLanguage.setDisabled(this._state.no_paragraph);
|
this.btnLanguage.setDisabled(this._state.no_paragraph);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onApiCoAuthoringDisconnect: function() {
|
||||||
|
this.setMode({isDisconnected:true});
|
||||||
|
this.SetDisabled(true);
|
||||||
|
},
|
||||||
|
|
||||||
pageIndexText : 'Slide {0} of {1}',
|
pageIndexText : 'Slide {0} of {1}',
|
||||||
goToPageText : 'Go to Slide',
|
goToPageText : 'Go to Slide',
|
||||||
tipFitPage : 'Fit to Slide',
|
tipFitPage : 'Fit to Slide',
|
||||||
|
|
Loading…
Reference in a new issue