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:
parent
9edc7d8051
commit
0f7b20c9a6
|
@ -81,6 +81,7 @@ define([
|
|||
this.documentCaption = this.options.documentCaption;
|
||||
this.canBack = this.options.canBack;
|
||||
this.branding = this.options.customization;
|
||||
this.isModified = false;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
@ -155,14 +156,18 @@ define([
|
|||
return this.headerCaption;
|
||||
},
|
||||
|
||||
setDocumentCaption: function(value, applyOnly) {
|
||||
if (_.isUndefined(applyOnly)) {
|
||||
this.documentCaption = value;
|
||||
}
|
||||
setDocumentCaption: function(value, isModified) {
|
||||
if (isModified !== undefined)
|
||||
this.isModified = isModified;
|
||||
|
||||
this.documentCaption = value;
|
||||
|
||||
if (!value)
|
||||
value = '';
|
||||
|
||||
if (this.isModified)
|
||||
value = value + '*';
|
||||
|
||||
var dc = $('#header-documentcaption div');
|
||||
if (dc)
|
||||
dc.html(Common.Utils.String.htmlEncode(value));
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -1355,33 +1355,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.setDocumentCaption(headerView.getDocumentCaption() + '*', true);
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption(), true);
|
||||
}
|
||||
} else {
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption());
|
||||
if (this._state.fastCoauth && this._state.usersCount>1) {
|
||||
this._state.timerCaption = setTimeout(function () {
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption(), false);
|
||||
}, 500);
|
||||
} else
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption(), 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());
|
||||
|
|
|
@ -79,7 +79,6 @@ define([
|
|||
isDisconnected : false,
|
||||
usersCount : 1,
|
||||
fastCoauth : true,
|
||||
startModifyDocument : true,
|
||||
lostEditingRights : false,
|
||||
licenseWarning : false
|
||||
};
|
||||
|
@ -878,21 +877,12 @@ define([
|
|||
if (window.document.title != title)
|
||||
window.document.title = title;
|
||||
|
||||
if (!this._state.fastCoauth || this._state.usersCount<2 )
|
||||
Common.Gateway.setDocumentModified(isModified);
|
||||
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);
|
||||
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());
|
||||
|
|
|
@ -98,7 +98,7 @@ define([
|
|||
onLaunch: function() {
|
||||
var me = this;
|
||||
|
||||
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};
|
||||
|
||||
window.storagename = 'presentation';
|
||||
|
||||
|
@ -1110,25 +1110,26 @@ 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.setDocumentCaption(headerView.getDocumentCaption() + '*', true);
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption(), true);
|
||||
}
|
||||
} else {
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption());
|
||||
if (this._state.fastCoauth && this._state.usersCount>1) {
|
||||
this._state.timerCaption = setTimeout(function () {
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption(), false);
|
||||
}, 500);
|
||||
} else
|
||||
headerView.setDocumentCaption(headerView.getDocumentCaption(), 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;
|
||||
}
|
||||
|
@ -1138,8 +1139,6 @@ define([
|
|||
},
|
||||
|
||||
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());
|
||||
|
|
|
@ -79,7 +79,6 @@ define([
|
|||
isDisconnected : false,
|
||||
usersCount : 1,
|
||||
fastCoauth : true,
|
||||
startModifyDocument : true,
|
||||
lostEditingRights : false,
|
||||
licenseWarning : false
|
||||
};
|
||||
|
@ -829,21 +828,12 @@ define([
|
|||
if (window.document.title != title)
|
||||
window.document.title = title;
|
||||
|
||||
if (!this._state.fastCoauth || this._state.usersCount<2 )
|
||||
Common.Gateway.setDocumentModified(isModified);
|
||||
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);
|
||||
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());
|
||||
|
|
|
@ -103,7 +103,7 @@ define([
|
|||
onLaunch: function() {
|
||||
// $(document.body).css('position', 'absolute');
|
||||
|
||||
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};
|
||||
|
||||
if (!Common.Utils.isBrowserSupported()){
|
||||
Common.Utils.showBrowserRestriction();
|
||||
|
@ -1271,24 +1271,26 @@ define([
|
|||
title = this.headerView.getDocumentCaption() + ' - ' + title;
|
||||
|
||||
if (change) {
|
||||
if (!_.isUndefined(title) && (!this._state.fastCoauth || this._state.usersCount<2 )) {
|
||||
clearTimeout(this._state.timerCaption);
|
||||
if (!_.isUndefined(title)) {
|
||||
title = '* ' + title;
|
||||
this.headerView.setDocumentCaption(this.headerView.getDocumentCaption() + '*', true);
|
||||
this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(), true);
|
||||
}
|
||||
} else {
|
||||
this.headerView.setDocumentCaption(this.headerView.getDocumentCaption());
|
||||
if (this._state.fastCoauth && this._state.usersCount>1) {
|
||||
var me = this;
|
||||
this._state.timerCaption = setTimeout(function () {
|
||||
me.headerView.setDocumentCaption(me.headerView.getDocumentCaption(), false);
|
||||
}, 500);
|
||||
} else
|
||||
this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(), false);
|
||||
}
|
||||
|
||||
if (window.document.title != title)
|
||||
window.document.title = title;
|
||||
|
||||
if (!this._state.fastCoauth || this._state.usersCount<2 )
|
||||
Common.Gateway.setDocumentModified(change);
|
||||
else if ( this._state.startModifyDocument!==undefined && this._state.startModifyDocument === change){
|
||||
Common.Gateway.setDocumentModified(change);
|
||||
this._state.startModifyDocument = (this._state.startModifyDocument) ? !this._state.startModifyDocument : undefined;
|
||||
}
|
||||
|
||||
Common.Gateway.setDocumentModified(change);
|
||||
|
||||
this._state.isDocModified = change;
|
||||
}
|
||||
},
|
||||
|
@ -1297,8 +1299,6 @@ define([
|
|||
},
|
||||
|
||||
onDocumentModifiedChanged: function(change) {
|
||||
if (this._state.fastCoauth && this._state.usersCount>1 && this._state.startModifyDocument===undefined ) return;
|
||||
|
||||
this.updateWindowTitle(change);
|
||||
Common.Gateway.setDocumentModified(change);
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ define([
|
|||
isDisconnected : false,
|
||||
usersCount : 1,
|
||||
fastCoauth : true,
|
||||
startModifyDocument : true,
|
||||
lostEditingRights : false,
|
||||
licenseWarning : false
|
||||
};
|
||||
|
@ -972,21 +971,12 @@ define([
|
|||
if (window.document.title != title)
|
||||
window.document.title = title;
|
||||
|
||||
if (!this._state.fastCoauth || this._state.usersCount<2 )
|
||||
Common.Gateway.setDocumentModified(isModified);
|
||||
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);
|
||||
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.asc_isDocumentModified());
|
||||
|
|
Loading…
Reference in a new issue