diff options
-rw-r--r-- | pdf-as-web/src/main/webapp/sitemesh/standalone.jsp | 189 |
1 files changed, 164 insertions, 25 deletions
diff --git a/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp b/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp index 1349a67..740a587 100644 --- a/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp +++ b/pdf-as-web/src/main/webapp/sitemesh/standalone.jsp @@ -1,37 +1,176 @@ -<?xml version="1.0" encoding="UTF-8" ?>
-<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator"%>
+<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
+
+<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ page import="at.gv.egiz.pdfas.web.helper.LocalRequestHelper" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ page import="java.net.URL" %>
+<%@ page import="java.net.URLConnection" %>
+<%@ page import="java.io.InputStream" %>
+<%@ page import="java.io.InputStreamReader" %>
+<%@ page import="java.io.BufferedReader" %>
+<%@ page import="net.htmlparser.jericho.Source" %>
+<%@ page import="net.htmlparser.jericho.Element" %>
+<%@ page import="net.htmlparser.jericho.Attributes" %>
+<%@ page import="net.htmlparser.jericho.Attribute" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.Locale" %>
+<%@ page import="at.gv.egiz.pdfas.web.i18n.LocaleParamFilter" %>
+<%@ page import="java.nio.charset.Charset" %>
+<%@ page import="at.gv.egiz.pdfas.web.session.SessionAttributes" %>
+
-<html>
+<%@page import="java.nio.charset.Charset"%>
+
+ <html>
+ <head>
+
+ <script language="javascript" type="text/javascript">
+ //Submit the form when the change language button was hit
+ function submit() {
+ var file = document.submitform.source.options[0].selected;
+ if (file) {
+ document.changelanguage.source_mode.value='file';
+ }
+ else {
+ document.changelanguage.source_mode.value='text';
+ document.changelanguage.text.value=document.getElementById('freetext').value;
+ }
+ document.changelanguage.submit();
+ }
+ </script>
<%
- boolean testMode = request.getContextPath().startsWith("/test-");
+
+ String headerUrl="http://www.buergerkarte.at/header.php?lang=";
+ //String headerUrl="http://www.buergerkarte.at/header.php";
+ String serverUrl=LocalRequestHelper.getLocalServerAddress(request,response);
+
+ String requestLang = (String)request.getParameter("lang");
+
+ String language = "";
+
+ URL urlHeader = new URL(headerUrl);
+
+ 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();
+
+ InputStream isHeader = ucHeader.getInputStream();
+
+ //Read the header php files from the server
+ BufferedReader brHeader = new BufferedReader(new InputStreamReader(isHeader, Charset.forName("UTF-8")));
+
+ String phpLine="";
+ String phpHeader="";
+ while ((phpLine=brHeader.readLine())!=null) {
+ phpHeader += phpLine;
+ }
+
+ phpHeader = phpHeader.substring(phpHeader.indexOf("<body>"), phpHeader.length());
+
+ Source source = new Source(phpHeader);
+ List list = source.getAllElements();
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ Element element = (Element)it.next();
+
+ //Set the absolute path for each element with src or href
+ String attributeValueSrc = element.getAttributeValue("src");
+ String attributeValueHref = element.getAttributeValue("href");
+
+ if ((attributeValueSrc!=null) || (attributeValueHref!=null)) {
+
+ String attribute = "";
+
+ if ((attributeValueSrc!=null) && (attributeValueHref!=null)) {
+ phpHeader = phpHeader.replace(attributeValueSrc, serverUrl+attributeValueSrc);
+ phpHeader = phpHeader.replace(attributeValueHref, serverUrl+attributeValueHref);
+ }
+ else {
+ if (attributeValueSrc!=null) {
+ phpHeader = phpHeader.replace(attributeValueSrc, serverUrl+attributeValueSrc);
+ }
+ if (attributeValueHref!=null) {
+ phpHeader = phpHeader.replace(attributeValueHref, serverUrl+attributeValueHref);
+ }
+ }
+ }
+ }
+
+ //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();
+ }
+
+ String languagelink;
+ if (!language.equals("de")) {
+ languagelink = "<div id=\"sprachlink\" class=\"de\"><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=\"en\"><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;
+
%>
-
- <head>
+ <title>PDF Signature</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <%
+ if (language.equals("de")) { %>
+ <meta http-equiv="Content-Language" content="de" />
+ <% } else { %>
+ <meta http-equiv="Content-Language" content="en" />
+ <% } %>
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <meta name="Description" content="Bürgerkarte" />
+ <meta name="Keywords" content="Citizen Card, Austrian Citizen Card, Citizen Card Austria" />
<decorator:head/>
- <link rel="stylesheet" type="text/css" href="<%=LocalRequestHelper.getLocalContextAddress(request,response)%>/css/pdfas-styles.css" />
- <title><fmt:message key="<%= testMode ? \"test.common.title\" : \"common.title\" %>"/></title>
- <link rel="stylesheet" type="text/css" href="<%=LocalRequestHelper.getLocalContextAddress(request,response)%>/css/pdfas-standalone-styles.css" />
+ <link rel="stylesheet" type="text/css" href="https://www.buergerkarte.at/test-pdf-as/css/pdfas-styles.css" />
+ <link rel="shortcut icon" href="https://www.buergerkarte.at/dateien/favicon.ico" type="image/vnd.microsoft.icon" />
+ <link rel="stylesheet" href="https://www.buergerkarte.at/style.css" type="text/css" />
</head>
-
+
<body>
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
- <tr>
- <td align="center" valign="middle">
- <table cellpadding="0" cellspacing="0" border="0" width="700px">
- <tr>
- <td align="left"><decorator:body/></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
+ <%= phpHeader %>
+ <!-- mitte -->
+ <div id="mitte">
+ <!-- inhalt -->
+ <div class="inhalt" id="inhalt">
+ <!-- pdfas-container -->
+ <div id="pdfas-container">
+ <decorator:body/>
+ </div><!-- pdfas-container -->
+ </div><!-- inhalt -->
+ </div><!-- mitte -->
+ </div>
</body>
-
</html>
|