[DE] Changes for fast co-editing mode when count of users>2: always send ' onDocumentStateChange' event , draw '*' in the document caption while user is editing document.

This commit is contained in:
Julia Radzhabova 2017-04-12 11:55:46 +03:00
parent ea9c74f08f
commit 65b7e8722b
2 changed files with 18 additions and 15 deletions

View file

@ -275,6 +275,7 @@ define([
this.documentCaption = this.options.documentCaption;
this.canBack = this.options.canBack;
this.branding = this.options.customization;
this.isModified = false;
me.btnGoBack = new Common.UI.Button({
id: 'btn-goback',
@ -332,7 +333,7 @@ define([
Common.Utils.String.htmlEncode(this.documentCaption) );
}
this.labelDocName = $html.find('#doc-name');
this.labelDocName = $html.find('#rib-doc-name');
$userList = $html.find('.cousers-list');
$panelUsers = $html.find('.box-cousers');
$btnUsers = $html.find('.btn-users');
@ -375,10 +376,11 @@ define([
return this.headerCaption;
},
setDocumentCaption: function (value, applyOnly) {
setDocumentCaption: function(value) {
!value && (value = '');
this.documentCaption = value;
this.isModified && (value += '*');
if ( this.labelDocName )
this.labelDocName.html(Common.Utils.String.htmlEncode(value));
@ -390,6 +392,8 @@ define([
},
setDocumentChanged: function (changed) {
this.isModified = changed;
var _name = Common.Utils.String.htmlEncode(this.documentCaption);
changed && (_name += '*');

View file

@ -104,7 +104,7 @@ define([
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
});
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, startModifyDocument: true, lostEditingRights: false, licenseWarning: false};
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseWarning: false};
// Initialize viewport
@ -1364,33 +1364,32 @@ define([
title = headerView.getDocumentCaption() + ' - ' + title;
if (isModified) {
if (!_.isUndefined(title) && (!this._state.fastCoauth || this._state.usersCount<2 )) {
clearTimeout(this._state.timerCaption);
if (!_.isUndefined(title)) {
title = '* ' + title;
headerView.setDocumentChanged(true);
}
} else {
headerView.setDocumentChanged(false);
if (this._state.fastCoauth && this._state.usersCount>1) {
this._state.timerCaption = setTimeout(function () {
headerView.setDocumentChanged(false);
}, 500);
} else
headerView.setDocumentChanged(false);
}
if (window.document.title != title)
window.document.title = title;
if (!this._state.fastCoauth || this._state.usersCount<2 ) {
Common.Gateway.setDocumentModified(isModified);
if (isModified)
this.getApplication().getController('Statusbar').setStatusCaption('', true);
} else if ( this._state.startModifyDocument!==undefined && this._state.startModifyDocument === isModified){
Common.Gateway.setDocumentModified(isModified);
this._state.startModifyDocument = (this._state.startModifyDocument) ? !this._state.startModifyDocument : undefined;
}
Common.Gateway.setDocumentModified(isModified);
if (isModified && (!this._state.fastCoauth || this._state.usersCount<2))
this.getApplication().getController('Statusbar').setStatusCaption('', true);
this._state.isDocModified = isModified;
}
},
onDocumentModifiedChanged: function() {
if (this._state.fastCoauth && this._state.usersCount>1 && this._state.startModifyDocument===undefined ) return;
var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.isDocumentModified());