home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2006 April / DPPRO0406DVD.ISO / Essentials / Programming / Eclipse SDK / eclipse-SDK-3.1.1-win32.exe / eclipse / plugins / org.eclipse.help.webapp_3.1.0 / advanced / searchSimple.jsp < prev    next >
Encoding:
Text File  |  2005-09-29  |  5.6 KB  |  226 lines

  1. <%--
  2.  Copyright (c) 2000, 2004 IBM Corporation and others.
  3.  All rights reserved. This program and the accompanying materials 
  4.  are made available under the terms of the Eclipse Public License v1.0
  5.  which accompanies this distribution, and is available at
  6.  http://www.eclipse.org/legal/epl-v10.html
  7.  
  8.  Contributors:
  9.      IBM Corporation - initial API and implementation
  10. --%>
  11. <%@ include file="header.jsp"%>
  12.  
  13. <% 
  14.     SearchData data = new SearchData(application, request, response);
  15.     WebappPreferences prefs = data.getPrefs();
  16. %>
  17.  
  18.  
  19. <html>
  20. <head>
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  22.  
  23. <title><%=ServletResources.getString("Search", request)%></title>
  24.      
  25. <style type="text/css">
  26. /* need this one for Mozilla */
  27. HTML { 
  28.     width:100%;
  29.     height:100%;
  30.     margin:0px;
  31.     padding:0px;
  32.     border:0px;
  33.  }
  34.  
  35. BODY {
  36.     background:<%=prefs.getToolbarBackground()%>;
  37.     border:0px;
  38.     text:white;
  39.     height:100%;
  40. }
  41.  
  42. TABLE {
  43.     font: <%=prefs.getToolbarFont()%>;
  44.     background:<%=prefs.getToolbarBackground()%>;
  45.     margin: 0px;
  46.     padding: 0px;
  47.     height:100%;
  48. }
  49.  
  50. FORM {
  51.     background:<%=prefs.getToolbarBackground()%>;
  52.     height:100%;
  53.     margin:0px;
  54. }
  55.  
  56. INPUT {
  57.     font: <%=prefs.getToolbarFont()%>;
  58.     margin:0px;
  59.     padding:0px;
  60. }
  61.  
  62.  
  63. #searchTable {
  64.     padding-<%=isRTL?"right":"left"%>:5;
  65. }
  66.  
  67. #searchWord {    
  68.     padding-left:4px;
  69.     padding-right:4px;
  70.     border:1px solid ThreeDShadow;
  71. }
  72.  
  73. #go {
  74.     background:ThreeDShadow;
  75.     color:Window;
  76.     font-weight:bold;
  77.     border:1px solid ThreeDShadow;
  78. }
  79.  
  80.  
  81. #advanced {
  82.     text-decoration:underline; 
  83.     text-align:<%=isRTL?"left":"right"%>;
  84.     color:#0066FF; 
  85.     cursor:hand;
  86.     margin-<%=isRTL?"right":"left"%>:4px;
  87.     border:0px;
  88. }
  89.  
  90. <%
  91.     if (data.isIE()) {
  92. %>
  93. #go {
  94.     padding-<%=isRTL?"right":"left"%>:1px;
  95. }
  96. <%
  97.     }
  98. %>
  99. </style>
  100.  
  101. <script language="JavaScript">
  102. var isIE = navigator.userAgent.indexOf('MSIE') != -1;
  103. var isMozilla = navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && parseInt(navigator.appVersion.substring(0,1)) >= 5;
  104.  
  105. <%
  106.     String[] selectedBooks = data.getSelectedTocs();
  107. %>
  108. // create list of books initilize selectedBooks variable used by advances search
  109. var selectedBooks = new Array(<%=selectedBooks.length%>);
  110. <%
  111. for (int i=0; i<selectedBooks.length; i++) 
  112. {
  113. %>
  114.     selectedBooks[<%=i%>] = "<%=UrlUtil.JavaScriptEncode(selectedBooks[i])%>";
  115. <%
  116. }
  117. %>
  118.  
  119. var advancedDialog;
  120. var w = 400;
  121. var h = 300;
  122.  
  123. function saveSelectedBooks(books)
  124. {
  125.     selectedBooks = new Array(books.length);
  126.     for (var i=0; i<selectedBooks.length; i++){
  127.         selectedBooks[i] = new String(books[i]);
  128.     }
  129. }
  130.  
  131. function openAdvanced()
  132. {
  133.     window.location="javascript://needModal";
  134.     advancedDialog = window.open("advanced.jsp?searchWord="+encodeURIComponent(document.getElementById("searchWord").value), "advancedDialog", "resizeable=no,height="+h+",width="+w );
  135.     advancedDialog.focus(); 
  136. }
  137.  
  138. function closeAdvanced()
  139. {
  140.     try {
  141.         if (advancedDialog)
  142.             advancedDialog.close();
  143.     }
  144.     catch(e) {}
  145. }
  146.  
  147. /**
  148.  * This function can be called from this page or from
  149.  * the advanced search page. When called from the advanced
  150.  * search page, a query is passed.
  151.  */
  152. function doSearch(query)
  153. {
  154.     if (!query || query == "")
  155.     {
  156.         var form = document.forms["searchForm"];
  157.         var searchWord = form.searchWord.value;
  158.         var maxHits = form.maxHits.value;
  159.         if (!searchWord || searchWord == "")
  160.             return;
  161.         query ="searchWord="+encodeURIComponent(searchWord)+"&maxHits="+maxHits;
  162.     }
  163.         
  164.     /******** HARD CODED VIEW NAME *********/
  165.     // do some tests to ensure the results are available
  166.     if (parent.HelpFrame && 
  167.         parent.HelpFrame.NavFrame && 
  168.         parent.HelpFrame.NavFrame.showView &&
  169.         parent.HelpFrame.NavFrame.ViewsFrame && 
  170.         parent.HelpFrame.NavFrame.ViewsFrame.search && 
  171.         parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame) 
  172.     {
  173.         parent.HelpFrame.NavFrame.showView("search");
  174.         var searchView = parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame;
  175.         searchView.location.replace("searchView.jsp?"+query);
  176.     }
  177. }
  178.  
  179. function fixHeights()
  180. {
  181.     if (!isIE) return;
  182.     
  183.     var h = document.getElementById("searchWord").offsetHeight;
  184.     document.getElementById("go").style.height = h;
  185. }
  186.  
  187. function onloadHandler(e)
  188. {
  189.     var form = document.forms["searchForm"];
  190.     form.searchWord.value = '<%=UrlUtil.JavaScriptEncode(data.getSearchWord())%>';
  191.     fixHeights();
  192. }
  193.  
  194. </script>
  195.  
  196. </head>
  197.  
  198. <body dir="<%=direction%>" onload="onloadHandler()"  onunload="closeAdvanced()">
  199.  
  200.     <form  name="searchForm"   onsubmit="doSearch()">
  201.         <table id="searchTable" align="<%=isRTL?"right":"left"%>" valign="middle" cellspacing="0" cellpadding="0" border="0">
  202.             <tr nowrap  valign="middle">
  203.                 <td <%=isRTL?"nowrap":""%>>
  204.                     <label id="searchLabel" for="searchWord" accesskey="<%=ServletResources.getAccessKey("Search", request)%>">
  205.                      <%=ServletResources.getLabel("Search", request)%>:
  206.                     </label>
  207.                 </td>
  208.                 <td>
  209.                     <input type="text" id="searchWord" name="searchWord" value='' size="20" maxlength="256" alt='<%=ServletResources.getString("SearchExpression", request)%>' title='<%=ServletResources.getString("SearchExpression", request)%>'>
  210.                 </td>
  211.                 <td >
  212.                      <input type="button" onclick="this.blur();doSearch()" value='<%=ServletResources.getString("GO", request)%>' id="go" alt='<%=ServletResources.getString("GO", request)%>' title='<%=ServletResources.getString("GO", request)%>'>
  213.                     <input type="hidden" name="maxHits" value="500" >
  214.                 </td>
  215.                 <td nowrap>
  216.                     <a id="advanced" href="javascript:openAdvanced();" alt='<%=ServletResources.getString("Advanced", request)%>' title='<%=ServletResources.getString("Advanced", request)%>' onmouseover="window.status='<%=ServletResources.getString("Advanced", request)%>'; return true;" onmouseout="window.status='';"><%=ServletResources.getString("Advanced", request)%></a> 
  217.                 </td>
  218.             </tr>
  219.  
  220.         </table>
  221.     </form>        
  222.  
  223. </body>
  224. </html>
  225.  
  226.