From 2cf6fcb31e85b0e3b367121219932ec86b205da8 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 5 Nov 2008 14:42:05 +0000 Subject: help jsp git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@151 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 2 +- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 45 +++++++++------------- BKUOnline/src/main/webapp/WEB-INF/web.xml | 11 ++++-- BKUOnline/src/main/webapp/appletPage.jsp | 2 +- BKUOnline/src/main/webapp/help.jsp | 7 ++++ BKUOnline/src/main/webapp/helpfiles/index.html | 17 ++++++++ 6 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 BKUOnline/src/main/webapp/help.jsp create mode 100644 BKUOnline/src/main/webapp/helpfiles/index.html diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java index f3eecdf9..4eab7e89 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java @@ -89,7 +89,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { URL backgroundImgURL = null; URL helpURL = null; try { - helpURL = getURLParameter(HELP_URL, getAppletParameter(SESSION_ID)); + helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID)); } catch (MalformedURLException ex) { log.warn("failed to load help URL, disabling help: " + ex.getMessage()); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index 6e3167c1..a249a376 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -32,39 +32,22 @@ import org.apache.commons.logging.LogFactory; public abstract class AbstractHelpListener implements ActionListener { protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); - protected String helpURLBase; +// protected String helpURLBase; + protected URL baseURL; protected Locale locale; public AbstractHelpListener(URL baseURL, Locale locale) { if (baseURL == null || "".equals(baseURL)) { throw new RuntimeException("no help URL provided"); } - this.helpURLBase = baseURL.toString(); + this.baseURL = baseURL; this.locale = locale; } @Override public void actionPerformed(ActionEvent e) { log.debug("received help action: " + e.getActionCommand()); - URL helpURL; - try { - String urlString = helpURLBase; - if (locale != null) { - urlString = appendParameter(urlString, "locale", locale.toString()); - } - if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { - urlString = appendParameter(urlString, "topic", e.getActionCommand()); - } - helpURL = new URL(urlString); - } catch (MalformedURLException ex) { - try { - log.error("failed to create help URL: " + ex.getMessage()); - helpURL = new URL(helpURLBase); - } catch (MalformedURLException ex1) { - log.error("failed to create default help URL, requested help will not be displayed"); - return; - } - } + URL helpURL = constructHelpURL(baseURL, e.getActionCommand()); try { showDocument(helpURL); } catch (Exception ex) { @@ -72,12 +55,22 @@ public abstract class AbstractHelpListener implements ActionListener { } } - private String appendParameter(String url, String paramName, String paramValue) { - if (url.indexOf('?') < 0) { - return url + "?" + paramName + "=" + paramValue; - } else { - return url + "&" + paramName + "=" + paramValue; + private URL constructHelpURL(URL baseURL, String helpItem) { + URL helpURL = baseURL; + log.trace("constructing help URL: " + helpURL); + try { + if (locale != null) { + helpURL = new URL(helpURL, locale.toString() + "/"); + log.trace("constructing help URL: " + helpURL); + } + if (helpItem != null && !"".equals(helpItem)) { + helpURL = new URL(helpURL, helpItem + ".html"); + log.trace("constructing help URL: " + helpURL); + } + } catch (MalformedURLException ex) { + log.error("Failed to construct help URL for help item " + helpItem + ": " + ex.getMessage()); } + return helpURL; } public abstract void showDocument(URL helpDocument) throws Exception; diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml index 6b2ec35c..f6fdbefc 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/web.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -52,6 +52,10 @@ HashDataInputServlet at.gv.egiz.bku.online.webapp.HashDataInputServlet + + help + /help.jsp + BKUServlet /http-security-layer-request @@ -68,9 +72,10 @@ HashDataInputServlet /hashDataInput - - - + + help + /help/* + diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index 8ddbed13..ff52fe51 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -53,7 +53,7 @@ GuiStyle : '<%=guiStyle%>', Background : '<%=backgroundImg%>', WSDL_URL :'../stal?wsdl', - HelpURL : '../help', + HelpURL : '../help/', HashDataDisplay : 'external', HashDataURL : '../hashDataInput', SessionID : '<%=session.getId()%>', diff --git a/BKUOnline/src/main/webapp/help.jsp b/BKUOnline/src/main/webapp/help.jsp new file mode 100644 index 00000000..29343171 --- /dev/null +++ b/BKUOnline/src/main/webapp/help.jsp @@ -0,0 +1,7 @@ +<%-- + Document : help + Created on : 05.11.2008, 10:55:52 + Author : Clemens Orthacker +--%> + + diff --git a/BKUOnline/src/main/webapp/helpfiles/index.html b/BKUOnline/src/main/webapp/helpfiles/index.html new file mode 100644 index 00000000..84db59c6 --- /dev/null +++ b/BKUOnline/src/main/webapp/helpfiles/index.html @@ -0,0 +1,17 @@ + + + + + + + + + +

No help item provided

+ + + -- cgit v1.2.3