[seam-commits] Seam SVN: r8434 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/admin and 14 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat Jul 5 07:42:14 EDT 2008


Author: christian.bauer at jboss.com
Date: 2008-07-05 07:42:13 -0400 (Sat, 05 Jul 2008)
New Revision: 8434

Added:
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java
   trunk/examples/wiki/testbinaries/testimage_w40.jpg
   trunk/examples/wiki/testbinaries/testimage_w80.jpg
Modified:
   trunk/examples/wiki/src/etc/i18n/messages_en.properties
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
   trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
   trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml
   trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml
   trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml
   trunk/examples/wiki/view/includes/breadcrumb.xhtml
   trunk/examples/wiki/view/includes/commentsDisplay.xhtml
   trunk/examples/wiki/view/includes/mainMenuItem.xhtml
   trunk/examples/wiki/view/includes/onlineMembers.xhtml
   trunk/examples/wiki/view/includes/onlineUsers.xhtml
   trunk/examples/wiki/view/includes/userControl.xhtml
   trunk/examples/wiki/view/includes/userInfo.xhtml
   trunk/examples/wiki/view/themes/default/css/mainMenu.css
   trunk/examples/wiki/view/themes/default/css/template.css
   trunk/examples/wiki/view/themes/default/css/userControl.css
   trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
   trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
   trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
   trunk/examples/wiki/view/userProfile_d.xhtml
Log:
JBSEAM-2887, generate thumbnails of user portraits on upload, not on the fly

Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties	2008-07-05 11:42:13 UTC (rev 8434)
@@ -306,14 +306,13 @@
 
 lacewiki.label.userControl.Username=Username
 lacewiki.label.userControl.Password=Password
-lacewiki.button.userControl.Login=<u>L</u>ogin
-lacewiki.button.userControl.Login.accesskey=L
+lacewiki.button.userControl.Login=Login
 lacewiki.button.userControl.ResetPassword=Reset
 lacewiki.button.userControl.Register=<u>R</u>egister
 lacewiki.button.userControl.Register.accesskey=R
 lacewiki.button.userControl.Members=<u>M</u>embers
 lacewiki.button.userControl.Members.accesskey=M
-lacewiki.button.userControl.Logout=<u>L</u>ogout
+lacewiki.button.userControl.Logout=Logout
 lacewiki.button.userControl.Logout.accesskey=L
 lacewiki.button.userControl.Home=<u>H</u>ome
 lacewiki.button.userControl.Home.accesskey=H
@@ -468,6 +467,7 @@
 lacewiki.label.userList.OnlineMembers=Online Members
 lacewiki.label.userList.InTheLast=in the last
 lacewiki.label.userList.Minutes=minutes
+lacewiki.label.userList.Idle=Idle
 lacewiki.msg.userList.NoOnlineMembers=No members are currently online.
 lacewiki.label.userList.Online=Online
 lacewiki.label.userList.Of=of

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java	2008-07-05 11:42:13 UTC (rev 8434)
@@ -10,6 +10,7 @@
 import org.jboss.seam.wiki.core.model.User;
 import org.jboss.seam.wiki.core.model.Role;
 import org.jboss.seam.wiki.core.dao.UserDAO;
+import org.jboss.seam.wiki.util.WikiUtil;
 import org.jboss.seam.annotations.*;
 import org.jboss.seam.annotations.security.Restrict;
 import org.jboss.seam.log.Log;
@@ -42,7 +43,7 @@
 
     transient private Map<String, Boolean> selectedSessions = new HashMap<String,Boolean>();
     transient private Map<String, Long> sessionsSize = new HashMap<String,Long>();
-    transient private List<User> onlineMembers;
+    transient private List<OnlineUser> onlineMembers;
 
     @Restrict("#{s:hasPermission('User', 'isAdmin', currentUser)}")
     public Map<String, Boolean> getSelectedSessions() { return selectedSessions; }
