Commit 65ddb5cd authored by Matija Obreza's avatar Matija Obreza

Merge branch 'masterig'

parents c635da28 7553b35e
......@@ -61,6 +61,9 @@ public interface CountryRepository extends JpaRepository<Country, Long> {
@Query("select distinct c from Country c where c.nameL like :pattern")
List<Country> findWithI18N(@Param("pattern") String pattern);
@Query("select distinct c from Country c where c.code3 like ?1 or c.code2 like ?1 or c.name like ?1 or c.nameL like ?1")
List<Country> autocomplete(String ac, Pageable pageable);
// @Query("select distinct c from Country c where c.region in ( ?1 )")
// List<Country> findByRegions(List<Region> regions);
}
......@@ -61,4 +61,7 @@ public interface FaoInstituteRepository extends JpaRepository<FaoInstitute, Long
@Query("update FaoInstitute fi set accessionCount=(select count(a) from Accession a where a.institute = :institute ) where fi=:institute")
void updateInstituteAccessionCount(@Param("institute") FaoInstitute institute);
@Query("select distinct fi from FaoInstitute fi where fi.code like ?1 or fi.fullName like ?1 or fi.acronym like ?1 order by fi.accessionCount desc")
List<FaoInstitute> autocomplete(String string, Pageable pageable);
}
......@@ -117,4 +117,6 @@ public interface GeoService {
String filteredKml(String jsonFilter);
List<Country> autocomplete(String ac);
}
......@@ -64,4 +64,6 @@ public interface InstituteService {
List<FaoInstitute> listMyInstitutes(Sort sort);
List<FaoInstitute> autocomplete(String ac);
}
......@@ -89,9 +89,9 @@ public class DirectMysqlQuery {
}
protected DirectMysqlQuery join(ObjectNode jsonTree) {
if (hasFilter(jsonTree, "crop") || hasFilter(jsonTree, "genus") || hasFilter(jsonTree, "species") || hasFilter(jsonTree, "taxon")) {
if (hasFilter(jsonTree, "crops") || hasFilter(jsonTree, "taxonomy.genus") || hasFilter(jsonTree, "taxonomy.species") || hasFilter(jsonTree, "taxonomy.sciName")) {
innerJoin("taxonomy2", "t", "t.id=a.taxonomyId2");
if (hasFilter(jsonTree, "crop")) {
if (hasFilter(jsonTree, "crops")) {
innerJoin("croptaxonomy", "ct", "ct.taxonomyId=t.id");
innerJoin("crop", null, "crop.id=ct.cropId");
}
......@@ -102,15 +102,15 @@ public class DirectMysqlQuery {
innerJoin("organization", "org", "org.id=oi.organizationId");
}
if (hasFilter(jsonTree, "latitude") || hasFilter(jsonTree, "longitude") || hasFilter(jsonTree, "elevation")) {
if (hasFilter(jsonTree, "geo.latitude") || hasFilter(jsonTree, "geo.longitude") || hasFilter(jsonTree, "geo.elevation")) {
innerJoin("accessiongeo", "geo", "geo.accessionId=a.id");
}
if (hasFilter(jsonTree, "acceName")) {
if (hasFilter(jsonTree, "alias")) {
innerJoin("accessionalias", "accename", "accename.accessionId=a.id");
}
if (hasFilter(jsonTree, "collMissId")) {
if (hasFilter(jsonTree, "coll.collMissId")) {
innerJoin("accessioncollect", "col", "col.accessionId=a.id");
}
......@@ -131,23 +131,23 @@ public class DirectMysqlQuery {
createQuery(whereBuffer, "a.taxGenus", jsonTree.get("genusId"), params);
createQuery(whereBuffer, "a.taxSpecies", jsonTree.get("speciesId"), params);
createQuery(whereBuffer, "a.acceNumb", jsonTree.get("acceNumb"), params);
createQuery(whereBuffer, "a.orgCty", jsonTree.get("orgCty"), params);
createQuery(whereBuffer, "a.instCode", jsonTree.get("instCode"), params);
createQuery(whereBuffer, "a.inSGSV", jsonTree.get("inSvalbard"), params);
createQuery(whereBuffer, "a.mlsStat", jsonTree.get("mlsStat"), params);
createQuery(whereBuffer, "a.inTrust", jsonTree.get("inTrust"), params);
createQuery(whereBuffer, "a.orgCty", jsonTree.get("orgCty.iso3"), params);
createQuery(whereBuffer, "a.instCode", jsonTree.get("institute.code"), params);
createQuery(whereBuffer, "a.inSGSV", jsonTree.get("svalbard"), params);
createQuery(whereBuffer, "a.mlsStat", jsonTree.get("mlsStatus"), params);
createQuery(whereBuffer, "a.inTrust", jsonTree.get("art15"), params);
createQuery(whereBuffer, "a.sampStat", jsonTree.get("sampStat"), params);
createQuery(whereBuffer, "a.available", jsonTree.get("available"), params);
createQuery(whereBuffer, "org.slug", jsonTree.get("organization"), params);
createQuery(whereBuffer, "t.genus", jsonTree.get("genus"), params);
createQuery(whereBuffer, "t.species", jsonTree.get("species"), params);
createQuery(whereBuffer, "t.taxonName", jsonTree.get("taxon"), params);
createQuery(whereBuffer, "geo.longitude", jsonTree.get("longitude"), params);
createQuery(whereBuffer, "geo.latitude", jsonTree.get("latitude"), params);
createQuery(whereBuffer, "geo.elevation", jsonTree.get("elevation"), params);
createQuery(whereBuffer, "crop.shortName", jsonTree.get("crop"), params);
createQuery(whereBuffer, "accename.name", jsonTree.get("acceName"), params);
createQuery(whereBuffer, "col.collMissId", jsonTree.get("collMissId"), params);
createQuery(whereBuffer, "t.genus", jsonTree.get("taxonomy.genus"), params);
createQuery(whereBuffer, "t.species", jsonTree.get("taxonomy.species"), params);
createQuery(whereBuffer, "t.taxonName", jsonTree.get("taxonomy.sciName"), params);
createQuery(whereBuffer, "geo.longitude", jsonTree.get("geo.longitude"), params);
createQuery(whereBuffer, "geo.latitude", jsonTree.get("geo.latitude"), params);
createQuery(whereBuffer, "geo.elevation", jsonTree.get("geo.elevation"), params);
createQuery(whereBuffer, "crop.shortName", jsonTree.get("crops"), params);
createQuery(whereBuffer, "accename.name", jsonTree.get("alias"), params);
createQuery(whereBuffer, "col.collMissId", jsonTree.get("coll.collMissId"), params);
createQuery(whereBuffer, "storage.storage", jsonTree.get("storage"), params);
for (final Iterator<String> it = jsonTree.fieldNames(); it.hasNext();) {
......
......@@ -45,6 +45,7 @@ import org.genesys2.server.persistence.domain.TraitValueRepository;
import org.genesys2.server.service.GenesysFilterService;
import org.genesys2.server.service.GenesysFilterService.GenesysFilter.DataType;
import org.genesys2.server.service.GenesysFilterService.GenesysFilter.FilterType;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.SearchService;
import org.genesys2.server.service.TaxonomyService;
......@@ -84,6 +85,9 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
@Autowired
private TraitService traitService;
@Autowired
private GeoService geoService;
// @PersistenceContext
// private EntityManager entityManager;
......@@ -107,27 +111,27 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
public GenesysFilterServiceImpl() {
this.availableFilters = new ArrayList<GenesysFilter>();
this.availableFilters.add(new GenesysFilterImpl("crop", DataType.STRING));
this.availableFilters.add(new GenesysFilterImpl("crops", DataType.STRING));
this.availableFilters.add(new GenesysI18nListFilterImpl<Integer>("sampStat", DataType.NUMERIC).build("accession.sampleStatus", new Integer[] { 100,
110, 120, 130, 200, 300, 400, 410, 411, 412, 413, 414, 415, 416, 420, 421, 422, 423, 500, 600, 999 }));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("genus", "/explore/ac/genus"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("species", "/explore/ac/species"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxon", "/explore/ac/taxonomy"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxonomy.genus", "/explore/ac/genus"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxonomy.species", "/explore/ac/species"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxonomy.sciName", "/explore/ac/taxonomy"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("orgCty", "/explore/ac/country"));
this.availableFilters.add(new GenesysFilterImpl("latitude", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("longitude", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("elevation", DataType.NUMERIC));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("orgCty.iso3", "/explore/ac/country"));
this.availableFilters.add(new GenesysFilterImpl("geo.latitude", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("geo.longitude", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("geo.elevation", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("organization", DataType.STRING));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("instCode", "/explore/ac/instCode"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("institute.code", "/explore/ac/instCode"));
this.availableFilters.add(new GenesysFilterImpl("acceNumb", DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl("acceName", DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl("inSvalbard", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("mlsStat", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("inTrust", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("alias", DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl("sgsv", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("mlsStatus", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("art15", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("available", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("collMissId", DataType.STRING));
this.availableFilters.add(new GenesysFilterImpl("coll.collMissId", DataType.STRING));
this.availableFilters.add(new GenesysI18nListFilterImpl<Integer>("storage", DataType.NUMERIC).build("accession.storage", new Integer[] { 10, 11, 12,
13, 20, 30, 40, 50, 99 }));
}
......@@ -244,12 +248,12 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
final List<LabelValue<String>> completed = new ArrayList<LabelValue<String>>();
if ("instCode".equalsIgnoreCase(filter)) {
final List<FaoInstitute> faoInst = searchService.autocomplete(ac, FaoInstitute.class);
final List<FaoInstitute> faoInst = instituteService.autocomplete(ac);
for (final FaoInstitute inst : faoInst) {
completed.add(new LabelValue<String>(inst.getCode(), inst.getCode() + ", " + inst.getFullName()));
}
} else if ("country".equalsIgnoreCase(filter)) {
final List<Country> countries = searchService.autocomplete(ac, Country.class);
final List<Country> countries = geoService.autocomplete(ac);
for (final Country c : countries) {
completed.add(new LabelValue<String>(c.getCode3(), c.getCode3() + ", " + c.getName()));
}
......
......@@ -39,6 +39,7 @@ import org.genesys2.server.persistence.domain.ITPGRFAStatusRepository;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.GeoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
......@@ -130,7 +131,7 @@ public class GeoServiceImpl implements GeoService {
/**
* Check if we have a country that has
*
*
* @param name
* in i18n
* @param countryString
......@@ -160,7 +161,7 @@ public class GeoServiceImpl implements GeoService {
/**
* Get current country based on ISO3 code. Follow replacedBy where possible.
*
*
* @param code3
* @return
*/
......@@ -310,11 +311,11 @@ public class GeoServiceImpl implements GeoService {
* countryInfo.getRefnameId() != null) {
* country.setRefnameId(countryInfo.getRefnameId());
* countryRepository.save(country); }
*
*
* // if country name is not the same if
* (StringUtils.isNotBlank(countryInfo.getName()) &&
* !countryInfo.getName().equals(country.getName())) {
*
*
* LOG.info("Updating country name from: " + country.getName() +
* " to: " + countryInfo.getName());
* country.setName(countryInfo.getName());
......@@ -410,4 +411,9 @@ public class GeoServiceImpl implements GeoService {
public String filteredKml(String jsonFilter) {
return null;
}
@Override
public List<Country> autocomplete(String term) {
return countryRepository.autocomplete("%" + term + "%", new PageRequest(0, 10));
}
}
......@@ -212,4 +212,9 @@ public class InstituteServiceImpl implements InstituteService {
return instituteRepository.findByIds(oids, sort);
}
@Override
public List<FaoInstitute> autocomplete(String term) {
return instituteRepository.autocomplete("%" + term + "%", new PageRequest(0, 10));
}
}
......@@ -134,7 +134,7 @@ public class AccessionController extends BaseController {
throw new ResourceNotFoundException("No taxonomy with genus=" + genus);
}
model.addAttribute("filter", "{\"genus\":[\"" + taxonomy.getGenus() + "\"]}");
model.addAttribute("filter", "{\"taxonomy.genus\":[\"" + taxonomy.getGenus() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
......@@ -160,7 +160,7 @@ public class AccessionController extends BaseController {
throw new ResourceNotFoundException("No taxonomy with genus=" + genus);
}
model.addAttribute("filter", "{\"genus\":[\"" + taxonomy.getGenus() + "\"], \"species\":[\"" + taxonomy.getSpecies() + "\"]}");
model.addAttribute("filter", "{\"taxonomy.genus\":[\"" + taxonomy.getGenus() + "\"], \"taxonomy.species\":[\"" + taxonomy.getSpecies() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
......
......@@ -126,7 +126,7 @@ public class CountryController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"orgCty\":[\"" + country.getCode3() + "\"]}");
model.addAttribute("filter", "{\"orgCty.iso3\":[\"" + country.getCode3() + "\"]}");
return "redirect:/explore";
}
......
......@@ -95,7 +95,7 @@ public class CropController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"crop\":[\"" + crop.getShortName() + "\"]}");
model.addAttribute("filter", "{\"crops\":[\"" + crop.getShortName() + "\"]}");
return "redirect:/explore";
}
......
......@@ -114,7 +114,7 @@ public class ExplorerController extends BaseController {
throw new ResourceNotFoundException("No crop " + shortName);
}
model.addAttribute("filter", "{\"crop\":[\"" + crop.getShortName() + "\"]}");
model.addAttribute("filter", "{\"crops\":[\"" + crop.getShortName() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......@@ -191,7 +191,7 @@ public class ExplorerController extends BaseController {
final List<GenesysFilterService.GenesysFilter> additionalFilters = filterService.selectFilters(selectedFilters);
model.addAttribute("additionalFilters", additionalFilters);
if (ArrayUtils.contains(selectedFilters, "crop")) {
if (ArrayUtils.contains(selectedFilters, "crops")) {
_logger.debug("Adding crop list");
model.addAttribute("crops", cropService.list(getLocale()));
}
......
......@@ -165,7 +165,7 @@ public class WiewsController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"instCode\":[\"" + faoInstitute.getCode() + "\"]}");
model.addAttribute("filter", "{\"institute.code\":[\"" + faoInstitute.getCode() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......@@ -186,7 +186,7 @@ public class WiewsController extends BaseController {
}
_logger.debug("Got " + taxonomy2);
model.addAttribute("filter", "{\"instCode\":[\"" + faoInstitute.getCode() + "\"],\"genus\":[\"" + taxonomy2.getGenus() + "\"]}");
model.addAttribute("filter", "{\"institute.code\":[\"" + faoInstitute.getCode() + "\"],\"taxonomy.genus\":[\"" + taxonomy2.getGenus() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......@@ -207,7 +207,7 @@ public class WiewsController extends BaseController {
}
_logger.debug("Got " + taxonomy2);
model.addAttribute("filter", "{\"instCode\":[\"" + faoInstitute.getCode() + "\"],\"genus\":[\"" + taxonomy2.getGenus() + "\"],\"species\":[\""
model.addAttribute("filter", "{\"institute.code\":[\"" + faoInstitute.getCode() + "\"],\"taxonomy.genus\":[\"" + taxonomy2.getGenus() + "\"],\"taxonomy.species\":[\""
+ taxonomy2.getSpecies() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
......
......@@ -328,24 +328,23 @@ filter.filters-not-applied=You can filter the data.
filters.data-is-filtered=The data is filtered.
filters.toggle-filters=Filters
filter.taxonomy=Scientific name
filter.inTrust=ITPGRFA Art. 15 accession
filter.art15=ITPGRFA Art. 15 accession
filter.acceNumb=Accession number
filter.acceName=Accession name
filter.crop=Crop name
filter.countryOfOrigin=Country of Origin
filter.holdingInstitute=Holding Institute name
filter.orgCty=Country of Origin
filter.alias=Accession name
filter.crops=Crop name
filter.orgCty.iso3=Country of Origin
filter.institute.code=Holding Institute name
filter.sampStat=Biological status of accession
filter.instCode=Holding Institute
filter.latitude=Latitude
filter.longitude=Longitude
filter.elevation=Elevation
filter.genus=Genus
filter.species=Species
filter.institute.code=Holding Institute
filter.geo.latitude=Latitude
filter.geo.longitude=Longitude
filter.geo.elevation=Elevation
filter.taxonomy.genus=Genus
filter.taxonomy.species=Species
filter.taxSpecies=Species
filter.taxon=Scientific name
filter.inSvalbard=Safety duplicated in Svalbard
filter.mlsStat=MLS status of the accession
filter.taxonomy.sciName=Scientific name
filter.sgsv=Safety duplicated in Svalbard
filter.mlsStatus=MLS status of the accession
filter.available=Available for distribution
filter.download-dwca=Download ZIP
filter.add=Add filter
......
......@@ -9,10 +9,9 @@
<c:forEach items="${additionalFilters}" var="filter">
<c:set var="normalizedKey" value="${fn:replace(filter.key,':', '_')}"/>
<c:set var="filterKey" value="${filter.key}"/>
<c:set var="normalizedKey" value="${filter.key.replace(':', '_').replace('.','-')}"/>
<div class="clearfix filter-block" id="${normalizedKey}_filter" key="${normalizedKey}">
<div class="clearfix filter-block" id="<c:out value="${normalizedKey}" />_filter" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">
<div class="col-lg-3 edit-fil">
<c:if test="${not filter.core}">
......@@ -25,10 +24,10 @@
</div>
<div class="col-lg-5 filter-new">
<c:choose>
<c:when test="${filter.name=='crop'}">
<c:when test="${filter.name=='crops'}">
<div class="form-group input-group">
<span class="input-group-btn">
<select name="crop" id="cropselector" i-key = "${filterKey}" class="form-control filter-crop">
<select name="crops" id="cropselector" i-key="<c:out value="${filter.key}" />" class="form-control filter-crop">
<option value=""></option>
<c:forEach items="${crops}" var="c">
<option value="${c.shortName}" ${c.shortName== crop.shortName?'selected':''} ><c:out value="${c.getName(pageContext.response.locale)}" /></option>
......@@ -42,7 +41,7 @@
<c:forEach items="${filter.options}" var="option">
<div>
<label>
<input class="filter-list" id="${option.value}_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="${normalizedKey}" i-key="${normalizedKey}${option.value}" type="checkbox" value="${option.value}" />
<input class="filter-list" id="<c:out value="${normalizedKey}${option.value}" />_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />" type="checkbox" value="${option.value}" />
<spring:message code="${option.name}"/>
</label>
</div>
......@@ -54,7 +53,7 @@
<c:forEach items="${filter.options}" var="option">
<div>
<label>
<input class="filter-list" id="${option.value}_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="${normalizedKey}" i-key="${normalizedKey}${option.value}" type="checkbox" value="${option.value}" />
<input class="filter-list" id="<c:out value="${normalizedKey}${option.value}" />_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />" type="checkbox" value="${option.value}" />
<spring:message code="${option.name}"/>
</label>
</div>
......@@ -66,7 +65,7 @@
<div class="form-group input-group">
<span class="input-group-btn">
<input id="${normalizedKey}_input" class="span2 form-control autocomplete-filter string-type" x-source="${filter.autocompleteUrl}" placeholder="<spring:message code="filter.autocomplete-placeholder" />" type="text"/>
<button class="btn notimportant filter-auto" norm-key="${normalizedKey}" >+</button>
<button class="btn notimportant filter-auto" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">+</button>
</span>
</div>
</div>
......@@ -76,15 +75,15 @@
<span class="input-group-btn">
<input id="${normalizedKey}_input_1" class="span5 form-control" type="text"/>
<input id="${normalizedKey}_input_2" class="span5 form-control" type="text"/>
<button class="btn notimportant filter-range" norm-key="${normalizedKey}">+</button>
<button class="btn notimportant filter-range" norm-key="${normalizedKey}" i-key="<c:out value="${filter.key}" />">+</button>
</span>
</div>
</c:when>
<c:when test="${filter.dataType=='BOOLEAN'}">
<div class="">
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'true')?'checked':''} class="filter-bool" i-key="${normalizedKey}true" id="${normalizedKey}" value="true"><spring:message code="boolean.true"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'false')?'checked':''} class="filter-bool" i-key="${normalizedKey}false" id="${normalizedKey}" value="false"><spring:message code="boolean.false"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'null')?'checked':''} class="filter-bool" i-key="${normalizedKey}null" id="${normalizedKey}" value="null"><spring:message code="boolean.null"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'true')?'checked':''} class="filter-bool" i-key="<c:out value="${filter.key}" />" id="<c:out value="${normalizedKey}" />" value="true"><spring:message code="boolean.true"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'false')?'checked':''} class="filter-bool" i-key="<c:out value="${filter.key}" />" id="<c:out value="${normalizedKey}" />" value="false"><spring:message code="boolean.false"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'null')?'checked':''} class="filter-bool" i-key="<c:out value="${filter.key}" />" id="<c:out value="${normalizedKey}" />" value="null"><spring:message code="boolean.null"/></label></div>
</div>
</c:when>
<c:otherwise>
......@@ -96,7 +95,7 @@
<option value="equals"><spring:message code="filter.string.equals" /></option>
</select>
<input class="span2 form-control string-type" id="${normalizedKey}_input" type="text"/>
<button class="btn notimportant filter-auto" norm-key="${normalizedKey}">+</button>
<button class="btn notimportant filter-auto" norm-key="${normalizedKey}" i-key="<c:out value="${filter.key}" />">+</button>
</span>
</div>
</div>
......@@ -104,7 +103,7 @@
</c:choose>
</div>
<div class="col-lg-9">
<div class="filter-values" id="${normalizedKey}_value">
<div class="filter-values" id="<c:out value="${normalizedKey}" />_value">
</div>
<div style="margin-top: 3px" class="filter-apply-btn">
<button class="btn btn-primary apply"><spring:message code="filter.apply"/></button>
......
......@@ -57,7 +57,7 @@
<ul class="dropdown-menu">
<c:forEach items="${availableFilters}" var="filter">
<li><a href="#" id="${filter.key}_id" class="filter-enable">
<li><a href="#" i-key="${filter.key}" class="filter-enable">
<spring:message code="filter.${filter.key}"/></a></li>
</c:forEach>
</ul>
......@@ -80,10 +80,9 @@
<%-- Only render currently present filters --%>
<c:forEach items="${currentFilters}" var="filter">
<c:set var="normalizedKey" value="${fn:replace(filter.key,':', '_')}"/>
<c:set var="filterKey" value="${filter.key}"/>
<c:set var="normalizedKey" value="${filter.key.replace('.', '-').replace(':', '_')}"/>
<div class="clearfix filter-block" id="${normalizedKey}_filter" key="${normalizedKey}">
<div class="clearfix filter-block" id="<c:out value="${normalizedKey}" />_filter" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">
<div class="col-lg-3 edit-fil">
<c:if test="${not filter.core}">
<c:out value="${filter.title}" />
......@@ -101,7 +100,7 @@
<c:forEach items="${filter.options}" var="option">
<div>
<label>
<input class="filter-list" id="${option.value}_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="${normalizedKey}" i-key="${normalizedKey}${option.value}" type="checkbox" value="${option.value}" />
<input class="filter-list" id="<c:out value="${normalizedKey}${option.value}" />_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />" type="checkbox" value="${option.value}" />
<spring:message code="${option.name}"/>
</label>
</div>
......@@ -113,7 +112,7 @@
<c:forEach items="${filter.options}" var="option">
<div>
<label>
<input class="filter-list" id="${option.value}_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="${normalizedKey}" i-key="${normalizedKey}${option.value}" type="checkbox" value="${option.value}" />
<input class="filter-list" id="<c:out value="${normalizedKey}${option.value}" />_input" ${fn:contains(filters[filter.key], option.value)?'checked':''} norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />" type="checkbox" value="${option.value}" />
<spring:message code="${option.name}"/>
</label>
</div>
......@@ -124,8 +123,8 @@
<div class="ui-front">
<div class="form-group input-group">
<span class="input-group-btn">
<input id="${normalizedKey}_input" class="span2 form-control autocomplete-filter string-type" x-source="${filter.autocompleteUrl}" placeholder="<spring:message code="filter.autocomplete-placeholder" />" type="text"/>
<button class="btn notimportant filter-auto" norm-key="${normalizedKey}" >+</button>
<input id="<c:out value="${normalizedKey}" />_input" class="span2 form-control autocomplete-filter string-type" x-source="${filter.autocompleteUrl}" placeholder="<spring:message code="filter.autocomplete-placeholder" />" type="text"/>
<button class="btn notimportant filter-auto" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">+</button>
</span>
</div>
</div>
......@@ -133,23 +132,23 @@
<c:when test="${filter.dataType=='NUMERIC'}">
<div class="form-group input-group">
<span class="input-group-btn">
<input id="${normalizedKey}_input_1" class="span5 form-control" type="text"/>
<input id="${normalizedKey}_input_2" class="span5 form-control" type="text"/>
<button class="btn notimportant filter-range" norm-key="${normalizedKey}">+</button>
<input id="<c:out value="${normalizedKey}" />_input_1" class="span5 form-control" type="text"/>
<input id="<c:out value="${normalizedKey}" />_input_2" class="span5 form-control" type="text"/>
<button class="btn notimportant filter-range" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">+</button>
</span>
</div>
</c:when>
<c:when test="${filter.dataType=='BOOLEAN'}">
<div class="">
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'true')?'checked':''} class="filter-bool" i-key="${normalizedKey}true" id="${normalizedKey}" value="true"><spring:message code="boolean.true"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'false')?'checked':''} class="filter-bool" i-key="${normalizedKey}false" id="${normalizedKey}" value="false"><spring:message code="boolean.false"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'null')?'checked':''} class="filter-bool" i-key="${normalizedKey}null" id="${normalizedKey}" value="null"><spring:message code="boolean.null"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'true')?'checked':''} class="filter-bool" i-key="<c:out value="${filter.key}" />" id="<c:out value="${normalizedKey}" />" value="true"><spring:message code="boolean.true"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'false')?'checked':''} class="filter-bool" i-key="<c:out value="${filter.key}" />" id="<c:out value="${normalizedKey}" />" value="false"><spring:message code="boolean.false"/></label></div>
<div><label><input type="checkbox" ${fn:contains(filters[filter.key], 'null')?'checked':''} class="filter-bool" i-key="<c:out value="${filter.key}" />" id="<c:out value="${normalizedKey}" />" value="null"><spring:message code="boolean.null"/></label></div>
</div>
</c:when>
<c:when test="${filter.name=='crop'}">
<c:when test="${filter.name=='crops'}">
<div class="form-group input-group">
<span class="input-group-btn">
<select name="crop" id="cropselector" i-key = "${filterKey}" class="form-control filter-crop">
<select name="crops" id="cropselector" i-key="${filter.key}" class="form-control filter-crop">
<option value=""></option>
<c:forEach items="${crops}" var="c">
<option value="${c.shortName}" ${c.shortName== crop.shortName?'selected':''} ><c:out value="${c.getName(pageContext.response.locale)}" /></option>
......@@ -166,8 +165,8 @@
<option value="like"><spring:message code="filter.string.like" /></option>
<option value="equals"><spring:message code="filter.string.equals" /></option>
</select>
<input class="span2 form-control string-type" id="${normalizedKey}_input" type="text"/>
<button class="btn notimportant filter-auto" norm-key="${normalizedKey}">+</button>
<input class="span2 form-control string-type" id="<c:out value="${<