2016-04-01 13:17:09 +00:00
/ *
*
2019-01-17 13:05:03 +00:00
* ( c ) Copyright Ascensio System SIA 2010 - 2019
2016-04-01 13:17:09 +00:00
*
* This program is a free software product . You can redistribute it and / or
* modify it under the terms of the GNU Affero General Public License ( AGPL )
* version 3 as published by the Free Software Foundation . In accordance with
* Section 7 ( a ) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non - infringement
* of any third - party rights .
*
* This program is distributed WITHOUT ANY WARRANTY ; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . For
* details , see the GNU AGPL at : http : //www.gnu.org/licenses/agpl-3.0.html
*
2019-01-17 13:00:34 +00:00
* You can contact Ascensio System SIA at 20 A - 12 Ernesta Birznieka - Upisha
* street , Riga , Latvia , EU , LV - 1050.
2016-04-01 13:17:09 +00:00
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices , as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7 ( b ) of the License you must retain the original Product
* logo when distributing the program . Pursuant to Section 7 ( e ) we decline to
* grant you any rights under trademark law for use of our trademarks .
*
* All the Product ' s GUI elements , including illustrations and icon sets , as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution - ShareAlike 4.0 International . See the License
* terms at http : //creativecommons.org/licenses/by-sa/4.0/legalcode
*
* /
2016-03-11 00:48:53 +00:00
/ * *
* ReviewChanges . js
*
* View
*
* Created by Julia . Radzhabova on 05.08 . 15
2018-03-01 12:16:38 +00:00
* Copyright ( c ) 2018 Ascensio System SIA . All rights reserved .
2016-03-11 00:48:53 +00:00
*
* /
if ( Common === undefined )
var Common = { } ;
Common . Views = Common . Views || { } ;
define ( [
'common/main/lib/util/utils' ,
'common/main/lib/component/Button' ,
'common/main/lib/component/DataView' ,
'common/main/lib/component/Layout' ,
'common/main/lib/component/Window'
2018-06-07 14:09:54 +00:00
] , function ( ) {
2016-03-11 00:48:53 +00:00
'use strict' ;
2021-12-29 16:32:43 +00:00
if ( ! Common . enumLock )
Common . enumLock = { } ;
var enumLock = {
2021-12-29 22:01:53 +00:00
noSpellcheckLangs : 'no-spellcheck-langs' ,
2021-12-29 16:32:43 +00:00
isReviewOnly : 'review-only' ,
reviewChangelock : 'review-change-lock' ,
hasCoeditingUsers : 'has-coediting-users' ,
previewReviewMode : 'preview-review-mode' , // display mode on Collaboration tab
viewFormMode : 'view-form-mode' , // view form mode on Forms tab
2022-01-10 08:59:51 +00:00
viewMode : 'view-mode' , // view mode on disconnect, version history etc (used for locking buttons not in toolbar)
2021-12-29 22:01:53 +00:00
hideComments : 'hide-comments' , // no live comments and left panel is closed
cantShare : 'cant-share'
2021-12-29 16:32:43 +00:00
} ;
for ( var key in enumLock ) {
if ( enumLock . hasOwnProperty ( key ) ) {
Common . enumLock [ key ] = enumLock [ key ] ;
}
}
2017-02-21 09:48:23 +00:00
Common . Views . ReviewChanges = Common . UI . BaseView . extend ( _ . extend ( ( function ( ) {
2017-02-27 12:04:18 +00:00
var template =
'<section id="review-changes-panel" class="panel" data-tab="review">' +
2020-10-08 08:11:34 +00:00
'<div class="group no-group-mask review">' +
2017-10-07 13:06:51 +00:00
'<span id="slot-btn-sharing" class="btn-slot text x-huge"></span>' +
'<span id="slot-btn-coauthmode" class="btn-slot text x-huge"></span>' +
2017-02-27 12:04:18 +00:00
'</div>' +
2020-06-05 13:10:48 +00:00
'<div class="separator long sharing"></div>' +
2017-02-27 12:04:18 +00:00
'<div class="group">' +
2017-03-29 16:24:20 +00:00
'<span class="btn-slot text x-huge slot-comment"></span>' +
2019-10-18 10:28:30 +00:00
'<span class="btn-slot text x-huge" id="slot-comment-remove"></span>' +
2021-04-06 07:53:53 +00:00
'<span class="btn-slot text x-huge" id="slot-comment-resolve"></span>' +
2017-02-27 12:04:18 +00:00
'</div>' +
2020-06-05 13:10:48 +00:00
'<div class="separator long comments"></div>' +
2017-02-27 12:04:18 +00:00
'<div class="group">' +
2017-03-29 16:24:20 +00:00
'<span id="btn-review-on" class="btn-slot text x-huge"></span>' +
2017-08-23 14:49:56 +00:00
'</div>' +
2020-10-08 08:11:34 +00:00
'<div class="group no-group-mask review" style="padding-left: 0;">' +
2017-08-23 14:49:56 +00:00
'<span id="btn-review-view" class="btn-slot text x-huge"></span>' +
'</div>' +
2017-10-09 12:03:50 +00:00
'<div class="group move-changes" style="padding-left: 0;">' +
2017-03-29 16:24:20 +00:00
'<span id="btn-change-prev" class="btn-slot text x-huge"></span>' +
'<span id="btn-change-next" class="btn-slot text x-huge"></span>' +
'<span id="btn-change-accept" class="btn-slot text x-huge"></span>' +
'<span id="btn-change-reject" class="btn-slot text x-huge"></span>' +
2017-02-27 12:04:18 +00:00
'</div>' +
2020-06-05 13:10:48 +00:00
'<div class="separator long review"></div>' +
2019-08-13 14:40:52 +00:00
'<div class="group">' +
'<span id="btn-compare" class="btn-slot text x-huge"></span>' +
'</div>' +
2020-06-05 13:10:48 +00:00
'<div class="separator long compare"></div>' +
2020-10-08 08:11:34 +00:00
'<div class="group no-group-mask review form-view">' +
2017-10-10 12:14:27 +00:00
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
'</div>' +
2020-06-05 13:10:48 +00:00
'<div class="separator long chat"></div>' +
2020-10-08 08:11:34 +00:00
'<div class="group no-group-mask review form-view">' +
2017-10-09 12:37:12 +00:00
'<span id="slot-btn-history" class="btn-slot text x-huge"></span>' +
'</div>' +
2017-02-27 12:04:18 +00:00
'</section>' ;
function setEvents ( ) {
var me = this ;
2017-04-05 09:11:15 +00:00
if ( me . appConfig . canReview ) {
this . btnAccept . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:accept' , [ me . btnAccept , 'current' ] ) ;
} ) ;
2017-02-27 12:04:18 +00:00
2020-08-04 19:20:20 +00:00
this . btnAccept . menu && this . btnAccept . menu . on ( 'item:click' , function ( menu , item , e ) {
2017-04-05 09:11:15 +00:00
me . fireEvent ( 'reviewchange:accept' , [ menu , item ] ) ;
} ) ;
2017-02-27 12:04:18 +00:00
2017-04-05 09:11:15 +00:00
this . btnReject . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:reject' , [ me . btnReject , 'current' ] ) ;
} ) ;
2017-03-29 11:19:57 +00:00
2020-08-04 19:20:20 +00:00
this . btnReject . menu && this . btnReject . menu . on ( 'item:click' , function ( menu , item , e ) {
2017-04-05 09:11:15 +00:00
me . fireEvent ( 'reviewchange:reject' , [ menu , item ] ) ;
} ) ;
2017-03-29 11:19:57 +00:00
2019-11-28 10:15:59 +00:00
if ( me . appConfig . canFeatureComparison ) {
this . btnCompare . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:compare' , [ 'file' ] ) ;
} ) ;
2019-08-13 14:40:52 +00:00
2019-11-28 10:15:59 +00:00
this . btnCompare . menu . on ( 'item:click' , function ( menu , item , e ) {
me . fireEvent ( 'reviewchange:compare' , [ item . value ] ) ;
} ) ;
}
2019-08-13 14:40:52 +00:00
2017-04-05 09:11:15 +00:00
this . btnsTurnReview . forEach ( function ( button ) {
2021-02-10 10:09:21 +00:00
button . on ( 'click' , function ( btn , e ) {
Common . NotificationCenter . trigger ( 'reviewchanges:turn' , btn . pressed ) ;
Common . NotificationCenter . trigger ( 'edit:complete' ) ;
} ) ;
! me . appConfig . isReviewOnly && button . menu . on ( 'item:toggle' , function ( menu , item , state , e ) {
if ( ! ! state ) {
if ( item . value == 2 ) // ON track changes for everyone
Common . UI . warning ( {
title : me . textWarnTrackChangesTitle ,
msg : me . textWarnTrackChanges ,
maxwidth : 600 ,
buttons : [ {
value : 'enable' ,
caption : me . textEnable
} , 'cancel' ] ,
primary : 'enable' ,
callback : function ( btn ) {
if ( btn == 'enable' ) {
Common . NotificationCenter . trigger ( 'reviewchanges:turn' , item . value == 0 || item . value == 2 , item . value > 1 ) ;
} else {
var old = Common . Utils . InternalSettings . get ( me . appPrefix + "track-changes" ) ;
me . turnChanges ( old == 0 || old == 2 , old > 1 ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' ) ;
}
} ) ;
else
Common . NotificationCenter . trigger ( 'reviewchanges:turn' , item . value == 0 || item . value == 2 , item . value > 1 ) ;
}
} ) ;
2017-04-05 09:11:15 +00:00
} ) ;
2018-12-18 14:27:19 +00:00
}
2019-01-22 13:47:19 +00:00
if ( this . appConfig . canViewReview ) {
this . btnPrev . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:preview' , [ me . btnPrev , 'prev' ] ) ;
} ) ;
this . btnNext . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:preview' , [ me . btnNext , 'next' ] ) ;
} ) ;
2019-03-28 13:35:27 +00:00
this . btnReviewView && this . btnReviewView . menu . on ( 'item:click' , function ( menu , item , e ) {
2019-08-13 14:40:52 +00:00
me . fireEvent ( 'reviewchange:view' , [ menu , item ] ) ;
2017-08-23 14:49:56 +00:00
} ) ;
2019-01-22 13:47:19 +00:00
}
2017-04-04 15:22:02 +00:00
this . btnsSpelling . forEach ( function ( button ) {
button . on ( 'click' , function ( b , e ) {
Common . NotificationCenter . trigger ( 'spelling:turn' , b . pressed ? 'on' : 'off' ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
} ) ;
} ) ;
2017-10-09 12:03:50 +00:00
this . btnsDocLang . forEach ( function ( button ) {
button . on ( 'click' , function ( b , e ) {
me . fireEvent ( 'lang:document' , this ) ;
} ) ;
2017-04-04 15:22:02 +00:00
} ) ;
2017-10-07 13:06:51 +00:00
this . btnSharing && this . btnSharing . on ( 'click' , function ( btn , e ) {
Common . NotificationCenter . trigger ( 'collaboration:sharing' ) ;
} ) ;
this . btnCoAuthMode && this . btnCoAuthMode . menu . on ( 'item:click' , function ( menu , item , e ) {
me . fireEvent ( 'collaboration:coauthmode' , [ menu , item ] ) ;
} ) ;
2017-10-09 12:37:12 +00:00
this . btnHistory && this . btnHistory . on ( 'click' , function ( btn , e ) {
Common . NotificationCenter . trigger ( 'collaboration:history' ) ;
} ) ;
2017-10-10 12:14:27 +00:00
this . btnChat && this . btnChat . on ( 'click' , function ( btn , e ) {
me . fireEvent ( 'collaboration:chat' , [ btn . pressed ] ) ;
2017-04-04 15:22:02 +00:00
} ) ;
2019-10-18 10:28:30 +00:00
if ( this . btnCommentRemove ) {
this . btnCommentRemove . on ( 'click' , function ( e ) {
me . fireEvent ( 'comment:removeComments' , [ 'current' ] ) ;
} ) ;
this . btnCommentRemove . menu . on ( 'item:click' , function ( menu , item , e ) {
me . fireEvent ( 'comment:removeComments' , [ item . value ] ) ;
} ) ;
}
2021-04-06 07:53:53 +00:00
if ( this . btnCommentResolve ) {
this . btnCommentResolve . on ( 'click' , function ( e ) {
me . fireEvent ( 'comment:resolveComments' , [ 'current' ] ) ;
} ) ;
this . btnCommentResolve . menu . on ( 'item:click' , function ( menu , item , e ) {
me . fireEvent ( 'comment:resolveComments' , [ item . value ] ) ;
} ) ;
}
2022-09-27 22:01:27 +00:00
Common . NotificationCenter . on ( 'protect:doclock' , function ( e ) {
me . fireEvent ( 'protect:update' ) ;
} ) ;
me . fireEvent ( 'protect:update' ) ;
2017-02-27 12:04:18 +00:00
}
2017-02-21 09:48:23 +00:00
return {
2017-04-05 09:11:15 +00:00
// el: '#review-changes-panel',
2016-03-11 00:48:53 +00:00
2017-02-21 09:48:23 +00:00
options : { } ,
2016-03-11 00:48:53 +00:00
2017-02-21 09:48:23 +00:00
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , options ) ;
2017-04-05 09:11:15 +00:00
this . appConfig = options . mode ;
2021-12-29 22:01:53 +00:00
this . lockedControls = [ ] ;
2021-04-01 10:36:08 +00:00
var filter = Common . localStorage . getKeysFilter ( ) ;
this . appPrefix = ( filter && filter . length ) ? filter . split ( ',' ) [ 0 ] : '' ;
2021-12-29 22:01:53 +00:00
var _set = Common . enumLock ;
2017-04-05 09:11:15 +00:00
if ( this . appConfig . canReview ) {
this . btnAccept = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
caption : this . txtAccept ,
2020-08-04 19:20:20 +00:00
split : ! this . appConfig . canUseReviewPermissions ,
2021-05-26 15:30:18 +00:00
iconCls : 'toolbar__icon btn-review-save' ,
2022-09-26 20:34:59 +00:00
lock : [ _set . reviewChangelock , _set . isReviewOnly , _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments , _set . docLockReview ] ,
2021-05-26 15:30:18 +00:00
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-04-05 09:11:15 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnAccept ) ;
2017-02-21 09:48:23 +00:00
2017-04-05 09:11:15 +00:00
this . btnReject = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
caption : this . txtReject ,
2020-08-04 19:20:20 +00:00
split : ! this . appConfig . canUseReviewPermissions ,
2021-05-26 15:30:18 +00:00
iconCls : 'toolbar__icon btn-review-deny' ,
2022-09-26 20:34:59 +00:00
lock : [ _set . reviewChangelock , _set . isReviewOnly , _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments , _set . docLockReview ] ,
2021-05-26 15:30:18 +00:00
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-04-05 09:11:15 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnReject ) ;
2016-03-11 00:48:53 +00:00
2021-12-29 22:01:53 +00:00
if ( this . appConfig . canFeatureComparison ) {
2019-11-28 10:15:59 +00:00
this . btnCompare = new Common . UI . Button ( {
2021-12-29 22:01:53 +00:00
cls : 'btn-toolbar x-huge icon-top' ,
caption : this . txtCompare ,
split : true ,
2021-06-01 17:07:24 +00:00
iconCls : 'toolbar__icon btn-compare' ,
2022-09-23 20:43:09 +00:00
lock : [ _set . hasCoeditingUsers , _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments ] ,
2021-06-01 17:07:24 +00:00
dataHint : '1' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2019-11-28 10:15:59 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnCompare ) ;
}
2017-04-05 09:11:15 +00:00
this . btnTurnOn = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-review' ,
2022-09-26 20:34:59 +00:00
lock : [ _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments , _set . docLockReview ] ,
2017-04-05 09:11:15 +00:00
caption : this . txtTurnon ,
2021-02-10 10:09:21 +00:00
split : ! this . appConfig . isReviewOnly ,
2021-05-26 15:30:18 +00:00
enableToggle : true ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-04-05 09:11:15 +00:00
} ) ;
this . btnsTurnReview = [ this . btnTurnOn ] ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnTurnOn ) ;
2018-12-18 14:27:19 +00:00
}
if ( this . appConfig . canViewReview ) {
2019-01-22 13:47:19 +00:00
this . btnPrev = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-review-prev' ,
2022-09-23 20:43:09 +00:00
lock : [ _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments ] ,
2021-05-26 15:30:18 +00:00
caption : this . txtPrev ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2019-01-22 13:47:19 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnPrev ) ;
2019-01-22 13:47:19 +00:00
this . btnNext = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-review-next' ,
2022-09-23 20:43:09 +00:00
lock : [ _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments ] ,
2021-05-26 15:30:18 +00:00
caption : this . txtNext ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2019-01-22 13:47:19 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnNext ) ;
2019-01-22 13:47:19 +00:00
2021-07-19 10:42:03 +00:00
if ( ! this . appConfig . isRestrictedEdit && ! ( this . appConfig . customization && this . appConfig . customization . review && this . appConfig . customization . review . hideReviewDisplay ) ) { // hide Display mode option for fillForms and commenting mode
2019-06-13 14:37:56 +00:00
var menuTemplate = _ . template ( '<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div>' +
'<% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label>' +
'<% } %></a>' ) ;
2019-03-28 13:35:27 +00:00
this . btnReviewView = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-reviewview' ,
2022-09-23 20:43:09 +00:00
lock : [ _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments ] ,
2019-03-28 13:35:27 +00:00
caption : this . txtView ,
2019-06-13 14:37:56 +00:00
menu : new Common . UI . Menu ( {
cls : 'ppm-toolbar' ,
items : [
{
caption : this . txtMarkupCap ,
checkable : true ,
toggleGroup : 'menuReviewView' ,
checked : true ,
value : 'markup' ,
template : menuTemplate ,
2021-09-03 14:38:49 +00:00
description : Common . Utils . String . format ( this . txtMarkup , ! this . appConfig . isEdit && ! this . appConfig . isRestrictedEdit ? '' : '(' + this . txtEditing + ')' )
2019-06-13 14:37:56 +00:00
} ,
2021-08-04 10:19:19 +00:00
{
caption : this . txtMarkupSimpleCap ,
checkable : true ,
toggleGroup : 'menuReviewView' ,
checked : false ,
value : 'simple' ,
template : menuTemplate ,
2021-09-03 14:38:49 +00:00
description : Common . Utils . String . format ( this . txtMarkupSimple , ! this . appConfig . isEdit && ! this . appConfig . isRestrictedEdit ? '' : '(' + this . txtEditing + ')' )
2021-08-04 10:19:19 +00:00
} ,
2019-06-13 14:37:56 +00:00
{
caption : this . txtFinalCap ,
checkable : true ,
toggleGroup : 'menuReviewView' ,
checked : false ,
template : menuTemplate ,
2021-09-03 14:38:49 +00:00
description : Common . Utils . String . format ( this . txtFinal , ! this . appConfig . isEdit && ! this . appConfig . isRestrictedEdit ? '' : '(' + this . txtPreview + ')' ) ,
2019-06-13 14:37:56 +00:00
value : 'final'
} ,
{
caption : this . txtOriginalCap ,
checkable : true ,
toggleGroup : 'menuReviewView' ,
checked : false ,
template : menuTemplate ,
2021-09-03 14:38:49 +00:00
description : Common . Utils . String . format ( this . txtOriginal , ! this . appConfig . isEdit && ! this . appConfig . isRestrictedEdit ? '' : '(' + this . txtPreview + ')' ) ,
2019-06-13 14:37:56 +00:00
value : 'original'
}
]
2021-05-26 15:30:18 +00:00
} ) ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2019-03-28 13:35:27 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnReviewView ) ;
2019-06-13 14:37:56 +00:00
}
2017-04-05 09:11:15 +00:00
}
2016-03-11 00:48:53 +00:00
2019-11-28 13:54:14 +00:00
if ( ( ! ! this . appConfig . sharingSettingsUrl && this . appConfig . sharingSettingsUrl . length || this . appConfig . canRequestSharingSettings ) && this . _readonlyRights !== true ) {
2017-10-07 13:06:51 +00:00
this . btnSharing = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-sharing' ,
2021-12-30 11:49:19 +00:00
lock : [ _set . viewFormMode , _set . cantShare , _set . lostConnect ] ,
2021-06-01 17:07:24 +00:00
caption : this . txtSharing ,
dataHint : '1' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-10-07 13:06:51 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnSharing ) ;
2017-10-07 13:06:51 +00:00
}
2017-03-29 11:19:57 +00:00
2021-04-02 08:08:36 +00:00
if ( this . appConfig . isEdit && ! this . appConfig . isOffline && this . appConfig . canCoAuthoring && this . appConfig . canChangeCoAuthoring ) {
2017-10-07 13:06:51 +00:00
this . btnCoAuthMode = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-coedit' ,
2022-09-23 12:13:58 +00:00
lock : [ _set . viewFormMode , _set . lostConnect , _set . docLockView ] ,
2017-10-07 13:06:51 +00:00
caption : this . txtCoAuthMode ,
2021-05-26 15:30:18 +00:00
menu : true ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-10-07 13:06:51 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnCoAuthMode ) ;
2017-10-07 13:06:51 +00:00
}
2017-10-09 12:03:50 +00:00
this . btnsSpelling = [ ] ;
this . btnsDocLang = [ ] ;
2017-04-04 15:14:47 +00:00
2017-10-09 12:37:12 +00:00
if ( this . appConfig . canUseHistory && ! this . appConfig . isDisconnected ) {
this . btnHistory = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-history' ,
2021-12-29 22:01:53 +00:00
lock : [ _set . lostConnect ] ,
2021-05-26 15:30:18 +00:00
caption : this . txtHistory ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-10-09 12:37:12 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnHistory ) ;
2017-10-09 12:37:12 +00:00
}
2017-10-10 12:14:27 +00:00
if ( this . appConfig . canCoAuthoring && this . appConfig . canChat ) {
this . btnChat = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-chat' ,
2021-12-29 22:01:53 +00:00
lock : [ _set . lostConnect ] ,
2017-10-10 12:14:27 +00:00
caption : this . txtChat ,
2021-05-26 15:30:18 +00:00
enableToggle : true ,
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2017-10-10 12:14:27 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnChat ) ;
2017-10-10 12:14:27 +00:00
}
2019-10-18 10:28:30 +00:00
if ( this . appConfig . canCoAuthoring && this . appConfig . canComments ) {
this . btnCommentRemove = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
caption : this . txtCommentRemove ,
split : true ,
2021-05-26 15:30:18 +00:00
iconCls : 'toolbar__icon btn-rem-comment' ,
2022-09-23 19:07:05 +00:00
lock : [ _set . previewReviewMode , _set . viewFormMode , _set . hideComments , _set [ 'Objects' ] , _set . lostConnect , _set . docLockView , _set . docLockForms ] ,
2021-05-26 15:30:18 +00:00
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2019-10-18 10:28:30 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnCommentRemove ) ;
2021-04-06 07:53:53 +00:00
this . btnCommentResolve = new Common . UI . Button ( {
cls : 'btn-toolbar x-huge icon-top' ,
caption : this . txtCommentResolve ,
split : true ,
2021-05-26 15:30:18 +00:00
iconCls : 'toolbar__icon btn-resolve-all' ,
2022-09-23 19:07:05 +00:00
lock : [ _set . previewReviewMode , _set . viewFormMode , _set . hideComments , _set [ 'Objects' ] , _set . lostConnect , _set . docLockView , _set . docLockForms ] ,
2021-05-26 15:30:18 +00:00
dataHint : '1' ,
2021-06-01 17:07:24 +00:00
dataHintDirection : 'bottom' ,
dataHintOffset : 'small'
2021-04-06 07:53:53 +00:00
} ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( this . btnCommentResolve ) ;
2019-10-18 10:28:30 +00:00
}
2017-02-27 12:04:18 +00:00
} ,
render : function ( el ) {
2017-02-21 09:48:23 +00:00
this . boxSdk = $ ( '#editor_sdk' ) ;
2017-02-27 12:04:18 +00:00
if ( el ) el . html ( this . getPanel ( ) ) ;
2016-03-11 00:48:53 +00:00
2017-02-27 12:04:18 +00:00
return this ;
2017-02-21 09:48:23 +00:00
} ,
2016-03-11 00:48:53 +00:00
2017-04-04 15:14:47 +00:00
onAppReady : function ( config ) {
var me = this ;
( new Promise ( function ( accept , reject ) {
accept ( ) ;
} ) ) . then ( function ( ) {
2017-11-07 12:00:58 +00:00
var menuTemplate = _ . template ( '<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div>' +
'<% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label>' +
'<% } %></a>' ) ;
2017-04-05 09:11:15 +00:00
if ( config . canReview ) {
2021-02-10 10:09:21 +00:00
var idx = Common . Utils . InternalSettings . get ( me . appPrefix + "track-changes" ) ;
! config . isReviewOnly && me . btnTurnOn . setMenu (
new Common . UI . Menu ( { items : [
{
caption : me . txtOn ,
value : 0 ,
checkable : true ,
checked : idx == 0 ,
toggleGroup : 'menuTurnReviewTlb'
} ,
{
caption : me . txtOff ,
value : 1 ,
checkable : true ,
checked : idx == 1 ,
toggleGroup : 'menuTurnReviewTlb'
} ,
{
caption : me . txtOnGlobal ,
value : 2 ,
checkable : true ,
checked : idx == 2 ,
toggleGroup : 'menuTurnReviewTlb'
} ,
{
caption : me . txtOffGlobal ,
value : 3 ,
checkable : true ,
checked : idx == 3 ,
toggleGroup : 'menuTurnReviewTlb'
}
] } )
) ;
2017-08-18 09:09:57 +00:00
me . btnTurnOn . updateHint ( me . tipReview ) ;
2017-04-05 09:11:15 +00:00
2020-08-04 19:20:20 +00:00
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'
}
]
} )
) ;
}
2017-09-07 11:47:59 +00:00
me . btnAccept . updateHint ( [ me . tipAcceptCurrent , me . txtAcceptChanges ] ) ;
me . btnReject . updateHint ( [ me . tipRejectCurrent , me . txtRejectChanges ] ) ;
2017-04-05 09:11:15 +00:00
2019-11-28 10:15:59 +00:00
if ( config . canFeatureComparison ) {
me . btnCompare . setMenu ( new Common . UI . Menu ( {
items : [
{ caption : me . mniFromFile , value : 'file' } ,
{ caption : me . mniFromUrl , value : 'url' } ,
{ caption : me . mniFromStorage , value : 'storage' }
// ,{caption: '--'},
// {caption: me.mniSettings, value: 'settings'}
]
} ) ) ;
me . btnCompare . menu . items [ 2 ] . setVisible ( me . appConfig . canRequestCompareFile || me . appConfig . fileChoiceUrl && me . appConfig . fileChoiceUrl . indexOf ( "{documentType}" ) > - 1 ) ;
me . btnCompare . updateHint ( me . tipCompare ) ;
}
2019-08-13 14:40:52 +00:00
2021-12-29 22:01:53 +00:00
Common . Utils . lockControls ( Common . enumLock . isReviewOnly , config . isReviewOnly , { array : [ me . btnAccept , me . btnReject ] } ) ;
2018-12-18 14:27:19 +00:00
}
if ( me . appConfig . canViewReview ) {
2019-01-22 13:47:19 +00:00
me . btnPrev . updateHint ( me . hintPrev ) ;
me . btnNext . updateHint ( me . hintNext ) ;
2019-03-28 13:35:27 +00:00
me . btnReviewView && me . btnReviewView . updateHint ( me . tipReviewView ) ;
2017-04-05 09:11:15 +00:00
}
2017-10-07 13:06:51 +00:00
me . btnSharing && me . btnSharing . updateHint ( me . tipSharing ) ;
2017-10-09 12:37:12 +00:00
me . btnHistory && me . btnHistory . updateHint ( me . tipHistory ) ;
2017-10-10 12:14:27 +00:00
me . btnChat && me . btnChat . updateHint ( me . txtChat + Common . Utils . String . platformKey ( 'Alt+Q' ) ) ;
2017-10-09 12:37:12 +00:00
2017-10-07 13:06:51 +00:00
if ( me . btnCoAuthMode ) {
me . btnCoAuthMode . setMenu (
new Common . UI . Menu ( {
cls : 'ppm-toolbar' ,
2017-10-19 12:11:51 +00:00
style : 'max-width: 220px;' ,
2017-10-07 13:06:51 +00:00
items : [
{
caption : me . strFast ,
checkable : true ,
toggleGroup : 'menuCoauthMode' ,
checked : true ,
2017-10-19 12:11:51 +00:00
template : menuTemplate ,
description : me . strFastDesc ,
2017-10-07 13:06:51 +00:00
value : 1
} ,
{
caption : me . strStrict ,
checkable : true ,
toggleGroup : 'menuCoauthMode' ,
checked : false ,
2017-10-19 12:11:51 +00:00
template : menuTemplate ,
description : me . strStrictDesc ,
2017-10-07 13:06:51 +00:00
value : 0
}
]
} ) ) ;
me . btnCoAuthMode . updateHint ( me . tipCoAuthMode ) ;
2021-04-01 10:36:08 +00:00
me . turnCoAuthMode ( Common . Utils . InternalSettings . get ( me . appPrefix + "settings-coauthmode" ) ) ;
2017-04-05 09:11:15 +00:00
}
2017-04-04 15:14:47 +00:00
2019-10-18 10:28:30 +00:00
if ( me . btnCommentRemove ) {
var items = [
{
2021-02-04 09:39:56 +00:00
caption : config . canDeleteComments ? me . txtCommentRemCurrent : me . txtCommentRemMyCurrent ,
2019-10-18 10:28:30 +00:00
value : 'current'
} ,
{
caption : me . txtCommentRemMy ,
value : 'my'
}
] ;
2021-02-04 09:39:56 +00:00
if ( config . canDeleteComments )
2019-10-18 10:28:30 +00:00
items . push ( {
caption : me . txtCommentRemAll ,
value : 'all'
} ) ;
me . btnCommentRemove . setMenu (
new Common . UI . Menu ( { items : items } )
) ;
me . btnCommentRemove . updateHint ( [ me . tipCommentRemCurrent , me . tipCommentRem ] ) ;
}
2021-04-06 07:53:53 +00:00
if ( me . btnCommentResolve ) {
var items = [
{
caption : config . canEditComments ? me . txtCommentResolveCurrent : me . txtCommentResolveMyCurrent ,
value : 'current'
} ,
{
caption : me . txtCommentResolveMy ,
value : 'my'
}
] ;
if ( config . canEditComments )
items . push ( {
caption : me . txtCommentResolveAll ,
value : 'all'
} ) ;
me . btnCommentResolve . setMenu (
new Common . UI . Menu ( { items : items } )
) ;
me . btnCommentResolve . updateHint ( [ me . tipCommentResolveCurrent , me . tipCommentResolve ] ) ;
}
2017-10-11 14:52:04 +00:00
var separator _sharing = ! ( me . btnSharing || me . btnCoAuthMode ) ? me . $el . find ( '.separator.sharing' ) : '.separator.sharing' ,
separator _comments = ! ( config . canComments && config . canCoAuthoring ) ? me . $el . find ( '.separator.comments' ) : '.separator.comments' ,
2018-12-18 14:27:19 +00:00
separator _review = ! ( config . canReview || config . canViewReview ) ? me . $el . find ( '.separator.review' ) : '.separator.review' ,
2019-11-28 10:15:59 +00:00
separator _compare = ! ( config . canReview && config . canFeatureComparison ) ? me . $el . find ( '.separator.compare' ) : '.separator.compare' ,
2017-10-11 14:52:04 +00:00
separator _chat = ! me . btnChat ? me . $el . find ( '.separator.chat' ) : '.separator.chat' ,
separator _last ;
if ( typeof separator _sharing == 'object' )
separator _sharing . hide ( ) . prev ( '.group' ) . hide ( ) ;
else
separator _last = separator _sharing ;
if ( typeof separator _comments == 'object' )
separator _comments . hide ( ) . prev ( '.group' ) . hide ( ) ;
else
separator _last = separator _comments ;
if ( typeof separator _review == 'object' )
separator _review . hide ( ) . prevUntil ( '.separator.comments' ) . hide ( ) ;
else
separator _last = separator _review ;
2019-08-13 14:40:52 +00:00
if ( typeof separator _compare == 'object' )
separator _compare . hide ( ) . prev ( '.group' ) . hide ( ) ;
else
separator _last = separator _compare ;
2017-10-11 14:52:04 +00:00
if ( typeof separator _chat == 'object' )
separator _chat . hide ( ) . prev ( '.group' ) . hide ( ) ;
else
separator _last = separator _chat ;
if ( ! me . btnHistory && separator _last )
me . $el . find ( separator _last ) . hide ( ) ;
2017-04-04 15:14:47 +00:00
2021-10-08 07:55:26 +00:00
Common . NotificationCenter . trigger ( 'tab:visible' , 'review' , ( config . isEdit || config . canViewReview || config . canCoAuthoring && config . canComments ) && Common . UI . LayoutManager . isElementVisible ( 'toolbar-collaboration' ) ) ;
2017-04-04 15:14:47 +00:00
setEvents . call ( me ) ;
} ) ;
} ,
2017-02-27 12:04:18 +00:00
getPanel : function ( ) {
2017-04-21 08:10:07 +00:00
this . $el = $ ( _ . template ( template ) ( { } ) ) ;
2017-04-05 09:11:15 +00:00
if ( this . appConfig . canReview ) {
this . btnAccept . render ( this . $el . find ( '#btn-change-accept' ) ) ;
this . btnReject . render ( this . $el . find ( '#btn-change-reject' ) ) ;
2019-11-28 10:15:59 +00:00
this . appConfig . canFeatureComparison && this . btnCompare . render ( this . $el . find ( '#btn-compare' ) ) ;
2017-04-05 09:11:15 +00:00
this . btnTurnOn . render ( this . $el . find ( '#btn-review-on' ) ) ;
}
2019-01-22 13:47:19 +00:00
this . btnPrev && this . btnPrev . render ( this . $el . find ( '#btn-change-prev' ) ) ;
this . btnNext && this . btnNext . render ( this . $el . find ( '#btn-change-next' ) ) ;
2018-12-18 14:27:19 +00:00
this . btnReviewView && this . btnReviewView . render ( this . $el . find ( '#btn-review-view' ) ) ;
2017-02-27 12:04:18 +00:00
2017-10-07 13:06:51 +00:00
this . btnSharing && this . btnSharing . render ( this . $el . find ( '#slot-btn-sharing' ) ) ;
this . btnCoAuthMode && this . btnCoAuthMode . render ( this . $el . find ( '#slot-btn-coauthmode' ) ) ;
2017-10-09 12:37:12 +00:00
this . btnHistory && this . btnHistory . render ( this . $el . find ( '#slot-btn-history' ) ) ;
2017-10-10 12:14:27 +00:00
this . btnChat && this . btnChat . render ( this . $el . find ( '#slot-btn-chat' ) ) ;
2019-10-18 10:28:30 +00:00
this . btnCommentRemove && this . btnCommentRemove . render ( this . $el . find ( '#slot-comment-remove' ) ) ;
2021-04-06 07:53:53 +00:00
this . btnCommentResolve && this . btnCommentResolve . render ( this . $el . find ( '#slot-comment-resolve' ) ) ;
2017-02-27 12:04:18 +00:00
2017-04-05 09:11:15 +00:00
return this . $el ;
2017-02-21 09:48:23 +00:00
} ,
2016-03-11 00:48:53 +00:00
2017-02-21 09:48:23 +00:00
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this ) ;
this . fireEvent ( 'show' , this ) ;
} ,
2016-03-11 00:48:53 +00:00
2017-03-29 11:19:57 +00:00
getButton : function ( type , parent ) {
if ( type == 'turn' && parent == 'statusbar' ) {
var button = new Common . UI . Button ( {
cls : 'btn-toolbar' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-review' ,
2022-09-26 20:34:59 +00:00
lock : [ Common . enumLock . viewMode , Common . enumLock . previewReviewMode , Common . enumLock . viewFormMode , Common . enumLock . lostConnect , Common . enumLock . docLockView , Common . enumLock . docLockForms , Common . enumLock . docLockComments , Common . enumLock . docLockReview ] ,
2017-03-29 11:19:57 +00:00
hintAnchor : 'top' ,
hint : this . tipReview ,
2021-02-10 10:09:21 +00:00
split : ! this . appConfig . isReviewOnly ,
enableToggle : true ,
menu : this . appConfig . isReviewOnly ? false : new Common . UI . Menu ( {
menuAlign : 'bl-tl' ,
style : 'margin-top:-5px;' ,
items : [
{
caption : this . txtOn ,
value : 0 ,
checkable : true ,
toggleGroup : 'menuTurnReviewStb'
} ,
{
caption : this . txtOff ,
value : 1 ,
checkable : true ,
toggleGroup : 'menuTurnReviewStb'
} ,
{
caption : this . txtOnGlobal ,
value : 2 ,
checkable : true ,
toggleGroup : 'menuTurnReviewStb'
} ,
{
caption : this . txtOffGlobal ,
value : 3 ,
checkable : true ,
toggleGroup : 'menuTurnReviewStb'
}
2021-06-07 11:14:32 +00:00
] } ) ,
dataHint : '0' ,
dataHintDirection : 'top' ,
dataHintOffset : '2, -16'
2017-03-29 11:19:57 +00:00
} ) ;
this . btnsTurnReview . push ( button ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( button ) ;
2017-04-04 15:22:02 +00:00
return button ;
} else
if ( type == 'spelling' ) {
button = new Common . UI . Button ( {
cls : 'btn-toolbar' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-docspell' ,
2022-09-23 20:43:09 +00:00
lock : [ Common . enumLock . viewMode , Common . enumLock . viewFormMode , Common . enumLock . previewReviewMode , Common . enumLock . docLockView , Common . enumLock . docLockForms , Common . enumLock . docLockComments ] ,
2017-04-04 15:22:02 +00:00
hintAnchor : 'top' ,
hint : this . tipSetSpelling ,
2021-06-07 11:14:32 +00:00
enableToggle : true ,
dataHint : '0' ,
dataHintDirection : 'top' ,
2021-11-01 18:13:34 +00:00
dataHintOffset : 'small' ,
visible : Common . UI . FeaturesManager . canChange ( 'spellcheck' )
2017-04-04 15:22:02 +00:00
} ) ;
this . btnsSpelling . push ( button ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( button ) ;
2017-10-09 12:03:50 +00:00
return button ;
} else if ( type == 'doclang' && parent == 'statusbar' ) {
button = new Common . UI . Button ( {
cls : 'btn-toolbar' ,
2019-11-21 07:58:05 +00:00
iconCls : 'toolbar__icon btn-ic-doclang' ,
2022-09-23 20:43:09 +00:00
lock : [ Common . enumLock . viewMode , Common . enumLock . previewReviewMode , Common . enumLock . viewFormMode , Common . enumLock . noSpellcheckLangs , Common . enumLock . lostConnect , Common . enumLock . docLockView , Common . enumLock . docLockForms , Common . enumLock . docLockComments ] ,
2017-10-09 12:03:50 +00:00
hintAnchor : 'top' ,
hint : this . tipSetDocLang ,
2021-06-07 11:14:32 +00:00
dataHint : '0' ,
dataHintDirection : 'top' ,
dataHintOffset : 'small'
2017-10-09 12:03:50 +00:00
} ) ;
this . btnsDocLang . push ( button ) ;
2021-12-29 22:01:53 +00:00
this . lockedControls . push ( button ) ;
Common . Utils . lockControls ( Common . enumLock . noSpellcheckLangs , true , { array : [ button ] } ) ;
2017-03-29 11:19:57 +00:00
return button ;
}
} ,
2021-12-29 22:01:53 +00:00
getButtons : function ( ) {
return this . lockedControls ;
} ,
2017-02-21 09:48:23 +00:00
getUserName : function ( username ) {
2021-03-26 11:29:16 +00:00
return Common . Utils . String . htmlEncode ( AscCommon . UserInfoParser . getParsedName ( username ) ) ;
2017-02-21 09:48:23 +00:00
} ,
2021-02-10 10:09:21 +00:00
turnChanges : function ( state , global ) {
2017-03-29 11:19:57 +00:00
this . btnsTurnReview . forEach ( function ( button ) {
if ( button && button . pressed != state ) {
button . toggle ( state , true ) ;
}
2021-02-10 10:09:21 +00:00
if ( button . menu ) {
button . menu . items [ 0 ] . setChecked ( state && ! global , true ) ;
button . menu . items [ 1 ] . setChecked ( ! state && ! global , true ) ;
button . menu . items [ 2 ] . setChecked ( state && ! ! global , true ) ;
button . menu . items [ 3 ] . setChecked ( ! state && ! ! global , true ) ;
}
2017-03-29 11:19:57 +00:00
} , this ) ;
} ,
markChanges : function ( status ) {
this . btnsTurnReview . forEach ( function ( button ) {
if ( button ) {
var _icon _el = $ ( '.icon' , button . cmpEl ) ;
_icon _el [ status ? 'addClass' : 'removeClass' ] ( 'btn-ic-changes' ) ;
}
} , this ) ;
} ,
2017-04-04 15:22:02 +00:00
turnSpelling : function ( state ) {
2021-11-01 18:13:34 +00:00
this . btnsSpelling && this . btnsSpelling . forEach ( function ( button ) {
2017-04-04 15:22:02 +00:00
if ( button && button . pressed != state ) {
button . toggle ( state , true ) ;
}
} , this ) ;
} ,
2017-10-07 13:06:51 +00:00
turnCoAuthMode : function ( fast ) {
if ( this . btnCoAuthMode ) {
this . btnCoAuthMode . menu . items [ 0 ] . setChecked ( fast , true ) ;
this . btnCoAuthMode . menu . items [ 1 ] . setChecked ( ! fast , true ) ;
}
} ,
2017-10-10 12:14:27 +00:00
turnChat : function ( state ) {
this . btnChat && this . btnChat . toggle ( state , true ) ;
} ,
2019-01-15 11:12:09 +00:00
turnDisplayMode : function ( mode ) {
if ( this . btnReviewView ) {
this . btnReviewView . menu . items [ 0 ] . setChecked ( mode == 'markup' , true ) ;
2021-08-04 10:19:19 +00:00
this . btnReviewView . menu . items [ 1 ] . setChecked ( mode == 'simple' , true ) ;
this . btnReviewView . menu . items [ 2 ] . setChecked ( mode == 'final' , true ) ;
this . btnReviewView . menu . items [ 3 ] . setChecked ( mode == 'original' , true ) ;
2019-01-15 11:12:09 +00:00
}
} ,
2017-06-15 13:35:55 +00:00
2017-10-07 13:06:51 +00:00
onLostEditRights : function ( ) {
this . _readonlyRights = true ;
2017-06-15 13:35:55 +00:00
} ,
2017-02-21 09:48:23 +00:00
txtAccept : 'Accept' ,
txtAcceptCurrent : 'Accept current Changes' ,
txtAcceptAll : 'Accept all Changes' ,
txtReject : 'Reject' ,
txtRejectCurrent : 'Reject current Changes' ,
2017-04-19 12:09:44 +00:00
txtRejectAll : 'Reject all Changes' ,
hintNext : 'To Next Change' ,
hintPrev : 'To Previous Change' ,
txtPrev : 'Previous' ,
txtNext : 'Next' ,
txtTurnon : 'Turn On' ,
txtSpelling : 'Spell checking' ,
txtDocLang : 'Language' ,
tipSetDocLang : 'Set Document Language' ,
tipSetSpelling : 'Spell checking' ,
2017-08-03 13:46:46 +00:00
tipReview : 'Review' ,
txtAcceptChanges : 'Accept Changes' ,
2017-08-23 14:49:56 +00:00
txtRejectChanges : 'Reject Changes' ,
2017-08-24 09:27:02 +00:00
txtView : 'Display Mode' ,
2021-09-03 14:38:49 +00:00
txtMarkup : 'Text with changes {0}' ,
txtFinal : 'All changes like accept {0}' ,
txtOriginal : 'Text without changes {0}' ,
2017-09-07 11:47:59 +00:00
tipReviewView : 'Select the way you want the changes to be displayed' ,
tipAcceptCurrent : 'Accept current changes' ,
2017-10-07 13:06:51 +00:00
tipRejectCurrent : 'Reject current changes' ,
txtSharing : 'Sharing' ,
tipSharing : 'Manage document access rights' ,
txtCoAuthMode : 'Co-editing Mode' ,
tipCoAuthMode : 'Set co-editing mode' ,
strFast : 'Fast' ,
2017-10-09 12:37:12 +00:00
strStrict : 'Strict' ,
txtHistory : 'Version History' ,
2017-10-10 12:14:27 +00:00
tipHistory : 'Show version history' ,
2017-10-19 12:11:51 +00:00
txtChat : 'Chat' ,
txtMarkupCap : 'Markup' ,
txtFinalCap : 'Final' ,
txtOriginalCap : 'Original' ,
strFastDesc : 'Real-time co-editing. All changes are saved automatically.' ,
2019-08-13 14:40:52 +00:00
strStrictDesc : 'Use the \'Save\' button to sync the changes you and others make.' ,
txtCompare : 'Compare' ,
tipCompare : 'Compare current document with another one' ,
mniFromFile : 'Document from File' ,
mniFromUrl : 'Document from URL' ,
mniFromStorage : 'Document from Storage' ,
2019-11-28 09:51:56 +00:00
mniSettings : 'Comparison Settings' ,
2019-11-06 14:22:12 +00:00
txtCommentRemove : 'Remove' ,
2019-10-18 10:28:30 +00:00
tipCommentRemCurrent : 'Remove current comments' ,
tipCommentRem : 'Remove comments' ,
txtCommentRemCurrent : 'Remove Current Comments' ,
2019-10-29 14:19:03 +00:00
txtCommentRemMyCurrent : 'Remove My Current Comments' ,
2019-10-18 10:28:30 +00:00
txtCommentRemMy : 'Remove My Comments' ,
2021-02-10 10:09:21 +00:00
txtCommentRemAll : 'Remove All Comments' ,
2021-04-06 07:53:53 +00:00
txtCommentResolve : 'Resolve' ,
tipCommentResolveCurrent : 'Resolve current comments' ,
tipCommentResolve : 'Resolve comments' ,
txtCommentResolveCurrent : 'Resolve Current Comments' ,
txtCommentResolveMyCurrent : 'Resolve My Current Comments' ,
txtCommentResolveMy : 'Resolve My Comments' ,
txtCommentResolveAll : 'Resolve All Comments' ,
2021-02-10 10:09:21 +00:00
txtOnGlobal : 'ON for me and everyone' ,
txtOffGlobal : 'OFF for me and everyone' ,
txtOn : 'ON for me' ,
txtOff : 'OFF for me' ,
textWarnTrackChangesTitle : 'Enable Track Changes for everyone?' ,
textWarnTrackChanges : 'Track Changes will be switched ON for all users with full access. The next time anyone opens the doc, Track Changes will remain enabled.' ,
2021-08-04 10:19:19 +00:00
textEnable : 'Enable' ,
txtMarkupSimpleCap : 'Simple Markup' ,
2021-09-03 14:38:49 +00:00
txtMarkupSimple : 'All changes {0}<br>Turn off balloons' ,
txtEditing : 'Editing' ,
txtPreview : 'Preview'
2017-02-21 09:48:23 +00:00
}
2017-06-09 14:30:52 +00:00
} ( ) ) , Common . Views . ReviewChanges || { } ) ) ;
Common . Views . ReviewChangesDialog = Common . UI . Window . extend ( _ . extend ( {
options : {
2018-05-17 12:44:38 +00:00
width : 330 ,
2017-06-09 14:30:52 +00:00
height : 90 ,
title : 'Review Changes' ,
modal : false ,
cls : 'review-changes modal-dlg' ,
alias : 'Common.Views.ReviewChangesDialog'
} ,
initialize : function ( options ) {
2018-05-17 12:44:38 +00:00
_ . extend ( this . options , {
title : this . textTitle
} , options || { } ) ;
2017-06-09 14:30:52 +00:00
this . template = [
'<div class="box">' ,
'<div class="input-row">' ,
'<div id="id-review-button-prev" style=""></div>' ,
'<div id="id-review-button-next" style=""></div>' ,
'<div id="id-review-button-accept" style=""></div>' ,
'<div id="id-review-button-reject" style="margin-right: 0;"></div>' ,
'</div>' ,
'</div>'
] . join ( '' ) ;
this . options . tpl = _ . template ( this . template ) ( this . options ) ;
this . popoverChanges = this . options . popoverChanges ;
this . mode = this . options . mode ;
2022-09-27 22:01:27 +00:00
this . docProtection = this . options . docProtection ;
2017-06-09 14:30:52 +00:00
2021-12-13 17:47:52 +00:00
var filter = Common . localStorage . getKeysFilter ( ) ;
this . appPrefix = ( filter && filter . length ) ? filter . split ( ',' ) [ 0 ] : '' ;
2017-06-09 14:30:52 +00:00
Common . UI . Window . prototype . initialize . call ( this , this . options ) ;
} ,
render : function ( ) {
Common . UI . Window . prototype . render . call ( this ) ;
2022-09-26 20:34:59 +00:00
var _set = Common . enumLock ;
2017-06-09 14:30:52 +00:00
this . btnPrev = new Common . UI . Button ( {
cls : 'dlg-btn iconic' ,
iconCls : 'img-commonctrl prev' ,
hint : this . txtPrev ,
hintAnchor : 'top'
} ) ;
this . btnPrev . render ( this . $window . find ( '#id-review-button-prev' ) ) ;
this . btnNext = new Common . UI . Button ( {
cls : ' dlg-btn iconic' ,
iconCls : 'img-commonctrl next' ,
hint : this . txtNext ,
hintAnchor : 'top'
} ) ;
this . btnNext . render ( this . $window . find ( '#id-review-button-next' ) ) ;
this . btnAccept = new Common . UI . Button ( {
cls : 'btn-toolbar' ,
caption : this . txtAccept ,
split : true ,
2022-09-27 22:01:27 +00:00
disabled : this . mode . isReviewOnly || this . docProtection . isReviewOnly || ! ! Common . Utils . InternalSettings . get ( this . appPrefix + "accept-reject-lock" ) ,
2022-09-26 20:34:59 +00:00
lock : [ _set . reviewChangelock , _set . isReviewOnly , _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments , _set . docLockReview ] ,
2020-08-04 19:20:20 +00:00
menu : this . mode . canUseReviewPermissions ? false : new Common . UI . Menu ( {
2017-06-09 14:30:52 +00:00
items : [
this . mnuAcceptCurrent = new Common . UI . MenuItem ( {
caption : this . txtAcceptCurrent ,
value : 'current'
} ) ,
this . mnuAcceptAll = new Common . UI . MenuItem ( {
caption : this . txtAcceptAll ,
value : 'all'
} )
]
} )
} ) ;
this . btnAccept . render ( this . $window . find ( '#id-review-button-accept' ) ) ;
this . btnReject = new Common . UI . Button ( {
cls : 'btn-toolbar' ,
caption : this . txtReject ,
split : true ,
2022-09-26 20:34:59 +00:00
lock : [ _set . reviewChangelock , _set . isReviewOnly , _set . previewReviewMode , _set . viewFormMode , _set . lostConnect , _set . docLockView , _set . docLockForms , _set . docLockComments , _set . docLockReview ] ,
2020-08-04 19:20:20 +00:00
menu : this . mode . canUseReviewPermissions ? false : new Common . UI . Menu ( {
2017-06-09 14:30:52 +00:00
items : [
this . mnuRejectCurrent = new Common . UI . MenuItem ( {
caption : this . txtRejectCurrent ,
value : 'current'
} ) ,
this . mnuRejectAll = new Common . UI . MenuItem ( {
caption : this . txtRejectAll ,
value : 'all'
} )
]
} )
} ) ;
this . btnReject . render ( this . $window . find ( '#id-review-button-reject' ) ) ;
2022-09-26 20:34:59 +00:00
var arr = [ this . btnAccept , this . btnReject ] ;
Common . Utils . lockControls ( Common . enumLock . isReviewOnly , this . mode . isReviewOnly , { array : arr } ) ;
2022-09-27 22:01:27 +00:00
Common . Utils . lockControls ( Common . enumLock . docLockView , this . docProtection . isReadOnly , { array : arr } ) ;
Common . Utils . lockControls ( Common . enumLock . docLockForms , this . docProtection . isFormsOnly , { array : arr } ) ;
Common . Utils . lockControls ( Common . enumLock . docLockReview , this . docProtection . isReviewOnly , { array : arr } ) ;
Common . Utils . lockControls ( Common . enumLock . docLockComments , this . docProtection . isCommentsOnly , { array : arr } ) ;
2022-09-26 20:34:59 +00:00
Common . Utils . lockControls ( Common . enumLock . reviewChangelock , ! ! Common . Utils . InternalSettings . get ( this . appPrefix + "accept-reject-lock" ) , { array : arr } ) ;
2017-06-09 14:30:52 +00:00
var me = this ;
this . btnPrev . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:preview' , [ me . btnPrev , 'prev' ] ) ;
} ) ;
this . btnNext . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:preview' , [ me . btnNext , 'next' ] ) ;
} ) ;
this . btnAccept . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:accept' , [ me . btnAccept , 'current' ] ) ;
} ) ;
2020-08-04 19:20:20 +00:00
this . btnAccept . menu && this . btnAccept . menu . on ( 'item:click' , function ( menu , item , e ) {
2017-06-09 14:30:52 +00:00
me . fireEvent ( 'reviewchange:accept' , [ menu , item ] ) ;
} ) ;
this . btnReject . on ( 'click' , function ( e ) {
me . fireEvent ( 'reviewchange:reject' , [ me . btnReject , 'current' ] ) ;
} ) ;
2020-08-04 19:20:20 +00:00
this . btnReject . menu && this . btnReject . menu . on ( 'item:click' , function ( menu , item , e ) {
2017-06-09 14:30:52 +00:00
me . fireEvent ( 'reviewchange:reject' , [ menu , item ] ) ;
} ) ;
return this ;
} ,
textTitle : 'Review Changes' ,
txtPrev : 'To previous change' ,
txtNext : 'To next change' ,
txtAccept : 'Accept' ,
txtAcceptCurrent : 'Accept Current Change' ,
txtAcceptAll : 'Accept All Changes' ,
txtReject : 'Reject' ,
txtRejectCurrent : 'Reject Current Change' ,
txtRejectAll : 'Reject All Changes'
} , Common . Views . ReviewChangesDialog || { } ) ) ;
2016-03-11 00:48:53 +00:00
} ) ;