aboutsummaryrefslogtreecommitdiff
path: root/src/main/webapp/jsp/signupload.jsp
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-03-16 12:07:29 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-03-16 12:07:29 +0000
commit11b5950be66bcc9d6f0bb28d3fc9d211bc70f4d9 (patch)
tree5a48a33069a318e269245998ecf89b387f331f67 /src/main/webapp/jsp/signupload.jsp
parentda4926845267ca8bedf34917bd3bfb94aeafa153 (diff)
downloadpdf-as-3-11b5950be66bcc9d6f0bb28d3fc9d211bc70f4d9.tar.gz
pdf-as-3-11b5950be66bcc9d6f0bb28d3fc9d211bc70f4d9.tar.bz2
pdf-as-3-11b5950be66bcc9d6f0bb28d3fc9d211bc70f4d9.zip
Catching OutOfMemory exceptions, returning appropriate error message/code
Binary signature: bug concerning indirect pdf objects fixed SignaturePositioning improved (Signature position can be declared by String which is parsed) Some more error codes (Out of memory, Invalid signature position) iText utility for creation of pdf files added ConfigUtils updated (destination of configuration to be extracted can now be chosen) PDFASUtils updated (more tools) WebApplication: Freetext pdf creation implemented WebApplication: XSS security updates git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@580 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/webapp/jsp/signupload.jsp')
-rw-r--r--src/main/webapp/jsp/signupload.jsp90
1 files changed, 79 insertions, 11 deletions
diff --git a/src/main/webapp/jsp/signupload.jsp b/src/main/webapp/jsp/signupload.jsp
index 010012b..f6c02fe 100644
--- a/src/main/webapp/jsp/signupload.jsp
+++ b/src/main/webapp/jsp/signupload.jsp
@@ -1,5 +1,6 @@
<%@ page import="at.knowcenter.wag.egov.egiz.web.FormFields" %>
<%@ page import="at.knowcenter.wag.egov.egiz.web.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="at.knowcenter.wag.egov.egiz.web.servlets.UpdateFormServlet"%>
@@ -41,18 +42,35 @@
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.value) {
- if (preview) {
- alert('<fmt:message key="signupload.documentnotselected.preview"/>');
- } else {
- alert('<fmt:message key="signupload.documentnotselected"/>');
+ 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);
}
- return(false);
}
if (preview) {
submitform.<%= FormFields.FIELD_PREVIEW %>.value='true';
@@ -118,6 +136,21 @@
}
}
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>
@@ -131,13 +164,29 @@
<fmt:message key="common.title"/>
<% } // end if %>
</h1>
-<h2 align="left"><fmt:message key="signupload.heading2"/></h2>
-<div class="pdfasnote"><fmt:message key="signupload.selectfilenote"/></div>
-<form name="updateform" id="updateform" method="post" action="<%= request.getContextPath() %>/UpdateForm">
+<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_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"
@@ -183,12 +232,31 @@
</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>
- <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>
+ <div class="pdfasnote"><span class="pdfasemphasis">
+ <fmt:message key="signupload.note.prefix"/>:</span> <% if (!freeText) { %><fmt:message key="signupload.note.file"/><% } %> <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" />