diff options
author | Chris Goldthorpe | 2010-02-26 19:44:38 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2010-02-26 19:44:38 +0000 |
commit | f8678d6fe61c4a9e6e17da0ecaee46e3f4a97379 (patch) | |
tree | 32ddbe15fbe0570894069238a0faaf3f4099281b /org.eclipse.help.webapp | |
parent | 6ec21e39ea6fbd94f6db05585cff54f78503a637 (diff) | |
download | eclipse.platform.ua-f8678d6fe61c4a9e6e17da0ecaee46e3f4a97379.tar.gz eclipse.platform.ua-f8678d6fe61c4a9e6e17da0ecaee46e3f4a97379.tar.xz eclipse.platform.ua-f8678d6fe61c4a9e6e17da0ecaee46e3f4a97379.zip |
Bug 303970 - [Webapp] Always filter by search scope
Diffstat (limited to 'org.eclipse.help.webapp')
5 files changed, 65 insertions, 54 deletions
diff --git a/org.eclipse.help.webapp/advanced/searchScoped.jsp b/org.eclipse.help.webapp/advanced/searchScoped.jsp index 25c094bc6..29b8caa72 100644 --- a/org.eclipse.help.webapp/advanced/searchScoped.jsp +++ b/org.eclipse.help.webapp/advanced/searchScoped.jsp @@ -1,5 +1,5 @@ <%-- - Copyright (c) 2000, 2009 IBM Corporation and others. + Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at @@ -199,8 +199,10 @@ function closeAdvanced() * This function can be called from this page or from * the advanced search page. When called from the advanced * search page, a query is passed. + * noRefocus is a boolean which if true suppresses + * switch of focus to the search view */ -function doSearch(query) +function doSearch(query, noRefocus) { var workingSet = document.getElementById("scope").firstChild.nodeValue; @@ -225,12 +227,31 @@ function doSearch(query) parent.parent.HelpFrame.NavFrame.ViewsFrame.search && parent.parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame) { - parent.parent.HelpFrame.NavFrame.showView("search"); + if (!noRefocus) { + parent.parent.HelpFrame.NavFrame.showView("search"); + } var searchView = parent.parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame; searchView.location.replace("searchView.jsp?"+query); } } +function rescope() { + if (parent.parent.HelpFrame && + parent.parent.HelpFrame.NavFrame && + parent.parent.HelpFrame.NavFrame.ViewsFrame) { + var viewsFrame = parent.parent.HelpFrame.NavFrame.ViewsFrame; + if (viewsFrame.toc && viewsFrame.toc.tocViewFrame) { + var tocView = viewsFrame.toc.tocViewFrame; + tocView.location.replace("tocView.jsp"); + } + if (viewsFrame.toc && viewsFrame.index.indexViewFrame) { + var indexView = viewsFrame.index.indexViewFrame; + indexView.location.replace("indexView.jsp"); + } + doSearch(null, true); + } +} + function fixHeights() { if (!isIE) return; @@ -244,6 +265,13 @@ function onloadHandler(e) var form = document.forms["searchForm"]; form.searchWord.value = '<%=UrlUtil.JavaScriptEncode(data.getSearchWord())%>'; fixHeights(); +<% + if (data.isScopeRequest() && RequestScope.filterBySearchScope(request)) { +%> + rescope(); +<% + } +%> } </script> diff --git a/org.eclipse.help.webapp/advanced/workingSetManager.jsp b/org.eclipse.help.webapp/advanced/workingSetManager.jsp index 3a48c4fe5..48f052e8d 100644 --- a/org.eclipse.help.webapp/advanced/workingSetManager.jsp +++ b/org.eclipse.help.webapp/advanced/workingSetManager.jsp @@ -186,20 +186,13 @@ function selectWorkingSet() { if (searchWord) search += "&searchWord="+encodeURIComponent(searchWord); -<% - if (RequestScope.filterBySearchScope(request)) { -%> - try { - window.opener.parent.parent.HelpFrame.NavFrame.ViewsFrame.window.location.replace("views.jsp"); - } catch(e) {} -<% } %> window.opener.location.replace( window.opener.location.protocol + "//" + window.opener.location.host + window.opener.location.pathname + search); - + window.close(); return false; } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties index 231917126..b1209b071 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties @@ -84,24 +84,24 @@ bookmarks=Bookmarks Views=Navigation Views noLiveHelp=Active help is not enabled in your installation. noLiveHelpInInfocenter=You must run help locally to perform "active help" actions. -cookieSaveFailed=Saving search scope failed. Please reduce search scope definitions. +cookieSaveFailed=Saving scope failed. Please reduce scope definitions. CookieUtil.tooManyCookiesNeeded=Too may cookies required to store data. cookiesRequired=This feature requires cookies to be enabled in your browser. All=All topics -selectAll=Search &all topics -selectWorkingSet=Search only the following &topics: -SelectWorkingSetTitle=Select Search Scope +selectAll=Show &all topics +selectWorkingSet=Show only the following &topics: +SelectWorkingSetTitle=Select Scope NewWorkingSetButton=&New... EditWorkingSetButton=&Edit... RemoveWorkingSetButton=&Remove OK=OK -NewWorkingSet=New Search List -EditWorkingSet=Edit Search List +NewWorkingSet=New Scope +EditWorkingSet=Edit Scope WorkingSetName=List &name: WorkingSetContent=Topics to search -Scope=Search scope: -ScopeTooltip=Select Search Scope +Scope=Scope: +ScopeTooltip=Select Scope DefaultScopeName=scope #Confirm Show All Topics dialog diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java index a2d0826e5..fece32020 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java @@ -62,7 +62,7 @@ public class RequestScope { } public static AbstractHelpScope[] getActiveScopes(HttpServletRequest req, - HttpServletResponse resp, boolean allowSearchScope) { + HttpServletResponse resp, boolean isSearchFilter) { AbstractHelpScope[] scopeArray; String scopeString; List scopes = new ArrayList(); @@ -73,28 +73,26 @@ public class RequestScope { if (scopeString != null) { StringTokenizer tokenizer = new StringTokenizer(scopeString, "/"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { - String nextScope = tokenizer.nextToken().trim(); - if (ScopeRegistry.SEARCH_SCOPE_SCOPE_ID.equals(nextScope)) { - if (!allowSearchScope) { - // Try for a working set - try { - WebappWorkingSetManager manager = new WebappWorkingSetManager(req, - resp, UrlUtil.getLocale(req, resp)); - String wset = manager.getCurrentWorkingSet(); - WorkingSetScope workingSetScope = new WorkingSetScope( - wset, manager, HelpBaseResources.SearchScopeFilterName); - scopes.add(workingSetScope); - } catch (Exception e) { - } - } - } else { - AbstractHelpScope scope = ScopeRegistry.getInstance().getScope(nextScope); - if (scope != null) { - scopes.add(scope); - } + String nextScope = tokenizer.nextToken().trim(); + AbstractHelpScope scope = ScopeRegistry.getInstance().getScope(nextScope); + if (scope != null) { + scopes.add(scope); } } } + // Add filter by search scope + if (!isSearchFilter) { + // Try for a working set + try { + WebappWorkingSetManager manager = new WebappWorkingSetManager(req, + resp, UrlUtil.getLocale(req, resp)); + String wset = manager.getCurrentWorkingSet(); + WorkingSetScope workingSetScope = new WorkingSetScope( + wset, manager, HelpBaseResources.SearchScopeFilterName); + scopes.add(workingSetScope); + } catch (Exception e) { + } + } scopeArray = (AbstractHelpScope[]) scopes.toArray(new AbstractHelpScope[scopes.size()]); return scopeArray; } @@ -173,17 +171,7 @@ public class RequestScope { } public static boolean filterBySearchScope(HttpServletRequest request) { - String scopeString = getScopeString(request); - if (scopeString != null) { - StringTokenizer tokenizer = new StringTokenizer(scopeString, "/"); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - String nextScope = tokenizer.nextToken().trim(); - if (ScopeRegistry.SEARCH_SCOPE_SCOPE_ID.equals(nextScope)) { - return true; - } - } - } - return false; + return true; } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java index ca7261159..290e6ee42 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java @@ -85,6 +85,11 @@ public class SearchData extends ActivitiesData { topicHref = null; searchWord = request.getParameter("searchWord"); //$NON-NLS-1$ + + if (isScopeRequest()) { + workingSetName = request.getParameter("workingSet"); //$NON-NLS-1$ + saveWorkingSet(workingSetName); + } // try loading search results or get the indexing progress info. if (isSearchRequest() && !isScopeRequest()) { @@ -300,10 +305,7 @@ public class SearchData extends ActivitiesData { if (workingSetName != null) return workingSetName; - if (isScopeRequest()) { - workingSetName = request.getParameter("workingSet"); //$NON-NLS-1$ - saveWorkingSet(workingSetName); - } else if (isSearchRequest()) { + if (isSearchRequest()) { workingSetName = request.getParameter("scope"); //$NON-NLS-1$ // if we have already set the working set, then use it. if (workingSetName == null) { |