tags:

views:

11

answers:

0

hi,

I need to change the theme (let's say default theme = classic) to the iphone theme (or whatever) when the user has navigated to the liferay portal using a mobile device.

I thought to go about it like this:
- create a hook to gets triggered on a user login event
- check for the device using the User-Agent request header attribute
- if required, set the theme to iphone using LayoutServiceUtil

Probably there is a better approach to implement such a requirement so feel free to offer alternatives.

I'm quite new to liferay so that is probably the reason I could not get this to work.

a. First of all I'm very confused about how themes are handled in liferay; there seem to be various related model objects which are hard to distinguish: Theme, ThemeDisplay, Layout, LayoutSet, ColorScheme, ... . Can someone explain this or know where this is explained?

b. apparently you need to get the ThemeDisplay from the request in order to set a theme on it. However, when the user logs in, the theme attribute (THEME_DISPLAY) has not been set yet (neither in the pre nor post event; it is set when I check during a logout event). Setting the theme during login is an absolute minimum, I was actually hoping I could set the theme before the user logs in but since the attribute is not even known after user logs in...

c. when using LayoutServiceUtil.updateLookAndFeel, you need to give the groupId, themeId, colorSchemeId, css, ... . I was expecting it would be simply telling liferay which theme (name) to use no matter what groupId, ... . Is this not possible?

thanks a lot for any help,
Stijn

P.S. I'm using liferay 6.0.5.