Merge pull request #2174 from ONLYOFFICE/fix/bugfix

[DE] Fix Bug 60381
This commit is contained in:
Julia Radzhabova 2022-12-29 20:05:21 +03:00 committed by GitHub
commit 1320c9ec7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 8 deletions

View file

@ -72,7 +72,8 @@ define([
this.options.tpl = _.template(this.template)(this.options);
this.props = this.options.props;
this.lastColor = 'CCE1FF';
this.colors = this.options.colors;
this.lastColor = 'FFEFBF';
this.oformManager = this.options.oformManager;
Common.UI.Window.prototype.initialize.call(this, this.options);
@ -135,18 +136,24 @@ define([
setSettings: function (props) {
if (props) {
var clr = props.color,
show = !!clr;
this.mnuNoFormsColor.setChecked(!show, true);
var clr = props.color;
this.mnuNoFormsColor.setChecked(!clr, true);
this.mnuColorPicker.clearSelection();
if (clr) {
clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b());
this.mnuColorPicker.selectByRGB(clr, true);
this.lastColor = clr;
}
this.btnColor.setColor(clr || 'transparent');
this.inputName.setValue(props.name || '');
} else {
var arr = _.difference(this.btnColor.options.colors, this.colors);
if (arr.length>0) {
var i = Math.floor(Math.random() * arr.length);
this.lastColor = arr[i];
this.mnuColorPicker.selectByRGB(this.lastColor, true);
this.btnColor.setColor(this.lastColor);
}
}
},

View file

@ -80,6 +80,7 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
this.wrapEvents = {
onRefreshRolesList: _.bind(this.onRefreshRolesList, this)
};
this.arrColors = [];
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
},
@ -96,7 +97,7 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
'<div class="listitem-icon"><svg class=""><use xlink:href="#svg-icon-<%= scope.getIconCls(index) %>"></use></svg></div>',
'<div style="min-width: 25px;text-align:center; padding-right: 5px;"><%= index+1 %></div>',
'<div style="min-width: 25px;">',
'<span class="color" style="background: <% if (color) { %>#<%= Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()) %><% } else { %> transparent <% } %>;"></span>',
'<span class="color" style="background: <% if (color) { %>#<%= color %><% } else { %> transparent <% } %>;"></span>',
'</div>',
'<div style="flex-grow: 1;padding-right: 5px;"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div style="min-width: 25px;text-align: right;opacity: 0.8;"><%= fields %></div>',
@ -171,17 +172,21 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
var rec = this.rolesList.getSelectedRec();
rec && (selectedRole = rec.get('name'));
}
this.arrColors = [];
if (roles) {
var arr = [];
for (var i=0; i<roles.length; i++) {
var role = roles[i].asc_getSettings();
var role = roles[i].asc_getSettings(),
color = role.asc_getColor();
color && (color = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()));
arr.push({
name: role.asc_getName() || this.textAnyone,
color: role.asc_getColor(),
color: color,
fields: role.asc_getFieldCount() || 0,
index: i,
scope: this
});
color && this.arrColors.push(color.toUpperCase());
}
this.rolesList.store.reset(arr);
}
@ -219,6 +224,7 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
var win = new DE.Views.RoleEditDlg({
oformManager: me.oformManager,
props : (isEdit && rec) ? {name: rec.get('name'), color: rec.get('color')} : null,
colors : me.arrColors,
isEdit : (isEdit && rec),
handler : function(result, settings) {
if (result == 'ok' && settings) {