Search This Blog

Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Friday, October 18, 2013

To make JSP compatible with IE8 or IE 9

Add the following code to the javascript block.

#if ($browserSniffer.getMajorVersion($request) < 9)
  <meta http-equiv="X-UA-Compatible" content="IE=8" />
#else
  <meta http-equiv="X-UA-Compatible" content="IE=9" />
#end

this will make the jsp compatible with IE 8 or IE 9

Happy Coding !!

 

Friday, July 19, 2013

Running liferay script on control Panel Script console

Liferay has a script console at the Control Panel. It is accessible to the Liferay administrator. In the Script console Liferay API code , and other various code can be run seamlessly.

The script console is located at

ContolPanel --> Server --> Server Administration. 






 Here are few examples of codes run in the console and screenshot of the output. Most of the  codes were run here by selecting the Language as "Groovy".

Example 1.  Get list of users

Language : Groovy
code:

import com.liferay.portal.service.UserLocalServiceUtil;

userCount = UserLocalServiceUtil.getUsersCount();
users = UserLocalServiceUtil.getUsers(0, userCount);
count=0;
for (user in users) {
    count++;
    println(count+". User: " + user.getFullName());

}





































Example 2.  Get list of roles supported be the portal.


Language : Groovy
code:

import com.liferay.portal.service.RoleLocalServiceUtil;

roleCount =RoleLocalServiceUtil.getRolesCount();
roles=RoleLocalServiceUtil.getRoles(0,roleCount );

for(role in roles){
    println("Role Name: " + role.getName());
}




Example 3.  Get number of users in the portal . (using Javascript as language default script)
Language : Javascript
code:

number = Packages.com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();

out.println(number);



My Blog List