Commit a4f4cbf3 authored by Matija Obreza's avatar Matija Obreza

CDN configuration (flags)

parent cbd19451
...@@ -34,13 +34,27 @@ public class EnvVariablesFilter extends OncePerRequestFilter { ...@@ -34,13 +34,27 @@ public class EnvVariablesFilter extends OncePerRequestFilter {
@Value("${google.analytics.account}") @Value("${google.analytics.account}")
private String googleAnalyticsAccount; private String googleAnalyticsAccount;
@Value("${cdn.flags.url}")
private String cdnFlagsUrl;
@Override
public void afterPropertiesSet() throws ServletException {
super.afterPropertiesSet();
cdnFlagsUrl = StringUtils.defaultIfBlank(cdnFlagsUrl, null);
googleAnalyticsAccount = StringUtils.defaultIfBlank(googleAnalyticsAccount, null);
}
@Override @Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (StringUtils.isNotBlank(googleAnalyticsAccount)) { if (googleAnalyticsAccount != null) {
request.setAttribute("googleAnalyticsAccount", googleAnalyticsAccount); request.setAttribute("googleAnalyticsAccount", googleAnalyticsAccount);
} }
if (cdnFlagsUrl != null) {
request.setAttribute("cdnFlagsUrl", cdnFlagsUrl);
}
filterChain.doFilter(request, response); filterChain.doFilter(request, response);
} }
......
...@@ -24,7 +24,7 @@ db.url=jdbc:mysql://127.0.0.1/genesys2?useUnicode=true&characterEncoding=UTF-8&u ...@@ -24,7 +24,7 @@ db.url=jdbc:mysql://127.0.0.1/genesys2?useUnicode=true&characterEncoding=UTF-8&u
db.driverClassName = com.mysql.jdbc.Driver db.driverClassName = com.mysql.jdbc.Driver
db.username = root db.username = root
db.password = db.password =
db.showSql=true db.showSql=false
db.hbm2ddl=do-nothing db.hbm2ddl=do-nothing
c3p0.acquireIncrement=1 c3p0.acquireIncrement=1
...@@ -44,3 +44,6 @@ download.files.dir=./data/ ...@@ -44,3 +44,6 @@ download.files.dir=./data/
# GA Account # GA Account
google.analytics.account= google.analytics.account=
# CDN
cdn.base=http://cdn.sandbox.genesys-pgr.org
cdn.flags.url=${cdn.base}/flags
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<c:if test="${accession.countryOfOrigin ne null}"> <c:if test="${accession.countryOfOrigin ne null}">
<tr> <tr>
<td><spring:message code="accession.origin" /></td> <td><spring:message code="accession.origin" /></td>
<td><img src="http://genesys-pgr.org/images/flags/${accession.origin.toUpperCase()}.png" /> <a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"> <c:out value="${accession.countryOfOrigin.getName(pageContext.response.locale)}" /> <td><img src="${cdnFlagsUrl}/${accession.origin.toUpperCase()}.png" /> <a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"> <c:out value="${accession.countryOfOrigin.getName(pageContext.response.locale)}" />
</a></td> </a></td>
</tr> </tr>
</c:if> </c:if>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<body> <body>
<h1> <h1>
<c:out value="${country.getName(pageContext.response.locale)}" /> <c:out value="${country.getName(pageContext.response.locale)}" />
<img class="country-flag bigger" src="http://genesys-pgr.org/images/flags/${country.code3.toUpperCase()}.png" /> <img class="country-flag bigger" src="${cdnFlagsUrl}/${country.code3.toUpperCase()}.png" />
</h1> </h1>
<c:if test="${not country.current}"> <c:if test="${not country.current}">
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<body> <body>
<h1> <h1>
<c:out value="${country.getName(pageContext.response.locale)}" /> <c:out value="${country.getName(pageContext.response.locale)}" />
<img class="country-flag bigger" src="http://genesys-pgr.org/images/flags/${country.code3.toUpperCase()}.png" /> <img class="country-flag bigger" src="${cdnFlagsUrl}/${country.code3.toUpperCase()}.png" />
</h1> </h1>
<form role="form" class="" action="<c:url value="/geo/${country.code3.toLowerCase()}/update" />" method="post"> <form role="form" class="" action="<c:url value="/geo/${country.code3.toLowerCase()}/update" />" method="post">
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<h1> <h1>
<img class="country-flag bigger" src="http://genesys-pgr.org/images/flags/${faoInstitute.country.code3.toUpperCase()}.png" /> <img class="country-flag bigger" src="${cdnFlagsUrl}/${faoInstitute.country.code3.toUpperCase()}.png" />
<c:out value="${faoInstitute.fullName}" /> <c:out value="${faoInstitute.fullName}" />
<small><c:out value="${faoInstitute.code}" /></small> <small><c:out value="${faoInstitute.code}" /></small>
</h1> </h1>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<div class="row" style=""> <div class="row" style="">
<div class="col-sm-4"> <div class="col-sm-4">
<spring:message code="faoInstitute.country" />: <spring:message code="faoInstitute.country" />:
<%-- <img src="http://genesys-pgr.org/images/flags/${faoInstitute.country.code3.toUpperCase()}.png" /> --%> <%-- <img src="${cdnFlagsUrl}/${faoInstitute.country.code3.toUpperCase()}.png" /> --%>
<a href="<c:url value="/geo/${faoInstitute.country.code3.toLowerCase()}" />"><c:out value="${faoInstitute.country.getName(pageContext.response.locale)}" /></a> <a href="<c:url value="/geo/${faoInstitute.country.code3.toLowerCase()}" />"><c:out value="${faoInstitute.country.getName(pageContext.response.locale)}" /></a>
</div> </div>
<%-- <div class="col-sm-4"> <%-- <div class="col-sm-4">
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</head> </head>
<body> <body>
<h1> <h1>
<img class="country-flag bigger" src="http://genesys-pgr.org/images/flags/${faoInstitute.country.code3.toUpperCase()}.png" /> <img class="country-flag bigger" src="${cdnFlagsUrl}/${faoInstitute.country.code3.toUpperCase()}.png" />
<c:out value="${faoInstitute.fullName}" /> <c:out value="${faoInstitute.fullName}" />
<small><c:out value="${faoInstitute.code}" /></small> <small><c:out value="${faoInstitute.code}" /></small>
</h1> </h1>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment