Leaked source code of windows server 2003
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.

167 lines
4.3 KiB

  1. <HTML>
  2. <HEAD>
  3. <META NAME="GENERATOR" Content="Microsoft Developer Studio">
  4. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  5. <TITLE>Document Title</TITLE>
  6. <OBJECT ID=pchealth classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7></OBJECT>
  7. </HEAD>
  8. <BODY>
  9. <H1>Extensible Search Engine</H1>
  10. <table>
  11. <tr>
  12. <td>Number of results returned</td><td><INPUT type=text id=numcount name=numcount></td>
  13. </tr><tr>
  14. <td>Query string</td><td><INPUT type="text" id="QueryString"></td>
  15. </tr><tr>
  16. <td>Full Text Search in Titles only</td><td><INPUT id=titleonly name=titleonly type=checkbox></td>
  17. </tr><tr>
  18. <td>Enable Search Engines</td><td><DIV ID=sectrl></DIV></td>
  19. </tr>
  20. </table>
  21. <INPUT type="button" value="Execute Query" onClick="ExecQuery();">
  22. <INPUT type="button" value="Abort" onClick="Abort();">
  23. <DIV ID=out></DIV>
  24. </BODY>
  25. <SCRIPT LANGUAGE=javascript>
  26. var g_semgr;
  27. var seCount;
  28. var resultstring;
  29. function Print( line )
  30. {
  31. out.innerHTML = out.innerHTML + line + "<br>";
  32. }
  33. function SEMgrComplete(lSucceeded)
  34. {
  35. // clear out contents
  36. out.innerHTML = "";
  37. // enumerate all search engines
  38. for(var e = new Enumerator( g_semgr.EnumEngine() ); !e.atEnd(); e.moveNext())
  39. {
  40. var SearchEng = e.item();
  41. var resultstring;
  42. resultstring = "<br>Results from " + SearchEng.Name;
  43. resultstring = resultstring + "<table>";
  44. resultstring = resultstring + "<tr><td>Title</td><td>Description</td><td>URI</td></tr>";
  45. // enumerate all results
  46. for (var r = new Enumerator( SearchEng.Result() ); !r.atEnd(); r.moveNext())
  47. {
  48. var Result = r.item();
  49. resultstring = resultstring + "<tr><td><a href='" + Result.URI + "'>" + Result.Title + "</a></td><td>" + Result.Description + "</td><td>" + Result.URI + "</td></tr>";
  50. }
  51. resultstring = resultstring + "</table>";
  52. Print(resultstring);
  53. }
  54. }
  55. function SEMgrProgress(lDone, lTotal, SEName)
  56. {
  57. Print("SE Wrapper progress : lDone " + lDone + " lTotal : " + lTotal + " Name : " + SEName);
  58. }
  59. function Abort()
  60. {
  61. g_semgr.AbortQuery();
  62. }
  63. function ExecQuery()
  64. {
  65. var e = new Enumerator( g_semgr.EnumEngine() );
  66. var c = new Enumerator( sectrl.all.tags("input") )
  67. // Clear out result screen
  68. out.innerHTML = "";
  69. // Enumerate search engines and checkboxes
  70. seCount = 0;
  71. for(;!e.atEnd() && !c.atEnd();)
  72. {
  73. var SearchEng = e.item();
  74. var CheckBox = c.item();
  75. SearchEng.Enabled = CheckBox.checked;
  76. c.moveNext();
  77. e.moveNext()
  78. }
  79. // setup the query
  80. g_semgr.NumResult = numcount.value
  81. g_semgr.QueryString = QueryString.value;
  82. // Callback for Search Engine Manager
  83. g_semgr.OnComplete = SEMgrComplete;
  84. g_semgr.OnProgress = SEMgrProgress;
  85. // Get the Full text search parameter
  86. if (document.all.titleonly.checked == true)
  87. g_semgr.AddParam("Help Center Full Text Search", "TITLEONLY", true);
  88. else
  89. g_semgr.AddParam("Help Center Full Text Search", "TITLEONLY", false);
  90. // Execute the query
  91. g_semgr.ExecuteAsynchQuery();
  92. }
  93. //
  94. // Initialize the SE Manager
  95. //
  96. g_semgr = pchealth.CreateObject_SearchEngineMgr();
  97. g_semgr.NumResult = 10;
  98. resultstring = "";
  99. //
  100. // Number of results
  101. //
  102. numcount.value = g_semgr.NumResult;
  103. //
  104. // Enumerate search engines
  105. //
  106. seCount = 0;
  107. resultstring = resultstring + "<table>";
  108. for(var e = new Enumerator( g_semgr.EnumEngine() ); !e.atEnd(); e.moveNext())
  109. {
  110. var SearchEng = e.item();
  111. //
  112. // Enable flag
  113. //
  114. if (SearchEng.Enabled)
  115. {
  116. resultstring = resultstring + "<tr><td><INPUT id=checkbox" + seCount + "cb name=checkbox" + seCount + " type=checkbox checked></td>";
  117. }
  118. else
  119. {
  120. resultstring = resultstring + "<tr><td><INPUT id=checkbox" + seCount + "cb name=checkbox" + seCount + " type=checkbox></td>";
  121. }
  122. //
  123. // Name of the Search Engine
  124. //
  125. resultstring = resultstring + "<td>" + SearchEng.Name + "</td>";
  126. for (var param = new Enumerator( SearchEng.Param(1033) ); !param.atEnd(); param.moveNext())
  127. {
  128. var ParamItem = param.item();
  129. resultstring = resultstring + "<td>" + ParamItem.Type + "</td><td>" + ParamItem.Display + "</td><td>" + ParamItem.Name + "</td><td>" + ParamItem.Required + "</td></tr>";
  130. }
  131. seCount++;
  132. }
  133. //
  134. // Print out the results
  135. //
  136. resultstring = resultstring + "</table>";
  137. sectrl.innerHTML = resultstring;
  138. </SCRIPT>
  139. </HTML>