@@ -149,44 +150,88 @@
     }
     */
 
-    public List<User> getOnlineMembers() {
-        if (onlineMembers == null) {
-            Set<String> onlineUsernames = new HashSet<String>();
-            Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
-            for (HttpSession session : sessions) {
-                Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
-                if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
-                    onlineUsernames.add( ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername() );
-                }
-            }
+    public long getTotalMembers() {
+        return userDAO.findTotalNoOfUsers();
+    }
 
-            // Need to load these guys, the are not in this persistence context
-            onlineMembers = userDAO.findUsersWithUsername(onlineUsernames);
-        }
+    public List<OnlineUser> getOnlineMembers() {
+        if (onlineMembers == null) loadOnlineMembers();
         return onlineMembers;
     }
 
-    public long getTotalMembers() {
-        return userDAO.findTotalNoOfUsers();
+    public long getNumberOfOnlineMembers() {
+        if (onlineMembers == null) loadOnlineMembers();
+        return onlineMembers.size();
     }
 
-    public long getNumberOfOnlineMembers() {
+    public long getNumberOfOnlineGuests() {
+        return WikiServletListener.getSessions().values().size() - getNumberOfOnlineMembers();
+    }
+
+    private void loadOnlineMembers() {
+        onlineMembers = new ArrayList<OnlineUser>();
+
+        // First get the usernames of members out of all sessions
+        Map<String,HttpSession> onlineUsernames = new HashMap<String, HttpSession>();
         Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
-
-        long loggedInUsers = 0l;
         for (HttpSession session : sessions) {
             Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
             if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
-                loggedInUsers++;
+                String username = ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername();
+
+                // Try to get the session with the smallest idle time
+                if (onlineUsernames.containsKey(username)) {
+                    if (session.getLastAccessedTime() > onlineUsernames.get(username).getLastAccessedTime()) {
+                        onlineUsernames.put(username, session);
+                    }
+                } else {
+                    onlineUsernames.put(username, session);
+                }
             }
         }
-        return loggedInUsers;
 
+        // Then load these guys into a current persistence context
+        List<User> userInstances = userDAO.findUsersWithUsername(onlineUsernames.keySet());
+
+        for (User userInstance : userInstances) {
+            // Now fill the OnlineUser DTO which is needed by the UI
+            onlineMembers.add(
+                new OnlineUser(
+                    userInstance,
+                    onlineUsernames.get(userInstance.getUsername()).getLastAccessedTime()
+                )
+            );
+        }
     }
-    
-    public long getNumberOfOnlineGuests() {
-        return WikiServletListener.getSessions().values().size() - getNumberOfOnlineMembers();
+
+    public static class OnlineUser {
+        private User user;
+        private long lastAccessedTime;
+
+        public OnlineUser(User user, long lastAccessedTime) {
+            this.user = user;
+            this.lastAccessedTime = lastAccessedTime;
+        }
+
+        public User getUser() {
+            return user;
+        }
+
+        public void setUser(User user) {
+            this.user = user;
+        }
+
+        public long getLastAccessedTime() {
+            return lastAccessedTime;
+        }
+
+        public void setLastAccessedTime(long lastAccessedTime) {
+            this.lastAccessedTime = lastAccessedTime;
+        }
+
+        public String getIdleTime() {
+            return WikiUtil.getTimeDifferenceToCurrent(WikiUtil.toDate(lastAccessedTime));
+        }
     }
-    
 
 }

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java	2008-07-05 11:42:13 UTC (rev 8434)
@@ -241,6 +241,9 @@
                 getInstance().getProfile().setImage(
                     WikiUtil.resizeImage(portrait.getData(), portrait.getContentType(), 80) // TODO: Make size configurable?
                 );
+                getInstance().getProfile().setSmallImage(
+                    WikiUtil.resizeImage(portrait.getData(), portrait.getContentType(), 40) // TODO: Make size configurable?
+                );
 
             } else {
                 statusMessages.addFromResourceBundleOrDefault(

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java	2008-07-05 11:42:13 UTC (rev 8434)
@@ -58,6 +58,12 @@
     @Column(name = "IMAGE_CONTENT_TYPE", nullable = true, length = 255)
     private String imageContentType;
 
+    // SchemaExport needs length.. MySQL has "tinyblob", "mediumblob" and other such nonsense types
+    @Lob
+    @Column(name = "SMALL_IMAGE_DATA", nullable = true, length = 200000)
+    @Basic(fetch = FetchType.LAZY) // Lazy loaded through bytecode instrumentation
+    private byte[] smallImage;
+
     public UserProfile() {}
 
     // Immutable properties
@@ -123,4 +129,12 @@
     public void setImageContentType(String imageContentType) {
         this.imageContentType = imageContentType;
     }
+
+    public byte[] getSmallImage() {
+        return smallImage;
+    }
+
+    public void setSmallImage(byte[] smallImage) {
+        this.smallImage = smallImage;
+    }
 }

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java	2008-07-05 11:42:13 UTC (rev 8434)
@@ -78,6 +78,18 @@
         return url.toString();
     }
 
