term-result.tag 6.49 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<%@ tag description="ES term result" pageEncoding="UTF-8" %>
<%@ attribute name="termResult" required="true" type="java.lang.Object" %>
<%@ attribute name="type" required="false" type="java.lang.String" %>
<%@ attribute name="count" required="false" type="java.lang.Integer" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<c:choose>
  <c:when test="${count eq null or count eq 0}">
    <c:set var="totalCount" value="${termResult.totalCount+termResult.missingCount}" />
  </c:when>
  <c:otherwise>
    <c:set var="totalCount" value="${count}" />
  </c:otherwise>
</c:choose>

Taisiya Glushko's avatar
Taisiya Glushko committed
21
22
23
24
25
26
27
28
29
<div class="terms-table">
  <c:forEach items="${termResult.terms}" var="term" varStatus="status">
    <div class="row">
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}">
        <c:choose>
          <c:when test="${type=='country'}">
            <a href="<c:url value="/geo/${term.term.toUpperCase()}" />"><c:out value="${jspHelper.getCountry(term.term).getName(pageContext.response.locale)}" /></a>
          </c:when>
          <c:when test="${type=='crop'}">
30
            <span><c:out value="${jspHelper.getCrop(term.term).getName(pageContext.response.locale)}" /></span>
Taisiya Glushko's avatar
Taisiya Glushko committed
31
32
33
34
35
36
37
38
39
40
41
          </c:when>
          <c:when test="${type=='instCode'}">
            <a href="<c:url value="/wiews/${term.term.toUpperCase()}" />"><c:out value="${term.term.toUpperCase()}" /></a>
          </c:when>
          <c:when test="${type=='bool' and term.term=='T'}">
            <spring:message code="boolean.true" />
          </c:when>
          <c:when test="${type=='bool' and term.term=='F'}">
            <spring:message code="boolean.false" />
          </c:when>
          <c:when test="${type ne null && type.startsWith('i18n')}">
Matija Obreza's avatar
Matija Obreza committed
42
            <span><spring:message code="${type.substring(5).concat('.').concat(term.term)}" /></span>
Taisiya Glushko's avatar
Taisiya Glushko committed
43
44
          </c:when>
          <c:when test="${type=='genus'}">
Matija Obreza's avatar
Matija Obreza committed
45
            <a href="<c:url value="/acn/t/${term.term}" />"><span dir="ltr" class="sci-name" ><i><c:out value="${term.term}" /></i></span></a>
Taisiya Glushko's avatar
Taisiya Glushko committed
46
47
          </c:when>
          <c:when test="${type=='species'}">
Matija Obreza's avatar
Matija Obreza committed
48
            <span dir="ltr" class="sci-name" ><i><c:out value="${term.term}" /></i></span>
Taisiya Glushko's avatar
Taisiya Glushko committed
49
50
51
52
53
          </c:when>
          <c:otherwise><c:out value="${term.term}" /></c:otherwise>
        </c:choose>
      </div>
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
54
55
        <span class="stats-number"><fmt:formatNumber value="${term.count}" /></span>
        <%--<span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${term.count/totalCount}" /></span>--%>
Taisiya Glushko's avatar
Taisiya Glushko committed
56
57
58
59
60
61
      </div>
    </div>
  </c:forEach>
  <c:if test="${termResult.otherCount gt 0}">
    <div class="row">
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}">
62
        <span><em><spring:message code="data-overview.otherCount" /></em></span>
Taisiya Glushko's avatar
Taisiya Glushko committed
63
64
      </div>
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
65
66
        <span class="stats-number"><fmt:formatNumber value="${termResult.otherCount}" /></span>
        <%--<span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${termResult.otherCount/totalCount}" /></span>--%>
Taisiya Glushko's avatar
Taisiya Glushko committed
67
68
69
70
71
72
      </div>
    </div>
  </c:if>
  <c:if test="${termResult.missingCount gt 0}">
    <div class="row">
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}">
73
        <span><em><spring:message code="data-overview.missingCount" /></em></span>
Taisiya Glushko's avatar
Taisiya Glushko committed
74
75
      </div>
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
76
77
        <span class="stats-number"><fmt:formatNumber value="${termResult.missingCount}" /></span>
        <%--<span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${termResult.missingCount/totalCount}" /></span>--%>
Taisiya Glushko's avatar
Taisiya Glushko committed
78
79
80
81
82
83
      </div>
    </div>
  </c:if>
</div>

<%--<table class="terms-table">
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<c:forEach items="${termResult.terms}" var="term">
  <tr><td>
  <c:choose>
    <c:when test="${type=='country'}">
      <a href="<c:url value="/geo/${term.term.toUpperCase()}" />"><c:out value="${jspHelper.getCountry(term.term).getName(pageContext.response.locale)}" /></a>
    </c:when>
    <c:when test="${type=='crop'}">
      <c:out value="${jspHelper.getCrop(term.term).getName(pageContext.response.locale)}" />
    </c:when>
    <c:when test="${type=='instCode'}">
      <a href="<c:url value="/wiews/${term.term.toUpperCase()}" />"><c:out value="${term.term.toUpperCase()}" /></a>
    </c:when>
    <c:when test="${type=='bool' and term.term=='T'}">
      <spring:message code="boolean.true" />
    </c:when>
    <c:when test="${type=='bool' and term.term=='F'}">
      <spring:message code="boolean.false" />
    </c:when>
    <c:when test="${type ne null && type.startsWith('i18n')}">
      <spring:message code="${type.substring(5).concat('.').concat(term.term)}" />
    </c:when>
    <c:when test="${type=='genus'}">
      <a href="<c:url value="/acn/t/${term.term}" />"><span dir="ltr" class="sci-name" ><c:out value="${term.term}" /></span></a>
    </c:when>
    <c:when test="${type=='species'}">
      <span dir="ltr" class="sci-name" ><c:out value="${term.term}" /></span>
    </c:when>
Matija Obreza's avatar
Matija Obreza committed
111
    <c:otherwise><c:out value="${term.term}" /></c:otherwise>
112
  </c:choose>
Taisiya Glushko's avatar
Taisiya Glushko committed
113

114
115
116
117
118
119
120
121
122
  </td><td class="text-right"><fmt:formatNumber value="${term.count}" /> <span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${term.count/totalCount}" /></span></td></tr>
</c:forEach>
<c:if test="${termResult.otherCount gt 0}">
  <tr><td><em><spring:message code="data-overview.otherCount" /></em></td><td class="text-right"><fmt:formatNumber value="${termResult.otherCount}" /> <span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${termResult.otherCount/totalCount}" /></span></td></tr>
</c:if>
<c:if test="${termResult.missingCount gt 0}">
  <tr><td><em><spring:message code="data-overview.missingCount" /></em></td><td class="text-right"><fmt:formatNumber value="${termResult.missingCount}" /> <span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${termResult.missingCount/totalCount}" /></span></td></tr>
</c:if>
<%-- <tr><td><spring:message code="data-overview.totalCount" /></td><td class="text-right">!<fmt:formatNumber value="${termResult.totalCount+termResult.missingCount}" /></td></tr> --%>
Taisiya Glushko's avatar
Taisiya Glushko committed
123
<%--</table>--%>
124
125

<c:remove var="totalCount" />