Foros de discusión
Customize Asset Publisher , Structure , Template
Malek Tarboush, modificado hace 13 años.
Customize Asset Publisher , Structure , Template
Junior Member Mensajes: 30 Fecha de incorporación: 19/09/10 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
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
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
<root>
<dynamic-element name="right_image" type="image" index-type="" repeatable="false">
</dynamic-element>
<dynamic-element name="left_image" type="image" index-type="" repeatable="false">
</dynamic-element>
</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, modificado hace 13 años.
RE: Customize Asset Publisher , Structure , Template
Junior Member Mensajes: 30 Fecha de incorporación: 19/09/10 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
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, modificado hace 13 años.
RE: Customize Asset Publisher , Structure , Template
Junior Member Mensajes: 30 Fecha de incorporación: 19/09/10 Mensajes recientes
Ok I'll answer myself
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 )
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
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 )
JournalArticle ja = null;
JournalStructure js = null;
JournalTemplate jt = null;
JournalArticle = JournalArticleLocalServiceUtil.getLatestArticle(assetEntry.getClassPK());
try {
if (ja.getStructureId() != null && !ja.getStructureId().trim().equals("")) {
js = JournalStructureLocalServiceUtil.getStructure(ja.getGroupId(),ja.getStructureId());
}
if (ja.getTemplateId() != null && !ja.getTemplateId().trim().equals("")) {
jt = JournalTemplateLocalServiceUtil.getTemplate(ja.getGroupId(), ja.getTemplateId());
}
} catch (PortalException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
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, modificado hace 12 años.
RE: Customize Asset Publisher , Structure , Template
New Member Mensajes: 4 Fecha de incorporación: 25/07/11 Mensajes recientes
Hi.
Did you figure out how can you solve this issue? I would appreciate it if you share your code.
Did you figure out how can you solve this issue? I would appreciate it if you share your code.
Manali Lalaji, modificado hace 12 años.
RE: Customize Asset Publisher , Structure , Template
Expert Mensajes: 362 Fecha de incorporación: 9/03/10 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
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, modificado hace 11 años.
RE: Customize Asset Publisher , Structure , Template
New Member Mensajes: 13 Fecha de incorporación: 3/12/12 Mensajes recientes
While reading this post some questions arise in my head:
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!
- 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, modificado hace 10 años.
RE: Customize Asset Publisher , Structure , Template
New Member Mensajes: 3 Fecha de incorporación: 19/12/12 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
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