I've got a problem with the presence indicators in sharepoint 2007 when I add more than one contact web part onto a page.
I noticed that I always got gray bubbles when more than one contact was added so I searched around the internet for a solution. Someone found that the ID of the img tag (of the presence indicator bubble) should not be unique. Because SharePoint automatically adds static ID's to the img tag I needed to override the ID. So I wrote this javascript code (copied the guid functions actually ;-)):
function S4()
{
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
window.IMNRC = function(native) {
return function(name, elem) {
if(elem != null)
{
if(elem.id="contact_im,type=sip")
{
elem.id = guid();
}
}
native(name, elem);
}
}(window.IMNRC);
I don't know if it's good code, but when I added it to the page, the bubble showed the good presence of the contact. The only problem that I now have is that the menu does not work. When I hover over the presence indicator it becomes gray and all the links in the menu aren't working.
A collegue of me noticed that when he hovered over the presence indicator's a tooltip appeared with the name of the contact. Weird thing here is that the name did not matched the contact. When he refreshed he noticed that the name in the tooltip randomly changes. So I think this has something to do with me playing with the ID's of the img tag.
So now I have 2 options: - Or I need to start over and don't mess with the ID's off the img tag, and find another solution for the presence indicator problem - or I need to fix the menu problem.
Could someone help me with any of the 2 options?
Thanks!