portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r899666 - in /portals/jetspeed-2/portal/trunk: applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
Date Fri, 15 Jan 2010 15:37:02 GMT
Author: ate
Date: Fri Jan 15 15:37:02 2010
New Revision: 899666

URL: http://svn.apache.org/viewvc?rev=899666&view=rev
Log:
Also fix for UnsupportedOperationException on modification of User.userInfo map in Jetui

Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp?rev=899666&r1=899665&r2=899666&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
Fri Jan 15 15:37:02 2010
@@ -36,7 +36,12 @@
   Jetui jetui = (Jetui)request.getAttribute("jetui");
   PortalConfiguration pc = jetui.getPortalConfiguration();
   RequestContext rc = (RequestContext)request.getAttribute(RequestContext.REQUEST_PORTALENV);
-  Map userInfo = jetui.getUserAttributes(rc);
+  String userNameFamily = null;
+  String userNameGiven = null;
+  if (request.getUserPrincipal() != null) {
+    userNameFamily = jetui.getUserAttribute(rc,"user.name.family",request.getUserPrincipal().getName());
+    userNameGiven = jetui.getUserAttribute(rc,"user.name.given","");
+  }
   ContentPage portalPage = rc.getPage();
   ContentFragment maximized = (ContentFragment)request.getAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE);
   ColumnLayout columnLayout = (ColumnLayout)request.getAttribute("columnLayout");
@@ -127,7 +132,7 @@
 &nbsp;<% if (ltb != null) { %><span style='position: absolute; left: 0px; top:
42px;' id='jstbLeftToggle' class='<%=leftToggleClass%>'></span><% } if (rtb
!= null) { %><span id='jstbRightToggle' class='<%=rightToggleClass%>' style='position:
absolute; right: 0px; top: 42px;'></span><% } %>
 </div>
 <%if (request.getUserPrincipal() != null) {%>
-<span class="layout-statusarea"><b><%=userInfo.get("user.name.given")%>
<%=userInfo.get("user.name.family")%></b> | Profile | Tasks (5) | Notifications
(2) | <a href="<%=request.getContextPath()%>/login/logout?org.apache.jetspeed.login.destination=<%=request.getContextPath()%>/ui">Log
out</a></span>
+<span class="layout-statusarea"><b><%=userNameGiven%> <%=userNameFamily%></b>
| Profile | Tasks (5) | Notifications (2) | <a href="<%=request.getContextPath()%>/login/logout?org.apache.jetspeed.login.destination=<%=request.getContextPath()%>/ui">Log
out</a></span>
 <% } %>
 <!-- <span class="layout-search"><input type='text' size='14'/></span><span
class="layout-search2"><img height='18' src="<%=request.getContextPath()%>/images/search.png"/></span>
 -->
 </div> <!-- end header -->

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java?rev=899666&r1=899665&r2=899666&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
Fri Jan 15 15:37:02 2010
@@ -226,22 +226,27 @@
         }
     }
  
-    public Map getUserAttributes(RequestContext rc)
+    public Map<String,String> getUserAttributes(RequestContext rc)
     {
-        Map map = null;
+        Map<String,String> map = null;
         Principal principal = rc.getRequest().getUserPrincipal();
         if (principal instanceof UserSubjectPrincipal)
         {
             UserSubjectPrincipal jp = (UserSubjectPrincipal)principal;
             map = jp.getUser().getInfoMap();
-            if (map.get("user.name.given") == null)
-                map.put("user.name.given", "");
-            if (map.get("user.name.family") == null)
-                map.put("user.name.family", jp.getName());            
         }
         return map;
     }
     
+    public String getUserAttribute(RequestContext rc, String attributeName, String defaultValue)
+    {
+        Map<String,String> infoMap = getUserAttributes(rc);
+        String value = infoMap != null ? infoMap.get(attributeName) : null;
+        return value != null ? value : defaultValue;
+    }
+
+    
+    
     public PortalConfiguration getPortalConfiguration()
     {
         return this.pc;



---------------------------------------------------------------------
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