META-INF.resources.view_entries.jsp Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/init.jsp" %>
<%
String referringPortletResource = ParamUtil.getString(request, "referringPortletResource");
Map componentContext = journalDisplayContext.getComponentContext();
%>
<%
JournalArticle curArticle = null;
JournalFolder curFolder = null;
Object result = row.getObject();
if (result instanceof JournalFolder) {
curFolder = (JournalFolder)result;
}
else {
curArticle = journalDisplayContext.getLatestArticle((JournalArticle)result);
}
%>
<%
String title = curArticle.getTitle(locale);
if (Validator.isNull(title)) {
title = curArticle.getTitle(LocaleUtil.fromLanguageId(curArticle.getDefaultLanguageId()));
}
row.setData(
HashMapBuilder.put(
"actions", journalDisplayContext.getAvailableActions(curArticle)
).put(
"draggable", !BrowserSnifferUtil.isMobile(request) && (JournalArticlePermission.contains(permissionChecker, curArticle, ActionKeys.DELETE) || JournalArticlePermission.contains(permissionChecker, curArticle, ActionKeys.UPDATE))
).put(
"title", HtmlUtil.escape(title)
).build());
row.setPrimaryKey(HtmlUtil.escape(curArticle.getArticleId()));
String editURL = StringPool.BLANK;
if (JournalArticlePermission.contains(permissionChecker, curArticle, ActionKeys.UPDATE)) {
editURL = PortletURLBuilder.createRenderURL(
liferayPortletResponse
).setMVCPath(
"/edit_article.jsp"
).setRedirect(
currentURL
).setParameter(
"articleId", curArticle.getArticleId()
).setParameter(
"folderId", curArticle.getFolderId()
).setParameter(
"groupId", curArticle.getGroupId()
).setParameter(
"referringPortletResource", referringPortletResource
).setParameter(
"version", curArticle.getVersion()
).buildString();
}
%>
<%
List articles = JournalArticleLocalServiceUtil.getArticles(curArticle.getGroupId(), curArticle.getArticleId(), 0, 1, new ArticleVersionComparator(true));
JournalArticle article = articles.get(0);
%>
<%
Date createDate = curArticle.getModifiedDate();
String modifiedDateDescription = LanguageUtil.getTimeDescription(request, System.currentTimeMillis() - createDate.getTime(), true);
%>
<%= HtmlUtil.escape(title) %>
<%= JournalHelperUtil.getAbsolutePath(liferayPortletRequest, curArticle.getFolderId()) %>
<%
Date createDate = curArticle.getModifiedDate();
String modifiedDateDescription = LanguageUtil.getTimeDescription(request, System.currentTimeMillis() - createDate.getTime(), true);
%>
<%
DDMStructure ddmStructure = curArticle.getDDMStructure();
%>
<%
row.setData(
HashMapBuilder.put(
"actions", journalDisplayContext.getAvailableActions(curFolder)
).put(
"draggable", !BrowserSnifferUtil.isMobile(request) && (JournalFolderPermission.contains(permissionChecker, curFolder, ActionKeys.DELETE) || JournalFolderPermission.contains(permissionChecker, curFolder, ActionKeys.UPDATE))
).put(
"folder", true
).put(
"folder-id", curFolder.getFolderId()
).put(
"title", HtmlUtil.escape(curFolder.getName())
).build());
row.setPrimaryKey(String.valueOf(curFolder.getPrimaryKey()));
PortletURL rowURL = PortletURLBuilder.createRenderURL(
liferayPortletResponse
).setParameter(
"displayStyle", journalDisplayContext.getDisplayStyle()
).setParameter(
"folderId", curFolder.getFolderId()
).setParameter(
"groupId", curFolder.getGroupId()
).buildPortletURL();
%>
<%
Date createDate = curFolder.getCreateDate();
String createDateDescription = LanguageUtil.getTimeDescription(request, System.currentTimeMillis() - createDate.getTime(), true);
%>
<%= HtmlUtil.escape(curFolder.getName()) %>
<%= JournalHelperUtil.getAbsolutePath(liferayPortletRequest, curFolder.getParentFolderId()) %>
<%
row.setCssClass("card-page-item card-page-item-directory " + row.getCssClass());
%>
var journalNavigation = new Liferay.Portlet.JournalNavigation({
editEntryUrl: ' ',
form: {
method: 'POST',
node: A.one(document. fm),
},
moveEntryUrl:
' ',
namespace: ' ',
searchContainerId: 'articles',
});
var clearJournalNavigationHandles = function (event) {
if (event.portletId === '<%= portletDisplay.getRootPortletId() %>') {
journalNavigation.destroy();
Liferay.detach('destroyPortlet', clearJournalNavigationHandles);
}
};
Liferay.on('destroyPortlet', clearJournalNavigationHandles);