Tuesday, December 23, 2014

Custom Taglib in Liferay 6.2


Hi! This is the example of a custom tag created inside a portlet plugin in Liferay 6.2. To create a custom taglib in Liferay is fairly easy, so let's start!




0 Read More »

Sunday, November 16, 2014

Access multiple Datasources in Liferay 6.2


In this post I’ll show you how to use, in a Service Builder Portlet, an alternative datasource. By example, lets supose that we have two entities: one stored in the same schema than the liferay portal and another one which will be in a diferent database.





3 Read More »

Saturday, November 8, 2014

jQuery autocomplete in Liferay 6.2

Hi! today I'll show how to use the jQuery autocomplete functionality in Liferay 6.2.

The result will be shown on a page with an autocomplete input for books titles under what I'll show a search-container with the possible books to be found.



0 Read More »

WebGL animation inside a Liferay 6.2 popup

Hello, here is my second post, where a 3D animation is shown inside a Liferay 6.2 popup.


WebGL is a Javascript API for rendering interactive graphics within any compatible web browser without installing any additional plug-in. WebGL is completely integrated into all the web standards allowing the rendering of GPU accelerated 3D effects as a part of a web page canvas. WebGL elements can be mixed with other HTML elements, so it can be perfectly used inside a Liferay popup. WebGL programs consist of control code written in Javascript and shader code that is executed on a computer's Graphics Processing Unit (GPU).

0 Read More »

Sunday, October 26, 2014

Sample popup in Liferay 6.2 with close button

Hello! To start with this blog I will publish the code for a liferay 6.2 popup.

Liferay 6.2 uses the new AUI 2.0 version. When this versión of Liferay was developed some AUI old modules became deprecated.





The following is sample code for a Liferay 6.2 popup with a close button.

Portlet view jsp code:

<aui:script>

function showPopup() {
AUI().use( 'aui-io',
'aui-dialog',
function(A) {

Liferay.Util.openWindow(
           {
                dialog: {
                   centered: true,
     destroyOnClose: true,
                    cache: false,
                    width: 500,
                   height: 300,
                    modal: true
               },
               title: 'Sample Popup',
                   id:'<portlet:namespace/>popUpDialog',            
               uri:'<%=dialogUrl.toString()%>'
            });
           
           
            Liferay.provide(
                   window,
                   '<portlet:namespace/>closePopup',
                   function(popupIdToClose) {
                   var popupDialog = Liferay.Util.Window.getById(popupIdToClose);
                   popupDialog.destroy();
                   },
                   ['liferay-util-window']
              );

});
}



</aui:script>

<div>
<h1>AUI Popup</h1><br/>
<aui:button id="dialogButton" value="Show popup" onClick="showPopup();"> </aui:button>
</div>


Popup jsp code:


<portlet:actionURL name="helloFunction" var="helloFunctionUrl">
<portlet:param name="mvcPath" value="/popup.jsp"/>
</portlet:actionURL>


<aui:script>
    function closeThis(){
        Liferay.Util.getOpener().<portlet:namespace />closePopup('<portlet:namespace />popUpDialog');
    }
</aui:script>


<form name="<portlet:namespace/>fm" action="<%=helloFunctionUrl%>" method="post">

<h1>Sample popup</h1>

<aui:button type="submit" value="Call function" />
<aui:button name="close" value="close" onClick="closeThis();"/>

 </form>


Portlet class code:

public class SimplePortlet extends MVCPortlet{

@Override
public void init() throws PortletException {
super.init();

copyRequestParameters = true;
}

public void helloFunction(ActionRequest actionRequest, ActionResponse actionResponse)throws Exception {
 System.out.println("Hello!!");
   }

}

2 Read More »