Custom publishing

Hello,

I am trying to build on the “publish now” functionality in order to give users a preview in a test environment. What I am trying to achieve is to “redirect” from “/ui/publishing/publish.jsp” (or a copy of this file) to the published file, when on-demand publishing is triggered.

Is there a built-in way of doing this? If not, what is the best way to get the published URL: from the menu item parameters (in WorkBench), or from IPSPublisherService in the jsp page?

Many thanks

Fabio

The best way to find the published path (which is really the relative URL) is to call $rx.location.generate(). There are several signatures: pick one that allows you to specify the context, site and folder ids.

If you’re in a JSP page, this class is has be referenced through Java. The fully qualified name is:

com.percussion.services.assembly.jexl.PSLocationUtils

This class is included in the public Java Doc.

Thanks dbenua, however I’m trying to pass the URL to a user menu, and calling $rx.location.generate() from the parameters list does not return anything. I suppose it could be done, as you suggested, in the jsp publish page using the PSLocationUtils class: where can I find a snippet of code to get an “IPSAssemblyItem” from its ID (IPSHtmlParameters.SYS_CONTENTID)?

Many thanks again.

[QUOTE=ffabrizio;410]Thanks dbenua, however I’m trying to pass the URL to a user menu, and calling $rx.location.generate() from the parameters list does not return anything. I suppose it could be done, as you suggested, in the jsp publish page using the PSLocationUtils class: where can I find a snippet of code to get an “IPSAssemblyItem” from its ID (IPSHtmlParameters.SYS_CONTENTID)?

Many thanks again.[/QUOTE]

I guess I don’t understand what you mean by “pass the URL to a user menu”. Normally, the target of a user menu will be some sort of generated “page” (in 5.x we used Query Resources, but in 6.x the simplest approach is to use a JSP page).

To create an AssemblyItem, you need not only the ID, but also the Site, Context, Template, etc. The Assembly Service has a method for creating an AssemblyItem (see IPSAssemblyService.createAssemblyItem()). The JavaDoc is pretty clear on what you have to do. Remember to call normalize() at the end or you won’t have a usable item.

Dave

Hi Dave,

what I meant is that what I’m trying to achieve is to have a “Publish now” menu, which redirect to the first published item, rather than displaying a “Edition queued” message (which is what /ui/publishing/publish.jsp does).

I’ll dig around the API, thanks
Fabio