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.

476 lines
12 KiB

  1. <HTML>
  2. <HEAD>
  3. #include "header.inc"
  4. #include "debug_js.inc"
  5. #include "common.inc"
  6. #include "constants.inc"
  7. #define MAC_IF_DIRECTLAUNCH if(null==parent.idFrameSet0)
  8. <TITLE>Remote Assistance</TITLE>
  9. <meta http-equiv="MSThemeCompatible" content="Yes">
  10. <LINK id="UI_StyleSheet" REL="stylesheet" TYPE="text/css" HREF="../../Css/rc.css">
  11. <LINK id="UI_StyleSheet1" REL="stylesheet" TYPE="text/css" HREF="../../Css/RAChat.css">
  12. <LINK ID=Stylesheet_Ref4 href="hcp://system/css/shared.css" rel=STYLESHEET type=text/css>
  13. <script id="LocalScripts" name="LocalScripts" LANGUAGE="Javascript">
  14. //
  15. // Localizable constants, values
  16. //
  17. var L_SAYS_Text = " says: \n";
  18. //
  19. // Security check
  20. //
  21. function DoLoad()
  22. {
  23. var L_ERRACCESSDENIED_Text = "Directly launching this page is not allowed. ";
  24. MAC_IF_DIRECTLAUNCH
  25. {
  26. idBody.style.visibility = "hidden";
  27. alert( L_ERRACCESSDENIED_Text );
  28. return;
  29. }
  30. }
  31. function InitChatServer()
  32. {
  33. try
  34. {
  35. InitTrace();
  36. TraceFunctEnter("InitChatServer");
  37. //
  38. // enable chat controls on the screen
  39. //
  40. idIncomingChatText.disabled=false;
  41. idchatText.disabled=false;
  42. var oNewText = document.createElement("Span");
  43. oNewText.innerHTML = parent.CreateChatGreeting( parent.g_szLocalUser, parent.parent.gHelper );
  44. idIncomingChatText.appendChild( oNewText );
  45. //
  46. // Set the Focus on chat control
  47. //
  48. idchatText.click();
  49. idchatText.select();
  50. idchatText.focus();
  51. }
  52. catch(error)
  53. {
  54. parent.FatalError( parent.L_RCCTL_Text, error );
  55. }
  56. TraceFunctLeave();
  57. }
  58. function PrintTakeControlMsg( msg )
  59. {
  60. TraceFunctEnter("PrintTakeControlMsg");
  61. try
  62. {
  63. var oP = document.createElement("P");
  64. idIncomingChatText.appendChild( oP );
  65. var oNewText = document.createElement("Span");
  66. oNewText.innerText = msg;
  67. idIncomingChatText.appendChild( oNewText );
  68. #if 0
  69. idIncomingChatText.value = idIncomingChatText.value + msg;
  70. #endif
  71. var szTmp = idIncomingChatText.value;
  72. for( var i = 0; i <= ((szTmp.length / 100)+1); i++ )
  73. {
  74. idIncomingChatText.doScroll("scrollbarPageDown");
  75. }
  76. SetFocus();
  77. }
  78. catch(error)
  79. {
  80. parent.FatalError( parent.L_RCCTL_Text, error );
  81. }
  82. TraceFunctLeave();
  83. }
  84. //
  85. // SendChatData: Routine to send chat data
  86. //
  87. function SendChatData()
  88. {
  89. TraceFunctEnter("SendChatData");
  90. try
  91. {
  92. if( false == parent.g_bConnected )
  93. {
  94. //
  95. // Not connected
  96. //
  97. TraceFunctLeave();
  98. return;
  99. }
  100. if ( (parent.g_Helpee_oSAFRemoteDesktopSession != null) && ( idchatText.value.length > 0))
  101. {
  102. //
  103. // Send the data across
  104. //
  105. parent.g_Helpee_oChatChannel.SendChannelData( idchatText.value );
  106. //
  107. // Update user's chat history window
  108. //
  109. #if 0
  110. var oNewText = document.createElement("Span");
  111. oNewText.innerHTML = parent.FormatSendChatText( parent.g_szLocalUser , idchatText.value )
  112. idIncomingChatText.appendChild( oNewText );
  113. #endif
  114. if( parent.parent.gFrom.length == 0 )
  115. {
  116. parent.parent.gFrom = parent.GetLocalUser();
  117. }
  118. #if 0
  119. idIncomingChatText.value = idIncomingChatText.value + "\n\n" + parent.parent.gFrom +
  120. L_SAYS_Text + idchatText.value;
  121. #endif
  122. var oP = document.createElement("P");
  123. idIncomingChatText.appendChild( oP );
  124. var oNewText = document.createElement("Span");
  125. oNewText.innerText = parent.parent.gFrom +
  126. L_SAYS_Text + idchatText.value;
  127. idIncomingChatText.appendChild( oNewText );
  128. var strText = idIncomingChatText.value;
  129. for(var i = 0; i <= ((strText.length / 80)+1); i++)
  130. {
  131. idIncomingChatText.doScroll("scrollbarPageDown");
  132. }
  133. //
  134. // Clear up the chat message window
  135. //
  136. idchatText.value="";
  137. //Get the focus on to the chat box.
  138. idchatText.click();
  139. idchatText.select();
  140. }
  141. }
  142. catch(error)
  143. {
  144. parent.FatalError( parent.L_ERRFATAL_Text, error );
  145. }
  146. TraceFunctLeave();
  147. return;
  148. }
  149. var g_bFirstKey = true;
  150. //
  151. // OnEnter:
  152. //
  153. function OnEnter()
  154. {
  155. TraceFunctEnter( "OnEnter" );
  156. try
  157. {
  158. if( false == parent.g_bConnected )
  159. {
  160. //
  161. // Not connected
  162. //
  163. TraceFunctLeave();
  164. return;
  165. }
  166. if (window.event.keyCode == 13)
  167. {
  168. SendChatData();
  169. parent.g_bNewLine = true;
  170. window.event.returnValue = false;
  171. }
  172. if( true == g_bFirstKey )
  173. {
  174. g_bFirstKey = false;
  175. idIncomingChatText.value = "";
  176. }
  177. SetFocus();
  178. }
  179. catch(error)
  180. {
  181. parent.FatalError( parent.L_RCCTL_Text, error );
  182. }
  183. TraceFunctLeave();
  184. return;
  185. }
  186. function UpdateChatHistory( data )
  187. {
  188. TraceFunctEnter("UpdateChatHistory");
  189. try
  190. {
  191. if( true == g_bFirstKey )
  192. {
  193. g_bFirstKey = false;
  194. idIncomingChatText.value = "";
  195. }
  196. #if 0
  197. var oNewText = document.createElement("Span");
  198. oNewText.innerHTML = parent.FormatSendChatText( parent.parent.gHelper , data )
  199. idIncomingChatText.appendChild( oNewText );
  200. idIncomingChatText.value = idIncomingChatText.value + "\n\n" + parent.parent.gHelper +
  201. parent.L_Expert_Text + L_SAYS_Text + data;
  202. #endif
  203. var oP = document.createElement("P");
  204. idIncomingChatText.appendChild( oP );
  205. var oNewText = document.createElement("Span");
  206. oNewText.innerText = parent.parent.gHelper +
  207. parent.L_Expert_Text + L_SAYS_Text + data;
  208. idIncomingChatText.appendChild( oNewText );
  209. var szTmp = idIncomingChatText.value;
  210. for( var i = 0; i <= ((szTmp.length / 100) + 1); i++ )
  211. {
  212. idIncomingChatText.doScroll("scrollbarPageDown");
  213. }
  214. DebugTrace("Number of scrolls: " + i);
  215. SetFocus();
  216. }
  217. catch(error)
  218. {
  219. parent.FatalError( parent.L_RCCTL_Text, error );
  220. }
  221. TraceFunctLeave();
  222. }
  223. //
  224. // Cut and Paste truncation code...
  225. //
  226. var flag = true;
  227. function validatePaste()
  228. {
  229. TraceFunctEnter("validatePaste");
  230. try
  231. {
  232. if(flag)
  233. {
  234. flag = false;
  235. var sSnapshot = clipboardData.getData("text");
  236. var lpreText = idchatText.innerText.length;
  237. if(IsActiveSelect()) // handles the case of highlighted text
  238. {
  239. var selected = element.document.selection.createRange();
  240. lpreText -= selected.text.length;
  241. }
  242. var sChop = sSnapshot.substring( 0, idchatText.Maxlength-lpreText+1);
  243. clipboardData.setData("text",sChop);
  244. document.execCommand("paste"); // calls paste method again
  245. event.returnValue = false; // cancels the action of the first call
  246. clipboardData.setData("text",sSnapshot); // restores the clipboard
  247. }
  248. else
  249. {
  250. flag = true;
  251. }
  252. }
  253. catch(error)
  254. {
  255. // Ignore this error
  256. }
  257. TraceFunctLeave();
  258. }
  259. function IsActiveSelect()
  260. // returns a Boolean if there is currently something selected
  261. {
  262. TraceFunctEnter("IsActiveSelect");
  263. try
  264. {
  265. var selected = document.selection.createRange();
  266. if( selected.text.length > 0 )
  267. {
  268. return true;
  269. }
  270. else
  271. {
  272. return false;
  273. }
  274. }
  275. catch(error)
  276. {
  277. // Ignore this error
  278. }
  279. TraceFunctLeave();
  280. }
  281. function document.onkeydown()
  282. {
  283. TraceFunctEnter("onkeydown");
  284. try
  285. {
  286. switch( window.event.keyCode ) {
  287. case 0x9:
  288. if(( window.event.srcElement.id == "idchatText")&&(window.event.shiftKey==true))
  289. {
  290. parent.frames.idFrameTools.SetRevFocus();
  291. window.event.returnValue = false;
  292. }
  293. if(( window.event.srcElement.id == "idIncomingChatText" )&&(window.event.shiftKey==false))
  294. {
  295. parent.frames.idFrameTools.SetFocus();
  296. window.event.returnValue = false;
  297. }
  298. break;
  299. }
  300. }
  301. catch(error)
  302. {
  303. SetFocus();
  304. window.event.returnValue = false;
  305. }
  306. TraceFunctLeave();
  307. }
  308. function SetFocus()
  309. {
  310. TraceFunctEnter("SetFocus");
  311. try
  312. {
  313. document.all("idchatText").focus();
  314. }
  315. catch(error)
  316. {
  317. // Dont care
  318. }
  319. TraceFunctLeave();
  320. }
  321. function SetRevFocus()
  322. {
  323. TraceFunctEnter("SetRevFocus");
  324. try
  325. {
  326. document.all("idIncomingChatText").focus();
  327. }
  328. catch(error)
  329. {
  330. // Dont care
  331. }
  332. TraceFunctLeave();
  333. }
  334. </script>
  335. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  336. </head>
  337. <body id="idBody" scroll="no" tabindex=-1 onLoad="DoLoad()" class="sys-homepage-bgcolor">
  338. <Table cellpadding="10px" cellspacing="0" border=0 class="MaxLayout">
  339. <TR>
  340. <TD>
  341. <TABLE id="T0" name="T0" border=0 cellpadding=0 cellspacing=0 class="MaxLayout">
  342. <TR id="TR0T0" name="TR0T0">
  343. <TD id="TD0TR0T0" name="TD0TR0T0" class="styChatTD0TR0T0">
  344. <TABLE id="T0TD0TR0T0" name="T0TD0TR0T0" cellpadding=0 cellspacing=0 border=0 class="MaxLayout">
  345. <TR id="TR0T0TD0TR0T0" name="TR0T0TD0TR0T0">
  346. <TD id="TD0TR0T0TD0TR0T0" name="TD0TR0T0TD0TR0T0" class="styChatTR4 sys-toppane-header-bgcolor sys-font-body-bold sys-toppane-header-color">
  347. &nbsp;&nbsp;Chat History
  348. </TD>
  349. </TR>
  350. <TR id="TR1T0TD0TR0T0" name="TR1T0TD0TR0T0" >
  351. <TD id="TD0TR1T0TD0TR0T0" name="TD0TR1T0TD0TR0T0" class="sys-toppane-header-bgcolor" >
  352. <TEXTAREA id="idIncomingChatText" name="idIncomingChatText" title="Chat history" tabindex=3 class="overflow MaxLayout sys-font-body sys-toppane-bgcolor sys-toppane-color-border styChatTextArea styPadding" disabled readOnly wrap=VIRTUAL multiline="true"></TEXTAREA>
  353. </TD>
  354. </TR>
  355. </TABLE>
  356. </TD>
  357. </TR>
  358. <TR>
  359. <TD class="height2">
  360. </TD>
  361. </TR>
  362. <TR id="TR1T0" name="TR1T0">
  363. <TD id="TD0TR1T0" name="TD0TR1T0" class="MaxLayout">
  364. <TABLE id="T0TD0TR1T0" name="T0TD0TR1T0" cellpadding=0 cellspacing=0 border=0 class="MaxLayout">
  365. <TR id="TR0T0TD0TR1T0" name="TR0T0TD0TR1T0">
  366. <TD colspan=2 id="TD0TR0T0TD0TR1T0" name="TD0TR0T0TD0TR1T0" class="styChatTR6 sys-bottompane-header-bgcolor sys-font-body-bold sys-bottompane-header-color">
  367. &nbsp;&nbsp;Message Entry
  368. </TD>
  369. </TR>
  370. <TR id="TR1T0TD0TR1T0" name="TR1T0TD0TR1T0">
  371. <TD id="TD0TR1T0TD0TR1T0" name="TD0TR1T0TD0TR1T0" class="styChatTR5TD1 sys-bottompane-header-bgcolor">
  372. <TEXTAREA class="sys-font-body sys-color-body MaxLayout styChatTextArea styPadding sys-bottompane-bgcolor sys-bottompane-color-border overflow" Maxlength=1024 onpaste="validatePaste();" onkeypress=OnEnter() id="idchatText" name="idchatText" title="Type new message here" tabindex=1 ></TEXTAREA>
  373. </TD>
  374. <TD id="TD0TR1T0TD0TR1T0" name="TD0TR1T0TD0TR1T0" class="sys-bottompane-color-border borderNone sys-table-cell-bgcolor5 valigntop">
  375. <Div class="styChatTR5TD2" title="Send chat message" id="btnSendChat" name="btnSendChat" align="center">
  376. <A id="S0btnSendChat" name="S0btnSendChat" class="sys-font-body sys-link-normal" href="" onclick="SendChatData();return false;" onkeypress="if((window.event.keyCode == 13)||(window.event.keyCode == 0x20 )) SendChatData();"tabindex=2>
  377. <img id="I0btnSendChat" name="I0btnSendChat" src="../Common/SendChat.gif" class="BorderNone" onclick="SendChatData();" onkeypress="if((window.event.keyCode == 13)||(window.event.keyCode == 0x20 )) SendChatData();"><BR>
  378. Send
  379. </A>
  380. </Div>
  381. </TD>
  382. </TR>
  383. </TABLE>
  384. </TD>
  385. </TR>
  386. </TABLE>
  387. </TD>
  388. </TR>
  389. </Table>
  390. </body>
  391. </html>