Skip to content

Commit

Permalink
ETCCB-109
Browse files Browse the repository at this point in the history
  • Loading branch information
heather999 committed Sep 13, 2016
1 parent 67cadbe commit 4de6e02
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
11 changes: 10 additions & 1 deletion src/main/java/org/lsst/camera/portal/queries/QueryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,16 @@ public static String stringFromList(List<Integer> theList) {
}

public static String truncateString(String inputStr, String token) {
return inputStr.substring(0, inputStr.lastIndexOf(token));
if (inputStr != null) {
Integer ind = inputStr.lastIndexOf(token);
if (ind >= 0) {
return inputStr.substring(0, ind);
} else {
return null;
}
} else {
return null;
}
}


Expand Down
24 changes: 16 additions & 8 deletions src/main/webapp/WEB-INF/tags/eTrav/activityList.tag
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,22 @@ http://stackoverflow.com/questions/14431907/how-to-access-duplicate-column-names
</sql:query>
<c:choose>
<c:when test="${downloadQuery.rowCount>0}" >
<c:set var="firstRow" value="${downloadQuery.rows[0]}" scope="page"/>
<c:set var="curPath" value="${portal:truncateString(firstRow.virtualPath,'/')}" scope="page"/>
<c:url var="dcLink" value="http://srs.slac.stanford.edu/DataCatalog/">
<c:param name="folderPath" value="${curPath}"/>
<c:param name="experiment" value="LSST-CAMERA"/>
<c:param name="showFileList" value="true"/>
</c:url>
<a href="${dcLink}" style="color: rgb(6,82,32)" target="_blank"><c:out value="Download Files"/></a>
<c:set var="firstRow" value="${downloadQuery.rows[0]}" />
<c:set var="curPath" value="${portal:truncateString(firstRow.virtualPath,'/')}" />
<c:choose>
<c:when test="${curPath != null}" >
<c:url var="dcLink" value="http://srs.slac.stanford.edu/DataCatalog/">
<c:param name="folderPath" value="${curPath}"/>
<c:param name="experiment" value="LSST-CAMERA"/>
<c:param name="showFileList" value="true"/>
</c:url>
<a href="${dcLink}" style="color: rgb(6,82,32)" target="_blank"><c:out value="Download Files"/></a>
</c:when>
<c:otherwise>
<c:out value="EMPTY"/>
</c:otherwise>
</c:choose>

</c:when>
<c:otherwise>
<c:out value="NA"/>
Expand Down

0 comments on commit 4de6e02

Please sign in to comment.