Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-3244 The popup messages are not localized properly
Browse files Browse the repository at this point in the history
  • Loading branch information
trongtt committed Aug 27, 2013
1 parent 2530a67 commit aaaa855
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Expand Up @@ -31,6 +31,7 @@
import org.exoplatform.services.organization.UserProfileHandler;
import org.exoplatform.services.resources.LocaleConfig;
import org.exoplatform.services.resources.LocaleConfigService;
import org.exoplatform.web.application.AbstractApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
Expand All @@ -45,6 +46,8 @@
import org.exoplatform.webui.organization.UIUserMembershipSelector;
import org.exoplatform.webui.organization.UIUserProfileInputSet;

import java.util.ResourceBundle;

/** Created by The eXo Platform SARL Author : chungnv nguyenchung136@yahoo.com Jun 23, 2006 10:07:15 AM */
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UIUserInfo.SaveActionListener.class, csrfCheck = true),
Expand Down Expand Up @@ -129,9 +132,22 @@ public void execute(Event<UIUserInfo> event) throws Exception {
PortalRequestContext prqCtx = Util.getPortalRequestContext();
prqCtx.setLocale(localeConfig.getLocale());

// GTNPORTAL-3244: A workaround to update localization in the popup messages
ResourceBundle bundle = Util.getPortalRequestContext().getApplication().getResourceBundle(localeConfig.getLocale());
for(AbstractApplicationMessage message : uiApp.getUIPopupMessages().getErrors()) {
message.setResourceBundle(bundle);
}
for(AbstractApplicationMessage message : uiApp.getUIPopupMessages().getWarnings()) {
message.setResourceBundle(bundle);
}
for(AbstractApplicationMessage message : uiApp.getUIPopupMessages().getInfos()) {
message.setResourceBundle(bundle);
}

Util.getPortalRequestContext().addUIComponentToUpdateByAjax(
uiApp.findFirstComponentOfType(UIWorkingWorkspace.class));
Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);

}
}

Expand Down
Expand Up @@ -65,8 +65,6 @@
@Serialized
public class UIUserProfileInputSet extends UIFormInputSet {

private String user_;

public static final String MALE = "male";

public static final String FEMALE = "female";
Expand Down Expand Up @@ -220,7 +218,6 @@ private String[] getSocialInfoKeys() {

@SuppressWarnings("deprecation")
public void setUserProfile(String user) throws Exception {
user_ = user;
if (user == null)
return;
OrganizationService service = getApplicationComponent(OrganizationService.class);
Expand All @@ -243,13 +240,12 @@ public void setUserProfile(String user) throws Exception {

@SuppressWarnings("deprecation")
public boolean save(OrganizationService service, String user, boolean isnewUser) throws Exception {
user_ = user;
UserProfileHandler hanlder = service.getUserProfileHandler();
UserProfile userProfile = hanlder.findUserProfileByName(user_);
UserProfile userProfile = hanlder.findUserProfileByName(user);

if (userProfile == null) {
userProfile = hanlder.createUserProfileInstance();
userProfile.setUserName(user_);
userProfile.setUserName(user);
}

for (UIComponent set : getChildren()) {
Expand Down Expand Up @@ -277,7 +273,7 @@ public boolean save(OrganizationService service, String user, boolean isnewUser)
}
}

Object[] args = { "UserProfile", user_ };
Object[] args = { "UserProfile", user };
if (isnewUser) {
uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.successful.create.user", args));
return true;
Expand Down

0 comments on commit aaaa855

Please sign in to comment.