diff --git a/apps/common/main/lib/collection/Users.js b/apps/common/main/lib/collection/Users.js index 790d87e21..af293d4a5 100644 --- a/apps/common/main/lib/collection/Users.js +++ b/apps/common/main/lib/collection/Users.js @@ -64,10 +64,18 @@ define([ return this.filter(function(item){return item.get('online') && !item.get('view')}).length; }, + getVisibleEditingCount: function() { + return this.filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).length; + }, + getEditingOriginalCount: function() { return this.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).size().value(); }, + getVisibleEditingOriginalCount: function() { + return this.chain().filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).groupBy(function(item) {return item.get('idOriginal');}).size().value(); + }, + findUser: function(id) { return this.find( function(model){ diff --git a/apps/common/main/lib/component/SynchronizeTip.js b/apps/common/main/lib/component/SynchronizeTip.js index 6c7c170e8..c56dd7c46 100644 --- a/apps/common/main/lib/component/SynchronizeTip.js +++ b/apps/common/main/lib/component/SynchronizeTip.js @@ -79,6 +79,7 @@ define([ this.placement = this.options.placement; this.showLink = this.options.showLink; this.showButton = this.options.showButton; + this.closable = this.options.closable; this.textButton = this.options.textButton || ''; }, diff --git a/apps/common/main/lib/controller/Chat.js b/apps/common/main/lib/controller/Chat.js index aa895823d..002c178cc 100644 --- a/apps/common/main/lib/controller/Chat.js +++ b/apps/common/main/lib/controller/Chat.js @@ -89,6 +89,7 @@ define([ setMode: function(mode) { this.mode = mode; + this.currentUserId = mode.user.id; if (this.api) { if (this.mode.canCoAuthoring && this.mode.canChat) @@ -142,7 +143,8 @@ define([ username : user.asc_getUserName(), online : true, color : user.asc_getColor(), - view : user.asc_getView() + view : user.asc_getView(), + hidden : !(user.asc_getIdOriginal()===this.currentUserId || AscCommon.UserInfoParser.isUserVisible(user.asc_getUserName())) }); arrUsers[(user.asc_getId() == currentUserId ) ? 'unshift' : 'push'](usermodel); } @@ -165,7 +167,8 @@ define([ username : change.asc_getUserName(), online : change.asc_getState(), color : change.asc_getColor(), - view : change.asc_getView() + view : change.asc_getView(), + hidden : !(change.asc_getIdOriginal()===this.currentUserId || AscCommon.UserInfoParser.isUserVisible(change.asc_getUserName())) })); } else { user.set({online: change.asc_getState()}); diff --git a/apps/common/main/lib/model/User.js b/apps/common/main/lib/model/User.js index 6f71c3de8..275e09e45 100644 --- a/apps/common/main/lib/model/User.js +++ b/apps/common/main/lib/model/User.js @@ -62,7 +62,8 @@ define([ color : '#fff', colorval : null, online : false, - view : false + view : false, + hidden : false } } }); diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 62f41c7e8..56a229dfa 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -130,11 +130,11 @@ define([ ''; function onResetUsers(collection, opts) { - var usercount = collection.getEditingCount(); + var usercount = collection.getVisibleEditingCount(); if ( $userList ) { if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.isRestrictedEdit) { $userList.html(templateUserList({ - users: collection.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).value(), + users: collection.chain().filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).groupBy(function(item) {return item.get('idOriginal');}).value(), usertpl: _.template(templateUserItem), fnEncode: function(username) { return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); @@ -153,7 +153,7 @@ define([ } } - applyUsers( usercount, collection.getEditingOriginalCount() ); + applyUsers( usercount, collection.getVisibleEditingOriginalCount() ); }; function onUsersChanged(model) { @@ -270,7 +270,7 @@ define([ $panelUsers.find('.cousers-menu') .on('click', function(e) { return false; }); - var editingUsers = storeUsers.getEditingCount(); + var editingUsers = storeUsers.getVisibleEditingCount(); $btnUsers.tooltip({ title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.isRestrictedEdit) ? me.tipViewUsers : me.tipAccessRights, titleNorm: me.tipAccessRights, diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 47a545be6..ba79ab18d 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -366,6 +366,14 @@ define([ } return me.guestText; }; + var isUserVisible = function(id){ + if (usersStore){ + var rec = usersStore.findUser(id); + if (rec) + return !rec.get('hidden'); + } + return true; + }; /** coauthoring end **/ @@ -577,7 +585,7 @@ define([ screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'}); } /** coauthoring begin **/ - else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit) { // 2 - locked object + else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit && isUserVisible(moveData.get_UserId())) { // 2 - locked object var src; if (me.usertipcount >= me.usertips.length) { src = $(document.createElement("div")); @@ -613,6 +621,8 @@ define([ }; var onShowForeignCursorLabel = function(UserId, X, Y, color) { + if (!isUserVisible(UserId)) return; + /** coauthoring begin **/ var src; for (var i=0; i= me.usertips.length) { src = $(document.createElement("div")); @@ -568,6 +576,8 @@ define([ }; var onShowForeignCursorLabel = function(UserId, X, Y, color) { + if (!isUserVisible(UserId)) return; + /** coauthoring begin **/ var src; for (var i=0; iClose this view and delete it?", - textLongName: 'Enter a name that is less than 128 characters.' + textLongName: 'Enter a name that is less than 128 characters.', + lockText: 'Locked' }, SSE.Views.ViewManagerDlg || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index cb69493a2..64a70d656 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2292,6 +2292,7 @@ "SSE.Views.FormatRulesManagerDlg.textUp": "Move rule up", "SSE.Views.FormatRulesManagerDlg.tipIsLocked": "This element is being edited by another user.", "SSE.Views.FormatRulesManagerDlg.txtTitle": "Conditional Formatting", + "SSE.Views.FormatRulesManagerDlg.lockText": "Locked", "SSE.Views.FormatSettingsDialog.textCategory": "Category", "SSE.Views.FormatSettingsDialog.textDecimal": "Decimal", "SSE.Views.FormatSettingsDialog.textFormat": "Format", @@ -2521,6 +2522,7 @@ "SSE.Views.NameManagerDlg.tipIsLocked": "This element is being edited by another user.", "SSE.Views.NameManagerDlg.txtTitle": "Name Manager", "SSE.Views.NameManagerDlg.warnDelete": "Are you sure you want to delete the name {0}?", + "SSE.Views.NameManagerDlg.lockText": "Locked", "SSE.Views.PageMarginsDialog.textBottom": "Bottom", "SSE.Views.PageMarginsDialog.textLeft": "Left", "SSE.Views.PageMarginsDialog.textRight": "Right", @@ -2784,6 +2786,7 @@ "SSE.Views.ProtectRangesDlg.txtTitle": "Allow Users to Edit Ranges", "SSE.Views.ProtectRangesDlg.txtYes": "Yes", "SSE.Views.ProtectRangesDlg.warnDelete": "Are you sure you want to delete the name {0}?", + "SSE.Views.ProtectRangesDlg.lockText": "Locked", "SSE.Views.RemoveDuplicatesDialog.textColumns": "Columns", "SSE.Views.RemoveDuplicatesDialog.textDescription": "To delete duplicate values, select one or more columns that contain duplicates.", "SSE.Views.RemoveDuplicatesDialog.textHeaders": "My data has headers", @@ -3526,6 +3529,7 @@ "SSE.Views.ViewManagerDlg.tipIsLocked": "This element is being edited by another user.", "SSE.Views.ViewManagerDlg.txtTitle": "Sheet View Manager", "SSE.Views.ViewManagerDlg.warnDeleteView": "You are trying to delete the currently enabled view '%1'.
Close this view and delete it?", + "SSE.Views.ViewManagerDlg.lockText": "Locked", "SSE.Views.ViewTab.capBtnFreeze": "Freeze Panes", "SSE.Views.ViewTab.capBtnSheetView": "Sheet View", "SSE.Views.ViewTab.textClose": "Close",