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)
{
var data = newAuthorData[author];
var bgcolor = data.colorId;
var bgcolor = typeof data.colorId == "number" ? clientVars.colorPalette[data.colorId] : data.colorId;
if (bgcolor && dynamicCSS)
{
dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author)).backgroundColor = bgcolor;

View file

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

View file

@ -227,12 +227,6 @@ function handshake()
clientVars.userAgent = "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
pad.init();
initalized = true;

View file

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