Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-11-18 00:41:58 +0000
committerChris Goldthorpe2009-11-18 00:41:58 +0000
commit751d5a1cd189cfefe121cbe375576fa2928c6c0c (patch)
treee7fe4ba70e451efcd26322e534ffcbd9fec0f627
parentfff09e4e536d566af1708e5a85daa6f6da91bca1 (diff)
downloadeclipse.platform.ua-751d5a1cd189cfefe121cbe375576fa2928c6c0c.tar.gz
eclipse.platform.ua-751d5a1cd189cfefe121cbe375576fa2928c6c0c.tar.xz
eclipse.platform.ua-751d5a1cd189cfefe121cbe375576fa2928c6c0c.zip
Bug 293744 – [Webapp]Allow additional section to be added to the bar upside:
-rw-r--r--org.eclipse.help.webapp/advanced/helpToolbar.jsp39
-rw-r--r--org.eclipse.help.webapp/advanced/index.jsp6
-rw-r--r--org.eclipse.help.webapp/advanced/navActions.js4
-rw-r--r--org.eclipse.help.webapp/advanced/searchScoped.jsp16
-rw-r--r--org.eclipse.help.webapp/advanced/searchSimple.jsp16
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java35
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java45
-rw-r--r--org.eclipse.ua.tests/jsp/advanced/testHelpToolbarFrame.jsp59
-rw-r--r--org.eclipse.ua.tests/plugin.xml3
12 files changed, 210 insertions, 26 deletions
diff --git a/org.eclipse.help.webapp/advanced/helpToolbar.jsp b/org.eclipse.help.webapp/advanced/helpToolbar.jsp
new file mode 100644
index 000000000..c20b7c6f2
--- /dev/null
+++ b/org.eclipse.help.webapp/advanced/helpToolbar.jsp
@@ -0,0 +1,39 @@
+<%--
+ Copyright (c) 2009 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
+--%>
+<%@ include file="fheader.jsp"%>
+
+<%
+ LayoutData data = new LayoutData(application,request, response);
+ FrameData frameData = new FrameData(application,request, response);
+ WebappPreferences prefs = data.getPrefs();
+ AbstractFrame frame = frameData.getHelpToolbarFrame();
+%>
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title><%=ServletResources.getString("helpToolbarFrame", request)%></title>
+</head>
+<frameset id="helpToolbarFrameset" cols="<%=frameData.getHelpToolbarFrameSizes()%>" frameborder=0" framespacing="0" border="0" spacing="0">
+<% if (isRTL) {
+if(null != frame){%>
+ <frame name="<%=frame.getName()%>" src="<%= frameData.getUrl(frame) %>" <%=frame.getFrameAttributes()%> >
+<%}%>
+ <frame name="SearchFrame" title="<%=ServletResources.getString("SearchFrame", request)%>" src='<%="search.jsp"+UrlUtil.htmlEncode(data.getQuery())%>' marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize=0>
+<%} else {%>
+ <frame name="SearchFrame" title="<%=ServletResources.getString("SearchFrame", request)%>" src='<%="search.jsp"+UrlUtil.htmlEncode(data.getQuery())%>' marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize=0>
+<%if(null != frame){%>
+ <frame name="<%=frame.getName()%>" src="<%= frameData.getUrl(frame) %>" <%=frame.getFrameAttributes()%> >
+<%}
+}%>
+</frameset>
+</html>
+
diff --git a/org.eclipse.help.webapp/advanced/index.jsp b/org.eclipse.help.webapp/advanced/index.jsp
index 43a5be87e..35c63a759 100644
--- a/org.eclipse.help.webapp/advanced/index.jsp
+++ b/org.eclipse.help.webapp/advanced/index.jsp
@@ -43,7 +43,7 @@ function onloadHandler(e)
<% if (data.isIE() || data.isMozilla() && "1.2.1".compareTo(data.getMozillaVersion()) <=0){
%>
try {
- var h=window.SearchFrame.document.getElementById("searchLabel").offsetHeight; <%-- default 13 --%>
+ var h=window.HelpToolbarFrame.SearchFrame.document.getElementById("searchLabel").offsetHeight; <%-- default 13 --%>
if(h<=19){
// no need to resize up to 19px
} else {
@@ -62,7 +62,7 @@ if (data.isMozilla()){
<%
}
%>
- window.frames["SearchFrame"].document.getElementById("searchWord").focus();
+ window.HelpToolbarFrame.frames["SearchFrame"].document.getElementById("searchWord").focus();
}
</script>
@@ -76,7 +76,7 @@ if (data.isMozilla()){
<%
}
%>
- <frame name="SearchFrame" title="<%=ServletResources.getString("helpToolbarFrame", request)%>" src='<%="advanced/search.jsp"+UrlUtil.htmlEncode(data.getQuery())%>' marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize=0>
+ <frame name="HelpToolbarFrame" title="<%=ServletResources.getString("ignore", "HelpToolbarFrame", request)%>" src='<%="advanced/helpToolbar.jsp"+UrlUtil.htmlEncode(data.getQuery())%>' marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize=0>
<frame name="HelpFrame" title="<%=ServletResources.getString("ignore", "HelpFrame", request)%>" src='<%="advanced/help.jsp"+UrlUtil.htmlEncode(data.getQuery())%>' marginwidth="0" marginheight="0" scrolling="no" frameborder="0" >
<%
if(!("0".equals(data.getFooterHeight()))){
diff --git a/org.eclipse.help.webapp/advanced/navActions.js b/org.eclipse.help.webapp/advanced/navActions.js
index 17ab1649f..91e2f588e 100644
--- a/org.eclipse.help.webapp/advanced/navActions.js
+++ b/org.eclipse.help.webapp/advanced/navActions.js
@@ -137,7 +137,7 @@ function getWindowBounds(window) {
function getSearchWord() {
var navFrame = parent.parent.parent;
- var searchFrame = navFrame.parent.parent.frames["SearchFrame"];
+ var searchFrame = navFrame.parent.parent.HelpToolbarFrame.frames["SearchFrame"];
return searchFrame.document.forms["searchForm"].searchWord.value;
}
@@ -185,7 +185,7 @@ function searchFor(searchWord) {
query += treeItem.nodeid;
}
var navFrame = parent.parent.parent;
- var searchFrame = navFrame.parent.parent.frames["SearchFrame"];
+ var searchFrame = navFrame.parent.parent.HelpToolbarFrame.frames["SearchFrame"];
navFrame.showView('search');
var searchView = navFrame.ViewsFrame.search.searchViewFrame;
searchView.location.replace("searchView.jsp?"+query);
diff --git a/org.eclipse.help.webapp/advanced/searchScoped.jsp b/org.eclipse.help.webapp/advanced/searchScoped.jsp
index b70123da7..85f2ecbc7 100644
--- a/org.eclipse.help.webapp/advanced/searchScoped.jsp
+++ b/org.eclipse.help.webapp/advanced/searchScoped.jsp
@@ -208,15 +208,15 @@ function doSearch(query)
/******** HARD CODED VIEW NAME *********/
// do some tests to ensure the results are available
- if (parent.HelpFrame &&
- parent.HelpFrame.NavFrame &&
- parent.HelpFrame.NavFrame.showView &&
- parent.HelpFrame.NavFrame.ViewsFrame &&
- parent.HelpFrame.NavFrame.ViewsFrame.search &&
- parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame)
+ if (parent.parent.HelpFrame &&
+ parent.parent.HelpFrame.NavFrame &&
+ parent.parent.HelpFrame.NavFrame.showView &&
+ parent.parent.HelpFrame.NavFrame.ViewsFrame &&
+ parent.parent.HelpFrame.NavFrame.ViewsFrame.search &&
+ parent.parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame)
{
- parent.HelpFrame.NavFrame.showView("search");
- var searchView = parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame;
+ parent.parent.HelpFrame.NavFrame.showView("search");
+ var searchView = parent.parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame;
searchView.location.replace("searchView.jsp?"+query);
}
}
diff --git a/org.eclipse.help.webapp/advanced/searchSimple.jsp b/org.eclipse.help.webapp/advanced/searchSimple.jsp
index 00af1f47d..ce01c424d 100644
--- a/org.eclipse.help.webapp/advanced/searchSimple.jsp
+++ b/org.eclipse.help.webapp/advanced/searchSimple.jsp
@@ -163,15 +163,15 @@ function doSearch(query)
/******** HARD CODED VIEW NAME *********/
// do some tests to ensure the results are available
- if (parent.HelpFrame &&
- parent.HelpFrame.NavFrame &&
- parent.HelpFrame.NavFrame.showView &&
- parent.HelpFrame.NavFrame.ViewsFrame &&
- parent.HelpFrame.NavFrame.ViewsFrame.search &&
- parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame)
+ if (parent.parent.HelpFrame &&
+ parent.parent.HelpFrame.NavFrame &&
+ parent.parent.HelpFrame.NavFrame.showView &&
+ parent.parent.HelpFrame.NavFrame.ViewsFrame &&
+ parent.parent.HelpFrame.NavFrame.ViewsFrame.search &&
+ parent.parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame)
{
- parent.HelpFrame.NavFrame.showView("search");
- var searchView = parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame;
+ parent.parent.HelpFrame.NavFrame.showView("search");
+ var searchView = parent.parent.HelpFrame.NavFrame.ViewsFrame.search.searchViewFrame;
searchView.location.replace("searchView.jsp?"+query);
}
}
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 e6fbf8607..322dd9343 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
@@ -128,6 +128,7 @@ remotePreferencesMenuSelect=Window &gt Preferences &gt Help &gt Content
# Frame Titles
ignore=Layout frame: {0}
helpToolbarFrame=Main Help Toolbar
+SearchFrame=Search Toolbar
TabsFrame=Selection of Navigation Views
topicView=Topic View
topicViewToolbar=Topic View Toolbar
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java
index e05cb9758..3d1688827 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java
@@ -82,5 +82,40 @@ public class FrameData extends RequestData {
}
return size;
}
+
+ /**
+ * Get the additional frame added to the Main Help Toolbar
+ * Considering of the layout and space of Main Help Toolbar, only one extra frame is supported
+ *
+ * @return AbstractFrame or null if not found
+ */
+ public AbstractFrame getHelpToolbarFrame() {
+ AbstractFrame[] frames = getFrames(AbstractFrame.HELP_TOOLBAR);
+ if(frames.length > 0) {
+ if(frames.length > 1){
+ HelpWebappPlugin.logWarning("Only one extra frame is supported to be added to Help Toolbar. The first reterived element will be used."); //$NON-NLS-1$
+ }
+ return frames[0];
+ }else {
+ return null;
+ }
+ }
+
+ /**
+ * Get layout(frame sizes) of Main Help Toolbar
+ */
+ public String getHelpToolbarFrameSizes() {
+ String size = "*"; //$NON-NLS-1$
+ AbstractFrame frame = getHelpToolbarFrame();
+ if(null != frame) {
+ boolean isRTL = UrlUtil.isRTL(request, response);
+ if(isRTL) {
+ size = frame.getSize() + ", " + size; //$NON-NLS-1$
+ }else {
+ size = size + ", " + frame.getSize(); //$NON-NLS-1$
+ }
+ }
+ return size;
+ }
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java
index 666a0ce9b..c60661174 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java
@@ -20,18 +20,16 @@ public abstract class AbstractFrame implements Comparable {
/**
* Constant returned from getFrameLocation() function to indicate that
- * the frame should be created below the content frame. This is
- * currently the only supported location for extra frames.
+ * the frame should be created below the content frame or the Main Help Toolbar
*/
public static final int BELOW_CONTENT = 1;
+ public static final int HELP_TOOLBAR = 2;
/**
* Function which defines the frame location
* @return a constant defined in this class which indicates the location of this frame
*/
- public int getLocation() {
- return BELOW_CONTENT;
- }
+ public abstract int getLocation();
/**
*
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java
index 1daddc265..bf07d3b5e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java
@@ -25,6 +25,10 @@ public class TestFrame extends AbstractFrame {
return "/titlesearch/jsp/advanced/testFrame.jsp";
}
+ public int getLocation() {
+ return AbstractFrame.BELOW_CONTENT;
+ }
+
public String getSize() {
return "24";
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java
new file mode 100644
index 000000000..593c21460
--- /dev/null
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *******************************************************************************/
+
+package org.eclipse.ua.tests.help.webextension;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.help.webapp.AbstractFrame;
+import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
+
+public class TestHelpToolbarFrame extends AbstractFrame {
+
+ public String getName() {
+ return "testHelpToolbarFrame";
+ }
+
+ public String getURL() {
+ return "/titlesearch/jsp/advanced/testHelpToolbarFrame.jsp";
+ }
+
+ public int getLocation() {
+ return AbstractFrame.HELP_TOOLBAR;
+ }
+
+ public String getSize() {
+ return "*";
+ }
+
+ public String getFrameAttributes() {
+ return "\"marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\""; //$NON-NLS-1$
+ }
+
+ public boolean isVisible() {
+ return Platform.getPreferencesService().getBoolean
+ (UserAssistanceTestPlugin.getPluginId(), "extraFrame", false, null);
+ }
+
+}
diff --git a/org.eclipse.ua.tests/jsp/advanced/testHelpToolbarFrame.jsp b/org.eclipse.ua.tests/jsp/advanced/testHelpToolbarFrame.jsp
new file mode 100644
index 000000000..3e158bb7d
--- /dev/null
+++ b/org.eclipse.ua.tests/jsp/advanced/testHelpToolbarFrame.jsp
@@ -0,0 +1,59 @@
+<%--
+ Copyright (c) 2009 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
+--%>
+<%@
+page import="org.eclipse.help.internal.webapp.data.*" contentType="text/html; charset=UTF-8"
+%>
+<%@page import="org.eclipse.help.webapp.*" %>
+<%
+ request.setCharacterEncoding("UTF-8");
+ boolean isRTL = UrlUtil.isRTL(request, response);
+ String direction = isRTL?"rtl":"ltr";
+ FrameData data = new FrameData(application, request, response);
+ WebappPreferences prefs = data.getPrefs();
+%>
+<html>
+<head>
+<style type="text/css">
+/* need this one for Mozilla */
+HTML {
+ width:100%;
+ height:100%;
+ margin:0px;
+ padding:0px;
+ border:0px;
+ }
+
+BODY {
+ background:<%=prefs.getToolbarBackground()%>;
+ border:0px;
+ height:100%;
+}
+TABLE {
+ font: <%=prefs.getToolbarFont()%>;
+ background:<%=prefs.getToolbarBackground()%>;
+ margin: 0px;
+ padding: 0px;
+ height:100%;
+}
+
+</style>
+
+</head>
+<body dir="<%=direction %>">
+<table align ="<%=isRTL?"left":"right"%>">
+ <tr>
+ <td>
+ Hello, Guest!
+ </td>
+ </tr>
+</table>
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.ua.tests/plugin.xml b/org.eclipse.ua.tests/plugin.xml
index d1d49fced..1b7d5b57d 100644
--- a/org.eclipse.ua.tests/plugin.xml
+++ b/org.eclipse.ua.tests/plugin.xml
@@ -559,6 +559,9 @@
<frame
class="org.eclipse.ua.tests.help.webextension.TestFrame">
</frame>
+ <frame
+ class="org.eclipse.ua.tests.help.webextension.TestHelpToolbarFrame">
+ </frame>
</extension>
<extension
point="org.eclipse.equinox.http.registry.httpcontexts">

Back to the top