Merge pull request #555 from ONLYOFFICE/fix/license-mode

Add limited license
This commit is contained in:
Julia Radzhabova 2020-11-09 14:57:36 +03:00 committed by GitHub
commit ee25374d11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 239 additions and 65 deletions

View file

@ -1087,6 +1087,8 @@ define([
} else {
documentHolderController.getView().createDelayedElementsViewer();
Common.NotificationCenter.trigger('document:ready', 'main');
if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
me.applyLicense();
}
// TODO bug 43960
@ -1116,7 +1118,8 @@ define([
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS))
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited))
this._state.licenseType = licType;
if (this._isDocReady)
@ -1124,11 +1127,14 @@ define([
},
applyLicense: function() {
if (this._state.licenseType) {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
var license = this._state.licenseType,
buttons = ['ok'],
primary = 'ok';
if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
(license===Asc.c_oLicenseResult.ExpiredLimited) && this.getApplication().getController('LeftMenu').leftMenu.setLimitMode();// show limited hint
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
@ -1136,15 +1142,17 @@ define([
primary = 'buynow';
}
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
if (this._state.licenseType && this.appOptions.isEdit) {
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
}
var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
Common.UI.info({
width: 500,
maxwidth: 500,
title: this.textNoLicenseTitle,
msg : license,
buttons: buttons,
@ -2687,7 +2695,9 @@ define([
txtEnterDate: 'Enter a date.',
txtTypeEquation: 'Type equation here.',
textHasMacros: 'The file contains automatic macros.<br>Do you want to run macros?',
textRemember: 'Remember my choice'
textRemember: 'Remember my choice',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
}
})(), DE.Controllers.Main || {}))
});

View file

@ -340,7 +340,7 @@ define([
SetDisabled: function(disabled, allowMerge, allowSignature) {
this.setMode({isEdit: !disabled});
if (this.rightmenu) {
if (this.rightmenu && this.rightmenu.paragraphSettings) {
this.rightmenu.paragraphSettings.disableControls(disabled);
this.rightmenu.shapeSettings.disableControls(disabled);
this.rightmenu.textartSettings.disableControls(disabled);

View file

@ -384,12 +384,41 @@ define([
setDeveloperMode: function(mode) {
if ( !this.$el.is(':visible') ) return;
if (!this.developerHint) {
this.developerHint = $('<div id="developer-hint">' + ((mode == Asc.c_oLicenseMode.Trial) ? this.txtTrial.toLocaleUpperCase() : this.txtDeveloper.toLocaleUpperCase()) + '</div>').appendTo(this.$el);
this.devHeight = this.developerHint.outerHeight();
$(window).on('resize', _.bind(this.onWindowResize, this));
if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) {
if (!this.developerHint) {
var str = '';
if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer))
str = this.txtTrialDev;
else if ((mode & Asc.c_oLicenseMode.Trial)!==0)
str = this.txtTrial;
else if ((mode & Asc.c_oLicenseMode.Developer)!==0)
str = this.txtDeveloper;
str = str.toUpperCase();
this.developerHint = $('<div id="developer-hint">' + str + '</div>').appendTo(this.$el);
this.devHeight = this.developerHint.outerHeight();
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
this.devHintInited = true;
}
}
this.developerHint.toggleClass('hidden', !mode);
this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)));
var btns = this.$el.find('button.btn-category:visible'),
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20;
this.onWindowResize();
},
setLimitMode: function() {
if ( !this.$el.is(':visible') ) return;
if (!this.limitHint) {
var str = this.txtLimit.toUpperCase();
this.limitHint = $('<div id="limit-hint" style="margin-top: 4px;">' + str + '</div>').appendTo(this.$el);
this.limitHeight = this.limitHint.outerHeight();
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
this.devHintInited = true;
}
this.limitHint && this.limitHint.toggleClass('hidden', false);
var btns = this.$el.find('button.btn-category:visible'),
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
@ -398,7 +427,13 @@ define([
},
onWindowResize: function() {
this.developerHint.css('top', Math.max((this.$el.height()-this.devHeight)/2, this.minDevPosition));
var height = (this.devHeight || 0) + (this.limitHeight || 0);
var top = Math.max((this.$el.height()-height)/2, this.minDevPosition);
if (this.developerHint) {
this.developerHint.css('top', top);
top += this.devHeight;
}
this.limitHint && this.limitHint.css('top', top);
},
/** coauthoring begin **/
tipComments : 'Comments',
@ -410,6 +445,8 @@ define([
tipPlugins : 'Plugins',
txtDeveloper: 'DEVELOPER MODE',
txtTrial: 'TRIAL MODE',
tipNavigation: 'Navigation'
txtTrialDev: 'Trial Developer Mode',
tipNavigation: 'Navigation',
txtLimit: 'Limit Access'
}, DE.Views.LeftMenu || {}));
});

View file

@ -771,6 +771,8 @@
"DE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"DE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"DE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"DE.Controllers.Navigation.txtBeginning": "Beginning of document",
"DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document",
"DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked",
@ -1789,6 +1791,8 @@
"DE.Views.LeftMenu.tipTitles": "Titles",
"DE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE",
"DE.Views.LeftMenu.txtTrial": "TRIAL MODE",
"DE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode",
"DE.Views.LeftMenu.txtLimit": "Limit Access",
"DE.Views.LineNumbersDialog.textAddLineNumbering": "Add line numbering",
"DE.Views.LineNumbersDialog.textApplyTo": "Apply changes to",
"DE.Views.LineNumbersDialog.textContinuous": "Continuous",

View file

@ -51,13 +51,13 @@
overflow: hidden;
}
#developer-hint {
#developer-hint, #limit-hint {
position: absolute;
left: 0;
padding: 12px 0;
background-color: #ffb400;
color: #6e4e00 !important;
white-space: nowrap;
white-space: pre;
line-height: 20px;
writing-mode: tb-rl;
-moz-transform: rotate(180deg);

View file

@ -658,7 +658,8 @@ define([
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS))
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited))
this._state.licenseType = licType;
if (this._isDocReady && this._state.licenseType)
@ -683,10 +684,12 @@ define([
return;
}
if (this._state.licenseType) {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
var license = this._state.licenseType,
buttons = [{text: 'OK'}];
if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
@ -752,7 +755,6 @@ define([
onEditorPermissions: function(params) {
var me = this,
licType = params.asc_getLicenseType();
if (Asc.c_oLicenseResult.Expired === licType ||
Asc.c_oLicenseResult.Error === licType ||
Asc.c_oLicenseResult.ExpiredTrial === licType) {
@ -795,6 +797,7 @@ define([
me.appOptions.fileKey = me.document.key;
me.appOptions.canFillForms = ((me.permissions.fillForms===undefined) ? me.appOptions.isEdit : me.permissions.fillForms) && (me.editorConfig.mode !== 'view');
me.appOptions.isRestrictedEdit = !me.appOptions.isEdit && me.appOptions.canFillForms;
me.appOptions.trialMode = params.asc_getLicenseMode();
var type = /^(?:(pdf|djvu|xps))$/.exec(me.document.fileType);
me.appOptions.canDownloadOrigin = me.permissions.download !== false && (type && typeof type[1] === 'string');
@ -1588,7 +1591,9 @@ define([
textNo: 'No',
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.',
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.'
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
}
})(), DE.Controllers.Main || {}))
});

View file

@ -296,6 +296,8 @@
"DE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"DE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"DE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"DE.Controllers.Search.textNoTextFound": "Text not Found",
"DE.Controllers.Search.textReplaceAll": "Replace All",
"DE.Controllers.Settings.notcriticalErrorTitle": "Warning",

View file

@ -815,6 +815,8 @@ define([
} else {
documentHolderController.getView('DocumentHolder').createDelayedElementsViewer();
Common.NotificationCenter.trigger('document:ready', 'main');
if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
me.applyLicense();
}
// TODO bug 43960
@ -842,7 +844,8 @@ define([
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS))
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited))
this._state.licenseType = licType;
if (this._isDocReady)
@ -850,11 +853,14 @@ define([
},
applyLicense: function() {
if (this._state.licenseType) {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
var license = this._state.licenseType,
buttons = ['ok'],
primary = 'ok';
if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
(license===Asc.c_oLicenseResult.ExpiredLimited) && this.getApplication().getController('LeftMenu').leftMenu.setLimitMode();// show limited hint
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
@ -862,15 +868,17 @@ define([
primary = 'buynow';
}
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
if (this._state.licenseType && this.appOptions.isEdit) {
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
}
var value = Common.localStorage.getItem("pe-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
Common.UI.info({
width: 500,
maxwidth: 500,
title: this.textNoLicenseTitle,
msg : license,
buttons: buttons,
@ -2319,7 +2327,9 @@ define([
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
textHasMacros: 'The file contains automatic macros.<br>Do you want to run macros?',
textRemember: 'Remember my choice'
textRemember: 'Remember my choice',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
}
})(), PE.Controllers.Main || {}))
});

View file

@ -215,7 +215,7 @@ define([
SetDisabled: function(disabled, allowSignature) {
this.setMode({isEdit: !disabled});
if (this.rightmenu) {
if (this.rightmenu && this.rightmenu.paragraphSettings) {
this.rightmenu.slideSettings.SetSlideDisabled(disabled, disabled, disabled, disabled);
this.rightmenu.paragraphSettings.disableControls(disabled);
this.rightmenu.shapeSettings.disableControls(disabled);

View file

@ -362,12 +362,41 @@ define([
setDeveloperMode: function(mode) {
if ( !this.$el.is(':visible') ) return;
if (!this.developerHint) {
this.developerHint = $('<div id="developer-hint">' + ((mode == Asc.c_oLicenseMode.Trial) ? this.txtTrial.toLocaleUpperCase() : this.txtDeveloper.toLocaleUpperCase()) + '</div>').appendTo(this.$el);
this.devHeight = this.developerHint.outerHeight();
$(window).on('resize', _.bind(this.onWindowResize, this));
if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) {
if (!this.developerHint) {
var str = '';
if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer))
str = this.txtTrialDev;
else if ((mode & Asc.c_oLicenseMode.Trial)!==0)
str = this.txtTrial;
else if ((mode & Asc.c_oLicenseMode.Developer)!==0)
str = this.txtDeveloper;
str = str.toUpperCase();
this.developerHint = $('<div id="developer-hint">' + str + '</div>').appendTo(this.$el);
this.devHeight = this.developerHint.outerHeight();
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
this.devHintInited = true;
}
}
this.developerHint.toggleClass('hidden', !mode);
this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)));
var btns = this.$el.find('button.btn-category:visible'),
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20;
this.onWindowResize();
},
setLimitMode: function() {
if ( !this.$el.is(':visible') ) return;
if (!this.limitHint) {
var str = this.txtLimit.toUpperCase();
this.limitHint = $('<div id="limit-hint" style="margin-top: 4px;">' + str + '</div>').appendTo(this.$el);
this.limitHeight = this.limitHint.outerHeight();
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
this.devHintInited = true;
}
this.limitHint && this.limitHint.toggleClass('hidden', false);
var btns = this.$el.find('button.btn-category:visible'),
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
@ -376,7 +405,13 @@ define([
},
onWindowResize: function() {
this.developerHint.css('top', Math.max((this.$el.height()-this.devHeight)/2, this.minDevPosition));
var height = (this.devHeight || 0) + (this.limitHeight || 0);
var top = Math.max((this.$el.height()-height)/2, this.minDevPosition);
if (this.developerHint) {
this.developerHint.css('top', top);
top += this.devHeight;
}
this.limitHint && this.limitHint.css('top', top);
},
/** coauthoring begin **/
@ -389,6 +424,8 @@ define([
tipSlides: 'Slides',
tipPlugins : 'Plugins',
txtDeveloper: 'DEVELOPER MODE',
txtTrial: 'TRIAL MODE'
txtTrial: 'TRIAL MODE',
txtTrialDev: 'Trial Developer Mode',
txtLimit: 'Limit Access'
}, PE.Views.LeftMenu || {}));
});

View file

@ -650,6 +650,8 @@
"PE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"PE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"PE.Controllers.Statusbar.zoomText": "Zoom {0}%",
"PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",
"PE.Controllers.Toolbar.textAccent": "Accents",
@ -1376,6 +1378,8 @@
"PE.Views.LeftMenu.tipTitles": "Titles",
"PE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE",
"PE.Views.LeftMenu.txtTrial": "TRIAL MODE",
"PE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode",
"PE.Views.LeftMenu.txtLimit": "Limit Access",
"PE.Views.ParagraphSettings.strLineHeight": "Line Spacing",
"PE.Views.ParagraphSettings.strParagraphSpacing": "Paragraph Spacing",
"PE.Views.ParagraphSettings.strSpacingAfter": "After",

View file

@ -485,13 +485,13 @@
}
}
#developer-hint {
#developer-hint, #limit-hint {
position: absolute;
left: 0;
padding: 12px 0;
background-color: #ffb400;
color: #6e4e00 !important;
white-space: nowrap;
white-space: pre;
line-height: @app-header-height;
writing-mode: tb-rl;
-moz-transform: rotate(180deg);

View file

@ -588,7 +588,8 @@ define([
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS))
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited))
this._state.licenseType = licType;
if (this._isDocReady && this._state.licenseType)
@ -613,10 +614,12 @@ define([
return;
}
if (this._state.licenseType) {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
var license = this._state.licenseType,
buttons = [{text: 'OK'}];
if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
@ -722,6 +725,7 @@ define([
me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false);
me.appOptions.canEditStyles = me.appOptions.canLicense && me.appOptions.canEdit;
me.appOptions.canPrint = (me.permissions.print !== false);
me.appOptions.trialMode = params.asc_getLicenseMode();
var type = /^(?:(pdf|djvu|xps))$/.exec(me.document.fileType);
me.appOptions.canDownloadOrigin = me.permissions.download !== false && (type && typeof type[1] === 'string');
@ -1525,7 +1529,9 @@ define([
textNo: 'No',
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.',
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.'
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
}
})(), PE.Controllers.Main || {}))
});

