Foros de discusión
Velocity - get edit URL for asset
Bünyamin Sever, modificado hace 8 años.
Velocity - get edit URL for asset
New Member Mensajes: 14 Fecha de incorporación: 22/04/15 Mensajes recientes
Hi,
in my Application Display Template (Velocity) i need to add an edit-button for editing the asset entry.
I checked if the user has the permission to edit the asset entries.
Now i need the URL for edit the asset entry.
How can i get the URL?
Thanks
in my Application Display Template (Velocity) i need to add an edit-button for editing the asset entry.
I checked if the user has the permission to edit the asset entries.
Now i need the URL for edit the asset entry.
How can i get the URL?
Thanks
Samuel Kong, modificado hace 8 años.
RE: Velocity - get edit URL for asset
Liferay Legend Mensajes: 1902 Fecha de incorporación: 10/03/08 Mensajes recientes
You can get the edit URL from the AssetRenderer.
http://docs.liferay.com/portal/6.2/javadocs/com/liferay/portlet/asset/model/AssetRenderer.html#getURLEdit%28com.liferay.portal.kernel.portlet.LiferayPortletRequest,%20com.liferay.portal.kernel.portlet.LiferayPortletResponse%29
You can get the AssetRenderer from the AssetEntry
http://docs.liferay.com/portal/6.2/javadocs/com/liferay/portlet/asset/model/AssetEntry.html#getAssetRenderer%28%29
http://docs.liferay.com/portal/6.2/javadocs/com/liferay/portlet/asset/model/AssetRenderer.html#getURLEdit%28com.liferay.portal.kernel.portlet.LiferayPortletRequest,%20com.liferay.portal.kernel.portlet.LiferayPortletResponse%29
You can get the AssetRenderer from the AssetEntry
http://docs.liferay.com/portal/6.2/javadocs/com/liferay/portlet/asset/model/AssetEntry.html#getAssetRenderer%28%29
Bünyamin Sever, modificado hace 8 años.
RE: Velocity - get edit URL for asset
New Member Mensajes: 14 Fecha de incorporación: 22/04/15 Mensajes recientes
Thank you for your help.
But with this i have following question/problems:
i use following Code:
But with this i have following question/problems:
- Am i able to open directly the edit mode for an entry without going into the control panel?
- after use this URL, i will forwarded to edit mode, but the Structure-Selection is set to Default... the Template -selection is as before
i use following Code:
#set ($assetRenderer = $entry.getAssetRenderer())
#set ($editURL = $assetRenderer.getURLEdit($renderRequest,$renderResponse))
#set ($editURL = $editURL + "&_15_redirect=" + $currentURL)
Bünyamin Sever, modificado hace 8 años.
RE: Velocity - get edit URL for asset
New Member Mensajes: 14 Fecha de incorporación: 22/04/15 Mensajes recientes
after trying a little bit:
## create edit URL
#set ($portletName = $themeDisplay.getPortletDisplay().getPortletName())
#set ($plid = $getterUtil.getLong($themeDisplay.getPlid()))
#set ($portletURL = $portletURLFactory.create($renderRequest, $portletName, $plid, "RENDER_PHASE"))
#set ($windowState = $windowStateFactory.getWindowState("POP_UP"))
#set ($assetRenderer = $entry.getAssetRenderer())
#set ($editURL = $assetRenderer.getURLEdit($renderRequest,$renderResponse, $windowState, $portletURL))
Maryam Nabavi, modificado hace 7 años.
RE: Velocity - get edit URL for asset
New Member Mensaje: 1 Fecha de incorporación: 19/01/15 Mensajes recientesBünyamin Sever:
after trying a little bit:## create edit URL #set ($portletName = $themeDisplay.getPortletDisplay().getPortletName()) #set ($plid = $getterUtil.getLong($themeDisplay.getPlid())) #set ($portletURL = $portletURLFactory.create($renderRequest, $portletName, $plid, "RENDER_PHASE")) #set ($windowState = $windowStateFactory.getWindowState("POP_UP")) #set ($assetRenderer = $entry.getAssetRenderer()) #set ($editURL = $assetRenderer.getURLEdit($renderRequest,$renderResponse, $windowState, $portletURL))
hi , i have this issue too
but when i use this solution , only last asset entry will be edited.
how can i get any asset entry edit URl separately?
Vaclav Bartos, modificado hace 6 años.
RE: Velocity - get edit URL for asset
New Member Mensaje: 1 Fecha de incorporación: 12/04/17 Mensajes recientes
Hi,
just put it in the loop and print links as html. Freemarker looks like this.
Thank you for the code, Bünyamin Sever
just put it in the loop and print links as html. Freemarker looks like this.
<#list entries as entry>
<#assign portletName = themeDisplay.getPortletDisplay().getPortletName()>
<#assign plid = getterUtil.getLong(themeDisplay.getPlid())>
<#assign portletURL = portletURLFactory.create(renderRequest, portletName, plid, "RENDER_PHASE")>
<#assign windowState = windowStateFactory.getWindowState("POP_UP")>
<#assign assetRenderer = entry.getAssetRenderer())
<#assign editURL = assetRenderer.getURLEdit(renderRequest,renderResponse, windowState, portletURL)>
<a href="${editURL}" target="_blank">link to edit entry</a>
<!--#list-->
Thank you for the code, Bünyamin Sever