Merge pull request #1294 from ONLYOFFICE/fix/sse-protect

Fix/sse protect
This commit is contained in:
Julia Radzhabova 2021-11-09 13:08:54 +03:00 committed by GitHub
commit b6b126027e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,6 +152,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
_setDefaults: function (props) { _setDefaults: function (props) {
this.refreshRangeList(props, 0); this.refreshRangeList(props, 0);
this.currentSheet = this.api.asc_getActiveWorksheetIndex();
this.api.asc_registerCallback('asc_onLockProtectedRangeManager', this.wrapEvents.onLockProtectedRangeManager); this.api.asc_registerCallback('asc_onLockProtectedRangeManager', this.wrapEvents.onLockProtectedRangeManager);
this.api.asc_registerCallback('asc_onUnLockProtectedRangeManager', this.wrapEvents.onUnLockProtectedRangeManager); this.api.asc_registerCallback('asc_onUnLockProtectedRangeManager', this.wrapEvents.onUnLockProtectedRangeManager);
this.api.asc_registerCallback('asc_onLockProtectedRange', this.wrapEvents.onLockProtectedRange); this.api.asc_registerCallback('asc_onLockProtectedRange', this.wrapEvents.onLockProtectedRange);
@ -167,6 +168,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
name: ranges[i].asc_getName() || '', name: ranges[i].asc_getName() || '',
pwd: ranges[i].asc_isPassword(), pwd: ranges[i].asc_isPassword(),
range: ranges[i].asc_getSqref() || '', range: ranges[i].asc_getSqref() || '',
rangeId: ranges[i].asc_getId(),
props: ranges[i], props: ranges[i],
lock: (id!==null && id!==undefined), lock: (id!==null && id!==undefined),
lockuser: (id) ? this.getUserName(id) : this.guestText lockuser: (id) ? this.getUserName(id) : this.guestText
@ -334,7 +336,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
return this.guestText; return this.guestText;
}, },
onSelectRangeItem: function(lisvView, itemView, record) { onSelectRangeItem: function(listView, itemView, record) {
if (!record) return; if (!record) return;
this.userTipHide(); this.userTipHide();
@ -380,8 +382,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
if (this.currentSheet !== index) return; if (this.currentSheet !== index) return;
this.locked = true; this.locked = true;
this.updateButtons(); this.updateButtons();
if (this.userTooltip===true && this.rulesList.cmpEl.find('.lock-user').length>0) if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rulesList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this)); this.rangeList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
}, },
onUnLockProtectedRangeManager: function(index) { onUnLockProtectedRangeManager: function(index) {
@ -390,23 +392,23 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
this.updateButtons(); this.updateButtons();
}, },
onLockProtectedRange: function(index, ruleId, userId) { onLockProtectedRange: function(index, rangeId, userId) {
if (this.currentSheet !== index) return; if (this.currentSheet !== index) return;
var store = this.rulesList.store, var store = this.rangeList.store,
rec = store.findWhere({ruleId: ruleId}); rec = store.findWhere({rangeId: rangeId});
if (rec) { if (rec) {
rec.set('lockuser', (userId) ? this.getUserName(userId) : this.guestText); rec.set('lockuser', (userId) ? this.getUserName(userId) : this.guestText);
rec.set('lock', true); rec.set('lock', true);
this.updateButtons(); this.updateButtons();
} }
if (this.userTooltip===true && this.rulesList.cmpEl.find('.lock-user').length>0) if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rulesList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this)); 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; if (this.currentSheet !== index) return;
var store = this.rulesList.store, var store = this.rangeList.store,
rec = store.findWhere({ruleId: ruleId}); rec = store.findWhere({rangeId: rangeId});
if (rec) { if (rec) {
rec.set('lockuser', ''); rec.set('lockuser', '');
rec.set('lock', false); rec.set('lock', false);