Source code of Windows XP (NT5)
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.

217 lines
5.5 KiB

  1. function DoNothing()
  2. {
  3. // Stub
  4. }
  5. //****************************
  6. // CLICK EVENT HELPER FUNCTION
  7. //****************************
  8. function SymbolClickHandler(theIndex)
  9. {
  10. // Determine what type of action to take
  11. // based on value in gaiBtnActionType array
  12. switch( gaiBtnActionType[theIndex] )
  13. {
  14. case 0: // MMC_TASK_ACTION_ID:
  15. ExecuteCommandID( gaszBtnActionClsid[theIndex], gaiBtnActionID[theIndex], 0 );
  16. break;
  17. case 1: // MMC_TASK_ACTION_LINK:
  18. // document.location( gaszBtnActionURL[theIndex] );
  19. window.navigate( gaszBtnActionURL[theIndex] );
  20. break;
  21. case 2: // MMC_TASK_ACTION_SCRIPT:
  22. // Determine whether the language is (JSCRIPT | JAVASCRIPT) or (VBSCRIPT | VBS)
  23. // Convert toUpperCase
  24. var szLanguage = gaszBtnActionScriptLanguage[theIndex].toUpperCase();
  25. switch( szLanguage )
  26. {
  27. case 'JSCRIPT':
  28. case 'JAVASCRIPT':
  29. // Pass a script string to the JSObject to be evaluated and executed
  30. // through the eval method (this can be a semi-colon delimited complex expression)
  31. eval( gaszBtnActionScript[theIndex] );
  32. break;
  33. case 'VBSCRIPT':
  34. case 'VBS':
  35. // Use the window.execScript method to execute a simple or complex VBScript expression
  36. window.execScript( gaszBtnActionScript[theIndex], szLanguage );
  37. break;
  38. default:
  39. alert( 'Unrecognized scripting language.' );
  40. break;
  41. }
  42. break;
  43. default:
  44. alert( 'Unrecognized task.' );
  45. break;
  46. }
  47. }
  48. //***************************************************
  49. // CIC TASK NOTIFY HELPER FUNCTION (ExecuteCommandID)
  50. //***************************************************
  51. function ExecuteCommandID(szClsid, arg, param)
  52. {
  53. MMCCtrl.TaskNotify (szClsid, arg, param);
  54. }
  55. //***********************************
  56. // EOT & FONT-FAMILY HELPER FUNCTIONS
  57. //***********************************
  58. function IsUniqueEOT( szURLtoEOT )
  59. {
  60. // Get the length of the test array
  61. var iLength = gaszURLtoEOTUnique.length;
  62. // If the length is empty, return true
  63. // since the EOT *must* be unique
  64. if( iLength == 0 ) {
  65. return true;
  66. }
  67. // Compare with each existing entry in the array
  68. for( var i = 0; i < iLength; i++ ) {
  69. if( gaszURLtoEOTUnique[i] == szURLtoEOT ) {
  70. // Found a duplicate
  71. return false;
  72. }
  73. }
  74. // If we made it this far, the EOT is unique
  75. return true;
  76. }
  77. function AddUniqueEOT( szEOT, szFontFamilyName )
  78. {
  79. // Use the length of the EOT array to get the
  80. // index for the next element to be added
  81. var iNextIndex = gaszURLtoEOTUnique.length;
  82. gaszURLtoEOTUnique[iNextIndex] = szEOT;
  83. gaszFontFamilyNameUnique[iNextIndex] = szFontFamilyName;
  84. }
  85. //***************
  86. //COLOR FUNCTIONS
  87. //***************
  88. function SetBaseColors( iPageType )
  89. {
  90. // NOTE: Body background color is set from dedicated SCRIPT block just after
  91. // the HEAD tag to ensure that the page doesn't momentarily show white while loading
  92. switch( iPageType ) {
  93. case CON_TODOPAGE:
  94. break;
  95. case CON_LINKPAGE:
  96. tdWatermark.style.color = SysColorX.GetHalfLightHex( gszBaseColor, 'HEX' );
  97. break;
  98. }
  99. }
  100. function SynchTooltipColorsToSystem()
  101. {
  102. tblTooltip.style.backgroundColor = 'infobackground';
  103. tblTooltip.style.color = 'infotext';
  104. divTooltipPointer.style.color = 'buttonshadow';
  105. // Show a one-pixel border around the divTooltip
  106. divTooltip.style.borderWidth = 1;
  107. }
  108. function InitializeMenubar( iPageType )
  109. {
  110. divMenu.style.backgroundColor = gszBgColorMenu;
  111. divBand.style.backgroundColor = gszBgColorBand;
  112. tblMenu.style.backgroundColor = gszBgColorMenu;
  113. tblMenu.style.color = gszColorTabDefault;
  114. for( var i = 0; i <= giTotalTabs; i++ ) {
  115. document.all('mnu_' + i).style.color = gszColorAnchorMenuSelected;
  116. document.all('mnu_' + i ).innerText = L_gszMenuText_StaticText[i];
  117. }
  118. switch( iPageType )
  119. {
  120. case CON_LINKPAGE:
  121. // Set first tab to selected state
  122. tdTab_0.style.backgroundColor = gszBgColorTabSelected;
  123. break;
  124. case CON_TASKPAGE:
  125. // Set first tab to disabled state
  126. tdTab_0.style.backgroundColor = SysColorX.GetQuarterDarkHex( gszBaseColor, 'HEX' );
  127. break;
  128. }
  129. }
  130. //************************
  131. // RESIZE MENUBAR FUNCTION
  132. //************************
  133. function ResizeMenubar()
  134. {
  135. var iSmallerDimension = GetSmallerDimension();
  136. tblMenu.style.fontSize = iSmallerDimension * L_ConstMenuText_Size;
  137. }
  138. //*****************
  139. //UTILITY FUNCTIONS
  140. //*****************
  141. function GetSmallerDimension()
  142. {
  143. //Purpose: Returns the smaller of clientHeight or clientWidth
  144. var cw = document.body.clientWidth;
  145. var ch = document.body.clientHeight;
  146. // Get smaller of clientWidth or clientHeight
  147. if( cw <= ch ) {
  148. return cw;
  149. }
  150. else {
  151. return ch;
  152. }
  153. }
  154. function GetElementIndex(ElementID)
  155. {
  156. // Purpose: Given an Element ID formatted as follows:
  157. // "divCaption_12"
  158. // returns the numeric portion after the underscore character;
  159. // returns -1 if delimiter not found.
  160. var iDelimitLoc = ElementID.indexOf( '_' );
  161. if( iDelimitLoc == -1 ) {
  162. // Return -1 if delimiter not found (which shouldn't happen)
  163. return iDelimitLoc;
  164. }
  165. else {
  166. var theIndex = ElementID.substring( iDelimitLoc + 1, ElementID.length );
  167. // TODO: Confirm that theIndex is numeric and does not contain illegal characters
  168. return theIndex;
  169. }
  170. }
  171. function GetPixelSize(szTheSize)
  172. {
  173. // Purpose: Given an Element.style.fontSize formatted as follows:
  174. // "72px"
  175. // returns the parsed numeric portion, discarding the "px" string at the end;
  176. // Assumes that szTheSize is properly formatted, and that the Object Model identifier
  177. // for pixel size always appears at the end of the string.
  178. // TODO: Absolutely no error checking here (or in calling function)
  179. return parseInt(szTheSize);
  180. }