From 09d3028f777c2a1a821e42004df12a85fc5805e1 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Mon, 26 Aug 2019 10:55:11 +0300 Subject: [PATCH 1/3] [mobile] Display review for view mode --- .../mobile/lib/controller/Collaboration.js | 22 +++++++++++++------ .../mobile/app/controller/Main.js | 16 ++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 63d5296a4..4bdd605ab 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -60,6 +60,7 @@ define([ editUsers = [], editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE', displayMode = "Markup", + canViewReview, arrChangeReview = [], dateChange = [], _fileKey; @@ -208,11 +209,8 @@ define([ me.initComments(); Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content'); } else { - if(editor === 'DE' && !this.appConfig.canReview) { - this.canViewReview = me.api.asc_HaveRevisionsChanges(true); - if (!this.canViewReview) { - $('#reviewing-settings').hide(); - } + if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) { + $('#reviewing-settings').hide(); } } }, @@ -317,9 +315,14 @@ define([ }, initDisplayMode: function() { - var me = this; + var me = this, + value; $('input:radio').single('change', _.bind(me.onReviewViewClick, me)); - var value = displayMode; + if (me.appConfig.canReview) { + value = displayMode; + } else if (canViewReview) { + value = Common.localStorage.getItem("de-view-review-mode") || 'Original'; + } if (value == null || value === "Markup") { $('input[value="Markup"]').attr('checked', true); } else if (value === 'Final') { @@ -333,9 +336,14 @@ define([ return displayMode; }, + setCanViewReview: function(config) { + canViewReview = config; + }, + onReviewViewClick: function(event) { var value = $(event.currentTarget).val(); this.turnDisplayMode(value); + !this.appConfig.canReview && Common.localStorage.setItem("de-view-review-mode", value); }, turnDisplayMode: function(value) { diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 09a87a897..17140c063 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -604,6 +604,22 @@ define([ me.applyLicense(); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); + + if (!me.appOptions.canReview) { + var canViewReview = me.api.asc_HaveRevisionsChanges(true); + if (canViewReview) { + var viewReviewMode = Common.localStorage.getItem("de-view-review-mode"); + viewReviewMode = viewReviewMode || 'Original'; + if (viewReviewMode === 'Original') + me.api.asc_BeginViewModeInReview(false); + else if (viewReviewMode === 'Final') + me.api.asc_BeginViewModeInReview(true); + else + me.api.asc_EndViewModeInReview(); + } + DE.getController('Common.Controllers.Collaboration').setCanViewReview(canViewReview); + } + Common.Gateway.documentReady(); }, From df6c0d9df89d5b705bed229f5d7bc067c84118ae Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 26 Aug 2019 14:24:42 +0300 Subject: [PATCH 2/3] [DE mobile] Review refactoring --- .../mobile/lib/controller/Collaboration.js | 39 ++++++++----------- .../lib/template/Collaboration.template | 6 +-- .../mobile/app/controller/Main.js | 15 +++---- .../mobile/app/controller/Settings.js | 4 +- .../mobile/app/controller/Toolbar.js | 2 +- 5 files changed, 29 insertions(+), 37 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 4bdd605ab..f4b57afb3 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -59,7 +59,7 @@ define([ _userId, editUsers = [], editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE', - displayMode = "Markup", + displayMode = "markup", canViewReview, arrChangeReview = [], dateChange = [], @@ -274,7 +274,7 @@ define([ $('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me)); $('#settings-accept-all').single('click', _.bind(me.onAcceptAllClick, me)); $('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, me)); - if(this.appConfig.isReviewOnly || displayMode == "Final" || displayMode == "Original" ) { + if(this.appConfig.isReviewOnly || displayMode == "final" || displayMode == "original" ) { $('#settings-accept-all').addClass('disabled'); $('#settings-reject-all').addClass('disabled'); $('#settings-review').addClass('disabled'); @@ -315,20 +315,15 @@ define([ }, initDisplayMode: function() { - var me = this, - value; + var me = this; $('input:radio').single('change', _.bind(me.onReviewViewClick, me)); - if (me.appConfig.canReview) { - value = displayMode; - } else if (canViewReview) { - value = Common.localStorage.getItem("de-view-review-mode") || 'Original'; - } - if (value == null || value === "Markup") { - $('input[value="Markup"]').attr('checked', true); - } else if (value === 'Final') { - $('input[value="Final"]').attr('checked', true); - } else if (value === 'Original') { - $('input[value="Original"]').attr('checked', true); + var value = displayMode; + if (value == null || value === "markup") { + $('input[value="markup"]').attr('checked', true); + } else if (value === 'final') { + $('input[value="final"]').attr('checked', true); + } else if (value === 'original') { + $('input[value="original"]').attr('checked', true); } }, @@ -346,19 +341,19 @@ define([ !this.appConfig.canReview && Common.localStorage.setItem("de-view-review-mode", value); }, - turnDisplayMode: function(value) { - displayMode = value; + turnDisplayMode: function(value, suppressEvent) { + displayMode = value.toLocaleLowerCase(); if (this.api) { - if (value === 'Final') + if (displayMode === 'final') this.api.asc_BeginViewModeInReview(true); - else if (value === 'Original') + else if (displayMode === 'original') this.api.asc_BeginViewModeInReview(false); else this.api.asc_EndViewModeInReview(); } - this.initReviewingSettingsView(); - DE.getController('Toolbar').setDisplayMode(value); + !suppressEvent && this.initReviewingSettingsView(); + DE.getController('Toolbar').setDisplayMode(displayMode); }, @@ -394,7 +389,7 @@ define([ $('#btn-delete-change').single('click', _.bind(this.onDeleteChange, this)); } } - if(displayMode == "Final" || displayMode == "Original") { + if(displayMode == "final" || displayMode == "original") { $('#btn-accept-change').addClass('disabled'); $('#btn-reject-change').addClass('disabled'); $('#btn-prev-change').addClass('disabled'); diff --git a/apps/common/mobile/lib/template/Collaboration.template b/apps/common/mobile/lib/template/Collaboration.template index 39e076ded..ec41861a4 100644 --- a/apps/common/mobile/lib/template/Collaboration.template +++ b/apps/common/mobile/lib/template/Collaboration.template @@ -150,7 +150,7 @@