diff options
5 files changed, 161 insertions, 111 deletions
diff --git a/org.eclipse.help.webapp/advanced/indexView.js b/org.eclipse.help.webapp/advanced/indexView.js index 167bbce23..086cff0c2 100644 --- a/org.eclipse.help.webapp/advanced/indexView.js +++ b/org.eclipse.help.webapp/advanced/indexView.js @@ -20,6 +20,8 @@ var typein; var lines = 30; var firstEntry; var lastEntry; +var showAllChanged = false; +var showAll; /** * Set value of the typein input field. @@ -144,6 +146,17 @@ function loadChildren(startCharacters, mode, entry) { parameters += separator; parameters += "entry="; parameters += entry; + separator = "&"; + } + if (showAllChanged) { + showAllChanged = false; + parameters += separator; + parameters += "showAll=" + if (showAll) { + parameters += "on"; + } else { + parameters += "off"; + } } makeNodeRequest(parameters); } @@ -221,6 +234,15 @@ function loadNextPage() { } } +function loadCurrentPage() { + getFirstAndLast(); + if (firstEntry && firstEntry > 0) { + loadChildren("", "next", firstEntry - 1); + } else { + loadChildren(""); + } +} + function onShow() { sizeList(); if (!shown) { @@ -230,6 +252,15 @@ function onShow() { } } +function setShowAll(isShowAll) { + showAll = isShowAll; + showAllChanged = true; + if (shown) { + // Only refresh if we are already showing + loadCurrentPage(); + } +} + /* * Function called when the typein value may have changed */ diff --git a/org.eclipse.help.webapp/advanced/indexView.jsp b/org.eclipse.help.webapp/advanced/indexView.jsp index 1ae2bb6f3..db1ddbbec 100644 --- a/org.eclipse.help.webapp/advanced/indexView.jsp +++ b/org.eclipse.help.webapp/advanced/indexView.jsp @@ -14,7 +14,7 @@ <%@ include file="fheader.jsp"%> <% - RequestData requestData = new RequestData(application,request, response); + RequestData requestData = new ActivitiesData(application,request, response); WebappPreferences prefs = requestData.getPrefs(); %> diff --git a/org.eclipse.help.webapp/advanced/views.js b/org.eclipse.help.webapp/advanced/views.js new file mode 100644 index 000000000..40ae1d4c2 --- /dev/null +++ b/org.eclipse.help.webapp/advanced/views.js @@ -0,0 +1,119 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + + var lastView = ""; +/** + * Switches to specified view + */ +function showView(view) +{ + if (view == lastView) + return; + + lastView = view; + + // show appropriate frame + var iframes = parent.ViewsFrame.document.body.getElementsByTagName("IFRAME"); + for (var i=0; i<iframes.length; i++) + { + if (iframes[i].id != view){ + iframes[i].className = "hidden"; + iframes[i].style.visibility="hidden"; + }else{ + iframes[i].className = "visible"; + iframes[i].style.visibility="visible"; + try { + iframes[i].contentWindow.onShow(); + } catch(ex) {} + } + } +} + +var regExp=/&(showAll|synch)=(on|off|yes|no)/gi; +function toggleShowAll(){ + if(activityFiltering){ + if( displayShowAllConfirmation ){ + confirmShowAll(); + }else{ + showAll(); + } + } else { + dontShowAll(); + } +} + +function dontAskAgain(){ + displayShowAllConfirmation = false; +} +function showAll(){ + var displayConfirmParam; + if(displayShowAllConfirmation){ + displayConfirmParam=""; + }else{ + displayConfirmParam="&showconfirm=false"; + } + activityFiltering=false; + try{ + window.frames.toc.tocToolbarFrame.setButtonState("show_all", true); + }catch(ex) {} + try{ + window.frames.index.indexToolbarFrame.setButtonState("show_all", true); + }catch(ex) {} + try{ + window.frames.search.searchToolbarFrame.setButtonState("show_all", true); + }catch(ex) {} + try{ + var newUrl = window.frames.toc.tocViewFrame.location.href.replace(regExp, "")+"&showAll=on"+displayConfirmParam; + window.frames.toc.tocViewFrame.setShowAll(true, newUrl); + }catch(ex) {} + try{ + window.frames.index.indexViewFrame.setShowAll(true); + }catch(ex) {} + try{ + window.frames.search.searchViewFrame.location.replace(window.frames.search.searchViewFrame.location.href.replace(regExp, "")+"&showAll=on"); + }catch(ex) {} +} + +function dontShowAll(){ + activityFiltering=true; + try{ + window.frames.toc.tocToolbarFrame.setButtonState("show_all", false); + }catch(ex) {} + try{ + window.frames.index.indexToolbarFrame.setButtonState("show_all", false); + }catch(ex) {} + try{ + window.frames.search.searchToolbarFrame.setButtonState("show_all", false); + }catch(ex) {} + try{ + var newUrl = window.frames.toc.tocViewFrame.location.href.replace(regExp, "")+"&showAll=off"; + window.frames.toc.tocViewFrame.setShowAll(false, newUrl); + }catch(ex) {} + try{ + window.frames.index.indexViewFrame.setShowAll(false); + }catch(ex) {} + try{ + window.frames.search.searchViewFrame.location.replace(window.frames.search.searchViewFrame.location.href.replace(regExp, "")+"&showAll=off"); + }catch(ex) {} +} + +function closeConfirmShowAllDialog(){ + try { + if (confirmShowAllDialog){ + confirmShowAllDialog.close(); + } + } + catch(e) {} +} + +var confirmShowAllDialog; +var w = 470; +var h = 240;
\ No newline at end of file diff --git a/org.eclipse.help.webapp/advanced/views.jsp b/org.eclipse.help.webapp/advanced/views.jsp index 44fbdd867..73ad21297 100644 --- a/org.eclipse.help.webapp/advanced/views.jsp +++ b/org.eclipse.help.webapp/advanced/views.jsp @@ -59,110 +59,11 @@ IFRAME { } </style> - +<script language="JavaScript" src="views.js"></script> <script language="Javascript"> -var lastView = ""; -/** - * Switches to specified view - */ -function showView(view) -{ - if (view == lastView) - return; - - lastView = view; - - // show appropriate frame - var iframes = parent.ViewsFrame.document.body.getElementsByTagName("IFRAME"); - for (var i=0; i<iframes.length; i++) - { - if (iframes[i].id != view){ - iframes[i].className = "hidden"; - iframes[i].style.visibility="hidden"; - }else{ - iframes[i].className = "visible"; - iframes[i].style.visibility="visible"; - try { - iframes[i].contentWindow.onShow(); - } catch(ex) {} - } - } -} - var activityFiltering = <%=(new ActivitiesData(application, request, response)).isActivityFiltering()?"true":"false"%>; var displayShowAllConfirmation = <%=prefs.isDontConfirmShowAll()?"false":"true"%>; -var regExp=/&(showAll|synch)=(on|off|yes|no)/gi; -function toggleShowAll(){ - if(activityFiltering){ - if( displayShowAllConfirmation ){ - confirmShowAll(); - }else{ - showAll(); - } - } else { - dontShowAll(); - } -} - -function dontAskAgain(){ - displayShowAllConfirmation = false; -} -function showAll(){ - var displayConfirmParam; - if(displayShowAllConfirmation){ - displayConfirmParam=""; - }else{ - displayConfirmParam="&showconfirm=false"; - } - activityFiltering=false; - try{ - window.frames.toc.tocToolbarFrame.setButtonState("show_all", true); - }catch(ex) {} - try{ - window.frames.index.indexToolbarFrame.setButtonState("show_all", true); - }catch(ex) {} - try{ - window.frames.search.searchToolbarFrame.setButtonState("show_all", true); - }catch(ex) {} - try{ - var newUrl = window.frames.toc.tocViewFrame.location.href.replace(regExp, "")+"&showAll=on"+displayConfirmParam; - window.frames.toc.tocViewFrame.setShowAll(true, newUrl); - }catch(ex) {} - try{ - window.frames.index.indexViewFrame.location.replace(window.frames.index.indexViewFrame.location.href.replace(regExp, "")+"&showAll=on"+displayConfirmParam); - }catch(ex) {} - try{ - window.frames.search.searchViewFrame.location.replace(window.frames.search.searchViewFrame.location.href.replace(regExp, "")+"&showAll=on"); - }catch(ex) {} -} - -function dontShowAll(){ - activityFiltering=true; - try{ - window.frames.toc.tocToolbarFrame.setButtonState("show_all", false); - }catch(ex) {} - try{ - window.frames.index.indexToolbarFrame.setButtonState("show_all", false); - }catch(ex) {} - try{ - window.frames.search.searchToolbarFrame.setButtonState("show_all", false); - }catch(ex) {} - try{ - var newUrl = window.frames.toc.tocViewFrame.location.href.replace(regExp, "")+"&showAll=off"; - window.frames.toc.tocViewFrame.setShowAll(false, newUrl); - }catch(ex) {} - try{ - window.frames.index.indexViewFrame.location.replace(window.frames.index.indexViewFrame.location.href.replace(regExp, "")+"&showAll=off"); - }catch(ex) {} - try{ - window.frames.search.searchViewFrame.location.replace(window.frames.search.searchViewFrame.location.href.replace(regExp, "")+"&showAll=off"); - }catch(ex) {} -} - -var confirmShowAllDialog; -var w = 470; -var h = 240; function confirmShowAll() { @@ -187,15 +88,6 @@ if (data.isIE()){ confirmShowAllDialog.focus(); } -function closeConfirmShowAllDialog(){ - try { - if (confirmShowAllDialog){ - confirmShowAllDialog.close(); - } - } - catch(e) {} -} - </script> </head> diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java index 9e7520cdc..65e3e5a60 100644 --- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java +++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java @@ -28,6 +28,7 @@ import org.eclipse.help.ITopic; import org.eclipse.help.internal.HelpPlugin; import org.eclipse.help.internal.base.BaseHelpSystem; import org.eclipse.help.internal.webapp.WebappResources; +import org.eclipse.help.internal.webapp.data.ActivitiesData; import org.eclipse.help.internal.webapp.data.EnabledTopicUtils; import org.eclipse.help.internal.webapp.data.UrlUtil; @@ -47,6 +48,7 @@ public class IndexFragmentServlet extends HttpServlet { private String sizeParameter; private String entryParameter; private String modeParameter; + private String showAllParameter; private int size; private int entry; private static final String NEXT = "next"; //$NON-NLS-1$ @@ -54,6 +56,7 @@ public class IndexFragmentServlet extends HttpServlet { private static final String SIZE = "size"; //$NON-NLS-1$ private static final String MODE = "mode"; //$NON-NLS-1$ private static final String ENTRY = "entry"; //$NON-NLS-1$ + private static final String SHOW_ALL = "showAll"; //$NON-NLS-1$ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -80,8 +83,13 @@ public class IndexFragmentServlet extends HttpServlet { } catch (NumberFormatException n) { } } - + modeParameter = req.getParameter(MODE); + showAllParameter = req.getParameter(SHOW_ALL); + if (showAllParameter != null) { + // Use activities data to toggle the show all state + new ActivitiesData(this.getServletContext(), req, resp); + } req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$ resp.setContentType("application/xml; charset=UTF-8"); //$NON-NLS-1$ |