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.
|
|
<HTML> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<object id="MMCCtrl" width=0 height=0 classid="CLSID:545AE700-50BF-11D1-9FE9-00600832DB4A"></object> <object id="SysColorX" width=0 height=0 classid="CLSID:C47195EC-CD7A-11D1-8EA3-00C04F9900D7"></object>
<style> body {margin:0; font: clientTop:0; icon; color: windowtext; background:window; overflow:none} .cInline { display:inline; width:30%; margin-right:5px; vertical-align:top; } BottomPanel {overflow:auto} #FolderIcon {height:expression(TaskpadName.clientHeight + 10); width:100%;} #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;} #TaskpadDescription {font:icon; padding-left:5px; padding-top:5px; padding-bottom:3px; padding-right:5px} p {font-weight:normal; border:0; margin-top:0} 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 --> tr {margin:0; border:0; padding:0} td {margin:0; border:0 solid; padding:0} div {border:0; margin:0; padding:0; }
.Task {color:expression(document.linkColor); text-decoration:underline; cursor:hand;} .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
to be consistent than correct only part of the time --> <!--@font-face {font-family:'GLYPH 100';src:url("res://C:\WINNT\system32\mmc.exe/glyph100.eot");}--> </style>
<script language = "JavaScript"> // constants // Taskpad button display types var CON_TASK_DISPLAY_TYPE_SYMBOL = 1; // EOT-based symbol | font var CON_TASK_DISPLAY_TYPE_VANILLA_GIF = 2; // (GIF) index 0 is transparent var CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF = 3; // (GIF) index 1 is transparent var CON_TASK_DISPLAY_TYPE_BITMAP = 4; // non-transparent raster image
// global variables var s_rgTasks = new Array(); var s_rgURLtoEOTUnique = new Array(); var s_rgFontFamilyNameUnique = new Array(); var szScripts = "";
var szHash = location.hash;
if (szHash != "") // not sure why this is needed. { szHash = szHash.substr(1); }
// need to collect the list of unique EOT URLs and create a <STYLE> @font-face{} </STYLE> rule here { // 1. Add all EOTs to a list var objTask = MMCCtrl.GetFirstTask(szHash); while (objTask != null) { var displayObject = objTask.DisplayObject;
if(displayObject.DisplayObjectType == CON_TASK_DISPLAY_TYPE_SYMBOL) // EOT-based symbol | font AddEOT(displayObject. URLtoEOT, displayObject.FontFamilyName);
objTask = MMCCtrl.GetNextTask(); }
var szCssText = "";
// 2. Loop through each unique EOT & FontFamilyName for (var i = 0; i < s_rgURLtoEOTUnique.length; i++) { szCssText += "@font-face {font-family:'" + s_rgFontFamilyNameUnique[i] + "';font-style:normal; font-weight:normal; src:url('" + s_rgURLtoEOTUnique[i] + "');}"; }
szCssText = "<style" +">" + szCssText + "</style" +">";
//alert(szCssText);
document.write(szCssText); }
// Prevent text from being selected and messing up the UI. function document.onselectstart() { event.returnValue = false; }
function AddEOT(szURLtoEOT, szFontFamilyName) { // 1. determine whether the URL is unique
// Get the length of the unique URL array var iLength = s_rgURLtoEOTUnique.length; var i = 0;
// Compare with each existing entry in the array if(iLength > 0) { for (i = 0; i < iLength; i++) { if (s_rgURLtoEOTUnique[i] == szURLtoEOT) { // Found a duplicate bUnique = false; return; } } }
// 2. If we reached here, the URL is unique. Add it to the array. s_rgURLtoEOTUnique[iLength] = szURLtoEOT; s_rgFontFamilyNameUnique[iLength] = szFontFamilyName; }
function GetTaskDisplayHTML(objTask, i) { var displayObject = objTask.DisplayObject;
// Build up the HTML for the button var szBtnHTML = ""; var displayObjectType = displayObject.DisplayObjectType;
switch (displayObjectType) { case CON_TASK_DISPLAY_TYPE_SYMBOL: // EOT-based symbol | font 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>"; break;
// there is NO difference between CON_TASK_DISPLAY_TYPE_VANILLA_GIF and CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF. The original intent was never implemented. case CON_TASK_DISPLAY_TYPE_VANILLA_GIF: // transparent case CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF: // transparent case CON_TASK_DISPLAY_TYPE_BITMAP: // non-transparent raster image
var szFilterCode = ""; var szMouseOverCode = "";
if( (displayObjectType == CON_TASK_DISPLAY_TYPE_VANILLA_GIF) || (displayObjectType == CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF) ) { szFilterCode = "FILTER: mask(color=" + SysColorX.HEXthreedshadow + "); "; }
if( (displayObject.MouseOverBitmap != "") && (displayObject.MouseOverBitmap != displayObject.MouseOffBitmap)) { szMouseOverCode = "onmouseover='Image"+i+".src=s_rgTasks["+i+"].DisplayObject.MouseOverBitmap;' "; szMouseOverCode += "onmouseout ='Image"+i+".src=s_rgTasks["+i+"].DisplayObject.MouseOffBitmap;' "; }
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>";
break; } return szBtnHTML;
}
/*+-------------------------------------------------------------------------* * * taskNotify * * PURPOSE: Calls MMCCtrl's tasknotify. Uses expando properties instead of * parameters as the event is hooked up using attachEvent. * * This is just a dummy function. We cannot do attachEvent with * parameters. So we use this dummy function to call real function * with those properties. * * RETURNS: * Nothing * *+-------------------------------------------------------------------------*/ function taskNotify() { var srcElement = window.event.srcElement;
MMCCtrl.TaskNotify(srcElement.param1, srcElement.param2, srcElement.param3); }
/*+-------------------------------------------------------------------------* * * PopulateTaskpad * * PURPOSE: Adds all tasks in the taskpad to the HTML. Also holds on to the * task objects using the array s_rgTasks. * * RETURNS: * Nothing * *+-------------------------------------------------------------------------*/ function PopulateTaskpad() { var objTask = MMCCtrl.GetFirstTask(szHash); var strTasksHTML = ""; var strTaskHTML = ""; var bIsLargeIconMode = true; var i = 0; var count = 0; var tempArray;
var IconSize = (bIsLargeIconMode) ? 32 : 16;
// Add the listpad title and button, if it exists var objListviewInfo = MMCCtrl.GetListPadInfo(szHash);
if (objListviewInfo) { // Set the parameters for button-click handler (see taskNotify). btnLV.param1 = objListviewInfo.Clsid; btnLV.param2 = objListviewInfo.NotifyID; btnLV.param3 = 0; btnLV.attachEvent("onclick", taskNotify);
ListViewTitle.innerText = objListviewInfo.Title + ""; if(objListviewInfo.HasButton) { btnLV.value = objListviewInfo.Text; } else { btnLV.style.display = "none"; } }
// add the watermark, if it exists
var objWatermark = MMCCtrl.GetBackground( szHash );
if (objWatermark != null) { // Keep track of the watermark display object type var watermarkObjectType = objWatermark.DisplayObjectType;
switch (watermarkObjectType) { case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL var szWatermarkColor = (screen.colorDepth <= 8) ? "color:threedlightshadow;" : "color:threedshadow;filter:alpha(opacity=15);";
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>"; TaskpadNameDIV.insertAdjacentHTML("afterEnd", szWatermark); break;
case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster // Note: No distinction made between GIF & Raster for the watermark var gszWatermarkImage = objWatermark.MouseOverBitmap; break; } }
// add the taskpad title TaskpadName.innerHTML = "<NOBR>"+MMCCtrl.GetTitle(szHash)+"</NOBR>"; TaskpadDescription.innerHTML = MMCCtrl.GetDescriptiveText(szHash) + "<BR />";
while (objTask != null) { s_rgTasks[i]= objTask; // this holds on to the task object.
strTaskHTML = "";
strTaskHTML += " <SPAN CLASS='cInline'>"; strTaskHTML += ""; strTaskHTML += " <TABLE BORDER='0' WIDTH='100%'>"; strTaskHTML += " <TR>"; strTaskHTML += " <TD>"; strTaskHTML += " <BR />"; strTaskHTML += " </TD>"; strTaskHTML += " </TR>"; strTaskHTML += " <TR>"; strTaskHTML += " <TD VALIGN='TOP' width='32'height='32' style='border: 0 black solid; overflow:hidden'>"; strTaskHTML += GetTaskDisplayHTML(objTask, i); strTaskHTML += " </TD>"; strTaskHTML += " <TD>"; strTaskHTML += " <SPAN CLASS='Task' id='TaskID' onmouseover=\"javascript:window.event.srcElement.className='TaskHover';\" onmouseout=\"javascript:window.event.srcElement.className='Task';\""; strTaskHTML += " onclick='javascript:Task"+i+"_Clicked();'"; strTaskHTML += " tabIndex=\"0\">"; strTaskHTML += " </SPAN>"; strTaskHTML += ""; strTaskHTML += " </TD>"; strTaskHTML += " </TR>"; strTaskHTML += " </TABLE>"; strTaskHTML += " </SPAN>";
szScripts += " function Task"+i+"_Clicked()"; szScripts += " {"; szScripts += " try"; szScripts += " {"; szScripts += " window.event.srcElement.className='Task';";
switch (objTask.ActionType) // 3 possibilities for action: "ID:", "LINK:" and "SCRIPT:" { case 0: // MMC_TASK_ACTION_ID szScripts += "MMCCtrl.TaskNotify(s_rgTasks["+i+"].Clsid,s_rgTasks["+i+"].CommandID,0);"; break;
case 1: // MMC_TASK_ACTION_LINK szScripts += "window.navigate(s_rgTasks["+i+"].ActionURL);"; break;
case 2: // MMC_TASK_ACTION_SCRIPT // Convert script language string to upper case var szLanguage = objTask.ScriptLanguage.toUpperCase();
switch (szLanguage) { case "JSCRIPT": case "JAVASCRIPT": // Pass a script string to the JSObject to be evaluated and executed // through the eval method (this can be a semi-colon delimited complex expression) szScripts += "eval (s_rgTasks["+i+"].Script);"; break;
case "VBSCRIPT": case "VBS": // Use the window.execScript method to execute a simple or complex VBScript expression szScripts += "window.execScript (s_rgTasks["+i+"].Script, '"+szLanguage+"');"; break;
default: var L_UnknownScriptingLanguage_ErrorMessage = "Unrecognized scripting language."; alert (L_UnknownScriptingLanguage_ErrorMessage); break; } break; break; }
szScripts += " "; szScripts += " } catch(e)"; szScripts += " {"; szScripts += " window.alert(e.description);"; szScripts += " }"; szScripts += " }";
strTasksHTML += strTaskHTML;
objTask = MMCCtrl.GetNextTask(); ++i; }
count = i; // the total number of tasks
Tasks.innerHTML = strTasksHTML; // add the tasks to the HTML
tempArray= document.all.item("TaskID"); //get the collection of all tasks on the page.
if(count==1) { // in this case tempArray is not an array at all, but a single object per the DHTML object model tempArray.title =s_rgTasks[0].Help; // set the tooltip tempArray.innerText =s_rgTasks[0].Text; // set the title eval("Image0.title=s_rgTasks[0].Help;"); // set the tooltip for the image } else { if(tempArray.length != count) // sanity check { alert("Error!"); }
// set up the tasks - we do this here rather than expanding the variables in the strings above to // prevent Escaping problems. Eg \ would need to be converted to \\ otherwise. for(i=0; i<count; i++) { tempArray(i).title =s_rgTasks[i].Help; // set the tooltip tempArray(i).innerText =s_rgTasks[i].Text; // set the title
eval("Image"+i+".title=s_rgTasks["+i+"].Help;"); // set the tooltip for the image
} }
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. TaskpadNameDIV.insertAdjacentHTML("afterBegin", szScripts); }
function OnLoad() { document.vlinkColor = document.linkColor; // make sure that visited links don't look different
PopulateTaskpad();
} </script>
</head>
<body id="body" scroll='no' onload='OnLoad()' tabIndex='-1'> <DIV id="TaskpadNameDIV" style="position:absolute; top:0; left:0"> <TABLE WIDTH="100%" cellspacing="0" cellpadding="0" COLS="2"> <TR> <TD><SPAN style="width:32px"></SPAN></TD> <TD id="TaskpadName"><NOBR></NOBR></TD> </TR> </TABLE> </DIV> <TABLE WIDTH="100%" HEIGHT="100%" cellspacing="0" cellpadding="0"> <TR id="TitleRow" WIDTH="100%" VALIGN="TOP"> <TD id="LeftPanel" WIDTH="100%"> <object id='FolderIcon' classid="clsid:B0395DA5-6A15-4E44-9F36-9A9DC7A2F341" tabIndex='-1'> <!-- do not display the notch for horizontal taskpads--> <PARAM NAME="Notch" VALUE="0"></PARAM> </object> </TD> </TR> <tr ID="DescriptionRow"> <td id='TaskpadDescription' ><BR /></td> </tr> <tr> <TD style="background-color:buttonface"> <TABLE style="width:100%"> <TR> <TD width="100%"><DIV id="ListViewTitle"></DIV> </TD> <TD> <INPUT type="button" id="btnLV" style="font:menu"/> </TD> </TR> </TABLE> </TD> </tr> <tr id="TopPanelRow" style="height:100%;"> <td id='TopPanel' style="padding:0; border:solid windowtext 1;" > <DIV id ="MMCViewElement" style="position:relative; height:100%; width:100%; left:0%;" > <object id="ListView" style="overflow:auto; width:100%; height:100%" classid="clsid:289228DE-A31E-11D1-A19C-0000F875B132"></object> </DIV> </td> </tr> <TR valign="top"> <TD ID="BottomPanel" VALIGN="TOP"> <DIV id="Tasks" STYLE="overflow-y:auto; overflow-x:none; height:150px;"></DIV> </TD> </TR> </TABLE> </body>
</HTML>
|