[SSE] Fix rules lock

This commit is contained in:
Julia Radzhabova 2021-03-12 12:41:05 +03:00
parent b5433c25db
commit afdb5b343f
3 changed files with 17 additions and 14 deletions

View file

@ -187,7 +187,8 @@ define([
pgsize: [0, 0],
pgmargins: undefined,
pgorient: undefined,
lock_doc: undefined
lock_doc: undefined,
cf_locked: []
};
this.binding = {};
@ -421,6 +422,8 @@ define([
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onLockCFManager', _.bind(this.onLockCFManager, this));
this.api.asc_registerCallback('asc_onUnLockCFManager', _.bind(this.onUnLockCFManager, this));
this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
} else if (config.isRestrictedEdit)
@ -1731,6 +1734,7 @@ define([
(new SSE.Views.FormatRulesManagerDlg({
api: me.api,
langId: value,
locked: !!me._state.cf_locked[this.api.asc_getActiveWorksheetIndex()],
handler: function (result, settings) {
if (me && me.api && result=='ok') {
me.api.asc_setCF(settings.rules, settings.deleted);
@ -3536,6 +3540,14 @@ define([
this.toolbar.lockToolbar(SSE.enumLock.namedRangeLock, this._state.namedrange_locked, {array: [this.toolbar.btnPrintArea.menu.items[0], this.toolbar.btnPrintArea.menu.items[2]]});
},
onLockCFManager: function(index) {
this._state.cf_locked[index] = true;
},
onUnLockCFManager: function(index) {
this._state.cf_locked[index] = false;
},
activateControls: function() {
this.toolbar.lockToolbar(SSE.enumLock.disableOnStart, false, {array: [this.toolbar.btnPrint]});
this._state.activated = true;

View file

@ -214,16 +214,6 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
});
this.ruleStore = new Backbone.Collection(arrrules);
// this.txtScope = new Common.UI.InputFieldBtn({
// el : $('#format-rules-edit-txt-scope'),
// name : 'range',
// style : 'width: 150px;',
// allowBlank : true,
// btnHint : this.textSelectData,
// validateOnChange: false
// });
// this.txtScope.on('button:click', _.bind(this.onSelectData, this));
this.cmbCategory = new Common.UI.ComboBox({
el : $('#format-rules-edit-combo-category'),
style : 'width: 150px;',

View file

@ -258,7 +258,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
for (var i=0; i<rules.length; i++) {
var rule = rules[i],
name = this.getRuleName(rule),
location = rule.asc_getLocation();
location = rule.asc_getLocation(),
idlock = rule.asc_getIsLock();
arr.push({
ruleIndex: i, // connect store and list with controls. is not changed
ruleId: rule.asc_getId(),
@ -269,8 +270,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
priority: rule.asc_getPriority(), // priority of the rule, is changed when move or when new rule is added
ruleChanged: false, // true if was edited in FormatRulesEditDlg or was created, need to send this rule to sdk if true
props: rule,
lock: false,
lockuser: ''
lock: (idlock!==null && idlock!==undefined),
lockuser: (idlock) ? this.getUserName(idlock) : this.guestText
});
}
}