All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.wiki.view.jsp Maven / Gradle / Ivy

There is a newer version: 7.0.121
Show newest version
<%--
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */
--%>

<%@ include file="/wiki/init.jsp" %>



<%
WikiPortletInstanceConfiguration wikiPortletInstanceConfiguration = wikiRequestHelper.getWikiPortletInstanceConfiguration();

boolean followRedirect = ParamUtil.getBoolean(request, "followRedirect", true);

WikiNode node = (WikiNode)request.getAttribute(WikiWebKeys.WIKI_NODE);

WikiPage wikiPage = (WikiPage)request.getAttribute(WikiWebKeys.WIKI_PAGE);

WikiPage originalPage = null;
WikiPage redirectPage = wikiPage.getRedirectPage();

if (followRedirect && (redirectPage != null)) {
	originalPage = wikiPage;
	wikiPage = redirectPage;
}

String title = wikiPage.getTitle();
String parentTitle = wikiPage.getParentTitle();

List childPages = new ArrayList<>();

for (WikiPage curChildPage : wikiPage.getViewableChildPages()) {
	if (curChildPage.getRedirectPage() == null) {
		childPages.add(curChildPage);
	}
}

boolean preview = false;
boolean print = Objects.equals(ParamUtil.getString(request, "viewMode"), Constants.PRINT);

PortletURL viewPageURL = renderResponse.createRenderURL();

if (portletName.equals(WikiPortletKeys.WIKI_DISPLAY)) {
	viewPageURL.setParameter("mvcRenderCommandName", "/wiki/view_page");
}
else {
	viewPageURL.setParameter("mvcRenderCommandName", "/wiki/view");
}

viewPageURL.setParameter("nodeName", node.getName());
viewPageURL.setParameter("title", title);

PortletURL viewParentPageURL = null;

if (Validator.isNotNull(parentTitle)) {
	viewParentPageURL = PortletURLBuilder.create(
		PortletURLUtil.clone(viewPageURL, renderResponse)
	).setParameter(
		"title", parentTitle
	).buildPortletURL();

	parentTitle = StringUtil.shorten(parentTitle, 20);
}

PortletURL addPageURL = PortletURLBuilder.createRenderURL(
	renderResponse
).setMVCRenderCommandName(
	"/wiki/edit_page"
).setRedirect(
	currentURL
).setParameter(
	"editTitle", "1"
).setParameter(
	"nodeId", node.getNodeId()
).setParameter(
	"parentTitle", wikiPage.getTitle()
).setParameter(
	"title", StringPool.BLANK
).buildPortletURL();

PortletURL editPageURL = PortletURLBuilder.createRenderURL(
	renderResponse
).setMVCRenderCommandName(
	"/wiki/edit_page"
).setRedirect(
	currentURL
).setParameter(
	"nodeId", node.getNodeId()
).setParameter(
	"title", title
).buildPortletURL();

String printPageURL = PortletURLBuilder.create(
	PortletURLUtil.clone(viewPageURL, renderResponse)
).setParameter(
	"viewMode", Constants.PRINT
).setWindowState(
	LiferayWindowState.POP_UP
).buildString();

PortletURL categorizedPagesURL = PortletURLBuilder.createRenderURL(
	renderResponse
).setMVCRenderCommandName(
	"/wiki/view_categorized_pages"
).setParameter(
	"nodeId", node.getNodeId()
).buildPortletURL();

PortletURL taggedPagesURL = PortletURLBuilder.createRenderURL(
	renderResponse
).setMVCRenderCommandName(
	"/wiki/view_tagged_pages"
).setParameter(
	"nodeId", node.getNodeId()
).buildPortletURL();

AssetEntry layoutAssetEntry = AssetEntryLocalServiceUtil.getEntry(WikiPage.class.getName(), wikiPage.getResourcePrimKey());

AssetEntryServiceUtil.incrementViewCounter(layoutAssetEntry);

