home *** CD-ROM | disk | FTP | other *** search
-
-
- //create template for user management.
- function chatPanelObj()
- {
- this.chatPanelAddScreenName = chatPanelAddScreenName;
- this.chatPanelRemoveScreenName = chatPanelRemoveScreenName;
- this.chatPanelUpdateScreenName = chatPanelUpdateScreenName;
- return this;
- }
-
- myChatPanel = new chatPanelObj()
-
- function chatPanelOnWinLoad()
- {
- try {
- if(parent.myManager && parent.chatPanelLoaded) {
- for(z=0;z<parent.myManager.members.length;z++)
- chatPanelUpdateScreenName(parent.myManager.members[z].screenName,parent.myManager.members[z].status)
- }
- }
- catch (e) {
- dump("chatPanelOnWinLoad : couldnt find parent.myManager (caught exception) \n");
- }
-
- parent.chatPanelLoaded=true;
- }
-
- function chatPanelAddScreenName(screenName,initialState)
- {
- var listbox = document.getElementById("chatPanelTree");
- listitem=document.createElement("listitem");
- listitem.setAttribute('label',screenName)
- listitem.setAttribute('class',initialState);
- listbox.appendChild(listitem)
-
- top.updateMemberCount();
- top.chatContentStatusChange(screenName,initialState)
-
- if(listbox.childNodes.length == 1) {
- //Im the first person here! Select me
- document.getElementById("chatPanelTree").selectedIndex=0;
- }
- }
-
- function chatPanelRemoveScreenName(screenName)
- {
- var listbox = document.getElementById("chatPanelTree");
- var listitems = listbox.getElementsByTagName("listitem");
- var theDoomedScreenName = null;
- var theDoomedScreenNameWasSelected = false;
-
- for (k=0; k < listitems.length; k++) {
- if (listitems[k].getAttribute("label").toLowerCase() == screenName.toLowerCase())
- theDoomedScreenName = listitems[k];
- }
-
- if(theDoomedScreenName != null) {
- if(theDoomedScreenName.selected) {
- theDoomedScreenNameWasSelected = true;
- }
-
- listbox.removeChild(theDoomedScreenName)
- top.updateMemberCount();
- top.chatContentStatusChange(screenName,"has left")
- }
-
- if (theDoomedScreenNameWasSelected) {
- //it was selected - reset selection now
- //dont need to check for 0 because if it's zero - you'd not be in the chatroom yourself
- listbox.selectedIndex= 0 ;
- }
-
- }
-
- //update the status of a given screenname
- function chatPanelUpdateScreenName(screenName,snStatus)
- {
- var theTreeChildren = document.getElementsByTagName("listitem");
- var theSNtoUpdate= null;
- for (j=0; j<theTreeChildren.length; j++) {
- if(aimIsSameScreenName(theTreeChildren.item(j).getAttribute("label"), screenName)) {
- theSNtoUpdate = theTreeChildren.item(j);
- }
- }
-
- if(theSNtoUpdate!=null) {
- theSNtoUpdate.setAttribute("class",snStatus);
-
- // in case its formatting has changed
- theSNtoUpdate.setAttribute("label", screenName);
- top.updateMemberCount();
- top.chatContentStatusChange(screenName,snStatus)
- }
- else {
- chatPanelAddScreenName(screenName,snStatus)
- }
- }
-
-
- function cmdUserSelected(e)
- {
- document.getElementById("userSelected").setAttribute("disabled","false")
- var theTree = document.getElementById("chatPanelTree")
- if(theTree.selectedItems.length >=1 ) {
- document.getElementById("userSelected").setAttribute("selectedScreenName",theTree.selectedItems[0].getAttribute("label"))
- document.getElementById("userSelected").setAttribute("disabled","false");
- }
- if(theTree.selectedItems.length==0) {
- document.getElementById("userSelected").setAttribute("disabled","true")
- document.getElementById("userSelected").setAttribute("selectedScreenName",'')
- }
- }
-
- function cmdSendIMFromChat()
- {
- var theTree = document.getElementById("chatPanelTree")
- if(theTree.selectedItems.length>=1) {
- var selectedScreenName = cmdGetSelectedScreenName();
- aimIMInvokeIMForm(selectedScreenName);
- }
- else
- aimIMInvokeIMForm(null, null);
- }
-
- function cmdIgnoreFromChat()
- {
- var theTree = document.getElementById("chatPanelTree")
- var i;
- for (i = 0; i < theTree.selectedItems.length; i++) {
- var selectedScreenName =theTree.selectedItems[i].getAttribute("label");
- var wasIgnored = top.chatRoomObj.Ignore(selectedScreenName);
- if (wasIgnored)
- top.frames['chatpanel'].chatPanelUpdateScreenName(selectedScreenName, "joined");
- else
- top.frames['chatpanel'].chatPanelUpdateScreenName(selectedScreenName, "ignored");
- }
- }
-
- function cmdGetSelectedScreenName()
- {
- return document.getElementById("userSelected").getAttribute("selectedScreenName")
- }
-
- function cmdUserBlurred(e)
- {
- //I'm an empty fn and I don't do any useful thing.
- //document.getElementById("userSelected").setAttribute("disabled","true");
- }
-
-
-
-
-
-