portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r695645 - in /portals/jetspeed-2/applications/j2-admin/trunk/src: main/java/org/apache/jetspeed/portlets/localeselector/ main/java/org/apache/jetspeed/portlets/localeselector/resources/ webapp/WEB-INF/view/ webapp/images/
Date Mon, 15 Sep 2008 21:44:56 GMT
Author: vkumar
Date: Mon Sep 15 14:44:55 2008
New Revision: 695645

URL: http://svn.apache.org/viewvc?rev=695645&view=rev
Log:
Making Locale Selector based of flags for simplifying the user interface

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/de.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/en.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/es.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/fr.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/hu.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/it.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ja.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ko.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/nl.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pl.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pt.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ru.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/sv.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh.gif   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh_TW.gif   (with props)
Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/locale-list.jsp

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java?rev=695645&r1=695644&r2=695645&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
Mon Sep 15 14:44:55 2008
@@ -18,7 +18,6 @@
 
 import java.io.IOException;
 import java.util.Locale;
-import java.util.prefs.Preferences;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -34,7 +33,7 @@
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.SecurityAttributes;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.util.JetspeedLocale;
@@ -47,7 +46,7 @@
  */
 public class LocaleSelectorPortlet extends GenericPortlet
 {
-    public static final String PREFERED_LOCALE_SESSION_KEY = "org.apache.jetspeed.prefered.locale";
+    public static final String PREFERED_LOCALE_SESSION_KEY = "prefered_locale";
 
     private UserManager userManager;
     
@@ -121,11 +120,10 @@
                 {
                     User user = userManager.getUser(request.getRemoteUser());
                     // TODO if preferred lang or locale is defined in PLT.D, it's better
to use it
-                    Preferences prefs = user.getPreferences();
-                    prefs.put(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, JetspeedLocale
-                            .convertLocaleToString(preferedLocale));
+                    SecurityAttributes secAttrs = user.getSecurityAttributes();
+                    secAttrs.getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE,
true).setStringValue(JetspeedLocale.convertLocaleToString(preferedLocale));
                 }
-                catch (SecurityException e)
+                catch (Exception e)
                 {
                     // TODO Auto-generated catch block
                     e.printStackTrace();

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties?rev=695645&r1=695644&r2=695645&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties
Mon Sep 15 14:44:55 2008
@@ -18,7 +18,7 @@
 
 # Base Locales
 # DO NOT TRANSLATE & DO NOT INCLUDE IN L10N PROPERTIES FILE
-localeselector.locales=de,en,es,fr,hu,it,ja,ko,nl,pl,pt,ru,sv,zh,zh_TW
+localeselector.locales=hu,de,en,es,fr,hu,it,ja,ko,nl,pl,pt,ru,sv,zh,zh_TW
 
 # Label
 localeselector.label.language=Language:

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/locale-list.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/locale-list.jsp?rev=695645&r1=695644&r2=695645&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/locale-list.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/locale-list.jsp
Mon Sep 15 14:44:55 2008
@@ -21,24 +21,26 @@
 
 <portlet:actionURL var="changeLocaleAction">
 </portlet:actionURL>
-
-<form action="<%=changeLocaleAction%>" method="POST">
+<script>
+function setLanguage(lang)
+{
+	document.langChng.prefered_locale.value=lang;
+	document.langChng.submit();
+}
+</script>
+<form name="langChng" action="<%=changeLocaleAction%>" method="POST">
 <table border="0">
 	<tr>
-		<td align="right"><fmt:message key="localeselector.label.language"/></td>
-		<td align="left">
-			<select name="org.apache.jetspeed.prefered.locale">
-				<c:set var="locales"><fmt:message key="localeselector.locales"/></c:set>
-				<c:forTokens var="l" items="${locales}" delims=",">
-				<option value="<c:out value="${l}"/>"
-					<c:if test="${currentLocale == l}">selected</c:if>
-				><fmt:message>localeselector.locale.<c:out value="${l}"/></fmt:message></option>
-				</c:forTokens>
-			</select>
-		</td>
+		<td align="left"><fmt:message key="localeselector.label.language"/></td>
 	</tr>
 	<tr>
-		<td align="center" colspan="2"><input type="submit" value="<fmt:message key="localeselector.label.change"/>"/></td>
+		<td align="left">
+			<c:set var="locales"><fmt:message key="localeselector.locales"/></c:set>
+			<c:forTokens var="l" items="${locales}" delims=",">
+				<a href="javascript:setLanguage('<c:out value="${l}"/>')" title="<fmt:message
key="localeselector.locale.${l}"/>""><img border="0" src="<%=request.getContextPath()%><c:out
value="/images/${l}.gif"/>" /></a>
+			</c:forTokens>
+		</td>
 	</tr>
 </table>
+<input type="hidden" name="prefered_locale" value=""/>
 </form>

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/de.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/de.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/de.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/en.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/en.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/en.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/es.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/es.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/es.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/fr.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/fr.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/fr.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/hu.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/hu.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/hu.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/it.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/it.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/it.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ja.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ja.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ja.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ko.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ko.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ko.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/nl.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/nl.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/nl.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pl.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pl.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pl.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pt.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pt.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/pt.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ru.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ru.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/ru.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/sv.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/sv.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/sv.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh_TW.gif
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh_TW.gif?rev=695645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/zh_TW.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message