Author: thomas.heute(a)jboss.com
Date: 2010-04-01 08:44:40 -0400 (Thu, 01 Apr 2010)
New Revision: 2452
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
JBEPP-218: Skin selection isn't persisted
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2010-04-01
12:02:56 UTC (rev 2451)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2010-04-01
12:44:40 UTC (rev 2452)
@@ -23,6 +23,9 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.services.organization.OrganizationService;
+import org.exoplatform.services.organization.UserProfile;
+import org.exoplatform.services.organization.UserProfileHandler;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
@@ -107,6 +110,17 @@
if (skin == null || skin.trim().length() < 1)
return;
uiApp.setSkin(skin);
+ String remoteUser = event.getRequestContext().getRemoteUser();
+
+ //Save the skin selection to the User Profile
+ OrganizationService orgService =
event.getSource().getApplicationComponent(OrganizationService.class);
+ if (remoteUser != null)
+ {
+ UserProfile userProfile =
orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
+ userProfile.getUserInfoMap().put("user.skin", skin);
+ UserProfileHandler hanlder = orgService.getUserProfileHandler();
+ hanlder.saveUserProfile(userProfile, true);
+ }
}
}
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-04-01
12:02:56 UTC (rev 2451)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-04-01
12:44:40 UTC (rev 2452)
@@ -148,12 +148,15 @@
OrganizationService orgService =
getApplicationComponent(OrganizationService.class);
LocaleConfig localeConfig =
localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
String user = context.getRemoteUser();
+ String portalSkin = null;
+
if (user != null)
{
UserProfile userProfile =
orgService.getUserProfileHandler().findUserProfileByName(user);
if (userProfile != null)
{
portalLanguage =
userProfile.getUserInfoMap().get("user.language");
+ portalSkin = userProfile.getUserInfoMap().get("user.skin");
}
else
{
@@ -183,9 +186,18 @@
addWorkingWorkspace();
- String currentSkin = userPortalConfig_.getPortalConfig().getSkin();
- if (currentSkin != null && currentSkin.trim().length() > 0)
- skin_ = currentSkin;
+ // use the skin from the user profile if available, otherwise use from the portal
config
+ if (portalSkin != null && portalSkin.trim().length() > 0)
+ {
+ skin_ = portalSkin;
+ }
+ else
+ {
+ String userPortalConfigSkin = userPortalConfig_.getPortalConfig().getSkin();
+ if (userPortalConfigSkin != null && userPortalConfigSkin.trim().length()
> 0)
+ skin_ = userPortalConfigSkin;
+ }
+
setOwner(context.getPortalOwner());
//Minh Hoang TO: Localizes navigations, need to put this code snippet below
'setLocale' block
Show replies by date