diff --git a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js index 987589d9b..6c8293d96 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -82,6 +82,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this._noApply = true; this._tabListChanged = false; this.Margins = undefined; + this.FirstLine = undefined; + this.LeftIndent = undefined; this.spinners = []; this.tableStylerRows = this.options.tableStylerRows; @@ -576,6 +578,26 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this._changedProps.get_Tabs().add_Tab(tab); }, this); } + if (this._changedProps.get_Ind()!==null && this._changedProps.get_Ind()!==undefined) { + var left = this._changedProps.get_Ind().get_Left(), + first = this._changedProps.get_Ind().get_FirstLine(); + if (first<0 || this.FirstLine<0) { + if (first<0 || first===undefined || first===null) { + if (first === undefined || first === null) + first = this.FirstLine; + if (left === undefined || left === null) + left = this.LeftIndent; + if (left !== undefined && left !== null) + this._changedProps.get_Ind().put_Left(left-first); + } else { + if (left === undefined || left === null) + left = this.LeftIndent; + if (left !== undefined && left !== null) + this._changedProps.get_Ind().put_Left(left); + } + } + } + return { paragraphProps: this._changedProps, borderProps: {borderSize: this.BorderSize, borderColor: this.btnBorderColor.color} }; }, @@ -585,8 +607,12 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this.hideTextOnlySettings(this.isChart); - this.numFirstLine.setValue((props.get_Ind() !== null && props.get_Ind().get_FirstLine() !== null ) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_FirstLine()) : '', true); - this.numIndentsLeft.setValue((props.get_Ind() !== null && props.get_Ind().get_Left() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Left()) : '', true); + this.FirstLine = (props.get_Ind() !== null) ? props.get_Ind().get_FirstLine() : null; + this.numFirstLine.setValue(this.FirstLine!== null ? Common.Utils.Metric.fnRecalcFromMM(this.FirstLine) : '', true); + this.LeftIndent = (props.get_Ind() !== null) ? props.get_Ind().get_Left() : null; + if (this.FirstLine<0 && this.LeftIndent !== null) + this.LeftIndent = this.LeftIndent + this.FirstLine; + this.numIndentsLeft.setValue(this.LeftIndent!==null ? Common.Utils.Metric.fnRecalcFromMM(this.LeftIndent) : '', true); this.numIndentsRight.setValue((props.get_Ind() !== null && props.get_Ind().get_Right() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Right()) : '', true); this.chKeepLines.setValue((props.get_KeepLines() !== null && props.get_KeepLines() !== undefined) ? props.get_KeepLines() : 'indeterminate', true); diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index f7b2dcce3..c1ed762e1 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -57,7 +57,10 @@ define([ _view, _fastCoAuthTips = [], _actionSheets = [], - _isEdit = false; + _isEdit = false, + _canAcceptChanges = false, + _inRevisionChange = false, + _menuPos = []; return { models: [], @@ -90,11 +93,13 @@ define([ me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me)); me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect,me)); + me.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(me.onApiShowChange, me)); me.api.asc_coAuthoringGetUsers(); }, setMode: function (mode) { _isEdit = mode.isEdit; + _canAcceptChanges = mode.canReview && !mode.isReviewOnly; }, // When our application is ready, lets get started @@ -135,10 +140,29 @@ define([ return true; } }); + } else if ('accept' == eventName) { + me.api.asc_GetNextRevisionsChange(); + me.api.asc_AcceptChanges(); + } else if ('acceptall' == eventName) { + me.api.asc_AcceptAllChanges(); + } else if ('reject' == eventName) { + me.api.asc_GetNextRevisionsChange(); + me.api.asc_RejectChanges(); + } else if ('rejectall' == eventName) { + me.api.asc_RejectAllChanges(); + } else if ('review' == eventName) { + if (Common.SharedSettings.get('phone')) { + _actionSheets = me._initReviewMenu(); + me.onContextMenuClick(view, 'showActionSheet'); + } else { + _.delay(function () { + _view.showMenu(me._initReviewMenu(), _menuPos[0] || 0, _menuPos[1] || 0); + }, 100); + } } else if ('showActionSheet' == eventName && _actionSheets.length > 0) { _.delay(function () { _.each(_actionSheets, function (action) { - action.text = action.caption + action.text = action.caption; action.onClick = function () { me.onContextMenuClick(null, action.event) } @@ -166,6 +190,7 @@ define([ if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal.modal-in, .actions-modal').length > 0) { return; } + _menuPos = [posX, posY]; var me = this, items; @@ -283,6 +308,10 @@ define([ _view = this.createView('DocumentHolder').render(); }, + onApiShowChange: function(sdkchange) { + _inRevisionChange = sdkchange && sdkchange.length>0; + }, + // Internal _openLink: function(url) { @@ -378,6 +407,13 @@ define([ event: 'addlink' }); } + + if (_canAcceptChanges && _inRevisionChange) { + menuItems.push({ + caption: me.menuReview, + event: 'review' + }); + } } } @@ -401,6 +437,33 @@ define([ return menuItems; }, + _initReviewMenu: function (stack) { + var me = this, + menuItems = []; + + menuItems.push({ + caption: me.menuAccept, + event: 'accept' + }); + + menuItems.push({ + caption: me.menuReject, + event: 'reject' + }); + + menuItems.push({ + caption: me.menuAcceptAll, + event: 'acceptall' + }); + + menuItems.push({ + caption: me.menuRejectAll, + event: 'rejectall' + }); + + return menuItems; + }, + onCoAuthoringDisconnect: function() { this.isDisconnected = true; }, @@ -414,7 +477,12 @@ define([ menuAddLink: 'Add Link', menuOpenLink: 'Open Link', menuMore: 'More', - sheetCancel: 'Cancel' + sheetCancel: 'Cancel', + menuReview: 'Review', + menuAccept: 'Accept', + menuAcceptAll: 'Accept All', + menuReject: 'Reject', + menuRejectAll: 'Reject All' } })(), DE.Controllers.DocumentHolder || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 67764cd4e..542d51928 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -502,8 +502,7 @@ define([ me.hidePreloader(); me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - if (me.appOptions.isReviewOnly) - me.api.asc_SetTrackRevisions(true); + me.api.asc_SetTrackRevisions(me.appOptions.isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes-" + (me.appOptions.fileKey || ''))); /** coauthoring begin **/ this.isLiveCommenting = Common.localStorage.getBool("de-settings-livecomment", true); @@ -689,6 +688,7 @@ define([ me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false); me.appOptions.canEditStyles = me.appOptions.canLicense && me.appOptions.canEdit; me.appOptions.canPrint = (me.permissions.print !== false); + me.appOptions.fileKey = me.document.key; var type = /^(?:(pdf|djvu|xps))$/.exec(me.document.fileType); me.appOptions.canDownloadOrigin = me.permissions.download !== false && (type && typeof type[1] === 'string'); @@ -698,6 +698,10 @@ define([ me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); + if ( me.appOptions.isLightVersion ) { + me.appOptions.canUseHistory = me.appOptions.canReview = me.appOptions.isReviewOnly = false; + } + me.applyModeCommonElements(); me.applyModeEditorElements(); diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index 7b58fd0c7..07d576ecc 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -79,7 +79,10 @@ define([ { caption: 'A2', subtitle: Common.Utils.String.format('42{0} x 59,4{0}', txtCm), value: [420, 594] }, { caption: 'A6', subtitle: Common.Utils.String.format('10,5{0} x 14,8{0}', txtCm), value: [105, 148] } ], - _licInfo; + _licInfo, + _canReview = false, + _isReviewOnly = false, + _fileKey; var mm2Cm = function(mm) { return parseFloat((mm/10.).toFixed(2)); @@ -137,6 +140,9 @@ define([ this.getView('Settings').setMode(mode); if (mode.canBranding) _licInfo = mode.customization; + _canReview = mode.canReview; + _isReviewOnly = mode.isReviewOnly; + _fileKey = mode.fileKey; }, initEvents: function () { @@ -213,9 +219,11 @@ define([ } else { $('#settings-readermode input:checkbox').attr('checked', Common.SharedSettings.get('readerMode')); $('#settings-spellcheck input:checkbox').attr('checked', Common.localStorage.getBool("de-mobile-spellcheck", false)); + $('#settings-review input:checkbox').attr('checked', _isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes-" + (_fileKey || ''))); $('#settings-search').single('click', _.bind(me.onSearch, me)); $('#settings-readermode input:checkbox').single('change', _.bind(me.onReaderMode, me)); $('#settings-spellcheck input:checkbox').single('change', _.bind(me.onSpellcheck, me)); + $('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me)); $('#settings-help').single('click', _.bind(me.onShowHelp, me)); $('#settings-download').single('click', _.bind(me.onDownloadOrigin, me)); $('#settings-print').single('click', _.bind(me.onPrint, me)); @@ -364,6 +372,17 @@ define([ this.api && this.api.asc_setSpellCheck(state); }, + onTrackChanges: function(e) { + var $checkbox = $(e.currentTarget), + state = $checkbox.is(':checked'); + if ( _isReviewOnly ) { + $checkbox.attr('checked', true); + } else if ( _canReview ) { + this.api.asc_SetTrackRevisions(state); + Common.localStorage.setItem("de-mobile-track-changes-" + (_fileKey || ''), state ? 1 : 0); + } + }, + onShowHelp: function () { window.open('http://support.onlyoffice.com/', "_blank"); this.hideModal(); diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index 2ea5ff4ba..f523005ea 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -57,6 +57,22 @@ +