Merge pull request #1494 from ONLYOFFICE/fix/for-hotfix

Fix/for hotfix
This commit is contained in:
Julia Radzhabova 2022-01-19 14:38:25 +03:00 committed by GitHub
commit c4ea47a9e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 17 deletions

View file

@ -505,6 +505,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_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, 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);
this.api.asc_enableKeyEvents(true); this.api.asc_enableKeyEvents(true);
@ -642,6 +643,17 @@ define([
}); });
}, },
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canFillForms &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType;
if (this._isDocReady)
this.applyLicense();
},
applyLicense: function() { applyLicense: function() {
if (this._state.licenseType) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
@ -658,6 +670,10 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.canFillForms) {
this.disableEditing(true);
}
var value = Common.localStorage.getItem("de-license-warning"); var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
@ -986,6 +1002,8 @@ define([
}, },
onShowContentControlsActions: function(obj, x, y) { onShowContentControlsActions: function(obj, x, y) {
if (this._isDisabled) return;
var me = this; var me = this;
switch (obj.type) { switch (obj.type) {
case Asc.c_oAscContentControlSpecificType.DateTime: case Asc.c_oAscContentControlSpecificType.DateTime:
@ -1718,12 +1736,12 @@ define([
if (this.textMenu && !noobject) { if (this.textMenu && !noobject) {
var cancopy = this.api.can_CopyCut(), var cancopy = this.api.can_CopyCut(),
disabled = menu_props.paraProps && menu_props.paraProps.locked || menu_props.headerProps && menu_props.headerProps.locked || disabled = menu_props.paraProps && menu_props.paraProps.locked || menu_props.headerProps && menu_props.headerProps.locked ||
menu_props.imgProps && (menu_props.imgProps.locked || menu_props.imgProps.content_locked); menu_props.imgProps && (menu_props.imgProps.locked || menu_props.imgProps.content_locked) || this._isDisabled;
this.textMenu.items[0].setDisabled(disabled || !this.api.asc_getCanUndo()); // undo this.textMenu.items[0].setDisabled(disabled || !this.api.asc_getCanUndo()); // undo
this.textMenu.items[1].setDisabled(disabled || !this.api.asc_getCanRedo()); // redo this.textMenu.items[1].setDisabled(disabled || !this.api.asc_getCanRedo()); // redo
this.textMenu.items[3].setDisabled(!cancopy); // copy this.textMenu.items[3].setDisabled(disabled || !cancopy); // cut
this.textMenu.items[4].setDisabled(disabled || !cancopy); // cut this.textMenu.items[4].setDisabled(!cancopy); // copy
this.textMenu.items[5].setDisabled(disabled) // paste; this.textMenu.items[5].setDisabled(disabled) // paste;
this.showPopupMenu(this.textMenu, {}, event); this.showPopupMenu(this.textMenu, {}, event);
@ -1757,6 +1775,11 @@ define([
} }
}, },
disableEditing: function(state) {
this.view && this.view.btnClear && this.view.btnClear.setDisabled(state);
this._isDisabled = state;
},
errorDefaultMessage : 'Error code: %1', errorDefaultMessage : 'Error code: %1',
unknownErrorText : 'Unknown error.', unknownErrorText : 'Unknown error.',
convertationTimeoutText : 'Conversion timeout exceeded.', convertationTimeoutText : 'Conversion timeout exceeded.',

View file

@ -1274,7 +1274,7 @@ define([
onLicenseChanged: function(params) { onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && 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.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
@ -1300,7 +1300,7 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.isEdit || this.appOptions.isRestrictedEdit)) {
this.disableEditing(true); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
} }

View file

@ -916,7 +916,7 @@ define([
onLicenseChanged: function(params) { onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && 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.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
@ -942,7 +942,7 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.isEdit || this.appOptions.isRestrictedEdit)) {
this.disableEditing(true); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
} }

View file

@ -1017,7 +1017,7 @@ define([
if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return; if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return;
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && 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.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
@ -1043,7 +1043,7 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.isEdit || this.appOptions.isRestrictedEdit)) {
this.disableEditing(true); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
} }

View file

@ -33,7 +33,7 @@ module.exports = function(grunt) {
return !!string && !!iconv_lite ? iconv_lite.encode(string,encoding) : string; return !!string && !!iconv_lite ? iconv_lite.encode(string,encoding) : string;
}; };
var jsreplacements = [ global.jsreplacements = [
{ {
from: /\{\{SUPPORT_EMAIL\}\}/g, from: /\{\{SUPPORT_EMAIL\}\}/g,
to: _encode(process.env.SUPPORT_EMAIL) || 'support@onlyoffice.com' to: _encode(process.env.SUPPORT_EMAIL) || 'support@onlyoffice.com'
@ -355,12 +355,12 @@ module.exports = function(grunt) {
replacements: [{ replacements: [{
from: /\{\{PRODUCT_VERSION\}\}/g, from: /\{\{PRODUCT_VERSION\}\}/g,
to: packageFile.version to: packageFile.version
}] }, ...global.jsreplacements]
}, },
prepareHelp: { prepareHelp: {
src: ['<%= pkg.main.copy.help[0].dest %>/ru/**/*.htm*'], src: ['<%= pkg.main.copy.help[0].dest %>/ru/**/*.htm*'],
overwrite: true, overwrite: true,
replacements: [] replacements: [...helpreplacements]
} }
}, },
@ -427,10 +427,10 @@ module.exports = function(grunt) {
} }
}); });
var replace = grunt.config.get('replace'); // var replace = grunt.config.get('replace');
replace.writeVersion.replacements.push(...jsreplacements); // replace.writeVersion.replacements.push(...global.jsreplacements);
replace.prepareHelp.replacements.push(...helpreplacements); // replace.prepareHelp.replacements.push(...helpreplacements);
grunt.config.set('replace', replace); // grunt.config.set('replace', replace);
}); });
grunt.registerTask('deploy-reporter', function(){ grunt.registerTask('deploy-reporter', function(){

View file

@ -65,6 +65,17 @@ module.exports = (grunt) => {
} }
}, },
replace: {
varsEnviroment: {
src: ['<%= pkg.forms.js.requirejs.options.out %>'],
overwrite: true,
replacements: [{
from: /\{\{PRODUCT_VERSION\}\}/g,
to: packageFile.version
}, ...global.jsreplacements]
},
},
inline: { inline: {
dist: { dist: {
src: packageFile.forms.inline.src src: packageFile.forms.inline.src
@ -76,5 +87,5 @@ module.exports = (grunt) => {
grunt.registerTask('deploy-app-forms', ['forms-app-init', 'clean:prebuild', /*'imagemin',*/ 'less', grunt.registerTask('deploy-app-forms', ['forms-app-init', 'clean:prebuild', /*'imagemin',*/ 'less',
'requirejs', 'concat', 'copy', 'inline', /*'json-minify',*/ 'requirejs', 'concat', 'copy', 'inline', /*'json-minify',*/
/*'replace:writeVersion',*/ /*'replace:prepareHelp',*/ 'clean:postbuild']); 'replace:varsEnviroment', /*'replace:prepareHelp',*/ 'clean:postbuild']);
} }