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.

381 lines
14 KiB

  1. <HTML>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  4. <object id="MMCCtrl" width=0 height=0 classid="CLSID:545AE700-50BF-11D1-9FE9-00600832DB4A"></object>
  5. <object id="SysColorX" width=0 height=0 classid="CLSID:C47195EC-CD7A-11D1-8EA3-00C04F9900D7"></object>
  6. <style>
  7. body {margin:0; font: clientTop:0; icon; color: windowtext; background:window; overflow:none}
  8. .cInline {
  9. display:inline; width:30%;
  10. margin-right:5px;
  11. vertical-align:top;
  12. }
  13. BottomPanel {overflow:auto}
  14. #FolderIcon {height:expression(TaskpadName.clientHeight + 10); width:100%;}
  15. #TaskpadName {font: caption; color:captiontext; margin-left:0; margin-right:0; margin-top: 0; width:100%; border:0; padding-left:3; padding-top:5; padding-bottom:7;}
  16. #TaskpadDescription {font:icon; padding-left:5px; padding-top:5px; padding-bottom:3px; padding-right:5px}
  17. p {font-weight:normal; border:0; margin-top:0}
  18. table {font:icon; border:0 solid; padding:0; margin:0;} <!--cellpadding and cellspacing only apply to table, but are NOT CSS attributes. Set them on a per-tag basis -->
  19. tr {margin:0; border:0; padding:0}
  20. td {margin:0; border:0 solid; padding:0}
  21. div {border:0; margin:0; padding:0; }
  22. .Task {color:expression(document.linkColor); text-decoration:underline; cursor:hand;}
  23. .TaskHover {color:expression(document.linkColor); text-decoration:underline; cursor:hand;} <!-- Cannot use the user's hover color because once a link has been visited, the hover color never appears. So it is better
  24. to be consistent than correct only part of the time -->
  25. <!--@font-face {font-family:'GLYPH 100';src:url("res://C:\WINNT\system32\mmc.exe/glyph100.eot");}-->
  26. </style>
  27. <script language = "JavaScript">
  28. // constants
  29. // Taskpad button display types
  30. var CON_TASK_DISPLAY_TYPE_SYMBOL = 1; // EOT-based symbol | font
  31. var CON_TASK_DISPLAY_TYPE_VANILLA_GIF = 2; // (GIF) index 0 is transparent
  32. var CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF = 3; // (GIF) index 1 is transparent
  33. var CON_TASK_DISPLAY_TYPE_BITMAP = 4; // non-transparent raster image
  34. // global variables
  35. var s_rgTasks = new Array();
  36. var s_rgURLtoEOTUnique = new Array();
  37. var s_rgFontFamilyNameUnique = new Array();
  38. var szScripts = "";
  39. var szHash = location.hash;
  40. if (szHash != "") // not sure why this is needed.
  41. {
  42. szHash = szHash.substr(1);
  43. }
  44. // need to collect the list of unique EOT URLs and create a <STYLE> @font-face{} </STYLE> rule here
  45. {
  46. // 1. Add all EOTs to a list
  47. var objTask = MMCCtrl.GetFirstTask(szHash);
  48. while (objTask != null)
  49. {
  50. var displayObject = objTask.DisplayObject;
  51. if(displayObject.DisplayObjectType == CON_TASK_DISPLAY_TYPE_SYMBOL) // EOT-based symbol | font
  52. AddEOT(displayObject. URLtoEOT, displayObject.FontFamilyName);
  53. objTask = MMCCtrl.GetNextTask();
  54. }
  55. var szCssText = "";
  56. // 2. Loop through each unique EOT & FontFamilyName
  57. for (var i = 0; i < s_rgURLtoEOTUnique.length; i++)
  58. {
  59. szCssText += "@font-face {font-family:'" + s_rgFontFamilyNameUnique[i] + "';font-style:normal; font-weight:normal; src:url('" + s_rgURLtoEOTUnique[i] + "');}";
  60. }
  61. szCssText = "<style" +">" + szCssText + "</style" +">";
  62. //alert(szCssText);
  63. document.write(szCssText);
  64. }
  65. // Prevent text from being selected and messing up the UI.
  66. function document.onselectstart()
  67. {
  68. event.returnValue = false;
  69. }
  70. function AddEOT(szURLtoEOT, szFontFamilyName)
  71. {
  72. // 1. determine whether the URL is unique
  73. // Get the length of the unique URL array
  74. var iLength = s_rgURLtoEOTUnique.length;
  75. var i = 0;
  76. // Compare with each existing entry in the array
  77. if(iLength > 0)
  78. {
  79. for (i = 0; i < iLength; i++)
  80. {
  81. if (s_rgURLtoEOTUnique[i] == szURLtoEOT)
  82. {
  83. // Found a duplicate
  84. bUnique = false;
  85. return;
  86. }
  87. }
  88. }
  89. // 2. If we reached here, the URL is unique. Add it to the array.
  90. s_rgURLtoEOTUnique[iLength] = szURLtoEOT;
  91. s_rgFontFamilyNameUnique[iLength] = szFontFamilyName;
  92. }
  93. function GetTaskDisplayHTML(objTask, i)
  94. {
  95. var displayObject = objTask.DisplayObject;
  96. // Build up the HTML for the button
  97. var szBtnHTML = "";
  98. var displayObjectType = displayObject.DisplayObjectType;
  99. switch (displayObjectType)
  100. {
  101. case CON_TASK_DISPLAY_TYPE_SYMBOL: // EOT-based symbol | font
  102. szBtnHTML += " <span id = 'Image"+i+"' style='cursor:hand' width='100%' height='100%' onclick='javascript:Task"+i+"_Clicked();' style='font-family:\"" + displayObject.FontFamilyName + "\";font-size:23pt;'>" + displayObject.SymbolString +"</span>";
  103. break;
  104. // there is NO difference between CON_TASK_DISPLAY_TYPE_VANILLA_GIF and CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF. The original intent was never implemented.
  105. case CON_TASK_DISPLAY_TYPE_VANILLA_GIF: // transparent
  106. case CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF: // transparent
  107. case CON_TASK_DISPLAY_TYPE_BITMAP: // non-transparent raster image
  108. var szFilterCode = "";
  109. var szMouseOverCode = "";
  110. if( (displayObjectType == CON_TASK_DISPLAY_TYPE_VANILLA_GIF) || (displayObjectType == CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF) )
  111. {
  112. szFilterCode = "FILTER: mask(color=" + SysColorX.HEXthreedshadow + "); ";
  113. }
  114. if( (displayObject.MouseOverBitmap != "") && (displayObject.MouseOverBitmap != displayObject.MouseOffBitmap))
  115. {
  116. szMouseOverCode = "onmouseover='Image"+i+".src=s_rgTasks["+i+"].DisplayObject.MouseOverBitmap;' ";
  117. szMouseOverCode += "onmouseout ='Image"+i+".src=s_rgTasks["+i+"].DisplayObject.MouseOffBitmap;' ";
  118. }
  119. szBtnHTML += "<span style='cursor:hand' width='100%' height='100%' onclick='javascript:Task"+i+"_Clicked();'> <IMG id='Image"+i+"'"+ szMouseOverCode +"style='" + szFilterCode +"WIDTH: 32px; HEIGHT: 32px' src='"+displayObject.MouseOffBitmap+"'></span>";
  120. break;
  121. }
  122. return szBtnHTML;
  123. }
  124. /*+-------------------------------------------------------------------------*
  125. *
  126. * PopulateTaskpad
  127. *
  128. * PURPOSE: Adds all tasks in the taskpad to the HTML. Also holds on to the
  129. * task objects using the array s_rgTasks.
  130. *
  131. * RETURNS:
  132. * Nothing
  133. *
  134. *+-------------------------------------------------------------------------*/
  135. function PopulateTaskpad()
  136. {
  137. var objTask = MMCCtrl.GetFirstTask(szHash);
  138. var strTasksHTML = "";
  139. var strTaskHTML = "";
  140. var bIsLargeIconMode = true;
  141. var i = 0;
  142. var count = 0;
  143. var tempArray;
  144. var IconSize = (bIsLargeIconMode) ? 32 : 16;
  145. // add the watermark, if it exists
  146. var objWatermark = MMCCtrl.GetBackground( szHash );
  147. if (objWatermark != null)
  148. {
  149. // Keep track of the watermark display object type
  150. var watermarkObjectType = objWatermark.DisplayObjectType;
  151. switch (watermarkObjectType)
  152. {
  153. case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL
  154. var szWatermarkColor = (screen.colorDepth <= 8) ? "color:threedlightshadow;" : "color:threedshadow;filter:alpha(opacity=15);";
  155. var szWatermark = "<table style=' z-index:-1; position:absolute' width='100%' height='100%' cellspacing='0' cellpadding='10' border='0' frame='none' rules='none'><tr><td style='width:100%'><span></span></td><td valign='bottom' style='"+szWatermarkColor+" font-family:\"" + objWatermark.FontFamilyName + "\";font-weight:normal;font-size:300pt;'>" + objWatermark.SymbolString +"</td></tr></table>";
  156. TaskpadNameDIV.insertAdjacentHTML("afterEnd", szWatermark);
  157. break;
  158. case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent
  159. case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent
  160. case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster
  161. // Note: No distinction made between GIF & Raster for the watermark
  162. var gszWatermarkImage = objWatermark.MouseOverBitmap;
  163. break;
  164. }
  165. }
  166. // add the taskpad title
  167. TaskpadName.innerHTML = "<NOBR>"+MMCCtrl.GetTitle(szHash)+"</NOBR>";
  168. TaskpadDescription.innerHTML = MMCCtrl.GetDescriptiveText(szHash) + "<BR />";
  169. while (objTask != null)
  170. {
  171. s_rgTasks[i]= objTask; // this holds on to the task object.
  172. strTaskHTML = "";
  173. strTaskHTML += " <SPAN CLASS='cInline'>";
  174. strTaskHTML += "";
  175. strTaskHTML += " <TABLE BORDER='0' WIDTH='100%'>";
  176. strTaskHTML += " <TR>";
  177. strTaskHTML += " <TD>";
  178. strTaskHTML += " <BR />";
  179. strTaskHTML += " </TD>";
  180. strTaskHTML += " </TR>";
  181. strTaskHTML += " <TR>";
  182. strTaskHTML += " <TD VALIGN='TOP' width='32'height='32' style='border: 0 black solid; overflow:hidden'>";
  183. strTaskHTML += GetTaskDisplayHTML(objTask, i);
  184. strTaskHTML += " </TD>";
  185. strTaskHTML += " <TD>";
  186. strTaskHTML += " <SPAN CLASS='Task' id='TaskID' onmouseover=\"javascript:window.event.srcElement.className='TaskHover';\" onmouseout=\"javascript:window.event.srcElement.className='Task';\"";
  187. strTaskHTML += " onclick='javascript:Task"+i+"_Clicked();'";
  188. strTaskHTML += " tabIndex=\"0\">";
  189. strTaskHTML += " </SPAN>";
  190. strTaskHTML += "";
  191. strTaskHTML += " </TD>";
  192. strTaskHTML += " </TR>";
  193. strTaskHTML += " </TABLE>";
  194. strTaskHTML += " </SPAN>";
  195. szScripts += " function Task"+i+"_Clicked()";
  196. szScripts += " {";
  197. szScripts += " try";
  198. szScripts += " {";
  199. szScripts += " window.event.srcElement.className='Task';";
  200. switch (objTask.ActionType)
  201. // 3 possibilities for action: "ID:", "LINK:" and "SCRIPT:"
  202. {
  203. case 0:
  204. // MMC_TASK_ACTION_ID
  205. szScripts += "MMCCtrl.TaskNotify(s_rgTasks["+i+"].Clsid,s_rgTasks["+i+"].CommandID,0);";
  206. break;
  207. case 1:
  208. // MMC_TASK_ACTION_LINK
  209. szScripts += "window.navigate(s_rgTasks["+i+"].ActionURL);";
  210. break;
  211. case 2:
  212. // MMC_TASK_ACTION_SCRIPT
  213. // Convert script language string to upper case
  214. var szLanguage = objTask.ScriptLanguage.toUpperCase();
  215. switch (szLanguage)
  216. {
  217. case "JSCRIPT":
  218. case "JAVASCRIPT":
  219. // Pass a script string to the JSObject to be evaluated and executed
  220. // through the eval method (this can be a semi-colon delimited complex expression)
  221. szScripts += "eval (s_rgTasks["+i+"].Script);";
  222. break;
  223. case "VBSCRIPT":
  224. case "VBS":
  225. // Use the window.execScript method to execute a simple or complex VBScript expression
  226. szScripts += "window.execScript (s_rgTasks["+i+"].Script, '"+szLanguage+"');";
  227. break;
  228. default:
  229. var L_UnknownScriptingLanguage_ErrorMessage = "Unrecognized scripting language.";
  230. alert (L_UnknownScriptingLanguage_ErrorMessage);
  231. break;
  232. }
  233. break;
  234. break;
  235. }
  236. szScripts += " ";
  237. szScripts += " } catch(e)";
  238. szScripts += " {";
  239. szScripts += " window.alert(e.description);";
  240. szScripts += " }";
  241. szScripts += " }";
  242. strTasksHTML += strTaskHTML;
  243. objTask = MMCCtrl.GetNextTask();
  244. ++i;
  245. }
  246. count = i; // the total number of tasks
  247. Tasks.innerHTML = strTasksHTML; // add the tasks to the HTML
  248. tempArray= document.all.item("TaskID"); //get the collection of all tasks on the page.
  249. if(count==1)
  250. {
  251. // in this case tempArray is not an array at all, but a single object per the DHTML object model
  252. tempArray.title =s_rgTasks[0].Help; // set the tooltip
  253. tempArray.innerText =s_rgTasks[0].Text; // set the title
  254. eval("Image0.title=s_rgTasks[0].Help;"); // set the tooltip for the image
  255. }
  256. else
  257. {
  258. if(tempArray.length != count) // sanity check
  259. {
  260. alert("Error!");
  261. }
  262. // set up the tasks - we do this here rather than expanding the variables in the strings above to
  263. // prevent Escaping problems. Eg \ would need to be converted to \\ otherwise.
  264. for(i=0; i<count; i++)
  265. {
  266. tempArray(i).title =s_rgTasks[i].Help; // set the tooltip
  267. tempArray(i).innerText =s_rgTasks[i].Text; // set the title
  268. eval("Image"+i+".title=s_rgTasks["+i+"].Help;"); // set the tooltip for the image
  269. }
  270. }
  271. szScripts = '<span style="display:none">h</span><SCRIPT DEFER>' + szScripts +'</SCRIPT' + '>'; // see Q185140. The SPAN is needed because it causes the page to be reparsed.
  272. TaskpadNameDIV.insertAdjacentHTML("afterBegin", szScripts);
  273. }
  274. function OnLoad()
  275. {
  276. document.vlinkColor = document.linkColor; // make sure that visited links don't look different
  277. PopulateTaskpad();
  278. }
  279. </script>
  280. </head>
  281. <body id="body" scroll='no' onload='OnLoad()' tabIndex='-1'>
  282. <DIV id="TaskpadNameDIV" style="position:absolute; top:0; left:0">
  283. <TABLE WIDTH="100%" cellspacing="0" cellpadding="0" COLS="2">
  284. <TR>
  285. <TD><SPAN style="width:32px"></SPAN></TD>
  286. <TD id="TaskpadName"><NOBR></NOBR></TD>
  287. </TR>
  288. </TABLE>
  289. </DIV>
  290. <TABLE WIDTH="100%" HEIGHT="100%" cellspacing="0" cellpadding="0" COLS="2">
  291. <TR WIDTH="100%">
  292. <TD id="LeftPanel" WIDTH="100%" ROWSPAN="2">
  293. <object id='FolderIcon' classid="clsid:B0395DA5-6A15-4E44-9F36-9A9DC7A2F341" tabIndex='-1'>
  294. <PARAM NAME="Notch" VALUE="0"/>
  295. </object>
  296. </TD>
  297. <TD ID="RightPanel" bgColor="activecaption" VALIGN="TOP" WIDTH="100%" style="height:expression(TaskpadName.clientHeight);">
  298. </TD>
  299. </TR>
  300. <TR>
  301. <TD HEIGHT="10"></TD>
  302. </TR>
  303. <TR height="100%" valign="top">
  304. <TD>
  305. <DIV id="TaskpadDescription"><BR /></DIV>
  306. <DIV id="Tasks" STYLE="overflow: auto; padding-left:5; padding-right:5"></DIV>
  307. </TD>
  308. <TD id="ViewPanel"></TD>
  309. </TR>
  310. </TABLE>
  311. </body>
  312. </HTML>