liferay Journal Preview

1.实现Journal的Preview功能

2.   重写Journal下的article_action.jsp:

添加:

<%
long groupId = themeDisplay.getPortletGroupId();;
String name = portletDisplay.getRootPortletId();
String primKey = portletDisplay.getResourcePK();
%>

<!--if 判断用户是否有view和preview权限-->

<c:if test="<%= JournalArticlePermission.contains(permissionChecker, article, ActionKeys.VIEW)&&permissionChecker.hasPermission(groupId, name, primKey, "preview") %>">

        <portlet:renderURL var="previewURL">

<!--请求新的页面preview,也可与Journal Article Portlet的view.jsp一样,作if判断,如果articleId不是null,则显示Journal的内容-->
            <portlet:param name="struts_action" value="/journal/preview" />
            <portlet:param name="articleId" value="<%= article.getArticleId() %>" />
            <portlet:param name="version" value="<%= String.valueOf(article.getVersion()) %>" />
        </portlet:renderURL>

        <liferay-ui:icon image="preview" url="<%= previewURL.toString() %>"/>
    </c:if>

3.preview.jsp

<!--Journal Acticle portlet view.jsp中的<c:otherwise></c:otherwise>的内容,用于显示journal的内容-->
<%@ include file="/html/portlet/journal_articles/init.jsp" %>

<%
String articleId = ParamUtil.getString(request, "articleId");
double version = ParamUtil.getDouble(request, "version");

String languageId = LanguageUtil.getLanguageId(request);

String content = JournalArticleServiceUtil.getArticleContent(groupId, articleId, version, languageId, themeDisplay);

RuntimeLogic portletLogic = new PortletLogic(application, request, response, renderRequest, renderResponse);
RuntimeLogic actionURLLogic = new ActionURLLogic(renderResponse);
RuntimeLogic renderURLLogic = new RenderURLLogic(renderResponse);

content = RuntimePortletUtil.processXML(request, content, portletLogic);
content = RuntimePortletUtil.processXML(request, content, actionURLLogic);
content = RuntimePortletUtil.processXML(request, content, renderURLLogic);
%>

<%= content %>

你可能感兴趣的:(C++,c,jsp,struts,C#)