Commit 639f9b76 authored by konovalovsergey's avatar konovalovsergey

for sessionIdle

parent 7b63c57b
......@@ -586,7 +586,7 @@
if (t.isOnFirstConnectEnd)
{
if (t.CoAuthoringApi.get_isAuth()) {
t.CoAuthoringApi.auth(t.getViewMode());
t.CoAuthoringApi.auth(t.getViewMode(), undefined, t.isIdle());
} else {
//первый запрос или ответ не дошел надо повторить открытие
t.asc_LoadDocument(undefined, true);
......@@ -625,12 +625,11 @@
var interval = data["interval"];
var extendSession = true;
if (c_oCloseCode.sessionIdle == code) {
var lastTime = new Date().getTime();
var idleTime = new Date().getTime() - lastTime;
if (idleTime < interval) {
t.CoAuthoringApi.extendSession(idleTime);
} else {
var idleTime = t.isIdle();
if (idleTime > interval) {
extendSession = false;
} else {
t.CoAuthoringApi.extendSession(idleTime);
}
} else if (c_oCloseCode.sessionAbsolute == code) {
extendSession = false;
......@@ -1308,21 +1307,20 @@
{
};
baseEditorsApi.prototype.isIdle = function(time)
baseEditorsApi.prototype.isIdle = function()
{
// пока не стартовали - считаем работаем
if (0 == this.lastWorkTime)
return false;
return 0;
// если плагин работает - то и мы тоже
if (this.pluginsManager && this.pluginsManager.current != null)
return false;
return 0;
if (this.isEmbedVersion)
return false;
return 0;
var _currentTime = new Date().getTime();
return ((_currentTime - this.lastWorkTime) > time) ? true : false;
return new Date().getTime() - this.lastWorkTime;
};
baseEditorsApi.prototype.checkLastWork = function()
......
......@@ -180,9 +180,9 @@
}
};
CDocsCoApi.prototype.auth = function(isViewer, opt_openCmd) {
CDocsCoApi.prototype.auth = function(isViewer, opt_openCmd, opt_isIdle) {
if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.auth(isViewer, opt_openCmd);
this._CoAuthoringApi.auth(isViewer, opt_openCmd, opt_isIdle);
} else {
// Фиктивные вызовы
this.callback_OnSpellCheckInit('');
......@@ -1450,7 +1450,7 @@
this.sockjs_url = AscCommon.getBaseUrl() + '../../../../doc/' + docid + '/c';
};
// Авторизация (ее нужно делать после выставления состояния редактора view-mode)
DocsCoApi.prototype.auth = function(isViewer, opt_openCmd) {
DocsCoApi.prototype.auth = function(isViewer, opt_openCmd, opt_isIdle) {
this._isViewer = isViewer;
if (this._locks) {
this.ownedLockBlocks = [];
......@@ -1481,7 +1481,7 @@
'block': this.ownedLockBlocks,
'sessionId': this._id,
'sessionTimeConnect': this._sessionTimeConnect,
'sessionTimeIdle': 0,
'sessionTimeIdle': opt_isIdle >= 0 ? opt_isIdle : 0,
'documentFormatSave': this._documentFormatSave,
'view': this._isViewer,
'isCloseCoAuthoring': this.isCloseCoAuthoring,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment