From 3d88697da5a47139625700e591bef9baada4258a Mon Sep 17 00:00:00 2001 From: tknall Date: Mon, 21 Dec 2009 11:28:50 +0000 Subject: web application: many minor improvements (pdf/a selection for instance) Adobe signature attribute: added feature allowing configuration of field "reason" configuration updates default configuration updated git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@521 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- src/main/webapp/jsp/signupload.jsp | 54 ++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'src/main/webapp/jsp/signupload.jsp') diff --git a/src/main/webapp/jsp/signupload.jsp b/src/main/webapp/jsp/signupload.jsp index 526d2c1..010012b 100644 --- a/src/main/webapp/jsp/signupload.jsp +++ b/src/main/webapp/jsp/signupload.jsp @@ -3,6 +3,7 @@ <%@ page import="at.gv.egiz.pdfas.api.commons.Constants" %> <%@ page import="at.gv.egiz.pdfas.web.i18n.LanguageDecoratorMapper"%> <%@ page import="at.knowcenter.wag.egov.egiz.web.servlets.UpdateFormServlet"%> +<%@ page import="org.apache.commons.lang.BooleanUtils"%> @@ -12,7 +13,13 @@ <% boolean testMode = request.getContextPath().startsWith("/test-"); - boolean forceTextualForMocca = true; + 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"; + %> <% @@ -31,8 +38,9 @@ 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_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.submit(); return(false); } @@ -73,6 +81,19 @@ 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) { @@ -80,9 +101,23 @@ if (locale == null) { locale = request.getLocale(); } - type = Locale.GERMAN.getLanguage().equals(locale.getLanguage()) ? "SIGNATURBLOCK_DE" : "SIGNATURBLOCK_EN"; - session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_TYPE_KEY, type); + 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); %> </head> @@ -102,6 +137,7 @@ <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=""/> </form> <form name="submitform" id="submitform" enctype="multipart/form-data" @@ -113,10 +149,12 @@ <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="SIGNATURBLOCK_DE" <%= "SIGNATURBLOCK_DE".equals(type) ? "selected=\"selected\"" : "" %>><fmt:message key="signupload.signaturetype.signaturblock.de"/></option> - <option value="SIGNATURBLOCK_EN" <%= "SIGNATURBLOCK_EN".equals(type) ? "selected=\"selected\"" : "" %>><fmt:message key="signupload.signaturetype.signaturblock.en"/></option> + <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();"/> <fmt:message key="signupload.pdfa"/> </td> </tr> <tr> @@ -150,7 +188,7 @@ <td align="left"><input size="50" type="file" id="fileupload" name="<%= FormFields.FIELD_UPLOAD %>" accept="application/pdf"/></td> </tr> </table> - <div class="pdfasnote"><span class="pdfasemphasis"><fmt:message key="signupload.note.prefix"/>:</span> <fmt:message key="signupload.note"/></div> + <div class="pdfasnote"><span class="pdfasemphasis"><fmt:message key="signupload.note.prefix"/>:</span> <fmt:message key="signupload.note"/> <% if (pdfa) { %><fmt:message key="signupload.note.pdfa"/><% } %></div> <input type="hidden" name="<%= FormFields.FIELD_DOWNLOAD %>" value="<%= FormFields.VALUE_DOWNLOAD_ATTACHMENT %>"/> <input type="hidden" name="<%= FormFields.FIELD_PREVIEW %>" value="false" /> -- cgit v1.2.3