<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="at.knowcenter.wag.egov.egiz.web.servlets.UpdateFormServlet"%>
<%@ page import="java.util.Locale" %>
<%@ page import="at.gv.egiz.pdfas.api.commons.Constants" %>
<%@ page import="at.gv.egiz.pdfas.web.SignSessionInformation" %>
<%@ page import="at.knowcenter.wag.egov.egiz.web.SessionAttributes" %>
<%@ include file="language.jsp" %>
<%
  String local_request_url = (String)request.getAttribute("local_request_url");
  String data_url = (String) request.getAttribute("data_url");
  HttpSessionBindingListener si = (HttpSessionBindingListener) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
  Locale locale = (Locale) session.getAttribute(LocaleParamFilter.LOCALE_SESSION_KEY);
  
  boolean isExternalInvocation = false;
  boolean isServerBKU = false; 
  if (si instanceof SignSessionInformation) {
     SignSessionInformation ssi = (SignSessionInformation) si;
	  isExternalInvocation = ssi.exappinf != null;
	  isServerBKU = Constants.SIGNATURE_DEVICE_MOC.equals(ssi.connector); 
  } else {
     VerifySessionInformation vsi = (VerifySessionInformation) si;
	  isExternalInvocation = vsi.exappinf != null;
	  isServerBKU = Constants.SIGNATURE_DEVICE_MOC.equals(vsi.connector); 
  }
%>

<%@page import="at.gv.egiz.pdfas.web.VerifySessionInformation"%><html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<title><fmt:message key="nullrequestpage.title"/></title>
		<script language="javascript" type="text/javascript">
			<!--
				function disableElement(elementId) {
					if (elementId != null && document.getElementById(elementId)) {
						document.getElementById(elementId).disabled = true;
						document.getElementById(elementId).blur();
					}
					return(true);
				}
				function hitButton() {
					document.submitform.submit();
					disableElement("SendRequestButton");
					if (document.getElementById("SendRequestButton")) {
						document.getElementById("SendRequestButton").value = "<fmt:message key="nullrequestpage.button.pleasewait"/>";
					}
				}
			-->
		</script>
	</head>

	<body>
		<% if (!isExternalInvocation) { %>
			<h1><fmt:message key="common.title"/></h1>
			<h2><fmt:message key="nullrequestpage.heading2"/></h2>
		<% } // end if %>

		<% if (isServerBKU) { %>
			<% if (!isExternalInvocation) { %>
				<div class="pdfasnote"><fmt:message key="nullrequestpage.note.server"/></div>
			<% } // end if %>
			<form action="<%= local_request_url %>" name="submitform" accept-charset="UTF-8" method="post" target="moccaframe">
				<input type="hidden" name="XMLRequest"	value="<?xml version='1.0' encoding='UTF-8'?><NullOperationRequest xmlns='http://www.buergerkarte.at/namespaces/securitylayer/1.2#'/>" />
				<input type="hidden" name="DataURL" value="<%= data_url %>" />
				<input type="hidden" name="appletWidth" value="190"/>
				<input type="hidden" name="appletHeight" value="130"/>
				<% if (locale != null) { %>
					<input type="hidden" name="locale" value="<%= locale.toString() %>"/>
				<% } // end if %>
			</form>
			<% if (!isExternalInvocation) { %>
				<div class="pdfasverticalspace"></div>
				<iframe name="moccaframe" style="border: 1px solid black;" width="190" height="152" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" src="<%= request.getContextPath() %>/jsp/please_wait.jsp" ></iframe>
			<% } else { // end if %>
				<iframe name="moccaframe" style="border: 1px none black;" width="190" height="152" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" src="<%= request.getContextPath() %>/jsp/please_wait.jsp" ></iframe>
			<% } // end if %>

		<% } else { %>
			<% if (isExternalInvocation) { %>
				<div class="pdfasnote" style="padding:10px 10px 10px 10px;"><fmt:message key="nullrequestpage.note.local"/></div>
			<% } else { %>
				<div class="pdfasnote"><fmt:message key="nullrequestpage.note.local"/></div>
				<div class="pdfasverticalspace"></div>
			<% } // end if %>
			<form action="<%= local_request_url %>" name="submitform" accept-charset="UTF-8" method="post">
				<input type="hidden" name="XMLRequest"	value="<?xml version='1.0' encoding='UTF-8'?><NullOperationRequest xmlns='http://www.buergerkarte.at/namespaces/securitylayer/1.2#'/>" />
				<input type="hidden" name="DataURL" value="<%= data_url %>" />
				<% if (locale != null) { %>
					<input type="hidden" name="locale" value="<%= locale.toString() %>"/>
				<% } // end if %>
				<% if (!isExternalInvocation) { %>
					<input type="submit" id="SendRequestButton" value="<fmt:message key="nullrequestpage.button.submit"/>" />
				<% } // end if %>
			</form>
		<% } // end if %>

		<% if (!isExternalInvocation) { %>
			<div class="pdfasverticalspace"></div>
			<a href="<%= request.getContextPath() %>/"><fmt:message key="common.back"/></a>
		<% } // end if %>
		<script language="javascript" type="text/javascript">
			<!--
				window.setTimeout("hitButton()", 800);
			-->
		</script>
	</body>

</html>