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 / searchScoped.jsp < prev    next >
Encoding:
Text File  |  2005-09-29  |  6.3 KB  |  248 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. A {
  63.     color:WindowText;
  64.     text-decoration:none;
  65. }
  66.  
  67. #searchTD {
  68.     padding-<%=isRTL?"right":"left"%>:7px;
  69.     padding-<%=isRTL?"left":"right"%>:4px;
  70. }
  71.  
  72. #searchWord {
  73.     padding-left:4px;
  74.     padding-right:4px;
  75.     border:1px solid ThreeDShadow;
  76. }
  77.  
  78. #searchLabel {
  79.     color:WindowText;
  80. }
  81.  
  82. #go {
  83.     background:ThreeDShadow;
  84.     color:Window;
  85.     font-weight:bold;
  86.     border:1px solid ThreeDShadow;
  87.     margin-left:1px;
  88. }
  89.  
  90. #scopeLabel {
  91.     text-decoration:underline; 
  92.     color:#0066FF; 
  93.     cursor:hand;
  94.     padding-left:15px;   /* This should be the same for both RTL and LTR. */
  95. }
  96.  
  97. #scope { 
  98.     text-align:<%=isRTL?"left":"right"%>;
  99.     margin-<%=isRTL?"right":"left"%>:5px;
  100.     border:0px;
  101.     color:WindowText;
  102.     text-decoration:none;
  103. }
  104.  
  105. <%
  106.     if (data.isIE()) {
  107. %>
  108. #go {
  109.     padding-<%=isRTL?"right":"left"%>:1px;
  110. }
  111. <%
  112.     }
  113. %>
  114. </style>
  115.  
  116. <script language="JavaScript">
  117. var isIE = navigator.userAgent.indexOf('MSIE') != -1;
  118. var isMozilla = navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && parseInt(navigator.appVersion.substring(0,1)) >= 5;
  119.  
  120. var advancedDialog;
  121. var w = 300;
  122. var h = 300;
  123.  
  124. function openAdvanced()
  125. {
  126.     var scope = document.getElementById("scope").firstChild;
  127.     var workingSet = "";
  128.     if (scope != null)
  129.          workingSet = document.getElementById("scope").firstChild.nodeValue;
  130.          
  131. <%
  132. if (data.isIE()){
  133. %>
  134.     var l = top.screenLeft + (top.document.body.clientWidth - w) / 2;
  135.     var t = top.screenTop + (top.document.body.clientHeight - h) / 2;
  136. <%
  137. } else {
  138. %>
  139.     var l = top.screenX + (top.innerWidth - w) / 2;
  140.     var t = top.screenY + (top.innerHeight - h) / 2;
  141. <%
  142. }
  143. %>
  144.     // move the dialog just a bit higher than the middle
  145.     if (t-50 > 0) t = t-50;
  146.     
  147.     window.location="javascript://needModal";
  148.     advancedDialog = window.open("workingSetManager.jsp?workingSet="+encodeURIComponent(workingSet), "advancedDialog", "resizeable=no,height="+h+",width="+w+",left="+l+",top="+t );
  149.     advancedDialog.focus(); 
  150. }
  151.  
  152. function closeAdvanced()
  153. {
  154.     try {
  155.         if (advancedDialog)
  156.             advancedDialog.close();
  157.     }
  158.     catch(e) {}
  159. }
  160.  
  161. /**
  162.  * This function can be called from this page or from
  163.  * the advanced search page. When called from the advanced
  164.  * search page, a query is passed.
  165.  */
  166. function doSearch(query)
  167. {
  168.     var workingSet = document.getElementById("scope").firstChild.nodeValue;
  169.  
  170.     if (!query || query == "")
  171.     {
  172.         var form = document.forms["searchForm"];
  173.         var searchWord = form.searchWord.value;
  174.         var maxHits = form.maxHits.value;
  175.         if (!searchWord || searchWord == "")
  176.             return;
  177.         query ="searchWord="+encodeURIComponent(searchWord)+"&maxHits="+maxHits;
  178.         if (workingSet != '<%=ServletResources.getString("All", request)%>')
  179.             query = query +"&scope="+encodeURIComponent(workingSet);
  180.     }
  181.         
  182.     /******** HARD CODED VIEW NAME *********/
  183.     // do some tests to ensure the results are available
  184.     if (parent.HelpFrame && 
  185.         parent.HelpFrame.NavFrame && 
  186.         parent.HelpFrame.NavFrame.showView &&
  187.         parent.HelpFrame.NavFrame.ViewsFrame && 
  188.         parent.HelpFrame.NavFrame.ViewsFrame.search && 
  189.         parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame) 
  190.     {
  191.         parent.HelpFrame.NavFrame.showView("search");
  192.         var searchView = parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame;
  193.         searchView.location.replace("searchView.jsp?"+query);
  194.     }
  195. }
  196.  
  197. function fixHeights()
  198. {
  199.     if (!isIE) return;
  200.     
  201.     var h = document.getElementById("searchWord").offsetHeight;
  202.     document.getElementById("go").style.height = h;
  203. }
  204.  
  205. function onloadHandler(e)
  206. {
  207.     var form = document.forms["searchForm"];
  208.     form.searchWord.value = '<%=UrlUtil.JavaScriptEncode(data.getSearchWord())%>';
  209.     fixHeights();
  210. }
  211.  
  212. </script>
  213.  
  214. </head>
  215.  
  216. <body dir="<%=direction%>" onload="onloadHandler()"  onunload="closeAdvanced()">
  217.  
  218.     <form  name="searchForm"   onsubmit="doSearch()">
  219.         <table id="searchTable" align="<%=isRTL?"right":"left"%>" valign="middle" cellspacing="0" cellpadding="0" border="0">
  220.             <tr nowrap  valign="middle">
  221.                 <td <%=isRTL?"nowrap":""%> id="searchTD">
  222.                     <label id="searchLabel" for="searchWord" accesskey="<%=ServletResources.getAccessKey("Search", request)%>">
  223.                      <%=ServletResources.getLabel("Search", request)%>:
  224.                     </label>
  225.                 </td>
  226.                 <td>
  227.                     <input type="text" id="searchWord" name="searchWord" value='' size="24" maxlength="256" alt='<%=ServletResources.getString("SearchExpression", request)%>' title='<%=ServletResources.getString("SearchExpression", request)%>'>
  228.                 </td>
  229.                 <td >
  230.                      <input type="button" onclick="this.blur();doSearch()" value='<%=ServletResources.getString("GO", request)%>' id="go" alt='<%=ServletResources.getString("GO", request)%>' title='<%=ServletResources.getString("GO", request)%>'>
  231.                     <input type="hidden" name="maxHits" value="500" >
  232.                 </td>
  233.                 <td nowrap>
  234.                     <a id="scopeLabel" href="javascript:openAdvanced();" title='<%=ServletResources.getString("ScopeTooltip", request)%>' alt='<%=ServletResources.getString("ScopeTooltip", request)%>' onmouseover="window.status='<%=ServletResources.getString("ScopeTooltip", request)%>'; return true;" onmouseout="window.status='';"><%=ServletResources.getLabel("Scope", request)%>:</a>
  235.                 </td>
  236.                 <td nowrap>
  237.                     <input type="hidden" name="workingSet" value='<%=data.getScope()%>'>
  238.                     <div id="scope" ><%=data.getScope()%></div>
  239.                 </td>
  240.             </tr>
  241.  
  242.         </table>
  243.     </form>        
  244.  
  245. </body>
  246. </html>
  247.  
  248.