+    public String renderUserPortraitURL(User user, boolean small) {
+        return renderUserPortraitURL(user, small, false);
+    }
+
+    public String renderUserPortraitURL(User user, boolean small, boolean usePrefsPath) {
+        if (user == null || user.getId() == null) return "";
+        StringBuilder url = new StringBuilder();
+        if (usePrefsPath) url.append(prefs.getBaseUrl());
+        url.append("/seam/resource/wikiUserPortrait/").append(user.getId()).append("/").append(small ? "s" : "l");
+        return url.toString();
+    }
+
     public String renderAggregateFeedURL(String aggregateId) {
         return renderAggregateFeedURL(aggregateId, false);
     }

Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java	                        (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java	2008-07-05 11:42:13 UTC (rev 8434)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.ui;
+
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import org.jboss.seam.web.AbstractResource;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.servlet.ContextualHttpServletRequest;
+import org.jboss.seam.wiki.core.dao.UserDAO;
+import org.jboss.seam.wiki.core.model.User;
+import org.jboss.seam.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+/**
+ * Serves user portraits from the database, so we don't have to use s:graphicImage anymore.
+ *
+ * This helps caching on the browser, as image URIs will be stable and not random keys into a current HttpSession.
+ *
+ * @author Christian Bauer
+ */
+ at Scope(APPLICATION)
+ at Name("wikiUserPortraitThemeResource")
+ at BypassInterceptors
+public class WikiUserPortraitResource extends AbstractResource {
+
+    // Resources URIs end with /<userId>/<l|s>
+    public static Pattern RESOURCE_PATTERN = Pattern.compile("^/([0-9]+)/([ls]{1})$");
+
+    public static final String REGISTER_SEAM_RESOURCE = "/wikiUserPortrait";
+
+    private Log log = Logging.getLog(WikiUserPortraitResource.class);
+
+    @Override
+    public String getResourcePath() {
+        return REGISTER_SEAM_RESOURCE;
+    }
+
+    @Override
+    public void getResource(final HttpServletRequest request, final HttpServletResponse response)
+            throws ServletException, IOException {
+
+        // Wrap this, we need an ApplicationContext
+        new ContextualHttpServletRequest(request) {
+            @Override
+            public void process() throws IOException {
+                doWork(request, response);
+            }
+        }.run();
+
+    }
+
+    public void doWork(HttpServletRequest request, HttpServletResponse response)
+            throws IOException {
+
+        String pathInfo = request.getPathInfo().substring(getResourcePath().length());
+
+        String userId = null;
+        String imageSize = null;
+        Matcher matcher = RESOURCE_PATTERN.matcher(pathInfo);
+        if (matcher.find()) {
+            userId = matcher.group(1);
+            imageSize = matcher.group(2);
+            log.debug("request for user id: " + userId + ", image size: " + imageSize);
+        }
+
+        if (userId == null || imageSize == null) {
+            response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid request path, use: /wikiUserPortrait/[0-9]+/(l|s)");
+            return;
+        }
+
+        UserDAO userDAO = (UserDAO) Component.getInstance(UserDAO.class);
+        User user = userDAO.findUser(Long.valueOf(userId));
+        if (user == null || user.getProfile().getImageContentType() == null) {
+            response.sendError(HttpServletResponse.SC_NOT_FOUND, "User id not found or no portrait for user");
+            return;
+        }
+
+        response.addHeader("Cache-Control", "max-age=600"); // 10 minutes freshness in browser cache
+
+        byte[] image = imageSize.equals("l") ? user.getProfile().getImage() : user.getProfile().getSmallImage();
+        response.setContentType(user.getProfile().getImageContentType());
+        response.setContentLength(image.length);
+        response.getOutputStream().write(image);
+        response.getOutputStream().flush();
+    }
+
+}

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java	2008-07-05 11:42:13 UTC (rev 8434)
@@ -254,7 +254,7 @@
 
         String formatName = "";
         if ("image/png".equals(contentType))       formatName = "png";
-        else if ("image/jpeg".equals(contentType)) formatName = "jpeg";
+        else if ("image/jpeg".equals(contentType) || "image/jpg".equals(contentType)) formatName = "jpeg";
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
         try {

Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -10,10 +10,12 @@
     <s:div styleClass="box">
 
         <s:div styleClass="boxHeader">
-            <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}
+            <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}"/>
+            <!-- TODO: make configurable
                                  #{messages['lacewiki.label.userList.InTheLast']}
                                  #{wikiInit.authenticatedSessionTimeoutMinutes}
                                  #{messages['lacewiki.label.userList.Minutes']}"/>
