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.

146 lines
3.3 KiB

  1. //
  2. // This file contains JavaScriptlets some script that can be reused easily.
  3. //
  4. function SendMail(p_to, p_Subject, p_Body)
  5. {
  6. try
  7. {
  8. var email = new ActiveXObject("CDO.Message");
  9. with (email)
  10. {
  11. // CC = CClist;
  12. From = "[email protected]";
  13. To = p_to;
  14. Subject = p_Subject;
  15. // TextBody = p_Body;
  16. HTMLBody = p_Body
  17. with (Configuration.Fields)
  18. {
  19. var schemaBase = "http://schemas.microsoft.com/cdo/configuration/"
  20. Item (schemaBase + "sendusing") = 2;
  21. Item (schemaBase + "smtpserver") = "smarthost";
  22. Item (schemaBase + "smtpconnectiontimeout") = 2;
  23. Update();
  24. }
  25. Send();
  26. }
  27. }
  28. catch (e)
  29. {
  30. alert("Send mail failed.\nPlease use Save Out put to File button, and send the file manually.");
  31. }
  32. }
  33. function SendMail_orig(p_to, p_Subject, p_Body)
  34. {
  35. try
  36. {
  37. var oOutlook = new ActiveXObject("Outlook.Application");
  38. var oMail = oOutlook.CreateItem(0);
  39. oMail.recipients.Add(p_to);
  40. oMail.Subject = p_Subject;
  41. oMail.HTMLBody = p_Body;
  42. oMail.Send();
  43. alert ("mail sent!");
  44. }
  45. catch (e)
  46. {
  47. alert("Send mail failed.\nPlease check if your email address is valid and make sure your Outlook application works fine.");
  48. }
  49. }
  50. function SaveToFile(p_filename, p_Html)
  51. {
  52. try
  53. {
  54. var fso = new ActiveXObject("Scripting.FileSystemObject");
  55. var a = fso.CreateTextFile(p_filename, true);
  56. a.Write(p_Html);
  57. a.Close();
  58. alert ("Saved to file " + p_filename );
  59. }
  60. catch (e)
  61. {
  62. alert("failed to save to file");
  63. }
  64. }
  65. function GetTableSource(table)
  66. {
  67. var s = "";
  68. s = "<HTML> \n";
  69. s += table.outerHTML;
  70. s += "\n";
  71. s += "</HTML>";
  72. return s;
  73. /*
  74. // This works as well!
  75. alert(document.documentElement.innerHTML);
  76. // This code Works !!!
  77. var s=""
  78. var de=window.document.documentElement;
  79. if(de.sourceIndex!=0){//there's stuff before the html tag.
  80. for(var etc=0;etc<de.sourceIndex;etc++){
  81. s+=document.all(etc).outerHTML;
  82. };
  83. }
  84. alert(s+=de.outerHTML);
  85. */
  86. }
  87. var aWin;
  88. function openWin(astr, p_X, p_Y)
  89. {
  90. var windowoptions = "toolbar=no,menubar=no,location=no,height=200, width=200, top=" + p_Y+ ", left="+ p_X;
  91. /*
  92. if (aWin)
  93. {
  94. aPopUp = aWin;
  95. }
  96. else
  97. {
  98. aPopUp= window.open('','Note',windowoptions);
  99. }
  100. */
  101. aPopUp= window.open('','Note',windowoptions);
  102. var oPopupBody = aPopUp.document.body;
  103. oPopupBody.style.backgroundColor = "lightyellow";
  104. oPopupBody.style.border="solid black 1px";
  105. var ndoc= aPopUp.document;
  106. ndoc.write(astr);
  107. ndoc.close();
  108. self.aWin = aPopUp;
  109. }
  110. function JS_Popup(popuptext, p_X, p_Y)
  111. {
  112. var oPopup = window.createPopup();
  113. var oPopupBody = oPopup.document.body;
  114. oPopupBody.style.backgroundColor = "lightyellow";
  115. oPopupBody.style.border="solid black 1px";
  116. oPopupBody.innerHTML = popuptext
  117. oPopup.show(p_X, p_Y, 200, 200, document.body);
  118. }
  119. function ShowHtmlInAWindow(src)
  120. {
  121. src = "about:"+src;
  122. hwin = window.open(src);
  123. }