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.

154 lines
3.1 KiB

  1. //
  2. // Copyright (c) 2000 Microsoft Corporation
  3. //
  4. //////////////////////////////////////////////////////////////////////
  5. var MF_SEPARATOR = 0x00000800;
  6. var MF_ENABLED = 0x00000000;
  7. var MF_GRAYED = 0x00000001;
  8. var MF_DISABLED = 0x00000002;
  9. var MF_UNCHECKED = 0x00000000;
  10. var MF_CHECKED = 0x00000008;
  11. var MF_UNHILITE = 0x00000000;
  12. var MF_HILITE = 0x00000080;
  13. //////////////////////////////////////////////////////////////////////
  14. function Common_CancelEvent()
  15. {
  16. event.cancelBubble = true;
  17. event.returnValue = false;
  18. }
  19. //////////////////////////////////////////////////////////////////////
  20. function Common_FindParent( obj, tag )
  21. {
  22. while(obj)
  23. {
  24. if(obj.tagName == tag) return obj;
  25. obj = obj.parentElement;
  26. }
  27. return null;
  28. }
  29. //////////////////////////////////////////////////////////////////////
  30. function Common_ClearTable( tbl )
  31. {
  32. if(tbl == null) return;
  33. var i;
  34. var lCount = tbl.rows.length;
  35. for(i=0; i<lCount; i++)
  36. {
  37. tbl.deleteRow(0);
  38. }
  39. }
  40. //////////////////////////////////////////////////////////////////////
  41. function Common_GetTopPosition( elem, fStopOnAbsolute )
  42. {
  43. var elem;
  44. var lTopPixel = 0;
  45. while(elem != null)
  46. {
  47. var fIsAbsolute = (elem.style.position == "absolute");
  48. if(fIsAbsolute && fStopOnAbsolute) break;
  49. lTopPixel += elem.offsetTop;
  50. elem = elem.offsetParent;
  51. if(fIsAbsolute)
  52. {
  53. while(elem != null && elem.style.position != "absolute") elem = elem.offsetParent;
  54. }
  55. }
  56. return lTopPixel;
  57. }
  58. function Common_GetLeftPosition( elem, fStopOnAbsolute )
  59. {
  60. var elem;
  61. var lLeftPixel = 0;
  62. var fSkipLast = (window.document.documentElement.dir == "rtl");
  63. while(elem != null)
  64. {
  65. var fIsAbsolute = (elem.style.position == "absolute");
  66. if(fSkipLast && elem.offsetParent == null) break;
  67. if(fIsAbsolute && fStopOnAbsolute) break;
  68. lLeftPixel += elem.offsetLeft;
  69. elem = elem.offsetParent;
  70. if(fIsAbsolute)
  71. {
  72. while(elem != null && elem.style.position != "absolute") elem = elem.offsetParent;
  73. }
  74. }
  75. return lLeftPixel;
  76. }
  77. function Common_toLocaleStr( ndate )
  78. {
  79. var d = new Date( ndate );
  80. var s = d.toLocaleString();
  81. return s;
  82. }
  83. ////////////////////////////////////////////////////////////////////////////////
  84. function Common_LogError( arg )
  85. {
  86. event.returnValue = true;
  87. var sMsg = "";
  88. var sUrl = "";
  89. var sLine = "";
  90. switch(arg.length)
  91. {
  92. case 3: sLine = arg[2];
  93. case 2: sUrl = arg[1];
  94. case 1: sMsg = arg[0];
  95. }
  96. var oFS = new ActiveXObject( "Scripting.FileSystemObject" );
  97. var oFile = oFS.OpenTextFile( oFS.GetSpecialFolder( 0 ) + "\\PCHealth\\HC_errors.log", 8, true );
  98. oFile.WriteLine( "Error at line " + sLine + " of script '" + sUrl + "' : " + sMsg );
  99. oFile.Close();
  100. }
  101. function ValidateURL( strURL )
  102. {
  103. var reValidURL = new RegExp( "^(hcp:|http:|https:|file:|ms-its:)", "i");
  104. if(reValidURL.test( strURL ))
  105. {
  106. return strURL;
  107. }
  108. else
  109. {
  110. return "hcp://system/errors/badurl.htm";
  111. }
  112. }