View mode with commenting (permissions.comments = true).

This commit is contained in:
Julia Radzhabova 2017-06-14 14:53:29 +03:00
parent 33f79ba24c
commit 00fb06281e
14 changed files with 115 additions and 105 deletions

View file

@ -750,14 +750,15 @@ define([
if (this.mode && !this.mode.canComments) if (this.mode && !this.mode.canComments)
hint = true; hint = true;
if (this.getPopover()) { var popover = this.getPopover();
if (popover) {
this.clearDummyComment(); this.clearDummyComment();
if (this.isSelectedComment && (0 === _.difference(this.uids, uids).length)) { if (this.isSelectedComment && (0 === _.difference(this.uids, uids).length)) {
//NOTE: click to sdk view ? //NOTE: click to sdk view ?
if (this.api) { if (this.api) {
//this.view.txtComment.blur(); //this.view.txtComment.blur();
this.getPopover().commentsView.setFocusToTextBox(true); popover.commentsView && popover.commentsView.setFocusToTextBox(true);
this.api.asc_enableKeyEvents(true); this.api.asc_enableKeyEvents(true);
} }
@ -813,12 +814,12 @@ define([
this._dontScrollToComment = false; this._dontScrollToComment = false;
} }
if (this.getPopover().isVisible()) { if (popover.isVisible()) {
this.getPopover().hide(); popover.hide();
} }
this.getPopover().setLeftTop(posX, posY, leftX); popover.setLeftTop(posX, posY, leftX);
this.getPopover().show(animate, false, true, text); popover.show(animate, false, true, text);
} }
}, },
onApiHideComment: function (hint) { onApiHideComment: function (hint) {

View file

@ -166,7 +166,7 @@ define([
createDelayedElements: function() { createDelayedElements: function() {
/** coauthoring begin **/ /** coauthoring begin **/
if ( this.mode.canCoAuthoring ) { if ( this.mode.canCoAuthoring ) {
this.leftMenu.btnComments[(this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); this.leftMenu.btnComments[(this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide']();
if (this.mode.canComments) if (this.mode.canComments)
this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView()); this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView());
@ -623,7 +623,7 @@ define([
} }
return false; return false;
case 'comments': case 'comments':
if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) { if (this.mode.canCoAuthoring && this.mode.canComments && !this.mode.isLightVersion) {
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu('comments'); this.leftMenu.showMenu('comments');
this.getApplication().getController('Common.Controllers.Comments').onAfterShow(); this.getApplication().getController('Common.Controllers.Comments').onAfterShow();

View file

@ -968,8 +968,9 @@ define([
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory; this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && !this.appOptions.isOffline; this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && !this.appOptions.isOffline;
this.appOptions.canSendEmailAddresses = this.appOptions.canLicense && this.editorConfig.canSendEmailAddresses && this.appOptions.canEdit && this.appOptions.canCoAuthoring; this.appOptions.canSendEmailAddresses = this.appOptions.canLicense && this.editorConfig.canSendEmailAddresses && this.appOptions.canEdit && this.appOptions.canCoAuthoring;
this.appOptions.canComments = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comments===undefined ? this.appOptions.isEdit : this.permissions.comments);
this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false);
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit;
this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canRename = !!this.permissions.rename;
@ -1007,16 +1008,16 @@ define([
this.updatePlugins(this.plugins, true); this.updatePlugins(this.plugins, true);
this.applyModeCommonElements(); this.applyModeCommonElements();
if ( this.appOptions.isEdit ) { this.applyModeEditorElements();
this.applyModeEditorElements();
} else { if ( !this.appOptions.isEdit ) {
Common.NotificationCenter.trigger('app:face', this.appOptions); Common.NotificationCenter.trigger('app:face', this.appOptions);
this.hidePreloader(); this.hidePreloader();
this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
} }
this.api.asc_setViewMode(!this.appOptions.isEdit); this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments);
this.api.asc_LoadDocument(); this.api.asc_LoadDocument();
}, },
@ -1060,6 +1061,12 @@ define([
}, },
applyModeEditorElements: function() { applyModeEditorElements: function() {
if (this.appOptions.canComments || this.appOptions.isEdit) {
/** coauthoring begin **/
this.contComments.setMode(this.appOptions);
this.contComments.setConfig({config: this.editorConfig}, this.api);
/** coauthoring end **/
}
if (this.appOptions.isEdit) { if (this.appOptions.isEdit) {
var me = this, var me = this,
application = this.getApplication(), application = this.getApplication(),
@ -1071,10 +1078,6 @@ define([
fontsControllers && fontsControllers.setApi(me.api); fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api); toolbarController && toolbarController.setApi(me.api);
/** coauthoring begin **/
me.contComments.setMode(me.appOptions);
me.contComments.setConfig({config: me.editorConfig}, me.api);
/** coauthoring end **/
rightmenuController && rightmenuController.setApi(me.api); rightmenuController && rightmenuController.setApi(me.api);
if (reviewController) if (reviewController)

View file

@ -1540,7 +1540,7 @@ define([
this.mode = m; this.mode = m;
/** coauthoring begin **/ /** coauthoring begin **/
!(this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) !(this.mode.canCoAuthoring && this.mode.canComments)
? Common.util.Shortcuts.suspendEvents(hkComments) ? Common.util.Shortcuts.suspendEvents(hkComments)
: Common.util.Shortcuts.resumeEvents(hkComments); : Common.util.Shortcuts.resumeEvents(hkComments);
/** coauthoring end **/ /** coauthoring end **/
@ -1725,7 +1725,7 @@ define([
/** coauthoring begin **/ /** coauthoring begin **/
addComment: function(item, e, eOpt){ addComment: function(item, e, eOpt){
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) { if (this.api && this.mode.canCoAuthoring && this.mode.canComments) {
this.suppressEditComplete = true; this.suppressEditComplete = true;
var controller = DE.getController('Common.Controllers.Comments'); var controller = DE.getController('Common.Controllers.Comments');
@ -1818,9 +1818,10 @@ define([
initMenu: function (value) { initMenu: function (value) {
var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties())); var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties()));
menuViewUndo.setVisible(me.mode.isEdit); menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments);
menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); menuViewUndo.setDisabled(/* !me.api.asc_canUndo()*/);
menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true); menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true);
var cancopy = me.api && me.api.can_CopyCut(); var cancopy = me.api && me.api.can_CopyCut();

View file

@ -111,14 +111,14 @@ define([
template: _.template([ template: _.template([
'<table><tbody>', '<table><tbody>',
/** coauthoring begin **/ /** coauthoring begin **/
'<tr class="coauth">', '<tr class="comments">',
'<td class="left"><label><%= scope.txtLiveComment %></label></td>', '<td class="left"><label><%= scope.txtLiveComment %></label></td>',
'<td class="right"><div id="fms-chb-live-comment"/></td>', '<td class="right"><div id="fms-chb-live-comment"/></td>',
'</tr>','<tr class="divider coauth"></tr>', '</tr>','<tr class="divider comments"></tr>',
'<tr class="coauth">', '<tr class="comments">',
'<td class="left"></td>', '<td class="left"></td>',
'<td class="right"><div id="fms-chb-resolved-comment"/></td>', '<td class="right"><div id="fms-chb-resolved-comment"/></td>',
'</tr>','<tr class="divider coauth"></tr>', '</tr>','<tr class="divider comments"></tr>',
/** coauthoring end **/ /** coauthoring end **/
'<tr class="edit">', '<tr class="edit">',
'<td class="left"><label><%= scope.txtSpellCheck %></label></td>', '<td class="left"><label><%= scope.txtSpellCheck %></label></td>',
@ -337,6 +337,7 @@ define([
/** coauthoring begin **/ /** coauthoring begin **/
$('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.comments', this.el)[mode.canCoAuthoring && mode.canComments ? 'show' : 'hide']();
/** coauthoring end **/ /** coauthoring end **/
}, },

View file

@ -159,7 +159,7 @@ define([
createDelayedElements: function() { createDelayedElements: function() {
/** coauthoring begin **/ /** coauthoring begin **/
if ( this.mode.canCoAuthoring ) { if ( this.mode.canCoAuthoring ) {
this.leftMenu.btnComments[(this.mode.isEdit&&this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); this.leftMenu.btnComments[(this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide']();
if (this.mode.canComments) if (this.mode.canComments)
this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments'));
@ -505,7 +505,7 @@ define([
} }
return false; return false;
case 'comments': case 'comments':
if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion && (!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) { if (this.mode.canCoAuthoring && this.mode.canComments && !this.mode.isLightVersion && (!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) {
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu('comments'); this.leftMenu.showMenu('comments');
this.getApplication().getController('Common.Controllers.Comments').onAfterShow(); this.getApplication().getController('Common.Controllers.Comments').onAfterShow();

View file

@ -744,8 +744,9 @@ define([
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download !== false; this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download !== false;
this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable(); this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
this.appOptions.canComments = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comments===undefined ? this.appOptions.isEdit : this.permissions.comments);
this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false);
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
@ -766,17 +767,16 @@ define([
this.updatePlugins(this.plugins, true); this.updatePlugins(this.plugins, true);
this.applyModeCommonElements(); this.applyModeCommonElements();
this.applyModeEditorElements();
if ( this.appOptions.isEdit ) { if ( !this.appOptions.isEdit ) {
this.applyModeEditorElements();
} else {
Common.NotificationCenter.trigger('app:face', this.appOptions); Common.NotificationCenter.trigger('app:face', this.appOptions);
this.hidePreloader(); this.hidePreloader();
this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
} }
this.api.asc_setViewMode(!this.appOptions.isEdit); this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments);
this.api.asc_LoadDocument(); this.api.asc_LoadDocument();
}, },
@ -817,6 +817,15 @@ define([
}, },
applyModeEditorElements: function(prevmode) { applyModeEditorElements: function(prevmode) {
if (this.appOptions.canComments || this.appOptions.isEdit) {
/** coauthoring begin **/
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.setMode(this.appOptions);
commentsController.setConfig({config: this.editorConfig}, this.api);
}
/** coauthoring end **/
}
if (this.appOptions.isEdit) { if (this.appOptions.isEdit) {
var me = this, var me = this,
application = this.getApplication(), application = this.getApplication(),
@ -828,13 +837,6 @@ define([
fontsControllers && fontsControllers.setApi(me.api); fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api); toolbarController && toolbarController.setApi(me.api);
/** coauthoring begin **/
var commentsController = application.getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.setMode(this.appOptions);
commentsController.setConfig({config: me.editorConfig}, me.api);
}
/** coauthoring end **/
rightmenuController && rightmenuController.setApi(me.api); rightmenuController && rightmenuController.setApi(me.api);
var viewport = this.getApplication().getController('Viewport').getView('Viewport'); var viewport = this.getApplication().getController('Viewport').getView('Viewport');

View file

@ -1527,7 +1527,7 @@ define([
me.mode = mode; me.mode = mode;
/** coauthoring begin **/ /** coauthoring begin **/
!(me.mode.canCoAuthoring && me.mode.isEdit && me.mode.canComments) !(me.mode.canCoAuthoring && me.mode.canComments)
? Common.util.Shortcuts.suspendEvents(hkComments) ? Common.util.Shortcuts.suspendEvents(hkComments)
: Common.util.Shortcuts.resumeEvents(hkComments); : Common.util.Shortcuts.resumeEvents(hkComments);
/** coauthoring end **/ /** coauthoring end **/
@ -1609,7 +1609,7 @@ define([
/** coauthoring begin **/ /** coauthoring begin **/
addComment: function(item, e, eOpt){ addComment: function(item, e, eOpt){
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) { if (this.api && this.mode.canCoAuthoring && this.mode.canComments) {
this.suppressEditComplete = true; this.suppressEditComplete = true;
var controller = PE.getController('Common.Controllers.Comments'); var controller = PE.getController('Common.Controllers.Comments');
@ -1714,9 +1714,10 @@ define([
this.viewModeMenu = new Common.UI.Menu({ this.viewModeMenu = new Common.UI.Menu({
initMenu: function (value) { initMenu: function (value) {
menuViewUndo.setVisible(me.mode.isEdit); menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments);
menuViewCopySeparator.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); menuViewUndo.setDisabled(/* !me.api.asc_canUndo()*/);
menuViewAddComment.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); menuViewCopySeparator.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewAddComment.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewAddComment.setDisabled(value.locked); menuViewAddComment.setDisabled(value.locked);
}, },
items: [ items: [

View file

@ -239,7 +239,7 @@ define([
setMode: function(permissions) { setMode: function(permissions) {
this.permissions = permissions; this.permissions = permissions;
/** coauthoring begin **/ /** coauthoring begin **/
!(this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) !(this.permissions.canCoAuthoring && this.permissions.canComments)
? Common.util.Shortcuts.suspendEvents(this.hkComments) ? Common.util.Shortcuts.suspendEvents(this.hkComments)
: Common.util.Shortcuts.resumeEvents(this.hkComments); : Common.util.Shortcuts.resumeEvents(this.hkComments);
/** coauthoring end **/ /** coauthoring end **/
@ -254,17 +254,18 @@ define([
// this.api.asc_registerCallback('asc_onShowComment', this.wrapEvents.apiShowComment); // this.api.asc_registerCallback('asc_onShowComment', this.wrapEvents.apiShowComment);
/** coauthoring end **/ /** coauthoring end **/
this.api.asc_registerCallback('asc_onHyperlinkClick', _.bind(this.onApiHyperlinkClick, this)); this.api.asc_registerCallback('asc_onHyperlinkClick', _.bind(this.onApiHyperlinkClick, this));
this.api.asc_registerCallback('asc_onSetAFDialog', _.bind(this.onApiAutofilter, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this)); this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); if (this.permissions.isEdit===true) {
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); this.api.asc_registerCallback('asc_onSetAFDialog', _.bind(this.onApiAutofilter, this));
this.api.asc_registerCallback('asc_onEntriesListMenu', _.bind(this.onEntriesListMenu, this)); // Alt + Down this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this)); this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(this.onShowSpecialPasteOptions, this)); this.api.asc_registerCallback('asc_onEntriesListMenu', _.bind(this.onEntriesListMenu, this)); // Alt + Down
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(this.onHideSpecialPasteOptions, this)); this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this));
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(this.onShowSpecialPasteOptions, this));
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(this.onHideSpecialPasteOptions, this));
}
return this; return this;
}, },
@ -560,7 +561,7 @@ define([
}, },
onAddComment: function(item) { onAddComment: function(item) {
if (this.api && this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) { if (this.api && this.permissions.canCoAuthoring && this.permissions.canComments) {
var controller = SSE.getController('Common.Controllers.Comments'), var controller = SSE.getController('Common.Controllers.Comments'),
cellinfo = this.api.asc_getCellInfo(); cellinfo = this.api.asc_getCellInfo();
@ -952,7 +953,7 @@ define([
} }
} }
if (me.permissions.isEdit) { if (me.permissions.isEdit || me.permissions.canComments) {
if (index_comments && !this.popupmenu) { if (index_comments && !this.popupmenu) {
data = dataarray[index_comments - 1]; data = dataarray[index_comments - 1];
if (!commentTip.editCommentId && commentTip.moveCommentId != data.asc_getCommentIndexes()[0]) { if (!commentTip.editCommentId && commentTip.moveCommentId != data.asc_getCommentIndexes()[0]) {
@ -994,7 +995,9 @@ define([
} }
} }
} }
}
if (me.permissions.isEdit) {
if (index_locked) { if (index_locked) {
data = dataarray[index_locked-1]; data = dataarray[index_locked-1];
@ -1484,9 +1487,10 @@ define([
if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return; if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return;
documentHolder.menuViewUndo.setVisible(this.permissions.isEdit); documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments);
documentHolder.menuViewCopySeparator.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && this.permissions.isEdit); documentHolder.menuViewUndo.setDisabled(!this.api.asc_getCanUndo());
documentHolder.menuViewAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && this.permissions.isEdit); documentHolder.menuViewCopySeparator.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments);
documentHolder.menuViewAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments);
documentHolder.setMenuItemCommentCaptionMode(documentHolder.menuViewAddComment, cellinfo.asc_getComments().length < 1, this.permissions.canEditComments); documentHolder.setMenuItemCommentCaptionMode(documentHolder.menuViewAddComment, cellinfo.asc_getComments().length < 1, this.permissions.canEditComments);
commentsController && commentsController.blockPopover(true); commentsController && commentsController.blockPopover(true);
documentHolder.menuViewAddComment.setDisabled(isCellLocked || isTableLocked); documentHolder.menuViewAddComment.setDisabled(isCellLocked || isTableLocked);

View file

@ -166,7 +166,7 @@ define([
createDelayedElements: function() { createDelayedElements: function() {
/** coauthoring begin **/ /** coauthoring begin **/
if ( this.mode.canCoAuthoring ) { if ( this.mode.canCoAuthoring ) {
this.leftMenu.btnComments[(this.mode.isEdit&&this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); this.leftMenu.btnComments[(this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide']();
if (this.mode.canComments) if (this.mode.canComments)
this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments'));
@ -671,7 +671,7 @@ define([
} }
return false; return false;
case 'comments': case 'comments':
if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) { if (this.mode.canCoAuthoring && this.mode.canComments && !this.mode.isLightVersion) {
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu('comments'); this.leftMenu.showMenu('comments');
this.getApplication().getController('Common.Controllers.Comments').onAfterShow(); this.getApplication().getController('Common.Controllers.Comments').onAfterShow();

View file

@ -422,7 +422,7 @@ define([
action && this.setLongActionView(action); action && this.setLongActionView(action);
if (id == Asc.c_oAscAsyncAction.Save) { if (id == Asc.c_oAscAsyncAction.Save) {
this.toolbarView.synchronizeChanges(); this.toolbarView && this.toolbarView.synchronizeChanges();
} }
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
@ -766,8 +766,9 @@ define([
/** coauthoring begin **/ /** coauthoring begin **/
this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion;
/** coauthoring end **/ /** coauthoring end **/
this.appOptions.canComments = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comments===undefined ? (this.permissions.edit !== false && this.editorConfig.mode !== 'view') : this.permissions.comments);
this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false);
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.isTrial = params.asc_getTrial(); this.appOptions.isTrial = params.asc_getTrial();
@ -796,15 +797,16 @@ define([
this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.applyModeCommonElements(); this.applyModeCommonElements();
if ( this.appOptions.isEdit ) { this.applyModeEditorElements();
this.applyModeEditorElements();
} else { if ( !this.appOptions.isEdit ) {
Common.NotificationCenter.trigger('app:face', this.appOptions); Common.NotificationCenter.trigger('app:face', this.appOptions);
this.hidePreloader(); this.hidePreloader();
this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
} }
this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments);
this.api.asc_setViewMode(!this.appOptions.isEdit); this.api.asc_setViewMode(!this.appOptions.isEdit);
(this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? this.api.asc_LoadEmptyDocument() : this.api.asc_LoadDocument(); (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? this.api.asc_LoadEmptyDocument() : this.api.asc_LoadDocument();
}, },
@ -874,46 +876,38 @@ define([
}, },
applyModeEditorElements: function(prevmode) { applyModeEditorElements: function(prevmode) {
if (this.appOptions.canComments || this.appOptions.isEdit) {
/** coauthoring begin **/
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.setMode(this.appOptions);
commentsController.setConfig({
config : this.editorConfig,
sdkviewname : '#ws-canvas-outer',
hintmode : true},
this.api);
}
/** coauthoring end **/
}
if (this.appOptions.isEdit) { if (this.appOptions.isEdit) {
var me = this, var me = this,
application = this.getApplication(), application = this.getApplication(),
toolbarController = application.getController('Toolbar'), toolbarController = application.getController('Toolbar'),
statusbarController = application.getController('Statusbar'), statusbarController = application.getController('Statusbar'),
rightmenuController = application.getController('RightMenu'), rightmenuController = application.getController('RightMenu'),
/** coauthoring begin **/ fontsControllers = application.getController('Common.Controllers.Fonts');
commentsController = application.getController('Common.Controllers.Comments'),
/** coauthoring end **/
fontsControllers = application.getController('Common.Controllers.Fonts');
fontsControllers && fontsControllers.setApi(me.api); fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api); toolbarController && toolbarController.setApi(me.api);
// statusbarController && statusbarController.setApi(me.api); // statusbarController && statusbarController.setApi(me.api);
if (commentsController) {
commentsController.setMode(this.appOptions);
commentsController.setConfig({
config : me.editorConfig,
sdkviewname : '#ws-canvas-outer',
hintmode : true},
me.api);
}
rightmenuController && rightmenuController.setApi(me.api); rightmenuController && rightmenuController.setApi(me.api);
if (statusbarController) { if (statusbarController) {
statusbarController.getView('Statusbar').changeViewMode(true); statusbarController.getView('Statusbar').changeViewMode(true);
} }
/** coauthoring begin **/
if (prevmode=='view') {
if (commentsController) {
Common.NotificationCenter.trigger('comments:updatefilter',{
property : 'uid',
value : new RegExp('^(doc_|sheet' + this.api.asc_getActiveWorksheetId() + '_)')});
}
}
/** coauthoring end **/
var viewport = this.getApplication().getController('Viewport').getView('Viewport'); var viewport = this.getApplication().getController('Viewport').getView('Viewport');
viewport.applyEditorMode(); viewport.applyEditorMode();
rightmenuController.getView('RightMenu').setMode(me.appOptions).setApi(me.api); rightmenuController.getView('RightMenu').setMode(me.appOptions).setApi(me.api);

View file

@ -2852,9 +2852,11 @@ define([
}, },
applyFormulaSettings: function() { applyFormulaSettings: function() {
var formulas = this.toolbar.btnInsertFormula.menu.items; if (this.toolbar.rendered) {
for (var i=0; i<Math.min(4,formulas.length); i++) { var formulas = this.toolbar.btnInsertFormula.menu.items;
formulas[i].setCaption(this.api.asc_getFormulaLocaleName(formulas[i].value)); for (var i=0; i<Math.min(4,formulas.length); i++) {
formulas[i].setCaption(this.api.asc_getFormulaLocaleName(formulas[i].value));
}
} }
}, },

View file

@ -212,8 +212,8 @@ define([
this.items[10][(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 || this.items[10][(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
this.items[11][this.mode.isEdit?'show':'hide'](); this.items[11][(this.mode.isEdit || this.mode.canComments)?'show':'hide']();
this.items[11].$el.find('+.devider')[this.mode.isEdit?'show':'hide'](); this.items[11].$el.find('+.devider')[(this.mode.isEdit || this.mode.canComments)?'show':'hide']();
this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() :
this.$el.find('#fm-btn-back').hide().prev().hide(); this.$el.find('#fm-btn-back').hide().prev().hide();

View file

@ -439,14 +439,14 @@ define([
template: _.template([ template: _.template([
'<table class="main"><tbody>', '<table class="main"><tbody>',
/** coauthoring begin **/ /** coauthoring begin **/
'<tr class="coauth">', '<tr class="comments">',
'<td class="left"><label><%= scope.txtLiveComment %></label></td>', '<td class="left"><label><%= scope.txtLiveComment %></label></td>',
'<td class="right"><div id="fms-chb-live-comment"/></td>', '<td class="right"><div id="fms-chb-live-comment"/></td>',
'</tr>','<tr class="divider coauth"></tr>', '</tr>','<tr class="divider comments"></tr>',
'<tr class="coauth">', '<tr class="comments">',
'<td class="left"></td>', '<td class="left"></td>',
'<td class="right"><div id="fms-chb-resolved-comment"/></td>', '<td class="right"><div id="fms-chb-resolved-comment"/></td>',
'</tr>','<tr class="divider coauth"></tr>', '</tr>','<tr class="divider comments"></tr>',
'<tr class="autosave">', '<tr class="autosave">',
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>', '<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>', '<td class="right"><span id="fms-chb-autosave" /></td>',
@ -480,12 +480,12 @@ define([
'<div><div id="fms-cmb-func-locale" style="display: inline-block; margin-right: 15px;"/>', '<div><div id="fms-cmb-func-locale" style="display: inline-block; margin-right: 15px;"/>',
'<label id="fms-lbl-func-locale" style="vertical-align: middle;"><%= scope.strFuncLocaleEx %></label></div></td>', '<label id="fms-lbl-func-locale" style="vertical-align: middle;"><%= scope.strFuncLocaleEx %></label></div></td>',
'</tr>','<tr class="divider edit"></tr>', '</tr>','<tr class="divider edit"></tr>',
'<tr>', '<tr class="edit">',
'<td class="left"><label><%= scope.strRegSettings %></label></td>', '<td class="left"><label><%= scope.strRegSettings %></label></td>',
'<td class="right">', '<td class="right">',
'<div><div id="fms-cmb-reg-settings" style="display: inline-block; margin-right: 15px;"/>', '<div><div id="fms-cmb-reg-settings" style="display: inline-block; margin-right: 15px;"/>',
'<label id="fms-lbl-reg-settings" style="vertical-align: middle;"></label></div></td>', '<label id="fms-lbl-reg-settings" style="vertical-align: middle;"></label></div></td>',
'</tr>','<tr class="divider"></tr>', '</tr>','<tr class="divider edit"></tr>',
'<tr>', '<tr>',
'<td class="left"></td>', '<td class="left"></td>',
'<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>', '<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
@ -670,13 +670,14 @@ define([
setMode: function(mode) { setMode: function(mode) {
this.mode = mode; this.mode = mode;
$('tr.edit', this.el)[mode.isEdit ? 'show' : 'hide']();
$('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide'](); $('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide']();
if (this.mode.isDesktopApp && this.mode.isOffline) { if (this.mode.isDesktopApp && this.mode.isOffline) {
this.chAutosave.setCaption(this.strAutoRecover); this.chAutosave.setCaption(this.strAutoRecover);
this.lblAutosave.text(this.textAutoRecover); this.lblAutosave.text(this.textAutoRecover);
} }
$('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide']();
$('tr.coauth', this.el)[mode.canCoAuthoring && mode.isEdit ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring && mode.canComments ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide']();
}, },