This commit is contained in:
Alexey Golubev 2019-09-03 14:41:16 +03:00
commit 87f4d97c63
10 changed files with 120 additions and 57 deletions

View file

@ -1118,7 +1118,7 @@ define([
return (item.email && 0 === item.email.toLowerCase().indexOf(str) || item.name && 0 === item.name.toLowerCase().indexOf(str))
});
}
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= caption %></div><div style="color: #909090;"><%= options.value %></div></a>'),
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= Common.Utils.String.htmlEncode(caption) %></div><div style="color: #909090;"><%= Common.Utils.String.htmlEncode(options.value) %></div></a>'),
divider = false;
_.each(users, function(menuItem, index) {
if (divider && !menuItem.hasAccess) {

View file

@ -59,7 +59,8 @@ define([
_userId,
editUsers = [],
editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE',
displayMode = "Markup",
displayMode = "markup",
canViewReview,
arrChangeReview = [],
dateChange = [],
_fileKey;
@ -208,13 +209,10 @@ 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) {
if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) {
$('#reviewing-settings').hide();
}
}
}
},
//Edit users
@ -276,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');
@ -320,12 +318,12 @@ define([
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);
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);
}
},
@ -333,24 +331,29 @@ 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) {
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);
},
@ -386,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');

View file

@ -150,7 +150,7 @@
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Markup">
<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>
@ -159,7 +159,7 @@
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Final">
<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>
@ -168,7 +168,7 @@
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Original">
<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>

View file

@ -776,6 +776,7 @@ define([
this.menu = options.menu;
this.coreProps = null;
this.authors = [];
this._locked = false;
},
render: function() {
@ -1009,7 +1010,9 @@ define([
me.trAuthor.before(div);
me.authors.push(item);
});
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
}
this.SetDisabled();
},
_ShowHideInfoItem: function(el, visible) {
@ -1048,6 +1051,10 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
},
@ -1095,12 +1102,18 @@ define([
},
onLockCore: function(lock) {
this.inputTitle.setDisabled(lock);
this.inputSubject.setDisabled(lock);
this.inputComment.setDisabled(lock);
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock);
!lock && this.updateFileInfo();
this._locked = lock;
this.updateFileInfo();
},
SetDisabled: function() {
var disable = !this.mode.isEdit || this._locked;
this.inputTitle.setDisabled(disable);
this.inputSubject.setDisabled(disable);
this.inputComment.setDisabled(disable);
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
},
txtPlacement: 'Location',

View file

