Fórum

Get AssetEntry view URL

Maximiliano Chiesa, modificado 11 Anos atrás.

Get AssetEntry view URL

Junior Member Postagens: 47 Data de Entrada: 20/07/12 Postagens Recentes
Hi!

I have a portlet in which I order assets according to their categories. For each AssetEntry I want to generate a link to it's "view". The problem is that I don't know how to get that URL programatically and set it to the link's href property.

Is there a way of making this?

Thanks in advance!
thumbnail
Dave Weitzel, modificado 11 Anos atrás.

RE: Get AssetEntry view URL

Regular Member Postagens: 208 Data de Entrada: 18/11/09 Postagens Recentes
I suggest you look at how AssetPublisher does it.
Basically it has to identify a page layout (plid) that contains the right portlet for the asset type you are displaying , then standard portlet options will allow you to maximize the portlet to show larger view of the asset.
Gregor Bregenzer, modificado 11 Anos atrás.

RE: Get AssetEntry view URL

New Member Mensagem: 1 Data de Entrada: 22/10/12 Postagens Recentes
Hi!

In case you want to see the URL in each Asset Entry you can make a Hook for that. Just overwrite /WEB-INF/jsps/html/portlet/asset_publisher/display/full_content.jsp

and add the following content after line 217:

		<div class="urlBox">
                <hr>
                <input id="entryButton" type="button" name="entryURL" value="Entry URL" onClick="toggle(this)">

                <div id="entryURL">
                        &lt;%
                                String currentGroup = themeDisplay.getLayout().getGroup().getFriendlyURL();
                                String friendlyURL = themeDisplay.getPortalURL() + currentGroup + "/-/" + assetRenderer.getUrlTitle();
                        %&gt;
                        <a href="<%= friendlyURL %>"> &lt;%= friendlyURL %&gt; </a>
                </div>
		</div>

		<script>
                var entryURL = document.getElementById('entryURL');
                var isShown = true;
                entryURL.style.display = 'none';

                function toggle(entryButton) {
                        if (isShown)
                        {
                        entryURL.style.display = 'block';
                                isShown = false;
                                entryButton.value= 'Hide';
                        }

                        else
                    {
                entryURL.style.display = 'none';
                                isShown = true;
                                entryButton.value= 'Entry URL';
                        }
                 }
        </script>


Now every AssetEntry has a Button in the bottom, which shows the friendly url.