aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/webapp/jsp/signupload.jsp
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src/main/webapp/jsp/signupload.jsp')
-rw-r--r--pdf-as-web/src/main/webapp/jsp/signupload.jsp296
1 files changed, 296 insertions, 0 deletions
diff --git a/pdf-as-web/src/main/webapp/jsp/signupload.jsp b/pdf-as-web/src/main/webapp/jsp/signupload.jsp
new file mode 100644
index 0000000..9bc675f
--- /dev/null
+++ b/pdf-as-web/src/main/webapp/jsp/signupload.jsp
@@ -0,0 +1,296 @@
+<%@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"%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%@ include file="language.jsp" %>
+
+<html>
+<head>
+ <%
+ 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";
+
+ %>
+ <title>
+ <%
+ if (testMode) {
+ %>
+ <fmt:message key="test.common.title"/>
+ <% } else { %>
+ <fmt:message key="common.title"/>
+ <% } // end if %>
+ </title>
+ <% session.removeAttribute(SessionAttributes.SIGNED_PDF_DOCUMENT); %>
+ <script language="javascript" type="text/javascript">
+ <!--
+ function updateForm() {
+ var updateform = document.getElementById('updateform');
+ var submitform = document.getElementById('submitform');
+
+ updateform.<%= FormFields.FIELD_SIGNATURE_TYPE %>.value = submitform.<%= FormFields.FIELD_SIGNATURE_TYPE %>.value;
+ updateform.<%= FormFields.FIELD_MODE %>.value = submitform.<%= FormFields.FIELD_MODE %>.value;
+ updateform.<%= FormFields.FIELD_CONNECTOR %>.value = submitform.<%= FormFields.FIELD_CONNECTOR %>.value;
+ updateform.<%= FormFields.FIELD_PDFA_ENABLED %>.value = (submitform.<%= FormFields.FIELD_PDFA_ENABLED %>.checked == true);
+ updateform.<%= FormFields.FIELD_SOURCE %>.value = submitform.<%= FormFields.FIELD_SOURCE %>.value;
+ if (submitform.<%= FormFields.FIELD_FREETEXT %>) {
+ updateform.<%= FormFields.FIELD_FREETEXT %>.value = submitform.<%= FormFields.FIELD_FREETEXT %>.value;
+ }
+ updateform.submit();
+ return(false);
+ }
+ function submitForm(preview) {
+ var submitform = document.getElementById('submitform');
+ if (submitform.fileupload) {
+ // file
+ if (!submitform.fileupload.value) {
+ if (preview) {
+ alert('<fmt:message key="signupload.documentnotselected.preview"/>');
+ } else {
+ alert('<fmt:message key="signupload.documentnotselected"/>');
+ }
+ return(false);
+ }
+ } else {
+ // freetext
+ if (!submitform.freetext.value) {
+ if (preview) {
+ alert('<fmt:message key="signupload.nofreetext.preview"/>');
+ } else {
+ alert('<fmt:message key="signupload.nofreetext"/>');
+ }
+ return(false);
+ }
+ }
+ if (preview) {
+ submitform.<%= FormFields.FIELD_PREVIEW %>.value='true';
+ } else {
+ submitform.<%= FormFields.FIELD_PREVIEW %>.value='false';
+ }
+ return(true);
+ }
+ -->
+ </script>
+ <%
+ // 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);
+
+ %>
+</head>
+<body>
+<h1>
+ <%
+ if (testMode) {
+ %>
+ <fmt:message key="test.common.title"/>
+ <% } else { %>
+ <fmt:message key="common.title"/>
+ <% } // end if %>
+</h1>
+<h2 align="left">
+ <% if (freeText) { %>
+ <fmt:message key="signupload.heading2.freetext"/>
+ <% } else { %>
+ <fmt:message key="signupload.heading2"/>
+ <% } %>
+</h2>
+<div class="pdfasnote">
+ <% if (freeText) { %>
+ <fmt:message key="signupload.selectfilenote.freetext"/>
+ <% } else { %>
+ <fmt:message key="signupload.selectfilenote"/>
+ <% } %>
+</div>
+<form name="updateform" id="updateform" accept-charset="UTF-8" method="post" action="<%= request.getContextPath() %>/UpdateForm">
+ <input type="hidden" name="<%= FormFields.FIELD_SIGNATURE_TYPE %>" value=""/>
+ <input type="hidden" name="<%= FormFields.FIELD_MODE %>" value=""/>
+ <input type="hidden" name="<%= FormFields.FIELD_CONNECTOR %>" value=""/>
+ <input type="hidden" name="<%= FormFields.FIELD_PDFA_ENABLED %>" value=""/>
+ <input type="hidden" name="<%= FormFields.FIELD_SOURCE %>" value=""/>
+ <% if (freeText) { %>
+ <input type="hidden" name="<%= FormFields.FIELD_FREETEXT %>" value=""/>
+ <% } // end if %>
+</form>
+<form name="submitform" id="submitform"
+ enctype="multipart/form-data"
+ accept-charset="UTF-8"
+ method="post"
+ action="<%= request.getContextPath() %>/Sign">
+ <table border="0" cellspacing="0" cellpadding="4" id="pdfasupperformtable">
+ <tr>
+ <td align="left" nowrap="nowrap"><label><fmt:message key="signupload.signaturetype"/>:</label></td>
+ <td align="left">
+ <select class="field" name="<%= FormFields.FIELD_SIGNATURE_TYPE %>" onchange="return updateForm();">
+ <option value="<%= TYPE_DE %>" <%= TYPE_DE.equals(type) ? "selected=\"selected\"" : "" %>><fmt:message key="signupload.signaturetype.signaturblock.de"/></option>
+ <option value="<%= TYPE_EN %>" <%= TYPE_EN.equals(type) ? "selected=\"selected\"" : "" %>><fmt:message key="signupload.signaturetype.signaturblock.en"/></option>
+ </select>
+ <!-- %= // FormFields.generateTypeSelectBox() % -->
+ <span style="padding-left: 20px; 1px solid black;"></span>
+ <input type="checkbox" name="<%= FormFields.FIELD_PDFA_ENABLED %>" value="true" <%= pdfa ? "checked=\"checked\"" : "" %> onclick="return updateForm();"/>&nbsp;<fmt:message key="signupload.pdfa"/>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" nowrap="nowrap"><label><fmt:message key="signupload.signaturemode"/>:</label></td>
+ <td align="left">
+ <% if (forceTextualForMocca && Constants.SIGNATURE_DEVICE_MOC.equals(device)) {%>
+ <fmt:message key="common.textual"/>
+ <input type="hidden" name="<%= FormFields.FIELD_MODE %>" value="<%= FormFields.VALUE_MODE_TEXTUAL %>"/>
+ <% } else { %>
+ <select name="<%= FormFields.FIELD_MODE %>" onchange="return updateForm();">
+ <option value="<%= FormFields.VALUE_MODE_BINARY %>" <%= FormFields.VALUE_MODE_BINARY.equals(mode) ? "selected=\"selected\"" : "" %>><fmt:message key="common.binary"/></option>
+ <option value="<%= FormFields.VALUE_MODE_TEXTUAL %>" <%= FormFields.VALUE_MODE_TEXTUAL.equals(mode) ? "selected=\"selected\"" : "" %>><fmt:message key="common.textual"/></option>
+ <!--
+ <option value="<%= FormFields.VALUE_MODE_DETACHED %>">detached</option>
+ -->
+ </select>
+ <% } %>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" nowrap="nowrap"><label><fmt:message key="signupload.signaturedevice"/>:</label></td>
+ <td align="left">
+ <select name="<%= FormFields.FIELD_CONNECTOR %>" onchange="return updateForm();">
+ <option value="<%= Constants.SIGNATURE_DEVICE_BKU %>" <%= Constants.SIGNATURE_DEVICE_BKU.equals(device) ? "selected=\"selected\"" : "" %>><fmt:message key="common.bku"/></option>
+ <option value="<%= Constants.SIGNATURE_DEVICE_MOC %>" <%= Constants.SIGNATURE_DEVICE_MOC.equals(device) ? "selected=\"selected\"" : "" %>><fmt:message key="common.mocca"/></option>
+ </select>
+ </td>
+ </tr>
+ <!--
+ <tr>
+ <td align="left" nowrap="nowrap"><label><fmt:message key="signupload.file"/>:</label></td>
+ <td align="left"><input size="50" type="file" id="fileupload" name="<%= FormFields.FIELD_UPLOAD %>" accept="application/pdf"/></td>
+ </tr>
+ -->
+ <tr>
+ <td align="left" nowrap="nowrap" style="vertical-align: top;">
+ <select name="<%= FormFields.FIELD_SOURCE %>" onchange="return updateForm();">
+ <option value="<%= FormFields.VALUE_SOURCE_FILE %>" <%= FormFields.VALUE_SOURCE_FILE.equals(source) ? "selected=\"selected\"" : "" %>><fmt:message key="signupload.file"/></option>
+ <option value="<%= FormFields.VALUE_SOURCE_FREETEXT %>" <%= FormFields.VALUE_SOURCE_FREETEXT.equals(source) ? "selected=\"selected\"" : "" %>><fmt:message key="signupload.freetext"/></option>
+ </select>
+ </td>
+ <td align="left">
+ <% if (freeText) { %>
+ <textarea class="freetext" id="freetext" name="<%= FormFields.FIELD_FREETEXT %>"><%= StringEscapeUtils.escapeHtml(freeTextValue) %></textarea>
+ <% } else { %>
+ <input size="50" type="file" id="fileupload" name="<%= FormFields.FIELD_UPLOAD %>" accept="application/pdf"/>
+ <% } // end if freetext %>
+ </td>
+ </tr>
+ </table>
+ <% if ((!freeText && (FormFields.VALUE_MODE_TEXTUAL.equals(mode))) || pdfa) { %>
+ <div class="pdfasnote"><span class="pdfasemphasis">
+ <fmt:message key="signupload.note.prefix"/>:</span>
+ <% if ((FormFields.VALUE_MODE_TEXTUAL.equals(mode))) { %>
+ <% if (!freeText) { %><fmt:message key="signupload.note.file"/><% } %> <fmt:message key="signupload.note"/>
+ <% } // end if %>
+ <% if (pdfa) { %> <fmt:message key="signupload.note.pdfa"/><% } %>
+ </div>
+ <% } // end if %>
+
+ <input type="hidden" name="<%= FormFields.FIELD_DOWNLOAD %>" value="<%= FormFields.VALUE_DOWNLOAD_ATTACHMENT %>"/>
+ <input type="hidden" name="<%= FormFields.FIELD_PREVIEW %>" value="false" />
+
+ <div class="pdfasverticalspace"></div>
+
+ <jsp:include page="SIGNATURBLOCK.jsp"/>
+
+ <div class="pdfasnote"><fmt:message key="signupload.noteonsigmark"/></div>
+ <% if (Constants.SIGNATURE_DEVICE_BKU.equals(device)) { %>
+ <div>
+ <!-- =============================================== Start BKU-Erkennung -->
+ <iframe src="<%= request.getContextPath() %>/bku-erkennung/bku-erkennung_iframe.html" width="152" height="57" id="sep_iframe" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" allowtransparency="true"></iframe>
+ <!-- ================================================ Stop BKU-Erkennung -->
+ </div>
+ <% } else if (Constants.SIGNATURE_DEVICE_MOC.equals(device)) { %>
+ <div>
+ <img src="images/chiperling.jpg" width="57" height="57" alt="<fmt:message key="common.mocca"/>"/>
+ </div>
+ <% } else { %>
+ <div class="pdfasverticalspace"></div>
+ <% } // end if %>
+ <div>
+ <input type="submit" value="<fmt:message key="signupload.button.sign"/>" onclick="return submitForm(false);"/>
+ <input type="submit" value="<fmt:message key="signupload.button.preview"/>" onclick="return submitForm(true);"/>
+ </div>
+
+</form>
+
+</body>
+</html>