Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r7783b8ddec2b73369154eda24b45fe5c5f66634c -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 7783b8ddec2b73369154eda24b45fe5c5f66634c) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -499,6 +499,7 @@ label.upload.info =Uploaded file must be an Excel file and not exceed size of {0} errors.maxfilesize =Uploaded file exceeded maximum size: {0} error.attachment.not.xls =File is not an Excel .xls file. +sysadmin.maintain.session.count =logged in users sysadmin.maintain.session =Logged in users sysadmin.maintain.session.login =Login sysadmin.maintain.session.id =Session ID Index: lams_common/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java =================================================================== diff -u -rbe74862925361d836bef1df4c5959105c9695a87 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_common/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision be74862925361d836bef1df4c5959105c9695a87) +++ lams_common/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -37,14 +37,15 @@ import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.lesson.Lesson; import org.lamsfoundation.lams.lesson.dto.LessonDTO; -import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; import org.lamsfoundation.lams.usermanagement.User; /** - * All Learner service methods that are available within the core. + * All Learner service methods that are available within the core. */ public interface ILearnerService { + // how often Command Websocket Server checks for new commands + public static final long COMMAND_WEBSOCKET_CHECK_INTERVAL = 5000; /** * Gets the lesson object for the given key. @@ -74,7 +75,7 @@ * @throws LamsToolServiceException */ void createToolSessionsIfNecessary(Activity activity, LearnerProgress learnerProgress); - + /** * Marks an tool session as complete and calculates the next activity against the learning design. This method is * for tools to redirect the client on complete. @@ -123,6 +124,12 @@ * Complete the activity in the progress engine and delegate to the progress engine to calculate the next activity * in the learning design. It is currently triggered by various progress engine related action classes, which then * calculate the url to go to next, based on the ActivityMapping class. + * + * @param learnerId + * the learner who are running this activity in the design. + * @param activity + * the activity is being run. + * @return the updated learner progress */ void completeActivity(Integer learnerId, Activity activity, Long progressID); @@ -182,12 +189,12 @@ * will return null. */ Lesson getLessonByActivity(Activity activity); - + boolean isKumaliveDisabledForOrganisation(Integer organisationId); ActivityPositionDTO getActivityPositionByToolSessionId(Long toolSessionId); void createCommandForLearner(Long lessonId, String userName, String jsonCommand); void createCommandForLearners(Long toolContentId, Collection userIds, String jsonCommand); -} +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerFullService.java =================================================================== diff -u -rbe74862925361d836bef1df4c5959105c9695a87 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerFullService.java (.../ILearnerFullService.java) (revision be74862925361d836bef1df4c5959105c9695a87) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerFullService.java (.../ILearnerFullService.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -1,10 +1,15 @@ package org.lamsfoundation.lams.learning.service; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Date; import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.lamsfoundation.lams.learning.command.model.Command; +import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.BranchingActivity; import org.lamsfoundation.lams.learningdesign.Grouping; @@ -55,14 +60,17 @@ * @return LearnerProgress */ LearnerProgress chooseActivity(Integer learnerId, Long lessonId, Activity activity, Boolean clearCompletedFlag); - + /** - * If specified activity is set to produce ToolOutput, calculates and stores mark to gradebook. + * "Complete" an activity from the web layer's perspective. Used for CompleteActivityAction and the Gate and + * Grouping actions. Calls the completeActivity(Integer, Activity, Long) to actually complete the activity and + * progress. * - * @param toolActivity - * @param progress + * @param redirect + * Should this call redirect to the next screen (true) or use a forward (false) */ - void updateGradebookMark(Activity activity, LearnerProgress progress); + String completeActivity(ActivityMapping actionMappings, LearnerProgress progress, Activity currentActivity, + Integer learnerId, boolean redirect) throws UnsupportedEncodingException; /** * Perform grouping for the learners who have started the lesson, based on the grouping activity. Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java =================================================================== diff -u -r9825c35880ec88587666a5cf32a6fad2de9b3bab -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 9825c35880ec88587666a5cf32a6fad2de9b3bab) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -118,7 +118,7 @@ private ActivityMapping activityMapping; private IUserManagementService userManagementService; private ILessonService lessonService; - private static HashMap syncMap = new HashMap(); + private static HashMap syncMap = new HashMap<>(); private IGradebookService gradebookService; private ILogEventService logEventService; private IKumaliveService kumaliveService; @@ -246,7 +246,7 @@ Lesson lesson = getLesson(lessonID); if ((lesson == null) || !lesson.isLessonStarted()) { - LearnerService.log.error("joinLesson: Learner " + learner.getLogin() + " joining lesson " + lesson + log.error("joinLesson: Learner " + learner.getLogin() + " joining lesson " + lesson + " but lesson has not started"); throw new LearnerServiceException("Cannot join lesson as lesson has not started"); } @@ -263,7 +263,7 @@ try { progressEngine.setUpStartPoint(learnerProgress); } catch (ProgressException e) { - LearnerService.log.error("error occurred in 'setUpStartPoint':" + e.getMessage()); + log.error("error occurred in 'setUpStartPoint':" + e.getMessage()); throw new LearnerServiceException(e.getMessage()); } // Use TimeStamp rather than Date directly to keep consistent with Hibnerate persiste object. @@ -290,7 +290,7 @@ try { progressEngine.setUpStartPoint(learnerProgress); } catch (ProgressException e) { - LearnerService.log.error("error occurred in 'setUpStartPoint':" + e.getMessage()); + log.error("error occurred in 'setUpStartPoint':" + e.getMessage()); throw new LearnerServiceException(e.getMessage()); } } @@ -331,10 +331,10 @@ lamsCoreToolService.createToolSession(learnerProgress.getUser(), (ToolActivity) activity, lesson); } } catch (RequiredGroupMissingException e) { - LearnerService.log.warn("error occurred in 'createToolSessionFor':" + e.getMessage()); + log.warn("error occurred in 'createToolSessionFor':" + e.getMessage()); throw e; } catch (ToolException e) { - LearnerService.log.error("error occurred in 'createToolSessionFor':" + e.getMessage()); + log.error("error occurred in 'createToolSessionFor':" + e.getMessage()); throw new LearnerServiceException(e.getMessage()); } } @@ -550,13 +550,38 @@ } - if (LearnerService.log.isDebugEnabled()) { - LearnerService.log.debug("CompleteToolSession() for tool session id " + toolSessionId + " learnerId " + if (log.isDebugEnabled()) { + log.debug("CompleteToolSession() for tool session id " + toolSessionId + " learnerId " + learnerId + " url is " + returnURL); } return returnURL; + } + @Override + public String completeActivity(ActivityMapping actionMappings, LearnerProgress progress, Activity currentActivity, + Integer learnerId, boolean redirect) throws UnsupportedEncodingException { + Lesson lesson = progress.getLesson(); + + if (currentActivity == null) { + progress = joinLesson(learnerId, lesson.getLessonId()); + + } else if (progress.getCompletedActivities().containsKey(currentActivity)) { + // recalculate activity mark and pass it to gradebook + updateGradebookMark(currentActivity, progress); + return actionMappings.getCloseForward(currentActivity, lesson.getLessonId()); + + } else { + completeActivity(learnerId, currentActivity, progress.getLearnerProgressId()); + } + + if (currentActivity != null && (currentActivity.isFloating() || (currentActivity.getParentActivity() != null + && progress.getCompletedActivities().containsKey(currentActivity.getParentActivity())))) { + return actionMappings.getCloseForward(currentActivity, lesson.getLessonId()); + } + + boolean displayParallelFrames = false; + return actionMappings.getProgressForward(progress, redirect, displayParallelFrames); } @Override @@ -638,16 +663,39 @@ return activityMapping.getProgressForward(progress, redirect, false); } - @Override - public void updateGradebookMark(Activity activity, LearnerProgress progress) { + /** + * If specified activity is set to produce ToolOutput, calculates and stores mark to gradebook. + * + * @param toolActivity + * @param progress + */ + private void updateGradebookMark(Activity activity, LearnerProgress progress) { User learner = progress.getUser(); Lesson lesson = progress.getLesson(); - gradebookService.updateGradebookUserActivityMark(lesson, activity, learner); + + if ((learner == null) || (lesson == null) || (activity == null) || !(activity instanceof ToolActivity) + || (((ToolActivity) activity).getEvaluation() == null)) { + return; + } + ToolSession toolSession = lamsCoreToolService.getToolSessionByLearner(learner, activity); + if (toolSession == null) { + return; + } + + //in case this is a leader - update marks for all users in the group, otherwise update marks only for the specified user + List learnersRequiringMarkUpdate = new ArrayList<>(); + if (lamsCoreToolService.isUserLeaderInActivity(toolSession, learner)) { + learnersRequiringMarkUpdate.addAll(toolSession.getLearners()); + + } else { + learnersRequiringMarkUpdate.add(learner); + } + + for (User learnerRequiringMarksUpdate : learnersRequiringMarkUpdate) { + gradebookService.updateGradebookUserActivityMark(lesson, activity, learnerRequiringMarksUpdate); + } } - /** - * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getActivity(java.lang.Long) - */ @Override public Activity getActivity(Long activityId) { return activityDAO.getActivityByActivityId(activityId); @@ -689,7 +737,7 @@ } else { String error = "Grouping activity " + groupingActivity + " learner " + learnerId + " does not exist. Cannot perform grouping."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } } catch (LessonServiceException e) { @@ -750,7 +798,7 @@ private boolean forceGrouping(Lesson lesson, Grouping grouping, Group group, User learner) { boolean groupingDone = false; if (lesson.isPreviewLesson()) { - ArrayList learnerList = new ArrayList(); + ArrayList learnerList = new ArrayList<>(); learnerList.add(learner); if (group != null) { if (group.getGroupId() != null) { @@ -789,7 +837,7 @@ } String error = "Gate activity " + gateActivityId + " does not exist. Cannot knock on gate."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } @@ -845,7 +893,7 @@ @Override public Set getGroupsForGate(GateActivity gate) { Lesson lesson = getLessonByActivity(gate); - Set result = new HashSet(); + Set result = new HashSet<>(); Activity branchActivity = gate.getParentBranch(); while ((branchActivity != null) && !(branchActivity.getParentActivity().isChosenBranchingActivity() @@ -878,7 +926,7 @@ public Lesson getLessonByActivity(Activity activity) { Lesson lesson = lessonDAO.getLessonForActivity(activity.getActivityId()); if (lesson == null) { - LearnerService.log.warn( + log.warn( "Tried to get lesson id for a non-lesson based activity. An error is likely to be thrown soon. Activity was " + activity); } @@ -897,7 +945,7 @@ * @return the lesson dto array. */ private LessonDTO[] getLessonDataFor(List lessons) { - List lessonDTOList = new ArrayList(); + List lessonDTOList = new ArrayList<>(); for (Iterator i = lessons.iterator(); i.hasNext();) { Lesson currentLesson = (Lesson) i.next(); lessonDTOList.add(new LessonDTO(currentLesson)); @@ -916,7 +964,7 @@ User learner = (User) userManagementService.findById(User.class, learnerId); if (learner == null) { String error = "determineBranch: learner " + learnerId + " does not exist. Cannot determine branch."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } @@ -932,7 +980,7 @@ } } catch (LessonServiceException e) { String message = "determineBranch failed due to " + e.getMessage(); - LearnerService.log.error(message, e); + log.error(message, e); throw new LearnerServiceException("determineBranch failed due to " + e.getMessage(), e); } } @@ -956,7 +1004,7 @@ if (toolSession != null) { // Get all the conditions for this branching activity, ordered by order id. - Map conditionsMap = new TreeMap(); + Map conditionsMap = new TreeMap<>(); Iterator branchIterator = branchingActivity.getActivities().iterator(); while (branchIterator.hasNext()) { Activity branchActivity = (Activity) branchIterator.next(); @@ -973,7 +1021,7 @@ // Go through each condition until we find one that passes and that is the required branch. // Cache the tool output so that we aren't calling it over an over again. - Map toolOutputMap = new HashMap(); + Map toolOutputMap = new HashMap<>(); Iterator conditionIterator = conditionsMap.keySet().iterator(); Boolean isOrderedAsc = branchingActivity.getBranchingOrderedAsc(); // map of order chosen by learner -> condition with question and answer uid encoded @@ -987,7 +1035,7 @@ if (toolOutput == null) { toolOutput = lamsCoreToolService.getOutputFromTool(conditionName, toolSession, learner.getUserId()); if (toolOutput == null) { - LearnerService.log.warn("Condition " + condition + " refers to a tool output " + conditionName + log.warn("Condition " + condition + " refers to a tool output " + conditionName + " but tool doesn't return any tool output for that name. Skipping this condition."); } else { toolOutputMap.put(conditionName, toolOutput); @@ -1018,17 +1066,17 @@ // If no conditions match, use the branch that is the "default" branch for this branching activity. if (matchedBranch != null) { - if (LearnerService.log.isDebugEnabled()) { - LearnerService.log.debug("Found branch " + matchedBranch.getActivityId() + ":" + if (log.isDebugEnabled()) { + log.debug("Found branch " + matchedBranch.getActivityId() + ":" + matchedBranch.getTitle() + " for branching activity " + branchingActivity.getActivityId() + ":" + branchingActivity.getTitle() + " for learner " + learner.getUserId() + ":" + learner.getLogin()); } return matchedBranch; } else if (defaultBranch != null) { - if (LearnerService.log.isDebugEnabled()) { - LearnerService.log.debug("Using default branch " + defaultBranch.getActivityId() + ":" + if (log.isDebugEnabled()) { + log.debug("Using default branch " + defaultBranch.getActivityId() + ":" + defaultBranch.getTitle() + " for branching activity " + branchingActivity.getActivityId() + ":" + branchingActivity.getTitle() + " for learner " + learner.getUserId() + ":" + learner.getLogin()); @@ -1037,8 +1085,8 @@ return (SequenceActivity) activityDAO.getActivityByActivityId(defaultBranch.getActivityId(), SequenceActivity.class); } else { - if (LearnerService.log.isDebugEnabled()) { - LearnerService.log.debug( + if (log.isDebugEnabled()) { + log.debug( "No branches match and no default branch exists. Uable to allocate learner to a branch for the branching activity" + branchingActivity.getActivityId() + ":" + branchingActivity.getTitle() + " for learner " + learner.getUserId() + ":" + learner.getLogin()); @@ -1070,8 +1118,8 @@ } if (sequenceActivity != null) { - if (LearnerService.log.isDebugEnabled()) { - LearnerService.log.debug("Found branch " + sequenceActivity.getActivityId() + ":" + if (log.isDebugEnabled()) { + log.debug("Found branch " + sequenceActivity.getActivityId() + ":" + sequenceActivity.getTitle() + " for branching activity " + branchingActivity.getActivityId() + ":" + branchingActivity.getTitle() + " for learner " + learner.getUserId() + ":" + learner.getLogin()); @@ -1108,7 +1156,7 @@ // Go through each condition until we find one that passes and that opens the gate. // Cache the tool output so that we aren't calling it over an over again. - Map toolOutputMap = new HashMap(); + Map toolOutputMap = new HashMap<>(); for (BranchActivityEntry entry : conditionGate.getBranchActivityEntries()) { BranchCondition condition = entry.getCondition(); String conditionName = condition.getName(); @@ -1117,7 +1165,7 @@ toolOutput = lamsCoreToolService.getOutputFromTool(conditionName, toolSession, learner.getUserId()); if (toolOutput == null) { - LearnerService.log.warn("Condition " + condition + " refers to a tool output " + log.warn("Condition " + condition + " refers to a tool output " + conditionName + " but tool doesn't return any tool output for that name. Skipping this condition."); } else { @@ -1155,7 +1203,7 @@ User learner = (User) userManagementService.findById(User.class, learnerId); if (learner == null) { String error = "selectBranch: learner " + learnerId + " does not exist. Cannot determine branch."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } @@ -1167,7 +1215,7 @@ || !selectedBranch.getParentActivity().equals(branchingActivity)) { String error = "selectBranch: activity " + selectedBranch + " is not a branch within the branching activity " + branchingActivity + ". Unable to branch."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } @@ -1193,7 +1241,7 @@ + " for the branch " + selectedBranch + " for the lesson " + lesson.getLessonName() + " preview is " + lesson.isPreviewLesson() + ". This will only work if preview is true."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } } @@ -1213,14 +1261,14 @@ String error = "selectBranch: learner " + learnerId + " cannot be added to the group " + group + " for the branch " + selectedBranch + " for the lesson " + lesson.getLessonName() + " preview is " + lesson.isPreviewLesson() + ". This will only work if preview is true."; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } } groupingDAO.update(grouping); - if (LearnerService.log.isDebugEnabled()) { - LearnerService.log.debug("Found branch " + selectedBranch.getActivityId() + ":" + if (log.isDebugEnabled()) { + log.debug("Found branch " + selectedBranch.getActivityId() + ":" + selectedBranch.getTitle() + " for branching activity " + branchingActivity.getActivityId() + ":" + branchingActivity.getTitle() + " for learner " + learner.getUserId() + ":" + learner.getLogin()); @@ -1230,7 +1278,7 @@ } else { String error = "selectBranch: Unable to find branch for branch id " + branchId; - LearnerService.log.error(error); + log.error(error); throw new LearnerServiceException(error); } @@ -1368,6 +1416,7 @@ public void createCommandForLearner(Long lessonId, String userName, String jsonCommand) { Command command = new Command(lessonId, userName, jsonCommand); commandDAO.insert(command); + commandDAO.flush(); } /** Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java =================================================================== diff -u -rbe74862925361d836bef1df4c5959105c9695a87 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java (.../CompleteActivityController.java) (revision be74862925361d836bef1df4c5959105c9695a87) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java (.../CompleteActivityController.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -87,7 +87,7 @@ return null; } - // if user has already completed the lesson - we need to let integrations servers know to come and pick up + // if user has already completed the lesson - we need to let non-LTI integrations server know to come and pick up // updated marks (as it won't happen at lessoncomplete.jsp page) if (progress.isComplete()) { String lessonFinishCallbackUrl = integrationService.getLessonFinishCallbackUrl(progress.getUser(), @@ -102,12 +102,12 @@ // Set activity as complete try { - + long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); Activity activity = learnerService.getActivity(activityId); //return forward - return learnerService.completeActivity(progress, activity, learnerId, false); - + return learnerService.completeActivity(activityMapping, progress, activity, learnerId, false); + } catch (LearnerServiceException e) { return "error"; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java =================================================================== diff -u -rbe74862925361d836bef1df4c5959105c9695a87 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java (.../GateController.java) (revision be74862925361d836bef1df4c5959105c9695a87) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java (.../GateController.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -133,7 +133,7 @@ } // gate is open, so let the learner go to the next activity ( updating the cached learner progress on the way ) - return learnerService.completeActivity(learnerProgress, activity, learner.getUserId(), true); + return learnerService.completeActivity(activityMapping, learnerProgress, activity, learner.getUserId(), true); } // --------------------------------------------------------------------- Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java =================================================================== diff -u -r19b9f765af37c354d989517332e5636c5af3e9d1 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision 19b9f765af37c354d989517332e5636c5af3e9d1) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -209,7 +209,7 @@ Integer learnerId = LearningWebUtil.getUserId(); // so manually resume the progress. The completeActivity code can cope with a missing activity. - return learnerService.completeActivity(progress, groupingActivity, learnerId, true); + return learnerService.completeActivity(activityMapping, progress, groupingActivity, learnerId, true); } /** Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java =================================================================== diff -u -r9825c35880ec88587666a5cf32a6fad2de9b3bab -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java (.../SequenceActivityController.java) (revision 9825c35880ec88587666a5cf32a6fad2de9b3bab) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java (.../SequenceActivityController.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -96,7 +96,7 @@ } else { // No activities exist in the sequence, so go to the next activity. - return learnerService.completeActivity(learnerProgress, activity, learnerId, true); + return learnerService.completeActivity(activityMapping, learnerProgress, activity, learnerId, true); } } } \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java =================================================================== diff -u -rbe74862925361d836bef1df4c5959105c9695a87 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision be74862925361d836bef1df4c5959105c9695a87) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -87,4 +87,17 @@ return learnerProgress; } + + /** + * Get the activity from request. We assume there is a parameter coming in. Then the activity id parameter is used + * to retrieve from database. + * + * @param request + * @return + */ + public static Activity getActivityFromRequest(HttpServletRequest request, ILearnerFullService learnerService) { + long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); + Activity activity = learnerService.getActivity(activityId); + return activity; + } } \ No newline at end of file Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java =================================================================== diff -u -r68d56bcf4ea82273d7d3beb10809cb638d9b4e7d -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java (.../DacoServiceImpl.java) (revision 68d56bcf4ea82273d7d3beb10809cb638d9b4e7d) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java (.../DacoServiceImpl.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -567,6 +567,11 @@ public List getConfidenceLevels(Long toolSessionId) { return null; } + + @Override + public boolean isUserGroupLeader(Long userId, Long toolSessionId) { + return false; + } @Override public void forceCompleteUser(Long toolSessionId, User user) { Index: lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceImpl.java =================================================================== diff -u -r017ed225bae149252bb40a8e27a2323b8f8487c5 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceImpl.java (.../ResourceServiceImpl.java) (revision 017ed225bae149252bb40a8e27a2323b8f8487c5) +++ lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceImpl.java (.../ResourceServiceImpl.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -1052,6 +1052,11 @@ public List getConfidenceLevels(Long toolSessionId) { return null; } + + @Override + public boolean isUserGroupLeader(Long userId, Long toolSessionId) { + return false; + } @Override public void forceCompleteUser(Long toolSessionId, User user) { Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardService.java =================================================================== diff -u -rbe74862925361d836bef1df4c5959105c9695a87 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardService.java (.../NoticeboardService.java) (revision be74862925361d836bef1df4c5959105c9695a87) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardService.java (.../NoticeboardService.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -545,6 +545,11 @@ public List getConfidenceLevels(Long toolSessionId) { return null; } + + @Override + public boolean isUserGroupLeader(Long userId, Long toolSessionId) { + return false; + } @Override public void forceCompleteUser(Long toolSessionId, User user) { Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java =================================================================== diff -u -r68d56bcf4ea82273d7d3beb10809cb638d9b4e7d -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java (.../SubmitFilesService.java) (revision 68d56bcf4ea82273d7d3beb10809cb638d9b4e7d) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java (.../SubmitFilesService.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -538,6 +538,14 @@ } @Override + public boolean isUserGroupLeader(Long userId, Long toolSessionId) { + SubmitFilesSession session = submitFilesSessionDAO.getSessionByID(toolSessionId); + SubmitUser groupLeader = session.getGroupLeader(); + + return (groupLeader != null) && userId.equals(groupLeader.getUserID().longValue()); + } + + @Override public void forceCompleteUser(Long toolSessionId, User user) { // no actions required } @@ -1376,13 +1384,4 @@ submitUserDAO.insertOrUpdate(user); } - @Override - public boolean isUserGroupLeader(SubmitUser user, Long toolSessionId) { - - SubmitFilesSession session = submitFilesSessionDAO.getSessionByID(toolSessionId); - SubmitUser groupLeader = session.getGroupLeader(); - - return (groupLeader != null) && user.getUserID().equals(groupLeader.getUserID()); - } - } \ No newline at end of file Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/LearnerController.java =================================================================== diff -u -r68d56bcf4ea82273d7d3beb10809cb638d9b4e7d -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/LearnerController.java (.../LearnerController.java) (revision 68d56bcf4ea82273d7d3beb10809cb638d9b4e7d) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/LearnerController.java (.../LearnerController.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -250,7 +250,7 @@ } sessionMap.put(SbmtConstants.ATTR_GROUP_LEADER, groupLeader); - boolean isUserLeader = submitFilesService.isUserGroupLeader(learner, toolSessionID); + boolean isUserLeader = submitFilesService.isUserGroupLeader(learner.getUserID().longValue(), toolSessionID); sessionMap.put(SbmtConstants.ATTR_IS_USER_LEADER, isUserLeader); boolean hasEditRight = !content.isUseSelectLeaderToolOuput() Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java =================================================================== diff -u -ra036f4daff29fff35a950c2ddd63a36078f87e73 -r815b617ce48bcd3dc0a36aa32630ca55d4c21715 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision a036f4daff29fff35a950c2ddd63a36078f87e73) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 815b617ce48bcd3dc0a36aa32630ca55d4c21715) @@ -865,6 +865,11 @@ public List getConfidenceLevels(Long toolSessionId) { return null; } + + @Override + public boolean isUserGroupLeader(Long userId, Long toolSessionId) { + return false; + } @Override public void forceCompleteUser(Long toolSessionId, User user) {