@ -604,6 +604,19 @@ define([
me.applyLicense();
$(document).on('contextmenu', _.bind(me.onContextMenu, me));
if (!me.appOptions.canReview) {
var canViewReview = me.appOptions.isEdit || me.api.asc_HaveRevisionsChanges(true);
DE.getController('Common.Controllers.Collaboration').setCanViewReview(canViewReview);
if (canViewReview) {
var viewReviewMode = Common.localStorage.getItem("de-view-review-mode");
if (viewReviewMode===null)
viewReviewMode = me.appOptions.customization && /^(original|final|markup)$/i.test(me.appOptions.customization.reviewDisplay) ? me.appOptions.customization.reviewDisplay.toLocaleLowerCase() : 'original';
viewReviewMode = me.appOptions.isEdit ? 'markup' : viewReviewMode;
DE.getController('Common.Controllers.Collaboration').turnDisplayMode(viewReviewMode);
}
}
Common.Gateway.documentReady();
},

View file

@ -262,7 +262,7 @@ define([
$('#settings-print').single('click', _.bind(me.onPrint, me));
$('#settings-collaboration').single('click', _.bind(me.clickCollaboration, me));
var _stateDisplayMode = DE.getController('Common.Controllers.Collaboration').getDisplayMode();
if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") {
if(_stateDisplayMode == "final" || _stateDisplayMode == "original") {
$('#settings-document').addClass('disabled');
}
var _userCount = DE.getController('Main').returnUserCount();
@ -378,7 +378,7 @@ define([
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
$unitMeasurement.val([value]);
var _stateDisplayMode = DE.getController('Common.Controllers.Collaboration').getDisplayMode();
if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") {
if(_stateDisplayMode == "final" || _stateDisplayMode == "original") {
$('#settings-no-characters').addClass('disabled');
$('#settings-hidden-borders').addClass('disabled');
}

View file

@ -153,7 +153,7 @@ define([
},
setDisplayMode: function(displayMode) {
stateDisplayMode = displayMode == "Final" || displayMode == "Original" ? true : false;
stateDisplayMode = displayMode == "final" || displayMode == "original" ? true : false;
var selected = this.api.getSelectedElements();
this.onApiFocusObject(selected);
},

View file

@ -660,6 +660,7 @@ define([
this.menu = options.menu;
this.coreProps = null;
this.authors = [];
this._locked = false;
},
render: function() {
@ -882,7 +883,9 @@ define([
me.trAuthor.before(div);
me.authors.push(item);
});
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
}
this.SetDisabled();
},
_ShowHideInfoItem: function(el, visible) {
@ -897,6 +900,10 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
},
@ -908,12 +915,18 @@ define([
},
onLockCore: function(lock) {
this.inputTitle.setDisabled(lock);
this.inputSubject.setDisabled(lock);
this.inputComment.setDisabled(lock);
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock);
!lock && this.updateFileInfo();
this._locked = lock;
this.updateFileInfo();
},
SetDisabled: function() {
var disable = !this.mode.isEdit || this._locked;
this.inputTitle.setDisabled(disable);
this.inputSubject.setDisabled(disable);
this.inputComment.setDisabled(disable);
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
},
txtPlacement: 'Location',

View file

@ -56,18 +56,6 @@ define([
sdkViewName : '#id_main',
initialize: function () {
this.addListeners({
'DataTab': {
'data:group': this.onGroup,
'data:ungroup': this.onUngroup,
'data:tocolumns': this.onTextToColumn,
'data:show': this.onShowClick,
'data:hide': this.onHideClick,
'data:groupsettings': this.onGroupSettings
}
});
this._state = {
CSVOptions: new Asc.asc_CTextOptions(0, 4, '')
};
@ -91,6 +79,19 @@ define([
this.view = this.createView('DataTab', {
toolbar: this.toolbar.toolbar
});
this.addListeners({
'DataTab': {
'data:group': this.onGroup,
'data:ungroup': this.onUngroup,
'data:tocolumns': this.onTextToColumn,
'data:show': this.onShowClick,
'data:hide': this.onHideClick,
'data:groupsettings': this.onGroupSettings
},
'Statusbar': {
'sheet:changed': this.onApiSheetChanged
}
});
},
SetDisabled: function(state) {
@ -217,6 +218,13 @@ define([
}
},
onApiSheetChanged: function() {
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge) return;
var currentSheet = this.api.asc_getActiveWorksheetIndex();
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));
},
textWizard: 'Text to Columns Wizard'
}, SSE.Controllers.DataTab || {}));

View file

@ -1109,6 +1109,7 @@ define([
this.menu = options.menu;
this.coreProps = null;
this.authors = [];
this._locked = false;
},
render: function() {
@ -1331,7 +1332,9 @@ define([
me.trAuthor.before(div);
me.authors.push(item);
});
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
}
this.SetDisabled();
},
_ShowHideInfoItem: function(el, visible) {
@ -1346,6 +1349,10 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
},
@ -1357,12 +1364,18 @@ define([
},
onLockCore: function(lock) {
this.inputTitle.setDisabled(lock);
this.inputSubject.setDisabled(lock);
this.inputComment.setDisabled(lock);
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock);
!lock && this.updateFileInfo();
this._locked = lock;
this.updateFileInfo();
},
SetDisabled: function() {
var disable = !this.mode.isEdit || this._locked;
this.inputTitle.setDisabled(disable);
this.inputSubject.setDisabled(disable);
this.inputComment.setDisabled(disable);
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
},
txtPlacement: 'Location',