Wednesday, November 18, 2009

Import the lar file for the guest community.

Enable the below property in portal-ext.properties to import the lar file for the guest community.

#
# Specify a LAR file that can be used to create the guest public layouts.
# If this property is set, the previous layout properties will be ignored.
#
default.guest.public.layouts.lar=${liferay.home}/deploy/default_guest_public.lar

SignOut Message in .vm File

Step: 1
Add the below lines in LogoutAction.java
after session.invalidate();
HttpSession logoutSession = request.getSession();
logoutSession.setAttribute("logoutSession", logoutSession);


Step: 2

create EXTServicePreAction.java under (com.liferay.portal.events.EXTServicePreAction.java )


EXTServicePreAction.java

package com.liferay.portal.events;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.liferay.portal.kernel.events.Action;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.util.WebKeys;

public class EXTServicePreAction extends Action {


public void run(HttpServletRequest req, HttpServletResponse res)
throws ActionException {
Map vmVariables = new HashMap();
HttpSession session = req.getSession();
HttpSession logoutSession = null;
logoutSession = (HttpSession)session.getAttribute("logoutSession");

try {
if(Validator.isNotNull(logoutSession)){
logoutSession.setAttribute("flag", true);
}else{
logoutSession = req.getSession();
logoutSession.setAttribute("flag", false);
}
} catch (Exception ex) {
Logger.getLogger(EXTServicePreAction.class.getName()).log(Level.SEVERE, null, ex);
}
vmVariables.put("logoutSession", logoutSession);

req.setAttribute(WebKeys.VM_VARIABLES, vmVariables);
}
}

step: 3
Add the below line in portal-ext.properties

servlet.service.events.pre=com.liferay.portal.events.ServicePreAction,com.liferay.portal.events.EXTServicePreAction



step: 4

Add the below line in portal_normal.vm

#if ($logoutSession.getAttribute("flag"))
<div>
<b>Successfully Logout</b>
$logoutSession.invalidate()
</div>
#end