View file

@ -264,6 +264,8 @@
"PE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"PE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"PE.Controllers.Search.textNoTextFound": "Text not Found",
"PE.Controllers.Search.textReplaceAll": "Replace All",
"PE.Controllers.Settings.notcriticalErrorTitle": "Warning",

View file

@ -866,6 +866,8 @@ define([
} else {
documentHolderView.createDelayedElementsViewer();
Common.NotificationCenter.trigger('document:ready', 'main');
if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
me.applyLicense();
}
// TODO bug 43960
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
@ -909,7 +911,8 @@ define([
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS))
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited))
this._state.licenseType = licType;
if (this._isDocReady)
@ -917,11 +920,14 @@ define([
},
applyLicense: function() {
if (this._state.licenseType) {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
var license = this._state.licenseType,
buttons = ['ok'],
primary = 'ok';
if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
(license===Asc.c_oLicenseResult.ExpiredLimited) && this.getApplication().getController('LeftMenu').leftMenu.setLimitMode();// show limited hint
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
@ -929,15 +935,17 @@ define([
primary = 'buynow';
}
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
if (this._state.licenseType && this.appOptions.isEdit) {
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
}
var value = Common.localStorage.getItem("sse-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
Common.UI.info({
width: 500,
maxwidth: 500,
title: this.textNoLicenseTitle,
msg : license,
buttons: buttons,
@ -983,7 +991,6 @@ define([
onEditorPermissions: function(params) {
var licType = params ? params.asc_getLicenseType() : Asc.c_oLicenseResult.Error;
if ( params && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge)) {
if (Asc.c_oLicenseResult.Expired === licType || Asc.c_oLicenseResult.Error === licType || Asc.c_oLicenseResult.ExpiredTrial === licType) {
Common.UI.warning({
@ -2671,7 +2678,9 @@ define([
errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.',
errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,<br>cell references, and/or names.',
errorMoveSlicerError: 'Table slicers cannot be copied from one workbook to another.<br>Try again by selecting the entire table and the slicers.',
errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.'
errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -352,12 +352,41 @@ define([
setDeveloperMode: function(mode) {
if ( !this.$el.is(':visible') ) return;
if (!this.developerHint) {
this.developerHint = $('<div id="developer-hint">' + ((mode == Asc.c_oLicenseMode.Trial) ? this.txtTrial.toLocaleUpperCase() : this.txtDeveloper.toLocaleUpperCase()) + '</div>').appendTo(this.$el);
this.devHeight = this.developerHint.outerHeight();
$(window).on('resize', _.bind(this.onWindowResize, this));
if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) {
if (!this.developerHint) {
var str = '';
if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer))
str = this.txtTrialDev;
else if ((mode & Asc.c_oLicenseMode.Trial)!==0)
str = this.txtTrial;
else if ((mode & Asc.c_oLicenseMode.Developer)!==0)
str = this.txtDeveloper;
str = str.toUpperCase();
this.developerHint = $('<div id="developer-hint">' + str + '</div>').appendTo(this.$el);
this.devHeight = this.developerHint.outerHeight();
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
this.devHintInited = true;
}
}
this.developerHint.toggleClass('hidden', !mode);
this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)));
var btns = this.$el.find('button.btn-category:visible'),
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20;
this.onWindowResize();
},
setLimitMode: function() {
if ( !this.$el.is(':visible') ) return;
if (!this.limitHint) {
var str = this.txtLimit.toUpperCase();
this.limitHint = $('<div id="limit-hint" style="margin-top: 4px;">' + str + '</div>').appendTo(this.$el);
this.limitHeight = this.limitHint.outerHeight();
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
this.devHintInited = true;
}
this.limitHint && this.limitHint.toggleClass('hidden', false);
var btns = this.$el.find('button.btn-category:visible'),
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
@ -366,7 +395,13 @@ define([
},
onWindowResize: function() {
this.developerHint.css('top', Math.max((this.$el.height()-this.devHeight)/2, this.minDevPosition));
var height = (this.devHeight || 0) + (this.limitHeight || 0);
var top = Math.max((this.$el.height()-height)/2, this.minDevPosition);
if (this.developerHint) {
this.developerHint.css('top', top);
top += this.devHeight;
}
this.limitHint && this.limitHint.css('top', top);
},
/** coauthoring begin **/
@ -380,6 +415,8 @@ define([
tipPlugins : 'Plugins',
txtDeveloper: 'DEVELOPER MODE',
txtTrial: 'TRIAL MODE',
tipSpellcheck: 'Spell checking'
tipSpellcheck: 'Spell checking',
txtTrialDev: 'Trial Developer Mode',
txtLimit: 'Limit Access'
}, SSE.Views.LeftMenu || {}));
});

View file

@ -853,6 +853,8 @@
"SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"SSE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textFirstCol": "First column",
"SSE.Controllers.Print.textFirstRow": "First row",
@ -1979,6 +1981,8 @@
"SSE.Views.LeftMenu.tipSupport": "Feedback & Support",
"SSE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE",
"SSE.Views.LeftMenu.txtTrial": "TRIAL MODE",
"SSE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode",
"SSE.Views.LeftMenu.txtLimit": "Limit Access",
"SSE.Views.MainSettingsPrint.okButtonText": "Save",
"SSE.Views.MainSettingsPrint.strBottom": "Bottom",
"SSE.Views.MainSettingsPrint.strLandscape": "Landscape",

View file

@ -549,13 +549,13 @@
}
}
#developer-hint {
#developer-hint, #limit-hint {
position: absolute;
left: 0;
padding: 12px 0;
background-color: #ffb400;
color: #6e4e00 !important;
white-space: nowrap;
white-space: pre;
line-height: @app-header-height;
writing-mode: tb-rl;
-moz-transform: rotate(180deg);

View file

@ -614,7 +614,8 @@ define([
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS))
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited))
this._state.licenseType = licType;
if (this._isDocReady && this._state.licenseType)
@ -638,10 +639,12 @@ define([
SSE.getController('Toolbar').activateControls();
return;
}
if (this._state.licenseType) {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
var license = this._state.licenseType,
buttons = [{text: 'OK'}];
if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
@ -707,7 +710,6 @@ define([
onEditorPermissions: function(params) {
var me = this,
licType = params ? params.asc_getLicenseType() : Asc.c_oLicenseResult.Error;
if (params && !(me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge)) {
if (Asc.c_oLicenseResult.Expired === licType ||
Asc.c_oLicenseResult.Error === licType ||
@ -739,6 +741,7 @@ define([
me.appOptions.canViewComments = me.appOptions.canComments || !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.comments===false);
me.appOptions.canEditComments = me.appOptions.isOffline || !(typeof (me.editorConfig.customization) == 'object' && me.editorConfig.customization.commentAuthorOnly);
me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false);
me.appOptions.trialMode = params.asc_getLicenseMode();
me.appOptions.canBranding = params.asc_getCustomization();
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
@ -1743,7 +1746,9 @@ define([
textYes: 'Yes',
textNo: 'No',
errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.',
errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,<br>cell references, and/or names.'
errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,<br>cell references, and/or names.',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -326,6 +326,8 @@
"SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"SSE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"SSE.Controllers.Search.textNoTextFound": "Text not found",
"SSE.Controllers.Search.textReplaceAll": "Replace All",
"SSE.Controllers.Settings.notcriticalErrorTitle": "Warning",