explore.jsp 24.1 KB
Newer Older
igoshin's avatar
igoshin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>

<%@include file="/WEB-INF/jsp/init.jsp"%>

<html>
<head>
<title><spring:message code="accession.page.data.title" /></title>
</head>
<body>
	<h1>
		<spring:message code="accession.page.data.title" />
	</h1>
    <%--Dropdown filters--%>
	<div class="main-col-header clearfix">
15
        
igoshin's avatar
igoshin committed
16
	<div class="nav-header">
Matija Obreza's avatar
Matija Obreza committed
17
18
		<div class="results">
			<spring:message code="accessions.number" arguments="${pagedData.totalElements}" />
igoshin's avatar
igoshin committed
19
		</div>
Matija Obreza's avatar
Matija Obreza committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
		<div class="row">
			<div class="col-sm-12 col-md-6">
				<form method="get" action="">
					<input type="hidden" name="filter" value="<c:out value="${jsonFilter}" />" />
					<div class="pagination">
						<spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
						<a href="<spring:url value=""><spring:param name="page" value="${pagedData.number eq 0 ? 1 : pagedData.number}" /><spring:param name="filter" value="${jsonFilter}" /></spring:url>"><spring:message code="pagination.previous-page" /></a>
						<input class="form-control" style="display: inline; max-width: 5em; text-align: center" type="text" name="page" placeholder="${pagedData.number + 1}" />
						<a href="<spring:url value=""><spring:param name="page" value="${pagedData.number+2}" /><spring:param name="filter" value="${jsonFilter}" /></spring:url>"><spring:message code="pagination.next-page" /></a>
					</div>
				</form>
			</div>
			<div class="col-sm-12 col-md-6" style="text-align: right; padding-top: 12px">
				<c:if test="${pagedData.totalElements le 100000}">
Matija Obreza's avatar
Matija Obreza committed
34
				<form style="display: inline-block" method="post" action="<c:url value="/download/explore/dwca" />">
Matija Obreza's avatar
Matija Obreza committed
35
36
37
38
39
					<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
					<input type="hidden" name="filter" value="<c:out value="${jsonFilter}" />" />
					<button class="btn btn-default" type="submit"><spring:message code="filter.download-dwca" /></button>
				</form>
				</c:if>
Matija Obreza's avatar
Matija Obreza committed
40
                <security:authorize access="isAuthenticated()">
Matija Obreza's avatar
Matija Obreza committed
41
				<form style="display: inline-block" method="post" action="<c:url value="/download/explore/download/mcpd" />">
Matija Obreza's avatar
Matija Obreza committed
42
43
44
45
46
					<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
					<input type="hidden" name="filter" value="<c:out value="${jsonFilter}" />" />
					<button class="btn btn-default" type="submit"><spring:message code="filter.download-mcpd" /></button>
				</form>
				</security:authorize>
47
				<a class="btn btn-default" href="<c:url value="/explore/overview"><c:param name="filter">${jsonFilter}</c:param></c:url>"><span class="glyphicon glyphicon-eye-open"></span><span style="margin-left: 0.5em;"><spring:message code="data-overview.short" /></span></a>
Matija Obreza's avatar
Matija Obreza committed
48
49
				<a class="btn btn-default" href="<c:url value="/explore/map"><c:param name="filter">${jsonFilter}</c:param></c:url>"><span class="glyphicon glyphicon-globe"></span><span style="margin-left: 0.5em;"><spring:message code="maps.view-map" /></span></a>
			</div>
50
		</div>
igoshin's avatar
igoshin committed
51
52
53
54
	</div>
	</div>

    <%--Filters--%>
Matija Obreza's avatar
Matija Obreza committed
55
56
57
58
59
60
61
62
    <div id="toggleFilters" class="applied-filters">
    	<ul class="nav nav-pills">
	    	<li class="active filter-toggler"><a><spring:message code="filters.toggle-filters" /></a></li>
	    	<li class="message right">
				<span class="${fn:length(currentFilters) gt 0 ? '' : 'hide'}"><spring:message code="filter.filters-applied" /></span>
				<span class="${fn:length(currentFilters) gt 0 ? 'hide' : ''}"><spring:message code="filter.filters-not-applied" /></span>
	    	</li>
		</ul>
