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