diff options
author | rpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2012-01-30 13:57:12 +0000 |
---|---|---|
committer | rpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2012-01-30 13:57:12 +0000 |
commit | 3bd1daf2b44b6b7801d3dfd39bdd3dd62f448427 (patch) | |
tree | f56419bf06feee488d01916307aab8c87058a987 /pdf-as-web/src/main/webapp/sitemesh/standalone.jsp | |
parent | 98d3577c238cb5f3a9a06d3904c8e9f6ff10a3fe (diff) | |
download | pdf-as-3-3bd1daf2b44b6b7801d3dfd39bdd3dd62f448427.tar.gz pdf-as-3-3bd1daf2b44b6b7801d3dfd39bdd3dd62f448427.tar.bz2 pdf-as-3-3bd1daf2b44b6b7801d3dfd39bdd3dd62f448427.zip |
Changed language link
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@912 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'pdf-as-web/src/main/webapp/sitemesh/standalone.jsp')
-rw-r--r-- | pdf-as-web/src/main/webapp/sitemesh/standalone.jsp | 85 |
1 files changed, 59 insertions, 26 deletions
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 = "<li id=\"sprachlinkneu\"><a href=\"#\" onclick=\"submit()\" hreflang=\"de\">Deutsch</a></li>";
+ }
+ else {
+ languagelink = "<li id=\"sprachlinkneu\"><a href=\"#\" onclick=\"submit()\" hreflang=\"en\">English</a></li>";
+ }
+ 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 = "<li id=\"sprachlinkneu\"><a href=\"#\" onclick=\"submit()\" hreflang=\"de\">Deutsch</a></li>";
+ }
+ else {
+ languagelink = "<li id=\"sprachlinkneu\"><a href=\"#\" onclick=\"submit()\" hreflang=\"en\">English</a></li>";
+ }
+ String firstPart = phpHeader.substring(0, positionToEnd);
+ String secondPart = phpHeader.substring(positionToEnd, phpHeader.length());
+ phpHeader = firstPart+languagelink+secondPart;
}
- String languagelink;
- if (!language.equals("de")) {
- languagelink = "<div id=\"sprachlink\" class=\"sprachlinkdeaktiviert\"><a href=\"#\" onclick=\"submit(); return false;\" hreflang=\"de\"><img src=\""+serverUrl+"dateien/flagge-de.png\" alt=\"Deutsche Version\" width=\"15\" height=\"10\" />Deutsche Version</a></div>";
- languagelink += "<div id=\"sprachlinkdeaktiviert\" class=\"sprachlinkdeaktiviert\"><img src=\""+serverUrl+"dateien/flagge-de.png\" alt=\"Deutsche Version\" width=\"15\" height=\"10\" />Deutsche Version</div>";
- }
- else {
- languagelink = "<div id=\"sprachlink\" class=\"sprachlinkdeaktiviert\"><a href=\"#\" onclick=\"submit(); return false;\" hreflang=\"en\"><img src=\""+serverUrl+"dateien/flagge-en.png\" alt=\"English Version\" width=\"15\" height=\"10\" />English Version</a></div>";
- languagelink += "<div id=\"sprachlinkdeaktiviert\" class=\"sprachlinkdeaktiviert\"><img src=\""+serverUrl+"dateien/flagge-en.png\" alt=\"English Version\" width=\"15\" height=\"10\" />English Version</div>";
- }
-
-
- String firstPart = phpHeader.substring(0, positionToInsertLangLink);
- String secondPart = phpHeader.substring(positionToInsertLangLink, phpHeader.length());
- phpHeader = firstPart+languagelink+secondPart;
- */
%>
@@ -178,8 +211,8 @@ <link rel="stylesheet" href="<%=serverUrl %>style.css" type="text/css" />
</head>
- <%= phpHeader %>
- <!-- mitte -->
+ <%= phpHeader %>
+ <!-- mitte -->
<div id="mitte">
<!-- inhalt -->
<div class="inhalt" id="inhalt">
|