[gatein-commits] gatein SVN: r2402 - in portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui: workspace and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Mar 30 17:32:46 EDT 2010


Author: mwringe
Date: 2010-03-30 17:32:46 -0400 (Tue, 30 Mar 2010)
New Revision: 2402

Modified:
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTNPORTAL-634: store the portal skin as a user preference so that skin selection persists between logins.

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java	2010-03-30 19:49:21 UTC (rev 2401)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java	2010-03-30 21:32:46 UTC (rev 2402)
@@ -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/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java	2010-03-30 19:49:21 UTC (rev 2401)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java	2010-03-30 21:32:46 UTC (rev 2402)
@@ -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



More information about the gatein-commits mailing list