if (Validator.isNotNull(ParamUtil.getString(request, "title"))) {
	assetHelper.addLayoutTags(request, AssetTagLocalServiceUtil.getTags(WikiPage.class.getName(), wikiPage.getResourcePrimKey()));
}

request.setAttribute(WebKeys.LAYOUT_ASSET_ENTRY, layoutAssetEntry);

LinkedAssetEntryIdsUtil.addLinkedAssetEntryId(request, layoutAssetEntry.getEntryId());

boolean portletTitleBasedNavigation = GetterUtil.getBoolean(portletConfig.getInitParameter("portlet-title-based-navigation"));

if (portletTitleBasedNavigation) {
	WikiURLHelper wikiURLHelper = new WikiURLHelper(wikiRequestHelper, renderResponse, wikiGroupServiceConfiguration);

	PortletURL backToViewPagesURL = wikiURLHelper.getBackToViewPagesURL(node);

	portletDisplay.setShowBackIcon(true);
	portletDisplay.setURLBack((viewParentPageURL != null) ? viewParentPageURL.toString() : backToViewPagesURL.toString());
}
%>


	
>
>
> window.onafterprint = function () { window.close(); }; window.onfocus = function () { window.close(); }; print(); <% List entries = new ArrayList<>(); entries.add(wikiPage); String formattedContent = null; WikiEngineRenderer wikiEngineRenderer = (WikiEngineRenderer)request.getAttribute(WikiWebKeys.WIKI_ENGINE_RENDERER); try { formattedContent = WikiUtil.getFormattedContent(wikiEngineRenderer, renderRequest, renderResponse, wikiPage, viewPageURL, editPageURL, title, preview); } catch (Exception e) { formattedContent = wikiPage.getContent(); } %>

<%= title %>

<% PortletURL originalViewPageURL = PortletURLBuilder.createRenderURL( renderResponse ).setMVCRenderCommandName( "/wiki/view" ).setParameter( "followRedirect", "false" ).setParameter( "nodeName", node.getName() ).setParameter( "title", originalPage.getTitle() ).buildPortletURL(); %>
()
( (<%= wikiPage.getVersion() %>), )
<%@ include file="/wiki/view_page_content.jspf" %>
<% AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry(WikiPage.class.getName(), wikiPage.getResourcePrimKey()); %> <%= assetEntry.getViewCount() %> <%= assetEntry.getViewCount() %>
<% if (!Objects.equals(wikiPage.getTitle(), wikiGroupServiceConfiguration.frontPageName())) { if (!portletName.equals(WikiPortletKeys.WIKI_DISPLAY)) { PortalUtil.setPageSubtitle(wikiPage.getTitle(), request); String description = wikiPage.getContent(); if (Objects.equals(wikiPage.getFormat(), "html")) { description = HtmlUtil.stripHtml(description); } description = StringUtil.shorten(description, 200); PortalUtil.setPageDescription(description, request); PortalUtil.setPageKeywords(assetHelper.getAssetKeywords(WikiPage.class.getName(), wikiPage.getResourcePrimKey()), request); } List parentPages = wikiPage.getViewableParentPages(); for (WikiPage curParentPage : parentPages) { viewPageURL.setParameter("title", curParentPage.getTitle()); PortalUtil.addPortletBreadcrumbEntry(request, curParentPage.getTitle(), viewPageURL.toString()); } viewPageURL.setParameter("title", wikiPage.getTitle()); PortalUtil.addPortletBreadcrumbEntry(request, wikiPage.getTitle(), viewPageURL.toString()); } %>
    <% for (WikiPage childPage : childPages) { %>
  • "><%= childPage.getTitle() %>

    <% String childPageFormattedContent = null; try { childPageFormattedContent = WikiUtil.getFormattedContent(wikiEngineRenderer, renderRequest, renderResponse, childPage, viewPageURL, editPageURL, childPage.getTitle(), false); } catch (Exception e) { childPageFormattedContent = childPage.getContent(); } %>

    <%= HtmlUtil.escape(StringUtil.shorten(HtmlParserUtil.extractText(childPageFormattedContent), 200)) %>

  • <% } %>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy