From: <hs...@us...> - 2011-05-13 14:32:56
|
Revision: 867 http://treebase.svn.sourceforge.net/treebase/?rev=867&view=rev Author: hshyket Date: 2011-05-13 14:32:50 +0000 (Fri, 13 May 2011) Log Message: ----------- Fixing issue where Javascript was broken when JSON data had line breaks in it. Encoded the line breaks to characters. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/studyToJSON.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/studyToJSON.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/studyToJSON.jsp 2011-05-12 22:49:40 UTC (rev 866) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/studyToJSON.jsp 2011-05-13 14:32:50 UTC (rev 867) @@ -2,7 +2,15 @@ { id:${study.id}, name:'<c:out value="${study.name}"/>', -notes:'<c:out value="${study.notes}"/>', +<% pageContext.setAttribute("returnLineChar", "\r"); %> +<% pageContext.setAttribute("newLineChar", "\n"); %> +<c:set var="notes"> + ${fn:replace(study.notes,returnLineChar, "\\r")} +</c:set> +<c:set var="notes"> + ${fn:replace(notes,newLineChar, "\\n")} +</c:set> +notes:'<c:out value="${notes}"/>', authors:[<c:forEach var="author" items="${study.authors}" varStatus="status_analysis"> {id:${author.id},fullNameCitationStyle:'<c:out value="${author.fullNameCitationStyle}"/>'}, </c:forEach>], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |