Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Ramesh K
Asset Publisher show custom fields in table list
27 de febrero de 2013 10:06
Respuesta

Ramesh K

Ranking: New Member

Mensajes: 7

Fecha de incorporación: 5 de julio de 2011

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
Richard SINELLE
RE: Asset Publisher show custom fields in table list
28 de febrero de 2013 4:31
Respuesta

Richard SINELLE

Ranking: Junior Member

Mensajes: 27

Fecha de incorporación: 7 de abril de 2011

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.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.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
RE: Asset Publisher show custom fields in table list
18 de marzo de 2013 13:37
Respuesta

Ramesh K

Ranking: New Member

Mensajes: 7

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

Thanks
It really helped me
Umasankar Jeyaraj
RE: Asset Publisher show custom fields in table list
29 de julio de 2013 1:14
Respuesta

Umasankar Jeyaraj

Ranking: New Member

Mensajes: 7

Fecha de incorporación: 16 de julio de 2013

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
Adjunto

archivos adjuntos: Capture.PNG (9,2k)