63
64
    </div>
    <div id="allfilters" class="applied-filters hide">
65
    	<ul class="nav nav-pills">
Matija Obreza's avatar
Matija Obreza committed
66
67
	    	<li class="filter-toggler"><a><spring:message code="filters.toggle-filters" /></a></li>
            <li class="active dropdown form-horizontal" id="menu1">
68
69
70
71
72
73
74
75

                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                    <spring:message code="filter.add"/>
                    <b class="glyphicon-plus"></b>
                </a>

                <ul class="dropdown-menu">
                    <c:forEach items="${availableFilters}" var="filter">
76
                        <li><a href="#" i-key="${filter.key}" class="filter-enable">
77
78
79
80
81
82
83
                            <spring:message code="filter.${filter.key}"/></a></li>
                    </c:forEach>
                </ul>

            </li>


84
            <li class="dropdown form-horizontal" id="menu2" style="display: none">
85
86
87
88
89
                <a class="" data-toggle="modal" data-target="#myModal">
                    <spring:message code="filter.additional"/>
                    <b class="glyphicon-plus"></b>
                </a>
            </li>
Matija Obreza's avatar
Matija Obreza committed
90
91
92
93
			<li class="message right">
				<span class="${fn:length(currentFilters) gt 0 ? '' : 'hide'}"><spring:message code="filter.filters-applied" /></span>
				<span class="${fn:length(currentFilters) gt 0 ? 'hide' : ''}"><spring:message code="filter.filters-not-applied" /></span>
	    	</li>
94
        </ul>
95
96
97

		<%-- Only render currently present filters --%>
        <c:forEach items="${currentFilters}" var="filter">
igoshin's avatar
igoshin committed
98

99
            <c:set var="normalizedKey" value="${filter.key.replace('.', '-').replace(':', '_')}"/>
100
            <c:set var="appliedFilter" value="${appliedFilters.get(filter.key)}" />
igoshin's avatar
igoshin committed
101

102
            <div class="clearfix filter-block" id="<c:out value="${normalizedKey}" />_filter" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">
Matija Obreza's avatar
Matija Obreza committed
103
                <div class="col-lg-3 edit-fil">
104
                    <c:if test="${not filter.core}">
Matija Obreza's avatar
Matija Obreza committed
105
106
                        <c:out value="${filter.title}" />
                        <%-- <a href="<c:url value="/descriptors/${filter.key}" />"> --%>
107
                    </c:if>
igoshin's avatar
igoshin committed
108

109
                    <c:if test="${filter.core}">
110
						<spring:message code="filter.${filter.key}" />
111
                    </c:if>
igoshin's avatar
igoshin committed
112
                </div>
Matija Obreza's avatar
Matija Obreza committed
113
                <div class="col-lg-5 filter-new">
igoshin's avatar
igoshin committed
114
115
116
117
118
                    <c:choose>
                        <c:when test="${filter.filterType=='LIST'}">
                            <div class="">
                                <c:forEach items="${filter.options}" var="option">
                                    <div>
119
                                        <label>
120
                                            <input class="filter-list" id="<c:out value="${normalizedKey}${option.value}" />_input" ${fn:contains(filters[appliedFilter.key], option.value)?'checked':''} norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />" type="checkbox" value="${option.value}" />
121
122
                                            <spring:message code="${option.name}"/>
                                        </label>
igoshin's avatar
igoshin committed
123
124
125
126
127
128
129
130
131
                                    </div>
                                </c:forEach>
                            </div>
                        </c:when>
                        <c:when test="${filter.filterType=='I18NLIST'}">
                            <div class="">
                                <c:forEach items="${filter.options}" var="option">
                                    <div>
                                        <label>
132
                                            <input class="filter-list" id="<c:out value="${normalizedKey}${option.value}" />_input" ${fn:contains(filters[appliedFilter.key], option.value)?'checked':''} norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />" type="checkbox" value="${option.value}" />
igoshin's avatar
igoshin committed
133
134
135
136
                                            <spring:message code="${option.name}"/>
                                        </label>
                                    </div>
                                </c:forEach>
