From: <hs...@us...> - 2012-01-06 16:46:56
|
Revision: 1008 http://treebase.svn.sourceforge.net/treebase/?rev=1008&view=rev Author: hshyket Date: 2012-01-06 16:46:50 +0000 (Fri, 06 Jan 2012) Log Message: ----------- Adding x-access-code parameter to matrix and tree objects so that it generates a unique file for caching. Removing access to unpublished study's RDF page. Allowing access to unpublished studies trees so that PhyloWidget is able to grab the file Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-06 16:46:50 UTC (rev 1008) @@ -70,6 +70,12 @@ TBPersistable theObject = getStudyService().findByID(theClass, treebaseIDString.getId()); if ( null != theObject ) { + if (! getStudyService().findByID(treebaseIDString.getId()).isPublished()) { + response.setContentType("text/plain"); + response.setStatus(HttpServletResponse.SC_SEE_OTHER); + response.setHeader("Location", "/treebase-web/accessviolation.html"); + return null; + } request.getSession().setAttribute("theObject", theObject); LOGGER.info("Object: "+theObject); } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2012-01-06 16:46:50 UTC (rev 1008) @@ -45,7 +45,8 @@ throw new ObjectNotFoundException("Can't find study for tree "+objectId); } - checkAccess(study.isPublished()); + //not checking access due to need for Phloywidget to access tree when in review + //checkAccess(phyloTree.getStudy().isPublished()); Map<String,String> params = new HashMap<String,String>(); params.put("id",""+study.getId()); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp 2012-01-06 16:46:50 UTC (rev 1008) @@ -13,7 +13,9 @@ </c:url> <c:set var="counter" value="0"/> - +<% + pageContext.setAttribute("accesscode",request.getSession().getAttribute("x-access-code")); +%> <display:table name="matrices" requestURI="" class="list" @@ -67,7 +69,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${matrix.phyloWSPath.purl}"><c:param name="format">nexml</c:param></c:url> + <c:url var="url" value="${matrix.phyloWSPath.purl}"> + <c:param name="format">nexml</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -95,7 +104,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${matrix.phyloWSPath.purl}"><c:param name="format">nexus</c:param></c:url> + <c:url var="url" value="${matrix.phyloWSPath.purl}"> + <c:param name="format">nexus</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -111,7 +127,8 @@ headerClass="iconColumn"> <c:url value="/search/downloadANexusFile.html" var="originalMatrixURL"> <c:param name="id">${study.id}</c:param> - <c:param name="matrixid">${matrix.id}</c:param> + <c:param name="matrixid">${matrix.id}</c:param> + <c:if test="${!empty accesscode}"><c:param name="x-access-code"><c:out value='${accesscode}' /></c:param></c:if> </c:url> <a href="${originalMatrixURL}"> <img @@ -126,7 +143,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${matrix.phyloWSPath.purl}"><c:param name="format">html</c:param></c:url> + <c:url var="url" value="${matrix.phyloWSPath.purl}"> + <c:param name="format">html</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp 2012-01-06 16:46:50 UTC (rev 1008) @@ -69,7 +69,7 @@ </c:if> <c:if test="${not empty cit.URL && cit.URL != 'http://' }"> <li> - Other URL: + Other URL: <a href="<c:out value="${cit.URL}"/>"> <img class="iconButton" src="<fmt:message key="icons.weblink"/>" /> <c:out value="${cit.URL}"/> @@ -87,7 +87,10 @@ </a> </li> <li>Other versions: - <a href="${baseLink}?format=nexus"> + <% + pageContext.setAttribute("accesscode",request.getSession().getAttribute("x-access-code")); + %> + <a href="${baseLink}?format=nexus<c:if test="${!empty accesscode}">&x-access-code=<c:out value='${accesscode}' /></c:if>"> <img class="iconButton" src="<fmt:message key="icons.download.reconstructed"/>" @@ -95,7 +98,7 @@ alt="<fmt:message key="download.reconstructedfile"/>"/> Nexus </a> - <a href="${baseLink}?format=nexml"> + <a href="${baseLink}?format=nexml<c:if test="${!empty accesscode}">&x-access-code=<c:out value='${accesscode}' /></c:if>"> <img class="iconButton" src="<fmt:message key="icons.xml"/>" Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp 2012-01-06 16:46:50 UTC (rev 1008) @@ -8,11 +8,14 @@ <c:url var="studyURL" value="summary.html"> <c:param name="id" value="${study.id}"/> -</c:url> +</c:url> +<% + pageContext.setAttribute("accesscode",request.getSession().getAttribute("x-access-code")); +%> <script type="text/javascript"> function openPhylowidget(tree_id) { - var realURL = "http://www.phylowidget.org/full/?tree='http://"+location.host+"/treebase-web/tree_for_phylowidget/"+"TB2:Tr"+tree_id+"'"; + var realURL = "http://www.phylowidget.org/full/?tree='http://"+location.host+"/treebase-web/tree_for_phylowidget/"+"TB2:Tr"+tree_id<c:if test="${!empty accesscode}">+"?x-access-code=<c:out value='${accesscode}' />"</c:if>+"'"; window.open(realURL,'myplwidget') } </script> @@ -67,7 +70,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${baseURL}"><c:param name="format">nexml</c:param></c:url> + <c:url var="url" value="${baseURL}"> + <c:param name="format">nexml</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -95,7 +105,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${baseURL}"><c:param name="format">nexus</c:param></c:url> + <c:url var="url" value="${baseURL}"> + <c:param name="format">nexus</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -111,7 +128,12 @@ headerClass="iconColumn"> <c:url value="/search/downloadANexusFile.html" var="originalTreeURL"> <c:param name="id">${study.id}</c:param> - <c:param name="treeid">${tree.id}</c:param> + <c:param name="treeid">${tree.id}</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> </c:url> <a href="${originalTreeURL}"> <img This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |