Merge pull request #466 from ONLYOFFICE/feature/de-review-permissions

Feature/de review permissions
This commit is contained in:
Julia Radzhabova 2020-08-17 13:52:59 +03:00 committed by GitHub
commit afb4a2cdc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 232 additions and 95 deletions

View file

@ -117,6 +117,16 @@ define([
if (data) {
this.currentUserId = data.config.user.id;
if (this.appConfig && this.appConfig.canUseReviewPermissions) {
var permissions = this.appConfig.customization.reviewPermissions,
arr = [],
groups = Common.Utils.UserInfoParser.getParsedGroups(data.config.user.fullname);
groups && groups.forEach(function(group) {
var item = permissions[group.trim()];
item && (arr = arr.concat(item));
});
this.currentUserGroups = arr;
}
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
}
return this;
@ -183,7 +193,8 @@ define([
posY = sdkchange[0].get_Y(),
animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length),
lock = (sdkchange[0].get_LockUserId()!==null),
lockUser = this.getUserName(sdkchange[0].get_LockUserId());
lockUser = this.getUserName(sdkchange[0].get_LockUserId()),
editable = changes[0].get('editable');
this.getPopover().hideTips();
this.popoverChanges.reset(changes);
@ -195,14 +206,15 @@ define([
this.getPopover().showReview(animate, lock, lockUser);
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== lock) {
this.view.btnAccept.setDisabled(lock==true);
this.view.btnReject.setDisabled(lock==true);
var btnlock = lock || !editable;
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== btnlock) {
this.view.btnAccept.setDisabled(btnlock);
this.view.btnReject.setDisabled(btnlock);
if (this.dlgChanges) {
this.dlgChanges.btnAccept.setDisabled(lock==true);
this.dlgChanges.btnReject.setDisabled(lock==true);
this.dlgChanges.btnAccept.setDisabled(btnlock);
this.dlgChanges.btnReject.setDisabled(btnlock);
}
this._state.lock = lock;
this._state.lock = btnlock;
}
this._state.posx = posX;
this._state.posy = posY;
@ -459,7 +471,7 @@ define([
scope : me.view,
hint : !me.appConfig.canReview,
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
editable : (item.get_UserId() == me.currentUserId)
editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || me.checkUserGroups(item.get_UserName()))
});
arr.push(change);
@ -467,10 +479,15 @@ define([
return arr;
},
checkUserGroups: function(username) {
var groups = Common.Utils.UserInfoParser.getParsedGroups(username);
return this.currentUserGroups && groups && (_.intersection(this.currentUserGroups, groups).length>0);
},
getUserName: function(id){
if (this.userCollection && id!==null){
var rec = this.userCollection.findUser(id);
if (rec) return rec.get('username');
if (rec) return Common.Utils.UserInfoParser.getParsedName(rec.get('username'));
}
return '';
},

View file

@ -13,7 +13,7 @@
<% if (editable) { %>
<div class="btn-delete img-commonctrl"></div>
<% } %>
<% } else { %>
<% } else if (editable) { %>
<div class="btn-accept img-commonctrl"></div>
<div class="btn-reject img-commonctrl"></div>
<% } %>

View file

@ -959,4 +959,31 @@ Common.Utils.ModalWindow = new(function() {
return count>0;
}
}
})();
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

@ -267,7 +267,7 @@ define([
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(username);
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
hide: function () {

View file

@ -655,7 +655,7 @@ define([
return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(quote), 120, true);
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(username);
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
pickLink: function (message) {

View file

@ -128,7 +128,9 @@ define([
$userList.html(templateUserList({
users: collection.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).value(),
usertpl: _.template(templateUserItem),
fnEncode: Common.Utils.String.htmlEncode
fnEncode: function(username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
}
}));
$userList.scroller = new Common.UI.Scroller({

View file

@ -90,7 +90,7 @@ define([
'<% } %>',
'<div class="user-name">',
'<div class="color" style="display: inline-block; background-color:' + '<%=usercolor%>;' + '" >',
'</div><%= Common.Utils.String.htmlEncode(username) %>',
'</div><%= Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)) %>',
'</div>',
'<% if (canRestore && selected) { %>',
'<label class="revision-restore" role="presentation" tabindex="-1">' + this.textRestore + '</label>',

View file

@ -108,7 +108,7 @@ define([
me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']);
});
this.btnAccept.menu.on('item:click', function (menu, item, e) {
this.btnAccept.menu && this.btnAccept.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:accept', [menu, item]);
});
@ -116,7 +116,7 @@ define([
me.fireEvent('reviewchange:reject', [me.btnReject, 'current']);
});
this.btnReject.menu.on('item:click', function (menu, item, e) {
this.btnReject.menu && this.btnReject.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:reject', [menu, item]);
});
@ -202,14 +202,14 @@ define([
this.btnAccept = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtAccept,
split: true,
split: !this.appConfig.canUseReviewPermissions,
iconCls: 'toolbar__icon btn-review-save'
});
this.btnReject = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtReject,
split: true,
split: !this.appConfig.canUseReviewPermissions,
iconCls: 'toolbar__icon btn-review-deny'
});
@ -358,36 +358,37 @@ define([
if ( config.canReview ) {
me.btnTurnOn.updateHint(me.tipReview);
me.btnAccept.setMenu(
new Common.UI.Menu({
items: [
{
caption: me.txtAcceptCurrent,
value: 'current'
},
{
caption: me.txtAcceptAll,
value: 'all'
}
]
})
);
if (!me.appConfig.canUseReviewPermissions) {
me.btnAccept.setMenu(
new Common.UI.Menu({
items: [
{
caption: me.txtAcceptCurrent,
value: 'current'
},
{
caption: me.txtAcceptAll,
value: 'all'
}
]
})
);
me.btnReject.setMenu(
new Common.UI.Menu({
items: [
{
caption: me.txtRejectCurrent,
value: 'current'
},
{
caption: me.txtRejectAll,
value: 'all'
}
]
})
);
}
me.btnAccept.updateHint([me.tipAcceptCurrent, me.txtAcceptChanges]);
me.btnReject.setMenu(
new Common.UI.Menu({
items: [
{
caption: me.txtRejectCurrent,
value: 'current'
},
{
caption: me.txtRejectAll,
value: 'all'
}
]
})
);
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
if (config.canFeatureComparison) {
@ -583,7 +584,7 @@ define([
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(username);
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
turnChanges: function(state) {
@ -771,7 +772,7 @@ define([
caption : this.txtAccept,
split : true,
disabled : this.mode.isReviewOnly,
menu : new Common.UI.Menu({
menu : this.mode.canUseReviewPermissions ? false : new Common.UI.Menu({
items: [
this.mnuAcceptCurrent = new Common.UI.MenuItem({
caption: this.txtAcceptCurrent,
@ -791,7 +792,7 @@ define([
caption : this.txtReject,
split : true,
disabled : this.mode.isReviewOnly,
menu : new Common.UI.Menu({
menu : this.mode.canUseReviewPermissions ? false : new Common.UI.Menu({
items: [
this.mnuRejectCurrent = new Common.UI.MenuItem({
caption: this.txtRejectCurrent,
@ -819,7 +820,7 @@ define([
me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']);
});
this.btnAccept.menu.on('item:click', function (menu, item, e) {
this.btnAccept.menu && this.btnAccept.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:accept', [menu, item]);
});
@ -827,7 +828,7 @@ define([
me.fireEvent('reviewchange:reject', [me.btnReject, 'current']);
});
this.btnReject.menu.on('item:click', function (menu, item, e) {
this.btnReject.menu && this.btnReject.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:reject', [menu, item]);
});

View file

@ -63,7 +63,8 @@ define([
canViewReview,
arrChangeReview = [],
dateChange = [],
_fileKey;
_fileKey,
_currentUserGroups;
return {
@ -113,6 +114,18 @@ define([
if (editor === 'DE') {
_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;
},
@ -231,7 +244,8 @@ define([
getUsersInfo: function() {
var usersArray = [];
_.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();
if (fio.length > 1) {
initials += fio[fio.length - 1].substring(0, 1).toUpperCase();
@ -241,7 +255,7 @@ define([
color: item.asc_getColor(),
id: item.asc_getId(),
idOriginal: item.asc_getIdOriginal(),
name: item.asc_getUserName(),
name: name,
view: item.asc_getView(),
initial: initials
};
@ -300,6 +314,10 @@ define([
$('#settings-accept-all').hide();
$('#settings-reject-all').hide();
}
if (this.appConfig.canUseReviewPermissions) {
$('#settings-accept-all').hide();
$('#settings-reject-all').hide();
}
},
onTrackChanges: function(e) {
@ -407,6 +425,11 @@ define([
$('.accept-reject').html('<a href="#" id="btn-delete-change" class="link">' + this.textDelete + '</a>');
$('#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") {
$('#btn-accept-change').addClass('disabled');
@ -663,9 +686,7 @@ define([
userColor = item.get_UserColor(),
goto = (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom);
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});
});
arrChangeReview = arr;
@ -677,6 +698,11 @@ define([
this.updateInfoChange();
},
checkUserGroups: function(username) {
var groups = Common.Utils.UserInfoParser.getParsedGroups(username);
return _currentUserGroups && groups && (_.intersection(_currentUserGroups, groups).length>0);
},
dateToLocaleTimeString: function (date) {
function format(date) {
var strTime,
@ -736,7 +762,7 @@ define([
},
getInitials: function(name) {
var fio = name.split(' ');
var fio = Common.Utils.UserInfoParser.getParsedName(name).split(' ');
var initials = fio[0].substring(0, 1).toUpperCase();
if (fio.length > 1) {
initials += fio[fio.length - 1].substring(0, 1).toUpperCase();

View file

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

View file

@ -126,5 +126,32 @@ define([
new IScroll(targetSelector);
}, 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

@ -372,8 +372,7 @@ define([
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
.setUserName(this.appOptions.user.fullname);
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
if (this.editorConfig.lang)
this.api.asc_setLocale(this.editorConfig.lang);
@ -1263,6 +1262,10 @@ define([
if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization);
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname));
this.appOptions.canRename && appHeader.setCanRename(true);
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);

View file

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

View file

@ -1172,7 +1172,7 @@ define([
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
value = props.asc_getLastModifiedBy();
if (value)
this.lblModifyBy.text(value);
this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(value));
visible = this._ShowHideInfoItem(this.lblModifyBy, !!value) || visible;
$('tr.divider.modify', this.el)[visible?'show':'hide']();

View file

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

View file

@ -800,6 +800,9 @@ define([
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.applyModeEditorElements();

View file

@ -456,7 +456,7 @@ define([
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 = 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 ? $('#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();

View file

@ -177,7 +177,7 @@ define([
var $commentInfo = $('#comment-info');
var template = [
'<% 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>',
'<% if (android) { %></div></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)({
android: Framework7.prototype.device.android,
comment: comment,
textAddComment: me.textAddComment
textAddComment: me.textAddComment,
scope: me
});
$commentInfo.html(insert);
_.defer(function () {
@ -207,6 +208,10 @@ define([
}, 100);
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
renderNumFormat: function (dataFormat, selectFormat) {
var $listFormat = $('#list-format-footnote ul'),
items = [];

View file

@ -331,8 +331,7 @@ define([
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
.setUserName(this.appOptions.user.fullname);
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
if (this.editorConfig.lang)
this.api.asc_setLocale(this.editorConfig.lang);
@ -966,6 +965,10 @@ define([
if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization);
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname));
this.appOptions.canRename && appHeader.setCanRename(true);
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);

View file

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

View file

@ -1043,7 +1043,7 @@ define([
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
value = props.asc_getLastModifiedBy();
if (value)
this.lblModifyBy.text(value);
this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(value));
visible = this._ShowHideInfoItem(this.lblModifyBy, !!value) || visible;
$('tr.divider.modify', this.el)[visible?'show':'hide']();

View file

@ -730,6 +730,9 @@ define([
me.appOptions.canBranding = params.asc_getCustomization();
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.applyModeEditorElements();

View file

@ -241,7 +241,7 @@ define([
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 = 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 ? $('#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();

View file

@ -143,7 +143,7 @@ define([
var $commentInfo = $('#comment-info');
var template = [
'<% 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>',
'<% if (android) { %></div></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)({
android: Framework7.prototype.device.android,
comment: comment,
textAddComment: me.textAddComment
textAddComment: me.textAddComment,
scope: me
});
$commentInfo.html(insert);
_.defer(function () {
@ -173,6 +174,10 @@ define([
}, 100);
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
showPageTable: function() {
this.showPage('#addother-insert-table');
this.renderTableStyles();

View file

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

View file

@ -360,8 +360,7 @@ define([
this.appOptions.canFeaturePivot = !!this.api.asc_isSupportFeature("pivot-tables");
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
.setUserName(this.appOptions.user.fullname);
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
var reg = Common.localStorage.getItem("sse-settings-reg-settings"),
isUseBaseSeparator = Common.localStorage.getBool("sse-settings-use-base-separator", true),
@ -1022,6 +1021,9 @@ define([
this.headerView.setBranding(this.editorConfig.customization);
this.appOptions.canRename && this.headerView.setCanRename(true);
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname));
} else
this.appOptions.canModifyFilter = true;

View file

@ -1884,7 +1884,7 @@ define([
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
value = props.asc_getLastModifiedBy();
if (value)
this.lblModifyBy.text(value);
this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(value));
visible = this._ShowHideInfoItem(this.lblModifyBy, !!value) || visible;
$('tr.divider.modify', this.el)[visible?'show':'hide']();

View file

@ -361,7 +361,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
if (usersStore){
var rec = usersStore.findUser(id);
if (rec)
return rec.get('username');
return Common.Utils.UserInfoParser.getParsedName(rec.get('username'));
}
return this.guestText;
},

View file

@ -743,6 +743,9 @@ define([
me.appOptions.canBranding = params.asc_getCustomization();
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;

View file

@ -310,7 +310,7 @@ define([
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 = 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 ? $('#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();

View file

@ -217,7 +217,7 @@ define([
var $commentInfo = $('#comment-info');
var template = [
'<% 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>',
'<% if (android) { %></div></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)({
android: Framework7.prototype.device.android,
comment: comment,
textAddComment: me.textAddComment
textAddComment: me.textAddComment,
scope: me
});
$commentInfo.html(insert);
_.defer(function () {
@ -247,6 +248,10 @@ define([
}, 100);
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username));
},
showInsertImage: function () {
this.showPage('#addother-insimage');