aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-09-23 15:07:35 +0000
committerrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-09-23 15:07:35 +0000
commitb202c83423e998a30dee92afec2b0810b671b4da (patch)
tree2b070454a57e41d6cc2f7c305c9e3ce0bdcc1b65
parent39c357e5cfa5223f6126644d8a0dbc6ea203d09e (diff)
downloadpdf-as-3-b202c83423e998a30dee92afec2b0810b671b4da.tar.gz
pdf-as-3-b202c83423e998a30dee92afec2b0810b671b4da.tar.bz2
pdf-as-3-b202c83423e998a30dee92afec2b0810b671b4da.zip
Comprehensive changes due to reorganization of user interface. JavaScripts added for styling reasons, then added the same layout as with the start page, then added different layout handling for the cases of an error happened within the IFrame (e.g. when online CCS is called) or outside. Also added the possibility to visualize the page differently when the whole application is called from within an IFrame of an external application (see also other jsp's).
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@819 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r--pdf-as-web/src/main/webapp/jsp/error.jsp396
1 files changed, 316 insertions, 80 deletions
diff --git a/pdf-as-web/src/main/webapp/jsp/error.jsp b/pdf-as-web/src/main/webapp/jsp/error.jsp
index fc7ff1b..b70b169 100644
--- a/pdf-as-web/src/main/webapp/jsp/error.jsp
+++ b/pdf-as-web/src/main/webapp/jsp/error.jsp
@@ -9,101 +9,337 @@
<%@ page import="org.apache.commons.httpclient.NameValuePair" %>
<%@ page import="at.gv.egiz.pdfas.web.helper.SignServletHelper" %>
<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
+<%@page import="at.gv.egiz.pdfas.web.FormFields"%>
<%@ page import="java.io.*" %>
+<%@ page import="at.gv.egiz.pdfas.web.i18n.LocaleParamFilter" %>
+<%@ page import="java.util.Locale" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+
<%@ include file="language.jsp" %>
+<%
+
+
+%>
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
+ <%
+
+ //Check if application is started within an iframe from an extern application
+ boolean startedFromIFrame = false;
+ String extern = (String)session.getAttribute("extern");
+ if (extern!=null) {
+ if (extern.equals("yes")) {
+ startedFromIFrame = true;
+ }
+ }
+ //
+
+ String language = (String)session.getAttribute(SessionAttributes.LANGUAGE);
+ String height = (String)session.getAttribute(SignServlet.HEIGHT_SIGN_DIV);
+
+ boolean german = true;
+
+ if (language!=null) {
+ if (language.equals("de")) {%>
+ <fmt:setLocale value="de"/>
+ <% } else {
+ german = false; %>
+ <fmt:setLocale value="en"/>
+ <% }
+ }
+ else { %>
+ <fmt:setLocale value="de"/>
+ <% } %>
+
<title><fmt:message key="error.title"/></title>
<base href="<%=LocalRequestHelper.getLocalContextAddress(request,response)%>/"/>
- <meta http-equiv="Cache-Control" content="no-cache"/>
- <meta http-equiv="Pragma" content="no-cache"/>
- <meta http-equiv="Expires" content="-1"/>
+
+ <%
+ //Check if error happened within IFrame (e.g. if Online-BKU was called)
+ String iframe = (String)session.getAttribute(SignServlet.ERROR_WITHIN_IFRAME);
+
+ boolean withiniframe = false;
+ if (iframe!=null) {
+ if (iframe.equals("yes")) {
+ withiniframe = true;
+ }
+ }
+ %>
+
+ <%
+ //If not within IFrame and the whole application also was not started within an IFrame
+ //we have to set the buergerkarte page as template
+ if ((!withiniframe) && (!startedFromIFrame)) {
+ if (german) { %>
+ <meta name="decorator" content="production_de" />
+ <% } else { %>
+ <meta name="decorator" content="production_en" />
+ <% } %>
+ <% } %>
+ <meta http-equiv="pragma" content="no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0"/>
+ <meta http-equiv="expires" content="0"/>
+ <meta http-equiv="cache-control" content="no-cache,no-store,must-revalidate,max-age=-1"/>
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
+
+
+ <%
+ //If the whole application started from an IFrame there could be an external stylesheet
+ if (!startedFromIFrame) { %>
+ <link rel="stylesheet" type="text/css" href="https://www.buergerkarte.at/test-pdf-as/css/pdfas-styles.css" />
+ <link rel="stylesheet" href="https://www.buergerkarte.at/style.css" type="text/css" />
+ <% } else { %>
+ <link rel="stylesheet" type="text/css" href="https://www.buergerkarte.at/test-pdf-as/css/extern-styles.css" />
+ <% } %>
+
+ <script language="javascript" type="text/javascript">
+ //Detect if it is IE7 and if this is the case resize the div's
+ function detectBrowser() {
+ if ((navigator.appName.indexOf('Internet Explorer')!=-1) && (navigator.appVersion.indexOf('MSIE 7.0')!=-1)) {
+ var stringHeight = "<%=height%>";
+ var intHeight = stringHeight.substring(0,stringHeight.length-2);
+ var iediff = 25;
+ var height = parseInt(intHeight)+iediff;
+ height = height + 'px';
+ document.getElementById('sign').style.height = height;
+ document.getElementById('errortext').style.height = height;
+ document.getElementById('signintern').className='rechtsinhaltinternetexplorer';
+ document.getElementById('errortextintern').className='linksinhaltinternetexplorer';
+ document.getElementById('pdfasverticalspace').className='pdfasverticalspaceinternetexplorer';
+ }
+ }
+ //Set the height of the div's equally as previous pages
+ function setHeight() {
+ document.getElementById('sign').style.height = "<%=height%>";
+ document.getElementById('errortext').style.height = "<%=height%>";
+ }
+ </script>
+
</head>
<%
- PdfAsException pe;
- if (exception != null && exception instanceof PdfAsException)
- {
- pe = (PdfAsException)exception;
- SignServlet.prepareDispatchToErrorPage(pe, request);
- } else {
- pe = (PdfAsException)request.getAttribute("PresentableException");
- }
+ String redirect = null;
+ PdfAsException pe=null;
+ boolean paramInvok = false;
+ boolean rb = false;
+ boolean isExternalInvocation = false;
+ String cause="";
+ String error="";
+
+ if (exception != null && exception instanceof PdfAsException)
+ {
+ pe = (PdfAsException)exception;
+ SignServlet.prepareDispatchToErrorPage(pe, request);
+ } else {
+ pe = (PdfAsException)request.getAttribute("PresentableException");
+ }
- String error = request.getParameter("error");
- boolean paramInvok = false;
- if (error == null) {
- error = (request.getAttribute("error") == null ? "" : request.getAttribute("error").toString());
- } else {
- paramInvok = true;
- }
- String cause = request.getParameter("cause");
- if (cause == null) {
- cause = (request.getAttribute("cause") == null ? "" : request.getAttribute("cause").toString());
- } else {
- paramInvok = true;
- }
- boolean rb = Boolean.TRUE.equals((Boolean) request.getAttribute("resourcebundle"));
- Object sessionInfo = session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
+ error = (String)request.getParameter("error");
+ if (error == null) {
+ error = (request.getAttribute("error") == null ? "" : request.getAttribute("error").toString());
+ } else {
+ paramInvok = true;
+ }
+
+ cause = (String)request.getParameter("cause");
+ if (cause == null) {
+ cause = (request.getAttribute("cause") == null ? "" : request.getAttribute("cause").toString());
+ } else {
+ paramInvok = true;
+ }
+
+ rb = Boolean.TRUE.equals((Boolean) request.getAttribute("resourcebundle"));
+ Object sessionInfo = session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
+
+
+ if (sessionInfo != null) {
+ if (sessionInfo instanceof SignSessionInformation) {
+ SignSessionInformation si = (SignSessionInformation) sessionInfo;
+ isExternalInvocation = (si != null && si.exappinf != null);
+ if (isExternalInvocation) {
+ String urlParams = EncodingUtil.formUrlEncode(new NameValuePair[] {new NameValuePair("error", error), new NameValuePair("cause", cause) },"ISO8859_1");
+ if (si.exappinf.invoke_error_url == null) {
+ // prevent circular redirect
+ si.exappinf = null;
+ String redirectUrl = response.encodeRedirectURL(request.getContextPath() + "/jsp/error.jsp" +"?" + urlParams);
+ session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL,redirectUrl);
+ } else {
+ String errorUrl = null;
+ if(si.exappinf.invoke_error_url.contains("?")) {
+ errorUrl = si.exappinf.invoke_error_url + "&" + urlParams;
+ } else {
+ errorUrl = si.exappinf.invoke_error_url + "?" + urlParams;
+ }
+ session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL,errorUrl);
+ }
+ String redirectHelper =response.encodeRedirectURL(request.getContextPath() +"/jsp/redirect_to_parent.jsp");
+ response.sendRedirect(redirectHelper);
+ }
+ }
+ }
+
- boolean isExternalInvocation = false;
- if (sessionInfo != null) {
- if (sessionInfo instanceof SignSessionInformation) {
- SignSessionInformation si = (SignSessionInformation) sessionInfo;
- isExternalInvocation = (si != null && si.exappinf != null);
- if (isExternalInvocation) {
- String urlParams = EncodingUtil.formUrlEncode(new NameValuePair[] { new NameValuePair("error", error), new NameValuePair("cause", cause) }, "ISO8859_1");
- if (si.exappinf.invoke_error_url == null) {
- // prevent circular redirect
- si.exappinf = null;
- String redirectUrl = response.encodeRedirectURL(request.getContextPath() + "/jsp/error.jsp" + "?" + urlParams);
- session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, redirectUrl);
- } else {
- String errorUrl = si.exappinf.invoke_error_url + "?" + urlParams;
- session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, errorUrl);
- }
- String redirectHelper = response.encodeRedirectURL(request.getContextPath() + "/jsp/redirect_to_parent.jsp");
- SignServletHelper.disableBrowserCacheForResponse(response);
- response.sendRedirect(redirectHelper);
- }
- }
- }
+ boolean testMode = request.getContextPath().startsWith("/test-");
-%>
-
- <body>
- <h1><fmt:message key="common.title"/></h1>
- <h2><fmt:message key="error.heading2"/></h2>
- <div class="pdfasnote">
- <% if (rb) { %>
- <fmt:message key="<%= error %>"/>
- <% } else { out.write(StringEscapeUtils.escapeHtml(error)); } %>
- </div>
- <div class="pdfasnote"><fmt:message key="error.cause"/>: <strong>
- <% if (rb) { %>
- <fmt:message key="<%= cause %>"/>
- <% } else { out.write(StringEscapeUtils.escapeHtml(cause)); } %>
- </strong></div>
- <% if (!isExternalInvocation && !paramInvok) { %>
- <div class="pdfasverticalspace"></div>
- <a href="<%=LocalRequestHelper.getLocalContextAddress(request,response)%>/"><fmt:message key="common.back"/></a>
- <% } // end if %>
- <pre style="display:none">
- <%
- if (pe != null) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- pe.printStackTrace(pw);
- sw.close();
- pw.close();
- out.print(StringEscapeUtils.escapeHtml(sw.toString()));
- }
+ %>
+ <%
+ //If application not started within an iframe
+ if (!startedFromIFrame) { %>
+ <%
+ //If error didn't happen within IFrame (e.g. when online bku is called)
+ //The whole site has to be shown
+ if (!withiniframe) { %>
+ <body style="background: #e6f2fa">
+ <h1 id="heading1" style="display:block">
+ <%
+ if (testMode) {
+ %>
+ <fmt:message key="test.common.title"/>
+ <% } else { %>
+ <fmt:message key="common.title"/>
+ <% } // end if %>
+ </h1>
+
+ <div>
+ <fmt:message key="error.description"/>
+ </div>
+ <div class="pdfasverticalspace" id="pdfasverticalspace"></div>
+ <div id="inhalt">
+ <div class="links" id="errortext">
+ <div class="linksinhaltmargin" id="errortextintern">
+ <div class="pdfasnote"><fmt:message key="error.number"/>:
+ <%= error %>
+ </div>
+ <div class="pdfasverticalspace"></div>
+ <div class="pdfasnote"><fmt:message key="error.cause"/>: <strong>
+ <%= cause%>
+ </strong></div>
+ <div class="pdfasverticalspace"></div>
+ <a id="backlink" href="<%=LocalRequestHelper.getLocalContextAddress(request,response)%>/" target="_top"><fmt:message key="common.back"/></a>
+ </div>
+ </div>
+ <div class="rechts" id="sign">
+ <div class="rechtsinhalt" id="signintern">
+ <div class="rechtslinks">
+ <img src="<%=LocalRequestHelper.getLocalContextAddress(request,response) %>/images/onlineBKU.png" alt="Chip-Karte" id="Karte" />
+ </div>
+ <div class="rechtsrechts">
+ <img src="<%=LocalRequestHelper.getLocalContextAddress(request,response) %>/images/mobileBKU.png" alt="Handy" id="Handy"/>
+ </div>
+ <div class="rechtslinks">
+ <input type="submit" name="<%= FormFields.FIELD_CONNECTOR_SMARTCARD %>" value="<fmt:message key="signupload.signwithcard"/>" alt="Signatur mit Karte" disabled="disabled"/>
+ </div>
+ <div class="rechtsrechts">
+ <input type="submit" name="<%= FormFields.FIELD_CONNECTOR_MOBILE %>" value="<fmt:message key="signupload.signwithmobile"/>" alt="Signatur mit Handy" disabled="disabled"/>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script language="javascript" type="text/javascript">
+ document.getElementById('sprachlink').style.display = 'none';
+ document.getElementById('sprachlinkdeaktiviert').style.display= 'block';
+ setHeight();
+ detectBrowser();
+ </script>
+ </body>
+ <%}
+ //Just the error decription has to be shown
+ else { %>
+ <body style="background: #e6f2fa">
+ <div class="pdfasnote">
+ <% if (rb) { %>
+ <fmt:message key="<%= error %>"/>
+ <% } else { out.write(StringEscapeUtils.escapeHtml(error)); } %>
+ </div>
+ <div class="pdfasverticalspace"></div>
+ <div class="pdfasnote"><fmt:message key="error.cause"/>: <strong>
+ <% if (rb) { %>
+ <fmt:message key="<%= cause %>"/>
+ <% } else { out.write(StringEscapeUtils.escapeHtml(cause)); } %>
+ </strong></div>
+ <div class="pdfasverticalspace"></div>
+ <% if (!isExternalInvocation && !paramInvok) { %>
+ <a id="backlink" href="<%=LocalRequestHelper.getLocalContextAddress(request,response)%>/" target="_top"><fmt:message key="common.back"/></a>
+ <% } // end if %>
+ <pre style="display:none">
+ <%
+ if (pe != null) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ pe.printStackTrace(pw);
+ sw.close();
+ pw.close();
+ out.print(StringEscapeUtils.escapeHtml(sw.toString()));
+ }
+ %>
+ </pre>
+ <script language="javascript" type="text/javascript">
+ window.parent.moveErrorIFrame(document.getElementById('inhalt'));
+ </script>
+ </body>
+ <% }
+ }
+ //If application called from an IFrame the background is different
+ else { %>
+ <body>
+ <h1 id="heading1" style="display:block">
+ <%
+ if (testMode) {
+ %>
+ <fmt:message key="test.common.title"/>
+ <% } else { %>
+ <fmt:message key="common.title"/>
+ <% } // end if %>
+ </h1>
+ <div id="inhalt">
+ <div class="links">
+ <div class="linksinhaltmargin">
+ <div class="pdfasnote">
+ <%= error %>
+ </div>
+ <div class="pdfaverticalspace"></div>
+ <div class="pdfasnote"><fmt:message key="error.cause"/>: <strong>
+ <%= cause%>
+ </strong></div>
+ <div class="pdfasverticalspace"></div>
+ <a id="backlink" href="https://www.buergerkarte.at/test-pdf-as/" target="_self"><fmt:message key="common.back"/></a>
+ </div>
+ </div>
+ <div class="rechts">
+ <div class="rechtsinhalt">
+ <div class="rechtslinks">
+ <img src="https://www.buergerkarte.at/test-pdf-as/images/onlineBKU.png" alt="Chip-Karte" id="Karte"/>
+ </div>
+ <div class="rechtsrechts">
+ <img src="https://www.buergerkarte.at/test-pdf-as/images/mobileBKU.png" alt="Handy" id="Handy"/>
+ </div>
+ <div class="rechtslinks">
+ <input type="submit" name="<%= FormFields.FIELD_CONNECTOR_SMARTCARD %>" value="<fmt:message key="signupload.signwithcard"/>" alt="Signatur mit Karte" disabled="disabled"/>
+ </div>
+ <div class="rechtsrechts">
+ <input type="submit" name="<%= FormFields.FIELD_CONNECTOR_MOBILE %>" value="<fmt:message key="signupload.signwithmobile"/>" alt="Signatur mit Handy" disabled="disabled"/>
+ </div>
+ </div>
+ </div>
+ </div>
+ </body>
+ <% }
+
+ session.setAttribute(SignServlet.SUBMITFORM_SIGNATURE_MODE_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_SOURCE_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_SIGNATURE_TYPE_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_PDFA_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_NOTE_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_FREETEXT_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_SIGNATURE_DEVICE_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_FILE_KEY, null);
+ session.setAttribute(SignServlet.SUBMITFORM_FILENAME_KEY, null);
+ session.setAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION, null);
+ session.setAttribute(SignServlet.SUBMITFORM_PREVIEW, null);
+ session.setAttribute(SignServlet.ERROR_WITHIN_IFRAME, null);
%>
- </pre>
- </body>
-
</html>