Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -rf355a4d46b5ab02602de9fdb7513321197503bad -r5583b96031dbb65e91d200b7121cc5cd49e26003 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision f355a4d46b5ab02602de9fdb7513321197503bad) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) @@ -138,6 +138,7 @@ public static final String USER_EXCEPTION_USERID_NOTNUMERIC ="userExceptionUserIdNotNumeric"; public static final String USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS ="userExceptionOnlyContentAndNoSessions"; public static final String USER_EXCEPTION_USERID_EXISTING ="userExceptionUserIdExisting"; + public static final String USER_EXCEPTION_USER_DOESNOTEXIST ="userExceptionUserDoesNotExist"; public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED ="userExceptionMonitoringTabContentIdRequired"; public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup"; public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions"; @@ -151,6 +152,7 @@ public static final String USER_EXCEPTION_MODE_REQUIRED ="userExceptionModeRequired"; public static final String PORTFOLIO_REPORT ="portfolioReport"; public static final String PORTFOLIO_REQUEST ="portfolioRequest"; + public static final int MAX_GROUPS_COUNT =250; /** * user actions Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties =================================================================== diff -u -r9d15b7d0b741f4f9a2f3f3a0f04c0d14c6f92795 -r5583b96031dbb65e91d200b7121cc5cd49e26003 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties (.../QaResources.properties) (revision 9d15b7d0b741f4f9a2f3f3a0f04c0d14c6f92795) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties (.../QaResources.properties) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) @@ -85,6 +85,7 @@ error.toolSession.doesNotExist =Tool Activity Error! Can't continue. The toolsession id passed to the Tool Activity does not refer to an existing tool session. error.content.onlyContentAndNoSessions =A report can not be generated since no tool sessions has been passed to the Tool Activity. error.content.noToolSessions =A report can not be generated since there has not been any student activity on this content. +error.user.doesNotExist =Tool Activity Error! Can't continue. The user id passed to the Tool Activity does not refer to an existing user. error.tab.contentId.required =Sorry, the screen is not available. The Tool Activity requires a content id. monitoring.feedback.instructionUpdate =The content has been updated successfully. Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== diff -u -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 -r5583b96031dbb65e91d200b7121cc5cd49e26003 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) @@ -270,18 +270,14 @@ } - public static User createAuthoringUser(Integer userId) + + public static User createSimpleUser(Integer userId) { User user=new User(); user.setUserId(userId); return user; } - public static User createStandardUser(Integer userId) - { - return createAuthoringUser(userId); - } - public static User createUser(Integer userId) { User user=new User(); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== diff -u -r183fd9b105d8f11b7ab038be49e542499d28b970 -r5583b96031dbb65e91d200b7121cc5cd49e26003 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 183fd9b105d8f11b7ab038be49e542499d28b970) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) @@ -459,6 +459,7 @@ * A boolean true isUsernameVisible indicates that all user names to be displayed. * Only applies to learning mode. */ + Boolean isUsernameVisible=(Boolean)request.getSession().getAttribute(IS_USERNAME_VISIBLE); logger.debug("IS_USERNAME_VISIBLE: " + isUsernameVisible); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java =================================================================== diff -u -r9d15b7d0b741f4f9a2f3f3a0f04c0d14c6f92795 -r5583b96031dbb65e91d200b7121cc5cd49e26003 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java (.../QaExportPortfolioStarterAction.java) (revision 9d15b7d0b741f4f9a2f3f3a0f04c0d14c6f92795) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java (.../QaExportPortfolioStarterAction.java) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) @@ -41,6 +41,7 @@ import org.lamsfoundation.lams.tool.qa.QaAppConstants; import org.lamsfoundation.lams.tool.qa.QaApplicationException; import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; import org.lamsfoundation.lams.tool.qa.QaSession; import org.lamsfoundation.lams.tool.qa.QaStringComparator; import org.lamsfoundation.lams.tool.qa.QaUtils; @@ -82,7 +83,7 @@ logger.debug("userId: " + userId); try { - User user=QaUtils.createStandardUser(new Integer(userId)); + User user=QaUtils.createSimpleUser(new Integer(userId)); request.getSession().setAttribute(TOOL_USER, user); } catch(NumberFormatException e) @@ -159,15 +160,16 @@ return (mapping.findForward(PORTFOLIO_REPORT)); } logger.debug("final toolSessionId before exists test :" + toolSessionId); - } - QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); - if (qaSession == null) - { - persistError(request,"error.toolSession.doesNotExist"); - request.setAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST, new Boolean(true)); - logger.debug("forwarding to: " + PORTFOLIO_REPORT); - return (mapping.findForward(PORTFOLIO_REPORT)); + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); + if (qaSession == null) + { + persistError(request,"error.toolSession.doesNotExist"); + request.setAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } } logger.debug("final toolSessionId :" + toolSessionId); @@ -216,28 +218,59 @@ mode=(String)request.getSession().getAttribute(MODE); logger.debug("mode is: " + mode); - - toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID); - logger.debug("toolSessionId: " + toolSessionId); - - /** - whether the request is of mode learner or teacher, we construct a single listToolSessions object and - build the report based on that object. - */ - List listToolSessions=null; + Map mapToolSessions= new TreeMap(new QaStringComparator()); + request.getSession().setAttribute(MAP_TOOL_SESSIONS,mapToolSessions); + LearningUtil learningUtil= new LearningUtil(); + if (mode.equalsIgnoreCase(LEARNER)) { + toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID); + logger.debug("toolSessionId: " + toolSessionId); + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); + QaContent qaContent=qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + logger.debug("using qaContent id : " + qaContent.getQaContentId()); + request.getSession().setAttribute(TOOL_CONTENT_ID, qaContent.getQaContentId()); + + /** is other learner's full name visible to this learner */ + logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible()); + request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(qaContent.isUsernameVisible())); + + logger.debug("TOOL_USER is:" + request.getSession().getAttribute(TOOL_USER)); + User toolUser= (User)request.getSession().getAttribute(TOOL_USER); + logger.debug("TOOL_USER id:" + toolUser.getUserId()); + + QaQueUsr qaQueUsr=qaService.loadQaQueUsr(new Long(toolUser.getUserId().longValue())); + logger.debug("qaQueUsr:" + qaQueUsr); + + if (qaQueUsr != null) + { + request.getSession().setAttribute(CURRENTLEARNER_FULLNAME , qaQueUsr.getFullname()); + logger.debug("current learner fullname:" + qaQueUsr.getFullname()); + } + else + { + persistError(request,"error.user.doesNotExist"); + request.setAttribute(USER_EXCEPTION_USER_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + logger.debug("generate portfolio for mode: " + mode); request.getSession().setAttribute(TARGET_MODE, TARGET_MODE_LEARNING); /** a single toolSessionId */ - listToolSessions.add(1, toolSessionId); - logger.debug("listToolSessions: " + listToolSessions); + request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); + logger.debug("build a learner report:"); + learningUtil.buidLearnerReport(request, 1); } else { + toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); + + List listToolSessions=null; logger.debug("generate portfolio for mode: " + mode); request.getSession().setAttribute(TARGET_MODE, TARGET_MODE_MONITORING); @@ -246,34 +279,31 @@ logger.debug("qa: " + qa); listToolSessions= qaService.getToolSessionsForContent(qa); logger.debug("listToolSessions: " + listToolSessions); + + if (listToolSessions.size() == 0) + { + persistError(request,"error.content.noToolSessions"); + request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + Iterator sessionListIterator=listToolSessions.iterator(); + int toolSessionCounter=1; + while (sessionListIterator.hasNext()) + { + toolSessionId=(Long)sessionListIterator.next(); + logger.debug("toolSessionId: " + toolSessionId); + request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); + learningUtil.buidLearnerReport(request, toolSessionCounter); + toolSessionCounter++; + } } - if (listToolSessions.size() == 0) - { - persistError(request,"error.content.noToolSessions"); - request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true)); - logger.debug("forwarding to: " + PORTFOLIO_REPORT); - return (mapping.findForward(PORTFOLIO_REPORT)); - } - - Map mapToolSessions= new TreeMap(new QaStringComparator()); - request.getSession().setAttribute(MAP_TOOL_SESSIONS,mapToolSessions); - LearningUtil learningUtil= new LearningUtil(); - - Iterator sessionListIterator=listToolSessions.iterator(); - int toolSessionCounter=1; - while (sessionListIterator.hasNext()) - { - toolSessionId=(Long)sessionListIterator.next(); - logger.debug("toolSessionId: " + toolSessionId); - request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); - learningUtil.buidLearnerReport(request, toolSessionCounter); - toolSessionCounter++; - } - /** the flag to differentiate between request for monitoring versus request for portfolio */ request.setAttribute(PORTFOLIO_REQUEST, new Boolean(true)); logger.debug("generate portfolio jsp for mode: " + mode); + logger.debug("mapToolSessions: " + request.getSession().getAttribute(MAP_TOOL_SESSIONS)); return (mapping.findForward(PORTFOLIO_REPORT)); }