Merged V2.2 to HEAD

8121: Merged V2.1 to V2.2
      8088: Turned off debug logging.
      8090: Tweaked session cache limiting for AVM.
      8095: Fix for issue raised in ACT 402
      8108: Fix for AWC-1816
      8115: Build fix 
      8117: Fix AR-1217: OpenOffice connection is actively maintained

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8480 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-03-10 15:22:43 +00:00
parent 086838b020
commit c560aef6bd
7 changed files with 210 additions and 94 deletions

View File

@@ -34,7 +34,6 @@ import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.service.cmr.ml.MultilingualContentService;
@@ -58,8 +57,8 @@ public class UserPreferencesBean implements Serializable
private static final long serialVersionUID = -1262481849503163054L;
private static final String PREF_STARTLOCATION = "start-location";
private static final String PREF_CONTENTFILTERLANGUAGE = "content-filter-language";
public static final String PREF_INTERFACELANGUAGE = "interface-language";
/**
* Remplacement message for set the filter at 'all languages'.
@@ -67,9 +66,6 @@ public class UserPreferencesBean implements Serializable
*/
public static final String MSG_CONTENTALLLANGUAGES = "content_all_languages";
/** language locale selection */
private String language = null;
/** content language locale selection */
private String contentFilterLanguage = null;
@@ -87,48 +83,31 @@ public class UserPreferencesBean implements Serializable
*/
public SelectItem[] getLanguages()
{
// Get the item selection list
SelectItem[] items = getLanguageItems();
// Change the current language
if (this.language == null)
{
// first try to get the language that the current user is using
Locale lastLocale = Application.getLanguage(FacesContext.getCurrentInstance());
if (lastLocale != null)
{
this.language = lastLocale.toString();
}
// else we default to the first item in the list
else if (items.length > 0)
{
this.language = (String) items[0].getValue();
}
else
{
throw new AlfrescoRuntimeException("The language list is empty");
}
}
return items;
// Get the item selection list for the list of languages
return getLanguageItems();
}
/**
* @return Returns the language selection.
* @return Returns the language selection for the current user session.
*/
public String getLanguage()
{
return this.language;
return Application.getLanguage(FacesContext.getCurrentInstance()).toString();
}
/**
* @param language The language selection to set.
*/
public void setLanguage(String language)
{
this.language = language;
// set the language for the current session
Application.setLanguage(FacesContext.getCurrentInstance(), language);
// Set the current locale in the server
I18NUtil.setLocale(I18NUtil.parseLocale(language));
// save user preference
if (Application.getCurrentUser(FacesContext.getCurrentInstance()) != null)
{
PreferencesService.getPreferences().setValue(PREF_INTERFACELANGUAGE, language);
}
}
/**