Merge pull request #2123 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2022-12-09 10:43:05 +03:00 committed by GitHub
commit e88f1dfa8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 6 deletions

View file

@ -710,8 +710,8 @@ define([
this.options.updateFormControl.call(this, this._selectedItem); this.options.updateFormControl.call(this, this._selectedItem);
}, },
setValue: function(value) { setValue: function(value, defValue) {
Common.UI.ComboBox.prototype.setValue.call(this, value); Common.UI.ComboBox.prototype.setValue.call(this, value, defValue);
if (this.options.updateFormControl) if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem); this.options.updateFormControl.call(this, this._selectedItem);
}, },

View file

@ -86,6 +86,7 @@ define([
this.setApi(api); this.setApi(api);
}, },
setApi: function (api) { setApi: function (api) {
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
if (api) { if (api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onChangeDocumentProtection',_.bind(this.onChangeProtectDocument, this)); this.api.asc_registerCallback('asc_onChangeDocumentProtection',_.bind(this.onChangeProtectDocument, this));
@ -95,6 +96,7 @@ define([
setMode: function(mode) { setMode: function(mode) {
this.appConfig = mode; this.appConfig = mode;
this.currentUserId = mode.user.id;
this.appConfig.isEdit && (this.view = this.createView('DocProtection', { this.appConfig.isEdit && (this.view = this.createView('DocProtection', {
mode: mode mode: mode
@ -183,7 +185,7 @@ define([
}); });
}, },
onChangeProtectDocument: function() { onChangeProtectDocument: function(userId) {
var props = this.getDocProps(true), var props = this.getDocProps(true),
isProtected = props && (props.isReadOnly || props.isCommentsOnly || props.isFormsOnly || props.isReviewOnly); isProtected = props && (props.isReadOnly || props.isCommentsOnly || props.isFormsOnly || props.isReviewOnly);
this.view && this.view.btnProtectDoc.toggle(isProtected, true); this.view && this.view.btnProtectDoc.toggle(isProtected, true);
@ -204,6 +206,27 @@ define([
if (this._docProtectDlg && this._docProtectDlg.isVisible()) if (this._docProtectDlg && this._docProtectDlg.isVisible())
this._docProtectDlg.SetDisabled(!!this._state.lockDocProtect || isProtected); this._docProtectDlg.SetDisabled(!!this._state.lockDocProtect || isProtected);
Common.NotificationCenter.trigger('protect:doclock', props); Common.NotificationCenter.trigger('protect:doclock', props);
if (userId && this.userCollection) {
var recUser = this.userCollection.findOriginalUser(userId);
if (recUser && (recUser.get('idOriginal') !== this.currentUserId)) {
var str = this.view.txtWasUnprotected;
switch (this._state.docProtection.type) {
case Asc.c_oAscEDocProtect.ReadOnly:
str = this.view.txtWasProtectedView;
break;
case Asc.c_oAscEDocProtect.Comments:
str = this.view.txtWasProtectedComment;
break;
case Asc.c_oAscEDocProtect.Forms:
str = this.view.txtWasProtectedForms;
break;
case Asc.c_oAscEDocProtect.TrackedChanges:
str = this.view.txtWasProtectedTrack;
break;
}
str && Common.NotificationCenter.trigger('showmessage', {msg: str}, {timeout: 5000, hideCloseTip: true});
}
}
}, },
getDocProps: function(update) { getDocProps: function(update) {

View file

@ -142,7 +142,12 @@ define([
txtDocProtectedForms: 'Document is protected.<br>You may only fill in forms in this document.', txtDocProtectedForms: 'Document is protected.<br>You may only fill in forms in this document.',
hintProtectDoc: 'Protect document', hintProtectDoc: 'Protect document',
txtDocUnlockDescription: 'Enter a password to unprotect document', txtDocUnlockDescription: 'Enter a password to unprotect document',
txtUnlockTitle: 'Unprotect Document' txtUnlockTitle: 'Unprotect Document',
txtWasProtectedView: 'Document has been protected by another user.\nYou may only view this document.',
txtWasProtectedTrack: 'Document has been protected by another user.\nYou may edit this document, but all changes will be tracked.',
txtWasProtectedComment: 'Document has been protected by another user.\nYou may only insert comments to this document.',
txtWasProtectedForms: 'Document has been protected by another user.\nYou may only fill in forms in this document.',
txtWasUnprotected: 'Document has been unprotected.'
} }
}()), DE.Views.DocProtection || {})); }()), DE.Views.DocProtection || {}));
}); });

View file

@ -1634,6 +1634,11 @@
"DE.Views.DocProtection.txtDocUnlockDescription": "Enter a password to unprotect document", "DE.Views.DocProtection.txtDocUnlockDescription": "Enter a password to unprotect document",
"DE.Views.DocProtection.txtUnlockTitle": "Unprotect Document", "DE.Views.DocProtection.txtUnlockTitle": "Unprotect Document",
"DE.Views.DocProtection.txtProtectDoc": "Protect Document", "DE.Views.DocProtection.txtProtectDoc": "Protect Document",
"DE.Views.DocProtection.txtWasProtectedView": "Document has been protected by another user.\nYou may only view this document.",
"DE.Views.DocProtection.txtWasProtectedTrack": "Document has been protected by another user.\nYou may edit this document, but all changes will be tracked.",
"DE.Views.DocProtection.txtWasProtectedComment": "Document has been protected by another user.\nYou may only insert comments to this document.",
"DE.Views.DocProtection.txtWasProtectedForms": "Document has been protected by another user.\nYou may only fill in forms in this document.",
"DE.Views.DocProtection.txtWasUnprotected": "Document has been unprotected.",
"DE.Views.DocumentHolder.aboveText": "Above", "DE.Views.DocumentHolder.aboveText": "Above",
"DE.Views.DocumentHolder.addCommentText": "Add comment", "DE.Views.DocumentHolder.addCommentText": "Add comment",
"DE.Views.DocumentHolder.advancedDropCapText": "Drop Cap Settings", "DE.Views.DocumentHolder.advancedDropCapText": "Drop Cap Settings",

View file

@ -187,6 +187,7 @@ define([
this.toolbar = options.toolbar; this.toolbar = options.toolbar;
this.appConfig = options.mode; this.appConfig = options.mode;
this.$el = this.toolbar.toolbar.$el.find('#animation-panel'); this.$el = this.toolbar.toolbar.$el.find('#animation-panel');
var me = this;
var _set = Common.enumLock; var _set = Common.enumLock;
this.lockedControls = []; this.lockedControls = [];
this._arrEffectName = [{group:'none', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'animation-none', displayValue: this.textNone}].concat(Common.define.effectData.getEffectData()); this._arrEffectName = [{group:'none', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'animation-none', displayValue: this.textNone}].concat(Common.define.effectData.getEffectData());
@ -293,7 +294,7 @@ define([
this.lockedControls.push(this.btnAddAnimation); this.lockedControls.push(this.btnAddAnimation);
this.cmbDuration = new Common.UI.ComboBox({ this.cmbDuration = new Common.UI.ComboBoxCustom({
el: this.$el.find('#animation-spin-duration'), el: this.$el.find('#animation-spin-duration'),
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 100%;', menuStyle: 'min-width: 100%;',
@ -309,7 +310,10 @@ define([
lock: [_set.slideDeleted, _set.noSlides, _set.noGraphic, _set.noAnimation, _set.noAnimationDuration, _set.timingLock], lock: [_set.slideDeleted, _set.noSlides, _set.noGraphic, _set.noAnimation, _set.noAnimationDuration, _set.timingLock],
dataHint: '1', dataHint: '1',
dataHintDirection: 'top', dataHintDirection: 'top',
dataHintOffset: 'small' dataHintOffset: 'small',
updateFormControl: function(record) {
record && this.setRawValue(record.get('value') + ' ' + me.txtSec);
}
}); });
this.lockedControls.push(this.cmbDuration); this.lockedControls.push(this.cmbDuration);