Commit ff24c099 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил список UserColors (теперь цвета берутся из этого списка). На сервер не...

Добавил список UserColors (теперь цвета берутся из этого списка). На сервер не передаем цвет, вместо этого индекс пользователя генерируется на сервере (теперь он начинается с 0).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57922 954022d7-b5bf-4e40-9824-e11837661b57
parent 33f843b6
......@@ -1276,12 +1276,8 @@ function DrawingObjects() {
var aObjects = null;
var aImagesSync = null;
var aObjectsSync = null;
var aBoundsCheckers = [];
var userId = null;
var documentId = null;
_this.zoom = { last: 1, current: 1 };
_this.isViewerMode = null;
_this.objectLocker = null;
......@@ -1668,8 +1664,6 @@ function DrawingObjects() {
setInterval(drawTaskFunction, 5);
var api = window["Asc"]["editor"];
userId = api.User.asc_getId();
documentId = api.documentId;
worksheet = currentSheet;
drawingCtx = currentSheet.drawingGraphicCtx;
......@@ -1699,7 +1693,6 @@ function DrawingObjects() {
_this.isViewerMode = function() { return worksheet.handlers.trigger("getViewerMode"); };
aImagesSync = [];
aObjectsSync = [];
var i;
aObjects = currentSheet.model.Drawings;
......
......@@ -1050,4 +1050,19 @@
var CColor = window["CColor"];
var asc_ChartSettings = window["asc_ChartSettings"];
var asc_ValAxisSettings = window["asc_ValAxisSettings"];
var asc_CatAxisSettings = window["asc_CatAxisSettings"];
\ No newline at end of file
var asc_CatAxisSettings = window["asc_CatAxisSettings"];
var g_oArrUserColors = [15064320, 58807, 16724950, 1759488, 9981439, 56805, 15050496, 15224319, 10154496, 16731553,
62146, 47077, 1828096, 15859712, 15427327, 15919360, 15905024, 59890, 12733951, 13496832, 62072, 49906,16734720,
10682112, 7890687, 16731610, 65406, 38655, 16747008, 14221056, 16737966, 1896960, 65484, 10970879, 16759296,
16711680, 63231, 16774656, 2031360, 52479, 13330175, 16743219, 3386367, 11927347, 16752947, 9404671, 4980531,
16744678, 3407830, 11960575, 16724787, 10878873, 14745395, 16762931, 15696127, 3397375, 16744636,3407768, 3406079,
13926655, 15269734, 16751083, 6742271, 16766566, 13107046, 16775219, 16751718, 10852863, 6750176, 16737894,
14457343, 16759142, 6750130, 6865407, 15650047, 16769945, 7929702, 16751049, 6748927, 16751001, 12884479,
16775782, 16765081, 10087423, 10878873, 16757744, 10081791, 14352281, 15053823, 10092523, 16760217, 15728537,
13815039, 16776652, 16757719, 13432319, 16773580, 13828044, 15650047, 15893248, 16724883, 58737, 15007744, 36594,
12772608, 12137471, 6442495, 9561344, 15021055, 34789, 15039488, 44761, 16718470, 14274816, 11606783, 9099520,
53721, 16718545, 1625088, 15881472, 13419776, 50636, 14752511, 55659, 14261760, 32985, 11389952, 16711800,
8571904, 1490688, 16711884, 8991743, 13407488, 41932, 11010303, 7978752, 15028480, 52387, 15007927, 52325, 47295,
14549247, 12552960, 12564480, 39359, 15007852, 12114176, 1421824, 55726, 13041893, 10665728, 30924, 49049,
14251264, 48990, 14241024, 36530, 11709440, 13369507, 44210, 11698688, 7451136, 13397504, 45710, 34214];
\ No newline at end of file
"use strict";
(function (global) {
(function (window, undefined) {
'use strict';
var asc = window["Asc"];
var asc_user = asc.asc_CUser;
var asc_coAuthV = '3.0.1';
var asc_coAuthV = '3.0.2';
// Класс надстройка, для online и offline работы
var CDocsCoApi = function (options) {
function CDocsCoApi (options) {
this._CoAuthoringApi = new DocsCoApi();
this._onlineWork = false;
......@@ -28,7 +27,7 @@
this.onStartCoAuthoring = options.onStartCoAuthoring;
this.onEndCoAuthoring = options.onEndCoAuthoring;
}
};
}
CDocsCoApi.prototype.init = function (user, docid, token, callback, editorType, documentFormatSave, isViewer) {
if (this._CoAuthoringApi && this._CoAuthoringApi.isRightURL()) {
......@@ -242,7 +241,7 @@
* 2 - authorized
* 3 - closed
*/
var DocsCoApi = function (options) {
function DocsCoApi (options) {
if (options) {
this.onAuthParticipantsChanged = options.onAuthParticipantsChanged;
this.onParticipantsChanged = options.onParticipantsChanged;
......@@ -305,7 +304,7 @@
this._isAuth = false;
this._documentFormatSave = 0;
this._isViewer = false;
};
}
DocsCoApi.prototype.isRightURL = function () {
return ("" != this._url);
......@@ -704,7 +703,7 @@
if (participants) {
var tmpUser;
for (var i = 0; i < participants.length; ++i) {
tmpUser = new asc_user(participants[i]);
tmpUser = new asc.asc_CUser(participants[i]);
this._participants[tmpUser.asc_getId()] = tmpUser;
// Считаем только число редакторов
if (!tmpUser.asc_getView())
......@@ -726,7 +725,7 @@
DocsCoApi.prototype._onConnectionStateChanged = function (data) {
var userStateChanged = null, userId, stateChanged = false, isEditUser = true;
if (undefined !== data["state"] && this.onConnectionStateChanged) {
userStateChanged = new asc_user(data);
userStateChanged = new asc.asc_CUser(data);
userId = userStateChanged.asc_getId();
isEditUser = !userStateChanged.asc_getView();
......@@ -854,8 +853,7 @@
'token' : t._token,
'user' : {
'id' : t._user.asc_getId(),
'name' : t._user.asc_getUserName(),
'color' : t._user.asc_getColorValue()
'name' : t._user.asc_getUserName()
},
'locks' : t.ownedLockBlocks,
'sessionId' : t._id,
......@@ -923,5 +921,5 @@
};
global["CDocsCoApi"] = CDocsCoApi;
window["CDocsCoApi"] = CDocsCoApi;
})(window);
\ 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) { if ( !(this instanceof asc_CUser) ) { return new asc_CUser(val); } this.id = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype = { constructor: asc_CUser, _setUser: function (val) { if (val) { this.id = val["id"]; this.userName = val["username"]; this.color = val["color"]; this.state = val["state"]; this.view = val["view"]; } else { this.color = asc.generateColor(); } }, asc_getId: function () { return this.id; }, asc_getUserName: function () { return this.userName; }, asc_getState: function () { return this.state; }, asc_getColor: function () { return '#' + ('000000' + this.color.toString(16)).substr(-6); }, asc_getColorValue: function () { return this.color; }, asc_getView: function () { return this.view; }, asc_setId: function (val) { this.id = val; }, asc_setUserName: function (val) { this.userName = val; }, asc_setState: function (val) { this.state = val; }, 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_getColorValue"] = prot.asc_getColorValue; 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);
\ 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.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 = g_oArrUserColors[this.indexUser % g_oArrUserColors.length]; 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_getColorValue = function () { return this.color; }; 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_getColorValue"] = prot.asc_getColorValue; 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);
\ No newline at end of file
......
......@@ -16,7 +16,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var asc_applyFunction = asc.applyFunction;
var asc_CCollaborativeEditing = asc.CCollaborativeEditing;
var asc_CAdjustPrint = asc.asc_CAdjustPrint;
var asc_user = asc.asc_CUser;
var asc_CAscEditorPermissions = asc.asc_CAscEditorPermissions;
var asc_CAscLicense = asc.asc_CAscLicense;
var asc_CTrackFile = asc.CTrackFile;
......@@ -453,7 +452,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.documentTitleWithoutExtention = this.documentTitle;
// Выставляем пользователя
this.User = new asc_user();
this.User = new asc.asc_CUser();
this.User.asc_setId(this.DocInfo["UserId"]);
this.User.asc_setUserName(this.DocInfo["UserName"]);
}
......@@ -1476,7 +1475,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
//Если User не задан, отключаем коавторинг.
if (null == t.User || null == t.User.asc_getId()) {
t.User = new asc_user();
t.User = new asc.asc_CUser();
t.User.asc_setId("Unknown");
t.User.asc_setUserName("Unknown");
t._coAuthoringSetServerUrl("");
......@@ -3394,7 +3393,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
window.g_cAscCoAuthoringUrl = "";
window.g_cAscSpellCheckUrl = "";
this.User = new asc_user();
this.User = new asc.asc_CUser();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
......
......@@ -248,8 +248,7 @@ asc_docs_api.prototype._coAuthoringInit = function () {
this._coAuthoringSetServerUrl(window.g_cAscCoAuthoringUrl);
}
if (null == this.User || null == this.User.asc_getId()) {
var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user();
this.User = new Asc.asc_CUser();
this.User.asc_setId("Unknown");
this.User.asc_setUserName("Unknown");
......@@ -823,8 +822,7 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
else
documentOrigin = sHost;
var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user();
this.User = new Asc.asc_CUser();
this.User.asc_setId(this.DocInfo.get_UserId());
this.User.asc_setUserName(this.DocInfo.get_UserName());
}
......@@ -5280,9 +5278,8 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File)
window.g_cAscCoAuthoringUrl = "";
window.g_cAscSpellCheckUrl = "";
var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user();
this.User = new Asc.asc_CUser();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
......
......@@ -988,8 +988,7 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
else
documentOrigin = sHost;
var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user();
this.User = new Asc.asc_CUser();
this.User.asc_setId(this.DocInfo.get_UserId());
this.User.asc_setUserName(this.DocInfo.get_UserName());
}
......@@ -1476,8 +1475,7 @@ asc_docs_api.prototype._coAuthoringInit = function()
}
//Если User не задан, отключаем коавторинг.
if (null == this.User || null == this.User.asc_getId()) {
var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user();
this.User = new Asc.asc_CUser();
this.User.asc_setId("Unknown");
this.User.asc_setUserName("Unknown");
......@@ -7721,8 +7719,8 @@ asc_docs_api.prototype.asc_AddMath2 = function(Type)
{
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
var MathElement = new MathMenu (Type)
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
var MathElement = new MathMenu (Type);
this.WordControl.m_oLogicDocument.Paragraph_Add( MathElement );
}
};
......@@ -7734,9 +7732,8 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File)
window.g_cAscCoAuthoringUrl = "";
window.g_cAscSpellCheckUrl = "";
var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user();
this.User = new Asc.asc_CUser();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
......
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