blog.jesinger.net Liferay and more

7Nov/101

Custom Portlet Modes in Liferay 5.2.3

This post will show you how you can integrate the feature of using Custom Portlet Modes in your Liferay 5.2.3 - Portal. I realized this as part of my Bachelor Thesis at University of Applied Sciences Weingarten.

Custom Portlet Modes are not supported by Liferay Portal because this part is optional in the Portlet Standard (JSR-168 and JSR-286). So the Liferay guys just did not implement it.
It took me quite some time to get it done but finally it worked!! My Liferay portal now supports custom portlet modes.

After you modified your Liferay, your portlets will be able to use custom portlet modes according to the portlet standard! This is a pretty cool feature which a lot people are missing.

What you will need:

What you have to do:

1.) download the modified files and copy them into your EXT-Project at the correct positions

2.) modify your ext-spring.xml and add the following lines:
[code lang="xml"]

[/code]

3.) modify your portal-ext.properties and add the following line:

[code lang="ini"]
servlet.service.events.pre=com.liferay.portal.events.HRWServicePreAction
[/code]

With these modifications you will be able to run portlets that are using custom portlet modes.

To test your new functions and to give you an idea of how to use these modes, here is a Test portlet which uses a custom portlet mode. You can download the war file or the sources with the included Eclipse project. Your choice!

If something does not work properly, please let me know. Comments are highly appreciated! 🙂
Maybe this works with Liferay 6 too, but i have not tested it yet. Maybe someone could do this and let me know if it works too!

Have fun!

24Jul/100

How you integrate a new jQuery version into Liferay Portal

Here I will show you how you can integrate the lates jQuery version into your Liferay Portal (version 5.2.3 but should also work with 6.x). I will do this with jQuery version 1.3.2 (I know, that's not the latest atm) but it will work straight forward with any other version.

What you will need:

  • the jQuery version you want to add to your liferay (here i will use 'jquery1.3.2.js')
  • the plugins you want to use with your new jQuery version (here 'ui.jquery1.7.js' and 'ui.stars.js')
  • your Liferay-EXT Environment
  • One file from the Liferay Source Code (top_head.jsp)

Ok, let's start:

- Copy the file "top_head.jsp" located in folder "liferay-portal-src-[version]\portal-web\docroot\html\common\themes\" into the EXT-folder 'liferay[version]-portal-ext\ext-web\docroot\html\common\themes\'

- Open the copied file in your EXT

- Go to line 125, just above this: <%-- Portal JavaScript References --%>

- Add the following lines:
[code lang="javascript"]




[/code]
- Now you can access jQuery 1.3.2 through the variable 'jQuery132'.

- Have fun with the new version! 🙂

This does not affect the original jQuery variable in your Liferay Portal!
And you can have as many jQuery versions in your Liferay portal as you want!
Just add them this way and give the variables different names.