Fórum

Need help to extend Asset Publisher to add custom fields in display setting

Pushpinder Singh, modificado 13 Anos atrás.

Need help to extend Asset Publisher to add custom fields in display setting

Junior Member Postagens: 84 Data de Entrada: 21/07/10 Postagens Recentes
Hi All,
I need to extend existing asset publisher to add custom fields in display_settings.jspf and than extend abstract.jsp base on those field values.
Now I wonder how values from these new fields in extended display_settings.jspf will be passed to abstract.jsp. Is it stored somewhere in preference or passed as request parameter or request attribute. Do I need to extended any struct action class?

I will be using ext-plugin to extended changes.
I am using liferay 6.x.

Any help or hint will be really appreciated.
Pushpinder Singh, modificado 13 Anos atrás.

RE: Need help to extend Asset Publisher to add custom fields in display set

Junior Member Postagens: 84 Data de Entrada: 21/07/10 Postagens Recentes
Hi All,
You have to do following steps to add custom fields in display setting for asset publisher:

1. Add you custom field in display_settings.jspf
2. Update /html/portlet/asset_publisher/init.jsp to get value for your custom fields.
3. Update your choice of display jsp file in folder /html/portlet/asset_publisher/ to handle custom fields.
4. Create your coustom Configuration action class ConfigurationActionImpl.java which handle your custom fields also.
5. Add following entry in liferay-portlet-ext.xml

<portlet>
<portlet-name>101</portlet-name>
<icon>/html/icons/asset_publisher.png</icon>
<struts-path>asset_publisher</struts-path>
<configuration-action-class>my.org.portlet.assetpublisher.action.ConfigurationActionImpl</configuration-action-class>
<indexer-class>com.liferay.portlet.assetpublisher.util.AssetIndexer</indexer-class>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>asset_publisher</friendly-url-mapping>
<friendly-url-routes>com/liferay/portlet/assetpublisher/asset-publisher-friendly-url-routes.xml</friendly-url-routes>
<use-default-template>false</use-default-template>
<layout-cacheable>true</layout-cacheable>
<instanceable>true</instanceable>
<scopeable>false</scopeable>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>25</render-weight>
<header-portlet-css>/html/portlet/asset_publisher/css/main.jsp</header-portlet-css>
<css-class-wrapper>portlet-asset-publisher</css-class-wrapper>
</portlet>
thumbnail
Boris Yurkevich, modificado 11 Anos atrás.

RE: Need help to extend Asset Publisher to add custom fields in display set

New Member Postagens: 8 Data de Entrada: 20/04/12 Postagens Recentes
Pushpinder Singh,

Thank you very much for your instructions. If you can provide any references I'll be gratefull.
I have same task and I'm already stuck even on first step of your list.

1.
I'm not sure how it works. How do I add my custom filed in dislay_settings.jspf. All I have is a name of my custom field.

All code in display_settings.jspf is realted to Asset publisher's configuration pop-up window. Folowing instructions from step 2 I was already able to display my custom fields in Available List under Show Metadata header.

2.
Changed init.jsp from:
String allMetadataFields = "create-date,modified-date,publish-date,expiration-date,priority,author,view-count,categories,tags";

To
String allMetadataFields = "create-date,modified-date,publish-date,expiration-date,priority,author,view-count,categories,tags,realdate";


"realdate"
is my custom field name

3.
This step is not neccessery to display your custom-field.

4.
What logic to implement here? Such as I just need display my custom field in date format.
I can see you refereing this Java file in XML from the next fifth step.

5.
It is important do not forget to wrap all XML above inside <liferay-portlet-app> node or you will get this error during ant compiling


11:19:24,161 ERROR [MainServlet:244] java.lang.ClassNotFoundException: my.org.portlet.assetpublisher.action.ConfigurationActionImpl
java.lang.ClassNotFoundException: my.org.portlet.assetpublisher.action.ConfigurationActionImpl
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
        at com.liferay.portlet.PortletBagFactory.newInstance(PortletBagFactory.java:593)
        at com.liferay.portlet.PortletBagFactory.newInstance(PortletBagFactory.java:581)
        at com.liferay.portlet.PortletBagFactory.newConfigurationAction(PortletBagFactory.java:482)
        at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:126)
        at com.liferay.portal.servlet.MainServlet.initPortlets(MainServlet.java:864)
        at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:241)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)


Then in my ext project which looks now like this


I was able to see my custom field in Asset Publisher configuration pop-up window and when created new portlet.

I can't see my custom field next to Assets Publisher's metadata such as Authors, Category and so on.

Also Look At This Thread
Retrieving Custom Field (Expando Value) Associated With Web Content...