+            -->            
         </s:div>
 
         <div class="boxContent">

Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -45,10 +45,9 @@
                 <h:outputText value="#{messages['basic.userSummary.label.Portrait']}:"
                               rendered="#{!empty userHome.instance.profile.imageContentType}"/>
 
-                <s:graphicImage rendered="#{!empty userHome.instance.profile.imageContentType}"
-                                styleClass="userInfoPortraitImage" value="#{userHome.instance.profile.image}">
-                    <s:transformImageSize width="80" maintainRatio="true"/>
-                </s:graphicImage>
+                <h:graphicImage rendered="#{!empty userHome.instance.profile.imageContentType}"
+                                styleClass="userInfoPortraitImage"
+                                value="#{wikiURLRenderer.renderUserPortraitURL(userHome.instance, false)}"/>
 
                 <h:outputText value="#{messages['basic.userSummary.label.Bio']}:"
                               rendered="#{not empty userHome.instance.profile.bio}"/>

Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -118,9 +118,8 @@
             <s:fragment rendered="#{currentDocument.ownedByRegularUser and !empty currentDocument.createdBy.profile.imageContentType}">
                 <s:span styleClass="undecoratedLink">
                     <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(currentDocument.createdBy)}">
-                        <s:graphicImage styleClass="commentAuthorPortraitImage" value="#{currentDocument.createdBy.profile.image}">
-                            <s:transformImageSize width="30" maintainRatio="true"/>
-                        </s:graphicImage>
+                        <h:graphicImage styleClass="commentAuthorPortraitImage"
+                                        value="#{wikiURLRenderer.renderUserPortraitURL(currentDocument.createdBy, true)}"/>
                     </h:outputLink>
                 </s:span>
             </s:fragment>

Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -153,7 +153,8 @@
         LOCATION="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&#xA;&#xA;Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis."
         OCCUPATION="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&#xA;&#xA;Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum."
         SIGNATURE="My member signature&#xA;&#xA;Lorem ipsum dolor sit amet, *consectetuer* adipiscing elit, _sed diam nonummy_ nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum."
-        IMAGE_DATA="[BINARY_DIR]/testimage_thumbnail.jpg"
+        IMAGE_DATA="[BINARY_DIR]/testimage_w80.jpg"
+        SMALL_IMAGE_DATA="[BINARY_DIR]/testimage_w40.jpg"
         IMAGE_CONTENT_TYPE="image/jpg"/>
 
     />

Added: trunk/examples/wiki/testbinaries/testimage_w40.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/examples/wiki/testbinaries/testimage_w40.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/examples/wiki/testbinaries/testimage_w80.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/examples/wiki/testbinaries/testimage_w80.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/examples/wiki/view/includes/breadcrumb.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/breadcrumb.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/breadcrumb.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -44,6 +44,9 @@
             <h:outputText rendered="#{breadcrumb.indexOf(node) &lt; breadcrumb.size()-1}"
                           styleClass="itemSeparatorGreaterThan itemSeparator" value="&gt;"/>
 
+            <h:outputText rendered="#{breadcrumb.indexOf(node) &lt; breadcrumb.size()-1}"
+                          styleClass="itemSeparatorSlash itemSeparator" value="/"/>
+
         </ui:repeat>
     </h:panelGroup>
 

Modified: trunk/examples/wiki/view/includes/commentsDisplay.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/commentsDisplay.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/commentsDisplay.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -99,9 +99,8 @@
                     <s:fragment rendered="#{c.ownedByRegularUser and !empty c.createdBy.profile.imageContentType}">
                         <s:span styleClass="undecoratedLink">
                             <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(c.createdBy)}">
-                                <s:graphicImage styleClass="commentAuthorPortraitImage" value="#{c.createdBy.profile.image}">
-                                    <s:transformImageSize width="30" maintainRatio="true"/>
-                                </s:graphicImage>
+                                <h:graphicImage styleClass="commentAuthorPortraitImage"
+                                                value="#{wikiURLRenderer.renderUserPortraitURL(c.createdBy, true)}"/>
                             </h:outputLink>
                         </s:span>
                     </s:fragment>

Modified: trunk/examples/wiki/view/includes/mainMenuItem.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/mainMenuItem.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/mainMenuItem.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -10,7 +10,10 @@
 <c:forEach var="childWrapper" items="#{node.wrappedChildrenSorted}">
     <s:div styleClass="level#{childWrapper.level}">
         <s:div styleClass="level#{childWrapper.level}Body">
-            <h:outputText styleClass="level#{childWrapper.level}Marker" value="&#183;"/>
+            <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerDot" value="&#183;"/>
+            <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerGreaterThan" value=">"/>
+            <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerSlash" value="&#47;"/>
+            <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerSpace" value="&#160;"/>
             <h:outputLink styleClass="level#{childWrapper.level}Link"
                           value="#{wikiURLRenderer.renderURL(childWrapper.wrappedNode)}">#{childWrapper.wrappedNode.name}</h:outputLink>
         </s:div>

Modified: trunk/examples/wiki/view/includes/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineMembers.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/onlineMembers.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -7,32 +7,32 @@
         xmlns:s="http://jboss.com/products/seam/taglib">
 
     <h:panelGrid columns="8" rendered="#{not empty wikiHttpSessionManager.onlineMembers}"
-                 columnClasses="alignBottom minorPadding"
+                 columnClasses="alignBottom alignCenter minorPadding"
                  style="margin-left:auto;margin-right:auto;">
-        <c:forEach var="u" items="#{wikiHttpSessionManager.onlineMembers}">
+        <c:forEach var="ou" items="#{wikiHttpSessionManager.onlineMembers}">
             <s:div>
