Danh sách tin tức
Chuyên mục
Có lỗi xảy ra trong quá trình xử lý biểu mẫu.
The following has evaluated to null or missing: ==> AssetCategoryService.getCategory(idCategory?number) [in template "20115#20151#49509" at line 187, column 28] ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: category = AssetCategoryService.getCa... [in template "20115#20151#49509" at line 187, column 17] - Reached through: #assign-container [in template "20115#20151#49509" at line 185, column 9] ----
1<style scope>
2 .taglib-categorization-filter{
3 display:none
4 }
5 .article-title{
6 color: #0b5090;
7 text-decoration: none !important;
8 font-weight: bold;
9 padding: 0;
10 font-weight: bold;
11 margin-bottom: 5px
12 }
13 .article-img{
14 padding: 0;
15 }
16 .article-description{
17 padding-left: 10px;
18 text-align: justify;
19 }
20 .article-container{
21 padding: 0;
22 margin-bottom: 15px;
23 }
24 .article-title a{
25 color: #0b5090;
26 }
27 .list-container{
28 font-size: 14px;
29 }
30 .publish-date{
31 font-weight: bold;
32 color: grey;
33 }
34 .cms-title-category a{
35 color: #d70000;
36 font-weight: bold;
37 }
38 .title-category-container{
39 padding: 12px 0px 10px 12px;
40 border-bottom: 1px dotted #CBCBCB;
41 margin-bottom: 10px;
42 background: linear-gradient(#e9e9e9, #fbfbfb);
43 }
44 .search-date{
45 padding: 0;
46 float: left;
47 margin: 0 0 8px -10px;
48 display: flex;
49 }
50 .search-lable{
51 text-align: right;
52 padding: 8px;
53 font-weight: bold;
54 }
55 .search-input{
56 padding: 4px 1px 5px 5px;
57 }
58 #dateSearch {
59 height: 24px;
60 border: 1px solid #C8C9CA;
61 border-radius: 4px;
62 background: #fff;
63 width: 133px;
64 }
65 .btn-primary {
66 background-color: #337ab7;
67 height: 24px;
68 position: relative;
69 top: 4px;
70 width: 56px;
71 left: 43px;
72 border: 1px solid;
73 border-color: #C8C9CA #9E9E9E #9E9E9E #C8C9CA;
74 background: linear-gradient(#ffffff, #f2f2f2, #dedede, #d9d9d9);
75 Font-size: 12px;
76 font-weight: bold;
77 color: #2c6c97;
78 padding: 3px;
79 }
80 .taglib-page-iterator {
81 padding: 0 15px;
82 }
83 .lfr-icon-menu-text, .search-results, .lfr-pagination-buttons{
84 font-size: 12px;
85 }
86 .btn:hover {
87 border: 1px solid #204d74;
88 }
89 .btn-primary:active:hover{
90 color: #2c6c97;
91 border: 1px solid;
92 border-color: #C8C9CA #9E9E9E #9E9E9E #C8C9CA;
93 }
94 .taglib-page-iterator{
95 padding: 0 15px;
96 }
97 .taglib-page-iterator .search-results, .lfr-pagination-buttons, .lfr-icon-menu-text{
98 font-size: 12px;
99 }
100
101 .search-results, .lfr-pagination-delta-selector{
102 display: none !important;
103 }
104
105 .clearfix{
106 display: flex;
107 }
108
109 .lfr-pagination-buttons{
110 margin: 10px 0 0 auto !important;
111 }
112
113
114 @media only screen and (max-width: 767px){
115 .list-container {
116 padding: 6px;
117 }
118 .article-container {
119 margin-top: 0;
120 border-bottom: 1px dashed #cbcbcb;
121 }
122 .search-button{
123 padding: 0;
124 }
125 .search-button .btn-primary{
126 left: 0;
127 }
128 .search-lable {
129 text-align: left;
130 padding: 8px 0 0 6px;
131 }
132 .search-date{
133 margin: 0;
134 }
135 .taglib-page-iterator{
136 padding: 0 6px;
137 }
138 .taglib-page-iterator .lfr-pagination-buttons{
139 display: flex;
140 }
141 .taglib-page-iterator .lfr-pagination-buttons>li>a{
142 width: 99%;
143 border-radius: 4px;
144 }
145 .taglib-page-iterator .lfr-pagination-config .current-page-menu .btn{
146 margin: 0 0 5px 0;
147 }
148 .search-results{
149 display: none !important;
150 line-height: 35px !important;
151 color: #9e9e9e;
152 }
153
154 .clearfix{
155 display: unset;
156 }
157 }
158 .form-control:focus {
159 box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgb(255, 255, 255);
160
161}
162</style>
163
164<#assign enableButtonEditArticle = "false" />
165<#list portletPreferences?keys as preference>
166 <#-- Check if button edit is enabled. -->
167 <#if preference == "enableButtonEdit" >
168 <#list portletPreferences[preference] as value>
169 <#assign enableButtonEditArticle = value />
170 <#break>
171 </#list>
172 </#if>
173</#list>
174
175<#--firstCategoryId là gia trị được truyền từ template Danh sách tin tuc , và nó dùng làm chuyên mục chính-->
176<#assign firstCategoryId = paramUtil.getString(renderRequest, "categoryId") />
177<#assign httpRequest = portalUtil.getOriginalServletRequest(portalUtil.getHttpServletRequest(renderRequest))>
178<#assign AssetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryService")>
179<#assign dateSearch = getterUtil.getString(httpRequest.getParameter("p_r_p_date"))
180 idCategory = ""
181 nameCategory = "Tin tức"
182/>
183
184<#if (firstCategoryId != "")>
185 <#assign
186 idCategory = firstCategoryId
187 category = AssetCategoryService.getCategory(idCategory?number)
188 nameCategory = category.getName()
189 />
190<#else>
191 <#assign idCategory = getterUtil.getString(httpRequest.getParameter("p_r_p_categoryId"))>
192 <#if (idCategory?length > 0) >
193 <#assign
194 category = AssetCategoryService.getCategory(idCategory?number)
195 nameCategory = category.getName()
196 />
197 </#if>
198</#if>
199
200<h2 class="portlet-title-text">
201 <img class="portlet-title-icon" alt="title" src="/o/hcm-default-theme/images/imageVanBan/iconTitle.jpg">
202 <span>${nameCategory}</span>
203</h2>
204
205<div class="row row-swt-responsive">
206 <div class="col-md-12 list-container">
207 <#if entries?has_content>
208 <#if validator.isNull(dateSearch)>
209 <#assign listToShow = entries >
210 <#else>
211 <#assign dateSearch = htmlUtil.escape(dateSearch) />
212 <#assign listToShow = [] >
213 <#list entries?chunk(1) as i>
214 <#assign dateSearch_DateObj = dateUtil.parseDate("dd/MM/yyyy", dateSearch, locale) />
215 <#assign curEntryDate = i?first.getPublishDate() />
216 <#if dateSearch_DateObj?date?string.short?contains(curEntryDate?date?string.short) >
217 <#assign listToShow = listToShow + i>
218 </#if>
219 </#list>
220 </#if>
221 <#list listToShow as curEntry>
222 <#assign
223 curEntry = curEntry
224
225 renderer = curEntry.getAssetRenderer()
226 article = renderer.getArticle() >
227
228 <#assign firstImgUrl = "" />
229
230 <#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
231 <#assign journalArticle = journalArticleLocalService.fetchLatestArticle(curEntry.getClassPK()) />
232 <#assign entryTitle = htmlUtil.escape(renderer.getTitle(locale)) />
233
234 <#if validator.isNotNull(journalArticle)>
235 <#assign content = journalArticle.getContent() />
236 <#if content?contains("<img")>
237 <#assign firstIndexImg = content?index_of("<img") />
238 <#assign newContent = content?substring(firstIndexImg)/>
239 <#assign lastIndexImg = newContent?index_of(">") />
240 <#assign newContent = newContent?substring(0, lastIndexImg)/>
241
242 <#assign strLenght= "src=\"" />
243 <#assign indexSrc = newContent?index_of(strLenght) + strLenght?length />
244 <#assign firstImgUrl = newContent?substring(indexSrc) />
245 <#assign lastIndexSrc = firstImgUrl?index_of("\"") />
246 <#assign firstImgUrl = firstImgUrl?substring(0,lastIndexSrc) />
247 </#if>
248 </#if>
249
250
251 <#if article.getSmallImage()>
252 <#assign imgThumbnailURL = renderer.getThumbnailPath(renderRequest)>
253 <#elseif (firstImgUrl?length > 0)>
254 <#assign imgThumbnailURL = firstImgUrl>
255 <#else>
256 <#assign imgThumbnailURL = "/o/hcm-default-theme/images/cms/no-image.jpg" >
257 </#if>
258
259 <#assign publishDate = curEntry.getCreateDate() />
260 <#if (curEntry.getPublishDate()??) >
261 <#assign publishDate = curEntry.getPublishDate() />
262 </#if>
263
264 <#assign publishDate_txt = "(" + publishDate?date?string["dd/MM/yyyy"] + ")" />
265 <#assign urlArticle = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, renderer, curEntry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) />
266
267 <div class="col-md-12 article-container">
268 <div class="col-md-12 article-title">
269 <a href="${urlArticle}">
270 ${article.getTitle()?replace('<[^>]+>','','r')} <span class="publish-date">${publishDate_txt}<span>
271 </a>
272 <#if enableButtonEditArticle == "true">
273 <@getEditIcon />
274 </#if>
275 </div>
276 <div class="col-md-12 col-swt">
277 <div class="col-md-3 article-img">
278 <a href="${urlArticle}">
279 <img src="${imgThumbnailURL}" width=100%/>
280 </a>
281 </div>
282 <div class="col-md-9 article-description">
283 ${article.getDescription()}
284 </div>
285 </div>
286 </div>
287 </#list>
288 </#if>
289 </div>
290</div>
291
292<#macro getEditIcon>
293 <#if renderer.hasEditPermission(themeDisplay.getPermissionChecker())>
294 <#assign redirectURL = renderResponse.createRenderURL() />
295 ${redirectURL.setParameter("mvcPath", "/add_asset_redirect.jsp")}
296 ${redirectURL.setWindowState("pop_up")}
297 <#assign editPortletURL = renderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("pop_up"), redirectURL)!"" />
298 <!--Set embedded =true để giao diện hiển thị theo hook -->
299 ${editPortletURL.setParameter("embedded", "true")}
300 <#if validator.isNotNull(editPortletURL)>
301 <@liferay_ui["icon"]
302 cssClass="pull-right"
303 image="edit"
304 url="javascript:Liferay.Util.openWindow({id:'" + renderResponse.getNamespace() + "editAsset', title: '" + entryTitle + "', uri:'" + htmlUtil.escapeURL(editPortletURL.toString()) + "'});"
305 />
306 </#if>
307 </#if>
308</#macro>
309
310<div class="row search-date">
311 <div class="col-md-5 search-lable">
312 Xem theo ngày:
313 </div>
314 <div class="col-md-5 search-input">
315 <input class="form-control" type="text" id="dateSearch" value="${dateSearch}"/>
316
317 </div>
318 <div class="col-md-2 btn btn-primary" onClick="searchDate()">
319 Tìm
320 </div>
321
322</div>
323
324<#assign currentUrl = themeDisplay.getURLCurrent() />
325
326<#if currentUrl?contains("&p_r_p_date=")>
327 <#assign firstIndex = currentUrl?index_of("&p_r_p_date=") />
328 <#assign currentUrl = currentUrl?substring(0, firstIndex)/>
329</#if>
330<script>
331YUI().use(
332 'aui-datepicker',
333 function(Y) {
334 new Y.DatePicker(
335 {
336 trigger: 'input',
337
338 mask: '%d/%m/%Y',
339 popover: {
340 zIndex: 1
341 },
342 panes: 1
343 }
344 );
345 }
346);
347</script>
348<script type="text/javascript">
349 function searchDate(){
350 var date = $("#dateSearch").val();
351 var url = "${currentUrl}" + "&p_r_p_date=" + date;
352 window.location.href = url;
353 }
354</script>