Skip to content

Commit

Permalink
[SSE] Allow hide range for anyone
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Feb 21, 2024
1 parent 814e20a commit eed7a29
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions apps/spreadsheeteditor/main/app/view/ProtectedRangesEditDlg.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ define([
'<label>' + t.txtWhoCanEdit + '</label>',
'</div>',
'<div id="id-protected-range-cmb-user" class="input-row input-group-nr" style="margin-bottom: 8px;"></div>',
'<div id="id-protected-range-list-user" class="input-group-nr no-borders" style="height: 155px;"></div>',
'<div id="id-protected-range-list-user" class="input-group-nr no-borders" style="height: 143px;"></div>',
'<% } else { %>',
'<div class="input-row" style="margin-bottom: 8px;">',
'<label>' + t.txtYouCanEdit + '</label>',
Expand Down Expand Up @@ -205,7 +205,6 @@ define([
});
};
this.listUser.on('item:keydown', _.bind(this.onKeyDown, this))
this.listUser.on('item:click', _.bind(this.onListUserClick, this))
this.listUser.on('item:add', _.bind(this.addControls, this));
this.listUser.on('item:change', _.bind(this.addControls, this));

Expand Down Expand Up @@ -277,6 +276,16 @@ define([
email: '',
type: Asc.c_oSerUserProtectedRangeType.edit,
isCurrent: true});
this.listUser.store.add({
value: null,
name: this.textAnyone,
displayName: this.textAnyone,
initials: Common.Utils.getUserInitials(this.textAnyone),
avatar: '',
usercolor: null,
email: '',
type: props.asc_getType() || Asc.c_oSerUserProtectedRangeType.notView,
isAnyone: true});
var me = this,
rangeUsers = this.props.asc_getUsers();
if (rangeUsers && rangeUsers.length>0) {
Expand Down Expand Up @@ -306,11 +315,15 @@ define([
props.asc_setRef(this.txtDataRange.getValue());
var arr = [];
this.listUser.store.each(function(item){
var user = new Asc.CUserProtectedRangeUserInfo();
user.asc_setId(item.get('value'));
user.asc_setName(item.get('name'));
user.asc_setType(item.get('type'));
arr.push(user);
if (item.get('isAnyone')) {
props.asc_setType(item.get('type'));
} else {
var user = new Asc.CUserProtectedRangeUserInfo();
user.asc_setId(item.get('value'));
user.asc_setName(item.get('name'));
user.asc_setType(item.get('type'));
arr.push(user);
}
});

props.asc_setUsers(arr);
Expand Down Expand Up @@ -458,7 +471,7 @@ define([

onDeleteUser: function(rec) {
!rec && (rec = this.listUser.getSelectedRec());
if (rec && !rec.get('isCurrent')) {
if (rec && !rec.get('isCurrent') && !rec.get('isAnyone')) {
this.listUser.store.remove(rec);
}
var me = this;
Expand All @@ -467,10 +480,6 @@ define([
}, 1);
},

onListUserClick: function(list, item, record, e) {

},

addControls: function(listView, itemView, item) {
if (!item) return;

Expand All @@ -484,7 +493,18 @@ define([
menu: item.get('isCurrent') ? false : new Common.UI.Menu({
style: 'min-width: auto;',
cls: 'menu-absolute',
items: [
items: item.get('isAnyone') ? [
{
caption: this.textCanView,
value: 'view',
iconCls: 'menu__icon btn-sheet-view',
},
{
caption: this.textCantView,
value: 'notview',
iconCls: 'menu__icon btn-hide-password'
}
] : [
{
caption: this.textCanEdit,
value: 'edit',
Expand Down Expand Up @@ -547,7 +567,9 @@ define([
textAnonymous: 'Anonymous',
textCanEdit: 'Can edit',
textCanView: 'Can view',
textRemove: 'Remove'
textRemove: 'Remove',
textCantView: 'Can\'t view',
textAnyone: 'Anyone'

}, SSE.Views.ProtectedRangesEditDlg || {}));
});

0 comments on commit eed7a29

Please sign in to comment.