%@page import="at.gv.egiz.pdfas.web.servlets.UpdateFormServlet"%>
<%@page import="at.gv.egiz.pdfas.web.FormFields"%>
<%@page import="at.gv.egiz.pdfas.web.session.SessionAttributes"%>
<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
<%@ page import="at.gv.egiz.pdfas.api.commons.Constants" %>
<%@ page import="at.gv.egiz.pdfas.web.i18n.LanguageDecoratorMapper"%>
<%@ page import="org.apache.commons.lang.BooleanUtils"%>
<%@ include file="language.jsp" %>
<%
boolean testMode = request.getContextPath().startsWith("/test-");
boolean forceTextualForMocca = false;
final String SIGNATUREPROFILE_DE_nonPDFa = "SIGNATURBLOCK_DE";
final String SIGNATUREPROFILE_EN_nonPDFa = "SIGNATURBLOCK_EN";
final String SIGNATUREPROFILE_DE_PDFa = "SIGNATURBLOCK_DE_PDFA";
final String SIGNATUREPROFILE_EN_PDFa = "SIGNATURBLOCK_EN_PDFA";
%>
<%
if (testMode) {
%>
<% } else { %>
<% } // end if %>
<% session.removeAttribute(SessionAttributes.SIGNED_PDF_DOCUMENT); %>
<%
// PRESETS
// signature device
String device = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_DEVICE_KEY);
if (device == null) {
device = Constants.SIGNATURE_DEVICE_MOC;
session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_DEVICE_KEY, device);
}
// signature mode
String mode = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_MODE_KEY);
if (forceTextualForMocca && Constants.SIGNATURE_DEVICE_MOC.equals(device)) {
mode = FormFields.VALUE_MODE_TEXTUAL;
session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_MODE_KEY, mode);
}
if (mode == null) {
mode = FormFields.VALUE_MODE_BINARY;
session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_MODE_KEY, mode);
}
// PDF/A-1b
boolean pdfa = BooleanUtils.toBoolean((String) session.getAttribute(UpdateFormServlet.UPLOADFORM_PDFA_KEY));
String TYPE_EN;
String TYPE_DE;
if (pdfa) {
TYPE_EN = SIGNATUREPROFILE_EN_PDFa;
TYPE_DE = SIGNATUREPROFILE_DE_PDFa;
} else {
TYPE_EN = SIGNATUREPROFILE_EN_nonPDFa;
TYPE_DE = SIGNATUREPROFILE_DE_nonPDFa;
}
// signature type
String type = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_TYPE_KEY);
if (type == null) {
Locale locale = (Locale) session.getAttribute(LocaleParamFilter.LOCALE_SESSION_KEY);
if (locale == null) {
locale = request.getLocale();
}
type = Locale.GERMAN.getLanguage().equals(locale.getLanguage()) ? TYPE_DE : TYPE_EN;
} else {
if (pdfa) {
if (SIGNATUREPROFILE_DE_nonPDFa.equals(type)) {
type = SIGNATUREPROFILE_DE_PDFa;
} else if (SIGNATUREPROFILE_EN_nonPDFa.equals(type)) {
type = SIGNATUREPROFILE_EN_PDFa;
}
} else {
if (SIGNATUREPROFILE_DE_PDFa.equals(type)) {
type = SIGNATUREPROFILE_DE_nonPDFa;
} else if (SIGNATUREPROFILE_EN_PDFa.equals(type)) {
type = SIGNATUREPROFILE_EN_nonPDFa;
}
}
}
session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_TYPE_KEY, type);
// source
String source = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SOURCE_KEY);
if (source == null) {
source = FormFields.VALUE_SOURCE_FILE;
}
session.setAttribute(UpdateFormServlet.UPLOADFORM_SOURCE_KEY, source);
boolean freeText = FormFields.VALUE_SOURCE_FREETEXT.equals(source);
// freetext
String freeTextValue = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_FREETEXT_KEY);
if (freeTextValue == null) {
freeTextValue = "";
}
session.setAttribute(UpdateFormServlet.UPLOADFORM_FREETEXT_KEY, freeTextValue);
%>
<%
if (testMode) {
%>
<% } else { %>
<% } // end if %>
<% if (freeText) { %>
<% } else { %>
<% } %>
<% if (freeText) { %>
<% } else { %>
<% } %>