[SSE] Fix lock for protected ranges

This commit is contained in:
Julia Radzhabova 2021-11-09 12:17:30 +03:00
parent a0808df23c
commit 55cbca2a43

View file

@ -152,6 +152,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
_setDefaults: function (props) {
this.refreshRangeList(props, 0);
this.currentSheet = this.api.asc_getActiveWorksheetIndex();
this.api.asc_registerCallback('asc_onLockProtectedRangeManager', this.wrapEvents.onLockProtectedRangeManager);
this.api.asc_registerCallback('asc_onUnLockProtectedRangeManager', this.wrapEvents.onUnLockProtectedRangeManager);
this.api.asc_registerCallback('asc_onLockProtectedRange', this.wrapEvents.onLockProtectedRange);
@ -334,7 +335,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
return this.guestText;
},
onSelectRangeItem: function(lisvView, itemView, record) {
onSelectRangeItem: function(listView, itemView, record) {
if (!record) return;
this.userTipHide();
@ -380,8 +381,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
if (this.currentSheet !== index) return;
this.locked = true;
this.updateButtons();
if (this.userTooltip===true && this.rulesList.cmpEl.find('.lock-user').length>0)
this.rulesList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rangeList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
},
onUnLockProtectedRangeManager: function(index) {
@ -390,23 +391,23 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
this.updateButtons();
},
onLockProtectedRange: function(index, ruleId, userId) {
onLockProtectedRange: function(index, rangeId, userId) {
if (this.currentSheet !== index) return;
var store = this.rulesList.store,
rec = store.findWhere({ruleId: ruleId});
var store = this.rangeList.store,
rec = store.findWhere({rangeId: rangeId});
if (rec) {
rec.set('lockuser', (userId) ? this.getUserName(userId) : this.guestText);
rec.set('lock', true);
this.updateButtons();
}
if (this.userTooltip===true && this.rulesList.cmpEl.find('.lock-user').length>0)
this.rulesList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rangeList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
},
onUnLockProtectedRange: function(index, ruleId) {
onUnLockProtectedRange: function(index, rangeId) {
if (this.currentSheet !== index) return;
var store = this.rulesList.store,
rec = store.findWhere({ruleId: ruleId});
var store = this.rangeList.store,
rec = store.findWhere({rangeId: rangeId});
if (rec) {
rec.set('lockuser', '');
rec.set('lock', false);