summaryrefslogtreecommitdiff
path: root/BKUOnline/src/main/webapp/applet.jsp
diff options
context:
space:
mode:
authormcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-07-14 15:22:56 +0000
committermcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-07-14 15:22:56 +0000
commit5e10b6b575993c78ac22191849c464b618c4fa8a (patch)
tree55911c2b6d69e787dd408d63c1e641d6db39c5dc /BKUOnline/src/main/webapp/applet.jsp
parentdc95c76a126b4f3135645d3e20b152134d201244 (diff)
downloadmocca-5e10b6b575993c78ac22191849c464b618c4fa8a.tar.gz
mocca-5e10b6b575993c78ac22191849c464b618c4fa8a.tar.bz2
mocca-5e10b6b575993c78ac22191849c464b618c4fa8a.zip
MOCCA Online HTTP binding refactored.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@762 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUOnline/src/main/webapp/applet.jsp')
-rw-r--r--BKUOnline/src/main/webapp/applet.jsp391
1 files changed, 182 insertions, 209 deletions
diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp
index eba0ed87..ee1cca2a 100644
--- a/BKUOnline/src/main/webapp/applet.jsp
+++ b/BKUOnline/src/main/webapp/applet.jsp
@@ -14,226 +14,199 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"
- import="at.gv.egiz.bku.online.webapp.AppletDispatcher, org.apache.commons.lang.RandomStringUtils, org.apache.commons.lang.StringEscapeUtils" %>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%--
+
+ This JSP page loads the MOCCA applet into the browser. It is not intended
+ to by directly called by the browser, but the UIServlet should be called.
+ The UIServlet sets some request attributes and forwards to this page.
+
+ The look and behavior of this page and the embedded applet may be
+ customized by a number of parameters handed over in the request. If this
+ does not provide enough flexibility you may choose to modify this page
+ or provide an alternative customized page. The name of the customized page
+ may be specified as parameter in the original request. The UIServlet will
+ forward to the given page.
+
+ --%>
+<%-- Applet --%>
+<c:set var="defaultWidth" value="190"/>
+<c:set var="defaultHeight" value="130"/>
+<c:set var="minJavaVersion" value="1.6.0_04"/>
+<%-- Images --%>
+<c:set var="defaultButtonWidth" value="16"/>
+<c:set var="defaultButtonHeight" value="22"/>
+<%-- URLs --%>
+<c:url value="/applet" var="codebaseUrl"/>
+<c:url value="/help/" var="helpUrl"/>
+<c:url value="/stal;jsessionid=${requestScope.id}?wsdl" var="wsdlUrl"/>
+<c:url value="/result;jsessionid=${requestScope.id}" var="resultUrl"/>
+<%-- Messages --%>
+<fmt:bundle basename="web">
+<%-- Applet archive and class --%>
+<%--
+ Uncomment the following line if you would like to prevent applet caching!
+--%>
+<%-- jsp:useBean id="now" class="java.util.Date" scope="request"/ --%>
+<c:choose>
+ <c:when test="${requestScope.moccaParam.extension == 'activation'}">
+ <c:url var="appletArchive" value="BKUAppletExt-single.jar">
+ <c:if test="${! empty now}">
+ <c:param name="no-cache" value="${now.time}"/>
+ </c:if>
+ </c:url>
+ <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.ActivationApplet.class"/>
+ </c:when>
+ <c:when test="${requestScope.moccaParam.extension == 'pin'}">
+ <c:url var="appletArchive" value="BKUAppletExt-single.jar">
+ <c:if test="${! empty now}">
+ <c:param name="no-cache" value="${now.time}"/>
+ </c:if>
+ </c:url>
+ <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.PINManagementApplet.class"/>
+ </c:when>
+ <c:otherwise>
+ <c:url var="appletArchive" value="BKUApplet-single.jar">
+ <c:if test="${! empty now}">
+ <c:param name="no-cache" value="${now.time}"/>
+ </c:if>
+ </c:url>
+ <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.BKUApplet.class"/>
+ </c:otherwise>
+</c:choose>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>MOCCA Applet</title>
- <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon">
- <script type="text/javascript" src="js/deployJava.js"></script>
- <style type="text/css" media="all">@import "css/applet.css";</style>
-
- <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
- <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
- <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
- </head>
- <%
- String locale = StringEscapeUtils.escapeJavaScript(
- (String) session.getAttribute("locale"));
-
- int width = session.getAttribute("appletWidth") == null ? 190
- : (Integer) session.getAttribute("appletWidth");
- int height = session.getAttribute("appletHeight") == null ? 130
- : (Integer) session.getAttribute("appletHeight");
- String backgroundImg = StringEscapeUtils.escapeJavaScript(
- session.getAttribute("appletBackground") == null
- ? "../img/chip32.png"
- : (String) session.getAttribute("appletBackground"));
- String backgroundColor = StringEscapeUtils.escapeJavaScript(
- (String) session.getAttribute("appletBackgroundColor"));
- String guiStyle = StringEscapeUtils.escapeJavaScript(
- (String) session.getAttribute("appletGuiStyle"));
-
- String sessionId = StringEscapeUtils.escapeJavaScript(session.getId());
-
- String extension = (String) session.getAttribute("appletExtension");
- String appletClass, appletArchive;
- if ("activation".equalsIgnoreCase(extension)) {
- appletArchive = "BKUAppletExt-single";
- appletClass = "at.gv.egiz.bku.online.applet.ActivationApplet.class";
- } else if ("pin".equalsIgnoreCase(extension)) {
- appletArchive = "BKUAppletExt-single";
- appletClass = "at.gv.egiz.bku.online.applet.PINManagementApplet.class";
- } else {
- appletArchive = "BKUApplet-single";
- appletClass = "at.gv.egiz.bku.online.applet.BKUApplet.class";
+ <head>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+ <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+ <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
+ <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
+ <title><fmt:message key="title"/></title>
+ <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon">
+ <style type="text/css" media="all">
+ root {
+ display: block;
+ }
+ body {
+ background: #ffffff;
+ padding: 0;
+ margin: 0;
+ border-style: none;
+ width: <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>px;
+ }
+ #container {
+ padding: 0;
+ margin: 0;
+ width: <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>px;
+ background: <c:out value="${requestScope.moccaParam.appletBackgroundColor}" default="#eeeeee"/>;
+ }
+ #container applet{
+ padding: 0;
+ margin: 0;
+ }
+ .button {
+ width: <c:out value="${defaultButtonWidth}px"/>;
+ height: <c:out value="${defaultButtonHeight}px"/>;
+ text-decoration: none;
+ border-style: none;
+ }
+ #message {
+ margin: 0;
+ padding: 0.25em 0 0.25em 0;
+ clear: both;
+ }
+ #message p{
+ margin: 0;
+ padding: 0.25em 0.5em 0.25em 0.5em;
+ }
+ </style>
+ <script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script>
+ <script type="text/javascript">
+ var iframe = (top.location.href != window.location.href);
+ var fontSize = 100;
+ var width = <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>;
+ var height = <c:out value="${requestScope.moccaParam.appletHeight}" default="${defaultHeight}"/>;
+ var buttonWidth = <c:out value="${defaultButtonWidth}"/>;
+ var buttonHeight = <c:out value="${defaultButtonHeight}"/>;
+ var buttons = ["incButton", "decButton", "helpButton"];
+ function focusToBrowser() {
+ document.getElementById("focus").focus();
+ }
+ function focusToApplet() {
+ var applet = document.getElementById("moccaapplet");
+ if (applet != null) {
+ applet.getFocusFromBrowser();
}
-
- // disable applet caching
- boolean disableAppletCaching = false;
- String codebase = "applet";
-
- if (disableAppletCaching) {
- // run in AppletDispatcher context and
- // append random alphanumeric string to avoid applet caching
- // TODO prepend ../ to all xxxURL applet paramaters
- codebase += "/" + AppletDispatcher.DISPATCH_CTX;
- String rand = AppletDispatcher.RAND_PREFIX +
- RandomStringUtils.randomAlphanumeric(16);
- appletArchive += rand;
+ }
+ function resize(factor) {
+ width = Math.ceil(width * factor);
+ height = Math.ceil(height * factor);
+ var container = document.getElementById("container");
+ if (container != null) {
+ container.style.width = width + "px";
}
-
- %>
- <body id="appletpage" style="width:<%=width%>px">
-
-
- <div id="container" style="float: left; width: <%= width %>">
-
- <form name="increaseform" action="javascript:increaseSize()" method="get">
-
- <!-- increase font size image -->
- <input type="image" src="img/inc.png" alt="Text vergrößern" width="13px" height="18px" style="float: left;" id="increase_image"/>
-
- </form>
-
-
- <form name="decreaseform" action="javascript:decreaseSize()" method="get">
-
- <!-- decrease font size image -->
- <input type="image" src="img/dec.png" alt="Text verkleinern" width="13px" height="18px" style="float: left;" id="decrease_image"/>
-
- </form>
-
-
-
- <form name="helpform" action="help/index.html" method="get" target="_new"
- onsubmit="this.action=document.moccaapplet.getHelpURL(); this.submit(); return false;">
-
- <!-- invisible input -->
- <input type="image" src="img/help.png" alt=" " width="0px" height="0px" style="float: left;" onFocus="focusToApplet()"/>
-
- <!-- help image -->
- <input type="image" src="img/help.png" alt="Hilfe" width="13px" height="18px" style="float: right;" id="helpimage"/>
-
-
- </form>
-
-
-
- <script type="text/javascript">
-
- if (!deployJava.versionCheck('1.6.0_04+')) {
- document.write('<p>Diese Anwendung benötigt Version 6 Update 4 oder höher der <a href="" onclick="deployJava.installLatestJRE();">Java&trade; Laufzeitumgebung</a>.</p>');
+ var applet = document.getElementById("moccaapplet");
+ if (applet != null) {
+ applet.width = width;
+ applet.height = height;
+ }
+ buttonWidth = Math.ceil(buttonWidth * factor);
+ buttonHeight = Math.ceil(buttonHeight * factor);
+ for (var b in buttons) {
+ var button = document.getElementById(buttons[b]);
+ if (button != null) {
+ button.style.width = buttonWidth + "px";
+ button.style.height = buttonHeight + "px";
+ }
+ }
+ fontSize *= factor;
+ document.body.style.fontSize = fontSize + "%";
+ }
+ </script>
+ </head>
+ <body>
+ <div id="container">
+ <a href="#" id="focus" onclick="resize(1.2); return false;" style="float: left;"><img alt="<fmt:message key="incTextSize"/>" src="img/inc.png" id="incButton" class="button"></a>
+ <a href="#" onclick="resize(1/1.2); return false;" style="float: left;"><img alt="<fmt:message key="decTextSize"/>" src="img/dec.png" id="decButton" class="button"></a>
+ <a href="<c:out value="${helpUrl}"/>" onclick="this.href = document.moccaapplet.getHelpURL(); return true;" target="_new" style="float: right;"><img alt="<fmt:message key="help"/>" src="img/help.png" id="helpButton" class="button"></a>
+ <div id="message" style="display: none;">
+ <p><fmt:message key="javaPluginRequired"/></p>
+ <p style="text-align: right;">
+ <a style="width: 90%; font-size: 100%" href="http://www.java.com" onclick="deployJava.installLatestJRE(); return false;"><fmt:message key="installJava"/></a>
+ </p>
+ </div><script type="text/javascript">
+ if (iframe) {
+ document.getElementById("buttons").style.visibility = "hidden";
+ }
+ if (!deployJava.versionCheck('<c:out value="${minJavaVersion}+"/>')) {
+ document.getElementById("message").style.display = "block";
} else {
var attributes = {
- codebase :'<%=codebase%>',
- code : '<%=appletClass%>',
- archive : '<%=appletArchive +".jar"%>',
- width : <%=width%>,
- height :<%=height%>,
+ codebase :'<c:out value="${codebaseUrl}"/>',
+ code : '<c:out value="${appletClass}"/>',
+ archive : '<c:out value="${appletArchive}"/>',
+ width : <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>,
+ height : <c:out value="${requestScope.moccaParam.appletHeight}" default="${defaultHeight}"/>,
name : 'moccaapplet',
id : 'moccaapplet'
};
var parameters = {
- GuiStyle : '<%=guiStyle%>',
- Locale : '<%=locale%>',
- Background : '<%=backgroundImg%>',
- BackgroundColor : '<%=backgroundColor%>',
- WSDL_URL : '../stal;jsessionid=<%=sessionId%>?wsdl',
- HelpURL : 'help/',
- SessionID : '<%=sessionId%>',
- RedirectURL : '../bkuResult',
+ GuiStyle : '<c:out value="${requestScope.moccaParam.guiStyle}" default="simple"/>',
+ Locale : '<c:out value="${requestScope.moccaParam.locale}" default=""/>',
+ Background : '<c:out value="${requestScope.moccaParam.appletBackground}" default=""/>',
+ BackgroundColor : '<c:out value="${requestScope.moccaParam.appletBackgroundColor}" default="#eeeeee"/>',
+ WSDL_URL : '<c:out value="${wsdlUrl}"/>',
+ HelpURL : '<c:out value="${helpUrl}"/>',
+ SessionID : '<c:out value="${requestScope.id}"/>',
+ RedirectURL : '<c:out value="${resultUrl}"/>',
RedirectTarget: '_parent',
EnforceRecommendedPINLength: 'true'
};
- deployJava.runApplet(attributes, parameters, '1.6.0_04');
+ deployJava.runApplet(attributes, parameters, '<c:out value="${minJavaVersion}"/>');
}
-
- </script>
-
-
-
- </div>
-
- </body>
-
- <script>
-
-
-
- function focusToBrowser() {
-
- // put focus to window
- // focus can be assigned to any focusable field on the embedding website
-
- //alert("Put focus to browser..");
- //self.focus();
- document.getElementById("helpimage").focus();
-
- }
-
- function focusToApplet() {
-
- //alert('try to set focus to applet');
- if (document != null && document.moccaapplet != null) {
-
- //alert('set focus to applet.');
- document.moccaapplet.getFocusFromBrowser();
- return true;
- }
- }
-
-
- function increaseSize() {
-
- var appwidth = document.moccaapplet.width;
- var appheight = document.moccaapplet.height;
-
- document.moccaapplet.width = (appwidth * 1.2);
- document.moccaapplet.height = (appheight * 1.2);
-
- document.getElementById("container").style.width = (appwidth * 1.2);
-
- // TODO: This does not work in firefox, seems that width and height attributes cannot be read
- // and set from input of type image
- var image_width = document.getElementById("increase_image").width;
- var image_height = document.getElementById("increase_image").height;
-
-
- document.getElementById("helpimage").width = (image_width * 1.2);
- document.getElementById("helpimage").height = (image_height * 1.2);
-
- document.getElementById("increase_image").width = (image_width * 1.2);
- document.getElementById("increase_image").height = (image_height * 1.2);
-
- document.getElementById("decrease_image").width = (image_width * 1.2);
- document.getElementById("decrease_image").height = (image_height * 1.2);
-
-
- }
-
- function decreaseSize() {
-
- var appwidth = document.moccaapplet.width;
- var appheight = document.moccaapplet.height;
-
- document.moccaapplet.width = (appwidth * 0.8333333333333);
- document.moccaapplet.height = (appheight * 0.8333333333333);
-
- document.getElementById("container").style.width = (appwidth * 0.8333333333333);
-
- // TODO: This does not work in firefox, seems that width and height attributes cannot be read
- // and set from input of type image
- var image_width = document.getElementById("increase_image").width;
- var image_height = document.getElementById("increase_image").height;
-
-
- document.getElementById("helpimage").width = (image_width * 0.8333333333333);
- document.getElementById("helpimage").height = (image_height * 0.8333333333333);
-
- document.getElementById("increase_image").width = (image_width * 0.8333333333333);
- document.getElementById("increase_image").height = (image_height * 0.8333333333333);
-
- document.getElementById("decrease_image").width = (image_width * 0.8333333333333);
- document.getElementById("decrease_image").height = (image_height * 0.8333333333333);
-
-
- }
-
- </script>
-
+ </script></div>
+ </body>
</html>
+</fmt:bundle> \ No newline at end of file