Jonas X. Yuan 13 Years Ago Nice feature! Thanks a lot, Ray! Please sign in to reply. Reply as... Cancel
Joseph Toman 13 Years Ago Thanks for getting this up so quickly. So,... If instead of a Velocity template we were working in XSL could we accomplish the same thing? I'm not so much interested in the generic XSL required, but the way an XSL template interacts with the Liferay environment. For instance the Velocity template above depends on a lot of Java objects, are those all available if you use XSL ? If so, how do you get access to them (and their methods)? Thanks again, it was a good talk. Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago You can access all the same things from XSL. You just have to know your way around the xalan java language support. Please sign in to reply. Reply as... Cancel Joseph Toman Ray Augé 13 Years Ago Thanks. I had not found any documentation on this previously, but know that I know Liferay is using Xalan, a number of articles pop up when I do a search on that term. Thanks again. Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited I added the same template implemented as XSLT for you!It's completely functionally equivalent. Please sign in to reply. Reply as... Cancel Joseph Toman Ray Augé 13 Years Ago Hey, cool! Thanks, that'll save me a lot of head scratching! Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited Note that while you're working with XSL, that there is a small bug in the error processing xsl template which causes your template errors to be swallowed up and never made available.copy portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to your WEB-INF/classes folder (with full path) and remove the $companyId variable of the languageUtil:get method.That will also save you lots of head scratching. Please sign in to reply. Reply as... Cancel
Ray Augé Joseph Toman 13 Years Ago You can access all the same things from XSL. You just have to know your way around the xalan java language support. Please sign in to reply. Reply as... Cancel Joseph Toman Ray Augé 13 Years Ago Thanks. I had not found any documentation on this previously, but know that I know Liferay is using Xalan, a number of articles pop up when I do a search on that term. Thanks again. Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited I added the same template implemented as XSLT for you!It's completely functionally equivalent. Please sign in to reply. Reply as... Cancel Joseph Toman Ray Augé 13 Years Ago Hey, cool! Thanks, that'll save me a lot of head scratching! Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited Note that while you're working with XSL, that there is a small bug in the error processing xsl template which causes your template errors to be swallowed up and never made available.copy portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to your WEB-INF/classes folder (with full path) and remove the $companyId variable of the languageUtil:get method.That will also save you lots of head scratching. Please sign in to reply. Reply as... Cancel
Joseph Toman Ray Augé 13 Years Ago Thanks. I had not found any documentation on this previously, but know that I know Liferay is using Xalan, a number of articles pop up when I do a search on that term. Thanks again. Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited I added the same template implemented as XSLT for you!It's completely functionally equivalent. Please sign in to reply. Reply as... Cancel Joseph Toman Ray Augé 13 Years Ago Hey, cool! Thanks, that'll save me a lot of head scratching! Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited Note that while you're working with XSL, that there is a small bug in the error processing xsl template which causes your template errors to be swallowed up and never made available.copy portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to your WEB-INF/classes folder (with full path) and remove the $companyId variable of the languageUtil:get method.That will also save you lots of head scratching. Please sign in to reply. Reply as... Cancel
Ray Augé Joseph Toman 13 Years Ago - Edited I added the same template implemented as XSLT for you!It's completely functionally equivalent. Please sign in to reply. Reply as... Cancel Joseph Toman Ray Augé 13 Years Ago Hey, cool! Thanks, that'll save me a lot of head scratching! Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited Note that while you're working with XSL, that there is a small bug in the error processing xsl template which causes your template errors to be swallowed up and never made available.copy portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to your WEB-INF/classes folder (with full path) and remove the $companyId variable of the languageUtil:get method.That will also save you lots of head scratching. Please sign in to reply. Reply as... Cancel
Joseph Toman Ray Augé 13 Years Ago Hey, cool! Thanks, that'll save me a lot of head scratching! Please sign in to reply. Reply as... Cancel Ray Augé Joseph Toman 13 Years Ago - Edited Note that while you're working with XSL, that there is a small bug in the error processing xsl template which causes your template errors to be swallowed up and never made available.copy portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to your WEB-INF/classes folder (with full path) and remove the $companyId variable of the languageUtil:get method.That will also save you lots of head scratching. Please sign in to reply. Reply as... Cancel
Ray Augé Joseph Toman 13 Years Ago - Edited Note that while you're working with XSL, that there is a small bug in the error processing xsl template which causes your template errors to be swallowed up and never made available.copy portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to your WEB-INF/classes folder (with full path) and remove the $companyId variable of the languageUtil:get method.That will also save you lots of head scratching. Please sign in to reply. Reply as... Cancel
Abdelrahman Mohamed El Ghanam 13 Years Ago Great article .. i will surely try it out .. thanks ray.. Please sign in to reply. Reply as... Cancel
Richard Knight 12 Years Ago - Edited On this line of thinking with WCM...Like many windows applications having an embedded FileBrowser to pick a file to use in the application, how would you create a custom portlet that uses the existing WCM portlet as a means to create and choose a wcm entry to embed in the custom portlet. Any pointers would be greatly appreciated, since I don't want to recreate the entire functionality of the WCM portlet from scratch. Please sign in to reply. Reply as... Cancel Ray Augé Richard Knight 12 Years Ago The RSS portlet does exactly this using a special tag so you can embed a custom header and/or footer to it. The tag is <liferay-ui:journal-article /> (see the code of the RSS portlet, it's pretty simple. There is also the example in the configuration.jsp on how to make a selection of a WCM article and store it in a preference.) Please sign in to reply. Reply as... Cancel Richard Knight Ray Augé 12 Years Ago Thanks Ray, you are always so speedy with responses. I'll take a look. Thanks Again! Please sign in to reply. Reply as... Cancel Richard Knight Richard Knight 12 Years Ago One other question, is there anyway to do the same kind of thing with the Document Library or with the Image Library (File Chooser/Viewer) functionality? Please sign in to reply. Reply as... Cancel Ray Augé Richard Knight 12 Years Ago As soon s I get a chance I'll give an example of this. We don't have any canned examples that I'm aware of, but we should and so I'll make sure to come up with some shortly. Please sign in to reply. Reply as... Cancel
Ray Augé Richard Knight 12 Years Ago The RSS portlet does exactly this using a special tag so you can embed a custom header and/or footer to it. The tag is <liferay-ui:journal-article /> (see the code of the RSS portlet, it's pretty simple. There is also the example in the configuration.jsp on how to make a selection of a WCM article and store it in a preference.) Please sign in to reply. Reply as... Cancel Richard Knight Ray Augé 12 Years Ago Thanks Ray, you are always so speedy with responses. I'll take a look. Thanks Again! Please sign in to reply. Reply as... Cancel Richard Knight Richard Knight 12 Years Ago One other question, is there anyway to do the same kind of thing with the Document Library or with the Image Library (File Chooser/Viewer) functionality? Please sign in to reply. Reply as... Cancel Ray Augé Richard Knight 12 Years Ago As soon s I get a chance I'll give an example of this. We don't have any canned examples that I'm aware of, but we should and so I'll make sure to come up with some shortly. Please sign in to reply. Reply as... Cancel
Richard Knight Ray Augé 12 Years Ago Thanks Ray, you are always so speedy with responses. I'll take a look. Thanks Again! Please sign in to reply. Reply as... Cancel Richard Knight Richard Knight 12 Years Ago One other question, is there anyway to do the same kind of thing with the Document Library or with the Image Library (File Chooser/Viewer) functionality? Please sign in to reply. Reply as... Cancel Ray Augé Richard Knight 12 Years Ago As soon s I get a chance I'll give an example of this. We don't have any canned examples that I'm aware of, but we should and so I'll make sure to come up with some shortly. Please sign in to reply. Reply as... Cancel
Richard Knight Richard Knight 12 Years Ago One other question, is there anyway to do the same kind of thing with the Document Library or with the Image Library (File Chooser/Viewer) functionality? Please sign in to reply. Reply as... Cancel Ray Augé Richard Knight 12 Years Ago As soon s I get a chance I'll give an example of this. We don't have any canned examples that I'm aware of, but we should and so I'll make sure to come up with some shortly. Please sign in to reply. Reply as... Cancel
Ray Augé Richard Knight 12 Years Ago As soon s I get a chance I'll give an example of this. We don't have any canned examples that I'm aware of, but we should and so I'll make sure to come up with some shortly. Please sign in to reply. Reply as... Cancel
Richard Knight 12 Years Ago - Edited Hey Ray,Have you had a chance to develop any examples for as you spoke of above?....One other question, is there anyway to do the same kind of thing with the Document Library or with the Image Library (File Chooser/Viewer) functionality? Thanks,Richard Please sign in to reply. Reply as... Cancel Ray Augé Richard Knight 12 Years Ago I was trying really hard to actually get this into 6.1 as prepackaged components that you could just use. Unfortunately I did not get to do it.That being said, there is a partial component in 6.1 that could probably be re-purposed as a general solution (which is currently dependent on the control panel). That is the Asset Relation chooser (you can find this in the Related Assets section located in the editors of various assets). It let's you choose from any Asset type to create relations and returns reference information. But if it could be re-worked to specify the types available in particular instance (say limited to doclib references), then it could become very useful.Now, if you're trying to do this in 6.0 or earlier, the best possible examples are those found in the Web Content article editor. You have fields of type Document Library and Image Gallery with associated chooser. These are tied to a particular implementation for that portlet, but they are the best ootb examples that I can think of.Good luck Richard and my apologies for the very late reply! Please sign in to reply. Reply as... Cancel
Ray Augé Richard Knight 12 Years Ago I was trying really hard to actually get this into 6.1 as prepackaged components that you could just use. Unfortunately I did not get to do it.That being said, there is a partial component in 6.1 that could probably be re-purposed as a general solution (which is currently dependent on the control panel). That is the Asset Relation chooser (you can find this in the Related Assets section located in the editors of various assets). It let's you choose from any Asset type to create relations and returns reference information. But if it could be re-worked to specify the types available in particular instance (say limited to doclib references), then it could become very useful.Now, if you're trying to do this in 6.0 or earlier, the best possible examples are those found in the Web Content article editor. You have fields of type Document Library and Image Gallery with associated chooser. These are tied to a particular implementation for that portlet, but they are the best ootb examples that I can think of.Good luck Richard and my apologies for the very late reply! Please sign in to reply. Reply as... Cancel
Ismael Ferrer 12 Years Ago I am developing a war portlet that should allow the user to select a web content and store it in a preference.I'm taking as a model the RSS portlet as you suggested, but rss/select_journal_article.jspf imports asset_publisher/article_search.jsp that uses ArticleSearch and ArticleDisplayTerms classes wich are in portal-impl.jar.Is there a way to make that work without including portal-impl.jar in the portlet war?Thanks! Please sign in to reply. Reply as... Cancel Ray Augé Ismael Ferrer 12 Years Ago Oh! never include portal-impl.jar!Regarding those two classes, I've been meaning to do something like move this into the portal-service.jar. While not an ideal solution, for the short term I would simply take those two java classes and pull them into your plugin. I don't think they have any dependencies that are not already public, except from one small exception that could be solved by taking one method from JournalIUtil and pulling into the ArticleSearch class directly.The long term fix is of course to implement the nice asset choosers we talked about. Please sign in to reply. Reply as... Cancel
Ray Augé Ismael Ferrer 12 Years Ago Oh! never include portal-impl.jar!Regarding those two classes, I've been meaning to do something like move this into the portal-service.jar. While not an ideal solution, for the short term I would simply take those two java classes and pull them into your plugin. I don't think they have any dependencies that are not already public, except from one small exception that could be solved by taking one method from JournalIUtil and pulling into the ArticleSearch class directly.The long term fix is of course to implement the nice asset choosers we talked about. Please sign in to reply. Reply as... Cancel
(You) 12 Years Ago [...] http://www.liferay.com/web/raymond.auge/blog/-/blogs/advanced-web-content-example-with-ajax... [...] Read More Please sign in to reply. Reply as... Cancel
Francisco A Aranda 12 Years Ago Great article, I've learned a lot from it. But instead of the webcontent/name attribute, how I do access the webcontent title, not the structure name attribute? Thanks! Please sign in to reply. Reply as... Cancel
Randy Parsons 12 Years Ago Not sure what I'm doing wrong! I was so hoping this would be the answer to my issue of displaying multiple web content based on the same Structure. I have followed the instructions and understand most of what is going on, but I never get any content listing, even though I have added two WC using the structure 'WIDGET'. I did change the structureId in the code to what I called mine ('WIDGET') but still get nothing showing up. After refreshing the page the 'No Widgets' does appear briefly but then disappears (yes I did deselect the 'Cacheable' option). I would have thought that if no results are found then this information would continue to display. Is there setting I'm missing? (I have tried in 6.0.10 EE, 6.0.6 CE and 6.1 CE all with same results)I also tried using the XSLT version as well with the same results. Any suggestions. Please sign in to reply. Reply as... Cancel
Vaibhav Mittal 11 Years Ago - Edited Hi Ray! I am using Liferay 6.1. I am trying to make a web content using structure and templates. I have choosed lang xsl for templates. I have one textfield and 1 image in structure. But when i preview web content it shows internal server error. From logs i got this: 08:39:42,949 INFO [PortalImpl:4873] Current URL /c/journal/view_article_content?cmd=preview&groupId=19&articleId=14248&version=1.0 generates exception: com.liferay.portal.kernel.templateparser.TransformException: Unhandled exceptionBelow is my xsl:<?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" omit-xml-declaration="yes"/> <xsl:template match="/"> <html> <body> <xsl:value-of disable-output-escaping="yes" select="root/dynamic-element[@name='textarea']/dynamic-content"/> <br/> <img> <xsl:attribute name="src"> <xsl:value-of disable-output-escaping="yes" select="root/dynamic-element[@name='image']/dynamic-content"/> </xsl:attribute> </img> </body> </html> </xsl:template></xsl:stylesheet>I have copied portal-impl.jar!/com/liferay/portlet/journal/dependencies/error.xsl to tomcat/weebapps/Root/WEB-INF/classes folder but have not changed anything because 2 things are not clear to me 1.) what to do with full path 2.) not geeting how to remove $companyId variable of the languageUtil:get method because what i can found is only $companyId variable.Can you shed some light on this? Please sign in to reply. Reply as... Cancel
Marc-Olivier Picard 11 Years Ago Not sure what ime doing wrong about this... my response data is always null.I tried return it in a json format in the RESOURCE_PHASE doing someting like { "jsonArray": $jsonArray } with no luck i removed it and tried with #set ($V = $jsonArray.put($jsonObject)) $jsonFactory.serialize($jsonArray)but still no luck. here is my call and alert that tells me the responseData is null.AUI().use( "aui-base", "aui-io-plugin", "aui-io-request", function(A) { A.io.request( "${request.resource-url}", { data: { }, dataType: "json", on: { success: function(event, id, obj) { alert(this.get('responseData')); }, failure: function(event, id, obj) { alert("ajax call failure "); } } } ); } );any thoughts? Please sign in to reply. Reply as... Cancel
truong mai 10 Years Ago Hi Ray, it's amazing topic. But I have a question: I always receive null object "hits" when running this web content. What is the problem? Please sign in to reply. Reply as... Cancel
Giannis Foufas 9 Years Ago Hello,Could you please provide an example in liferay 6.2? Thank you very much Please sign in to reply. Reply as... Cancel