diff --git a/src/main/java/edu/harvard/iq/dataverse/GuestbookPage.java b/src/main/java/edu/harvard/iq/dataverse/GuestbookPage.java index 37d7169b959..7cbb69e5c1d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/GuestbookPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/GuestbookPage.java @@ -235,7 +235,7 @@ public String save() { boolean create = false; if (!(guestbook.getCustomQuestions() == null)) { for (CustomQuestion cq : guestbook.getCustomQuestions()) { - if (cq.getQuestionType().equals("text")) { + if (cq.getQuestionType().equals("text") || cq.getQuestionType().equals("textarea")) { cq.setCustomQuestionValues(null); } } diff --git a/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java index 2bd4e3f3d1d..385e340ba58 100644 --- a/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java @@ -35,7 +35,7 @@ import javax.persistence.Query; import javax.persistence.StoredProcedureQuery; import javax.persistence.TypedQuery; - +import org.apache.commons.text.StringEscapeUtils; /** * * @author skraffmiller @@ -269,7 +269,7 @@ private String formatPersistentIdentifier(String protocol, String authority, Str This method is used to produce an array of guestbook responses for displaying on the guestbook-responses page. */ - public List findArrayByGuestbookIdAndDataverseId (Long guestbookId, Long dataverseId, Long limit){ + public List findArrayByGuestbookIdAndDataverseId(Long guestbookId, Long dataverseId, Long limit){ Guestbook gbIn = em.find(Guestbook.class, guestbookId); boolean hasCustomQuestions = gbIn.getCustomQuestions() != null; @@ -400,9 +400,9 @@ private Map selectCustomQuestionAnswers(Long dataverseId, Long if (asString) { // as combined strings of comma-separated question and answer values + //assuming the strings are only being created for writing out to csv which seems to be the case + String qa = SEPARATOR + StringEscapeUtils.escapeCsv((String)response[0]) + SEPARATOR + (response[1] == null ? "" : StringEscapeUtils.escapeCsv((String)response[1])); - String qa = SEPARATOR + ((String)response[0]).replace(',', ' ') + SEPARATOR + (response[1] == null ? "" : ((String)response[1]).replace(',', ' ')); - if (ret.containsKey(responseId)) { ret.put(responseId, ret.get(responseId) + qa); } else { @@ -414,6 +414,9 @@ private Map selectCustomQuestionAnswers(Long dataverseId, Long if (!ret.containsKey(responseId)) { ret.put(responseId, new ArrayList<>()); } + if(response[1] != null){ + response[1]=((String)response[1]).replaceAll("(\r\n|\n)", "
"); + } ((List) ret.get(responseId)).add(response); } diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 81d1c9735f6..1d12900c0e9 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -1283,7 +1283,8 @@ dataset.manageGuestbooks.guestbook.customQuestions.description=Create your own q dataset.manageGuestbooks.guestbook.customQuestions.questionType=Question Type dataset.manageGuestbooks.guestbook.customQuestions.questionText=Question Text dataset.manageGuestbooks.guestbook.customQuestions.responseOptions=Response Options -dataset.manageGuestbooks.guestbook.customQuestions.questionType.text=Text +dataset.manageGuestbooks.guestbook.customQuestions.questionType.text=Single Line +dataset.manageGuestbooks.guestbook.customQuestions.questionType.textarea=Multiple Line dataset.manageGuestbooks.guestbook.customQuestions.questionType.multiple=Multiple Choice # guestbookResponseFragment.xhtml diff --git a/src/main/webapp/file-download-popup-fragment.xhtml b/src/main/webapp/file-download-popup-fragment.xhtml index b9a8c6e0425..c88ee8c9c78 100644 --- a/src/main/webapp/file-download-popup-fragment.xhtml +++ b/src/main/webapp/file-download-popup-fragment.xhtml @@ -128,6 +128,13 @@ requiredMessage="#{bundle['requiredField']}"> + + - #{customQResponse[0]}: #{customQResponse[1]}

-
+ + : + +
+
+ diff --git a/src/main/webapp/guestbook.xhtml b/src/main/webapp/guestbook.xhtml index e1f2d5beaa6..9cbd368157a 100644 --- a/src/main/webapp/guestbook.xhtml +++ b/src/main/webapp/guestbook.xhtml @@ -109,6 +109,7 @@ +