Author: thomas.heute(a)jboss.com
Date: 2008-10-06 07:59:02 -0400 (Mon, 06 Oct 2008)
New Revision: 12036
Removed:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java
Log:
JBPORTAL-2171: CurrentUsersPortletWindow spelling errors
(Simplified the portlet)
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java 2008-10-04
19:39:20 UTC (rev 12035)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java 2008-10-06
11:59:02 UTC (rev 12036)
@@ -135,7 +135,7 @@
for (Iterator iterator = activityResults.iterator(); iterator.hasNext();)
{
UserActivity ua = (UserActivity) iterator.next();
- if (currentTime - ua.getTimestamp() < period &&
ua.getId().equals(UserActivity.GUEST))
+ if (currentTime - ua.getTimestamp() < period)
{
results++;
}
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-10-04
19:39:20 UTC (rev 12035)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-10-06
11:59:02 UTC (rev 12036)
@@ -51,6 +51,8 @@
/** Help page */
private static final String JSP_HELP = "/WEB-INF/jsp/users/help.jsp";
+
+ private final long period = 1800000; // Default to 30min
protected void doHelp(JBossRenderRequest request,
JBossRenderResponse response) throws PortletException,
@@ -65,40 +67,25 @@
JBossRenderResponse rResponse) throws PortletException,
IOException, UnavailableException {
- String guestNumber =
rRequest.getPreferences().getValue("guestNumber","");
-
UsersActivityStatsService uass = (UsersActivityStatsService) this
.getPortletContext().getAttribute("UsersActivityStats");
rResponse.setContentType("text/html");
PrintWriter writer = rResponse.getWriter();
- long currentTime = System.currentTimeMillis();
+ // Non guest users
+ Set users = uass.getActiveUsersNames(period);
- // TODO: this is wrong - should pass period instead of current time -
- // actually it works by a coincedence...
- Set users = uass.getActiveUsersNames(currentTime);
+ // Number of active sessions, users and anonymous
+ int sessionCount = uass.getActiveSessionCount(period);
- int sessionCount = uass.getActiveSessionCount(currentTime);
-
- int allLoggedSessions = uass.getUsersActivities(currentTime).size();
-
- if (sessionCount == 1 || (guestNumber.equals("false") &&
users.size() == 1)) {
+ if (sessionCount > 0) {
DelegateContext ctx = new DelegateContext();
ctx.put("USERS", users.toString());
- ctx.put("USERS_COUNT", Integer.toString(sessionCount));
- ctx.put("USERS_LOGGED_COUNT", Integer.toString(users.size()));
+ ctx.put("USERS_COUNT", sessionCount);
+ ctx.put("USERS_LOGGED_COUNT", users.size());
rRequest.setAttribute(PortalJsp.CTX_REQUEST, ctx);
PortletRequestDispatcher rd = getPortletContext()
- .getRequestDispatcher("/WEB-INF/jsp/users/oneUser.jsp");
- rd.include(rRequest, rResponse);
- } else if (sessionCount > 1) {
- DelegateContext ctx = new DelegateContext();
- ctx.put("USERS", users.toString());
- ctx.put("USERS_COUNT", Integer.toString(sessionCount));
- ctx.put("USERS_LOGGED_COUNT", Integer.toString(users.size()));
- rRequest.setAttribute(PortalJsp.CTX_REQUEST, ctx);
- PortletRequestDispatcher rd = getPortletContext()
.getRequestDispatcher("/WEB-INF/jsp/users/users.jsp");
rd.include(rRequest, rResponse);
} else {
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties 2008-10-04
19:39:20 UTC (rev 12035)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties 2008-10-06
11:59:02 UTC (rev 12036)
@@ -24,16 +24,11 @@
javax.portlet.keywords=sample,test
NO_USERS_ONLINE=No online user
-ONE_USER_ONLINE_0=There is <b>
-ONE_USER_ONLINE_1=</b> online user
-ONE_USER_LOGGED_1=</b> logged user
-ONE_USER_IS_0=<b>
-ONE_USER_IS_1=</b>
+ONE_USER_ONLINE=You are the only user online
USERS_ONLINE_0=There are <b>
-USERS_ONLINE_1=</b> online users
-USERS_LOGGED_1=</b> logged users
+USERS_ONLINE_1=</b> users online
USERS_ARE_0=<b>
USERS_ARE_1=</b>
-USERS_WHICH_0=Whose <b>
+USERS_WHICH_0=Among them: <b>
USERS_WHICH_1=</b> are logged-in:
USERS_WHICH_2=</b> is logged-in:
\ No newline at end of file
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties 2008-10-04
19:39:20 UTC (rev 12035)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties 2008-10-06
11:59:02 UTC (rev 12036)
@@ -22,16 +22,11 @@
# 02110-1301 USA, or see the FSF site:
http://www.fsf.org. #
################################################################################
-NO_USERS_ONLINE = Pas d'utilisateurs en ligne.
+NO_USERS_ONLINE = Pas d'utilisateur en ligne.
+ONE_USER_ONLINE=Vous \u00EAtes le seul utilisateur
+USERS_ONLINE_0=Il y a <b>
+USERS_ONLINE_1=</b> utilisateurs online
-ONE_USER_IS_0 = <b>
-
-ONE_USER_IS_1 = </b>
-
-ONE_USER_ONLINE_0 = Il y a <b>
-
-ONE_USER_ONLINE_1 = </b> utilisateur en ligne:
-
USERS_ARE_0 = <b>
USERS_ARE_1 = </b>
@@ -39,3 +34,6 @@
USERS_ONLINE_0 = Il y a <b>
USERS_ONLINE_1 = </b> utilisateurs en ligne:
+USERS_WHICH_0=Parmi eux: <b>
+USERS_WHICH_1=</b> sont connect\u00E9s:
+USERS_WHICH_2=</b> est connect\u00E9:
\ No newline at end of file
Deleted:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp 2008-10-04
19:39:20 UTC (rev 12035)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp 2008-10-06
11:59:02 UTC (rev 12036)
@@ -1,67 +0,0 @@
-<%@ page import="org.jboss.portal.core.CoreConstants" %>
-<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-~ JBoss, a division of Red Hat ~
-~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
-~ contributors as indicated by the @authors tag. See the ~
-~ copyright.txt in the distribution for a full listing of ~
-~ individual contributors. ~
-~ ~
-~ This is free software; you can redistribute it and/or modify it ~
-~ under the terms of the GNU Lesser General Public License as ~
-~ published by the Free Software Foundation; either version 2.1 of ~
-~ the License, or (at your option) any later version. ~
-~ ~
-~ This software is distributed in the hope that it will be useful, ~
-~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
-~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
-~ Lesser General Public License for more details. ~
-~ ~
-~ You should have received a copy of the GNU Lesser General Public ~
-~ License along with this software; if not, write to the Free ~
-~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
-~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-<%@ page language="java"
extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
-<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
-<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
-<%@ page isELIgnored="false" %>
-<portlet:defineObjects/>
-
-<div class="box">
- <table border="0" class="portlet-font"
cellspacing="0" cellpadding="2">
- <tr>
- <td colspan="1">
- <span class="portlet-text">
- <% if (renderRequest.getPreferences().getValue("guestNumber",
"").equals("true")) { %>
- ${n:i18n("ONE_USER_ONLINE_0")}
- ${n:out("USERS_COUNT")}
- ${n:i18n("ONE_USER_ONLINE_1")}
- <br/><br/>
- <% }
- java.util.LinkedList linkedStack =
(java.util.LinkedList)contextStack.get();
- org.jboss.portal.core.servlet.jsp.taglib.context.Context currentContext =
-
((org.jboss.portal.core.servlet.jsp.taglib.context.NamedContext)linkedStack.getLast()).getContext();
- if
(!currentContext.get("USERS_LOGGED_COUNT").equals("0") &&
renderRequest.getPreferences().getValue("loggedNumber",
"").equals("true")) { %>
-
- <% if
(renderRequest.getPreferences().getValue("guestNumber",
"").equals("true")) { %>
- ${n:i18n("USERS_WHICH_0")}
- ${n:out("USERS_LOGGED_COUNT")}
- ${n:i18n("USERS_WHICH_2")}
- <% } else { %>
- ${n:i18n("ONE_USER_ONLINE_0")}
- ${n:out("USERS_LOGGED_COUNT")}
- ${n:i18n("ONE_USER_LOGGED_1")}
- <% } %>
- <br/><br/>
- <% }
- if (!currentContext.get("USERS").equals("[]")
&& renderRequest.getPreferences().getValue("loggedUsers",
"").equals("true")) { %>
-
- ${n:i18n("ONE_USER_IS_0")}
- ${n:out("USERS")}
- ${n:i18n("ONE_USER_IS_1")}
- <% } %>
- </span>
- </td>
- </tr>
- </table>
-</div>
\ No newline at end of file
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp 2008-10-04
19:39:20 UTC (rev 12035)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp 2008-10-06
11:59:02 UTC (rev 12036)
@@ -32,18 +32,32 @@
<tr>
<td colspan="1">
<span class="portlet-text">
- <% if (renderRequest.getPreferences().getValue("guestNumber",
"").equals("true")) { %>
+ <%
+ java.util.LinkedList linkedStack =
(java.util.LinkedList)contextStack.get();
+ org.jboss.portal.core.servlet.jsp.taglib.context.Context currentContext =
+
((org.jboss.portal.core.servlet.jsp.taglib.context.NamedContext)linkedStack.getLast()).getContext();
+
+ if (renderRequest.getPreferences().getValue("guestNumber",
"").equals("true")) {
+ if (Integer.parseInt(currentContext.get("USERS_COUNT")) >
1)
+ {
+ %>
${n:i18n("USERS_ONLINE_0")}
${n:out("USERS_COUNT")}
${n:i18n("USERS_ONLINE_1")}
+ <%
+ }
+ else
+ {
+ %>
+ ${n:i18n("ONE_USER_ONLINE")}
+ <%
+ }
+ %>
<br/><br/>
- <% }
- java.util.LinkedList linkedStack =
(java.util.LinkedList)contextStack.get();
- org.jboss.portal.core.servlet.jsp.taglib.context.Context currentContext =
-
((org.jboss.portal.core.servlet.jsp.taglib.context.NamedContext)linkedStack.getLast()).getContext();
- if
(!currentContext.get("USERS_LOGGED_COUNT").equals("0") &&
renderRequest.getPreferences().getValue("loggedNumber",
"").equals("true")) { %>
+ <%
+ }
+ if (Integer.parseInt(currentContext.get("USERS_COUNT")) > 1
&& !currentContext.get("USERS_LOGGED_COUNT").equals("0")
&& renderRequest.getPreferences().getValue("loggedNumber",
"").equals("true")) { %>
- <% if
(renderRequest.getPreferences().getValue("guestNumber",
"").equals("true")) { %>
${n:i18n("USERS_WHICH_0")}
${n:out("USERS_LOGGED_COUNT")}
<% if
(!currentContext.get("USERS_LOGGED_COUNT").equals("1")) { %>
@@ -51,14 +65,9 @@
<% } else { %>
${n:i18n("USERS_WHICH_2")}
<% } %>
- <% } else { %>
- ${n:i18n("USERS_ONLINE_0")}
- ${n:out("USERS_LOGGED_COUNT")}
- ${n:i18n("USERS_LOGGED_1")}
- <% } %>
<br/><br/>
<% }
- if (!currentContext.get("USERS").equals("[]")
&& renderRequest.getPreferences().getValue("loggedUsers",
"").equals("true")) { %>
+ if (Integer.parseInt(currentContext.get("USERS_COUNT")) > 1
&& !currentContext.get("USERS").equals("[]") &&
renderRequest.getPreferences().getValue("loggedUsers",
"").equals("true")) { %>
${n:i18n("USERS_ARE_0")}
${n:out("USERS")}