-                <s:div styleClass="alignCenter">
-                    <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
-                        <s:graphicImage styleClass="userInfoPortraitImage"
-                                        rendered="#{!empty u.profile.imageContentType}"
-                                        value="#{u.profile.image}">
-                            <s:transformImageSize width="40" maintainRatio="true"/>
-                        </s:graphicImage>
-                        <h:graphicImage rendered="#{empty u.profile.imageContentType}"
+                <s:div>
+                    <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(ou.user)}">
+                        <h:graphicImage styleClass="userInfoPortraitImage"
+                                        rendered="#{!empty ou.user.profile.imageContentType}"
+                                        value="#{wikiURLRenderer.renderUserPortraitURL(ou.user, true)}"/>
+                        <h:graphicImage rendered="#{empty ou.user.profile.imageContentType}"
                                         value="#{imagePath}/default_portrait.gif" width="40" height="50"/>
                     </h:outputLink>
                 </s:div>
-                <s:div styleClass="undecoratedLink">
-                    <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
-                        <h:outputText value="#{u.fullname}"/>
+                <s:div styleClass="undecoratedLink smallFont">
+                    <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(ou.user)}">
+                        <h:outputText value="#{ou.user.fullname}"/>
                     </h:outputLink>
+                    <br/>
+                    <h:outputText styleClass="smallFont" value="#{messages['lacewiki.label.userList.Idle']}:&#160;#{ou.idleTime}"/>
                 </s:div>
             </s:div>
         </c:forEach>
     </h:panelGrid>
 
-    <h:outputText value="#{messages['lacewiki.msg.userList.NoOnlineMembers']}"
-                  rendered="#{empty wikiHttpSessionManager.onlineMembers}"/>
+    <s:div styleClass="minorPadding" rendered="#{empty wikiHttpSessionManager.onlineMembers}">
+        <h:outputText value="#{messages['lacewiki.msg.userList.NoOnlineMembers']}"/>
+    </s:div>
 
-
 </s:fragment>
\ No newline at end of file

Modified: trunk/examples/wiki/view/includes/onlineUsers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineUsers.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/onlineUsers.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -6,7 +6,8 @@
         xmlns:s="http://jboss.com/products/seam/taglib">
 
     <h:panelGrid styleClass="onlineUsersPanel" columns="4"
-                 cellpadding="0" cellspacing="0" border="0">
+                 cellpadding="0" cellspacing="0" border="0"
+                 rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and wikiHttpSessionManager.numberOfOnlineGuests > 0}"> <!-- TODO -->
 
         <h:outputText styleClass="onlineLabel" value="#{messages['lacewiki.label.userList.Online']}:&#160;"/>
 
@@ -24,6 +25,7 @@
             </s:link>
         </s:fragment>
 
+        <!-- TODO: Make this configurable, it's confusing because the search robots also count as guests (but explain that to a marketing guy)
         <h:outputText styleClass="onlineSeparator" value="&#160;|&#160;"
                       rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and
                                   wikiHttpSessionManager.numberOfOnlineGuests > 0}"/>
@@ -36,6 +38,7 @@
                                              : messages['lacewiki.label.userList.Guest']}"/>
             </s:span>
         </s:fragment>
+        -->
 
     </h:panelGrid>
 

Modified: trunk/examples/wiki/view/includes/userControl.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userControl.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/userControl.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -104,10 +104,11 @@
             </s:span>
             <h:inputSecret styleClass="input" id="loginPassword" value="#{identity.password}" size="8" tabindex="50"/>
 
-            <h:commandLink action="#{identity.login}" tabindex="50" styleClass="link"
-                           accesskey="#{messages['lacewiki.button.userControl.Login.accesskey']}">
-                <h:outputText styleClass="linkText" escape="false" value="#{messages['lacewiki.button.userControl.Login']}"/>
-            </h:commandLink>
+            <h:commandButton id="loginButton" action="#{identity.login}" tabindex="50" styleClass="loginButton"
+                             accesskey="#{messages['lacewiki.button.userControl.Login.accesskey']}"
+                             value="#{messages['lacewiki.button.userControl.Login']}">
+                <s:defaultAction/>
+            </h:commandButton>
 
         </h:form>
     
