« Volver a The Application...

Rich Summary for Asset Publisher

Description #

This template is able to read preferences to show metadata from the Asset publisher, and it shows the abstracts of the assets being rendered.

Displays abstracts, icons, related assets, and print/edit actions for assets. Optionally include asset bookmarks and ratings.

Application #

This template is written for the Asset publisher

Language #

It is written using Freemarker

Screenshots #

Full code #

<#assign liferay_ui = taglibLiferayHash["/WEB-INF/tld/liferay-ui.tld"] />

<#list entries as entry>
	<#assign entry = entry />

	<#assign assetRenderer = entry.getAssetRenderer() />

	<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry) />

	<#if assetLinkBehavior != "showFullContent">
		<#assign viewURL = assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL) />
	</#if>

	<div class="asset-abstract">
		<div class="lfr-meta-actions asset-actions">
			<@getPrintIcon />

			<@getFlagsIcon />

			<@getEditIcon />
		</div>

		<h3 class="asset-title">
			<a href="${viewURL}"><img alt="" src="${assetRenderer.getIconPath(renderRequest)}" />${entry.getTitle(locale)}</a>
		</h3>

		<@getMetadataField fieldName="tags" />

		<@getMetadataField fieldName="create-date" />

		<@getMetadataField fieldName="view-count" />

		<div class="asset-content">
			<@getSocialBookmarks />

			<div class="asset-summary">
				<@getMetadataField fieldName="author" />

				${assetRenderer.getSummary(locale)}

				<a href="${viewURL}"><@liferay.language key="read-more" /><span class="aui-helper-hidden-accessible"><@liferay.language key="about" />${entry.getTitle(locale)}</span> &raquo;</a>
			</div>

			<@getRatings />

			<@getRelatedAssets />

			<@getDiscussion />
		</div>
	</div>

</#list>

<#macro getDiscussion>
	<#if validator.isNotNull(assetRenderer.getDiscussionPath()) && (enableComments == "true")>
		<br />

		<#assign discussionURL = renderResponse.createActionURL() />

		${discussionURL.setParameter("struts_action", "/asset_publisher/" + assetRenderer.getDiscussionPath())}

		<@liferay_ui["discussion"]
			className=entry.getClassName()
			classPK=entry.getClassPK()
			formAction=discussionURL?string
			formName="fm" + entry.getClassPK()
			ratingsEnabled=enableCommentRatings == "true"
			redirect=portalUtil.getCurrentURL(request)
			subject=assetRenderer.getTitle(locale)
			userId=assetRenderer.getUserId()
		/>
	</#if>
</#macro>

<#macro getEditIcon>
	<#if assetRenderer.hasEditPermission(themeDisplay.getPermissionChecker())>
		<#assign redirectURL = renderResponse.createRenderURL() />

		${redirectURL.setParameter("struts_action", "/asset_publisher/add_asset_redirect")}
		${redirectURL.setWindowState("pop_up")}

		<#assign editPortletURL = assetRenderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("pop_up"), redirectURL) />

		<#if validator.isNotNull(editPortletURL)>
			<#assign title = languageUtil.format(locale, "edit-x", htmlUtil.escape(assetRenderer.getTitle(locale))) />

			<@liferay_ui["icon"]
				image="edit"
				message=title
				url="javascript:Liferay.Util.openWindow({dialog: {width: 960}, id:'" + renderResponse.getNamespace() + "editAsset', title: '" + title + "', uri:'" + htmlUtil.escapeURL(editPortletURL.toString()) + "'});"
			/>
		</#if>
	</#if>
</#macro>

<#macro getFlagsIcon>
	<#if enableFlags == "true">
		<@liferay_ui["flags"]
			className=entry.getClassName()
			classPK=entry.getClassPK()
			contentTitle=entry.getTitle(locale)
			label=false
			reportedUserId=entry.getUserId()
		/>
	</#if>
</#macro>

<#macro getMetadataField fieldName>
	<#if stringUtil.split(metadataFields)?seq_contains(metadataFieldName)>
		<span class="metadata-entry metadata-"${metadataFieldName}">
			<#assign dateFormat = "dd MMM yyyy - HH:mm:ss" />

			<#if fieldName == "author">
				<@liferay.language key="by" /> ${portalUtil.getUserName(assetRenderer.getUserId(), assetRenderer.getUserName())}
			<#elseif fieldName == "categories">
				<@liferay_ui["asset-categories-summary"]
					className=entry.getClassName()
					classPK=entry.getClassPK()
					portletURL=renderResponse.createRenderURL()
				/>
			<#elseif fieldName == "create-date">
				${dateUtil.getDate(entry.getCreateDate(), dateFormat, locale)}
			<#elseif fieldName == "expiration-date">
				${dateUtil.getDate(entry.getExpirationDate(), dateFormat, locale)}
			<#elseif fieldName == "modified-date">
				${dateUtil.getDate(entry.getModifiedDate(), dateFormat, locale)}
			<#elseif fieldName == "priority">
				${entry.getPriority()}
			<#elseif fieldName == "publish-date">
				${ddateUtil.getDate(entry.getPublishDate(), dateFormat, locale)}
			<#elseif fieldName == "tags">
				<@liferay_ui["asset-tags-summary"]
					className=entry.getClassName()
					classPK=entry.getClassPK()
					portletURL=renderResponse.createRenderURL()
				/>
			<#elseif fieldName == "view-count">
				<@liferay_ui["icon"]
					image="history"
				/>

				${entry.getViewCount()} <@liferay.language key="views" />
			</#if>
		</span>
	</#if>
