diff options
Diffstat (limited to 'pdf-as-web/src/main/webapp')
-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">
|