[seam-commits] Seam SVN: r8431 - in trunk/examples/wiki: src/etc/i18n and 13 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Jul 1 07:53:31 EDT 2008
Author: christian.bauer at jboss.com
Date: 2008-07-01 07:53:31 -0400 (Tue, 01 Jul 2008)
New Revision: 8431
Added:
trunk/examples/wiki/src/etc/gwtmodules/
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
trunk/examples/wiki/view/themes/default/img/default_portrait.gif
trunk/examples/wiki/view/themes/inrelationto/img/default_portrait.gif
trunk/examples/wiki/view/themes/sfwkorg/img/default_portrait.gif
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/dao/UserDAO.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties
trunk/examples/wiki/view/includes/onlineMembers.xhtml
trunk/examples/wiki/view/themes/default/css/template.css
trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
trunk/examples/wiki/view/userList_d.xhtml
Log:
Added onlineMembers macro
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-01 11:53:31 UTC (rev 8431)
@@ -466,6 +466,9 @@
lacewiki.label.userList.Edit=Edit
lacewiki.label.userList.NotAvailableForSkin=User search is not available with this skin.
lacewiki.label.userList.OnlineMembers=Online Members
+lacewiki.label.userList.InTheLast=in the last
+lacewiki.label.userList.Minutes=minutes
+lacewiki.msg.userList.NoOnlineMembers=No members are currently online.
lacewiki.label.userList.Online=Online
lacewiki.label.userList.Of=of
lacewiki.label.userList.Member=Member
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-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-07-01 11:53:31 UTC (rev 8431)
@@ -42,6 +42,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;
@Restrict("#{s:hasPermission('User', 'isAdmin', currentUser)}")
public Map<String, Boolean> getSelectedSessions() { return selectedSessions; }
@@ -149,17 +150,20 @@
*/
public List<User> getOnlineMembers() {
- 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() );
+ 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() );
+ }
}
+
+ // Need to load these guys, the are not in this persistence context
+ onlineMembers = userDAO.findUsersWithUsername(onlineUsernames);
}
-
- // Need to load these guys, the are not in this persistence context
- return userDAO.findUsersWithUsername(onlineUsernames);
+ return onlineMembers;
}
public long getTotalMembers() {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java 2008-07-01 11:53:31 UTC (rev 8431)
@@ -53,13 +53,8 @@
}
public long findTotalNoOfUsers() {
- Query q =
- entityManager.createQuery(
- "select count(u) from User u where not u.username = :guestUsername and not u.username = :adminUsername"
- );
- q.setParameter("guestUsername", User.GUEST_USERNAME);
- q.setParameter("adminUsername", User.ADMIN_USERNAME);
- q.setHint("org.hibernate.comment", "Find number of members");
+ Query q = entityManager.createQuery("select count(u) from User u");
+ q.setHint("org.hibernate.comment", "Find number of users");
q.setHint("org.hibernate.cacheable", true);
return (Long)q.getSingleResult();
}
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -169,6 +169,13 @@
-->
</macro>
+ <macro key="onlineMembers" name="onlineMembers">
+ <applicable-to content="true"/>
+ <skins>
+ <skin name="d"/>
+ </skins>
+ </macro>
+
<profile key="userSummary" template="profile_userSummary" priority="10">
<skins>
<skin name="d"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties 2008-07-01 11:53:31 UTC (rev 8431)
@@ -82,6 +82,9 @@
basic.userProfile.label=User Profile
basic.userProfile.description=Display the profile of the current document owner/creator
+basic.onlineMembers.label=Online Members
+basic.onlineMembers.description=Display all currently online members and their portrait
+
basic.userSummary.label=User Summary
basic.userSummary.description=Display a summary of a users statistics
basic.userSummary.label.Portrait=Portrait
Added: 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 (rev 0)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -0,0 +1,29 @@
+<wiki:plugin
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+
+ <s:div styleClass="box">
+
+ <s:div styleClass="boxHeader">
+ <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}
+ #{messages['lacewiki.label.userList.InTheLast']}
+ #{wikiInit.authenticatedSessionTimeoutMinutes}
+ #{messages['lacewiki.label.userList.Minutes']}"/>
+ </s:div>
+
+ <div class="boxContent">
+
+ <ui:include src="/includes/onlineMembers.xhtml"/>
+
+ </div>
+
+ <div class="boxFooter"/>
+
+ </s:div>
+
+</wiki:plugin>
Modified: trunk/examples/wiki/view/includes/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -6,39 +6,33 @@
xmlns:c="http://java.sun.com/jstl/core"
xmlns:s="http://jboss.com/products/seam/taglib">
- <h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0"
- styleClass="datatable topLeftBottomBorder rightBorder smallFont"
- headerClass="regularHeader"
- columnClasses="alignCenter alignBottom minorPadding">
+ <h:panelGrid columns="8" rendered="#{not empty wikiHttpSessionManager.onlineMembers}"
+ columnClasses="alignBottom minorPadding"
+ style="margin-left:auto;margin-right:auto;">
+ <c:forEach var="u" 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}"
+ 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}"/>
+ </h:outputLink>
+ </s:div>
+ </s:div>
+ </c:forEach>
+ </h:panelGrid>
- <f:facet name="header">
- <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}"/>
- <h:outputText value="#{init.authenticatedSessionTimeoutMinutes} minutes"/>
- </f:facet>
+ <h:outputText value="#{messages['lacewiki.msg.userList.NoOnlineMembers']}"
+ rendered="#{empty wikiHttpSessionManager.onlineMembers}"/>
- <h:panelGrid columns="10">
- <c:forEach var="u" items="#{wikiHttpSessionManager.onlineMembers}">
- <h:panelGrid columns="1">
- <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}"
- style="background: #ccc;" value="#{imagePath}/blank.gif" width="40" height="40"/>
- </h:outputLink>
- </s:div>
- <s:div styleClass="undecoratedLink">
- <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
- <h:outputText value="#{u.fullname}"/>
- </h:outputLink>
- </s:div>
- </h:panelGrid>
- </c:forEach>
- </h:panelGrid>
- </h:panelGrid>
-
</s:fragment>
\ No newline at end of file
Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/themes/default/css/template.css 2008-07-01 11:53:31 UTC (rev 8431)
@@ -932,6 +932,14 @@
text-align: left;
}
+.alignTop {
+ vertical-align: top;
+}
+
+.alignBottom {
+ vertical-align: bottom;
+}
+
.noPadding {
padding: 0;
}
Added: trunk/examples/wiki/view/themes/default/img/default_portrait.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/view/themes/default/img/default_portrait.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-07-01 11:53:31 UTC (rev 8431)
@@ -952,6 +952,14 @@
text-align: left;
}
+.alignTop {
+ vertical-align: top;
+}
+
+.alignBottom {
+ vertical-align: bottom;
+}
+
.noPadding {
padding: 0;
}
Added: trunk/examples/wiki/view/themes/inrelationto/img/default_portrait.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/view/themes/inrelationto/img/default_portrait.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-01 11:53:31 UTC (rev 8431)
@@ -607,6 +607,14 @@
text-align: left;
}
+.alignTop {
+ vertical-align: top;
+}
+
+.alignBottom {
+ vertical-align: bottom;
+}
+
.noPadding {
padding: 0;
}
Added: trunk/examples/wiki/view/themes/sfwkorg/img/default_portrait.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/view/themes/sfwkorg/img/default_portrait.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/userList_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userList_d.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/userList_d.xhtml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -31,7 +31,21 @@
<ui:define name="content">
<s:div styleClass="box" style="margin-top:10px;">
- <ui:include src="includes/onlineMembers.xhtml"/>
+ <h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0"
+ styleClass="datatable topLeftBottomBorder rightBorder"
+ headerClass="regularHeader smallFont"
+ columnClasses="alignCenter alignBottom">
+
+ <f:facet name="header">
+ <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}
+ #{messages['lacewiki.label.userList.InTheLast']}
+ #{wikiInit.authenticatedSessionTimeoutMinutes}
+ #{messages['lacewiki.label.userList.Minutes']}"/>
+ </f:facet>
+
+ <ui:include src="includes/onlineMembers.xhtml"/>
+
+ </h:panelGrid>
</s:div>
<script type="text/javascript">jQuery(function() {
More information about the seam-commits
mailing list