From 3bd1daf2b44b6b7801d3dfd39bdd3dd62f448427 Mon Sep 17 00:00:00 2001 From: rpiazzi Date: Mon, 30 Jan 2012 13:57:12 +0000 Subject: Changed language link git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@912 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- pdf-as-web/src/main/webapp/sitemesh/standalone.jsp | 85 +++++++++++++++------- 1 file changed, 59 insertions(+), 26 deletions(-) (limited to 'pdf-as-web/src/main/webapp') diff --git a/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp b/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp index 0da7492..4bb19ff 100644 --- a/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp +++ b/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp @@ -67,8 +67,21 @@ } } else { - urlHeader = new URL(headerUrl+"de"); - language="de"; + requestLang = request.getParameter("lang"); + if (requestLang!=null) { + if (requestLang.equals("de")) { + urlHeader = new URL(headerUrl+"de"); + language="de"; + } + else { + urlHeader = new URL(headerUrl+"en"); + language="en"; + } + } + else { + urlHeader = new URL(headerUrl+"de"); + language="de"; + } } URLConnection ucHeader = urlHeader.openConnection(); @@ -132,31 +145,51 @@ //Insert a hidden language fake link, that is shown when the change of language is disabled - /*int positionToInsertLangLink = 0; - source = new Source(phpHeader); - list = source.getAllElements("ul"); - it = list.iterator(); - while (it.hasNext()) { - Element element = (Element)it.next(); - positionToInsertLangLink = element.getEnd(); + source = new Source(phpHeader); + + Element element = source.getElementById("sprachlinkneu"); + + if (element!=null) { + String languagelink; + int positionToInsertLangLink = 0; + int positionToEndLangLink = 0; + positionToInsertLangLink=element.getBegin(); + positionToEndLangLink=element.getEnd(); + if (!language.equals("de")) { + languagelink = "
  • Deutsch
  • "; + } + else { + languagelink = "
  • English
  • "; + } + String firstPart = phpHeader.substring(0, positionToInsertLangLink); + String secondPart = phpHeader.substring(positionToEndLangLink, phpHeader.length()); + phpHeader = firstPart+languagelink+secondPart; + } + else { + int positionToEnd=0; + list = source.getAllElements("li"); + it = list.iterator(); + int i=0; + while (it.hasNext()) { + element = (Element)it.next(); + if (i==5) { + positionToEnd = element.getEnd(); + } + i++; + } + String languagelink; + if (!language.equals("de")) { + languagelink = "
  • Deutsch
  • "; + } + else { + languagelink = "
  • English
  • "; + } + String firstPart = phpHeader.substring(0, positionToEnd); + String secondPart = phpHeader.substring(positionToEnd, phpHeader.length()); + phpHeader = firstPart+languagelink+secondPart; } - String languagelink; - if (!language.equals("de")) { - languagelink = "
    \"DeutscheDeutsche Version
    "; - languagelink += "
    \"DeutscheDeutsche Version
    "; - } - else { - languagelink = "
    \"EnglishEnglish Version
    "; - languagelink += "
    \"EnglishEnglish Version
    "; - } - - - String firstPart = phpHeader.substring(0, positionToInsertLangLink); - String secondPart = phpHeader.substring(positionToInsertLangLink, phpHeader.length()); - phpHeader = firstPart+languagelink+secondPart; - */ %> @@ -178,8 +211,8 @@ - <%= phpHeader %> - + <%= phpHeader %> +
    -- cgit v1.2.3