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.

443 lines
16 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. * taskNotify
  127. *
  128. * PURPOSE: Calls MMCCtrl's tasknotify. Uses expando properties instead of
  129. * parameters as the event is hooked up using attachEvent.
  130. *
  131. * This is just a dummy function. We cannot do attachEvent with
  132. * parameters. So we use this dummy function to call real function
  133. * with those properties.
  134. *
  135. * RETURNS:
  136. * Nothing
  137. *
  138. *+-------------------------------------------------------------------------*/
  139. function taskNotify()
  140. {
  141. var srcElement = window.event.srcElement;
  142. MMCCtrl.TaskNotify(srcElement.param1, srcElement.param2, srcElement.param3);
  143. }
  144. /*+-------------------------------------------------------------------------*
  145. *
  146. * PopulateTaskpad
  147. *
  148. * PURPOSE: Adds all tasks in the taskpad to the HTML. Also holds on to the
  149. * task objects using the array s_rgTasks.
  150. *
  151. * RETURNS:
  152. * Nothing
  153. *
  154. *+-------------------------------------------------------------------------*/
  155. function PopulateTaskpad()
  156. {
  157. var objTask = MMCCtrl.GetFirstTask(szHash);
  158. var strTasksHTML = "";
  159. var strTaskHTML = "";
  160. var bIsLargeIconMode = true;
  161. var i = 0;
  162. var count = 0;
  163. var tempArray;
  164. var IconSize = (bIsLargeIconMode) ? 32 : 16;
  165. // Add the listpad title and button, if it exists
  166. var objListviewInfo = MMCCtrl.GetListPadInfo(szHash);
  167. if (objListviewInfo)
  168. {
  169. // Set the parameters for button-click handler (see taskNotify).
  170. btnLV.param1 = objListviewInfo.Clsid;
  171. btnLV.param2 = objListviewInfo.NotifyID;
  172. btnLV.param3 = 0;
  173. btnLV.attachEvent("onclick", taskNotify);
  174. ListViewTitle.innerText = objListviewInfo.Title + "";
  175. if(objListviewInfo.HasButton)
  176. {
  177. btnLV.value = objListviewInfo.Text;
  178. }
  179. else
  180. {
  181. btnLV.style.display = "none";
  182. }
  183. }
  184. // add the watermark, if it exists
  185. var objWatermark = MMCCtrl.GetBackground( szHash );
  186. if (objWatermark != null)
  187. {
  188. // Keep track of the watermark display object type
  189. var watermarkObjectType = objWatermark.DisplayObjectType;
  190. switch (watermarkObjectType)
  191. {
  192. case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL
  193. var szWatermarkColor = (screen.colorDepth <= 8) ? "color:threedlightshadow;" : "color:threedshadow;filter:alpha(opacity=15);";
  194. 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>";
  195. TaskpadNameDIV.insertAdjacentHTML("afterEnd", szWatermark);
  196. break;
  197. case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent
  198. case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent
  199. case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster
  200. // Note: No distinction made between GIF & Raster for the watermark
  201. var gszWatermarkImage = objWatermark.MouseOverBitmap;
  202. break;
  203. }
  204. }
  205. // add the taskpad title
  206. TaskpadName.innerHTML = "<NOBR>"+MMCCtrl.GetTitle(szHash)+"</NOBR>";
  207. TaskpadDescription.innerHTML = MMCCtrl.GetDescriptiveText(szHash) + "<BR />";
  208. while (objTask != null)
  209. {
  210. s_rgTasks[i]= objTask; // this holds on to the task object.
  211. strTaskHTML = "";
  212. strTaskHTML += " <SPAN CLASS='cInline'>";
  213. strTaskHTML += "";
  214. strTaskHTML += " <TABLE BORDER='0' WIDTH='100%'>";
  215. strTaskHTML += " <TR>";
  216. strTaskHTML += " <TD>";
  217. strTaskHTML += " <BR />";
  218. strTaskHTML += " </TD>";
  219. strTaskHTML += " </TR>";
  220. strTaskHTML += " <TR>";
  221. strTaskHTML += " <TD VALIGN='TOP' width='32'height='32' style='border: 0 black solid; overflow:hidden'>";
  222. strTaskHTML += GetTaskDisplayHTML(objTask, i);
  223. strTaskHTML += " </TD>";
  224. strTaskHTML += " <TD>";
  225. strTaskHTML += " <SPAN CLASS='Task' id='TaskID' onmouseover=\"javascript:window.event.srcElement.className='TaskHover';\" onmouseout=\"javascript:window.event.srcElement.className='Task';\"";
  226. strTaskHTML += " onclick='javascript:Task"+i+"_Clicked();'";
  227. strTaskHTML += " tabIndex=\"0\">";
  228. strTaskHTML += " </SPAN>";
  229. strTaskHTML += "";
  230. strTaskHTML += " </TD>";
  231. strTaskHTML += " </TR>";
  232. strTaskHTML += " </TABLE>";
  233. strTaskHTML += " </SPAN>";
  234. szScripts += " function Task"+i+"_Clicked()";
  235. szScripts += " {";
  236. szScripts += " try";
  237. szScripts += " {";
  238. szScripts += " window.event.srcElement.className='Task';";
  239. switch (objTask.ActionType)
  240. // 3 possibilities for action: "ID:", "LINK:" and "SCRIPT:"
  241. {
  242. case 0:
  243. // MMC_TASK_ACTION_ID
  244. szScripts += "MMCCtrl.TaskNotify(s_rgTasks["+i+"].Clsid,s_rgTasks["+i+"].CommandID,0);";
  245. break;
  246. case 1:
  247. // MMC_TASK_ACTION_LINK
  248. szScripts += "window.navigate(s_rgTasks["+i+"].ActionURL);";
  249. break;
  250. case 2:
  251. // MMC_TASK_ACTION_SCRIPT
  252. // Convert script language string to upper case
  253. var szLanguage = objTask.ScriptLanguage.toUpperCase();
  254. switch (szLanguage)
  255. {
  256. case "JSCRIPT":
  257. case "JAVASCRIPT":
  258. // Pass a script string to the JSObject to be evaluated and executed
  259. // through the eval method (this can be a semi-colon delimited complex expression)
  260. szScripts += "eval (s_rgTasks["+i+"].Script);";
  261. break;
  262. case "VBSCRIPT":
  263. case "VBS":
  264. // Use the window.execScript method to execute a simple or complex VBScript expression
  265. szScripts += "window.execScript (s_rgTasks["+i+"].Script, '"+szLanguage+"');";
  266. break;
  267. default:
  268. var L_UnknownScriptingLanguage_ErrorMessage = "Unrecognized scripting language.";
  269. alert (L_UnknownScriptingLanguage_ErrorMessage);
  270. break;
  271. }
  272. break;
  273. break;
  274. }
  275. szScripts += " ";
  276. szScripts += " } catch(e)";
  277. szScripts += " {";
  278. szScripts += " window.alert(e.description);";
  279. szScripts += " }";
  280. szScripts += " }";
  281. strTasksHTML += strTaskHTML;
  282. objTask = MMCCtrl.GetNextTask();
  283. ++i;
  284. }
  285. count = i; // the total number of tasks
  286. Tasks.innerHTML = strTasksHTML; // add the tasks to the HTML
  287. tempArray= document.all.item("TaskID"); //get the collection of all tasks on the page.
  288. if(count==1)
  289. {
  290. // in this case tempArray is not an array at all, but a single object per the DHTML object model
  291. tempArray.title =s_rgTasks[0].Help; // set the tooltip
  292. tempArray.innerText =s_rgTasks[0].Text; // set the title
  293. eval("Image0.title=s_rgTasks[0].Help;"); // set the tooltip for the image
  294. }
  295. else
  296. {
  297. if(tempArray.length != count) // sanity check
  298. {
  299. alert("Error!");
  300. }
  301. // set up the tasks - we do this here rather than expanding the variables in the strings above to
  302. // prevent Escaping problems. Eg \ would need to be converted to \\ otherwise.
  303. for(i=0; i<count; i++)
  304. {
  305. tempArray(i).title =s_rgTasks[i].Help; // set the tooltip
  306. tempArray(i).innerText =s_rgTasks[i].Text; // set the title
  307. eval("Image"+i+".title=s_rgTasks["+i+"].Help;"); // set the tooltip for the image
  308. }
  309. }
  310. 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.
  311. TaskpadNameDIV.insertAdjacentHTML("afterBegin", szScripts);
  312. }
  313. function OnLoad()
  314. {
  315. document.vlinkColor = document.linkColor; // make sure that visited links don't look different
  316. PopulateTaskpad();
  317. }
  318. </script>
  319. </head>
  320. <body id="body" scroll='no' onload='OnLoad()' tabIndex='-1'>
  321. <DIV id="TaskpadNameDIV" style="position:absolute; top:0; left:0">
  322. <TABLE WIDTH="100%" cellspacing="0" cellpadding="0" COLS="2">
  323. <TR>
  324. <TD><SPAN style="width:32px"></SPAN></TD>
  325. <TD id="TaskpadName"><NOBR></NOBR></TD>
  326. </TR>
  327. </TABLE>
  328. </DIV>
  329. <TABLE WIDTH="100%" HEIGHT="100%" cellspacing="0" cellpadding="0">
  330. <TR id="TitleRow" WIDTH="100%" VALIGN="TOP">
  331. <TD id="LeftPanel" WIDTH="100%">
  332. <object id='FolderIcon' classid="clsid:B0395DA5-6A15-4E44-9F36-9A9DC7A2F341" tabIndex='-1'> <!-- do not display the notch for horizontal taskpads-->
  333. <PARAM NAME="Notch" VALUE="0"></PARAM>
  334. </object>
  335. </TD>
  336. </TR>
  337. <tr ID="DescriptionRow">
  338. <td id='TaskpadDescription' ><BR /></td>
  339. </tr>
  340. <tr>
  341. <TD style="background-color:buttonface">
  342. <TABLE style="width:100%">
  343. <TR>
  344. <TD width="100%"><DIV id="ListViewTitle"></DIV>
  345. </TD>
  346. <TD>
  347. <INPUT type="button" id="btnLV" style="font:menu"/>
  348. </TD>
  349. </TR>
  350. </TABLE>
  351. </TD>
  352. </tr>
  353. <tr id="TopPanelRow" style="height:100%;">
  354. <td id='TopPanel' style="padding:0; border:solid windowtext 1;" >
  355. <DIV id ="MMCViewElement" style="position:relative; height:100%; width:100%; left:0%;" >
  356. <object id="ListView" style="overflow:auto; width:100%; height:100%" classid="clsid:289228DE-A31E-11D1-A19C-0000F875B132"></object>
  357. </DIV>
  358. </td>
  359. </tr>
  360. <TR valign="top">
  361. <TD ID="BottomPanel" VALIGN="TOP">
  362. <DIV id="Tasks" STYLE="overflow-y:auto; overflow-x:none; height:150px;"></DIV>
  363. </TD>
  364. </TR>
  365. </TABLE>
  366. </body>
  367. </HTML>