[Mobile] Add parameter to api config: customization.reviewPermissions (user name must be prefixed)

This commit is contained in:
Julia Radzhabova 2020-08-05 16:36:35 +03:00
parent 5439ce930c
commit 3e0aaa0449
13 changed files with 112 additions and 30 deletions

View file

@ -63,7 +63,8 @@ define([
canViewReview, canViewReview,
arrChangeReview = [], arrChangeReview = [],
dateChange = [], dateChange = [],
_fileKey; _fileKey,
_currentUserGroups;
return { return {
@ -113,6 +114,18 @@ define([
if (editor === 'DE') { if (editor === 'DE') {
_fileKey = mode.fileKey; _fileKey = mode.fileKey;
} }
if (mode && mode.canUseReviewPermissions) {
var permissions = mode.customization.reviewPermissions,
arr = [],
groups = Common.Utils.UserInfoParser.getParsedGroups(mode.user.fullname);
groups && groups.forEach(function(group) {
var item = permissions[group.trim()];
item && (arr = arr.concat(item));
});
_currentUserGroups = arr;
}
return this; return this;
}, },
@ -231,7 +244,8 @@ define([
getUsersInfo: function() { getUsersInfo: function() {
var usersArray = []; var usersArray = [];
_.each(editUsers, function(item){ _.each(editUsers, function(item){
var fio = item.asc_getUserName().split(' '); var name = Common.Utils.UserInfoParser.getParsedName(item.asc_getUserName());
var fio = name.split(' ');
var initials = fio[0].substring(0, 1).toUpperCase(); var initials = fio[0].substring(0, 1).toUpperCase();
if (fio.length > 1) { if (fio.length > 1) {
initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); initials += fio[fio.length - 1].substring(0, 1).toUpperCase();
@ -241,7 +255,7 @@ define([
color: item.asc_getColor(), color: item.asc_getColor(),
id: item.asc_getId(), id: item.asc_getId(),
idOriginal: item.asc_getIdOriginal(), idOriginal: item.asc_getIdOriginal(),
name: item.asc_getUserName(), name: name,
view: item.asc_getView(), view: item.asc_getView(),
initial: initials initial: initials
}; };
@ -300,6 +314,10 @@ define([
$('#settings-accept-all').hide(); $('#settings-accept-all').hide();
$('#settings-reject-all').hide(); $('#settings-reject-all').hide();
} }
if (this.appConfig.canUseReviewPermissions) {
$('#settings-accept-all').hide();
$('#settings-reject-all').hide();
}
}, },
onTrackChanges: function(e) { onTrackChanges: function(e) {
@ -407,6 +425,11 @@ define([
$('.accept-reject').html('<a href="#" id="btn-delete-change" class="link">' + this.textDelete + '</a>'); $('.accept-reject').html('<a href="#" id="btn-delete-change" class="link">' + this.textDelete + '</a>');
$('#btn-delete-change').single('click', _.bind(this.onDeleteChange, this)); $('#btn-delete-change').single('click', _.bind(this.onDeleteChange, this));
} }
} else {
if(arrChangeReview.length != 0 && !arrChangeReview[0].editable) {
$('#btn-accept-change').addClass('disabled');
$('#btn-reject-change').addClass('disabled');
}
} }
if(displayMode == "final" || displayMode == "original") { if(displayMode == "final" || displayMode == "original") {
$('#btn-accept-change').addClass('disabled'); $('#btn-accept-change').addClass('disabled');
@ -663,9 +686,7 @@ define([
userColor = item.get_UserColor(), userColor = item.get_UserColor(),
goto = (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom); goto = (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom);
date = me.dateToLocaleTimeString(date); date = me.dateToLocaleTimeString(date);
var editable = (item.get_UserId() == _userId); var editable = me.appConfig.isReviewOnly && (item.get_UserId() == _userId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || me.checkUserGroups(item.get_UserName()));
arr.push({date: date, user: user, usercolor: userColor, changetext: changetext, goto: goto, editable: editable}); arr.push({date: date, user: user, usercolor: userColor, changetext: changetext, goto: goto, editable: editable});
}); });
arrChangeReview = arr; arrChangeReview = arr;
@ -677,6 +698,11 @@ define([
this.updateInfoChange(); this.updateInfoChange();
}, },
checkUserGroups: function(username) {
var groups = Common.Utils.UserInfoParser.getParsedGroups(username);
return _currentUserGroups && groups && (_.intersection(_currentUserGroups, groups).length>0);
},
dateToLocaleTimeString: function (date) { dateToLocaleTimeString: function (date) {
function format(date) { function format(date) {
var strTime, var strTime,
@ -736,7 +762,7 @@ define([
}, },
getInitials: function(name) { getInitials: function(name) {
var fio = name.split(' '); var fio = Common.Utils.UserInfoParser.getParsedName(name).split(' ');
var initials = fio[0].substring(0, 1).toUpperCase(); var initials = fio[0].substring(0, 1).toUpperCase();
if (fio.length > 1) { if (fio.length > 1) {
initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); initials += fio[fio.length - 1].substring(0, 1).toUpperCase();

View file

@ -177,7 +177,7 @@ define([
if (isAndroid) { if (isAndroid) {
template += '<div class="initials-comment" style="background-color: ' + comment.usercolor + ';">' + comment.userInitials + '</div><div>'; template += '<div class="initials-comment" style="background-color: ' + comment.usercolor + ';">' + comment.userInitials + '</div><div>';
} }
template += '<div class="user-name">' + comment.username + '</div>' + template += '<div class="user-name">' + me.getUserName(comment.username) + '</div>' +
'<div class="comment-date">' + comment.date + '</div>'; '<div class="comment-date">' + comment.date + '</div>';
if (isAndroid) { if (isAndroid) {
template += '</div>'; template += '</div>';
@ -202,7 +202,7 @@ define([
if (isAndroid) { if (isAndroid) {
template += '<div class="initials-reply" style="background-color: ' + reply.usercolor + ';">' + reply.userInitials + '</div><div>' template += '<div class="initials-reply" style="background-color: ' + reply.usercolor + ';">' + reply.userInitials + '</div><div>'
} }
template += '<div class="user-name">' + reply.username + '</div>' + template += '<div class="user-name">' + me.getUserName(reply.username) + '</div>' +
'<div class="reply-date">' + reply.date + '</div>' + '<div class="reply-date">' + reply.date + '</div>' +
'</div>'; '</div>';
if (isAndroid) { if (isAndroid) {
@ -249,7 +249,7 @@ define([
'<div class="item-inner">', '<div class="item-inner">',
'<div class="header-comment"><div class="comment-left">', '<div class="header-comment"><div class="comment-left">',
'<% if (android) { %><div class="initials-comment" style="background-color:<%= item.usercolor %> "> <%= item.userInitials %></div><div><% } %>', '<% if (android) { %><div class="initials-comment" style="background-color:<%= item.usercolor %> "> <%= item.userInitials %></div><div><% } %>',
'<div class="user-name"><%= item.username %></div>', '<div class="user-name"><%= scope.getUserName(item.username) %></div>',
'<div class="comment-date"><%= item.date %></div>', '<div class="comment-date"><%= item.date %></div>',
'<% if (android) { %></div><% } %>', '<% if (android) { %></div><% } %>',
'</div>', '</div>',
@ -271,7 +271,7 @@ define([
'<div class="header-reply">', '<div class="header-reply">',
'<div class="reply-left">', '<div class="reply-left">',
'<% if (android) { %><div class="initials-reply" style="background-color: <%= reply.usercolor %>;"><%= reply.userInitials %></div><div><% } %>', '<% if (android) { %><div class="initials-reply" style="background-color: <%= reply.usercolor %>;"><%= reply.userInitials %></div><div><% } %>',
'<div class="user-name"><%= reply.username %></div>', '<div class="user-name"><%= scope.getUserName(reply.username) %></div>',
'<div class="reply-date"><%= reply.date %></div>', '<div class="reply-date"><%= reply.date %></div>',
'</div>', '</div>',
'<% if (android) { %></div><% } %>', '<% if (android) { %></div><% } %>',
@ -292,7 +292,8 @@ define([
item: comment, item: comment,
replys: comment.replys.length, replys: comment.replys.length,
viewmode: me.viewmode, viewmode: me.viewmode,
quote: me.sliceQuote(comment.quote) quote: me.sliceQuote(comment.quote),
scope: me
})); }));
}); });
$listComments.html(items.join('')); $listComments.html(items.join(''));
@ -304,7 +305,7 @@ define([
var isAndroid = Framework7.prototype.device.android === true; var isAndroid = Framework7.prototype.device.android === true;
var template = '<div class="wrap-comment">' + var template = '<div class="wrap-comment">' +
(isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + comment.usercolor + ';">' + comment.userInitials + '</div><div>' : '') + (isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + comment.usercolor + ';">' + comment.userInitials + '</div><div>' : '') +
'<div class="user-name">' + comment.username + '</div>' + '<div class="user-name">' + this.getUserName(comment.username) + '</div>' +
'<div class="comment-date">' + comment.date + '</div>' + '<div class="comment-date">' + comment.date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div><textarea id="comment-text" class="comment-textarea">' + comment.comment + '</textarea></div>' + '<div><textarea id="comment-text" class="comment-textarea">' + comment.comment + '</textarea></div>' +
@ -317,7 +318,7 @@ define([
var isAndroid = Framework7.prototype.device.android === true; var isAndroid = Framework7.prototype.device.android === true;
var template = '<div class="wrap-reply">' + var template = '<div class="wrap-reply">' +
(isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + color + ';">' + initials + '</div><div>' : '') + (isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + color + ';">' + initials + '</div><div>' : '') +
'<div class="user-name">' + name + '</div>' + '<div class="user-name">' + this.getUserName(name) + '</div>' +
'<div class="comment-date">' + date + '</div>' + '<div class="comment-date">' + date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div><textarea class="reply-textarea" placeholder="' + this.textAddReply + '">' + '</textarea></div>' + '<div><textarea class="reply-textarea" placeholder="' + this.textAddReply + '">' + '</textarea></div>' +
@ -330,7 +331,7 @@ define([
var isAndroid = Framework7.prototype.device.android === true; var isAndroid = Framework7.prototype.device.android === true;
var template = '<div class="wrap-comment">' + var template = '<div class="wrap-comment">' +
(isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + reply.usercolor + ';">' + reply.userInitials + '</div><div>' : '') + (isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + reply.usercolor + ';">' + reply.userInitials + '</div><div>' : '') +
'<div class="user-name">' + reply.username + '</div>' + '<div class="user-name">' + this.getUserName(reply.username) + '</div>' +
'<div class="comment-date">' + reply.date + '</div>' + '<div class="comment-date">' + reply.date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div><textarea id="comment-text" class="edit-reply-textarea">' + reply.reply + '</textarea></div>' + '<div><textarea id="comment-text" class="edit-reply-textarea">' + reply.reply + '</textarea></div>' +
@ -354,7 +355,7 @@ define([
'<div class="page-content">' + '<div class="page-content">' +
'<div class="wrap-reply">' + '<div class="wrap-reply">' +
(isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + color + ';">' + initial + '</div><div>' : '') + (isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + color + ';">' + initial + '</div><div>' : '') +
'<div class="user-name">' + name + '</div>' + '<div class="user-name">' + this.getUserName(name) + '</div>' +
'<div class="comment-date">' + date + '</div>' + '<div class="comment-date">' + date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div><textarea class="reply-textarea" placeholder="' + this.textAddReply + '"></textarea></div>' + '<div><textarea class="reply-textarea" placeholder="' + this.textAddReply + '"></textarea></div>' +
@ -401,7 +402,7 @@ define([
'<div class="page-content">' + '<div class="page-content">' +
'<div class="wrap-comment">' + '<div class="wrap-comment">' +
(isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + comment.usercolor + ';">' + comment.userInitials + '</div><div>' : '') + (isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + comment.usercolor + ';">' + comment.userInitials + '</div><div>' : '') +
'<div class="user-name">' + comment.username + '</div>' + '<div class="user-name">' + this.getUserName(comment.username) + '</div>' +
'<div class="comment-date">' + comment.date + '</div>' + '<div class="comment-date">' + comment.date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div><textarea id="comment-text" class="comment-textarea">' + comment.comment + '</textarea></div>' + '<div><textarea id="comment-text" class="comment-textarea">' + comment.comment + '</textarea></div>' +
@ -427,7 +428,7 @@ define([
'<div class="page-content">' + '<div class="page-content">' +
'<div class="wrap-comment">' + '<div class="wrap-comment">' +
(isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + reply.usercolor + ';">' + reply.userInitials + '</div><div>' : '') + (isAndroid ? '<div class="header-comment"><div class="initials-comment" style="background-color: ' + reply.usercolor + ';">' + reply.userInitials + '</div><div>' : '') +
'<div class="user-name">' + reply.username + '</div>' + '<div class="user-name">' + this.getUserName(reply.username) + '</div>' +
'<div class="comment-date">' + reply.date + '</div>' + '<div class="comment-date">' + reply.date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div><textarea id="comment-text" class="edit-reply-textarea">' + reply.reply + '</textarea></div>' + '<div><textarea id="comment-text" class="edit-reply-textarea">' + reply.reply + '</textarea></div>' +
@ -442,13 +443,17 @@ define([
renderChangeReview: function(change) { renderChangeReview: function(change) {
var isAndroid = Framework7.prototype.device.android === true; var isAndroid = Framework7.prototype.device.android === true;
var template = (isAndroid ? '<div class="header-change"><div class="initials-change" style="background-color: #' + change.color + ';">' + change.initials + '</div><div>' : '') + var template = (isAndroid ? '<div class="header-change"><div class="initials-change" style="background-color: #' + change.color + ';">' + change.initials + '</div><div>' : '') +
'<div id="user-name">' + change.user + '</div>' + '<div id="user-name">' + this.getUserName(change.user) + '</div>' +
'<div id="date-change">' + change.date + '</div>' + '<div id="date-change">' + change.date + '</div>' +
(isAndroid ? '</div></div>' : '') + (isAndroid ? '</div></div>' : '') +
'<div id="text-change">' + change.text + '</div>'; '<div id="text-change">' + change.text + '</div>';
$('#current-change').html(_.template(template)); $('#current-change').html(_.template(template));
}, },
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
textCollaboration: 'Collaboration', textCollaboration: 'Collaboration',
textReviewing: 'Review', textReviewing: 'Review',
textСomments: 'Сomments', textСomments: 'Сomments',

View file

@ -126,5 +126,32 @@ define([
new IScroll(targetSelector); new IScroll(targetSelector);
}, 500); }, 500);
} }
};
Common.Utils.UserInfoParser = new(function() {
var parse = false;
return {
setParser: function(value) {
parse = !!value;
},
getParsedName: function(username) {
if (parse && username) {
return username.substring(username.indexOf(':')+1);
} else
return username;
},
getParsedGroups: function(username) {
if (parse && username) {
var idx = username.indexOf(':'),
groups = (idx>-1) ? username.substring(0, idx).split(',') : [];
for (var i=0; i<groups.length; i++)
groups[i] = groups[i].trim();
return groups;
} else
return undefined;
} }
}
})();
}); });

View file

@ -346,7 +346,7 @@ define([
if (usersStore){ if (usersStore){
var rec = usersStore.findUser(id); var rec = usersStore.findUser(id);
if (rec) if (rec)
return rec.get('username'); return Common.Utils.UserInfoParser.getParsedName(rec.get('username'));
} }
return me.textGuest; return me.textGuest;
}; };

View file

@ -800,6 +800,9 @@ define([
me.appOptions.canUseHistory = me.appOptions.canReview = me.appOptions.isReviewOnly = false; me.appOptions.canUseHistory = me.appOptions.canReview = me.appOptions.isReviewOnly = false;
} }
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
me.applyModeCommonElements(); me.applyModeCommonElements();
me.applyModeEditorElements(); me.applyModeEditorElements();

View file

@ -456,7 +456,7 @@ define([
value = props.asc_getModified(); value = props.asc_getModified();
value ? $('#settings-doc-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove(); value ? $('#settings-doc-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove();
value = props.asc_getLastModifiedBy(); value = props.asc_getLastModifiedBy();
value ? $('#settings-doc-mod-by').html(value) : $('.display-mode-by').remove(); value ? $('#settings-doc-mod-by').html(Common.Utils.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove();
value = props.asc_getCreated(); value = props.asc_getCreated();
value ? $('#settings-doc-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove(); value ? $('#settings-doc-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove();
value = props.asc_getCreator(); value = props.asc_getCreator();

View file

@ -177,7 +177,7 @@ define([
var $commentInfo = $('#comment-info'); var $commentInfo = $('#comment-info');
var template = [ var template = [
'<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>', '<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>',
'<div class="user-name"><%= comment.username %></div>', '<div class="user-name"><%= scope.getUserName(comment.username) %></div>',
'<div class="comment-date"><%= comment.date %></div>', '<div class="comment-date"><%= comment.date %></div>',
'<% if (android) { %></div></div><% } %>', '<% if (android) { %></div></div><% } %>',
'<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" placeholder="<%= textAddComment %>" autofocus></textarea></div>' '<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" placeholder="<%= textAddComment %>" autofocus></textarea></div>'
@ -185,7 +185,8 @@ define([
var insert = _.template(template)({ var insert = _.template(template)({
android: Framework7.prototype.device.android, android: Framework7.prototype.device.android,
comment: comment, comment: comment,
textAddComment: me.textAddComment textAddComment: me.textAddComment,
scope: me
}); });
$commentInfo.html(insert); $commentInfo.html(insert);
_.defer(function () { _.defer(function () {
@ -207,6 +208,10 @@ define([
}, 100); }, 100);
}, },
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
renderNumFormat: function (dataFormat, selectFormat) { renderNumFormat: function (dataFormat, selectFormat) {
var $listFormat = $('#list-format-footnote ul'), var $listFormat = $('#list-format-footnote ul'),
items = []; items = [];

View file

@ -730,6 +730,9 @@ define([
me.appOptions.canBranding = params.asc_getCustomization(); me.appOptions.canBranding = params.asc_getCustomization();
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
me.applyModeCommonElements(); me.applyModeCommonElements();
me.applyModeEditorElements(); me.applyModeEditorElements();

View file

@ -241,7 +241,7 @@ define([
value = props.asc_getModified(); value = props.asc_getModified();
value ? $('#settings-pe-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove(); value ? $('#settings-pe-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove();
value = props.asc_getLastModifiedBy(); value = props.asc_getLastModifiedBy();
value ? $('#settings-pe-mod-by').html(value) : $('.display-mode-by').remove(); value ? $('#settings-pe-mod-by').html(Common.Utils.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove();
value = props.asc_getCreated(); value = props.asc_getCreated();
value ? $('#settings-pe-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove(); value ? $('#settings-pe-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove();
value = props.asc_getCreator(); value = props.asc_getCreator();

View file

@ -143,7 +143,7 @@ define([
var $commentInfo = $('#comment-info'); var $commentInfo = $('#comment-info');
var template = [ var template = [
'<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>', '<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>',
'<div class="user-name"><%= comment.username %></div>', '<div class="user-name"><%= scope.getUserName(comment.username) %></div>',
'<div class="comment-date"><%= comment.date %></div>', '<div class="comment-date"><%= comment.date %></div>',
'<% if (android) { %></div></div><% } %>', '<% if (android) { %></div></div><% } %>',
'<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" placeholder="<%= textAddComment %>" autofocus></textarea></div>' '<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" placeholder="<%= textAddComment %>" autofocus></textarea></div>'
@ -151,7 +151,8 @@ define([
var insert = _.template(template)({ var insert = _.template(template)({
android: Framework7.prototype.device.android, android: Framework7.prototype.device.android,
comment: comment, comment: comment,
textAddComment: me.textAddComment textAddComment: me.textAddComment,
scope: me
}); });
$commentInfo.html(insert); $commentInfo.html(insert);
_.defer(function () { _.defer(function () {
@ -173,6 +174,10 @@ define([
}, 100); }, 100);
}, },
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
showPageTable: function() { showPageTable: function() {
this.showPage('#addother-insert-table'); this.showPage('#addother-insert-table');
this.renderTableStyles(); this.renderTableStyles();

View file

@ -743,6 +743,9 @@ define([
me.appOptions.canBranding = params.asc_getCustomization(); me.appOptions.canBranding = params.asc_getCustomization();
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
} }
me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights; me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights;

View file

@ -310,7 +310,7 @@ define([
value = props.asc_getModified(); value = props.asc_getModified();
value ? $('#settings-sse-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove(); value ? $('#settings-sse-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove();
value = props.asc_getLastModifiedBy(); value = props.asc_getLastModifiedBy();
value ? $('#settings-sse-mod-by').html(value) : $('.display-mode-by').remove(); value ? $('#settings-sse-mod-by').html(Common.Utils.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove();
value = props.asc_getCreated(); value = props.asc_getCreated();
value ? $('#settings-sse-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove(); value ? $('#settings-sse-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove();
value = props.asc_getCreator(); value = props.asc_getCreator();

View file

@ -217,7 +217,7 @@ define([
var $commentInfo = $('#comment-info'); var $commentInfo = $('#comment-info');
var template = [ var template = [
'<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>', '<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>',
'<div class="user-name"><%= comment.username %></div>', '<div class="user-name"><%= scope.getUserName(comment.username) %></div>',
'<div class="comment-date"><%= comment.date %></div>', '<div class="comment-date"><%= comment.date %></div>',
'<% if (android) { %></div></div><% } %>', '<% if (android) { %></div></div><% } %>',
'<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" placeholder="<%= textAddComment %>" autofocus></textarea></div>' '<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" placeholder="<%= textAddComment %>" autofocus></textarea></div>'
@ -225,7 +225,8 @@ define([
var insert = _.template(template)({ var insert = _.template(template)({
android: Framework7.prototype.device.android, android: Framework7.prototype.device.android,
comment: comment, comment: comment,
textAddComment: me.textAddComment textAddComment: me.textAddComment,
scope: me
}); });
$commentInfo.html(insert); $commentInfo.html(insert);
_.defer(function () { _.defer(function () {
@ -247,6 +248,10 @@ define([
}, 100); }, 100);
}, },
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
showInsertImage: function () { showInsertImage: function () {
this.showPage('#addother-insimage'); this.showPage('#addother-insimage');