</#macro>

<#macro getPrintIcon>
	<#if enablePrint == "true" >
		<#assign printURL = renderResponse.createRenderURL() />

		${printURL.setParameter("struts_action", "/asset_publisher/view_content")}
		${printURL.setParameter("assetEntryId", entry.getEntryId()?string)}
		${printURL.setParameter("viewMode", "print")}
		${printURL.setParameter("type", entry.getAssetRendererFactory().getType())}

		<#if (validator.isNotNull(assetRenderer.getUrlTitle()))>
			<#if (assetRenderer.getGroupId() != themeDisplay.getScopeGroupId())>
				${printURL.setParameter("groupId", assetRenderer.getGroupId()?string)}
			</#if>

			${printURL.setParameter("urlTitle", assetRenderer.getUrlTitle())}
		</#if>

		${printURL.setWindowState("pop_up")}

		<@liferay_ui["icon"]
			image="print"
			message="print"
			url="javascript:Liferay.Util.openWindow({dialog: {width: 960}, id:'" + renderResponse.getNamespace() + "printAsset', title: '" + languageUtil.format(locale, "print-x-x", ["aui-helper-hidden-accessible", htmlUtil.escape(assetRenderer.getTitle(locale))]) + "', uri: '" + htmlUtil.escapeURL(printURL.toString()) + "'});"
		/>
	</#if>
</#macro>

<#macro getRatings>
	<#if (enableRatings == "true")>
		<div class="asset-ratings">
			<@liferay_ui["ratings"]
				className=entry.getClassName()
				classPK=entry.getClassPK()
			/>
		</div>
	</#if>
</#macro>

<#macro getRelatedAssets>
	<#if enableRelatedAssets == "true">
		<@liferay_ui["asset-links"]
			assetEntryId=entry.getEntryId()
		/>
	</#if>
</#macro>

<#macro getSocialBookmarks>
	<#if enableSocialBookmarks == "true">
		<@liferay_ui["social-bookmarks"]
			displayStyle="${socialBookmarksDisplayStyle}"
			target="_blank"
			title=entry.getTitle(locale)
			url=viewURL
		/>
	</#if>
</#macro>
2 archivos adjuntos
44258 Accesos
Promedio (1 Votar)
La valoración media es de 5.0 estrellas de 5.
Comentarios
Respuestas anidadas Autor Fecha
Hi, Can any body guide about the code... Muhammad Umer Zubair 18 de febrero de 2014 3:15
Where is the assetLinkBehavior variable initiated? Luca Lauretta 6 de marzo de 2014 17:48
Hi, If I want to show the Edit icon only when... c s 3 de abril de 2014 14:03
hi please introduce me a user guide(pdf or... shima shima 9 de junio de 2014 23:48
hi please introduce me a user guide(pdf or... shima shima 9 de junio de 2014 23:48
hi please introduce me a user guide(pdf or... shima shima 9 de junio de 2014 23:48
hi please introduce me a user guide(pdf or... shima shima 9 de junio de 2014 23:48
hi please introduce me a user guide(pdf or... shima shima 9 de junio de 2014 23:48
another question in asset publisher I have a... shima shima 10 de junio de 2014 0:04
it is so useful . would you please explain the... shima shima 14 de septiembre de 2014 1:28

Hi,

Can any body guide about the code (Application Display Templates) for getting article small image (uploaded in article abstract summary), which will be used in Asset Publisher. This will be helpful in getting latest news, like default style Abstracts.

Thanks
Publicado el día 18/02/14 3:15.
Where is the assetLinkBehavior variable initiated?
Publicado el día 6/03/14 17:48.
Hi,

If I want to show the Edit icon only when Edit controls are enabled (in addition to the user having edit permission), what is the best way to do that?

Thanks
Publicado el día 3/04/14 14:03.
hi
please introduce me a user guide(pdf or such it) to write freemarker in liferay template , it is so hard to find each syntax per case.
Publicado el día 9/06/14 23:48.
hi
please introduce me a user guide(pdf or such it) to write freemarker in liferay template , it is so hard to find each syntax per case.
Publicado el día 9/06/14 23:48.
hi
please introduce me a user guide(pdf or such it) to write freemarker in liferay template , it is so hard to find each syntax per case.
Publicado el día 9/06/14 23:48.
hi
please introduce me a user guide(pdf or such it) to write freemarker in liferay template , it is so hard to find each syntax per case.
Publicado el día 9/06/14 23:48.
hi
please introduce me a user guide(pdf or such it) to write freemarker in liferay template , it is so hard to find each syntax per case.
Publicado el día 9/06/14 23:48.
another question
in asset publisher I have a structure that contains 1 picture 1 textarea 1 date . It has embedded to a template that will write in free marker . now I want show that parameters by use free marker in template as assign them (specialy the text area)to a custom field . and then check them to be sure it is not empty.
what is the best ftl syntax to do that?
Publicado el día 10/06/14 0:04.
it is so useful . would you please explain the case that click on "Read more" and show full content in web content displayer
Publicado el día 14/09/14 1:28.