From cf4d6b9b8315031431dd6d9460c0127286755d78 Mon Sep 17 00:00:00 2001
From: clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>
Date: Thu, 9 Jul 2009 12:05:48 +0000
Subject: no language

git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@400 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
 BKUOnline/src/main/webapp/help.jsp | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

(limited to 'BKUOnline/src')

diff --git a/BKUOnline/src/main/webapp/help.jsp b/BKUOnline/src/main/webapp/help.jsp
index 5b39547e..1d0c6f73 100644
--- a/BKUOnline/src/main/webapp/help.jsp
+++ b/BKUOnline/src/main/webapp/help.jsp
@@ -18,23 +18,28 @@
 	pageEncoding="UTF-8"%>
 <%@ page import="java.io.File"%>
 <%
-    String path;
-    String helpDir = "/helpfiles";
+    StringBuilder path = new StringBuilder("/helpfiles/");
 
+    //servlet mapping assures pathInfo[0] == help
+    //expect pathinfo /help/<languagecode>/<helpfile>
     String pathInfo[] = (request.getPathInfo() != null) ? request
       .getPathInfo().split("/") : new String[] {};
     if (pathInfo.length < 2) {
-      path = helpDir + "/index.html";
+      path.append("index.html");
     } else {
-      String language = pathInfo[1].split("_")[0];
-      String filename = pathInfo[2];
-      if ((new File(helpDir + "/"  + language.toLowerCase())).isDirectory()) {
-          path = helpDir + "/"  + language.toLowerCase() + "/" + filename;
-      } else {
-          path = helpDir + "/de/" + filename;
+
+      String language = "de";
+      if (pathInfo.length > 2 && (new File("/helpfiles/"  +
+              pathInfo[1].split("_")[0].toLowerCase())).isDirectory()) {
+        language = pathInfo[1].split("_")[0];
       }
+      path.append(language);
+      path.append('/');
+      
+      String filename = pathInfo[(pathInfo.length > 2) ? 2 : 1];
+      path.append(filename);
     }
     System.out.println(path);
 %>
 
-<jsp:include page="<%=path%>" flush="true"/>
+<jsp:include page="<%=path.toString()%>" flush="true"/>
-- 
cgit v1.2.3