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

  1. <HTML XMLNS:helpcenter>
  2. <HEAD>
  3. <!--
  4. Copyright (c) 2000 Microsoft Corporation
  5. -->
  6. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=windows-1252">
  7. <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))'>
  8. <META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
  9. <OBJECT ID=pchealth classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7></OBJECT>
  10. <LINK ID=Stylesheet_Ref1 href="hcp://system/css/Behaviors.css" rel=STYLESHEET type=text/css>
  11. <LINK ID=Stylesheet_Ref2 href="hcp://system/css/shared.css" rel=STYLESHEET type=text/css>
  12. <STYLE>
  13. .Search-Headline
  14. {
  15. height : 2em;
  16. padding-left : 11px;
  17. padding-right : 11px;
  18. }
  19. .Search-StopButton
  20. {
  21. padding : 2pt;
  22. cursor : hand;
  23. text-overflow : ellipsis;
  24. width : 100%;
  25. }
  26. .Search-ProviderPane
  27. {
  28. border-style : solid;
  29. border-left-width : 1px;
  30. border-right-width : 1px;
  31. border-top-width : 1px;
  32. border-bottom-width : 1px;
  33. border-top-color : threedhighlight;
  34. border-left-color : threedhighlight;
  35. border-bottom-color : threedshadow;
  36. border-right-color : threedshadow;
  37. background-color : threedface;
  38. padding-left : 11px;
  39. padding-top : 5px;
  40. padding-bottom : 5px;
  41. cursor : hand;
  42. }
  43. .Search-ResultCell
  44. {
  45. background-color : window;
  46. height : 100%;
  47. width : 100%;
  48. border-top-width : 0px;
  49. border-left-width : 1px;
  50. border-right-width : 1px;
  51. border-bottom-width : 1px;
  52. border-style : solid;
  53. border-color : threedshadow;
  54. }
  55. .Search-ResultDisplay
  56. {
  57. width : 100%;
  58. height : 100%;
  59. overflow : auto;
  60. }
  61. .Search-ResultFrameCell
  62. {
  63. height : 100%;
  64. padding-left : 11px;
  65. padding-right : 11px;
  66. }
  67. .Search-SearchStatusCell
  68. {
  69. width : 100%;
  70. padding-left : 11px;
  71. padding-top : 11px;
  72. padding-bottom : 11px;
  73. }
  74. .Search-OuterTableAll
  75. {
  76. border-top-width : 1px;
  77. border-left-width : 1px;
  78. border-right-width : 1px;
  79. border-bottom-width : 1px;
  80. border-style : solid;
  81. }
  82. .Search-OuterTableLeft
  83. {
  84. border-top-width : 0px;
  85. border-left-width : 1px;
  86. border-right-width : 0px;
  87. border-bottom-width : 0px;
  88. border-style : solid;
  89. }
  90. .Search-OuterTableRight
  91. {
  92. border-top-width : 0px;
  93. border-left-width : 0px;
  94. border-right-width : 1px;
  95. border-bottom-width : 0px;
  96. border-style : solid;
  97. }
  98. .Search-OuterTableLeftRight
  99. {
  100. border-top-width : 0px;
  101. border-left-width : 1px;
  102. border-right-width : 1px;
  103. border-bottom-width : 0px;
  104. border-style : solid;
  105. }
  106. .Search-OuterTableLeftRightBottom
  107. {
  108. border-top-width : 0px;
  109. border-left-width : 1px;
  110. border-right-width : 1px;
  111. border-bottom-width : 1px;
  112. border-style : solid;
  113. }
  114. .Search-ProvListBoxCell
  115. {
  116. border-top-width : 0px;
  117. border-left-width : 1px;
  118. border-right-width : 1px;
  119. border-bottom-width : 0px;
  120. border-style : solid;
  121. }
  122. </STYLE>
  123. </HEAD>
  124. <BODY SCROLL=NO class='sys-lhp-bgcolor'>
  125. <DIV id=idResultsPane WIDTH=100% HEIGHT=100%>
  126. <TABLE class='sys-font-body' cellspacing=0 cellpadding=0 WIDTH=100% HEIGHT=100% style='table-layout:fixed;'>
  127. <TR>
  128. <TD colspan=2>
  129. <DIV id=noloc1 class='sys-color-body' style='width: 100%; text-overflow: ellipsis; overflow-x: hidden;height:1em;padding-top:11px;padding-left:7px;'>
  130. <DIV id=locPreviousResults title="Specifies whether to search only the content included in the results of your most recent search." NOWRAP>
  131. <INPUT id=idSearchWithinResults TYPE=checkbox title="Search within previous results"> Search within previous results
  132. </DIV>
  133. </DIV>
  134. </TD>
  135. </TR>
  136. <TR>
  137. <TD id=noloc2 colspan=2 style='height:11px;'> </TD>
  138. </TR>
  139. <TR height=100%>
  140. <TD id=noloc3 colspan=2 style='padding-left : 11px; padding-right : 11px;'>
  141. <TABLE id="ResultTable" onresize="SwitchProvDisplay()" class='sys-font-body' WIDTH=100% HEIGHT=100% cellspacing=0 cellpadding=0 style='table-layout:fixed;'>
  142. <TR>
  143. <TD class='sys-toppane-color-border Search-OuterTableAll' colspan=3>
  144. <TABLE cellspacing=0 cellpadding=0 border=0 class='sys-font-body-bold sys-toppane-header-color sys-toppane-header-bgcolor Search-Headline' >
  145. <TR>
  146. <TD id='SearchResultsCell' WIDTH=100% id=locTitle>
  147. <DIV id=noloc4 style='width: 100%; text-overflow: ellipsis; overflow: hidden;'>
  148. <DIV NOWRAP id=locSearchResults>Search Results</DIV>
  149. </DIV>
  150. </TD>
  151. <TD NOWRAP>
  152. <DIV id=locTips><a class="sys-link-header" target='HelpCtrContents' href='hcp://system/blurbs/searchtips.htm'>Tips</a></DIV>
  153. </TD>
  154. </TR>
  155. </TABLE>
  156. </TD>
  157. </TR>
  158. <TR>
  159. <TD colspan=2 class='Search-SearchStatusCell sys-toppane-bgcolor sys-toppane-color-border Search-OuterTableLeft'>
  160. <DIV id=noloc5 style='width: 100%; text-overflow: ellipsis; overflow: hidden;'>
  161. <DIV NOWRAP class='sys-font-body sys-color-body' id='idSearchStatus'></DIV>
  162. </DIV>
  163. </TD>
  164. <TD align='right' class='sys-toppane-bgcolor sys-toppane-color-border Search-OuterTableRight' style='padding:11px;' id=noloc6>
  165. <BUTTON id=idStopSearch class="Search-StopButton sys-font-body" accesskey="t" disabled="true" onClick="UserAbort();">S<U>t</U>op</BUTTON>
  166. </TD>
  167. </TR>
  168. <TR>
  169. <TD class='sys-toppane-color-border Search-ResultFrameCell sys-toppane-bgcolor Search-OuterTableLeftRight' colspan=3>
  170. <DIV id=idResultSet class="sys-toppane-bgcolor"></DIV>
  171. </TD>
  172. </TR>
  173. <TR>
  174. <TD id=noloc7 colspan=3 class='sys-toppane-bgcolor sys-toppane-color-border Search-OuterTableLeftRightBottom' style='height:11px;'> </TD>
  175. </TR>
  176. </TABLE>
  177. </TD>
  178. </TR>
  179. <TR>
  180. <TD id=noloc8 colspan=2 style='height:11px;'> </TD>
  181. </TR>
  182. </TABLE>
  183. </DIV>
  184. </BODY>
  185. <SCRIPT id=Script_Ref0 SRC="hcp://system/scripts/wrapperparam.js"></SCRIPT>
  186. <SCRIPT>
  187. //
  188. // localizable variables/filenames
  189. //
  190. var L_SearchAborted_Text = 'Search was stopped.';
  191. var L_ResultsFound_Text = 'results found for';
  192. var L_ReturnZeroResults_Text = " returned 0 results for ";
  193. 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>";
  194. var L_Matches_Text = 'no matches';
  195. var L_Result1_Text = " (";
  196. var L_Result2_Text = " results)";
  197. 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.';
  198. 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.';
  199. var L_YourSearchResults_Text = 'Your search results for';
  200. var L_NoLongerAvailable_Text = 'is no longer available. Please perform the query again.';
  201. var L_HelpInformation_Text = "Help and Information";
  202. var L_CommonQuestions_Text = "Common Questions";
  203. var L_Troubleshooting_Text = "Troubleshooting";
  204. var L_TechnicalArticles_Text = "Technical Articles";
  205. var L_Tutorials_Text = "Tutorials";
  206. var L_Helpfiles_Text = "Helpfiles";
  207. var L_FixProblem_Text = "Fix a Problem";
  208. var L_PickTask_Text = "Pick a task";
  209. var L_Overviews_Text = "Overviews, Articles and Tutorials";
  210. var L_References_Text = "References";
  211. 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>.";
  212. // Other variables
  213. var g_ContentTypes = [];
  214. g_ContentTypes[1] = L_HelpInformation_Text;
  215. g_ContentTypes[2] = L_CommonQuestions_Text;
  216. g_ContentTypes[3] = L_Troubleshooting_Text;
  217. g_ContentTypes[4] = L_TechnicalArticles_Text;
  218. g_ContentTypes[5] = L_Tutorials_Text;
  219. g_ContentTypes[6] = L_Helpfiles_Text;
  220. g_ContentTypes[7] = L_FixProblem_Text;
  221. g_ContentTypes[8] = L_PickTask_Text;
  222. g_ContentTypes[9] = L_Overviews_Text;
  223. g_ContentTypes[10] = L_References_Text;
  224. var g_NAVBAR = pchealth.UI_NavBar.content.parentWindow;
  225. var g_oLearnDlg = null;
  226. var g_oEnumEngine = null;
  227. var g_semgr = null;
  228. var g_Timer_Timeout = null;
  229. var g_Timer_Print = null;
  230. var SEARCH_TIMEOUT = 30000; // 30 second timeout
  231. var g_bSearchInProgress = false;
  232. var g_lTotalNumResults = 0;
  233. var g_aEngID;
  234. var g_aEngName;
  235. var g_aDescription;
  236. var g_iEngCount;
  237. var g_WrapperSelected = "";
  238. var g_idWrapperDisplay = "";
  239. var g_NewResults = false;
  240. var g_bResultClick = false;
  241. var g_bResultTravel = false;
  242. var g_strResultClickID = "";
  243. var g_bFrameCreated = false;
  244. var g_SearchTerms = null;
  245. var g_aBullet = null;
  246. var g_aResultEnum = null;
  247. var g_aWrapperState = null;
  248. var g_aContentType = null;
  249. var g_aWrapperList = null;
  250. var g_bPrinting = false;
  251. var PRINT_DELAY = 10; // 10 millisecond delay per call
  252. var WRAPPER_STATE_QUERYING = 0;
  253. var WRAPPER_STATE_PRINTING = 1;
  254. var WRAPPER_STATE_DONE = 2;
  255. var WRAPPER_NUM_RESULT_PRINT = 2;
  256. var REGKEY_WRAPPER_DISPLAY = "HKLM\\SOFTWARE\\Microsoft\\PCHealth\\HelpSvc\\WrapperDisplay";
  257. // Get the default wrapper to display
  258. try
  259. {
  260. var g_idWrapperDisplay = pchealth.RegRead( REGKEY_WRAPPER_DISPLAY );
  261. if (!g_idWrapperDisplay)
  262. {
  263. if (pchealth.UserSettings.IsDesktopVersion)
  264. g_idWrapperDisplay = g_NAVBAR.ID_KEYWORD;
  265. else
  266. g_idWrapperDisplay = g_NAVBAR.ID_FTS;
  267. }
  268. }
  269. catch (e)
  270. {
  271. g_idWrapperDisplay = "";
  272. }
  273. function OpenConnWizard()
  274. {
  275. try
  276. {
  277. var sShellCmd_NCW = "rundll32 netshell.dll,StartNCW 0";
  278. g_oWShell.Run( sShellCmd_NCW );
  279. }
  280. catch( e ){}
  281. }
  282. function ShowLearnMore( sTopicURL )
  283. {
  284. if ((!sTopicURL) || (sTopicURL == ""))
  285. return;
  286. g_oLearnDlg = window.showModelessDialog( sTopicURL, window, "help:no;status:no;resizable:no;dialogWidth:385px;dialogHeight:440px" );
  287. // pchealth.UI_Contents.content.Navigate( sTopicURL, null, null, null, null );
  288. }
  289. function GenerateResultFrame()
  290. {
  291. var resultHTML = "<TABLE class='sys-font-body' cellspacing=0 cellpadding=0 border=0 WIDTH=100% HEIGHT=100% style='table-layout:fixed'>";
  292. var iIndex;
  293. var oWrapper = null;
  294. var strListBoxDisplay;
  295. var strProviderDisplay;
  296. if (g_bFrameCreated)
  297. return;
  298. g_bFrameCreated = true;
  299. // delete the arrays and create new ones
  300. g_aEngID = new Array();
  301. g_aEngName = new Array();
  302. g_aDescription = new Array();
  303. g_iEngCount = 0;
  304. // Initialize search eng and get data
  305. for(var oEnumEngine = new Enumerator(g_oEnumEngine); !oEnumEngine.atEnd(); oEnumEngine.moveNext())
  306. {
  307. var oSearchEng = oEnumEngine.item();
  308. // Display the search engine only if it has been enabled
  309. if (oSearchEng.Enabled)
  310. {
  311. g_aEngID [g_iEngCount] = oSearchEng.ID;
  312. g_aEngName[g_iEngCount] = oSearchEng.Name;
  313. g_aDescription[g_iEngCount] = oSearchEng.Description;
  314. g_iEngCount++;
  315. }
  316. }
  317. if (IsResultSpaceEnough())
  318. {
  319. strListBoxDisplay = " style='display:none' ";
  320. strProviderDisplay = "";
  321. }
  322. else
  323. {
  324. strListBoxDisplay = "";
  325. strProviderDisplay = " style='display:none' ";
  326. }
  327. // Create a drop down list box
  328. 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%>";
  329. resultHTML += "<SELECT style='width:100%;' class='sys-font-body sys-color-body sys-toppane-bgcolor' ID='ProviderList' SIZE=1 onchange='ProviderListChange();'>";
  330. for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
  331. {
  332. resultHTML += '<OPTION WIDTH=100% VALUE="' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '">' + pchealth.TextHelpers.HTMLEscape(g_aEngName[iIndex]);
  333. }
  334. resultHTML += "</SELECT></TD></TR>";
  335. // Create a row for each wrapper
  336. for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
  337. {
  338. // Check to see if there is a result number for the wrapper
  339. var strNumResults = g_NAVBAR.GetWrapperVar("g_numResult" + g_aEngID[iIndex]);
  340. 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>';
  341. // if it is the last one, display the result cell
  342. resultHTML += '<TR id="idResultCell' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '"';
  343. if (iIndex == g_iEngCount - 1)
  344. {
  345. g_WrapperSelected = g_aEngID[iIndex];
  346. }
  347. else
  348. {
  349. resultHTML += " style='display:none;'";
  350. }
  351. resultHTML += '><TD class="sys-font-body Search-ResultCell"><DIV class="Search-ResultDisplay" id="idResultDIV' + pchealth.TextHelpers.HTMLEscape( g_aEngID[iIndex] ) + '"></DIV></TD></TR>';
  352. }
  353. // Insert the HTML
  354. idResultSet.innerHTML = resultHTML + "</TABLE>";
  355. }
  356. function ProviderListChange()
  357. {
  358. var oOptions = event.srcElement.options(event.srcElement.selectedIndex);
  359. WrapperClick(oOptions.value);
  360. }
  361. function IsResultSpaceEnough()
  362. {
  363. // Compute the total height occupied by the provider cells
  364. // Use the search result cell because other cells may not be avail and it is about the same height
  365. var iResultDisplay = 50;
  366. var iNumProviders = g_iEngCount + 4; // there are about 4 spaces roughly equal to each provider space
  367. return (ResultTable.offsetHeight > ((SearchResultsCell.offsetHeight * iNumProviders) + iResultDisplay));
  368. }
  369. function SwitchProvDisplay()
  370. {
  371. if (IsResultSpaceEnough())
  372. {
  373. // Enough space, use provider cells instead
  374. // Hide the drop down list
  375. oProvListBox = idResultSet.all.item("ProvListBox");
  376. if (oProvListBox)
  377. oProvListBox.style.display = "none";
  378. // Show the provider cells
  379. for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
  380. {
  381. var oProvDiv = idResultSet.all.item("ProvCell" + g_aEngID[iIndex]);
  382. if (oProvDiv)
  383. oProvDiv.style.display = "inline";
  384. }
  385. }
  386. else
  387. {
  388. // Not enough space, so use drop down list instead
  389. // Show the drop down list
  390. var oProvListBox = idResultSet.all.item("ProvListBox");
  391. if (oProvListBox)
  392. oProvListBox.style.display = "inline";
  393. // Hide the provider cells
  394. for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
  395. {
  396. var oProvDiv = idResultSet.all.item("ProvCell" + g_aEngID[iIndex]);
  397. if (oProvDiv)
  398. oProvDiv.style.display = "none";
  399. }
  400. }
  401. }
  402. ////////////////////
  403. function SetTimer_Print()
  404. {
  405. g_Timer_Print = window.setTimeout( GenerateResultItem, PRINT_DELAY );
  406. }
  407. function ClearTimer_Print()
  408. {
  409. if(g_Timer_Print)
  410. {
  411. window.clearTimeout( g_Timer_Print ); g_Timer_Print = null;
  412. }
  413. }
  414. function GenerateResult(oWrapper)
  415. {
  416. try
  417. {
  418. g_aBullet [oWrapper.ID] = oWrapper.GetParam("UI_BULLET");
  419. }
  420. catch(e)
  421. { ; }
  422. if (g_aBullet[oWrapper.ID])
  423. 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>';
  424. else
  425. 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>';
  426. // Get the UI instructions for Button display from the wrapper
  427. try
  428. {
  429. g_aResultEnum [oWrapper.ID] = new Enumerator( oWrapper.Result(0, g_semgr.NumResult) );
  430. g_aContentType [oWrapper.ID] = -1;
  431. g_aWrapperState [oWrapper.ID] = WRAPPER_STATE_PRINTING;
  432. g_aWrapperList [oWrapper.ID] = idResultSet.all.item("list" + oWrapper.ID);
  433. }
  434. catch(e)
  435. { ; }
  436. GenerateResultItem();
  437. }
  438. function GenerateResultItem()
  439. {
  440. var bContinuePrinting = false;
  441. // If already printing, return
  442. if(g_bPrinting) return;
  443. ClearTimer_Print();
  444. g_bPrinting = true;
  445. // loop through all the wrappers
  446. for(var iIndex = 0; iIndex < g_iEngCount; iIndex++)
  447. {
  448. var wrapperID = g_aEngID[iIndex];
  449. var wrapper = g_aWrapperList[wrapperID];
  450. var result = g_aResultEnum[wrapperID];
  451. // Print out results
  452. for(var iResult = 0; iResult < WRAPPER_NUM_RESULT_PRINT; iResult++)
  453. {
  454. // Check if wrapper is ready to print results
  455. if (g_aWrapperState[wrapperID] == WRAPPER_STATE_PRINTING)
  456. {
  457. bContinuePrinting = true;
  458. // Get the result
  459. var oResult = result.item();
  460. // If error, display error string
  461. if (oResult.ContentType < 0)
  462. {
  463. // Create an error element
  464. var oNewNode = document.createElement("DIV");
  465. oNewNode.style.paddingTop = "15px";
  466. if (oResult.ContentType == -2)
  467. {
  468. 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>";
  469. }
  470. else
  471. {
  472. oNewNode.innerHTML = pchealth.TextHelpers.HTMLEscape(oResult.Description);
  473. }
  474. wrapper.style.marginLeft = "15px";
  475. wrapper.appendChild(oNewNode);
  476. }
  477. else
  478. {
  479. // Associate title and URL
  480. pchealth.HelpSession.SetTitle(oResult.URI, oResult.Title);
  481. // Add the content type
  482. var iContentType = oResult.ContentType;
  483. if ((iContentType == 0) && (g_aContentType[wrapperID] == -1))
  484. {
  485. // Add a line space
  486. var oContentSpace = document.createElement("DIV");
  487. oContentSpace.className = "sys-font-body-bold";
  488. oContentSpace.innerHTML = "&nbsp;";
  489. wrapper.appendChild(oContentSpace);
  490. // Change the content type stored
  491. g_aContentType[wrapperID] = 1;
  492. }
  493. if ((iContentType != 0) && (iContentType != g_aContentType[wrapperID]))
  494. {
  495. var strCT = g_ContentTypes[iContentType]; if(!strCT) strCT = " ";
  496. // Add a line space
  497. var oContentSpace = document.createElement("DIV");
  498. oContentSpace.className = "sys-font-body-bold sys-color-body";
  499. oContentSpace.innerHTML = "&nbsp;";
  500. wrapper.appendChild(oContentSpace);
  501. // Add the content type
  502. var oContentNode = document.createElement("DIV");
  503. oContentNode.className = "sys-font-body-bold sys-color-body";
  504. oContentNode.innerText = strCT;
  505. wrapper.appendChild(oContentNode);
  506. // Save the displayed content type so that it doesn't appear again
  507. g_aContentType[wrapperID] = iContentType;
  508. }
  509. // Create the element
  510. var oNewNode = document.createElement("LI");
  511. oNewNode.style.lineHeight = "1.5em";
  512. // Place the rank
  513. if ((oResult.Rank > 0) && (oResult.Rank <= 1))
  514. {
  515. var dRank = Math.ceil(oResult.Rank * 100);
  516. var oInnerDIV = document.createElement("DIV");
  517. oInnerDIV.style.color = "gray";
  518. oInnerDIV.className = "sys-font-body";
  519. oInnerDIV.innerText = "(" + dRank + "%)";
  520. oNewNode.appendChild(oInnerDIV);
  521. }
  522. // Place the title, URL, tooltip
  523. var oInnerDIV = document.createElement("DIV");
  524. oInnerDIV.className = "sys-font-body";
  525. var oInnerLink = document.createElement("A");
  526. oInnerLink.onclick = ResultClick;
  527. oInnerLink.className = "sys-link-normal";
  528. oInnerLink.wrapperID = wrapperID;
  529. oInnerLink.tabIndex = 0;
  530. oInnerLink.target = "HelpCtrContents";
  531. oInnerLink.href = oResult.URI;
  532. if(oResult.Description != "") oInnerLink.title = oResult.Description;
  533. // Place the location
  534. if ((oResult.Location != "") && (!pchealth.UserSettings.IsDesktopVersion))
  535. oInnerLink.innerText = oResult.Title + " : " + oResult.Location;
  536. else
  537. oInnerLink.innerText = oResult.Title;
  538. oNewNode.appendChild(oInnerLink);
  539. wrapper.appendChild(oNewNode);
  540. }
  541. // Advance to the next result
  542. result.moveNext();
  543. // Check if all results have been printed
  544. if(result.atEnd())
  545. {
  546. g_aWrapperState[wrapperID] = WRAPPER_STATE_DONE;
  547. continue;
  548. }
  549. }
  550. }
  551. }
  552. g_bPrinting = false;
  553. if(bContinuePrinting) SetTimer_Print();
  554. }
  555. function WrapperKeyDown(strID)
  556. {
  557. // Check if it is the space or return key being pressed
  558. if ((event.keyCode == 13) || (event.keyCode == 32))
  559. WrapperClick(strID);
  560. }
  561. function WrapperClick(strID)
  562. {
  563. if (g_WrapperSelected == strID)
  564. return;
  565. var strPrevWrapper = g_WrapperSelected;
  566. g_WrapperSelected = strID;
  567. // Turn results on
  568. if (g_WrapperSelected != "")
  569. idResultSet.all.item("idResultCell" + g_WrapperSelected).style.display = "";
  570. // Turn results off
  571. if (strPrevWrapper != "")
  572. idResultSet.all.item("idResultCell" + strPrevWrapper).style.display = "none";
  573. // Make sure that the list box selection is sync'ed
  574. var oProvList = idResultSet.all.item("ProviderList");
  575. for(var iIndex = 0; iIndex < g_iEngCount; iIndex++)
  576. {
  577. if (g_aEngID[iIndex] == strID)
  578. {
  579. oProvList.selectedIndex = iIndex;
  580. break;
  581. }
  582. }
  583. }
  584. function InitializeGlobals()
  585. {
  586. // Get the search engine if null
  587. if(g_semgr == null)
  588. {
  589. g_semgr = g_NAVBAR.GetSearchEngineManager();
  590. // Check if it has been initialized
  591. if(g_NAVBAR.GetWrapperVar("SEMgrInit") != "true")
  592. {
  593. LoadWrapperParams( g_semgr );
  594. g_NAVBAR.SetWrapperVar("SEMgrInit", "true");
  595. }
  596. g_oEnumEngine = g_semgr.EnumEngine();
  597. }
  598. }
  599. ////////////////////
  600. function SetTimer_Timeout()
  601. {
  602. g_Timer_Timeout = window.setTimeout( AbortFromTimeout, SEARCH_TIMEOUT );
  603. }
  604. function ClearTimer_Timeout()
  605. {
  606. if(g_Timer_Timeout)
  607. {
  608. window.clearTimeout( g_Timer_Timeout ); g_Timer_Timeout = null;
  609. }
  610. }
  611. function UserAbort()
  612. {
  613. AbortQuery();
  614. SetSearchStatus( L_SearchAborted_Text, L_SearchAborted_Text, true );
  615. }
  616. function AbortQuery()
  617. {
  618. ClearTimer_Timeout();
  619. ClearTimer_Print ();
  620. idResultsPane.style.cursor = "default";
  621. idStopSearch.disabled = true;
  622. g_bSearchInProgress = false;
  623. if(g_semgr)
  624. {
  625. g_semgr.onWrapperComplete = SENull;
  626. g_semgr.onComplete = SENull;
  627. g_semgr.AbortQuery();
  628. }
  629. }
  630. ////////////////////
  631. function UpdateSearchStatus()
  632. {
  633. if(g_NAVBAR.GetWrapperVar("SearchStatus"))
  634. {
  635. idSearchStatus.innerHTML = g_NAVBAR.GetWrapperVar("SearchStatus");
  636. idSearchStatus.title = g_NAVBAR.GetWrapperVar("SearchStatus_Tooltip");
  637. }
  638. else
  639. {
  640. idSearchStatus.innerHTML = L_Matches_Text;
  641. idSearchStatus.title = L_Matches_Text;
  642. }
  643. }
  644. function SetSearchStatus( text, title, now )
  645. {
  646. if(now)
  647. {
  648. idSearchStatus.innerHTML = text;
  649. idSearchStatus.title = title;
  650. }
  651. else
  652. {
  653. g_NAVBAR.SetWrapperVar( "SearchStatus" , text );
  654. g_NAVBAR.SetWrapperVar( "SearchStatus_Tooltip", title );
  655. }
  656. }
  657. function SEWrapperComplete( oWrapper )
  658. {
  659. // Get the actual total number of results
  660. var iTotalResult = oWrapper.Result(0, g_semgr.NumResult).Count;
  661. // Check if the wrapper has returned an error
  662. var oEnumResult = new Enumerator( oWrapper.Result(0, 1) );
  663. var oResult = oEnumResult.item();
  664. var bErrorResult = false;
  665. // Check if error on the first item
  666. try
  667. {
  668. if (oResult.ContentType < 0)
  669. {
  670. iTotalResult -= 1;
  671. bErrorResult = true;
  672. }
  673. }
  674. catch(e)
  675. { ; }
  676. // Save the number of results for this wrapper
  677. g_NAVBAR.SetWrapperVar("g_numResult" + oWrapper.ID, iTotalResult.toString());
  678. // tally number of results
  679. g_lTotalNumResults += iTotalResult;
  680. SetSearchStatus( g_lTotalNumResults + " " + L_ResultsFound_Text + " <B>" + pchealth.TextHelpers.HTMLEscape(g_semgr.QueryString) + "</B>" ,
  681. g_lTotalNumResults + " " + L_ResultsFound_Text + " \'" + pchealth.TextHelpers.HTMLEscape(g_semgr.QueryString) + "\'" , false );
  682. // Print out the number of results for the wrapper in the tab
  683. var item = idResultSet.all.item("div" + oWrapper.ID);
  684. var resTxt = pchealth.TextHelpers.HTMLEscape(oWrapper.Name) + L_Result1_Text + pchealth.TextHelpers.HTMLEscape( iTotalResult ) + L_Result2_Text;
  685. item.title = resTxt + "\n\n" + oWrapper.Description;
  686. item.innerHTML = "<DIV style='width: 100%; text-overflow: ellipsis; overflow: hidden;'><DIV NOWRAP>" + resTxt + "</DIV></DIV>";
  687. if (iTotalResult || bErrorResult)
  688. GenerateResult(oWrapper);
  689. else
  690. 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>";
  691. // Check to see if there is a wrapper to display first
  692. if (g_idWrapperDisplay == "")
  693. {
  694. // Display the one that came back first
  695. if ((g_WrapperSelected == "") && (iTotalResult > 0))
  696. {
  697. WrapperClick(oWrapper.ID);
  698. }
  699. }
  700. else
  701. {
  702. // if g_idWrapperDisplay is set to Keyword, then we know it is a desktop sku
  703. if (g_idWrapperDisplay == g_NAVBAR.ID_KEYWORD)
  704. {
  705. // Check if keyword is Enabled
  706. if (FindWrapper(g_NAVBAR.ID_KEYWORD).Enabled)
  707. {
  708. // if it is keyword and num results is zero, display FTS wrapper
  709. if (oWrapper.ID == g_NAVBAR.ID_KEYWORD)
  710. {
  711. if (iTotalResult == 0)
  712. WrapperClick(g_NAVBAR.ID_FTS);
  713. else
  714. WrapperClick(g_NAVBAR.ID_KEYWORD);
  715. }
  716. }
  717. else if (iTotalResult > 0)
  718. WrapperClick(oWrapper.ID);
  719. }
  720. else if ((g_idWrapperDisplay == oWrapper.ID) && (iTotalResult > 0))
  721. {
  722. WrapperClick(oWrapper.ID);
  723. }
  724. }
  725. // Display status only if search has ended
  726. if(!g_bSearchInProgress) UpdateSearchStatus();
  727. GenerateResultItem();
  728. }
  729. function SEMgrComplete(lSucceeded)
  730. {
  731. ClearTimer_Timeout();
  732. g_bSearchInProgress = false;
  733. // Set the cursor
  734. idResultsPane.style.cursor = "default";
  735. // Disable abort key
  736. idStopSearch.disabled = true;
  737. UpdateSearchStatus();
  738. GenerateResultItem();
  739. }
  740. function SENull()
  741. {
  742. }
  743. function AbortFromTimeout()
  744. {
  745. AbortQuery();
  746. SEMgrComplete(0);
  747. }
  748. function ExecuteQuery( strQuery )
  749. {
  750. var bEnableSearch = false;
  751. // Init print arrays
  752. g_aBullet = new Array();
  753. g_aResultEnum = new Array();
  754. g_aWrapperState = new Array();
  755. g_aContentType = new Array();
  756. g_aWrapperList = new Array();
  757. // Init global vars
  758. g_bFrameCreated = false;
  759. g_NewResults = true;
  760. g_bSearchInProgress = true;
  761. g_WrapperSelected = "";
  762. idResultsPane.style.cursor = "wait";
  763. g_lTotalNumResults = 0;
  764. // Create the query
  765. if (idSearchWithinResults.checked)
  766. {
  767. if (g_NAVBAR.GetWrapperVar("HCPrevQuery") == strQuery)
  768. g_semgr.QueryString = strQuery;
  769. else
  770. if (g_NAVBAR.GetWrapperVar("HCPrevQuery") != "")
  771. g_semgr.QueryString = "(" + g_NAVBAR.GetWrapperVar("HCPrevQuery") + ") and " + strQuery;
  772. else
  773. g_semgr.QueryString = strQuery;
  774. }
  775. else
  776. g_semgr.QueryString = strQuery;
  777. // Save query
  778. g_NAVBAR.SetWrapperVar("HCPrevQuery", g_semgr.QueryString);
  779. // Check if at least one wrapper is enabled
  780. var iSWCount = 0;
  781. for(var oEnumEngine = new Enumerator(g_oEnumEngine); !oEnumEngine.atEnd(); oEnumEngine.moveNext())
  782. {
  783. var oSearchEng = oEnumEngine.item();
  784. // Check whether enabled
  785. if(oSearchEng.Enabled) bEnableSearch = true;
  786. // reset the number of results
  787. g_NAVBAR.SetWrapperVar("g_numResult" + oSearchEng.ID, "");
  788. // set the subsite info
  789. oSearchEng.AddParam("SUBSITE", g_NAVBAR.GetWrapperVar("SUBSITE"));
  790. // set the state of the wrapper
  791. g_aWrapperState[oSearchEng.ID] = WRAPPER_STATE_QUERYING;
  792. // set the query and current query
  793. oSearchEng.AddParam("SubQuery", idSearchWithinResults.checked);
  794. oSearchEng.AddParam("CurrentQuery", strQuery);
  795. iSWCount++;
  796. }
  797. // Generate the tabs
  798. GenerateResultFrame();
  799. // Execute the query
  800. if (bEnableSearch)
  801. {
  802. // set the search status string
  803. SetSearchStatus( "<img src='hcp://system/images/progbar.gif'>", "", true );
  804. idStopSearch.disabled = false;
  805. idStopSearch.focus();
  806. ClearTimer_Timeout();
  807. ClearTimer_Print ();
  808. try
  809. {
  810. // Execute the search
  811. g_semgr.onWrapperComplete = SEWrapperComplete;
  812. g_semgr.onComplete = SEMgrComplete;
  813. g_semgr.ExecuteAsynchQuery();
  814. // create new timer for new query
  815. SetTimer_Timeout();
  816. }
  817. catch(e)
  818. {
  819. // abort, try again
  820. AbortQuery();
  821. }
  822. }
  823. else
  824. {
  825. SetSearchStatus( "", "", true );
  826. pchealth.MessageBox( iSWCount ? L_EnableWrapperError_Text : L_ServiceUnavailable_Text, "OK" );
  827. idResultsPane.style.cursor = "default";
  828. g_bSearchInProgress = false;
  829. }
  830. }
  831. function search_ContextSwitch()
  832. {
  833. var ctx = pchealth.HelpSession.CurrentContext;
  834. if(ctx.ContextName == "SEARCH")
  835. {
  836. // Check if a search is already in progress.
  837. if(g_bSearchInProgress) return;
  838. // Check if the previous context is not search
  839. var ctxPrev = event.srcElement.data.PreviousContext;
  840. if(!ctxPrev || ctxPrev.ContextName != "SEARCH")
  841. {
  842. idSearchWithinResults.checked = false;
  843. }
  844. InitializeGlobals();
  845. if(ctx.ContextInfo) ExecuteQuery( ctx.ContextInfo );
  846. }
  847. }
  848. function ResultClick()
  849. {
  850. g_bResultClick = true;
  851. g_bResultTravel = true;
  852. g_strResultClickID = this.wrapperID;
  853. }
  854. function search_PersistSave()
  855. {
  856. // Check if a search is already in progress.
  857. if(g_bSearchInProgress) return;
  858. if(g_NewResults)
  859. {
  860. // Save the last query
  861. idState.stateProperty("HCPrevQuery") = g_NAVBAR.GetWrapperVar("HCPrevQuery");
  862. // Save the html of results
  863. g_NAVBAR.SetWrapperVar("ResultDisplay", idResultSet.innerHTML);
  864. g_NewResults = false;
  865. }
  866. }
  867. function search_PersistLoad()
  868. {
  869. // Check if a search is already in progress.
  870. if(g_bSearchInProgress) return;
  871. if (g_bResultClick)
  872. {
  873. // Save the last query
  874. idState.stateProperty("HCPrevQuery") = g_NAVBAR.GetWrapperVar("HCPrevQuery");
  875. g_bResultClick = false;
  876. return;
  877. }
  878. // Check if there is anything to display
  879. if(!idState.stateProperty("HCPrevQuery") || idState.stateProperty("HCPrevQuery") == "")
  880. {
  881. InitializeGlobals();
  882. GenerateResultFrame();
  883. return;
  884. }
  885. // Recreate the display
  886. if (idState.stateProperty("HCPrevQuery") == g_NAVBAR.GetWrapperVar("HCPrevQuery"))
  887. {
  888. idResultSet.innerHTML = g_NAVBAR.GetWrapperVar("ResultDisplay");
  889. UpdateSearchStatus();
  890. }
  891. else
  892. {
  893. InitializeGlobals();
  894. GenerateResultFrame();
  895. SetSearchStatus( "", "", true );
  896. // Put unavailable message
  897. for (iIndex = 0; iIndex < g_iEngCount; iIndex++)
  898. {
  899. 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>";
  900. }
  901. }
  902. }
  903. function FindWrapper(strID)
  904. {
  905. // Find the wrapper
  906. for(var oEnumEngine = new Enumerator(g_semgr.EnumEngine()); !oEnumEngine.atEnd(); oEnumEngine.moveNext())
  907. {
  908. var oWrapper = oEnumEngine.item();
  909. if (oWrapper.ID == strID)
  910. {
  911. return oWrapper;
  912. }
  913. }
  914. }
  915. function search_TravelDone()
  916. {
  917. if (g_bResultTravel)
  918. {
  919. if (g_strResultClickID)
  920. {
  921. var oWrapper = FindWrapper(g_strResultClickID);
  922. g_SearchTerms = oWrapper.SearchTerms;
  923. if (oWrapper)
  924. window.setTimeout( search_Highlight, 500);
  925. }
  926. g_bResultTravel = false;
  927. }
  928. }
  929. function search_Highlight()
  930. {
  931. if(g_NAVBAR.g_SearchHighlight)
  932. {
  933. pchealth.HighlightWords( null, g_SearchTerms );
  934. }
  935. }
  936. function search_Abort()
  937. {
  938. if(g_bSearchInProgress)
  939. {
  940. UserAbort();
  941. }
  942. }
  943. </SCRIPT>
  944. <helpcenter:events id=idEvents onContextSwitch="search_ContextSwitch();" onTravelDone="search_TravelDone();" onPersistSave="search_PersistSave();" onPersistLoad="search_PersistLoad();" onBeforeContextSwitch="search_Abort();"/>
  945. <helpcenter:state id=idState identity="Search" />
  946. </HTML>