Skip to content

Commit

Permalink
Merge branch 'release/v8.1.0' into feature/sse-hidden-range
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Feb 26, 2024
2 parents 3e12a22 + 2cd1224 commit 8a4ce7a
Show file tree
Hide file tree
Showing 65 changed files with 639 additions and 205 deletions.
6 changes: 5 additions & 1 deletion apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@
url: 'http://...',
text: 'Go to London',
blank: true,
requestClose: false // if true - goback send onRequestClose event instead opening url
requestClose: false // if true - goback send onRequestClose event instead opening url, deprecated, use customization.close instead
},
close: {
visible: false,
text: 'Close file'
},
reviewPermissions: {
"Group1": ["Group2"], // users from Group1 can accept/reject review changes made by users from Group2
Expand Down
7 changes: 6 additions & 1 deletion apps/api/wopi/editor-wopi.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ div {
window.open(fileInfo.HostEditUrl, "_blank");
};
var onRequestSaveAs = function (event) {
//SaveAs work via PutRelativeFile server-server request
};
var onRequestSharingSettings = function (event) {
if (fileInfo.FileSharingPostMessage)
_postMessage('UI_Sharing', {});
Expand Down Expand Up @@ -324,7 +328,8 @@ div {
"events": {
"onAppReady": onAppReady,
"onDocumentStateChange": fileInfo.EditNotificationPostMessage ? onDocumentStateChange : undefined,
'onRequestEditRights': fileInfo.EditModePostMessage || (fileInfo.HostEditUrl && !fileInfo.UserCanNotWriteRelative) ? onRequestEditRights : undefined,
'onRequestEditRights': fileInfo.EditModePostMessage || fileInfo.HostEditUrl ? onRequestEditRights : undefined,
'onRequestSaveAs': fileInfo.SupportsUpdate && !fileInfo.UserCanNotWriteRelative ? onRequestSaveAs : undefined,
"onError": onError,
"onRequestClose": fileInfo.ClosePostMessage || fileInfo.CloseUrl ? onRequestClose : undefined,
"onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined,
Expand Down
7 changes: 4 additions & 3 deletions apps/common/main/lib/component/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,11 @@ define([
if (/svgicon/.test(this.iconCls)) {
var icon = /svgicon\s(\S+)/.exec(this.iconCls);
svgIcon.attr('xlink:href', icon && icon.length > 1 ? '#' + icon[1] : '');
} else if (svgIcon.length) {
var icon = /btn-[^\s]+/.exec(this.iconCls);
svgIcon.attr('href', icon ? '#' + icon[0]: '');
} else {
if (svgIcon.length) {
var icon = /btn-[^\s]+/.exec(this.iconCls);
svgIcon.attr('href', icon ? '#' + icon[0]: '');
}
btnIconEl.removeClass(oldCls);
btnIconEl.addClass(cls || '');
if (this.options.scaling === false) {
Expand Down
12 changes: 6 additions & 6 deletions apps/common/main/lib/controller/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ define([
comment.set('initials', Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(data.asc_getUserName())));
comment.set('parsedName', AscCommon.UserInfoParser.getParsedName(data.asc_getUserName()));
comment.set('parsedGroups', AscCommon.UserInfoParser.getParsedGroups(data.asc_getUserName()));
comment.set('usercolor', (user) ? user.get('color') : null);
comment.set('usercolor', (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(userid || data.asc_getUserName()));
comment.set('avatar', avatar);
comment.set('resolved', data.asc_getSolved());
comment.set('quote', data.asc_getQuoteText());
Expand Down Expand Up @@ -890,7 +890,7 @@ define([
username : data.asc_getReply(i).asc_getUserName(),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(data.asc_getReply(i).asc_getUserName())),
parsedName : AscCommon.UserInfoParser.getParsedName(data.asc_getReply(i).asc_getUserName()),
usercolor : (user) ? user.get('color') : null,
usercolor : (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(userid || data.asc_getReply(i).asc_getUserName()),
avatar : avatar,
date : t.dateToLocaleTimeString(dateReply),
reply : data.asc_getReply(i).asc_getText(),
Expand Down Expand Up @@ -1300,7 +1300,7 @@ define([
var users = this.userCollection,
hasGroup = false,
updateCommentData = function(comment, user, isNotReply) {
var color = (user) ? user.get('color') : null,
var color = (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(comment.get('userid')),
needrender = false;
if (color !== comment.get('usercolor')) {
needrender = true;
Expand Down Expand Up @@ -1395,7 +1395,7 @@ define([
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(data.asc_getUserName())),
parsedName : AscCommon.UserInfoParser.getParsedName(data.asc_getUserName()),
parsedGroups : AscCommon.UserInfoParser.getParsedGroups(data.asc_getUserName()),
usercolor : (user) ? user.get('color') : null,
usercolor : (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(userid || data.asc_getUserName()),
avatar : avatar,
date : this.dateToLocaleTimeString(date),
quote : data.asc_getQuoteText(),
Expand Down Expand Up @@ -1456,7 +1456,7 @@ define([
username : data.asc_getReply(i).asc_getUserName(),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(data.asc_getReply(i).asc_getUserName())),
parsedName : AscCommon.UserInfoParser.getParsedName(data.asc_getReply(i).asc_getUserName()),
usercolor : (user) ? user.get('color') : null,
usercolor : (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(userid || data.asc_getReply(i).asc_getUserName()),
avatar : avatar,
date : this.dateToLocaleTimeString(date),
reply : data.asc_getReply(i).asc_getText(),
Expand Down Expand Up @@ -1501,7 +1501,7 @@ define([
avatar: Common.UI.ExternalUsers.getImage(this.currentUserId),
initials: Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName())),
parsedName: AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()),
usercolor: (user) ? user.get('color') : null,
usercolor: (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(this.currentUserId),
editTextInPopover: true,
showReplyInPopover: false,
hideAddReply: true,
Expand Down
20 changes: 16 additions & 4 deletions apps/common/main/lib/controller/ExternalUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ Common.UI.ExternalUsers = new( function() {
isUsersLoading = false,
externalUsersInfo = [],
isUsersInfoLoading = false,
stackUsersInfoResponse = [];
stackUsersInfoResponse = [],
api,
userColors = [];

var _get = function(type, ids) {
if (type==='info') {
Expand Down Expand Up @@ -114,9 +116,9 @@ Common.UI.ExternalUsers = new( function() {
_onUsersInfo(stackUsersInfoResponse.shift());
};

var _init = function(canRequestUsers) {
var _init = function(canRequestUsers, _api) {
Common.Gateway.on('setusers', _onUsersInfo);

api = _api;
if (!canRequestUsers) return;

Common.Gateway.on('setusers', function(data) {
Expand All @@ -137,10 +139,20 @@ Common.UI.ExternalUsers = new( function() {
});
};

var _getColor = function(id, intValue) {
if (!userColors[id]) {
var color = api.asc_getUserColorById(id);
userColors[id] = ["#"+("000000"+color.toString(16)).substr(-6), color];
}

return intValue ? userColors[id][1] : userColors[id][0];
};

return {
init: _init,
get: _get,
getImage: _getImage,
setImage: _setImage
setImage: _setImage,
getColor: _getColor
}
})();
118 changes: 64 additions & 54 deletions apps/common/main/lib/controller/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,72 +625,82 @@ define([
if (!this.viewPlugins.pluginPanels[guid].openInsideMode(langName, url, frameId, plugin.get_Guid()))
this.api.asc_pluginButtonClick(-1, plugin.get_Guid());
} else {
var me = this,
isCustomWindow = variation.get_CustomWindow(),
arrBtns = variation.get_Buttons(),
newBtns = [],
size = variation.get_Size(),
isModal = variation.get_Modal();
var me = this;
var createPluginDlg = function () {
var isCustomWindow = variation.get_CustomWindow(),
arrBtns = variation.get_Buttons(),
newBtns = [],
size = variation.get_Size(),
isModal = variation.get_Modal();
if (!size || size.length<2) size = [800, 600];

if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
if (b.visible)
newBtns[index] = {caption: b.text, value: index, primary: b.primary};
});
}

var help = variation.get_Help();
me.pluginDlg = new Common.Views.PluginDlg({
cls: isCustomWindow ? 'plain' : '',
header: !isCustomWindow,
title: plugin.get_Name(lang),
width: size[0], // inner width
height: size[1], // inner height
url: url,
frameId : frameId,
buttons: isCustomWindow ? undefined : newBtns,
toolcallback: function(event) {
me.api.asc_pluginButtonClick(-1, plugin.get_Guid());
},
help: !!help,
loader: plugin.get_Loader(),
modal: isModal!==undefined ? isModal : true
});
me.pluginDlg.on({
'render:after': function(obj){
obj.getChild('.footer .dlg-btn').on('click', function(event) {
me.api.asc_pluginButtonClick(parseInt(event.currentTarget.attributes['result'].value), plugin.get_Guid());
if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
if (b.visible)
newBtns[index] = {caption: b.text, value: index, primary: b.primary};
});
me.pluginContainer = me.pluginDlg.$window.find('#id-plugin-container');
},
'close': function(obj){
me.pluginDlg = undefined;
},
'drag': function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start');
},
'resize': function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start');
},
'help': function(){
help && window.open(help, '_blank');
},
'header:click': function(type){
me.api.asc_pluginButtonClick(type, plugin.get_Guid());
}
});

me.pluginDlg.show();
var help = variation.get_Help();
me.pluginDlg = new Common.Views.PluginDlg({
guid: plugin.get_Guid(),
cls: isCustomWindow ? 'plain' : '',
header: !isCustomWindow,
title: plugin.get_Name(lang),
width: size[0], // inner width
height: size[1], // inner height
url: url,
frameId : frameId,
buttons: isCustomWindow ? undefined : newBtns,
toolcallback: function(event) {
me.api.asc_pluginButtonClick(-1, plugin.get_Guid());
},
help: !!help,
loader: plugin.get_Loader(),
modal: isModal!==undefined ? isModal : true
});
me.pluginDlg.on({
'render:after': function(obj){
obj.getChild('.footer .dlg-btn').on('click', function(event) {
me.api.asc_pluginButtonClick(parseInt(event.currentTarget.attributes['result'].value), plugin.get_Guid());
});
me.pluginContainer = me.pluginDlg.$window.find('#id-plugin-container');
},
'close': function(obj){
me.pluginDlg = undefined;
},
'drag': function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start');
},
'resize': function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start');
},
'help': function(){
help && window.open(help, '_blank');
},
'header:click': function(type){
me.api.asc_pluginButtonClick(type, plugin.get_Guid());
}
});

me.pluginDlg.show();
};
if (this.pluginDlg) {
this.api.asc_pluginButtonClick(-1, this.pluginDlg.guid);
setTimeout(createPluginDlg, 10);
} else {
createPluginDlg();
}

}
}
!variation.get_InsideMode() && this.viewPlugins.openedPluginMode(plugin.get_Guid());
},

onPluginClose: function(plugin) {
onPluginClose: function(plugin) {
var isIframePlugin = false,
guid = plugin.get_Guid();
if (this.pluginDlg)
if (this.pluginDlg && this.pluginDlg.guid === guid)
this.pluginDlg.close();
else {
var panel = this.viewPlugins.pluginPanels[guid];
Expand Down
4 changes: 2 additions & 2 deletions apps/common/main/lib/controller/ReviewChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ define([
uid : Common.UI.getId(),
userid : item.get_UserId(),
username : item.get_UserName(),
usercolor : (user) ? user.get('color') : null,
usercolor : (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(item.get_UserId() || item.get_UserName()),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(item.get_UserName())),
avatar : avatar,
date : me.dateToLocaleTimeString(date),
Expand Down Expand Up @@ -1091,7 +1091,7 @@ define([
var users = this.userCollection;
this.popoverChanges && this.popoverChanges.each(function (model) {
var user = users.findOriginalUser(model.get('userid'));
model.set('usercolor', (user) ? user.get('color') : null);
model.set('usercolor', (user) ? user.get('color') : Common.UI.ExternalUsers.getColor(model.get('userid')));
user && user.get('avatar') && model.set('avatar', user.get('avatar'));
});
},
Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/view/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ define([
var user = this.storeUsers.findOriginalUser(m.get('userid')),
avatar = Common.UI.ExternalUsers.getImage(m.get('userid'));
m.set({
usercolor : user ? user.get('color') : null,
usercolor : user ? user.get('color') : Common.UI.ExternalUsers.getColor(m.get('userid')),
avatar : avatar,
initials : user ? user.get('initials') : Common.Utils.getUserInitials(m.get('parsedName')),
message : this._pickLink(m.get('message'))
Expand Down
Loading

0 comments on commit 8a4ce7a

Please sign in to comment.