Commit 2070c9ea authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Убрал выставление режима просмотра (viewerMode). Ранее если был режим...

Убрал выставление режима просмотра (viewerMode). Ранее если был режим просмотра - это не считалось редактированием и не входило в рассчет числа пользователей для начала совместного редактирования.
Теперь режим просмотра и редактирования равны в рассчете числа пользователей в документе.
Правки для бага http://bugzserver/show_bug.cgi?id=20545

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50366 954022d7-b5bf-4e40-9824-e11837661b57
parent b26969b9
...@@ -20,14 +20,13 @@ ...@@ -20,14 +20,13 @@
this.onDisconnect = options.onDisconnect; this.onDisconnect = options.onDisconnect;
this.onFirstLoadChanges = options.onFirstLoadChanges; this.onFirstLoadChanges = options.onFirstLoadChanges;
this.onConnectionStateChanged = options.onConnectionStateChanged; this.onConnectionStateChanged = options.onConnectionStateChanged;
this.onUserStateChanged = options.onUserStateChanged;
this.onSetIndexUser = options.onSetIndexUser; this.onSetIndexUser = options.onSetIndexUser;
this.onSaveChanges = options.onSaveChanges; this.onSaveChanges = options.onSaveChanges;
this.onStartCoAuthoring = options.onStartCoAuthoring; this.onStartCoAuthoring = options.onStartCoAuthoring;
} }
}; };
CDocsCoApi.prototype.init = function (user, docid, isviewermode, token, serverHost, serverPath, callback, editorType) { CDocsCoApi.prototype.init = function (user, docid, token, serverHost, serverPath, callback, editorType) {
if (this._CoAuthoringApi && this._CoAuthoringApi.isRightURL()) { if (this._CoAuthoringApi && this._CoAuthoringApi.isRightURL()) {
var t = this; var t = this;
this._CoAuthoringApi.onAuthParticipantsChanged = function (e) {t.callback_OnAuthParticipantsChanged(e);}; this._CoAuthoringApi.onAuthParticipantsChanged = function (e) {t.callback_OnAuthParticipantsChanged(e);};
...@@ -39,13 +38,12 @@ ...@@ -39,13 +38,12 @@
this._CoAuthoringApi.onDisconnect = function (e, isDisconnectAtAll, isCloseCoAuthoring) {t.callback_OnDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring);}; this._CoAuthoringApi.onDisconnect = function (e, isDisconnectAtAll, isCloseCoAuthoring) {t.callback_OnDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring);};
this._CoAuthoringApi.onFirstLoadChanges = function (e) {t.callback_OnFirstLoadChanges(e);}; this._CoAuthoringApi.onFirstLoadChanges = function (e) {t.callback_OnFirstLoadChanges(e);};
this._CoAuthoringApi.onConnectionStateChanged = function (e) {t.callback_OnConnectionStateChanged(e);}; this._CoAuthoringApi.onConnectionStateChanged = function (e) {t.callback_OnConnectionStateChanged(e);};
this._CoAuthoringApi.onUserStateChanged = function (e) {t.callback_OnUserStateChanged(e);};
this._CoAuthoringApi.onSetIndexUser = function (e) {t.callback_OnSetIndexUser(e);}; this._CoAuthoringApi.onSetIndexUser = function (e) {t.callback_OnSetIndexUser(e);};
this._CoAuthoringApi.onSaveChanges = function (e) {t.callback_OnSaveChanges(e);}; this._CoAuthoringApi.onSaveChanges = function (e) {t.callback_OnSaveChanges(e);};
// Callback есть пользователей больше 1 // Callback есть пользователей больше 1
this._CoAuthoringApi.onStartCoAuthoring = function (e) {t.callback_OnStartCoAuthoring(e);}; this._CoAuthoringApi.onStartCoAuthoring = function (e) {t.callback_OnStartCoAuthoring(e);};
this._CoAuthoringApi.init(user, docid, isviewermode, token, serverHost, serverPath, callback, editorType); this._CoAuthoringApi.init(user, docid, token, serverHost, serverPath, callback, editorType);
this._onlineWork = true; this._onlineWork = true;
} }
else { else {
...@@ -139,12 +137,6 @@ ...@@ -139,12 +137,6 @@
this._CoAuthoringApi.disconnect(); this._CoAuthoringApi.disconnect();
} }
}; };
CDocsCoApi.prototype.set_isViewerMode = function (isViewerMode) {
if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.set_isViewerMode(isViewerMode);
}
};
CDocsCoApi.prototype.callback_OnAuthParticipantsChanged = function (e) { CDocsCoApi.prototype.callback_OnAuthParticipantsChanged = function (e) {
if (this.onAuthParticipantsChanged) if (this.onAuthParticipantsChanged)
...@@ -196,11 +188,6 @@ ...@@ -196,11 +188,6 @@
if (this.onConnectionStateChanged) if (this.onConnectionStateChanged)
return this.onConnectionStateChanged (e); return this.onConnectionStateChanged (e);
}; };
CDocsCoApi.prototype.callback_OnUserStateChanged = function (e) {
if (this.onUserStateChanged)
return this.onUserStateChanged (e);
};
CDocsCoApi.prototype.callback_OnSetIndexUser = function (e) { CDocsCoApi.prototype.callback_OnSetIndexUser = function (e) {
if (this.onSetIndexUser) if (this.onSetIndexUser)
...@@ -237,7 +224,6 @@ ...@@ -237,7 +224,6 @@
this.onConnect = options.onConnect; this.onConnect = options.onConnect;
this.onFirstLoadChanges = options.onFirstLoadChanges; this.onFirstLoadChanges = options.onFirstLoadChanges;
this.onConnectionStateChanged = options.onConnectionStateChanged; this.onConnectionStateChanged = options.onConnectionStateChanged;
this.onUserStateChanged = options.onUserStateChanged;
} }
this._state = 0; this._state = 0;
this._participants = []; this._participants = [];
...@@ -418,15 +404,6 @@ ...@@ -418,15 +404,6 @@
this.isCloseCoAuthoring = true; this.isCloseCoAuthoring = true;
return this.sockjs.close(); return this.sockjs.close();
}; };
DocsCoApi.prototype.set_isViewerMode = function (isViewerMode) {
// Выставляем режим редактирования
isViewerMode = !!isViewerMode;
if (this._isviewermode != isViewerMode) {
this._isviewermode = isViewerMode;
this._send({"type": "setisviewermode", "isviewermode": this._isviewermode});
}
};
DocsCoApi.prototype.getMessages = function () { DocsCoApi.prototype.getMessages = function () {
this._send({"type": "getmessages"}); this._send({"type": "getmessages"});
...@@ -640,17 +617,14 @@ ...@@ -640,17 +617,14 @@
DocsCoApi.prototype._onParticipantsChanged = function (participants, isStartEvent) { DocsCoApi.prototype._onParticipantsChanged = function (participants, isStartEvent) {
this._participants = []; this._participants = [];
if (participants) { if (participants) {
var tmpUser, isViewerMode, countEditUsers = (!this._isviewermode) ? 1 : 0; var tmpUser, countEditUsers = 1;
for (var i = 0; i < participants.length; ++i) { for (var i = 0; i < participants.length; ++i) {
isViewerMode = participants[i]["isviewermode"];
tmpUser = new asc_user (); tmpUser = new asc_user ();
tmpUser.asc_setId (participants[i]["id"]); tmpUser.asc_setId (participants[i]["id"]);
tmpUser.asc_setUserName (participants[i]["username"]); tmpUser.asc_setUserName (participants[i]["username"]);
tmpUser.asc_setIsViewerMode (isViewerMode);
this._participants.push (tmpUser); this._participants.push (tmpUser);
// Считаем только число пользователей, которые редактируют // Считаем число всех пользователей (и тех кто просматривает тоже)
if (!isViewerMode) ++countEditUsers;
++countEditUsers;
} }
if (isStartEvent) { if (isStartEvent) {
...@@ -680,17 +654,6 @@ ...@@ -680,17 +654,6 @@
} }
}; };
DocsCoApi.prototype._onUserStateChanged = function (data) {
var userStateChanged = null;
if (undefined != data["isviewermode"] && this.onUserStateChanged) {
userStateChanged = new asc_user();
userStateChanged.asc_setId(data["id"]);
userStateChanged.asc_setUserName(data["username"]);
userStateChanged.asc_setIsViewerMode(data["isviewermode"]);
this.onUserStateChanged(userStateChanged);
}
};
var reconnectTimeout, attemptCount=0; var reconnectTimeout, attemptCount=0;
function initSocksJs(url,docsCoApi) { function initSocksJs(url,docsCoApi) {
...@@ -724,7 +687,6 @@ ...@@ -724,7 +687,6 @@
{ {
"type":"auth", "type":"auth",
"docid":docsCoApi._docid, "docid":docsCoApi._docid,
"isviewermode":docsCoApi._isviewermode,
"token":docsCoApi._token, "token":docsCoApi._token,
"user":docsCoApi._user.asc_getId(), "user":docsCoApi._user.asc_getId(),
"username":docsCoApi._user.asc_getUserName(), "username":docsCoApi._user.asc_getUserName(),
...@@ -777,10 +739,9 @@ ...@@ -777,10 +739,9 @@
} }
DocsCoApi.prototype.init = function (user, docid, isviewermode, token, serverHost, serverPath, callback, editorType) { DocsCoApi.prototype.init = function (user, docid, token, serverHost, serverPath, callback, editorType) {
this._user = user; this._user = user;
this._docid = docid; this._docid = docid;
this._isviewermode = isviewermode;
this._token = token; this._token = token;
this._initCallback = callback; this._initCallback = callback;
this.ownedLockBlocks=[]; this.ownedLockBlocks=[];
...@@ -859,9 +820,6 @@ ...@@ -859,9 +820,6 @@
"connectstate":function (data) { "connectstate":function (data) {
docsCoApi._onConnectionStateChanged(data); docsCoApi._onConnectionStateChanged(data);
}, },
"isviewermode":function (data) {
docsCoApi._onUserStateChanged(data);
},
"savechanges":function (data) { "savechanges":function (data) {
docsCoApi._onSaveChanges(data); docsCoApi._onSaveChanges(data);
}, },
......
/* docscoapicommon.js * * Author: Alexander.Trofimov * Date: 09.11.12 */( /** * @param {Window} window * @param {undefined} undefined */ function (window, undefined) { /* * Import * ----------------------------------------------------------------------------- */ var asc = window["Asc"] ? window["Asc"] : (window["Asc"] = {}); var prot; /** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */ function asc_CUser () { if ( !(this instanceof asc_CUser) ) { return new asc_CUser(); } this.id = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.isViewerMode = false; // режим просмотра или нет this.state = undefined; // состояние (true - подключен, false - отключился) return this; } asc_CUser.prototype = { constructor: asc_CUser, asc_getId: function () { return this.id; }, asc_getUserName: function () { return this.userName; }, asc_getIsViewerMode: function () { return this.isViewerMode; }, asc_getState: function () { return this.state; }, asc_setId: function (val) { this.id = val; }, asc_setUserName: function (val) { this.userName = val; }, asc_setIsViewerMode: function (val) { this.isViewerMode = val; }, asc_setState: function (val) { this.state = val; } }; /* * Export * ----------------------------------------------------------------------------- */ window["Asc"]["asc_CUser"] = window["Asc"].asc_CUser = asc_CUser; prot = asc_CUser.prototype; prot["asc_getId"] = prot.asc_getId; prot["asc_getUserName"] = prot.asc_getUserName; prot["asc_getIsViewerMode"] = prot.asc_getIsViewerMode; prot["asc_getState"] = prot.asc_getState; prot["asc_setId"] = prot.asc_setId; prot["asc_setUserName"] = prot.asc_setUserName; prot["asc_setIsViewerMode"] = prot.asc_setIsViewerMode; prot["asc_setState"] = prot.asc_setState; } )(window); /* docscoapicommon.js * * Author: Alexander.Trofimov * Date: 09.11.12 */( /** * @param {Window} window * @param {undefined} undefined */ function (window, undefined) { /* * Import * ----------------------------------------------------------------------------- */ var asc = window["Asc"] ? window["Asc"] : (window["Asc"] = {}); var prot; /** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */ function asc_CUser () { if ( !(this instanceof asc_CUser) ) { return new asc_CUser(); } this.id = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) return this; } asc_CUser.prototype = { constructor: asc_CUser, asc_getId: function () { return this.id; }, asc_getUserName: function () { return this.userName; }, asc_getState: function () { return this.state; }, asc_setId: function (val) { this.id = val; }, asc_setUserName: function (val) { this.userName = val; }, asc_setState: function (val) { this.state = val; } }; /* * Export * ----------------------------------------------------------------------------- */ window["Asc"]["asc_CUser"] = window["Asc"].asc_CUser = asc_CUser; prot = asc_CUser.prototype; prot["asc_getId"] = prot.asc_getId; prot["asc_getUserName"] = prot.asc_getUserName; prot["asc_getState"] = prot.asc_getState; prot["asc_setId"] = prot.asc_setId; prot["asc_setUserName"] = prot.asc_setUserName; prot["asc_setState"] = prot.asc_setState; } )(window);
\ No newline at end of file \ No newline at end of file
......
...@@ -1275,7 +1275,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1275,7 +1275,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.CoAuthoringApi.onAuthParticipantsChanged = function (e) { t.handlers.trigger("asc_onAuthParticipantsChanged", e ); }; this.CoAuthoringApi.onAuthParticipantsChanged = function (e) { t.handlers.trigger("asc_onAuthParticipantsChanged", e ); };
this.CoAuthoringApi.onMessage = function (e) { t.handlers.trigger("asc_onCoAuthoringChatReceiveMessage", e ); }; this.CoAuthoringApi.onMessage = function (e) { t.handlers.trigger("asc_onCoAuthoringChatReceiveMessage", e ); };
this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.handlers.trigger("asc_onConnectionStateChanged", e ); }; this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.handlers.trigger("asc_onConnectionStateChanged", e ); };
this.CoAuthoringApi.onUserStateChanged = function (e) { t.handlers.trigger("asc_onUserStateChanged", e ); };
this.CoAuthoringApi.onLocksAcquired = function (e) { this.CoAuthoringApi.onLocksAcquired = function (e) {
if ( 2 != e["state"] ) if ( 2 != e["state"] )
{ {
...@@ -1434,7 +1433,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1434,7 +1433,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} }
}; };
this.CoAuthoringApi.init (t.User, t.documentId, this.asc_getViewerMode(), 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){ this.CoAuthoringApi.init (t.User, t.documentId, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){
}, c_oEditorId.Speadsheet); }, c_oEditorId.Speadsheet);
}, },
......
...@@ -227,7 +227,6 @@ asc_docs_api.prototype._coAuthoringInit = function () { ...@@ -227,7 +227,6 @@ asc_docs_api.prototype._coAuthoringInit = function () {
this.CoAuthoringApi.onAuthParticipantsChanged = function (e) { t.asc_fireCallback( "asc_onAuthParticipantsChanged", e ); }; this.CoAuthoringApi.onAuthParticipantsChanged = function (e) { t.asc_fireCallback( "asc_onAuthParticipantsChanged", e ); };
this.CoAuthoringApi.onMessage = function (e) { t.asc_fireCallback( "asc_onCoAuthoringChatReceiveMessage", e ); }; this.CoAuthoringApi.onMessage = function (e) { t.asc_fireCallback( "asc_onCoAuthoringChatReceiveMessage", e ); };
this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.asc_fireCallback( "asc_onConnectionStateChanged", e ); }; this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.asc_fireCallback( "asc_onConnectionStateChanged", e ); };
this.CoAuthoringApi.onUserStateChanged = function (e) { t.asc_fireCallback( "asc_onUserStateChanged", e ); };
this.CoAuthoringApi.onLocksAcquired = function (e) { this.CoAuthoringApi.onLocksAcquired = function (e) {
if (2 != e["state"]) { if (2 != e["state"]) {
...@@ -483,7 +482,7 @@ asc_docs_api.prototype._coAuthoringInit = function () { ...@@ -483,7 +482,7 @@ asc_docs_api.prototype._coAuthoringInit = function () {
} }
}; };
this.CoAuthoringApi.init (editor.User, documentId, this.isViewMode, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){ this.CoAuthoringApi.init (editor.User, documentId, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){
}, c_oEditorId.Presentation); }, c_oEditorId.Presentation);
// ToDo init other callbacks // ToDo init other callbacks
......
...@@ -1313,7 +1313,6 @@ asc_docs_api.prototype._coAuthoringInit = function() ...@@ -1313,7 +1313,6 @@ asc_docs_api.prototype._coAuthoringInit = function()
}; };
this.CoAuthoringApi.onMessage = function (e) { t.asc_fireCallback( "asc_onCoAuthoringChatReceiveMessage", e ); }; this.CoAuthoringApi.onMessage = function (e) { t.asc_fireCallback( "asc_onCoAuthoringChatReceiveMessage", e ); };
this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.asc_fireCallback( "asc_onConnectionStateChanged", e ); }; this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.asc_fireCallback( "asc_onConnectionStateChanged", e ); };
this.CoAuthoringApi.onUserStateChanged = function (e) { t.asc_fireCallback( "asc_onUserStateChanged", e ); };
this.CoAuthoringApi.onLocksAcquired = function (e) this.CoAuthoringApi.onLocksAcquired = function (e)
{ {
if ( 2 != e["state"] ) if ( 2 != e["state"] )
...@@ -1448,7 +1447,7 @@ asc_docs_api.prototype._coAuthoringInit = function() ...@@ -1448,7 +1447,7 @@ asc_docs_api.prototype._coAuthoringInit = function()
} }
}; };
this.CoAuthoringApi.init (editor.User, documentId, this.isViewMode, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){ this.CoAuthoringApi.init (editor.User, documentId, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){
}, c_oEditorId.Word); }, c_oEditorId.Word);
// ToDo init other callbacks // ToDo init other callbacks
......
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