1154 lines
24 KiB
HTML
1154 lines
24 KiB
HTML
<HTML XMLNS:helpcenter>
|
|
<!--
|
|
ChatServer.htm: Implementation of the helpee chat window and controls
|
|
Rajesh Soy (nsoy) - updated for new UI 08/18/2000
|
|
-->
|
|
<HEAD>
|
|
<helpcenter:context id=idCtx />
|
|
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
|
|
<TITLE>Remote Control Help Session</TITLE>
|
|
<LINK id="UI_StyleSheet" REL="stylesheet" TYPE="text/css" HREF="rc.css">
|
|
<script LANGUAGE="Javascript" SRC="../rcexpert/Constants.js"> </script>
|
|
<script LANGUAGE="Javascript" SRC="../rcexpert/common.js"> </script>
|
|
|
|
<!-- The SAF class factory object -->
|
|
<OBJECT classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7 height=0 id=oSAFClassFactory
|
|
width=0></OBJECT>
|
|
|
|
</HEAD>
|
|
|
|
|
|
<BODY id="idBody" onload=InitiateRCSession() style="BACKGROUND-COLOR: lightgrey" onunload=DisconnectRC() scroll=no onresize="Resize()" tabindex=-1>
|
|
<div id="ChatServerId" class="styHelpBackGround" style="position:absolute;top:1px;left:1px;width:100%;" >
|
|
<!--
|
|
Title and control panel
|
|
-->
|
|
<Table bgcolor="LightGrey" cellpadding=0 cellspacing=0 width=100%>
|
|
<tr>
|
|
<td colspan=2>
|
|
<FONT class=styHeader> Chatting with</FONT> <Span id=idHelperName> </Span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2>
|
|
<table border=0>
|
|
<tr>
|
|
<td> <BUTTON align="center" CLASS="styButton" id="RejectId" onclick="RejectRC( 1 )" tabindex=1 accesskey="C"> Stop <u>C</u>ontrol </BUTTON> </td>
|
|
<td> <BUTTON align="center" CLASS="styButton" id="FileXferId" onclick=LaunchFileXfer(0) tabindex=2 accesskey="F"> Send a <u>F</u>ile... </BUTTON> </td>
|
|
<td> <BUTTON align="center" CLASS="styButton" id=btnAbortConnection onclick=AbortConnection() tabindex=3 accesskey="Q"> <u>Q</u>uit </BUTTON> </td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2> <hr class="styHorzLine"> </td>
|
|
</tr>
|
|
</Table>
|
|
</Div>
|
|
|
|
<Div id="ChatServerLayer" class="styHelpBackGround" style="position:absolute;left:1px;top:65px;width=100%;">
|
|
<Table bgcolor="LightGrey" cellpadding=0 cellspacing=0 width=100% height=100%>
|
|
<tr>
|
|
<td height=30px align="left">
|
|
<div id=idStatus> </div>
|
|
</td>
|
|
<td height=30px align="right" >
|
|
<div id=idtogglechat onclick=HideChatBox()> </div>
|
|
</td>
|
|
</tr>
|
|
<TR>
|
|
<!--
|
|
Incoming chat display area
|
|
-->
|
|
<TD colspan=2><TEXTAREA style="width:100%;height:100%" id=incomingChatText name=incomingChatText readOnly wrap=VIRTUAL multiline="true" disabled="false" ></TEXTAREA></TD>
|
|
</TR>
|
|
<TR>
|
|
<!--
|
|
Chat text box
|
|
-->
|
|
<TD height=40px width=80%>
|
|
<TEXTAREA style="width:95%;height=22px" align="center" id=chatText name=chatText onkeypress=OnEnter() rows=1 wrap=VIRTUAL ></TEXTAREA>
|
|
</TD>
|
|
<TD align="center">
|
|
<input class="styButton" align="center" type="submit" id=sendChatButton name=sendChatButton onclick=SendChatButtonHandler() value="Submit" tabindex=0 accesskey="S">
|
|
</TD>
|
|
</TR>
|
|
</Table>
|
|
</div>
|
|
|
|
<SCRIPT Language="JScript">
|
|
//
|
|
// Salem objects.
|
|
//
|
|
var vArgs = null;
|
|
var g_oSAFRemoteDesktopSession = null;
|
|
var g_oSAFRemoteDesktopChannelMgr = null;
|
|
var g_oChatChannel = null;
|
|
var g_oControlChannel = null;
|
|
var g_numTries = 0;
|
|
|
|
|
|
//
|
|
// Globals
|
|
//
|
|
var g_bChatBoxHidden = false;
|
|
var g_bNewBinaries = false;
|
|
var g_bUserDisconnect = false;
|
|
var g_bChatMode = true;
|
|
var g_bConnected = false;
|
|
var g_bRC = false;
|
|
var g_bNewLine = false;
|
|
|
|
//
|
|
// Contants
|
|
//
|
|
var c_szFileXferURL = "../RCExpert/RCFileXfer.htm";
|
|
var c_szMsgURL = "../RCExpert/ErrorMsgs.htm";
|
|
|
|
g_bDebug = true; // Enable Tracing
|
|
|
|
|
|
function document.onkeydown()
|
|
{
|
|
if (window.event.keyCode==8)
|
|
window.event.returnValue=false;
|
|
}
|
|
|
|
|
|
function Resize()
|
|
{
|
|
ChatServerId.style.width=idBody.clientWidth-2;
|
|
ChatServerLayer.style.width=idBody.clientWidth-2;
|
|
ChatServerLayer.style.height=idBody.clientHeight-60;
|
|
}
|
|
|
|
//
|
|
// InitiateRCSession: Initiates the RC Session
|
|
//
|
|
function InitiateRCSession()
|
|
{
|
|
//
|
|
// Initialization
|
|
//
|
|
InitTrace();
|
|
TraceFunctEnter("InitiateRCSession");
|
|
var bIsIM = false;
|
|
|
|
if (document.URL.indexOf("?IM=1", 1) != -1) {
|
|
// from IM: No chatbox
|
|
bIsIM = true;
|
|
}
|
|
|
|
DebugTrace("Changing to kioskmode");
|
|
idCtx.ChangeContext( "kioskmode", "");
|
|
if (bIsIM)
|
|
idCtx.setWindowDimensions( 5, 5, 356, 136);
|
|
else
|
|
idCtx.setWindowDimensions( 10, 10, 356, 236);
|
|
|
|
idtogglechat.innerHTML = "<div class=styText> Hide Chat <img src=\"../rcexpert/hide-chat.gif\"> </div>";
|
|
g_bNewBinaries = true;
|
|
|
|
//
|
|
// Fill the Helper's name
|
|
//
|
|
idHelperName.innerHTML = "<span class=styText> (" + parent.gHelper + ")</span>";
|
|
|
|
//
|
|
// Connection Status
|
|
//
|
|
idStatus.innerHTML = "<div class=styText> <IMG src=\"../rcexpert/status_connected.gif\"> <STRONG>Status</STRONG> :Connected in VIEW mode</div>";
|
|
|
|
|
|
DebugTrace( "Obtaining g_oSAFRemoteDesktopSession");
|
|
g_oSAFRemoteDesktopSession = parent.oRCSession;
|
|
|
|
|
|
//
|
|
// Reject RC button is disabled
|
|
//
|
|
RejectId.disabled = true;
|
|
if(null == g_oSAFRemoteDesktopSession)
|
|
{
|
|
FatalError( L_ERRNULLRCSESSION );
|
|
oSAFClassFactory.Close();
|
|
}
|
|
else
|
|
{
|
|
|
|
var x;
|
|
|
|
try
|
|
{
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
|
|
//
|
|
// Add the chat channel
|
|
//
|
|
g_oSAFRemoteDesktopSession.AddChannels( c_szChatChannelID );
|
|
|
|
//
|
|
// Add the control channel
|
|
//
|
|
g_oSAFRemoteDesktopSession.AddChannels( c_szControlChannelID );
|
|
|
|
//
|
|
// Bind OnChannelDataReady callback
|
|
//
|
|
g_oSAFRemoteDesktopSession.OnChannelDataReady = function(channelID)
|
|
{ OnChannelDataReadyEvent(channelID); }
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use new interface
|
|
//
|
|
|
|
//
|
|
// Get the Channel Manager
|
|
//
|
|
DebugTrace("Getting ChannelManager");
|
|
g_oSAFRemoteDesktopChannelMgr = g_oSAFRemoteDesktopSession.ChannelManager;
|
|
|
|
//
|
|
// Open the Chat channel
|
|
//
|
|
DebugTrace("Opening ChatChannel");
|
|
g_oChatChannel = g_oSAFRemoteDesktopChannelMgr.OpenDataChannel( c_szChatChannelID );
|
|
|
|
//
|
|
// Open the Control Channel
|
|
//
|
|
DebugTrace("Opening Control Channel");
|
|
g_oControlChannel = g_oSAFRemoteDesktopChannelMgr.OpenDataChannel( c_szControlChannelID );
|
|
|
|
//
|
|
// Setup the ChannelDataReady handlers
|
|
//
|
|
DebugTrace("Binding Events");
|
|
g_oChatChannel.OnChannelDataReady = function()
|
|
{ ChatChannelDataReadyEvent(); }
|
|
|
|
g_oControlChannel.OnChannelDataReady = function()
|
|
{ ControlChannelDataReadyEvent(); }
|
|
|
|
}
|
|
}
|
|
catch(e)
|
|
{
|
|
//
|
|
// We reach here because the helpee has not initialized yet
|
|
//
|
|
if(g_numTries < 5 )
|
|
{
|
|
//
|
|
// Allow a maximum of 5 seconds
|
|
//
|
|
setTimeout('InitiateRCSession()',1000);
|
|
g_numTries++;
|
|
}
|
|
else
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
}
|
|
|
|
//
|
|
// Setup the OnDisconnected event callback
|
|
//
|
|
g_oSAFRemoteDesktopSession.OnDisconnected = function()
|
|
{ OnClientDisconnected(); }
|
|
|
|
}
|
|
|
|
try
|
|
{
|
|
//
|
|
// Also, Enable Remote Control
|
|
//
|
|
DebugTrace("Enabling Remote Control");
|
|
EnableRemoteControl();
|
|
|
|
//
|
|
// Transmit screen resolution to Expert, so that
|
|
// he has the right screen size to see in the RC Tool
|
|
//
|
|
DebugTrace("Transmitting screen info");
|
|
TransmitScreenInfo();
|
|
|
|
}
|
|
catch(error)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
|
|
g_bConnected = true;
|
|
|
|
//Get the focus on to the chat box.
|
|
chatText.click();
|
|
chatText.select();
|
|
|
|
if (bIsIM)
|
|
HideChatBox();
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// TransmitScreenInfo: Sends the user's screen resolution to the expert
|
|
//
|
|
function TransmitScreenInfo()
|
|
{
|
|
TraceFunctEnter("TransmitScreenInfo");
|
|
var Doc = null;
|
|
var RCCommand = null;
|
|
|
|
try
|
|
{
|
|
//
|
|
// Create an XML document
|
|
//
|
|
Doc = new ActiveXObject("microsoft.XMLDOM");
|
|
|
|
//
|
|
// Create the RCCOMMAND root node
|
|
//
|
|
RCCommand = Doc.createElement( c_szRCCommand );
|
|
|
|
//
|
|
// Set the NAME attribute to SCREENINFO
|
|
//
|
|
RCCommand.setAttribute( c_szRCCommandName, c_szScreenInfo );
|
|
|
|
//
|
|
// Set the WIDTH attribute
|
|
//
|
|
RCCommand.setAttribute( c_szWidth, screen.width );
|
|
|
|
//
|
|
// Set the HEIGHT attribute
|
|
//
|
|
RCCommand.setAttribute( c_szHeight, screen.height );
|
|
|
|
//
|
|
// Set the COLORDEPTH attribute
|
|
//
|
|
RCCommand.setAttribute( c_szColorDepth, screen.colorDepth );
|
|
|
|
//
|
|
// Send the XML across
|
|
//
|
|
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.SendChannelData( c_szControlChannelID, RCCommand.xml );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use new interface
|
|
//
|
|
g_oControlChannel.SendChannelData( RCCommand.xml );
|
|
}
|
|
}
|
|
catch(error)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// RejectRC: Sends a reject to the helper
|
|
//
|
|
function RejectRC( mode )
|
|
{
|
|
TraceFunctEnter("RejectRC");
|
|
var Doc = null;
|
|
var RCCommand = null;
|
|
|
|
try
|
|
{
|
|
//
|
|
// Create an XML document
|
|
//
|
|
Doc = new ActiveXObject("microsoft.XMLDOM");
|
|
|
|
//
|
|
// Create the RCCOMMAND root node
|
|
//
|
|
RCCommand = Doc.createElement( c_szRCCommand );
|
|
|
|
//
|
|
// Set the NAME attribute to SCREENINFO
|
|
//
|
|
if(mode == 0)
|
|
{
|
|
//
|
|
// Reject
|
|
//
|
|
RCCommand.setAttribute( c_szRCCommandName, c_szRejectRC );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Taking control
|
|
//
|
|
RCCommand.setAttribute( c_szRCCommandName, c_szTakeControl );
|
|
try
|
|
{
|
|
parent.oDeskMgr.SwitchDesktopMode( 0 );
|
|
idStatus.innerHTML = "<div class=styText> <IMG src=\"../rcexpert/status_connected.gif\"> <STRONG>Status</STRONG> :Connected in VIEW mode</div>";
|
|
RejectId.disabled = true;
|
|
}
|
|
catch(e)
|
|
{
|
|
FatalError("Toggle failed: " + e.Description);
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
}
|
|
|
|
//
|
|
// Send the XML across
|
|
//
|
|
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.SendChannelData( c_szControlChannelID, RCCommand.xml );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use new interface
|
|
//
|
|
g_oControlChannel.SendChannelData( RCCommand.xml );
|
|
}
|
|
}
|
|
catch(error)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
|
|
RejectId.disabled = true;
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// AcceptRC: Sends an accept to the helper
|
|
//
|
|
function AcceptRC()
|
|
{
|
|
TraceFunctEnter("AcceptRC");
|
|
var Doc = null;
|
|
var RCCommand = null;
|
|
|
|
try
|
|
{
|
|
//
|
|
// Create an XML document
|
|
//
|
|
Doc = new ActiveXObject("microsoft.XMLDOM");
|
|
|
|
//
|
|
// Create the RCCOMMAND root node
|
|
//
|
|
RCCommand = Doc.createElement( c_szRCCommand );
|
|
|
|
//
|
|
// Set the NAME attribute to SCREENINFO
|
|
//
|
|
RCCommand.setAttribute( c_szRCCommandName, c_szAcceptRC );
|
|
|
|
//
|
|
// Send the XML across
|
|
//
|
|
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.SendChannelData( c_szControlChannelID, RCCommand.xml );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use new interface
|
|
//
|
|
g_oControlChannel.SendChannelData( RCCommand.xml );
|
|
}
|
|
}
|
|
catch(error)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// EnableRemoteControl: This routine enables remote control
|
|
//
|
|
function EnableRemoteControl()
|
|
{
|
|
TraceFunctEnter("EnableRemoteControl");
|
|
if(null != g_oSAFRemoteDesktopSession)
|
|
{
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.EnableRemoteControl( "" );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use the new interface
|
|
//
|
|
DebugTrace("remote control permissions: ");
|
|
DebugTrace("Existing: " + g_oSAFRemoteDesktopSession.SharingClass);
|
|
}
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// DisableRemoteControl: Routine to disable Remote Control
|
|
//
|
|
function DisableRemoteControl()
|
|
{
|
|
TraceFunctEnter("DisableRemoteControl");
|
|
if(null != g_oSAFRemoteDesktopSession)
|
|
{
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.DisableRemoteControl( "" );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use the new interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.RemoteControlPermissions = NO_DESKTOP_SHARING;
|
|
}
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// AbortConnection: Routine that disconnects the session
|
|
//
|
|
function AbortConnection()
|
|
{
|
|
TraceFunctEnter("AbortConnection");
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
|
|
if (g_oSAFRemoteDesktopSession != null)
|
|
{
|
|
g_oSAFRemoteDesktopSession.StopListening();
|
|
}
|
|
|
|
//
|
|
// Remove the chat channel
|
|
//
|
|
g_oSAFRemoteDesktopSession.RemoveChannels( c_szChatChannelID );
|
|
|
|
//
|
|
// Remove the control channel
|
|
//
|
|
g_oSAFRemoteDesktopSession.RemoveChannels( c_szControlChannelID );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Using New interfaces
|
|
//
|
|
|
|
//
|
|
// Disconnect the connection to Helper, if the connection is broken by the Helpee
|
|
//
|
|
g_bUserDisconnect = true;
|
|
if(true == g_bUserDisconnect)
|
|
{
|
|
DisconnectRC();
|
|
if(null != parent.oRCSession)
|
|
{
|
|
parent.oRCSession = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// SendChatButtonHandler: Routine to send chat data
|
|
//
|
|
function SendChatButtonHandler()
|
|
{
|
|
TraceFunctEnter("SendChatButtonHandler");
|
|
try
|
|
{
|
|
if (g_oSAFRemoteDesktopSession != null)
|
|
{
|
|
if ( true == g_bChatMode)
|
|
{
|
|
//
|
|
// If We are in Chat Mode. Only then send the data across
|
|
//
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
|
|
//
|
|
// Send data on the chat channel
|
|
//
|
|
g_oSAFRemoteDesktopSession.SendChannelData(c_szChatChannelID, chatText.value);
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use the new interface
|
|
//
|
|
g_oChatChannel.SendChannelData( chatText.value );
|
|
}
|
|
|
|
//
|
|
// Update user's chat history window
|
|
//
|
|
incomingChatText.value = incomingChatText.value + L_cszUserID + chatText.value;
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// This is remote control Mode
|
|
//
|
|
|
|
//
|
|
// Update user's chat history window
|
|
//
|
|
incomingChatText.value = incomingChatText.value + "\n> " + chatText.value;
|
|
}
|
|
|
|
|
|
//
|
|
// Clear up the chat message window
|
|
//
|
|
chatText.value="";
|
|
|
|
//Get the focus on to the chat box.
|
|
chatText.click();
|
|
chatText.select();
|
|
|
|
incomingChatText.doScroll("scrollbarPageDown");
|
|
|
|
}
|
|
}
|
|
catch(e)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// OnChannelDataReadyEvent: Call back to handle data from expert
|
|
//
|
|
function OnChannelDataReadyEvent(channelID)
|
|
{
|
|
TraceFunctEnter("OnChannelDataReadyEvent");
|
|
var str = null;
|
|
|
|
|
|
try
|
|
{
|
|
if (channelID == c_szChatChannelID)
|
|
{
|
|
//
|
|
// Data on chat channel
|
|
//
|
|
str = g_oSAFRemoteDesktopSession.ReceiveChannelData(channelID)
|
|
|
|
//
|
|
// Update chat history window with incoming data
|
|
//
|
|
incomingChatText.value = incomingChatText.value + L_cszExpertID + str;
|
|
incomingChatText.doScroll("scrollbarPageDown");
|
|
}
|
|
else if (channelID == c_szControlChannelID)
|
|
{
|
|
//
|
|
// Incoming data on the control channel
|
|
//
|
|
}
|
|
}
|
|
catch(e)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
parent.navigate( c_szHomePage );
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// ChatChannelDataReadyEvent: Call back to handle data from expert
|
|
//
|
|
function ChatChannelDataReadyEvent()
|
|
{
|
|
TraceFunctEnter("ChatChannelDataReadyEvent");
|
|
var str = null;
|
|
|
|
//
|
|
// BUGBUG: Check if the window is closed. If it is, bring it in focus and open it
|
|
//
|
|
|
|
window.focus();
|
|
Resize();
|
|
|
|
try
|
|
{
|
|
//
|
|
// Data on chat channel
|
|
//
|
|
str = g_oChatChannel.ReceiveChannelData();
|
|
|
|
//
|
|
// Update chat history window with incoming data
|
|
//
|
|
incomingChatText.value = incomingChatText.value + L_cszExpertID + str;
|
|
incomingChatText.doScroll("scrollbarPageDown");
|
|
}
|
|
catch(e)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
oSAFClassFactory.Close();
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// ControlChannelDataReadyEvent: Call back to handle data from expert
|
|
//
|
|
function ControlChannelDataReadyEvent()
|
|
{
|
|
TraceFunctEnter("ControlChannelDataReadyEvent");
|
|
var str = null;
|
|
|
|
//
|
|
// Data on control channel
|
|
//
|
|
str = g_oControlChannel.ReceiveChannelData();
|
|
|
|
//
|
|
// Parse the data sent on the control channel
|
|
//
|
|
ParseControlData ( str );
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// ParseControlData: Parse the data sent on the control channel
|
|
//
|
|
function ParseControlData ( str )
|
|
{
|
|
TraceFunctEnter("ParseControlData");
|
|
var Doc = new ActiveXObject("microsoft.XMLDOM");
|
|
var RCCommand = null;
|
|
var szCommandName = null;
|
|
|
|
//
|
|
// BUGBUG: Check if the window is closed. If it is, bring it in focus and open it
|
|
//
|
|
|
|
window.focus();
|
|
Resize();
|
|
|
|
try
|
|
{
|
|
if( false == Doc.loadXML( str ))
|
|
{
|
|
FatalError ( L_ERRLOADXMLFAIL_MSG );
|
|
oSAFClassFactory.Close();
|
|
}
|
|
|
|
if ( Doc.parseError.reason != "")
|
|
{
|
|
FatalError ( Doc.parseError.reason);
|
|
oSAFClassFactory.Close();
|
|
}
|
|
|
|
//
|
|
// Get the RCCOMMAND node
|
|
//
|
|
RCCommand = Doc.documentElement;
|
|
|
|
//
|
|
// Get the NAME of the command
|
|
//
|
|
szCommandName = RCCommand.getAttribute( c_szRCCommandName );
|
|
|
|
if( szCommandName == c_szFileXfer )
|
|
{
|
|
//
|
|
// File Transfer Initiation
|
|
//
|
|
var vArgs = new Array(10);
|
|
|
|
vArgs[0] = 1; // Destination Mode
|
|
vArgs[1] = g_oControlChannel; // Control Channel
|
|
vArgs[2] = g_oSAFRemoteDesktopChannelMgr; // Channel Manager
|
|
vArgs[3] = RCCommand.getAttribute( c_szFileName ); // FILENAME
|
|
vArgs[4] = RCCommand.getAttribute( c_szFileSize ); // FILESIZE
|
|
vArgs[5] = RCCommand.getAttribute( c_szChannelId ); // CHANNELID
|
|
vArgs[6] = new ActiveXObject("Scripting.FileSystemObject"); // File system object
|
|
vArgs[7] = new ActiveXObject("SAFRCFileDlg.FileSave"); // Save As dialog object
|
|
vArgs[8] = oSAFClassFactory; // SAF ClassFactory object
|
|
vArgs[9] = parent.gHelper; // Sender
|
|
|
|
window.showModelessDialog( c_szFileXferURL, vArgs, "dialogwidth:" + c_FileXferWidth + "px;dialogHeight:" + c_FileXferHeight + "px;status:no;resizable:yes");
|
|
|
|
}
|
|
else if ( szCommandName == c_szRemoteCtrlStart )
|
|
{
|
|
//
|
|
// Remote Control initiation
|
|
//
|
|
var vArgs = new Array(7);
|
|
vArgs[0] = g_oControlChannel; // Control Channel
|
|
vArgs[1] = L_RCRCREQUEST; // Message title
|
|
vArgs[2] = L_HELPERTAKINGCONTROL_MSG; // Message
|
|
vArgs[3] = 2; // Number of buttons
|
|
vArgs[4] = L_YESBTN; // Button1 text
|
|
vArgs[5] = L_NOBTN; // Button2 text
|
|
vArgs[6] = parent.gHelper; // Helper
|
|
|
|
var vRetVal = window.showModalDialog( c_szMsgURL, vArgs, "dialogwidth:360px;dialogHeight:240px;status:no;" );
|
|
|
|
if( 0 == vRetVal)
|
|
{
|
|
//
|
|
// Helpee accepts RC request
|
|
//
|
|
|
|
try
|
|
{
|
|
parent.oDeskMgr.SwitchDesktopMode( 1 );
|
|
RejectId.disabled = false;
|
|
g_bRC = true;
|
|
AcceptRC();
|
|
}
|
|
catch(e)
|
|
{
|
|
FatalError("Toggle failed: " + e.Description);
|
|
oSAFClassFactory.Close();
|
|
}
|
|
|
|
idStatus.innerHTML = "<div class=styText> <IMG src=\"../rcexpert/status_connected.gif\"> <STRONG>Status</STRONG> :Connected in CONTROL mode</div>";
|
|
Resize();
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Helpee rejects RC request
|
|
//
|
|
|
|
//
|
|
// send reject to helper
|
|
//
|
|
RejectRC( 0 );
|
|
}
|
|
|
|
}
|
|
else if ( szCommandName == c_szRemoteCtrlEnd )
|
|
{
|
|
//
|
|
// End of Remote Control
|
|
//
|
|
|
|
try
|
|
{
|
|
parent.oDeskMgr.SwitchDesktopMode( 0 );
|
|
Resize();
|
|
idStatus.innerHTML = "<div class=styText> <IMG src=\"../rcexpert/status_connected.gif\"> <STRONG>Status</STRONG> :Connected in VIEW mode</div>";
|
|
RejectId.disabled = true;
|
|
g_bRC = false;
|
|
}
|
|
catch(e)
|
|
{
|
|
FatalError("Toggle failed: " + e.Description);
|
|
oSAFClassFactory.Close();
|
|
}
|
|
}
|
|
else if ( szCommandName == c_szHIDECHAT )
|
|
{
|
|
//
|
|
// Forcibly hide the Chat Box
|
|
//
|
|
g_bChatBoxHidden = false;
|
|
idCtx.minimized = true;
|
|
|
|
HideChatBox();
|
|
}
|
|
else if ( szCommandName == c_szSHOWCHAT )
|
|
{
|
|
//
|
|
// Forcibly show the Chat Box
|
|
//
|
|
g_bChatBoxHidden = true;
|
|
idCtx.minimized = false;
|
|
|
|
HideChatBox();
|
|
}
|
|
}
|
|
catch(error)
|
|
{
|
|
FatalError( L_ERRFATAL_MSG );
|
|
oSAFClassFactory.Close();
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
function OnClientConnected() {
|
|
}
|
|
|
|
function OnClientDisconnected() {
|
|
TraceFunctEnter("OnClientDisconnected");
|
|
|
|
try
|
|
{
|
|
if(null != parent.oRCSession)
|
|
{
|
|
parent.oRCSession.onDisconnected = function()
|
|
{ }
|
|
parent.oRCSession.onConnected = function( salemID, userSID, sessionID )
|
|
{ }
|
|
}
|
|
}
|
|
catch(x)
|
|
{
|
|
FatalTrace( L_ERRRCSESSION_MSG );
|
|
}
|
|
|
|
DebugTrace("DISCONNECTED");
|
|
TraceFunctLeave();
|
|
EndTrace();
|
|
|
|
if( false == g_bUserDisconnect )
|
|
{
|
|
parent.navigate( "rcQuit.htm?HELPER=" + parent.gHelper);
|
|
}
|
|
else
|
|
{
|
|
oSAFClassFactory.Close();
|
|
}
|
|
}
|
|
|
|
function OnEnter()
|
|
{
|
|
//
|
|
// The following is added to get rid of the bug 173683 of ENTER causing
|
|
// unnecessary LF.
|
|
//
|
|
if (true == g_bNewLine)
|
|
{
|
|
chatText.value = "";
|
|
g_bNewLine = false;
|
|
}
|
|
|
|
if (window.event.keyCode == 13)
|
|
{
|
|
SendChatButtonHandler();
|
|
g_bNewLine = true;
|
|
}
|
|
}
|
|
|
|
//
|
|
// HideChatBox: Toggles the chat box controls
|
|
//
|
|
function HideChatBox()
|
|
{
|
|
TraceFunctEnter("HideChatBox");
|
|
|
|
try
|
|
{
|
|
if(false == g_bChatBoxHidden)
|
|
{
|
|
//
|
|
// Chatbox is visible. Hide it
|
|
//
|
|
chatText.style.visibility = "hidden";
|
|
sendChatButton.style.visibility = "hidden";
|
|
incomingChatText.style.visibility = "hidden";
|
|
g_bChatBoxHidden = true;
|
|
idtogglechat.innerHTML = "<div class=styText> Show Chat <img src=\"../rcexpert/show-chat.gif\"> </div>";
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Chatbox is Hidden. Show it
|
|
//
|
|
chatText.style.visibility = "visible";
|
|
sendChatButton.style.visibility = "visible";
|
|
incomingChatText.style.visibility = "visible";
|
|
g_bChatBoxHidden = false;
|
|
idtogglechat.innerHTML = "<div class=styText> Hide Chat <img src=\"../rcexpert/hide-chat.gif\"> </div>";
|
|
}
|
|
}
|
|
catch(error)
|
|
{
|
|
alert(error.description);
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// Disconnect: Disconnects the RC Connection made by Expert
|
|
//
|
|
function DisconnectRC()
|
|
{
|
|
TraceFunctEnter("DisconnectRC");
|
|
var Doc = null;
|
|
var RCCommand = null;
|
|
|
|
if( true == g_bConnected)
|
|
{
|
|
try
|
|
{
|
|
//
|
|
// Create an XML document
|
|
//
|
|
Doc = new ActiveXObject("microsoft.XMLDOM");
|
|
|
|
//
|
|
// Create the RCCOMMAND root node
|
|
//
|
|
RCCommand = Doc.createElement( c_szRCCommand );
|
|
|
|
//
|
|
// Set the NAME attribute to DISCONNECTRC
|
|
//
|
|
RCCommand.setAttribute( c_szRCCommandName, c_szDisconnectRC );
|
|
|
|
//
|
|
// Send the XML across
|
|
//
|
|
|
|
if (false == g_bNewBinaries)
|
|
{
|
|
//
|
|
// Using Old interface
|
|
//
|
|
g_oSAFRemoteDesktopSession.SendChannelData( c_szControlChannelID, RCCommand.xml );
|
|
}
|
|
else
|
|
{
|
|
//
|
|
// Use new interface
|
|
//
|
|
g_oControlChannel.SendChannelData( RCCommand.xml );
|
|
}
|
|
}
|
|
catch(error)
|
|
{
|
|
//
|
|
// It is OK. We can get an error here if helper initiated the shutdown
|
|
//
|
|
DebugTrace( error );
|
|
}
|
|
|
|
g_bConnected = false;
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
EndTrace();
|
|
return;
|
|
}
|
|
|
|
var g_iChannelId = 1000;
|
|
|
|
//
|
|
// LaunchFileXfer: Launches the File Xfer UI
|
|
//
|
|
function LaunchFileXfer( mode )
|
|
{
|
|
TraceFunctEnter("LaunchFileXfer");
|
|
var vArgs = new Array(7);
|
|
|
|
if(0 == mode)
|
|
{
|
|
vArgs[0] = mode; // Source Mode
|
|
vArgs[1] = g_oControlChannel; // Control Channel
|
|
vArgs[2] = g_oSAFRemoteDesktopChannelMgr; // Channel Manager
|
|
vArgs[3] = g_iChannelId++; // Channel ID
|
|
vArgs[4] = new ActiveXObject("Scripting.FileSystemObject");
|
|
vArgs[5] = oSAFClassFactory; // SAF ClassFactory object
|
|
vArgs[6] = parent.Helper; // Receiver
|
|
|
|
window.showModelessDialog( c_szFileXferURL, vArgs, "dialogwidth:" + c_FileXferWidth + "px;dialogHeight:" + c_FileXferHeight + "px;status:no;resizable:no");
|
|
}
|
|
|
|
TraceFunctLeave();
|
|
return;
|
|
}
|
|
|
|
|
|
</SCRIPT>
|
|
|
|
</BODY>
|
|
</HTML>
|