137
                                <div><label><input type="checkbox" ${fn:contains(filters[appliedFilter.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>
igoshin's avatar
igoshin committed
138
139
140
141
142
143
                            </div>
                        </c:when>
                        <c:when test="${filter.filterType=='AUTOCOMPLETE'}">
                            <div class="ui-front">
                                <div class="form-group input-group">
                                     <span class="input-group-btn">
Matija Obreza's avatar
Matija Obreza committed
144
                                         <input id="<c:out value="${normalizedKey}" />_input"  class="span2 form-control autocomplete-filter string-type" x-source="<c:url value="${filter.autocompleteUrl}" />" placeholder="<spring:message code="filter.autocomplete-placeholder" />" type="text"/>
145
                                         <button class="btn notimportant filter-auto" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">+</button>
igoshin's avatar
igoshin committed
146
147
148
149
150
151
152
                                      </span>
                                </div>
                            </div>
                        </c:when>
                        <c:when test="${filter.dataType=='NUMERIC'}">
                            <div class="form-group input-group">
                                <span class="input-group-btn">
153
154
155
                                    <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>
igoshin's avatar
igoshin committed
156
157
158
159
160
                                </span>
                            </div>
                        </c:when>
                        <c:when test="${filter.dataType=='BOOLEAN'}">
                            <div class="">
161
162
163
                                <div><label><input type="checkbox" ${fn:contains(filters[appliedFilter.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[appliedFilter.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[appliedFilter.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>
164
165
                            </div>
                        </c:when>
166
                        <c:when test="${filter.key=='crops'}">
167
168
                            <div class="form-group input-group">
                                <span class="input-group-btn">
169
                                    <select name="crops" id="cropselector" i-key="${filter.key}" class="form-control filter-crop">
170
171
172
173
174
175
                                        <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>
                                        </c:forEach>
                                    </select>
                                </span>
igoshin's avatar
igoshin committed
176
177
178
                            </div>
                        </c:when>
                        <c:otherwise>
179
                        <div class="ui-front" >
igoshin's avatar
igoshin committed
180
181
                            <div class="form-group input-group">
                                <span class="input-group-btn">
182
183
184
185
                                    <select id="like-switcher" class="form-control select-like">
                                        <option value="like"><spring:message code="filter.string.like" /></option>
                                        <option value="equals"><spring:message code="filter.string.equals" /></option>
                                    </select>
186
187
                                    <input class="span2 form-control string-type" id="<c:out value="${normalizedKey}" />_input" type="text"/>
                                    <button class="btn notimportant filter-auto" norm-key="<c:out value="${normalizedKey}" />" i-key="<c:out value="${filter.key}" />">+</button>
igoshin's avatar
igoshin committed
188
189
                                </span>
                            </div>
190
                        </div>
igoshin's avatar
igoshin committed
191
192
193
                        </c:otherwise>
                    </c:choose>
                </div>
Matija Obreza's avatar
Matija Obreza committed
194
                <div class="col-lg-9">
195
                	<div class="filter-values" id="<c:out value="${normalizedKey}" />_value">
196
197
198
199
                		<c:if test="${appliedFilter.inverse}">
                			<spring:message code="filter.inverse" />
                		</c:if>
	                    <c:forEach items="${filters[appliedFilter.key]}" var="value">
Matija Obreza's avatar
Matija Obreza committed
200
201
202
203
204
	                        <c:set var="string" value="${value}"/>
	                        <c:if test="${fn:contains(value, 'range')}">
	                            <c:set var="string" value="${fn:replace(value,'{range=[','Between ')}"/>
	                            <c:set var="string" value="${fn:replace(string,',',' and ')}"/>
	                            <c:set var="string" value="${fn:replace(string,']}','')}"/>
igoshin's avatar
igoshin committed
205
206
                                <c:set var="value" value="${fn:replace(value,'{','{\"')}"/>
                                <c:set var="value" value="${fn:replace(value,'=','\":')}"/>
Matija Obreza's avatar
Matija Obreza committed
207
208
209
210
	                        </c:if>
	                        <c:if test="${fn:contains(value, 'min')}">
	                            <c:set var="string" value="${fn:replace(value,'{min=','More than ')}"/>
	                            <c:set var="string" value="${fn:replace(string,'}','')}"/>
igoshin's avatar
igoshin committed
211
212
                                <c:set var="value" value="${fn:replace(value,'{','{\"')}"/>
                                <c:set var="value" value="${fn:replace(value,'=','\":')}"/>
Matija Obreza's avatar
Matija Obreza committed
213
214
215
216
	                        </c:if>
	                        <c:if test="${fn:contains(value, 'max')}">
	                            <c:set var="string" value="${fn:replace(value,'{max=','Less than ')}"/>
	                            <c:set var="string" value="${fn:replace(string,'}','')}"/>
igoshin's avatar
igoshin committed
217
218
                                <c:set var="value" value="${fn:replace(value,'{','{\"')}"/>
                                <c:set var="value" value="${fn:replace(value,'=','\":')}"/>
Matija Obreza's avatar
Matija Obreza committed
219
	                        </c:if>
220
221
222
                            <c:if test="${fn:contains(value, 'like')}">
                                <c:set var="string" value="${fn:replace(value,'{like=','Like ')}"/>
                                <c:set var="string" value="${fn:replace(string,'}','')}"/>
igoshin's avatar
igoshin committed
223
224
225
                                <c:set var="value" value="${fn:replace(value,'{','{\"')}"/>
                                <c:set var="value" value="${fn:replace(value,'=','\":\"')}"/>
                                <c:set var="value" value="${fn:replace(value,'}','\"}')}"/>
226
                            </c:if>
igoshin's avatar
igoshin committed
227

Matija Obreza's avatar
Matija Obreza committed
228
229
	                        <c:if test="${string==null}">
	                        	<c:set var="string" value="null" />
igoshin's avatar
igoshin committed
230
	                        	<c:set var="value" value="null" />
Matija Obreza's avatar
Matija Obreza committed
231
	                        </c:if>
232
	                        <div class="filtval complex" x-key="<c:out value="${normalizedKey}" /><c:out value="${value}"/>" i-key="<c:out value="${filter.key}" />"><c:out value="${string}" /></div>
Matija Obreza's avatar
Matija Obreza committed
233
234
235
236
237
238
239
	                        <c:remove var="string" />
	                    </c:forEach>
	                </div>
                    <div style="margin-top: 3px" class="filter-apply-btn">
	                    <button class="btn btn-primary apply"><spring:message code="filter.apply"/></button>
	                    <button class="btn btn-default remove-filter"><spring:message code="filter.remove"/></button>
	                </div>
igoshin's avatar
igoshin committed
240
241
242
                </div>
            </div>
        </c:forEach>
243
244
245
246
247
248
    </div>


    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
249
            <div class="modal-content"></div>
igoshin's avatar
igoshin committed
250
251
        </div>
    </div>
252
    <!--End modal-->
igoshin's avatar
igoshin committed
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
    <%--Accessions--%>
	<table class="accessions">
		<thead>
			<tr>
				<td class="idx-col"></td>
				<td />
				<td><spring:message code="accession.accessionName" /></td>
				<td><spring:message code="accession.taxonomy" /></td>
				<td class="notimportant"><spring:message code="accession.origin" /></td>
				<td class="notimportant"><spring:message code="accession.sampleStatus" /></td>
				<td class="notimportant"><spring:message code="accession.holdingInstitute" /></td>
				<%-- 				<td><spring:message code="accession.holdingCountry" /></td>
 --%>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${pagedData.content}" var="accession" varStatus="status">
				<tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}">
					<td class="idx-col">${status.count + pagedData.size * pagedData.number}</td>
					<td class="sel" x-aid="${accession.id}"></td>
					<td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td>
					<%-- <td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a></td> --%>
					<td><c:out value="${accession.taxonomy.taxonName}" /></td>
276
					<%-- <td class="notimportant"><a href="<c:url value="/geo/${accession.origin}" />"><c:out value="${accession.countryOfOrigin.name}" /></a></td> --%>
igoshin's avatar
igoshin committed
277
278
					<td class="notimportant"><c:out value="${accession.countryOfOrigin.getName(pageContext.response.locale)}" /></td>
					<td class="notimportant"><spring:message code="accession.sampleStatus.${accession.sampleStatus}" /></td>
279
280
					<td class="notimportant"><a href="<c:url value="/wiews/${accession.institute.code}" />"><c:out value="${accession.institute.code}" /></a></td>
					<%-- 			<td><a href="<c:url value="/geo/${accession.institute.country.code3}" />"><c:out value="${accession.institute.country.name}" /></a></td>
igoshin's avatar
igoshin committed
281
282
283
284
285
286
287
288
		 --%>
				</tr>
			</c:forEach>
		</tbody>
	</table>

    <content tag="javascript">
        <script type="text/javascript">
289
            var jsonData = ${jsonFilter};
igoshin's avatar
igoshin committed
290

igoshin's avatar
#12579    
igoshin committed
291
292
            var page=${pagedData.number};

igoshin's avatar
igoshin committed
293
            $(document).ready(function () {
igoshin's avatar
igoshin committed
294

295
                if (jsonData.crops !=null && jsonData.crops.length > 0) {
igoshin's avatar
igoshin committed
296
                    $("#menu2").show();
igoshin's avatar
igoshin committed
297
298
                }

igoshin's avatar
igoshin committed
299
300
301
                if (page == 0) {
                    $("#allfilters").removeClass("hide");
                    $("#toggleFilters").addClass("hide");
igoshin's avatar
igoshin committed
302
                } else {
igoshin's avatar
igoshin committed
303
304
                    $("#allfilters").addClass("hide");
                    $("#toggleFilters").removeClass("hide");
igoshin's avatar
igoshin committed
305
306
                }

igoshin's avatar
igoshin committed
307
308
309
310
311
                $(".filter-toggler").on("click", function (ev) {
                    ev.preventDefault();
                    $("#allfilters").toggleClass("hide");
                    $("#toggleFilters").toggleClass("hide");
                });
312
313


igoshin's avatar
igoshin committed
314
                $("#menu2").on("click", function () {
Matija Obreza's avatar
Matija Obreza committed
315
                    $.ajax("<c:url value="/modal" />", {
igoshin's avatar
igoshin committed
316
                        type: 'GET',
317
                        data: "shortName=" + jsonData.crops,
igoshin's avatar
igoshin committed
318
319
320
321
322
323
324
325
326
327
                        success: function (data) {
                            $(".modal-content").empty();
                            $(".modal-content").append(data);
                            for (var x in jsonData) {
                                console.log(".modal-body input[value='" + x + "']");
                                $(".modal-body .filter-block label > input[value='" + x + "']").prop("checked", true);
                            }
                        },
                        error: function (error) {
                            console.log(error);
328
                        }
igoshin's avatar
igoshin committed
329
                    });
330
331
332
                });


igoshin's avatar
igoshin committed
333
334
335
336
                $("body").on("click", ".additional", function () {
                    var id = $(this).attr("id");
                    var filterId = "#" + id.replace("_id", "_filter");
                    var filter = id.replace("gm_", "gm:").replace("_id", "");
337

igoshin's avatar
igoshin committed
338
339
340
341
342
343
344
                    if ($(this).is(":checked")) {
                        GenesysFilterUtil.appendFilter(filter, filterId,jsonData);
                    } else {
                        delete jsonData[filter];
                        $(filterId).remove();
                    }
                });
345

346
347
348
349
350
351
352
353
354
355
356
357
358
                $("body").on("keypress", ".string-type", function (e) {
                  if(e.keyCode==13){
                      var btn=$(this).parent().find("button");
                     console.log(btn)
                      var selectedValue = $(this).parent().find("#like-switcher option:selected").val();

                      if (selectedValue == "like") {
                          GenesysFilter.filterLike(btn, jsonData);
                      } else {
                          GenesysFilter.filterAutocomplete(btn, jsonData);
                      }
                  }
                });
359

igoshin's avatar
igoshin committed
360
361
362
                $("body").on("click", ".filter-list", function () {
                    GenesysFilter.filterList($(this), jsonData);
                });
363

igoshin's avatar
igoshin committed
364
                $("body").on("click", ".filter-auto", function () {
365
366
367
368
369
370
                    var selectedValue = $(this).parent().find("#like-switcher option:selected").val();
                    if (selectedValue == "like") {
                        GenesysFilter.filterLike($(this), jsonData);
                    } else  {
                        GenesysFilter.filterAutocomplete($(this), jsonData);
                    }
igoshin's avatar
igoshin committed
371
                });
372

igoshin's avatar
igoshin committed
373
374
375
                $("body").on("click", ".filter-range", function () {
                    GenesysFilter.filterRange($(this), jsonData);
                });
igoshin's avatar
igoshin committed
376

igoshin's avatar
igoshin committed
377
378
379
                $("body").on("click", ".filter-bool", function () {
                    GenesysFilter.filterBoolean($(this), jsonData);
                });
igoshin's avatar
igoshin committed
380

igoshin's avatar
igoshin committed
381
382
383
                $("body").on("click", ".filter-crop", function () {
                    GenesysFilter.filterCrop($(this), jsonData);
                });
igoshin's avatar
igoshin committed
384

igoshin's avatar
igoshin committed
385
                $("body").on("click", ".filter-enable", function () {
386
387
388
389
                    var key=$(this).attr("i-key");
                    var normKey = GenesysFilter.normKey(key);
                    var filterId = "#" + normKey + "_filter";
                    GenesysFilterUtil.appendFilter(key,filterId,jsonData);
igoshin's avatar
igoshin committed
390
                });
igoshin's avatar
igoshin committed
391

igoshin's avatar
igoshin committed
392
                $("body").on("click", ".apply", function () {
Matija Obreza's avatar
Matija Obreza committed
393
                    GenesysFilterUtil.submitJson('<c:url value="/explore" />', jsonData);
igoshin's avatar
igoshin committed
394
                });
Matija Obreza's avatar
Matija Obreza committed
395
396
                
                $("body").on("click", ".remove-filter", function () {
397
398
                    var key = $(this).parents(".filter-block").attr("i-key");
                    delete jsonData[key];
Matija Obreza's avatar
Matija Obreza committed
399
                    GenesysFilterUtil.submitJson('<c:url value="/explore" />', jsonData);
igoshin's avatar
igoshin committed
400
                });
igoshin's avatar
igoshin committed
401

igoshin's avatar
igoshin committed
402
                $("body").on("click", ".edit-fil", function () {
Matija Obreza's avatar
Matija Obreza committed
403
                	GenesysFilterUtil.showFilter($(this).parents(".filter-block"));
404
405
                });

igoshin's avatar
igoshin committed
406
407
                $("body").on("click", ".filtval", function (event) {
                    event.preventDefault();
igoshin's avatar
igoshin committed
408

409
410
411
                    var key = $(this).attr("i-key");
                    var normKey = GenesysFilter.normKey(key);
                    var value = $(this).attr("x-key").replace(normKey, "");
igoshin's avatar
igoshin committed
412

igoshin's avatar
igoshin committed
413
414
415
416
417
//                    if (value.indexOf("{") > -1) {
//                        var jsonVal = value.replace("=", ":").replace(" ", "");
//                        value = GenesysFilterUtil.setCharAt(jsonVal, jsonVal.indexOf("{"), '{"');
//                        value = GenesysFilterUtil.setCharAt(value, jsonVal.indexOf(":") + 1, '":');
//                    }
Matija Obreza's avatar
Matija Obreza committed
418
419
                    
                    if (value=="null") value=null;
igoshin's avatar
igoshin committed
420
                    GenesysFilterUtil.removeValue(value, key, jsonData);
igoshin's avatar
#12579    
igoshin committed
421

Matija Obreza's avatar
Matija Obreza committed
422
                    if (! $(this).parents(".filter-block").hasClass("filter-edit")) {
Matija Obreza's avatar
Matija Obreza committed
423
                        GenesysFilterUtil.submitJson('<c:url value="/explore" />', jsonData);
igoshin's avatar
igoshin committed
424
                    }
igoshin's avatar
#12579    
igoshin committed
425

igoshin's avatar
igoshin committed
426
                    $(this).remove();
427
                    $('input[i-key=' + normKey + value + ']').prop('checked', false);
igoshin's avatar
igoshin committed
428
                });
igoshin's avatar
igoshin committed
429

igoshin's avatar
igoshin committed
430
                GenesysFilterUtil.registerAutocomplete("#allfilters",jsonData);
igoshin's avatar
igoshin committed
431
432
433
434
435
            });
        </script>
    </content>
</body>
</html>