Foros de discusión

Asset Publisher show custom fields in table list

Ramesh K, modificado hace 11 años.

Asset Publisher show custom fields in table list

New Member Mensajes: 8 Fecha de incorporación: 5/07/11 Mensajes recientes
Hi,
I created a website say "sampleweb.org" and created a web content structure "sample-web-content-structure"
sample-web-content-structure has following fields : First Name, Last Name, City, State
On "sampleweb.org" site I added Asset Publisher and configured in such a way that Under Asset Type >>Web Content >> sub type is "sample-web-content-structure"
It shows in the table format with Available metadata fields.
I wanted to show custom metadata in the table list. (First Name, Last Name, City) instead of Title, Published Date (These are available metadata fields in liferay)
Shall I have to write asset publisher hook in order to get the web content custom metadata fields?
Can anyone please suggest me how to show custom metadata on asset publisher table list?
Thanks in advance
thumbnail
Richard SINELLE, modificado hace 11 años.

RE: Asset Publisher show custom fields in table list

Junior Member Mensajes: 28 Fecha de incorporación: 7/04/11 Mensajes recientes
Hi

In order to display custom metadata in AssetPublisher portlet, you need to
- hook the /html/portlet/asset_publisher/init-ext.jsp in order to add the new attribut in the liste of metadata
ie: allMetadataFields += ",version";
allMetadataFields is used in configuration.jsp

- hook /html/portlet/asset_publisher/asset_metadat.jspf in oder to display the new metadata with title-list, abstracts, full-content display style
else if (metadataFields[j].equals("version")) {
value = "";
if (JournalArticle.class.getName().equals(assetEntry.getClassName())) {
JournalArticle journalArticle = JournalArticleLocalServiceUtil.getLatestArticle(assetEntry.getClassPK());
value = Double.toString(journalArticle.getVersion());
} else if (DLFileEntry.class.getName().equals(assetEntry.getClassName())) {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(assetEntry.getClassPK());
value = fileEntry.getVersion();
}
}

- hook: /html/portlet/asset_publisher/display/table.jsp in oder to display the new metadata with table display style
else if (metadataFields[m].equals("version")) {
if (JournalArticle.class.getName().equals(assetEntry.getClassName())) {
JournalArticle journalArticle = JournalArticleLocalServiceUtil.getLatestArticle(assetEntry.getClassPK());
value = Double.toString(journalArticle.getVersion());
} else if (DLFileEntry.class.getName().equals(assetEntry.getClassName())) {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(assetEntry.getClassPK());
value = fileEntry.getVersion();
} else {
value ="";
}
}
Take care to test the assetEntry class name.

Hope it's help you
Ramesh K, modificado hace 11 años.

RE: Asset Publisher show custom fields in table list

New Member Mensajes: 8 Fecha de incorporación: 5/07/11 Mensajes recientes
Thanks
It really helped me
Umasankar Jeyaraj, modificado hace 10 años.

RE: Asset Publisher show custom fields in table list

New Member Mensajes: 7 Fecha de incorporación: 16/07/13 Mensajes recientes
Hi Richard,
I tried the steps which you provided for custom hook. But i am getting allMetadataFields +=",version" in all the places. It is getting repeated above the button "Add New" and inside the table content (on columns). Could you please help me with some workable examples.

Thanks in advance,
Umasankar

Archivos adjuntos:

Jatinderpal Singh, modificado hace 8 años.

RE: Asset Publisher show custom fields in table list

Junior Member Mensajes: 49 Fecha de incorporación: 14/08/15 Mensajes recientes
Umashankar G !
I was also having same error while creating hook for init-ext.jsp.
Then instead of creating hook for init-ext.jsp, I created hook for init.jsp and the error is removed