@@ -128,13 +129,15 @@
 
     <s:fragment rendered="#{identity.loggedIn}">
 
-        <h:outputText styleClass="label" value="(#{currentUser.fullname})"/>
 
-        <s:link styleClass="link" action="#{authenticator.logout}" tabindex="70"
-                propagation="none"
-                accesskey="#{messages['lacewiki.button.userControl.Logout.accesskey']}">
-            <h:outputText styleClass="linkText" escape="false" value="#{messages['lacewiki.button.userControl.Logout']}"/>
-        </s:link>
+        <h:form id="logoutForm" styleClass="logoutForm">
+            <h:outputText styleClass="label" value="(#{currentUser.fullname})"/>
+            <h:commandButton action="#{authenticator.logout}" tabindex="70" styleClass="logoutButton"
+                             accesskey="#{messages['lacewiki.button.userControl.Logout.accesskey']}"
+                             value="#{messages['lacewiki.button.userControl.Logout']}">
+                <s:conversationPropagation type="none"/>
+            </h:commandButton>
+        </h:form>
 
         <h:outputLink styleClass="link" tabindex="70"
                       accesskey="#{messages['lacewiki.button.userControl.Home.accesskey']}"

Modified: trunk/examples/wiki/view/includes/userInfo.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userInfo.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/userInfo.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -27,10 +27,7 @@
 
             <s:div styleClass="#{!empty user.profile.bio ? 'userInfoPortraitWithBio' : 'userInfoPortrait'}"
                    rendered="#{!empty user.profile.imageContentType}">
-                <s:graphicImage styleClass="userInfoPortraitImage"
-                                value="#{user.profile.image}">
-                    <s:transformImageSize width="80" maintainRatio="true"/>
-                </s:graphicImage>
+                <h:graphicImage styleClass="userInfoPortraitImage" value="#{wikiURLRenderer.renderUserPortraitURL(user, false)}"/>
             </s:div>
 
             <s:span styleClass="userInfoBio" rendered="#{!empty user.profile.bio}">

Modified: trunk/examples/wiki/view/themes/default/css/mainMenu.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/mainMenu.css	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/default/css/mainMenu.css	2008-07-05 11:42:13 UTC (rev 8434)
@@ -49,6 +49,10 @@
 #mainMenu .level3 {}
 
 #mainMenu .level3Marker {
+    display: none;
+}
+
+#mainMenu .level3MarkerDot {
     padding-left: 2px;
     padding-right: 2px;
     font-size: 80%;

Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/default/css/template.css	2008-07-05 11:42:13 UTC (rev 8434)
@@ -1489,6 +1489,14 @@
     display: none;
 }
 
+#breadcrumb .itemSeparatorSlash  {
+    display: none;
+}
+
+#breadcrumb .itemSeparatorDot  {
+    display: inline;
+}
+
 #breadcrumb .itemText {
     color: #fff;
     text-decoration: none;

Modified: trunk/examples/wiki/view/themes/default/css/userControl.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/userControl.css	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/default/css/userControl.css	2008-07-05 11:42:13 UTC (rev 8434)
@@ -3,7 +3,7 @@
     font-size: 75%;
 }
 
-.loginForm {
+.userControlPanel .loginForm, .userControlPanel .logoutForm {
     display: inline;
 }
 
@@ -34,6 +34,22 @@
     border: 0;
 }
 
+.userControlPanel .loginButton, .userControlPanel .logoutButton {
+    padding: 2px;
+    border: none;
+    margin-left: 5px;
+    margin-right: 0;
+    margin-top: 0;
+    margin-bottom: 0;
+    color: #C7B299;
+    background: none;
+    font-family: Arial, Helvetica, sans-serif;
+    line-height: 100%;
+    font-size: 115%;
+    font-weight: bold;
+    cursor: pointer;
+}
+
 .resetPasswordForm {
     display: inline;
 }

Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css	2008-07-05 11:42:13 UTC (rev 8434)
@@ -1502,10 +1502,18 @@
     color: #d75525;
 }
 
