189 lines
4.4 KiB
HTML
189 lines
4.4 KiB
HTML
<HTML>
|
||
<HEAD>
|
||
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
|
||
<TITLE></TITLE>
|
||
</HEAD>
|
||
<BODY>
|
||
<P> </P>
|
||
<P> </P>
|
||
<P align=center><FONT face="Arial Black" size=5><STRONG>PCHealth Remote Control
|
||
Unittest (Server)</STRONG></FONT></P>
|
||
|
||
<TABLE>
|
||
<TBODY>
|
||
<TR>
|
||
<TD><BUTTON id=CreateNewSession name=CreateNewSession onclick=CreateNewSession()>Create new RDS Session (Session Resolver not set)</BUTTON></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
</TBODY>
|
||
</TABLE>
|
||
|
||
<TABLE>
|
||
<TBODY>
|
||
<TR>
|
||
<TD><BUTTON id=CreateNewSessionResolve name=CreateNewSessionResolve onclick=CreateNewSessionResolve()>Create new RDS Session (Session Resolver set)</BUTTON></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
</TBODY>
|
||
</TABLE>
|
||
|
||
|
||
<TABLE>
|
||
<TR>
|
||
<TD></INPUT></TD>
|
||
</TR>
|
||
<TR>
|
||
<TD></INPUT></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
</TABLE><BUTTON id=CloseSession name=CloseSession onclick=CloseSession()>Close open RDS Session</BUTTON>
|
||
|
||
<SCRIPT Language="JScript">
|
||
var RDSHost = null;
|
||
var RemoteDesktopSession = null;
|
||
var ChannelManager = null;
|
||
var ChatChannel = null;
|
||
var tFileName = "\\\\pchealth\\public\\rc\\parms.txt";
|
||
|
||
function UpdateConnectParms() {
|
||
if (RemoteDesktopSession != null) {
|
||
var str;
|
||
str = RemoteDesktopSession.ConnectParms;
|
||
connectParms.value = str;
|
||
}
|
||
}
|
||
|
||
function CreateNewSession() {
|
||
|
||
if (RemoteDesktopSession != null)
|
||
{
|
||
alert("Must close existing session first.");
|
||
return;
|
||
}
|
||
|
||
RDSHost = new ActiveXObject("RDSHost.SAFRemoteDesktopServerHost.1");
|
||
RemoteDesktopSession = RDSHost.CreateRemoteDesktopSession(4, 0, 0);
|
||
var x;
|
||
|
||
ChannelManager = RemoteDesktopSession.ChannelManager;
|
||
ChatChannel = ChannelManager.OpenDataChannel("70");
|
||
ChatChannel.OnChannelDataReady = function()
|
||
{ OnChannelDataReadyEvent(); }
|
||
|
||
// Bind events.
|
||
RemoteDesktopSession.OnConnected = function()
|
||
{ OnClientConnected(); }
|
||
RemoteDesktopSession.OnDisconnected = function()
|
||
{ OnClientDisconnected(); }
|
||
|
||
//
|
||
// Save the connection Params
|
||
//
|
||
SaveConnectParms();
|
||
}
|
||
|
||
function CreateNewSessionResolve() {
|
||
|
||
if (RemoteDesktopSession != null)
|
||
{
|
||
alert("Must close existing session first.");
|
||
return;
|
||
}
|
||
|
||
RDSHost = new ActiveXObject("RDSHost.SAFRemoteDesktopServerHost.1");
|
||
RemoteDesktopSession = RDSHost.CreateRemoteDesktopSession(4, 1, 0);
|
||
var x;
|
||
|
||
ChannelManager = RemoteDesktopSession.ChannelManager;
|
||
ChatChannel = ChannelManager.OpenDataChannel("70");
|
||
ChatChannel.OnChannelDataReady = function()
|
||
{ OnChannelDataReadyEvent(); }
|
||
|
||
// Bind events.
|
||
RemoteDesktopSession.OnConnected = function()
|
||
{ OnClientConnected(); }
|
||
RemoteDesktopSession.OnDisconnected = function()
|
||
{ OnClientDisconnected(); }
|
||
|
||
//
|
||
// Save the connection Params
|
||
//
|
||
SaveConnectParms();
|
||
}
|
||
|
||
function SaveConnectParms()
|
||
{
|
||
//
|
||
// Save the connection Params
|
||
//
|
||
var str = RemoteDesktopSession.ConnectParms;
|
||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||
var fileHandle = fso.CreateTextFile( tFileName );
|
||
fileHandle.Write( str );
|
||
fileHandle.Close();
|
||
}
|
||
|
||
function OpenExistingSession() {
|
||
|
||
if (RemoteDesktopSession != null)
|
||
{
|
||
alert("Must close existing session first.");
|
||
return;
|
||
}
|
||
|
||
RDSHost = new ActiveXObject("RDSHost.SAFRemoteDesktopServerHost.1");
|
||
RemoteDesktopSession = RDSHost.OpenRemoteDesktopSession(existingParms.value);
|
||
var x;
|
||
|
||
ChannelManager = RemoteDesktopSession.ChannelManager;
|
||
ChatChannel = ChannelManager.OpenDataChannel("70");
|
||
ChatChannel.OnChannelDataReady = function()
|
||
{ OnChannelDataReadyEvent(); }
|
||
|
||
// Bind events.
|
||
RemoteDesktopSession.OnConnected = function()
|
||
{ OnClientConnected(); }
|
||
RemoteDesktopSession.OnDisconnected = function()
|
||
{ OnClientDisconnected(); }
|
||
}
|
||
|
||
function CloseSession() {
|
||
if (RemoteDesktopSession != null) {
|
||
RDSHost.CloseRemoteDesktopSession(RemoteDesktopSession);
|
||
RemoteDesktopSession = null;
|
||
}
|
||
|
||
//
|
||
// Delete Connection Parms
|
||
//
|
||
var fso;
|
||
<EFBFBD><EFBFBD><EFBFBD> fso = new ActiveXObject("Scripting.FileSystemObject");
|
||
<EFBFBD><EFBFBD><EFBFBD> fso.DeleteFile(tFileName);
|
||
|
||
}
|
||
|
||
function SendChatButtonHandler() {
|
||
if (ChatChannel != null) {
|
||
ChatChannel.SendChannelData(chatText.value);
|
||
}
|
||
}
|
||
|
||
function OnChannelDataReadyEvent(channelName) {
|
||
var str;
|
||
str = ChatChannel.ReceiveChannelData()
|
||
incomingChatText.value = incomingChatText.value + "\n" + str;
|
||
}
|
||
|
||
function OnClientConnected() {
|
||
alert("Client connected.");
|
||
}
|
||
|
||
function OnClientDisconnected() {
|
||
alert("Client disconnected.");
|
||
}
|
||
|
||
</SCRIPT>
|
||
|
||
</BODY>
|
||
</HTML>
|