Commit 8b68e7dd authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

На сервере:

- coAuthV: 3.0.9
- name -> username
- isViewer from connection -> user.view
- отправляем сразу user, а не делаем новый объект (и для publish тоже)
- checkEndAuthLock delete unused participants
- connectState user вместо полей

На клиенте:
- поправил методы у класса user
- onSaveChanges посылаем useridoriginal
- цвет пользователя теперь определяем по useridoriginal

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66710 954022d7-b5bf-4e40-9824-e11837661b57
parent 1bca6133
......@@ -159,8 +159,8 @@ baseEditorsApi.prototype.asc_setDocInfo = function(oDocInfo) {
this.documentOpenOptions = this.DocInfo.asc_getOptions();
this.User = new Asc.asc_CUser();
this.User.asc_setId(this.DocInfo.get_UserId());
this.User.asc_setUserName(this.DocInfo.get_UserName());
this.User.setId(this.DocInfo.get_UserId());
this.User.setUserName(this.DocInfo.get_UserName());
}
if (undefined !== window["AscDesktopEditor"] && offlineMode != this.documentUrl) {
......@@ -347,8 +347,8 @@ baseEditorsApi.prototype._coAuthoringInit = function() {
//Если User не задан, отключаем коавторинг.
if (null == this.User || null == this.User.asc_getId()) {
this.User = new Asc.asc_CUser();
this.User.asc_setId("Unknown");
this.User.asc_setUserName("Unknown");
this.User.setId("Unknown");
this.User.setUserName("Unknown");
}
//в обычном серверном режиме портим ссылку, потому что CoAuthoring теперь имеет встроенный адрес
//todo надо использовать проверку get_OfflineApp
......
......@@ -39,7 +39,7 @@
asc_getCanDownload: function(){ return this.canDownload; },
asc_getCanCoAuthoring: function(){ return this.canCoAuthoring; },
asc_getCanReaderMode: function(){ return this.canReaderMode; },
asc_getCanBranding: function(v){ return this.canBranding; },
asc_getCanBranding: function(){ return this.canBranding; },
asc_getIsAutosaveEnable: function(){ return this.isAutosaveEnable; },
asc_getAutosaveMinInterval: function(){ return this.AutosaveMinInterval; },
asc_getIsAnalyticsEnable: function(){ return this.isAnalyticsEnable; },
......
......@@ -4,7 +4,7 @@
'use strict';
var asc = window["Asc"];
var asc_coAuthV = '3.0.8';
var asc_coAuthV = '3.0.9';
// Класс надстройка, для online и offline работы
function CDocsCoApi(options) {
......@@ -904,7 +904,7 @@
if (change['user'] !== this._userId) {
this.lastOtherSaveTime = change['time'];
}
this.onSaveChanges(JSON.parse(changesOneUser), change['user'], bFirstLoad);
this.onSaveChanges(JSON.parse(changesOneUser), change['useridoriginal'], bFirstLoad);
}
}
}
......@@ -992,8 +992,9 @@
DocsCoApi.prototype._onConnectionStateChanged = function(data) {
var userStateChanged = null, userId, stateChanged = false, isEditUser = true;
if (undefined !== data["state"] && this.onConnectionStateChanged) {
userStateChanged = new asc.asc_CUser(data);
if (this.onConnectionStateChanged) {
userStateChanged = new asc.asc_CUser(data['user']);
userStateChanged.setState(data["state"]);
userId = userStateChanged.asc_getId();
isEditUser = !userStateChanged.asc_getView();
......@@ -1152,7 +1153,7 @@
'token': this._token,
'user': {
'id': this._user.asc_getId(),
'name': this._user.asc_getUserName(),
'username': this._user.asc_getUserName(),
'indexUser': this._indexUser
},
'editorType': this.editorType,
......@@ -1160,7 +1161,7 @@
'block': this.ownedLockBlocks,
'sessionId': this._id,
'documentFormatSave': this._documentFormatSave,
'isViewer': this._isViewer,
'view': this._isViewer,
'isCloseCoAuthoring': this.isCloseCoAuthoring,
'version': asc_coAuthV
});
......
"use strict"; /* 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 (val) { this.id = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.indexUser = -1; // Индекс пользователя (фактически равно числу заходов в документ на сервере) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype._setUser = function (val) { if (val) { this.id = val['id']; this.userName = val['username']; this.indexUser = val['indexUser']; this.color = getUserColorById(this.id, this.userName, false, true); this.state = val['state']; this.view = val['view']; } }; asc_CUser.prototype.asc_getId = function () { return this.id; }; asc_CUser.prototype.asc_getUserName = function () { return this.userName; }; asc_CUser.prototype.asc_getState = function () { return this.state; }; asc_CUser.prototype.asc_getColor = function () { return '#' + ('000000' + this.color.toString(16)).substr(-6); }; asc_CUser.prototype.asc_getView = function () { return this.view; }; asc_CUser.prototype.asc_setId = function (val) { this.id = val; }; asc_CUser.prototype.asc_setUserName = function (val) { this.userName = val; }; asc_CUser.prototype.asc_setState = function (val) { this.state = val; }; asc_CUser.prototype.asc_setColor = function (val) { this.color = 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_getColor"] = prot.asc_getColor; prot["asc_getView"] = prot.asc_getView; prot["asc_setUserName"] = prot.asc_setUserName; prot["asc_setState"] = prot.asc_setState; prot["asc_setColor"] = prot.asc_setColor; } )(window); var ConnectionState = { Reconnect: -1, // reconnect state None: 0, // not initialized WaitAuth: 1, // waiting session id Authorized: 2, // authorized ClosedCoAuth: 3, // closed coauthoring ClosedAll: 4, // closed all SaveChanges: 10 // save };
\ No newline at end of file
"use strict"; /* 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(val) { this.id = null; // уникальный id - пользователя this.idOriginal = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.indexUser = -1; // Индекс пользователя (фактически равно числу заходов в документ на сервере) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype._setUser = function(val) { if (val) { this.id = val['id']; this.idOriginal = val['idOriginal']; this.userName = val['username']; this.indexUser = val['indexUser']; this.color = getUserColorById(this.idOriginal, this.userName, false, true); this.view = val['view']; } }; asc_CUser.prototype.asc_getId = function() { return this.id; }; asc_CUser.prototype.asc_getUserName = function() { return this.userName; }; asc_CUser.prototype.asc_getState = function() { return this.state; }; asc_CUser.prototype.asc_getColor = function() { return '#' + ('000000' + this.color.toString(16)).substr(-6); }; asc_CUser.prototype.asc_getView = function() { return this.view; }; asc_CUser.prototype.setId = function(val) { this.id = val; }; asc_CUser.prototype.setUserName = function(val) { this.userName = val; }; asc_CUser.prototype.setState = function(val) { this.state = val; }; /* * Export * ----------------------------------------------------------------------------- */ 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_getColor"] = prot.asc_getColor; prot["asc_getView"] = prot.asc_getView; })(window); var ConnectionState = { Reconnect: -1, // reconnect state None: 0, // not initialized WaitAuth: 1, // waiting session id Authorized: 2, // authorized ClosedCoAuth: 3, // closed coauthoring ClosedAll: 4, // closed all SaveChanges: 10 // save };
\ No newline at end of file
......
......@@ -2937,8 +2937,8 @@ var editor;
this.SpellCheckUrl = '';
this.User = new asc.asc_CUser();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
this.User.setId("TM");
this.User.setUserName("native");
this.wbModel = new Workbook(this.handlers, this);
this.initGlobalObjects(this.wbModel);
......
......@@ -4709,8 +4709,8 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
this.SpellCheckUrl = '';
this.User = new Asc.asc_CUser();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
this.User.setId("TM");
this.User.setUserName("native");
this.WordControl.m_bIsRuler = false;
this.WordControl.Init();
......
......@@ -6646,8 +6646,8 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
this.SpellCheckUrl = '';
this.User = new Asc.asc_CUser();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
this.User.setId("TM");
this.User.setUserName("native");
this.WordControl.m_bIsRuler = false;
this.WordControl.Init();
......
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