+#breadcrumb .itemSeparatorSlash  {
+    display: none;
+}
+
 #breadcrumb .itemSeparatorGreaterThan  {
     display: none;
 }
 
+#breadcrumb .itemSeparatorDot  {
+    display: inline;
+}
+
 #breadcrumb .itemText {
     color: #d75525;
     text-decoration: none;
@@ -1710,7 +1718,7 @@
     padding-right: 18px;
 }
 
-.loginForm {
+.userControlPanel .loginForm, .userControlPanel .logoutForm {
     display: inline;
 }
 
@@ -1758,6 +1766,21 @@
 }
 
 
+.userControlPanel .loginButton, .userControlPanel .logoutButton {
+    border: none;
+    background: none;
+    padding: 1px;
+    margin-left: 5px;
+    margin-right: 0;
+    margin-top: 0;
+    margin-bottom: 0;
+    color: #fff;
+    font-family:  'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+    line-height: 100%;
+    font-size: 100%;
+    cursor: pointer;
+}
+
 /* Search Control
 ----------------------------------------------- */
 

Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css	2008-07-05 11:42:13 UTC (rev 8434)
@@ -375,6 +375,10 @@
     color: #000;
 }
 
+#breadcrumb .itemSeparatorGreaterThan  {
+    display: none;
+}
+
 #breadcrumb .itemSeparatorDot  {
     display: none;
 }
@@ -1668,7 +1672,7 @@
     margin-right: 10px;
 }
 
-.loginForm {
+.userControlPanel .loginForm, .userControlPanel .logoutForm {
     display: inline;
 }
 
@@ -1703,6 +1707,20 @@
     border: 0;
 }
 
+.userControlPanel .loginButton, .userControlPanel .logoutButton {
+    border: none;
+    background: none;
+    padding: 1px;
+    margin-left: 5px;
+    margin-right: 0;
+    margin-top: 0;
+    margin-bottom: 0;
+    color: #fff;
+    font-family:  'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+    font-size: 100%;
+    cursor: pointer;
+}
+
 .resetPasswordForm {
     display: inline;
 }
@@ -1814,6 +1832,11 @@
 }
 
 #mainMenu .level2Marker {
+    display: none;
+}
+
+#mainMenu .level2MarkerDot {
+    display: inline;
     color: #ca884e;
     margin-right: 4px;
     font-size: 85%;
@@ -1837,10 +1860,7 @@
 }
 
 #mainMenu .level3Marker {
-    padding-left: 2px;
-    padding-right: 2px;
-    font-size: 80%;
-    color: #ca884e;
+    display: none;
 }
 
 #mainMenu .level3Link {

Modified: trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/template.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/sfwkorg/template.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -334,7 +334,8 @@
             </div>
         </div>
 
-        <s:div styleClass="membersAreaContainer" style="margin-top:15px;">
+        <s:div styleClass="membersAreaContainer" style="margin-top:15px;"
+                rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and wikiHttpSessionManager.numberOfOnlineGuests > 0}"> <!-- TODO -->
             <b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
             <ui:include src="../../includes/onlineUsers.xhtml"/>
             <b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>

Modified: trunk/examples/wiki/view/userProfile_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userProfile_d.xhtml	2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/userProfile_d.xhtml	2008-07-05 11:42:13 UTC (rev 8434)
@@ -30,10 +30,6 @@
 
 <ui:define name="content">
 
-    <h1 class="documentTitle">
-        <h:outputText value="#{messages['lacewiki.label.userProfile.UserProfile']} '#{userHome.instance.username}'"/>
-    </h1>
-
     <s:div>
         <c:forEach var="pm" items="#{pluginRegistry.profilePluginModulesAsList}">
             <ui:include src="/#{pm.plugin.getPackageDefaultTemplatePath(pm.template)}"/>




More information about the seam-commits mailing list