Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Malek Tarboush
Customize Asset Publisher , Structure , Template
28 de septiembre de 2010 5:46
Respuesta

Malek Tarboush

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 19 de septiembre de 2010

Mensajes recientes

Hello all
I'm trying to customize AssetPublisher style that show only web contents
with a custom structure and custom template
i was able to get everything from AssetEntry and AssetRenderer
its ok until now it works fine
but the problem is that
how can i get the additional parameters that i added in the customized structure?

my structure is something like this
1
2<root>
3 <dynamic-element name='right_image' type='image' index-type='' repeatable='false'>
4</dynamic-element>
5  <dynamic-element name='left_image' type='image' index-type='' repeatable='false'>
6</dynamic-element>
7</root>


so there is a new elements for every Journal Article

but how can i get these new elements from inside a JSP page
( AssetPublisher new display style )??

anyone has any idea about that

thanks
Malek Tarboush
RE: Customize Asset Publisher , Structure , Template
4 de octubre de 2010 5:58
Respuesta

Malek Tarboush

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 19 de septiembre de 2010

Mensajes recientes

from the JournalArticle I can get the structure id etc..

and this AssetEntry which i can get in AssetPublisher is originally a JournalArticle
but when I'm trying to cast from AssetEntry to JournalArticle
it throws cast exception may be because the AssetPublisher
wrap the JournalArticle in new Object (AssetEntry )

so is there anyway to get the AssetEntry as JournalArticle inside the AssetPublisher page?
so i can get the structure of this specific JournalArticle



thanks
Malek Tarboush
RE: Customize Asset Publisher , Structure , Template
5 de octubre de 2010 5:56
Respuesta

Malek Tarboush

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 19 de septiembre de 2010

Mensajes recientes

Ok I'll answer myselfemoticon

I got something good but not enough
from the asset entry now I'm able to get the original article (JournalArticle)
and the journal article my custom template and structure

and this is the way
this code exist in a custom AssetPublisher style called mine

mine.jsp ( it just show the code i added to )
 1
 2JournalArticle ja = null;
 3JournalStructure js = null;
 4JournalTemplate jt = null;
 5
 6JournalArticle  = JournalArticleLocalServiceUtil.getLatestArticle(assetEntry.getClassPK());
 7
 8try {
 9
10if (ja.getStructureId() != null && !ja.getStructureId().trim().equals("")) {
11
12js = JournalStructureLocalServiceUtil.getStructure(ja.getGroupId(),ja.getStructureId());
13
14}
15
16if (ja.getTemplateId() != null && !ja.getTemplateId().trim().equals("")) {
17
18jt = JournalTemplateLocalServiceUtil.getTemplate(ja.getGroupId(), ja.getTemplateId());
19
20}
21
22} catch (PortalException e) {
23e.printStackTrace();
24} catch (SystemException e) {
25e.printStackTrace();
26}


but also my problem did not end
because the problem that i can't get the variable values that i added in the custom strucure and custom template

I print the xsl data in the template object and the structure variable names there
but i want the value of these variables

any idea ?

I will keep trying
Balazs Pinter
RE: Customize Asset Publisher , Structure , Template
25 de julio de 2011 16:32
Respuesta

Balazs Pinter

Ranking: New Member

Mensajes: 4

Fecha de incorporación: 25 de julio de 2011

Mensajes recientes

Hi.

Did you figure out how can you solve this issue? I would appreciate it if you share your code.
Manali Lalaji
RE: Customize Asset Publisher , Structure , Template
26 de julio de 2011 0:18
Respuesta

Manali Lalaji

Ranking: Expert

Mensajes: 362

Fecha de incorporación: 9 de marzo de 2010

Mensajes recientes

Hi Malek,
You can try the sample code : Call the function getArticleFieldValue() which returns specific value for template

Document document = null;
JournalArticle authorJournalArticle=null;
content = journalArticle.getContent();
try {
document = SAXReaderUtil.read(new StringReader(content));
} catch (DocumentException e1) {
_log.warn("DocumentException : "+e1.getMessage());
}

if(Validator.isNotNull(document)){
imageUrl = getArticleFieldValue(document, "IMAGE");
status = getArticleFieldValue(document, "STATUS");
}

public static String getArticleFieldValue(Document document,String field){
String retValue = "";
if (Validator.isNotNull(document)) {
Node fieldContent = document.selectSingleNode("/root/dynamic-element[@name='"+field+"']/dynamic-content");
if(fieldContent!=null){
retValue = fieldContent.getText();
}
}
return retValue;
}

Hope this helps,

Thanks,
Manali
Judith Sambs
RE: Customize Asset Publisher , Structure , Template
23 de enero de 2013 7:38
Respuesta

Judith Sambs

Ranking: New Member

Mensajes: 13

Fecha de incorporación: 3 de diciembre de 2012

Mensajes recientes

While reading this post some questions arise in my head:
  • where should I put your code pieces?
  • are JournalArticleLocalServiceUtil and SAXReaderUtil available anyway or do I have to include it somehow
  • what datatype does "content" have?
  • is that code valid for Liferay Portal Community Edition 6.1.1 CE GA2

I am a liferay beginner and although I've been searching the web for days now I still could not access fields defined in the article's structure with the asset publisher. Either I don't know HOW to apply the solution or it doesn't work. I am grateful for any kind of help!

Thank you!
Claire Attard
RE: Customize Asset Publisher , Structure , Template
19 de noviembre de 2013 8:32
Respuesta

Claire Attard

Ranking: New Member

Mensajes: 3

Fecha de incorporación: 19 de diciembre de 2012

Mensajes recientes

Hi,

I am currently on an asset publisher in version 6.2 and i would like to create a custom vm template to display information from a web content structure. As i can understand it i can only use the variables of the asset entry but i would like to also like to include variables from the actual asset entry structure. is this possible using the ADT? I've seen the post explaining how this could be done in version 6.1 on your post, however i'm not sure if this will work in version 6.2.

Any feedback/ ideas would be appreciate