Fix date formatting in ServiceActivity custom short view. For now, displaying mm/yyyy, but may want to change to just yyyy.

This commit is contained in:
rjy7 2010-03-04 20:08:39 +00:00
parent 95c58ea9e3
commit 633f05cc58

View file

@ -8,6 +8,8 @@
PREDICATE - predicateUri PREDICATE - predicateUri
OBJECT - individual OBJECT - individual
Predicates: professionalServiceActivity on Person page: Person professionalServiceActivity ServiceActivity
organizationRelatedActivity on Organization page: Organization organizationRelatedActivity ServiceActivity
--%> --%>
<c:choose> <c:choose>
@ -20,13 +22,21 @@
<c:set var="title" value=" ${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#titleOrRole'].dataPropertyStatements[0].data}"/> <c:set var="title" value=" ${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#titleOrRole'].dataPropertyStatements[0].data}"/>
<%-- Get the time span of the service activity --%> <%-- Get the time span of the service activity --%>
<%-- RY FIX the display --%>
<c:set var="startYearMonth" value="${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#startYearMonth'].dataPropertyStatements[0].data}"/> <c:set var="startYearMonth" value="${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#startYearMonth'].dataPropertyStatements[0].data}"/>
<c:set var="endYearMonth" value="${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#endYearMonth'].dataPropertyStatements[0].data}"/> <c:set var="endYearMonth" value="${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#endYearMonth'].dataPropertyStatements[0].data}"/>
<c:if test="${!empty startYearMonth}"> <c:if test="${!empty startYearMonth}">
<c:set var="timeSpan" value=", ${startYearMonth} - "/> <%-- RY Don't know whether we should display just the year, or month and year.
Latter looks like too much info, but why collect it if we aren't going to display it?
Needs reformatting, otherwise we get e.g., "2008-10 - 2009-12"
<c:set var="startDate" value="${fn:substring(startYearMonth, 0, 4)}" /> --%>
<c:set var="start" value="${fn:split(startYearMonth, '-')}" />
<c:set var="startDate" value="${start[1]}/${start[0]}" />
<c:set var="timeSpan" value=", ${startDate} - "/>
<c:if test="${!empty endYearMonth}"> <c:if test="${!empty endYearMonth}">
<c:set var="timeSpan" value="${timeSpan}${endYearMonth}"/> <%-- <c:set var="endDate" value="${fn:substring(endYearMonth, 0, 4)}" /> --%>
<c:set var="end" value="${fn:split(endYearMonth, '-')}" />
<c:set var="endDate" value="${end[1]}/${end[0]}" />
<c:set var="timeSpan" value="${timeSpan}${endDate}"/>
</c:if> </c:if>
</c:if> </c:if>
@ -46,19 +56,18 @@
<c:when test="${!empty serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"> <c:when test="${!empty serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}">
<c:set var="objName" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"/> <c:set var="objName" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"/>
</c:when> </c:when>
<%-- otherwise case defined below --%>
<c:otherwise><%-- There's not even an organization name, so just display the title in place of the name --%>
<c:set var="objName" value="${title}"/>
<c:set var="title" value="" /><%-- don't output title twice --%>
</c:otherwise>
</c:choose> </c:choose>
</c:when> </c:when>
<%-- CASE 2: SUBJECT is Organization, OBJECT is ServiceActivity --%> <%-- CASE 2: SUBJECT is Organization, OBJECT is ServiceActivity --%>
<c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#organizationRelatedActivity'}"> <c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#organizationRelatedActivity'}">
<c:if test="${!empty serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#professionalServiceActivityBy']}">
<c:set var="obj" value="${serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#professionalServiceActivityBy'].objectPropertyStatements[0].object}" /> <c:set var="obj" value="${serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#professionalServiceActivityBy'].objectPropertyStatements[0].object}" />
<c:set var="objName" value="${obj.name}"/> <c:set var="objName" value="${obj.name}"/>
<c:set var="objUri" value="${obj.URI}"/> <c:set var="objUri" value="${obj.URI}"/>
</c:if>
<%-- else case handled below --%>
</c:when> </c:when>
<%-- CASE 3: Other predicate --%> <%-- CASE 3: Other predicate --%>
@ -67,6 +76,12 @@
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
<%-- No objName defined in either Case 1 or Case 2 --%>
<c:if test="${empty objName}">
<c:set var="objName" value="${title}"/>
<c:set var="title" value="" /><%-- don't output title twice --%>
</c:if>
<%-- Create an html link element to the objUri --%> <%-- Create an html link element to the objUri --%>
<c:if test="${!empty objUri}"> <c:if test="${!empty objUri}">
<c:url var="orgLink" value="/entity"><c:param name="uri" value="${objUri}"/></c:url> <c:url var="orgLink" value="/entity"><c:param name="uri" value="${objUri}"/></c:url>