Author: trong.tran
Date: 2010-06-08 23:14:12 -0400 (Tue, 08 Jun 2010)
New Revision: 3260
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/Constants.java
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/util/
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/mock/
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
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:
Clean up and improve a little code
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/Constants.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/Constants.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/Constants.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.portal;
+
+/**
+ * @author <a href="trong.tran(a)exoplatform.com">Trong Tran</a>
+ * @version $Revision$
+ */
+
+public class Constants
+{
+ public static final String USER_LANGUAGE = "user.language";
+
+ public static final String USER_SKIN = "user.skin";
+
+ public static final String PORTAL_WINDOW_STATE = "portal:windowState";
+
+ public static final String PORTAL_PORTLET_MODE = "portal:portletMode";
+}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -20,6 +20,7 @@
package org.exoplatform.organization.webui.component;
import org.exoplatform.commons.serialization.api.annotations.Serialized;
+import org.exoplatform.portal.Constants;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
@@ -123,7 +124,7 @@
{
UserProfileHandler hanlder = service.getUserProfileHandler();
UserProfile userProfile =
hanlder.findUserProfileByName(event.getRequestContext().getRemoteUser());
- String language = userProfile.getAttribute("user.language");
+ String language = userProfile.getAttribute(Constants.USER_LANGUAGE);
UIPortalApplication uiApp = Util.getUIPortalApplication();
if (language == null || language.trim().length() < 1)
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -137,8 +137,6 @@
if (onchange_ != null)
{
UIForm uiForm = getAncestorOfType(UIForm.class);
- //TODO TrongTT: The onchange don't affect in IE.
- // w.append("
onchange=\"").append(renderOnChangeEvent(uiForm)).append("\"");
w.append("
onclick=\"").append(renderOnChangeEvent(uiForm)).append("\"");
}
if (checked)
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
===================================================================
---
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.organization;
import org.exoplatform.commons.serialization.api.annotations.Serialized;
+import org.exoplatform.portal.Constants;
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.UserProfile;
import org.exoplatform.services.organization.UserProfileHandler;
@@ -106,7 +107,7 @@
set.addUIFormInput(genderSelectBox);
continue;
}
- else if (key.equalsIgnoreCase("user.language"))
+ else if (key.equalsIgnoreCase(Constants.USER_LANGUAGE))
{
UIFormSelectBox langSelectBox = new UIFormSelectBox(key, key, null);
set.addUIFormInput(langSelectBox);
@@ -123,7 +124,7 @@
@Override
public void processRender(WebuiRequestContext context) throws Exception
{
- UIFormSelectBox langSelectBox = this.findComponentById("user.language");
+ UIFormSelectBox langSelectBox = this.findComponentById(Constants.USER_LANGUAGE);
initLanguageCombo(langSelectBox);
super.processRender(context);
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.webui.application;
+import org.exoplatform.portal.Constants;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.exoplatform.portal.webui.page.UIPage;
@@ -709,8 +710,7 @@
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
pcontext.setFullRender(true);
- String windowState =
event.getRequestContext().getRequestParameter("portal:windowState");
- //TODO TrongTT: We should use only parameter for change WindowState
+ String windowState =
event.getRequestContext().getRequestParameter(Constants.PORTAL_WINDOW_STATE);
if (windowState == null)
{
windowState =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID).trim();
@@ -773,8 +773,7 @@
public void execute(Event<UIPortlet> event) throws Exception
{
UIPortlet uiPortlet = event.getSource();
- String portletMode =
event.getRequestContext().getRequestParameter("portal:portletMode");
- //TODO TrongTT: We should use only parameter for change PortletMode
+ String portletMode =
event.getRequestContext().getRequestParameter(Constants.PORTAL_PORTLET_MODE);
if (portletMode == null)
{
portletMode =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -92,7 +92,7 @@
return;
}
- String portletMode =
context.getRequestParameter("portal:portletMode");
+ String portletMode =
context.getRequestParameter(org.exoplatform.portal.Constants.PORTAL_PORTLET_MODE);
if (portletMode != null)
{
Event<UIComponent> event =
uicomponent.createEvent("ChangePortletMode", Event.Phase.PROCESS, context);
@@ -100,7 +100,7 @@
event.broadcast();
}
- String windowState =
context.getRequestParameter("portal:windowState");
+ String windowState =
context.getRequestParameter(org.exoplatform.portal.Constants.PORTAL_WINDOW_STATE);
if (windowState != null)
{
Event<UIComponent> event =
uicomponent.createEvent("ChangeWindowState", Event.Phase.PROCESS, context);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.webui.portal;
+import org.exoplatform.portal.Constants;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -137,7 +138,7 @@
if (remoteUser != null)
{
UserProfile userProfile =
orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
- userProfile.getUserInfoMap().put("user.language", language);
+ userProfile.getUserInfoMap().put(Constants.USER_LANGUAGE, language);
UserProfileHandler hanlder = orgService.getUserProfileHandler();
hanlder.saveUserProfile(userProfile, true);
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.webui.portal;
+import org.exoplatform.portal.Constants;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.StaleModelException;
@@ -222,7 +223,7 @@
String portalAppLanguage = uiPortalApp.getLocale().getLanguage();
OrganizationService orgService =
getApplicationComponent(OrganizationService.class);
UserProfile userProfile =
orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
- String userLanguage = userProfile.getUserInfoMap().get("user.language");
+ String userLanguage = userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE);
String browserLanguage = prContext.getRequest().getLocale().getLanguage();
// in case: edit current portal, set skin and language for uiPortalApp
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-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.webui.portal;
+import org.exoplatform.portal.Constants;
import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
@@ -117,7 +118,7 @@
if (remoteUser != null)
{
UserProfile userProfile =
orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
- userProfile.getUserInfoMap().put("user.skin", skin);
+ userProfile.getUserInfoMap().put(Constants.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-06-09
03:02:29 UTC (rev 3259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-06-09
03:14:12 UTC (rev 3260)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.webui.workspace;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.portal.Constants;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.NoSuchDataException;
@@ -155,8 +156,8 @@
UserProfile userProfile =
orgService.getUserProfileHandler().findUserProfileByName(user);
if (userProfile != null)
{
- portalLanguage =
userProfile.getUserInfoMap().get("user.language");
- portalSkin = userProfile.getUserInfoMap().get("user.skin");
+ portalLanguage = userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE);
+ portalSkin = userProfile.getUserInfoMap().get(Constants.USER_SKIN);
}
else
{