fixed the backward compatility to old colorIds

This commit is contained in:
Peter 'Pita' Martischka 2011-08-21 18:53:30 +01:00
parent 6c354c6333
commit 4f233d88f8
4 changed files with 14 additions and 8 deletions

View File

@ -741,7 +741,7 @@ function loadBroadcastJS()
for (var author in newAuthorData) for (var author in newAuthorData)
{ {
var data = newAuthorData[author]; var data = newAuthorData[author];
var bgcolor = data.colorId; var bgcolor = typeof data.colorId == "number" ? clientVars.colorPalette[data.colorId] : data.colorId;
if (bgcolor && dynamicCSS) if (bgcolor && dynamicCSS)
{ {
dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author)).backgroundColor = bgcolor; dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author)).backgroundColor = bgcolor;

View File

@ -407,6 +407,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
{ {
var userInfo = msg.userInfo; var userInfo = msg.userInfo;
var id = userInfo.userId; var id = userInfo.userId;
if (userSet[id]) if (userSet[id])
{ {
userSet[id] = userInfo; userSet[id] = userInfo;
@ -471,6 +472,11 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
function tellAceAuthorInfo(userId, colorId, inactive) function tellAceAuthorInfo(userId, colorId, inactive)
{ {
if(typeof colorId == "number")
{
colorId = clientVars.colorPalette[colorId];
}
var cssColor = colorId; var cssColor = colorId;
if (inactive) if (inactive)
{ {

View File

@ -227,12 +227,6 @@ function handshake()
clientVars.userAgent = "Anonymous"; clientVars.userAgent = "Anonymous";
clientVars.collab_client_vars.clientAgent = "Anonymous"; clientVars.collab_client_vars.clientAgent = "Anonymous";
//translate old colorIDs to RGB strings
if(typeof clientVars.userColor == "number")
{
clientVars.userColor = clientVars.colorPalette[clientVars.userColor];
}
//initalize the pad //initalize the pad
pad.init(); pad.init();
initalized = true; initalized = true;

View File

@ -499,6 +499,12 @@ var paduserlist = (function()
}, },
setMyUserInfo: function(info) setMyUserInfo: function(info)
{ {
//translate the colorId
if(typeof info.colorId == "number")
{
info.colorId = clientVars.colorPalette[info.colorId];
}
myUserInfo = $.extend( myUserInfo = $.extend(
{}, info); {}, info);
@ -513,7 +519,7 @@ var paduserlist = (function()
} }
var userData = {}; var userData = {};
userData.color = info.colorId; userData.color = typeof info.colorId == "number" ? clientVars.colorPalette[info.colorId] : info.colorId;
userData.name = info.name; userData.name = info.name;
userData.status = ''; userData.status = '';
userData.activity = ''; userData.activity = '';