Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/StatisticsAction.java =================================================================== diff -u -r70b2844ef7a633436b631e9e55096dc55ee63ed7 -r6b759dda2b1837d0da0b214bbfabbfa6deddc3bb --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/StatisticsAction.java (.../StatisticsAction.java) (revision 70b2844ef7a633436b631e9e55096dc55ee63ed7) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/StatisticsAction.java (.../StatisticsAction.java) (revision 6b759dda2b1837d0da0b214bbfabbfa6deddc3bb) @@ -22,32 +22,38 @@ */ package org.lamsfoundation.lams.admin.web.action; +import java.util.Map; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.admin.service.AdminServiceProxy; +import org.lamsfoundation.lams.statistics.dto.GroupStatisticsDTO; import org.lamsfoundation.lams.statistics.dto.StatisticsDTO; import org.lamsfoundation.lams.statistics.service.IStatisticsService; import org.lamsfoundation.lams.usermanagement.Role; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; /** * @author Luke Foxton * * Gives the overall statistics for a LAMS server * - * @struts.action path="/statistics" validate="false" + * @struts.action path="/statistics" parameter="method" name="statistics" + * input=".statistics" scope="request" validate="false" * @struts.action-forward name="success" path=".statistics" + * @struts.action-forward name="groupStats" path="/groupStatistics.jsp" * @struts.action-forward name="error" path=".error" */ -public class StatisticsAction extends Action { +public class StatisticsAction extends LamsDispatchAction { private static IStatisticsService statisticsService; - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { + public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // check permission if (!request.isUserInRole(Role.SYSADMIN)) { @@ -59,11 +65,35 @@ if (statisticsService == null) { statisticsService = AdminServiceProxy.getStatisticsService(getServlet().getServletContext()); } - + StatisticsDTO stats = statisticsService.getOverallStatistics(); + Map groupMap = statisticsService.getGroupMap(); + request.setAttribute("statisticsDTO", stats); + request.setAttribute("groupMap", groupMap); return mapping.findForward("success"); } + public ActionForward groupStats(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Integer orgId = WebUtil.readIntParam(request, "orgId"); + + // check permission + if (!request.isUserInRole(Role.SYSADMIN)) { + request.setAttribute("errorName", "RegisterAction"); + request.setAttribute("errorMessage", AdminServiceProxy.getMessageService(getServlet().getServletContext()).getMessage("error.authorisation")); + return mapping.findForward("error"); + } + + if (statisticsService == null) { + statisticsService = AdminServiceProxy.getStatisticsService(getServlet().getServletContext()); + } + + GroupStatisticsDTO groupStats = statisticsService.getGroupStatisticsDTO(orgId); + + request.setAttribute("groupStatisticsDTO", groupStats); + return mapping.findForward("groupStats"); + } + } Index: lams_admin/web/groupStatistics.jsp =================================================================== diff -u --- lams_admin/web/groupStatistics.jsp (revision 0) +++ lams_admin/web/groupStatistics.jsp (revision 6b759dda2b1837d0da0b214bbfabbfa6deddc3bb) @@ -0,0 +1,57 @@ +<%@ include file="/taglibs.jsp"%> + +

${groupStatisticsDTO.name}

+ + + + + + + + + + + + + + + + + + + + + + +
${groupStatisticsDTO.totalUsers}
${groupStatisticsDTO.lessons}
${groupStatisticsDTO.monitors}
${groupStatisticsDTO.authors}
${groupStatisticsDTO.learners}
+ + +
+ +

${subGroupStatisticsDTO.name}

+ + + + + + + + + + + + + + + + + + + + + + +
${subGroupStatisticsDTO.totalUsers}
${subGroupStatisticsDTO.lessons}
${subGroupStatisticsDTO.monitors}
${subGroupStatisticsDTO.authors}
${subGroupStatisticsDTO.learners}
+
+
Index: lams_admin/web/statistics.jsp =================================================================== diff -u -r70b2844ef7a633436b631e9e55096dc55ee63ed7 -r6b759dda2b1837d0da0b214bbfabbfa6deddc3bb --- lams_admin/web/statistics.jsp (.../statistics.jsp) (revision 70b2844ef7a633436b631e9e55096dc55ee63ed7) +++ lams_admin/web/statistics.jsp (.../statistics.jsp) (revision 6b759dda2b1837d0da0b214bbfabbfa6deddc3bb) @@ -1,5 +1,23 @@ <%@ include file="/taglibs.jsp"%> + + + +

@@ -70,101 +88,13 @@

- -

${groupStatisticDTO.name}

- - - - - - - - - - - - - - - - - - - - - - -
- - - ${groupStatisticDTO.totalUsers} -
- - - ${groupStatisticDTO.lessons} -
- - - ${groupStatisticDTO.monitors} -
- - - ${groupStatisticDTO.authors} -
- - - ${groupStatisticDTO.learners} -
- - -
- - -

${subGroupStatisticDTO.name}

- - - - - - - - - - - - - - - - - - - - - - -
- - - ${subGroupStatisticDTO.totalUsers} -
- - - ${subGroupStatisticDTO.lessons} -
- - - ${subGroupStatisticDTO.monitors} -
- - - ${subGroupStatisticDTO.authors} -
- - - ${subGroupStatisticDTO.learners} -
-
-
-
+ + +
+ +
+