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.
 
 
 
 
 
 

1136 lines
36 KiB

<HTML XMLNS:helpcenter>
<HEAD>
<!--
Copyright (c) 2000 Microsoft Corporation
-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=windows-1252">
<META HTTP-EQUIV=PICS-Label CONTENT='(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l comment "RSACi North America Server" by "[email protected]" r (n 0 s 0 v 0 l 0))'>
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
<OBJECT ID=pchealth classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7></OBJECT>
<LINK ID=Stylesheet_Ref1 href="hcp://system/css/Behaviors.css" rel=STYLESHEET type=text/css>
<LINK ID=Stylesheet_Ref2 href="hcp://system/css/shared.css" rel=STYLESHEET type=text/css>
<STYLE>
.Search-Headline
{
height : 2em;
padding-left : 11px;
padding-right : 11px;
}
.Search-StopButton
{
padding : 2pt;
cursor : hand;
text-overflow : ellipsis;
width : 100%;
}
.Search-ProviderPane
{
border-style : solid;
border-left-width : 1px;
border-right-width : 1px;
border-top-width : 1px;
border-bottom-width : 1px;
border-top-color : threedhighlight;
border-left-color : threedhighlight;
border-bottom-color : threedshadow;
border-right-color : threedshadow;
background-color : threedface;
padding-left : 11px;
padding-top : 5px;
padding-bottom : 5px;
cursor : hand;
}
.Search-ResultCell
{
background-color : window;
height : 100%;
width : 100%;
border-top-width : 0px;
border-left-width : 1px;
border-right-width : 1px;
border-bottom-width : 1px;
border-style : solid;
border-color : threedshadow;
}
.Search-ResultDisplay
{
width : 100%;
height : 100%;
overflow : auto;
}
.Search-ResultFrameCell
{
height : 100%;
padding-left : 11px;
padding-right : 11px;
}
.Search-SearchStatusCell
{
width : 100%;
padding-left : 11px;
padding-top : 11px;
padding-bottom : 11px;
}
.Search-OuterTableAll
{
border-top-width : 1px;
border-left-width : 1px;
border-right-width : 1px;
border-bottom-width : 1px;
border-style : solid;
}
.Search-OuterTableLeft
{
border-top-width : 0px;
border-left-width : 1px;
border-right-width : 0px;
border-bottom-width : 0px;
border-style : solid;
}
.Search-OuterTableRight
{
border-top-width : 0px;
border-left-width : 0px;
border-right-width : 1px;
border-bottom-width : 0px;
border-style : solid;
}
.Search-OuterTableLeftRight
{
border-top-width : 0px;
border-left-width : 1px;
border-right-width : 1px;
border-bottom-width : 0px;
border-style : solid;
}
.Search-OuterTableLeftRightBottom
{
border-top-width : 0px;
border-left-width : 1px;
border-right-width : 1px;
border-bottom-width : 1px;
border-style : solid;
}
.Search-ProvListBoxCell
{
border-top-width : 0px;
border-left-width : 1px;
border-right-width : 1px;
border-bottom-width : 0px;
border-style : solid;
}
</STYLE>
</HEAD>
<BODY SCROLL=NO class='sys-lhp-bgcolor'>
<DIV id=idResultsPane WIDTH=100% HEIGHT=100%>
<TABLE class='sys-font-body' cellspacing=0 cellpadding=0 WIDTH=100% HEIGHT=100% style='table-layout:fixed;'>
<TR>
<TD colspan=2>
<DIV id=noloc1 class='sys-color-body' style='width: 100%; text-overflow: ellipsis; overflow-x: hidden;height:1em;padding-top:11px;padding-left:7px;'>
<DIV id=locPreviousResults title="Specifies whether to search only the content included in the results of your most recent search." NOWRAP>
<INPUT id=idSearchWithinResults TYPE=checkbox title="Search within previous results"> Search within previous results
</DIV>
</DIV>
</TD>
</TR>
<TR>
<TD id=noloc2 colspan=2 style='height:11px;'> </TD>
</TR>
<TR height=100%>
<TD id=noloc3 colspan=2 style='padding-left : 11px; padding-right : 11px;'>
<TABLE id="ResultTable" onresize="SwitchProvDisplay()" class='sys-font-body' WIDTH=100% HEIGHT=100% cellspacing=0 cellpadding=0 style='table-layout:fixed;'>
<TR>
<TD class='sys-toppane-color-border Search-OuterTableAll' colspan=3>
<TABLE cellspacing=0 cellpadding=0 border=0 class='sys-font-body-bold sys-toppane-header-color sys-toppane-header-bgcolor Search-Headline' >
<TR>
<TD id='SearchResultsCell' WIDTH=100% id=locTitle>
<DIV id=noloc4 style='width: 100%; text-overflow: ellipsis; overflow: hidden;'>
<DIV NOWRAP id=locSearchResults>Search Results</DIV>
</DIV>
</TD>
<TD NOWRAP>
<DIV id=locTips><a class="sys-link-header" target='HelpCtrContents' href='hcp://system/blurbs/searchtips.htm'>Tips</a></DIV>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD colspan=2 class='Search-SearchStatusCell sys-toppane-bgcolor sys-toppane-color-border Search-OuterTableLeft'>
<DIV id=noloc5 style='width: 100%; text-overflow: ellipsis; overflow: hidden;'>
<DIV NOWRAP class='sys-font-body sys-color-body' id='idSearchStatus'></DIV>
</DIV>
</TD>
<TD align='right' class='sys-toppane-bgcolor sys-toppane-color-border Search-OuterTableRight' style='padding:11px;' id=noloc6>
<BUTTON id=idStopSearch class="Search-StopButton sys-font-body" accesskey="t" disabled="true" onClick="UserAbort();">S<U>t</U>op</BUTTON>
</TD>
</TR>
<TR>
<TD class='sys-toppane-color-border Search-ResultFrameCell sys-toppane-bgcolor Search-OuterTableLeftRight' colspan=3>
<DIV id=idResultSet class="sys-toppane-bgcolor"></DIV>
</TD>
</TR>
<TR>
<TD id=noloc7 colspan=3 class='sys-toppane-bgcolor sys-toppane-color-border Search-OuterTableLeftRightBottom' style='height:11px;'> </TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD id=noloc8 colspan=2 style='height:11px;'> </TD>
</TR>
</TABLE>
</DIV>
</BODY>
<SCRIPT id=Script_Ref0 SRC="hcp://system/scripts/wrapperparam.js"></SCRIPT>
<SCRIPT>
//
// localizable variables/filenames
//
var L_SearchAborted_Text = 'Search was stopped.';
var L_ResultsFound_Text = 'results found for';
var L_ReturnZeroResults_Text = " returned 0 results for ";
var L_QuickHints_Text = "Quick hints:<BR><BR><UL style='margin-left:15px;'><LI style='list-style-position:outside'>Check your spelling.</LI><BR><LI style='list-style-position:outside'>Try using a different word, like 'Web' instead of 'Internet'.</LI><BR><LI style='list-style-position:outside'>Make your search more general, or consult the search <a target='HelpCtrContents' href='hcp://system/blurbs/searchtips.htm'>Tips</a>.</LI></UL>";
var L_Matches_Text = 'no matches';
var L_Result1_Text = " (";
var L_Result2_Text = " results)";
var L_EnableWrapperError_Text = 'You must have at least one search provider selected in order to search Help and Support Center.\nPlease go to the Search Options page, and then select a search provider or engine.';
var L_ServiceUnavailable_Text = 'Help and Support Search cannot continue because the Help Service is temporarily not working.\nPlease restart Help and Support Center to try again.';
var L_YourSearchResults_Text = 'Your search results for';
var L_NoLongerAvailable_Text = 'is no longer available. Please perform the query again.';
var L_HelpInformation_Text = "Help and Information";
var L_CommonQuestions_Text = "Common Questions";
var L_Troubleshooting_Text = "Troubleshooting";
var L_TechnicalArticles_Text = "Technical Articles";
var L_Tutorials_Text = "Tutorials";
var L_Helpfiles_Text = "Helpfiles";
var L_FixProblem_Text = "Fix a Problem";
var L_PickTask_Text = "Pick a task";
var L_Overviews_Text = "Overviews, Articles and Tutorials";
var L_References_Text = "References";
var L_NotConnected_Text = "To access content from this search provider, you must be connected to the Internet.<BR><BR><A HREF=\"javascript:ShowLearnMore('hcp://system/updatectr/learninternet.htm')\">Tell me more about connecting to the Internet</A>.";
// Other variables
var g_ContentTypes = [];
g_ContentTypes[1] = L_HelpInformation_Text;
g_ContentTypes[2] = L_CommonQuestions_Text;
g_ContentTypes[3] = L_Troubleshooting_Text;
g_ContentTypes[4] = L_TechnicalArticles_Text;
g_ContentTypes[5] = L_Tutorials_Text;
g_ContentTypes[6] = L_Helpfiles_Text;
g_ContentTypes[7] = L_FixProblem_Text;
g_ContentTypes[8] = L_PickTask_Text;
g_ContentTypes[9] = L_Overviews_Text;
g_ContentTypes[10] = L_References_Text;
var g_NAVBAR = pchealth.UI_NavBar.content.parentWindow;
var g_oLearnDlg = null;
var g_oEnumEngine = null;
var g_semgr = null;
var g_Timer_Timeout = null;
var g_Timer_Print = null;
var SEARCH_TIMEOUT = 30000; // 30 second timeout
var g_bSearchInProgress = false;
var g_lTotalNumResults = 0;
var g_aEngID;
var g_aEngName;
var g_aDescription;
var g_iEngCount;
var g_WrapperSelected = "";
var g_idWrapperDisplay = "";
var g_NewResults = false;
var g_bResultClick = false;
var g_bResultTravel = false;
var g_strResultClickID = "";
var g_bFrameCreated = false;
var g_SearchTerms = null;
var g_aBullet = null;
var g_aResultEnum = null;
var g_aWrapperState = null;
var g_aContentType = null;
var g_aWrapperList = null;
var g_bPrinting = false;
var PRINT_DELAY = 10; // 10 millisecond delay per call
var WRAPPER_STATE_QUERYING = 0;
var WRAPPER_STATE_PRINTING = 1;
var WRAPPER_STATE_DONE = 2;
var WRAPPER_NUM_RESULT_PRINT = 2;
var REGKEY_WRAPPER_DISPLAY = "HKLM\\SOFTWARE\\Microsoft\\PCHealth\\HelpSvc\\WrapperDisplay";
// Get the default wrapper to display
try
{
var g_idWrapperDisplay = pchealth.RegRead( REGKEY_WRAPPER_DISPLAY );
if (!g_idWrapperDisplay)
{
if (pchealth.UserSettings.IsDesktopVersion)
g_idWrapperDisplay = g_NAVBAR.ID_KEYWORD;
else
g_idWrapperDisplay = g_NAVBAR.ID_FTS;
}
}
catch (e)
{
g_idWrapperDisplay = "";
}
function OpenConnWizard()
{
try
{
var sShellCmd_NCW = "rundll32 netshell.dll,StartNCW 0";
g_oWShell.Run( sShellCmd_NCW );
}
catch( e ){}
}
function ShowLearnMore( sTopicURL )
{
if ((!sTopicURL) || (sTopicURL == ""))
return;
g_oLearnDlg = window.showModelessDialog( sTopicURL, window, "help:no;status:no;resizable:no;dialogWidth:385px;dialogHeight:440px" );
// pchealth.UI_Contents.content.Navigate( sTopicURL, null, null, null, null );
}
function GenerateResultFrame()
{
var resultHTML = "<TABLE class='sys-font-body' cellspacing=0 cellpadding=0 border=0 WIDTH=100% HEIGHT=100% style='table-layout:fixed'>";
var iIndex;
var oWrapper = null;
var strListBoxDisplay;
var strProviderDisplay;
if (g_bFrameCreated)
return;
g_bFrameCreated = true;
// delete the arrays and create new ones
g_aEngID = new Array();
g_aEngName = new Array();
g_aDescription = new Array();
g_iEngCount = 0;
// Initialize search eng and get data
for(var oEnumEngine = new Enumerator(g_oEnumEngine); !oEnumEngine.atEnd(); oEnumEngine.moveNext())
{
var oSearchEng = oEnumEngine.item();
// Display the search engine only if it has been enabled
if (oSearchEng.Enabled)
{
g_aEngID [g_iEngCount] = oSearchEng.ID;
g_aEngName[g_iEngCount] = oSearchEng.Name;
g_aDescription[g_iEngCount] = oSearchEng.Description;
g_iEngCount++;
}
}
if (IsResultSpaceEnough())
{
strListBoxDisplay = " style='display:none' ";
strProviderDisplay = "";
}
else
{
strListBoxDisplay = "";
strProviderDisplay = " style='display:none' ";
}
// Create a drop down list box
resultHTML += "<TR id='ProvListBox' " + strListBoxDisplay + "><TD class='sys-font-body sys-color-body Search-ProvListBoxCell sys-toppane-color-border' style='background-color:threedface' TABINDEX=0 style='cursor:hand;' WIDTH=100%>";
resultHTML += "<SELECT style='width:100%;' class='sys-font-body sys-color-body sys-toppane-bgcolor' ID='ProviderList' SIZE=1 onchange='ProviderListChange();'>";
for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
resultHTML += '<OPTION WIDTH=100% VALUE="' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '">' + pchealth.TextHelpers.HTMLEscape(g_aEngName[iIndex]);
}
resultHTML += "</SELECT></TD></TR>";
// Create a row for each wrapper
for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
// Check to see if there is a result number for the wrapper
var strNumResults = g_NAVBAR.GetWrapperVar("g_numResult" + g_aEngID[iIndex]);
resultHTML += '<TR id="ProvCell' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '"' + strProviderDisplay + '><TD class="sys-font-body sys-color-body Search-ProviderPane" TITLE="' + pchealth.TextHelpers.HTMLEscape( g_aDescription[iIndex] ) + '" onClick=\'WrapperClick("' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '");\' onkeydown=\'WrapperKeyDown("' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '")\' TABINDEX=0 style="cursor:hand;" id="div' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '" WIDTH=100%><DIV style="width: 100%; text-overflow: ellipsis; overflow: hidden;"><DIV NOWRAP>' + pchealth.TextHelpers.HTMLEscape(g_aEngName[iIndex]) + '</DIV></DIV></TD></TR>';
// if it is the last one, display the result cell
resultHTML += '<TR id="idResultCell' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '"';
if (iIndex == g_iEngCount - 1)
{
g_WrapperSelected = g_aEngID[iIndex];
}
else
{
resultHTML += " style='display:none;'";
}
resultHTML += '><TD class="sys-font-body Search-ResultCell"><DIV class="Search-ResultDisplay" id="idResultDIV' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '"></DIV></TD></TR>';
}
// Insert the HTML
idResultSet.innerHTML = resultHTML + "</TABLE>";
}
function ProviderListChange()
{
var oOptions = event.srcElement.options(event.srcElement.selectedIndex);
WrapperClick(oOptions.value);
}
function IsResultSpaceEnough()
{
// Compute the total height occupied by the provider cells
// Use the search result cell because other cells may not be avail and it is about the same height
var iResultDisplay = 50;
var iNumProviders = g_iEngCount + 4; // there are about 4 spaces roughly equal to each provider space
return (ResultTable.offsetHeight > ((SearchResultsCell.offsetHeight * iNumProviders) + iResultDisplay));
}
function SwitchProvDisplay()
{
if (IsResultSpaceEnough())
{
// Enough space, use provider cells instead
// Hide the drop down list
oProvListBox = idResultSet.all.item("ProvListBox");
if (oProvListBox)
oProvListBox.style.display = "none";
// Show the provider cells
for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
var oProvDiv = idResultSet.all.item("ProvCell" + g_aEngID[iIndex]);
if (oProvDiv)
oProvDiv.style.display = "inline";
}
}
else
{
// Not enough space, so use drop down list instead
// Show the drop down list
var oProvListBox = idResultSet.all.item("ProvListBox");
if (oProvListBox)
oProvListBox.style.display = "inline";
// Hide the provider cells
for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
var oProvDiv = idResultSet.all.item("ProvCell" + g_aEngID[iIndex]);
if (oProvDiv)
oProvDiv.style.display = "none";
}
}
}
////////////////////
function SetTimer_Print()
{
g_Timer_Print = window.setTimeout( GenerateResultItem, PRINT_DELAY );
}
function ClearTimer_Print()
{
if(g_Timer_Print)
{
window.clearTimeout( g_Timer_Print ); g_Timer_Print = null;
}
}
function GenerateResult(oWrapper)
{
try
{
g_aBullet [oWrapper.ID] = oWrapper.GetParam("UI_BULLET");
}
catch(e)
{ ; }
if (g_aBullet[oWrapper.ID])
idResultSet.all.item("idResultDIV" + oWrapper.ID).innerHTML = '<DIV class="sys-rhp-bgcolor" style="height:100%;width:100%;"><UL class="sys-color-body" style="margin-left:25px;" id="list' + pchealth.TextHelpers.HTMLEscape( oWrapper.ID ) + '"></UL>';
else
idResultSet.all.item("idResultDIV" + oWrapper.ID).innerHTML = '<DIV class="sys-rhp-bgcolor" style="height:100%;width:100%;"><OL class="sys-color-body" id="list' + pchealth.TextHelpers.HTMLEscape( oWrapper.ID ) + '"></OL>';
// Get the UI instructions for Button display from the wrapper
try
{
g_aResultEnum [oWrapper.ID] = new Enumerator( oWrapper.Result(0, g_semgr.NumResult) );
g_aContentType [oWrapper.ID] = -1;
g_aWrapperState [oWrapper.ID] = WRAPPER_STATE_PRINTING;
g_aWrapperList [oWrapper.ID] = idResultSet.all.item("list" + oWrapper.ID);
}
catch(e)
{ ; }
GenerateResultItem();
}
function GenerateResultItem()
{
var bContinuePrinting = false;
// If already printing, return
if(g_bPrinting) return;
ClearTimer_Print();
g_bPrinting = true;
// loop through all the wrappers
for(var iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
var wrapperID = g_aEngID[iIndex];
var wrapper = g_aWrapperList[wrapperID];
var result = g_aResultEnum[wrapperID];
// Print out results
for(var iResult = 0; iResult < WRAPPER_NUM_RESULT_PRINT; iResult++)
{
// Check if wrapper is ready to print results
if (g_aWrapperState[wrapperID] == WRAPPER_STATE_PRINTING)
{
bContinuePrinting = true;
// Get the result
var oResult = result.item();
// If error, display error string
if (oResult.ContentType < 0)
{
// Create an error element
var oNewNode = document.createElement("DIV");
oNewNode.style.paddingTop = "15px";
if (oResult.ContentType == -2)
{
oNewNode.innerHTML = "<TABLE><TR><TD VALIGN='top'><IMG SRC='hcp://system/images/16x16/warning.gif'></TD><TD><DIV class='sys-font-body sys-link-normal'>" + L_NotConnected_Text + "</DIV></TD></TR></TABLE>";
}
else
{
oNewNode.innerHTML = pchealth.TextHelpers.HTMLEscape(oResult.Description);
}
wrapper.style.marginLeft = "15px";
wrapper.appendChild(oNewNode);
}
else
{
// Associate title and URL
pchealth.HelpSession.SetTitle(oResult.URI, oResult.Title);
// Add the content type
var iContentType = oResult.ContentType;
if ((iContentType == 0) && (g_aContentType[wrapperID] == -1))
{
// Add a line space
var oContentSpace = document.createElement("DIV");
oContentSpace.className = "sys-font-body-bold";
oContentSpace.innerHTML = "&nbsp;";
wrapper.appendChild(oContentSpace);
// Change the content type stored
g_aContentType[wrapperID] = 1;
}
if ((iContentType != 0) && (iContentType != g_aContentType[wrapperID]))
{
var strCT = g_ContentTypes[iContentType]; if(!strCT) strCT = " ";
// Add a line space
var oContentSpace = document.createElement("DIV");
oContentSpace.className = "sys-font-body-bold sys-color-body";
oContentSpace.innerHTML = "&nbsp;";
wrapper.appendChild(oContentSpace);
// Add the content type
var oContentNode = document.createElement("DIV");
oContentNode.className = "sys-font-body-bold sys-color-body";
oContentNode.innerText = strCT;
wrapper.appendChild(oContentNode);
// Save the displayed content type so that it doesn't appear again
g_aContentType[wrapperID] = iContentType;
}
// Create the element
var oNewNode = document.createElement("LI");
oNewNode.style.lineHeight = "1.5em";
// Place the rank
if ((oResult.Rank > 0) && (oResult.Rank <= 1))
{
var dRank = Math.ceil(oResult.Rank * 100);
var oInnerDIV = document.createElement("DIV");
oInnerDIV.style.color = "gray";
oInnerDIV.className = "sys-font-body";
oInnerDIV.innerText = "(" + dRank + "%)";
oNewNode.appendChild(oInnerDIV);
}
// Place the title, URL, tooltip
var oInnerDIV = document.createElement("DIV");
oInnerDIV.className = "sys-font-body";
var oInnerLink = document.createElement("A");
oInnerLink.onclick = ResultClick;
oInnerLink.className = "sys-link-normal";
oInnerLink.wrapperID = wrapperID;
oInnerLink.tabIndex = 0;
oInnerLink.target = "HelpCtrContents";
oInnerLink.href = oResult.URI;
if(oResult.Description != "") oInnerLink.title = oResult.Description;
// Place the location
if ((oResult.Location != "") && (!pchealth.UserSettings.IsDesktopVersion))
oInnerLink.innerText = oResult.Title + " : " + oResult.Location;
else
oInnerLink.innerText = oResult.Title;
oNewNode.appendChild(oInnerLink);
wrapper.appendChild(oNewNode);
}
// Advance to the next result
result.moveNext();
// Check if all results have been printed
if(result.atEnd())
{
g_aWrapperState[wrapperID] = WRAPPER_STATE_DONE;
continue;
}
}
}
}
g_bPrinting = false;
if(bContinuePrinting) SetTimer_Print();
}
function WrapperKeyDown(strID)
{
// Check if it is the space or return key being pressed
if ((event.keyCode == 13) || (event.keyCode == 32))
WrapperClick(strID);
}
function WrapperClick(strID)
{
if (g_WrapperSelected == strID)
return;
var strPrevWrapper = g_WrapperSelected;
g_WrapperSelected = strID;
// Turn results on
if (g_WrapperSelected != "")
idResultSet.all.item("idResultCell" + g_WrapperSelected).style.display = "";
// Turn results off
if (strPrevWrapper != "")
idResultSet.all.item("idResultCell" + strPrevWrapper).style.display = "none";
// Make sure that the list box selection is sync'ed
var oProvList = idResultSet.all.item("ProviderList");
for(var iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
if (g_aEngID[iIndex] == strID)
{
oProvList.selectedIndex = iIndex;
break;
}
}
}
function InitializeGlobals()
{
// Get the search engine if null
if(g_semgr == null)
{
g_semgr = g_NAVBAR.GetSearchEngineManager();
// Check if it has been initialized
if(g_NAVBAR.GetWrapperVar("SEMgrInit") != "true")
{
LoadWrapperParams( g_semgr );
g_NAVBAR.SetWrapperVar("SEMgrInit", "true");
}
g_oEnumEngine = g_semgr.EnumEngine();
}
}
////////////////////
function SetTimer_Timeout()
{
g_Timer_Timeout = window.setTimeout( AbortFromTimeout, SEARCH_TIMEOUT );
}
function ClearTimer_Timeout()
{
if(g_Timer_Timeout)
{
window.clearTimeout( g_Timer_Timeout ); g_Timer_Timeout = null;
}
}
function UserAbort()
{
AbortQuery();
SetSearchStatus( L_SearchAborted_Text, L_SearchAborted_Text, true );
}
function AbortQuery()
{
ClearTimer_Timeout();
ClearTimer_Print ();
idResultsPane.style.cursor = "default";
idStopSearch.disabled = true;
g_bSearchInProgress = false;
if(g_semgr)
{
g_semgr.onWrapperComplete = SENull;
g_semgr.onComplete = SENull;
g_semgr.AbortQuery();
}
}
////////////////////
function UpdateSearchStatus()
{
if(g_NAVBAR.GetWrapperVar("SearchStatus"))
{
idSearchStatus.innerHTML = g_NAVBAR.GetWrapperVar("SearchStatus");
idSearchStatus.title = g_NAVBAR.GetWrapperVar("SearchStatus_Tooltip");
}
else
{
idSearchStatus.innerHTML = L_Matches_Text;
idSearchStatus.title = L_Matches_Text;
}
}
function SetSearchStatus( text, title, now )
{
if(now)
{
idSearchStatus.innerHTML = text;
idSearchStatus.title = title;
}
else
{
g_NAVBAR.SetWrapperVar( "SearchStatus" , text );
g_NAVBAR.SetWrapperVar( "SearchStatus_Tooltip", title );
}
}
function SEWrapperComplete( oWrapper )
{
// Get the actual total number of results
var iTotalResult = oWrapper.Result(0, g_semgr.NumResult).Count;
// Check if the wrapper has returned an error
var oEnumResult = new Enumerator( oWrapper.Result(0, 1) );
var oResult = oEnumResult.item();
var bErrorResult = false;
// Check if error on the first item
try
{
if (oResult.ContentType < 0)
{
iTotalResult -= 1;
bErrorResult = true;
}
}
catch(e)
{ ; }
// Save the number of results for this wrapper
g_NAVBAR.SetWrapperVar("g_numResult" + oWrapper.ID, iTotalResult.toString());
// tally number of results
g_lTotalNumResults += iTotalResult;
SetSearchStatus( g_lTotalNumResults + " " + L_ResultsFound_Text + " <B>" + pchealth.TextHelpers.HTMLEscape(g_semgr.QueryString) + "</B>" ,
g_lTotalNumResults + " " + L_ResultsFound_Text + " \'" + pchealth.TextHelpers.HTMLEscape(g_semgr.QueryString) + "\'" , false );
// Print out the number of results for the wrapper in the tab
var item = idResultSet.all.item("div" + oWrapper.ID);
var resTxt = pchealth.TextHelpers.HTMLEscape(oWrapper.Name) + L_Result1_Text + pchealth.TextHelpers.HTMLEscape( iTotalResult ) + L_Result2_Text;
item.title = resTxt + "\n\n" + oWrapper.Description;
item.innerHTML = "<DIV style='width: 100%; text-overflow: ellipsis; overflow: hidden;'><DIV NOWRAP>" + resTxt + "</DIV></DIV>";
if (iTotalResult || bErrorResult)
GenerateResult(oWrapper);
else
idResultSet.all.item("idResultDIV" + oWrapper.ID).innerHTML = "<DIV style='padding:11px'>" + pchealth.TextHelpers.HTMLEscape(oWrapper.Name) + L_ReturnZeroResults_Text + "<B>" + pchealth.TextHelpers.HTMLEscape(g_semgr.QueryString) + "</B>.<BR><BR><BR>" + L_QuickHints_Text + "</DIV>";
// Check to see if there is a wrapper to display first
if (g_idWrapperDisplay == "")
{
// Display the one that came back first
if ((g_WrapperSelected == "") && (iTotalResult > 0))
{
WrapperClick(oWrapper.ID);
}
}
else
{
// if g_idWrapperDisplay is set to Keyword, then we know it is a desktop sku
if (g_idWrapperDisplay == g_NAVBAR.ID_KEYWORD)
{
// Check if keyword is Enabled
if (FindWrapper(g_NAVBAR.ID_KEYWORD).Enabled)
{
// if it is keyword and num results is zero, display FTS wrapper
if (oWrapper.ID == g_NAVBAR.ID_KEYWORD)
{
if (iTotalResult == 0)
WrapperClick(g_NAVBAR.ID_FTS);
else
WrapperClick(g_NAVBAR.ID_KEYWORD);
}
}
else if (iTotalResult > 0)
WrapperClick(oWrapper.ID);
}
else if ((g_idWrapperDisplay == oWrapper.ID) && (iTotalResult > 0))
{
WrapperClick(oWrapper.ID);
}
}
// Display status only if search has ended
if(!g_bSearchInProgress) UpdateSearchStatus();
GenerateResultItem();
}
function SEMgrComplete(lSucceeded)
{
ClearTimer_Timeout();
g_bSearchInProgress = false;
// Set the cursor
idResultsPane.style.cursor = "default";
// Disable abort key
idStopSearch.disabled = true;
UpdateSearchStatus();
GenerateResultItem();
}
function SENull()
{
}
function AbortFromTimeout()
{
AbortQuery();
SEMgrComplete(0);
}
function ExecuteQuery( strQuery )
{
var bEnableSearch = false;
// Init print arrays
g_aBullet = new Array();
g_aResultEnum = new Array();
g_aWrapperState = new Array();
g_aContentType = new Array();
g_aWrapperList = new Array();
// Init global vars
g_bFrameCreated = false;
g_NewResults = true;
g_bSearchInProgress = true;
g_WrapperSelected = "";
idResultsPane.style.cursor = "wait";
g_lTotalNumResults = 0;
// Create the query
if (idSearchWithinResults.checked)
{
if (g_NAVBAR.GetWrapperVar("HCPrevQuery") == strQuery)
g_semgr.QueryString = strQuery;
else
if (g_NAVBAR.GetWrapperVar("HCPrevQuery") != "")
g_semgr.QueryString = "(" + g_NAVBAR.GetWrapperVar("HCPrevQuery") + ") and " + strQuery;
else
g_semgr.QueryString = strQuery;
}
else
g_semgr.QueryString = strQuery;
// Save query
g_NAVBAR.SetWrapperVar("HCPrevQuery", g_semgr.QueryString);
// Check if at least one wrapper is enabled
var iSWCount = 0;
for(var oEnumEngine = new Enumerator(g_oEnumEngine); !oEnumEngine.atEnd(); oEnumEngine.moveNext())
{
var oSearchEng = oEnumEngine.item();
// Check whether enabled
if(oSearchEng.Enabled) bEnableSearch = true;
// reset the number of results
g_NAVBAR.SetWrapperVar("g_numResult" + oSearchEng.ID, "");
// set the subsite info
oSearchEng.AddParam("SUBSITE", g_NAVBAR.GetWrapperVar("SUBSITE"));
// set the state of the wrapper
g_aWrapperState[oSearchEng.ID] = WRAPPER_STATE_QUERYING;
// set the query and current query
oSearchEng.AddParam("SubQuery", idSearchWithinResults.checked);
oSearchEng.AddParam("CurrentQuery", strQuery);
iSWCount++;
}
// Generate the tabs
GenerateResultFrame();
// Execute the query
if (bEnableSearch)
{
// set the search status string
SetSearchStatus( "<img src='hcp://system/images/progbar.gif'>", "", true );
idStopSearch.disabled = false;
idStopSearch.focus();
ClearTimer_Timeout();
ClearTimer_Print ();
try
{
// Execute the search
g_semgr.onWrapperComplete = SEWrapperComplete;
g_semgr.onComplete = SEMgrComplete;
g_semgr.ExecuteAsynchQuery();
// create new timer for new query
SetTimer_Timeout();
}
catch(e)
{
// abort, try again
AbortQuery();
}
}
else
{
SetSearchStatus( "", "", true );
pchealth.MessageBox( iSWCount ? L_EnableWrapperError_Text : L_ServiceUnavailable_Text, "OK" );
idResultsPane.style.cursor = "default";
g_bSearchInProgress = false;
}
}
function search_ContextSwitch()
{
var ctx = pchealth.HelpSession.CurrentContext;
if(ctx.ContextName == "SEARCH")
{
// Check if a search is already in progress.
if(g_bSearchInProgress) return;
// Check if the previous context is not search
var ctxPrev = event.srcElement.data.PreviousContext;
if(!ctxPrev || ctxPrev.ContextName != "SEARCH")
{
idSearchWithinResults.checked = false;
}
InitializeGlobals();
if(ctx.ContextInfo) ExecuteQuery( ctx.ContextInfo );
}
}
function ResultClick()
{
g_bResultClick = true;
g_bResultTravel = true;
g_strResultClickID = this.wrapperID;
}
function search_PersistSave()
{
// Check if a search is already in progress.
if(g_bSearchInProgress) return;
if(g_NewResults)
{
// Save the last query
idState.stateProperty("HCPrevQuery") = g_NAVBAR.GetWrapperVar("HCPrevQuery");
// Save the html of results
g_NAVBAR.SetWrapperVar("ResultDisplay", idResultSet.innerHTML);
g_NewResults = false;
}
}
function search_PersistLoad()
{
// Check if a search is already in progress.
if(g_bSearchInProgress) return;
if (g_bResultClick)
{
// Save the last query
idState.stateProperty("HCPrevQuery") = g_NAVBAR.GetWrapperVar("HCPrevQuery");
g_bResultClick = false;
return;
}
// Check if there is anything to display
if(!idState.stateProperty("HCPrevQuery") || idState.stateProperty("HCPrevQuery") == "")
{
InitializeGlobals();
GenerateResultFrame();
return;
}
// Recreate the display
if (idState.stateProperty("HCPrevQuery") == g_NAVBAR.GetWrapperVar("HCPrevQuery"))
{
idResultSet.innerHTML = g_NAVBAR.GetWrapperVar("ResultDisplay");
UpdateSearchStatus();
}
else
{
InitializeGlobals();
GenerateResultFrame();
SetSearchStatus( "", "", true );
// Put unavailable message
for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
{
idResultSet.all.item("idResultDIV" + g_aEngID[iIndex]).innerHTML = "<DIV style='padding:11px'>" + L_YourSearchResults_Text + " <B>" + pchealth.TextHelpers.HTMLEscape(idState.stateProperty("HCPrevQuery")) + "</B> " + L_NoLongerAvailable_Text + "</DIV>";
}
}
}
function FindWrapper(strID)
{
// Find the wrapper
for(var oEnumEngine = new Enumerator(g_semgr.EnumEngine()); !oEnumEngine.atEnd(); oEnumEngine.moveNext())
{
var oWrapper = oEnumEngine.item();
if (oWrapper.ID == strID)
{
return oWrapper;
}
}
}
function search_TravelDone()
{
if (g_bResultTravel)
{
if (g_strResultClickID)
{
var oWrapper = FindWrapper(g_strResultClickID);
g_SearchTerms = oWrapper.SearchTerms;
if (oWrapper)
window.setTimeout( search_Highlight, 500);
}
g_bResultTravel = false;
}
}
function search_Highlight()
{
if(g_NAVBAR.g_SearchHighlight)
{
pchealth.HighlightWords( null, g_SearchTerms );
}
}
function search_Abort()
{
if(g_bSearchInProgress)
{
UserAbort();
}
}
</SCRIPT>
<helpcenter:events id=idEvents onContextSwitch="search_ContextSwitch();" onTravelDone="search_TravelDone();" onPersistSave="search_PersistSave();" onPersistLoad="search_PersistLoad();" onBeforeContextSwitch="search_Abort();"/>
<helpcenter:state id=idState identity="Search" />
</HTML>