[DE mobile] Add settings: Display Mode, Accept All Changes, Reject All Changes, Next Change, Previous Change, Accept Change, Reject Change, Description Change in Collaboration.

This commit is contained in:
Julia Svinareva 2019-05-16 19:15:12 +03:00
parent c7a5162e80
commit 0a1d461763
3 changed files with 491 additions and 17 deletions

View file

@ -55,7 +55,9 @@ define([
rootView,
_isReviewOnly = false,
_fileKey,
_canReview = false;
_canReview = false,
displayMode = "Markup",
arrChangeReview = [];
return {
models: [],
@ -75,6 +77,7 @@ define([
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.changeReview, this));
},
onLaunch: function () {
@ -159,16 +162,22 @@ define([
if ('#reviewing-settings-view' == pageId) {
me.initReviewingSettingsView();
Common.Utils.addScrollIfNeed('.page[data-page=reviewing-settings-view]', '.page[data-page=reviewing-settings-view] .page-content');
} else {
} else if ('#display-mode-view' == pageId) {
me.initDisplayMode();
Common.Utils.addScrollIfNeed('.page[data-page=display-mode-view]', '.page[data-page=display-mode-view] .page-content');
} else if('#change-view' == pageId) {
me.initChange();
Common.Utils.addScrollIfNeed('.page[data-page=change-view]', '.page[data-page=change-view] .page-content');
}
},
initReviewingSettingsView: function () {
var me = this;
$('#settings-review input:checkbox').attr('checked', _isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes-" + (_fileKey || '')));
$('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me));
$('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me));
if (_isReviewOnly) $layour.find('#settings-review').addClass('disabled');
$('#settings-accept-all').single('click', _.bind(me.onAcceptAllClick, me));
$('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, me));
},
onTrackChanges: function(e) {
@ -182,9 +191,360 @@ define([
}
},
onAcceptAllClick: function() {
if (this.api) {
this.api.asc_AcceptAllChanges();
}
},
onRejectAllClick: function() {
if (this.api) {
this.api.asc_RejectAllChanges();
}
},
initDisplayMode: function() {
var me = this;
$('input:radio').single('change', _.bind(me.onReviewViewClick, me));
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);
}
},
onReviewViewClick: function(event) {
var value = $(event.currentTarget).val();
this.turnDisplayMode(value);
},
turnDisplayMode: function(value) {
displayMode = value;
if (this.api) {
if (value === 'Final')
this.api.asc_BeginViewModeInReview(true);
else if (value === 'Original')
this.api.asc_BeginViewModeInReview(false);
else
this.api.asc_EndViewModeInReview();
}
},
initChange: function() {
if(arrChangeReview.length == 0) {
this.api.asc_GetNextRevisionsChange();
}
$('#current-change #date-change').html(arrChangeReview[0]);
$('#current-change #user-name').html(arrChangeReview[1]);
$('#current-change #text-change').html(arrChangeReview[2]);
$('#btn-prev-change').single('click', _.bind(this.onPrevChange, this));
$('#btn-next-change').single('click', _.bind(this.onNextChange, this));
$('#btn-accept-change').single('click', _.bind(this.onAcceptCurrentChange, this));
$('#btn-reject-change').single('click', _.bind(this.onRejectCurrentChange, this));
},
onPrevChange: function() {
this.api.asc_GetPrevRevisionsChange();
this.updateInfoChange();
},
onNextChange: function() {
this.api.asc_GetNextRevisionsChange();
this.updateInfoChange();
},
onAcceptCurrentChange: function() {
if (this.api) {
this.api.asc_AcceptChanges();
}
this.updateInfoChange();
},
onRejectCurrentChange: function() {
if (this.api) {
this.api.asc_RejectChanges();
}
this.updateInfoChange();
},
updateInfoChange: function() {
if(arrChangeReview.length == 0) {
$('#current-change #date-change').empty();
$('#current-change #user-name').empty();
$('#current-change #text-change').empty();
} else {
this.initChange();
}
},
changeReview: function (data) {
if (data && data.length>0) {
var me = this, arr = [];
_.each(data, function (item) {
var changetext = '', proptext = '',
value = item.get_Value(),
settings = false;
switch (item.get_Type()) {
case Asc.c_oAscRevisionsChangeType.TextAdd:
changetext = me.textInserted;
if (typeof value == 'object') {
_.each(value, function (obj) {
if (typeof obj === 'string')
changetext += (' ' + Common.Utils.String.htmlEncode(obj));
else {
switch (obj) {
case 0:
changetext += (' <' + me.textImage + '>');
break;
case 1:
changetext += (' <' + me.textShape + '>');
break;
case 2:
changetext += (' <' + me.textChart + '>');
break;
case 3:
changetext += (' <' + me.textEquation + '>');
break;
}
}
})
} else if (typeof value === 'string') {
changetext += (' ' + Common.Utils.String.htmlEncode(value));
}
break;
case Asc.c_oAscRevisionsChangeType.TextRem:
changetext = me.textDeleted;
if (typeof value == 'object') {
_.each(value, function (obj) {
if (typeof obj === 'string')
changetext += (' ' + Common.Utils.String.htmlEncode(obj));
else {
switch (obj) {
case 0:
changetext += (' <' + me.textImage + '>');
break;
case 1:
changetext += (' <' + me.textShape + '>');
break;
case 2:
changetext += (' <' + me.textChart + '>');
break;
case 3:
changetext += (' <' + me.textEquation + '>');
break;
}
}
})
} else if (typeof value === 'string') {
changetext += (' ' + Common.Utils.String.htmlEncode(value));
}
break;
case Asc.c_oAscRevisionsChangeType.ParaAdd:
changetext = me.textParaInserted;
break;
case Asc.c_oAscRevisionsChangeType.ParaRem:
changetext = me.textParaDeleted;
break;
case Asc.c_oAscRevisionsChangeType.TextPr:
changetext = '<b>' + me.textFormatted;
if (value.Get_Bold() !== undefined)
proptext += ((value.Get_Bold() ? '' : me.textNot) + me.textBold + ', ');
if (value.Get_Italic() !== undefined)
proptext += ((value.Get_Italic() ? '' : me.textNot) + me.textItalic + ', ');
if (value.Get_Underline() !== undefined)
proptext += ((value.Get_Underline() ? '' : me.textNot) + me.textUnderline + ', ');
if (value.Get_Strikeout() !== undefined)
proptext += ((value.Get_Strikeout() ? '' : me.textNot) + me.textStrikeout + ', ');
if (value.Get_DStrikeout() !== undefined)
proptext += ((value.Get_DStrikeout() ? '' : me.textNot) + me.textDStrikeout + ', ');
if (value.Get_Caps() !== undefined)
proptext += ((value.Get_Caps() ? '' : me.textNot) + me.textCaps + ', ');
if (value.Get_SmallCaps() !== undefined)
proptext += ((value.Get_SmallCaps() ? '' : me.textNot) + me.textSmallCaps + ', ');
if (value.Get_VertAlign() !== undefined)
proptext += (((value.Get_VertAlign() == 1) ? me.textSuperScript : ((value.Get_VertAlign() == 2) ? me.textSubScript : me.textBaseline)) + ', ');
if (value.Get_Color() !== undefined)
proptext += (me.textColor + ', ');
if (value.Get_Highlight() !== undefined)
proptext += (me.textHighlight + ', ');
if (value.Get_Shd() !== undefined)
proptext += (me.textShd + ', ');
if (value.Get_FontFamily() !== undefined)
proptext += (value.Get_FontFamily() + ', ');
if (value.Get_FontSize() !== undefined)
proptext += (value.Get_FontSize() + ', ');
if (value.Get_Spacing() !== undefined)
proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_Position() !== undefined)
proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_Lang() !== undefined)
proptext += (Common.util.LanguageInfo.getLocalLanguageName(value.Get_Lang())[1] + ', ');
if (!_.isEmpty(proptext)) {
changetext += ': ';
proptext = proptext.substring(0, proptext.length - 2);
}
changetext += '</b>';
changetext += proptext;
break;
case Asc.c_oAscRevisionsChangeType.ParaPr:
changetext = '<b>' + me.textParaFormatted;
if (value.Get_ContextualSpacing())
proptext += ((value.Get_ContextualSpacing() ? me.textContextual : me.textNoContextual) + ', ');
if (value.Get_IndLeft() !== undefined)
proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_IndRight() !== undefined)
proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_IndFirstLine() !== undefined)
proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_Jc() !== undefined) {
switch (value.Get_Jc()) {
case 0:
proptext += (me.textRight + ', ');
break;
case 1:
proptext += (me.textLeft + ', ');
break;
case 2:
proptext += (me.textCenter + ', ');
break;
case 3:
proptext += (me.textJustify + ', ');
break;
}
}
if (value.Get_KeepLines() !== undefined)
proptext += ((value.Get_KeepLines() ? me.textKeepLines : me.textNoKeepLines) + ', ');
if (value.Get_KeepNext())
proptext += ((value.Get_KeepNext() ? me.textKeepNext : me.textNoKeepNext) + ', ');
if (value.Get_PageBreakBefore())
proptext += ((value.Get_PageBreakBefore() ? me.textBreakBefore : me.textNoBreakBefore) + ', ');
if (value.Get_SpacingLineRule() !== undefined && value.Get_SpacingLine() !== undefined) {
proptext += me.textLineSpacing;
proptext += (((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_LEAST) ? me.textAtLeast : ((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_AUTO) ? me.textMultiple : me.textExact)) + ' ');
proptext += (((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()) + ', ');
}
if (value.Get_SpacingBeforeAutoSpacing())
proptext += (me.textSpacingBefore + ' ' + me.textAuto + ', ');
else if (value.Get_SpacingBefore() !== undefined)
proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_SpacingAfterAutoSpacing())
proptext += (me.textSpacingAfter + ' ' + me.textAuto + ', ');
else if (value.Get_SpacingAfter() !== undefined)
proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_WidowControl())
proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', ');
if (value.Get_Tabs() !== undefined)
proptext += proptext += (me.textTabs + ', ');
if (value.Get_NumPr() !== undefined)
proptext += proptext += (me.textNum + ', ');
if (value.Get_PStyle() !== undefined) {
var style = me.api.asc_GetStyleNameById(value.Get_PStyle());
if (!_.isEmpty(style)) proptext += (style + ', ');
}
if (!_.isEmpty(proptext)) {
changetext += ': ';
proptext = proptext.substring(0, proptext.length - 2);
}
changetext += '</b>';
changetext += proptext;
break;
}
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
user = item.get_UserName();
date = me.dateToLocaleTimeString(date);
text: ''
arr.push(date, user, changetext);
});
arrChangeReview = arr;
} else {
arrChangeReview = [];
}
},
dateToLocaleTimeString: function (date) {
function format(date) {
var strTime,
hours = date.getHours(),
minutes = date.getMinutes(),
ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
strTime = hours + ':' + minutes + ' ' + ampm;
return strTime;
}
// MM/dd/yyyy hh:mm AM
return (date.getMonth() + 1) + '/' + (date.getDate()) + '/' + date.getFullYear() + ' ' + format(date);
},
textInserted: '<b>Inserted:</b><br>',
textDeleted: '<b>Deleted:</b><br>',
textParaInserted: '<b>Paragraph Inserted</b><br> ',
textParaDeleted: '<b>Paragraph Deleted</b><br> ',
textFormatted: 'Formatted',
textParaFormatted: 'Paragraph Formatted',
textNot: 'Not ',
textBold: 'Bold',
textItalic: 'Italic',
textStrikeout: 'Strikeout',
textUnderline: 'Underline',
textColor: 'Font color',
textBaseline: 'Baseline',
textSuperScript: 'Superscript',
textSubScript: 'Subscript',
textHighlight: 'Highlight color',
textSpacing: 'Spacing',
textDStrikeout: 'Double strikeout',
textCaps: 'All caps',
textSmallCaps: 'Small caps',
textPosition: 'Position',
textShd: 'Background color',
textContextual: 'Don\'t add interval between paragraphs of the same style',
textNoContextual: 'Add interval between paragraphs of the same style',
textIndentLeft: 'Indent left',
textIndentRight: 'Indent right',
textFirstLine: 'First line',
textRight: 'Align right',
textLeft: 'Align left',
textCenter: 'Align center',
textJustify: 'Align justify',
textBreakBefore: 'Page break before',
textKeepNext: 'Keep with next',
textKeepLines: 'Keep lines together',
textNoBreakBefore: 'No page break before',
textNoKeepNext: 'Don\'t keep with next',
textNoKeepLines: 'Don\'t keep lines together',
textLineSpacing: 'Line Spacing: ',
textMultiple: 'multiple',
textAtLeast: 'at least',
textExact: 'exactly',
textSpacingBefore: 'Spacing before',
textSpacingAfter: 'Spacing after',
textAuto: 'auto',
textWidow: 'Widow control',
textNoWidow: 'No widow control',
textTabs: 'Change tabs',
textNum: 'Change numbering',
textEquation: 'Equation',
textImage: 'Image',
textChart: 'Chart',
textShape: 'Shape'
}
})(), DE.Controllers.Collaboration || {}))

