Saturday, June 28, 2014

Changes from Liferay 6.1 to 6.2

  • ThemeSetting:
In liferay-look-and-feel .xml:
<setting configurable="true" key="header-banner" type="textarea" value=""/>

In portal_normal.vm:
#set($bg_header = $theme_display.getThemeSetting("header-banner"))

In this case, we use $theme_display.getThemeSetting(key)  instead of $theme.getSetting(key)

  • Ajax using AUI:
AUI().use('node','aui-base','aui-io-request', function(A) {
        var groupId = A.one('#' + namespace + "groupId").get("value");
        A.io.request(ajaxPageLayoutUrl, {
            dataType : 'json',
            data : {
                <portlet:namespace/>groupId: groupId
            },
            on : {
                success : function() {
                    var data = this.get('responseData');
                    for(var i = 0; i < data.length; i++) {
                        var page = data[i];
                        var selected = page.plid == curPageSelected ? "selected" : "";
                        var newOption = A.Node.create('<option value="' + page.plid + '"' + selected + '>'+ page.title +'</option>');
                        A.one('#' + namespace + "plid").appendChild(newOption);
                    }
                }
            }
        });
    });

Friday, June 27, 2014

Accessing Service and Util in Application Display Template



See: (in content and comment)

1. http://liferaytrends.blogspot.com/2012/05/access-liferay-service-util-and-custom.html

2. http://stackoverflow.com/questions/12106827/liferay-obtain-filesize-in-template

Sunday, June 22, 2014

Using Application Display Template in (ADT) Liferay 6.2

If you want to get portlet title in ADT, using this code snippets:

#set ($portletTitle = $themeDisplay.getPortletDisplay().getTitle())

If you want to use localization, using code like this:

$languageUtil.get($locale, "read-more")