[SSE] Show access rights for ranges

This commit is contained in:
Julia Radzhabova
2024-02-26 15:17:24 +03:00
parent 79932fd1ad
commit b6eb9f0734
3 changed files with 21 additions and 13 deletions

View File

@ -92,17 +92,11 @@ define([
'<label>' + t.txtRange + '</label>',
'</div>',
'<div id="id-protected-range-txt" class="input-row" style="margin-bottom: 8px;"></div>',
'<% if (canRequestUsers) { %>',
'<div class="input-row">',
'<label>' + t.txtWhoCanEdit + '</label>',
'<label class="font-weight-bold">' + t.txtAccess + '</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: 143px;"></div>',
'<% } else { %>',
'<div class="input-row" style="margin-bottom: 8px;">',
'<label>' + t.txtYouCanEdit + '</label>',
'</div>',
'<% } %>',
'</div>'
].join('');
@ -574,7 +568,8 @@ define([
textCanView: 'Can view',
textRemove: 'Remove',
textCantView: 'Can\'t view',
textAnyone: 'Anyone'
textAnyone: 'Anyone',
txtAccess: 'Access to range'
}, SSE.Views.ProtectedRangesEditDlg || {}));
});

View File

@ -103,13 +103,13 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectedRangesManagerDlg.te
headers: [
{name: this.textTitle, width: 184},
{name: this.textRange, width: 191},
{name: this.textYouCan, width: 70},
{name: this.txtAccess, width: 70},
],
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">',
'<div class="padding-right-5" style="width:184px;"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="padding-right-5" style="width:191px;"><%= Common.Utils.String.htmlEncode(range) %></div>',
'<div style="width:70px;"><% if (canEdit) { %>', me.txtEdit, '<% } else { %>', me.txtView, '<% } %></div>',
'<div style="width:70px;"><% if (type===Asc.c_oSerUserProtectedRangeType.edit) { %>', me.txtEdit, '<% } else if (type===Asc.c_oSerUserProtectedRangeType.view) { %>', me.txtView, '<% } else { %>', me.txtDenied, '<% } %></div>',
'<% if (lock) { %>',
'<div class="lock-user"><%=Common.Utils.String.htmlEncode(lockuser)%></div>',
'<% } %>',
@ -174,14 +174,18 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectedRangesManagerDlg.te
currentId = this.currentUser.id;
for (var i=0; i<ranges.length; i++) {
var id = ranges[i].asc_getIsLock(),
users = ranges[i].asc_getUsers();
users = ranges[i].asc_getUsers(),
type = ranges[i].asc_getType(),
user = _.find(users, function(item) { return (item.asc_getId()===currentId); })
user && (type = user.asc_getType());
arr.push({
name: ranges[i].asc_getName() || '',
range: ranges[i].asc_getRef() || '',
rangeId: ranges[i].asc_getId() || '',
users: users,
props: ranges[i],
canEdit: !!_.find(users, function(item) { return (item.asc_getId()===currentId); }),
type: type,
canEdit: type===Asc.c_oSerUserProtectedRangeType.edit,
lock: (id!==null && id!==undefined),
lockuser: (id) ? (this.isUserVisible(id) ? this.getUserName(id) : this.lockText) : this.guestText
});
@ -447,7 +451,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectedRangesManagerDlg.te
lockText: 'Locked',
textFilter: 'Filter',
textFilterAll: 'All',
textYouCan: 'You can'
textYouCan: 'You can',
txtDenied: 'Denied',
txtAccess: 'Access'
}, SSE.Views.ProtectedRangesManagerDlg || {}));
});

View File

@ -3470,6 +3470,12 @@
"SSE.Views.ProtectedRangesEditDlg.txtWhoCanEdit": "Who can edit",
"SSE.Views.ProtectedRangesEditDlg.txtYouCanEdit": "Only you can edit this range",
"SSE.Views.ProtectedRangesEditDlg.userPlaceholder": "Start typing name or email",
"SSE.Views.ProtectedRangesEditDlg.textCanEdit": "Can edit",
"SSE.Views.ProtectedRangesEditDlg.textCanView": "Can view",
"SSE.Views.ProtectedRangesEditDlg.textRemove": "Remove",
"SSE.Views.ProtectedRangesEditDlg.textCantView": "Can't view",
"SSE.Views.ProtectedRangesEditDlg.textAnyone": "Anyone",
"SSE.Views.ProtectedRangesEditDlg.txtAccess": "Access to range",
"SSE.Views.ProtectedRangesManagerDlg.guestText": "Guest",
"SSE.Views.ProtectedRangesManagerDlg.lockText": "Locked",
"SSE.Views.ProtectedRangesManagerDlg.textDelete": "Delete",
@ -3491,6 +3497,7 @@
"SSE.Views.ProtectedRangesManagerDlg.txtView": "View",
"SSE.Views.ProtectedRangesManagerDlg.warnDelete": "Are you sure you want to delete the protected range {0}?<br>Anyone who has edit access to the spreadsheet will be able to edit content in the range.",
"SSE.Views.ProtectedRangesManagerDlg.warnDeleteRanges": "Are you sure you want to delete the protected ranges?<br>Anyone who has edit access to the spreadsheet will be able to edit content in those ranges.",
"SSE.Views.ProtectedRangesManagerDlg.txtAccess": "Access",
"SSE.Views.ProtectRangesDlg.guestText": "Guest",
"SSE.Views.ProtectRangesDlg.lockText": "Locked",
"SSE.Views.ProtectRangesDlg.textDelete": "Delete",