Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

639 lines
18 KiB

  1. <HTML>
  2. <HEAD>
  3. #include "header.inc"
  4. #include "debug_js.inc"
  5. #include "common.inc"
  6. #include "constants.inc"
  7. <TITLE>Remote Assistance</TITLE>
  8. <meta http-equiv="MSThemeCompatible" content="Yes">
  9. <LINK id="UI_StyleSheet1" name="UI_StyleSheet1" REL="stylesheet" TYPE="text/css" HREF="../../Css/rc.css">
  10. <LINK id="UI_StyleSheet2" name="UI_StyleSheet2" REL="stylesheet" TYPE="text/css" HREF="../../Css/RAChat.css">
  11. <LINK ID=Stylesheet_Ref4 href="hcp://system/css/shared.css" rel=STYLESHEET type=text/css>
  12. <script LANGUAGE="Javascript" >
  13. var g_oSAFRemoteAssistanceHelper = null;
  14. /*
  15. * Localizeable Constants, Text and Messages
  16. */
  17. var L_cszExpertID_Text = "\n Helper> ";
  18. var L_SAYS_Text = " says: \n ";
  19. /*++
  20. Control handling routines
  21. --*/
  22. #ifdef _BVT
  23. function ChatBVT()
  24. {
  25. try
  26. {
  27. var oNewText = document.createElement("Span");
  28. oNewText.innerHTML = parent.FormatChatMsg( "1. CHAT BVT: " );
  29. idIncomingChatText.appendChild( oNewText );
  30. parent.g_oBVT[ parent.g_iTest ].TEST = "Test " + parent.g_iTest + " CHAT";
  31. var oDate = new Date();
  32. parent.g_oBVT[ parent.g_iTest ].START_TIME = oDate.toLocaleString();
  33. //
  34. // CHAT BVT
  35. //
  36. g_oSAFRemoteAssistanceHelper.m_oChatChannel.SendChannelData( c_szChatBVT );
  37. g_bFirstKey = false;
  38. }
  39. catch(error)
  40. {
  41. FatalError( error.description, error );
  42. }
  43. }
  44. function TakeControlBVT()
  45. {
  46. //
  47. // REMOTE CONTROL BVT
  48. //
  49. try
  50. {
  51. var oNewText = document.createElement("Span");
  52. oNewText.innerHTML = parent.FormatChatMsg( "2. TAKE CONTROL BVT: " );
  53. idIncomingChatText.appendChild( oNewText );
  54. parent.g_oBVT[ parent.g_iTest ].TEST = "Test " + parent.g_iTest + " TAKE CONTROL";
  55. var oDate = new Date();
  56. parent.g_oBVT[ parent.g_iTest ].START_TIME = oDate.toLocaleString();
  57. g_oSAFRemoteAssistanceHelper.m_oChatChannel.SendChannelData( c_szTakeControlBVT );
  58. parent.frames.idFrameTools.Helper_TakeControl();
  59. }
  60. catch(error)
  61. {
  62. FatalError( error.description, error );
  63. }
  64. }
  65. function ReleaseControlBVT()
  66. {
  67. //
  68. // RELEASE CONTROL BVT
  69. //
  70. try
  71. {
  72. var oNewText = document.createElement("Span");
  73. oNewText.innerHTML = parent.FormatChatMsg( "3. RELEASE CONTROL BVT: " );
  74. idIncomingChatText.appendChild( oNewText );
  75. parent.g_oBVT[ parent.g_iTest ].TEST = "Test " + parent.g_iTest + " RELEASE CONTROL";
  76. var oDate = new Date();
  77. parent.g_oBVT[ parent.g_iTest ].START_TIME = oDate.toLocaleString();
  78. g_oSAFRemoteAssistanceHelper.m_oChatChannel.SendChannelData( c_szReleaseControlBVT );
  79. parent.frames.idFrameTools.Helper_TakeControl();
  80. }
  81. catch(error)
  82. {
  83. FatalError( error.description, error );
  84. }
  85. }
  86. function ActualSizeBVT()
  87. {
  88. //
  89. // ACTUAL SIZE BVT
  90. //
  91. try
  92. {
  93. var oNewText = document.createElement("Span");
  94. oNewText.innerHTML = parent.FormatChatMsg( "4. SMART SCALING( Actual Size) BVT: " );
  95. idIncomingChatText.appendChild( oNewText );
  96. parent.g_oBVT[ parent.g_iTest ].TEST = "Test " + parent.g_iTest + " SMART SCALING( Actual Size)";
  97. var oDate = new Date();
  98. parent.g_oBVT[ parent.g_iTest ].START_TIME = oDate.toLocaleString();
  99. parent.frames.idFrameStatus.ActualSize();
  100. Helper_UpdateChatHistory( c_szBVTPASS );
  101. setTimeout("ScaleToWindowBVT()", 10000);
  102. }
  103. catch(error)
  104. {
  105. FatalError( error.description, error );
  106. }
  107. }
  108. function ScaleToWindowBVT()
  109. {
  110. //
  111. // SCALE TO WINDOW BVT
  112. //
  113. try
  114. {
  115. var oNewText = document.createElement("Span");
  116. oNewText.innerHTML = parent.FormatChatMsg( "4. SMART SCALING( Scale to Window) BVT: " );
  117. idIncomingChatText.appendChild( oNewText );
  118. parent.g_oBVT[ parent.g_iTest ].TEST = "Test " + parent.g_iTest + " SMART SCALING( Scale to Window)";
  119. var oDate = new Date();
  120. parent.g_oBVT[ parent.g_iTest ].START_TIME = oDate.toLocaleString();
  121. parent.frames.idFrameStatus.ScaleToWindow();
  122. Helper_UpdateChatHistory( c_szBVTPASS );
  123. setTimeout("DisconnectBVT()", 10000);
  124. }
  125. catch(error)
  126. {
  127. FatalError( error.description, error );
  128. }
  129. }
  130. function DisconnectBVT()
  131. {
  132. //
  133. // DISCONNECT BVT
  134. //
  135. try
  136. {
  137. var oNewText = document.createElement("Span");
  138. oNewText.innerHTML = parent.FormatChatMsg( "4. DISCONNECT BVT: " );
  139. idIncomingChatText.appendChild( oNewText );
  140. g_oSAFRemoteAssistanceHelper.m_oChatChannel.SendChannelData( c_szDisconnectBVT );
  141. parent.g_oBVT[ parent.g_iTest ].TEST = "Test " + parent.g_iTest + " DISCONNECT";
  142. var oDate = new Date();
  143. parent.g_oBVT[ parent.g_iTest ].START_TIME = oDate.toLocaleString();
  144. parent.frames.idFrameTools.Helper_QuitMethod();
  145. }
  146. catch(error)
  147. {
  148. FatalError( error.description, error );
  149. }
  150. }
  151. #endif
  152. //
  153. // Helper_InitializeRAChatClient: Stuff done when the RCControl page is loaded
  154. //
  155. function Helper_InitializeRAChatClient()
  156. {
  157. TraceFunctEnter("InitializeRAChatClient");
  158. try
  159. {
  160. InitTrace();
  161. g_oSAFRemoteAssistanceHelper = parent.g_oSAFRemoteAssistanceHelper;
  162. //
  163. // Setup the Chat Channel
  164. //
  165. parent.Helper_SetupChatChannel();
  166. //
  167. // enable chat controls on the screen
  168. //
  169. idIncomingChatText.disabled=false;
  170. idchatText.disabled=false;
  171. #ifdef _BVT
  172. if( true == g_oSAFRemoteAssistanceHelper.m_bBVT )
  173. {
  174. setTimeout("ChatBVT()", 5000);
  175. }
  176. else
  177. {
  178. var oNewText = document.createElement("Span");
  179. oNewText.innerHTML = parent.CreateChatGreeting( g_oSAFRemoteAssistanceHelper.m_szLocalUser, g_oSAFRemoteAssistanceHelper.m_szUserName );
  180. idIncomingChatText.appendChild( oNewText );
  181. }
  182. #else
  183. var oNewText = document.createElement("Span");
  184. oNewText.innerHTML = parent.CreateChatGreeting( g_oSAFRemoteAssistanceHelper.m_szLocalUser, g_oSAFRemoteAssistanceHelper.m_szUserName );
  185. idIncomingChatText.appendChild( oNewText );
  186. #endif
  187. //
  188. // Set the Focus on chat control
  189. //
  190. setTimeout("idchatText.focus()", 0);
  191. }
  192. catch(error)
  193. {
  194. parent.FatalError( parent.L_RCCTL_Text, error);
  195. }
  196. TraceFunctLeave();
  197. return;
  198. }
  199. var g_bTyping = false;
  200. var g_bFirstKey = true;
  201. //
  202. // Helper_OnEnter: This is fired when Expert hits <ENTER> in the chat message window
  203. //
  204. function Helper_OnEnter()
  205. {
  206. try
  207. {
  208. if( parent.frames.idFrameScreen.g_oSAFRemoteAssistanceHelper.m_bConnected == false )
  209. {
  210. //
  211. // Disconnected
  212. //
  213. return;
  214. }
  215. if (window.event.keyCode == 13)
  216. {
  217. //
  218. // Send chat data to user
  219. //
  220. Helper_SendChatData();
  221. window.event.returnValue = false;
  222. }
  223. if( (window.event.keyCode >= 0x48) && (window.event.keyCode <= 0x90) && (false == g_bTyping ))
  224. {
  225. g_bTyping = true;
  226. parent.Helper_SendControlCommand( c_szTYPINGSTART );
  227. }
  228. if( true == g_bFirstKey )
  229. {
  230. g_bFirstKey = false;
  231. idIncomingChatText.value = "";
  232. }
  233. }
  234. catch(error)
  235. {
  236. parent.FatalError( parent.L_RCCTL_Text, error );
  237. }
  238. }
  239. //
  240. // Helper_SendChatData sends chat data to remote machine
  241. //
  242. function Helper_SendChatData()
  243. {
  244. TraceFunctEnter("Helper_SendChatData");
  245. try
  246. {
  247. if( parent.frames.idFrameScreen.g_oSAFRemoteAssistanceHelper.m_bConnected == false )
  248. {
  249. //
  250. // Disconnected
  251. //
  252. return;
  253. }
  254. if ((parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_oSAFRemoteDesktopClient != null) && ( parent.frames.idFrameChat.idchatText.value.length > 0 ))
  255. {
  256. //
  257. // Send chat data to user
  258. //
  259. parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_oChatChannel.SendChannelData( parent.frames.idFrameChat.idchatText.value );
  260. //
  261. // Update chat history window
  262. //
  263. if(parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_szLocalUser.length == 0)
  264. {
  265. parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_szLocalUser = L_cszExpertID_Text;
  266. }
  267. #if 0
  268. var oNewText = document.createElement("Span");
  269. oNewText.innerHTML = parent.FormatSendChatText( parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_szLocalUser , idchatText.value )
  270. idIncomingChatText.appendChild( oNewText );
  271. idIncomingChatText.value = idIncomingChatText.value + "\n\n" + parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_szLocalUser +
  272. parent.L_Expert_Text + L_SAYS_Text + idchatText.value;
  273. #endif
  274. var oP = document.createElement("P");
  275. idIncomingChatText.appendChild( oP );
  276. var oNewText = document.createElement("Span");
  277. oNewText.innerText = parent.frames.idFrameTools.g_oSAFRemoteAssistanceHelper.m_szLocalUser +
  278. parent.L_Expert_Text + L_SAYS_Text + idchatText.value;
  279. idIncomingChatText.appendChild( oNewText );
  280. //
  281. // Clear chat msg window
  282. //
  283. idchatText.value="";
  284. //
  285. // Reset the focus
  286. //
  287. idchatText.focus();
  288. //
  289. // Scroll down
  290. //
  291. var szTmp = idIncomingChatText.value;
  292. for( var i = 0; i <= ((szTmp.length / 100) + 1); i++ )
  293. {
  294. idIncomingChatText.doScroll("scrollbarPageDown");
  295. }
  296. g_bTyping = false;
  297. }
  298. }
  299. catch(error)
  300. {
  301. parent.FatalError( parent.L_RCCTL_Text, error );
  302. }
  303. TraceFunctLeave();
  304. return;
  305. }
  306. //
  307. // Helper_UpdateChatHistory: Updates the history pane with message from helpee
  308. //
  309. function Helper_UpdateChatHistory( szMsg )
  310. {
  311. try
  312. {
  313. if( true == g_bFirstKey )
  314. {
  315. g_bFirstKey = false;
  316. idIncomingChatText.value = "";
  317. }
  318. #if 0
  319. var oNewText = document.createElement("Span");
  320. oNewText.innerHTML = parent.FormatSendChatText( g_oSAFRemoteAssistanceHelper.m_szUserName, szMsg );
  321. idIncomingChatText.appendChild( oNewText );
  322. idIncomingChatText.value = idIncomingChatText.value + "\n\n" + g_oSAFRemoteAssistanceHelper.m_szUserName +
  323. L_SAYS_Text + szMsg;
  324. #endif
  325. var oP = document.createElement("P");
  326. idIncomingChatText.appendChild( oP );
  327. var oNewText = document.createElement("Span");
  328. if( null != g_oSAFRemoteAssistanceHelper)
  329. {
  330. oNewText.innerText = "\n\n" + g_oSAFRemoteAssistanceHelper.m_szUserName +
  331. L_SAYS_Text + szMsg;
  332. }
  333. else
  334. {
  335. oNewText.innerText = szMsg;
  336. }
  337. idIncomingChatText.appendChild( oNewText );
  338. var szTmp = idIncomingChatText.value;
  339. for( var i = 0; i <= ((szTmp.length / 100)+1); i++ )
  340. {
  341. idIncomingChatText.doScroll("scrollbarPageDown");
  342. }
  343. DebugTrace("Number of scrolls: " + i);
  344. #ifdef _BVT
  345. if( (true == g_oSAFRemoteAssistanceHelper.m_bBVT )&&( (szMsg == c_szBVTPASS) || (szMsg == c_szBVTFAIL) ))
  346. {
  347. parent.ReportBVTResult( szMsg );
  348. switch( parent.g_iTest ) {
  349. case 2:
  350. setTimeout("TakeControlBVT()", 10000);
  351. break;
  352. case 3:
  353. setTimeout("ReleaseControlBVT()", 10000);
  354. break;
  355. case 4:
  356. setTimeout("ActualSizeBVT()", 10000);
  357. break;
  358. }
  359. }
  360. #endif
  361. }
  362. catch(error)
  363. {
  364. parent.FatalError( parent.L_RCCTL_Text, error );
  365. }
  366. }
  367. //
  368. // Security Check
  369. //
  370. function DoLoad()
  371. {
  372. var L_ERRACCESSDENIED_Text = "Directly launching this page is not allowed. ";
  373. MAC_IF_DIRECTLAUNCH_CLIENT
  374. {
  375. idBody.style.visibility = "hidden";
  376. alert( L_ERRACCESSDENIED_Text );
  377. return;
  378. }
  379. }
  380. //
  381. // Cut and Paste truncation code...
  382. //
  383. var flag = true;
  384. function validatePaste()
  385. {
  386. try
  387. {
  388. if(flag)
  389. {
  390. flag = false;
  391. var sSnapshot = clipboardData.getData("text");
  392. var lpreText = idchatText.innerText.length;
  393. if(IsActiveSelect()) // handles the case of highlighted text
  394. {
  395. var selected = element.document.selection.createRange();
  396. lpreText -= selected.text.length;
  397. }
  398. var sChop = sSnapshot.substring( 0, idchatText.Maxlength-lpreText+1);
  399. clipboardData.setData("text",sChop);
  400. document.execCommand("paste"); // calls paste method again
  401. event.returnValue = false; // cancels the action of the first call
  402. clipboardData.setData("text",sSnapshot); // restores the clipboard
  403. }
  404. else
  405. {
  406. flag = true;
  407. }
  408. }
  409. catch(error)
  410. {
  411. // Ignore this error
  412. }
  413. }
  414. function IsActiveSelect()
  415. // returns a Boolean if there is currently something selected
  416. {
  417. try
  418. {
  419. var selected = document.selection.createRange();
  420. if( selected.text.length > 0 )
  421. {
  422. return true;
  423. }
  424. else
  425. {
  426. return false;
  427. }
  428. }
  429. catch(error)
  430. {
  431. // Ignore this error
  432. }
  433. }
  434. function document.onkeydown()
  435. {
  436. try
  437. {
  438. switch( window.event.keyCode ) {
  439. case 0x9:
  440. if(( window.event.srcElement.id == "idchatimg" )&&(window.event.shiftKey == false))
  441. {
  442. parent.frames.idFrameStatus.SetFocus();
  443. window.event.returnValue = false;
  444. }
  445. if(( window.event.srcElement.id == "idchatText" )&&(window.event.shiftKey == true))
  446. {
  447. parent.frames.idFrameStatus.SetRevFocus();
  448. window.event.returnValue = false;
  449. }
  450. break;
  451. }
  452. }
  453. catch(error)
  454. {
  455. SetFocus();
  456. window.event.returnValue = false;
  457. }
  458. }
  459. function SetFocus()
  460. {
  461. try
  462. {
  463. document.all("idchatText").focus();
  464. }
  465. catch(error)
  466. {
  467. //alert("error: " + error.description); Ignore
  468. }
  469. }
  470. </script>
  471. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  472. </head>
  473. <body id="idBody" scroll="no" tabindex=-1 onmouseover="" onLoad="DoLoad()" class="sys-homepage-bgcolor">
  474. <Table cellpadding="10px" cellspacing="0" border=0 class="MaxLayout">
  475. <TR>
  476. <TD>
  477. <TABLE id="T0" name="T0" border=0 cellpadding=0 cellspacing=0 class="MaxLayout" >
  478. <TR id="TR0T0" name="TR0T0">
  479. <TD id="TD0TR0T0" name="TD0TR0T0" class="styChatTD0TR0T0">
  480. <TABLE id="T0TD0TR0T0" name="T0TD0TR0T0" cellpadding=0 cellspacing=0 class="MaxLayout">
  481. <TR id="TR0T0TD0TR0T0" name="TR0T0TD0TR0T0">
  482. <TD id="TD0TR0T0TD0TR0T0" name="TD0TR0T0TD0TR0T0" class="styChatTR4 sys-toppane-header-bgcolor">
  483. <Table id="idContainer" name="idContainer" cellspacing="0px" cellpadding="0px" border=0 class="MaxLayout">
  484. <TR>
  485. <TD id="s0TD0TR0T0TD0TR0T0" name="s0TD0TR0T0TD0TR0T0" class="sys-font-body-bold sys-toppane-header-color width1">
  486. &nbsp;&nbsp;Chat History
  487. </TD>
  488. <TD class="sys-font-body sys-toppane-header-color width2" id="btnHideChat" name="btnHideChat" align="right">
  489. Hide&nbsp;<IMG id="idchatimg" name="idchatimg" tabindex=4 onkeydown="if (event.keyCode==13){idchatimg.onclick();}" onclick="idchatimg.focus();parent.frames.idFrameStatus.Helper_HideChat();" title="Hide chat window" src="../Common/hide-chat.gif" class="vAlign">&nbsp;
  490. </TD>
  491. </TR>
  492. </Table>
  493. </TD>
  494. </TR>
  495. <TR id="TR1T0TD0TR0T0" name="TR1T0TD0TR0T0">
  496. <TD id="TD0TR1T0TD0TR0T0" name="TD0TR1T0TD0TR0T0" class="sys-toppane-header-bgcolor">
  497. <TEXTAREA id=idIncomingChatText title="Chat history" tabindex=3 class="overflow MaxLayout sys-font-body sys-toppane-bgcolor sys-toppane-color-border styChatTextArea styPadding" disabled name="idIncomingChatText" readOnly wrap=VIRTUAL multiline="true"></TEXTAREA>
  498. </TD>
  499. </TR>
  500. </TABLE>
  501. </TD>
  502. </TR>
  503. <TR>
  504. <TD class="height2">
  505. </TD>
  506. </TR>
  507. <TR id="TR1T0" name="TR1T0">
  508. <TD id="TD0TR1T0" name="TD0TR1T0" class="MaxLayout">
  509. <TABLE id="T0TD0TR1T0" name="T0TD0TR1T0" cellpadding=0 cellspacing=0 class="MaxLayout">
  510. <TR id="TR0T0TD0TR1T0" name="TR0T0TD0TR1T0">
  511. <TD colspan=2 id="TD0TR0T0TD0TR1T0" name="TD0TR0T0TD0TR1T0" class="styChatTR6 sys-bottompane-header-bgcolor sys-font-body-bold sys-bottompane-header-color">
  512. &nbsp;&nbsp;Message Entry
  513. </TD>
  514. </TR>
  515. <TR id="TR1T0TD0TR1T0" name="TR1T0TD0TR1T0">
  516. <TD id="TD0TR1T0TD0TR1T0" name="TD0TR1T0TD0TR1T0" class="styChatTR5TD1 sys-bottompane-header-bgcolor">
  517. <TEXTAREA class="sys-font-body sys-color-body MaxLayout styChatTextArea styPadding sys-bottompane-bgcolor sys-bottompane-color-border overflow" Maxlength=1024 onpaste="validatePaste();" onkeypress="Helper_OnEnter()" id="idchatText" title="Type new message here" tabindex=1 name="idchatText"></TEXTAREA>
  518. </TD>
  519. <TD id="TD0TR1T0TD0TR1T0" name="TD0TR1T0TD0TR1T0" class="sys-bottompane-color-border borderNone sys-table-cell-bgcolor5 valigntop">
  520. <Div class="styChatTR5TD2" title="Send chat message" id="btnSendChat" name="btnSendChat" align="center">
  521. <A id="S0btnSendChat" name="S0btnSendChat" class="sys-font-body sys-link-normal" href="" onclick="Helper_SendChatData();return false;" onkeypress="if((window.event.keyCode == 13)||(window.event.keyCode == 0x20 )){Helper_SendChatData();}" tabindex=2>
  522. <img id="I0btnSendChat" name="I0btnSendChat" src="../Common/SendChat.gif" class="BorderNone" onclick="Helper_SendChatData();" onkeypress="if((window.event.keyCode == 13)||(window.event.keyCode == 0x20 )){Helper_SendChatData();}"><BR>
  523. Send
  524. </A>
  525. </Div>
  526. </TD>
  527. </TR>
  528. </TABLE>
  529. </TD>
  530. </TR>
  531. </TABLE>
  532. </TD>
  533. </TR>
  534. </Table>
  535. </body>
  536. </html>