1<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")/>
2<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")>
3
4<#assign url=themeDisplay.getURLCurrent() />
5<#assign params=url?split('&') />
6<#assign selectedCategoriesId=[] />
7
8
9
10<div class="c-search-result-template">
11<#if !entries?has_content>
12
13<#else>
14<div class="c-selected-category-list"></div>
15<div class="display-list">
16
17
18
19<ul class="list-group" id="search-results-display-list">
20<#list entries as entry>
21<li class="list-group-item list-group-item-flex">
22<div class="autofit-col">
23<#if entry.isThumbnailVisible()>
24
25<#elseif entry.isUserPortraitVisible() && stringUtil.equals(entry.getClassName(), userClassName)>
26<@liferay_ui["user-portrait"] userId=entry.getAssetEntryUserId() />
27<#elseif entry.isIconVisible()>
28
29</#if>
30</div>
31
32<div class="autofit-col autofit-col-expand">
33<section class="autofit-section">
34<#if entry.isAssetCategoriesOrTagsVisible()>
35<div class="search-document-tags text-default">
36<#assign assetEntry = assetEntryLocalService.getEntry(entry.getClassName(), entry.getClassPK()) />
37<#assign categories=assetEntry.getCategories()/>
38<#list categories as category>
39<#assign categoryName=category.getName()/>
40 <h6 class="asset-category">${category.getName()}</h6>
41
42</#list>
43</div>
44</#if>
45<div class="c-mt-0 list-group-title">
46<a class="list-title" href="${entry.getViewURL()}" target="_self">
47
48 ${entry.getHighlightedTitle()}
49</a>
50</div>
51<div class="search-results-metadata">
52
53<#if entry.isContentVisible()>
54<p class="list-group-subtext">
55<span class="subtext-item">
56
57 <#assign lenghth=entry.getContent()?length
58 content=entry.getContent()
59 summary=content?replace('Breadcrumb','')
60 laststring=content?substring(lenghth-4,lenghth)/>
61 <#if !(laststring?contains("..."))>
62 ${summary}...
63 <#else>
64 ${summary}
65 </#if>
66 <#if entry.getContent()?contains("https") || entry.getContent()?contains("http") >
67 external URL
68 </#if>
69</span>
70</p>
71</#if>
72<#if entry.isFieldsVisible()>
73<p class="list-group-subtext">
74<#assign separate = false />
75<#list entry.getFieldDisplayContexts() as fieldDisplayContext>
76<#if separate>
77·
78</#if>
79<span class="badge">${fieldDisplayContext.getName()}</span>
80<span>${fieldDisplayContext.getValuesToString()}</span>
81<#assign separate = true />
82</#list>
83</p>
84</#if>
85
86 <#if entry.isCreationDateVisible()>
87<span class="subtext-item">
88
89 <#assign assetEntry = assetEntryLocalService.getEntry(entry.getClassName(), entry.getClassPK()) />
90 <#assign renderer=assetEntry.getAssetRenderer()
91 className=renderer.getClassName() />
92 <#assign migraDate="" />
93 <#if className?has_content>
94 <#if className=="com.liferay.journal.model.JournalArticle">
95 <#assign journalArticle=renderer.getArticle()
96 document=saxReaderUtil.read(journalArticle.getContent())
97 rootElement=document.getRootElement()
98 elements=rootElement.elements() />
99
100 <#list elements as dynamicElement>
101 <#assign fieldName=dynamicElement.attributeValue("field-reference") />
102
103 <#if fieldName=="MigrationDate">
104 <#assign xPathSelector=saxReaderUtil.createXPath("dynamic-element[@field-reference='MigrationDate']") />
105 <#assign migrationDate=xPathSelector.selectSingleNode(rootElement).getStringValue() />
106
107 <#if (migrationDate?length) gte 10>
108
109 <#assign dateString=getterUtil.getString(migrationDate) />
110 <#assign newDateobj=dateUtil.parseDate("yyyy-MM-dd HH:mm:ss", dateString, locale) />
111 <#assign migraDate=dateUtil.getDate(newDateobj, "dd MMMMM yyyy", locale) />
112 </#if>
113 </#if>
114 </#list>
115 </#if>
116 </#if>
117 <#if validator.isNotNull(migraDate)>
118 ${migraDate}
119 <#assign migraDate=""/>
120 <#else>
121 <#assign CardDate = entry.getCreationDateString() />
122<#if validator.isNotNull(CardDate) && (CardDate?contains("AM") || CardDate?contains("PM"))>
123<#assign ArticleCardDate_DateObj=dateUtil.parseDate("MMM d, yyyy h:mm a", CardDate, locale) />
124 ${dateUtil.getDate(ArticleCardDate_DateObj, "dd MMMMM yyyy", locale)}
125<#else>
126 <#assign ArticleCardDate_DateObj=dateUtil.parseDate("DD-MMM-yyyy h:mm", CardDate, locale) />
127 ${dateUtil.getDate(ArticleCardDate_DateObj, "dd MMMMM yyyy", locale)}
128
129 </#if>
130 </#if>
131
132
133</span>
134
135</#if>
136
137
138
139
140<#if entry.isDocumentFormVisible()>
141<div class="expand-details text-default">
142<span class="list-group-text text-2">
143<a class="shadow-none" href="javascript:void(0);">
144<@liferay.language key="details" />...
145</a>
146</span>
147</div>
148<div class="hide search-results-list table-details table-responsive">
149<table class="table table-sm">
150<thead>
151<tr>
152<th class="table-cell-expand-smaller table-cell-text-end">
153<@liferay.language key="key" />
154</th>
155<th class="table-cell-expand">
156<@liferay.language key="value" />
157</th>
158</tr>
159</thead>
160<tbody>
161<#list entry.getDocumentFormFieldDisplayContexts() as fieldDisplayContext>
162<tr>
163<td class="table-cell-expand-smaller table-cell-text-end table-details-content">
164<strong>${htmlUtil.escape(fieldDisplayContext.getName())}</strong>
165</td>
166<td class="table-cell-expand table-details-content">
167<code>
168 ${fieldDisplayContext.getValuesToString()}
169</code>
170</td>
171</tr>
172</#list>
173</tbody>
174</table>
175</div>
176</#if>
177</div>
178</section>
179</div>
180</li>
181</#list>
182</ul>
183</div>
184
185<@liferay_aui.form useNamespace=false>
186<@liferay_ui["search-paginator"]
187 id="${namespace + 'searchContainerTag'}"
188 markupView="lexicon"
189 searchContainer=searchContainer
190 />
191</@liferay_aui.form>
192<@liferay_aui.script use="aui-base">
193 A.one('#search-results-display-list').delegate(
194 'click',
195 function(event) {
196 var currentTarget = event.currentTarget;
197 currentTarget.siblings('.search-results-list').toggleClass('hide');
198 },
199 '.expand-details'
200 );
201</@liferay_aui.script>
202</#if>
203</div>
204
205<script>
206
207
208
209 <!-- function for clearAll -->
210function clearAll() {
211 var url = window.location.href;
212 <!--alert( url.split('&')[0]);-->
213 <!--$(window).prop("location", url.split('&')[0]);-->
214 history.pushState(null, document.title, '?' + searchQuery);
215}
216 <!-- function to remove specific category -->
217function removeCategory(key) {
218 var sourceURL = window.location.href;
219 var rtn = sourceURL.split("?")[0],
220 param,
221 params_arr = [],
222 queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
223 if (queryString !== "") {
224 params_arr = queryString.split("&");
225 for (var i = params_arr.length - 1; i >= 0; i -= 1) {
226 param = params_arr[i].split("=")[1];
227 if (param == key) {
228 params_arr.splice(i, 1);
229 }
230 }
231 if (params_arr.length) rtn = rtn + "?" + params_arr.join("&");
232 }
233
234 <!--$(window).prop("location", rtn);-->
235}
236
237 <!-- function to show saerch by category in no results found section -->
238 function searchBycategory(categoryid){
239 var sourceURL = window.location.href;
240 var retunUrl = sourceURL.split("?")[0];
241 retunUrl=retunUrl+"?q="+categoryid;
242 $(window).prop("location", retunUrl);
243 }
244 var pagetext=$(".pagination-results").text();
245 $(".pagination-results").text(pagetext.replace("entries.",""));
246</script>
247
248 <style>
249
250 .c-search-result-template .page-item.active .page-link:hover {
251 color: white;
252 }
253
254 .c-search-result-template button.dropdown-toggle.page-link.page-link {
255 box-shadow: none;
256 justify-content: center;
257 &:active{
258 background-color: #fff;
259 }
260 }
261 .c-search-result-template .dropdown-menu .dropdown-item{
262 color: #1e1836;
263 }
264 .c-search-result-template .dropdown-menu .dropdown-item.active{
265 font-weight: bold;
266 background-color: transparent;
267 color: #1e1836;
268 }
269 .c-search-result-template .pagination-items-per-page.show .page-link .c-inner svg {
270 background-image: none;
271 }
272 </style>