View file

@ -23,18 +23,6 @@
</div>
</a>
</li>
<li>
<a id="comments-settings" class="item-link" data-page="#comments-settings-view">
<div class="item-content">
<div class="item-media">
<i class="icon icon-doc-setup"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textСomments %></div>
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
@ -71,6 +59,50 @@
</div>
</div>
</li>
<li>
<a id="display-mode-settings" class="item-link" data-page="#display-mode-view">
<div class="item-content">
<div class="item-media">
<i class="icon icon-doc-setup"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textDisplayMode %></div>
</div>
</div>
</a>
</li>
<li>
<a id="change-settings" class="item-link" data-page="#change-view">
<div class="item-content">
<div class="item-media">
<i class="icon icon-doc-setup"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textChange %></div>
</div>
</div>
</a>
</li>
<li>
<div id="settings-accept-all" class="item-content">
<div class="item-media">
<i class="icon icon-review"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textAcceptAllChanges %></div>
</div>
</div>
</li>
<li>
<div id="settings-reject-all" class="item-content">
<div class="item-media">
<i class="icon icon-review"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textRejectAllChanges %></div>
</div>
</div>
</li>
</ul>
</div>
@ -78,4 +110,79 @@
</div>
</div>
</div>
</div>
<!-- Display Mode view -->
<div id="display-mode-view">
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><a href="#" class="back link"> <i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
<div class="center sliding"><%= scope.textDisplayMode %></div>
</div>
</div>
<div class="pages">
<div class="page" data-page="display-mode-view">
<div class="page-content">
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Markup">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textMarkup %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Final">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textFinal %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Original">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textOriginal %></div>
</div>
</label>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Change view -->
<div id="change-view">
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><a href="#" class="back link"> <i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
<div class="center sliding"><%= scope.textChange %></div>
</div>
</div>
<div class="pages">
<div class="page" data-page="change-view">
<div class="page-content">
<div class="content-block">
<a href="#" id="btn-prev-change" class="link icon-only"><i class="icon icon-undo"></i></a>
<a href="#" id="btn-next-change" class="link icon-only"><i class="icon icon-redo"></i></a>
<a href="#" id="btn-accept-change" class="link icon-only">Accept</a>
<a href="#" id="btn-reject-change" class="link icon-only">Reject</a>
</div>
<div id="current-change" class="content-block">
<p id="user-name"></p>
<p id="date-change"></p>
<p id="text-change"></p>
</div>
</div>
</div>
</div>
</div>

View file

@ -147,6 +147,13 @@ define([
textСomments: 'Сomments',
textBack: 'Back',
textReview: 'Track Changes',
textAcceptAllChanges: 'Accept All Changes',
textRejectAllChanges: 'Reject All Changes',
textDisplayMode: 'Display Mode',
textMarkup: 'Markup',
textFinal: 'Final',
textOriginal: 'Original',
textChange: 'Change'
}
})(), DE.Views.Collaboration || {}))