Index: lams_build/lib/lams/lams.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v diff -u -r1.394 -r1.395 Binary files differ Index: lams_common/src/java/org/lamsfoundation/lams/lesson/service/ILessonService.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/lesson/service/ILessonService.java,v diff -u -r1.32 -r1.33 --- lams_common/src/java/org/lamsfoundation/lams/lesson/service/ILessonService.java 11 Oct 2012 12:01:09 -0000 1.32 +++ lams_common/src/java/org/lamsfoundation/lams/lesson/service/ILessonService.java 27 Dec 2013 13:40:28 -0000 1.33 @@ -434,4 +434,6 @@ * Find lessons which just got available after the given lesson has been completed. */ Set getReleasedSucceedingLessons(Long completedLessonId, Integer learnerId); + + void removeLearnerProgress(Long lessonId, Integer userId); } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java,v diff -u -r1.45 -r1.46 --- lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java 11 Oct 2012 12:01:09 -0000 1.45 +++ lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java 27 Dec 2013 13:40:28 -0000 1.46 @@ -481,6 +481,17 @@ } } } + + /** + * Completely removes learner progress as if the user has not started the lesson yet. + */ + @Override + public void removeLearnerProgress(Long lessonId, Integer userId) { + LearnerProgress learnerProgress = getUserProgressForLesson(userId, lessonId); + if (learnerProgress != null) { + learnerProgressDAO.deleteLearnerProgress(learnerProgress); + } + } private boolean removeActivityReference(Activity activity, LearnerProgress progress) { Index: lams_monitoring/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/conf/language/lams/ApplicationResources.properties,v diff -u -r1.60 -r1.61 --- lams_monitoring/conf/language/lams/ApplicationResources.properties 9 Oct 2013 16:28:36 -0000 1.60 +++ lams_monitoring/conf/language/lams/ApplicationResources.properties 27 Dec 2013 13:40:26 -0000 1.61 @@ -303,6 +303,6 @@ lesson.copy.prompt =(now press Ctrl+C to copy to clipboard) learners.search.phrase.tooltip =You can use multiple keywords by separating them with ; learner.group.select.all =Select/Unselect all +learner.group.remove.progress =You are about to remove student(s) from a lesson. The student(s) will not have access to this lesson any longer. Do you also want to remove the student(s) progress? - #======= End labels: Exported 297 labels for en AU ===== Index: lams_monitoring/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.47 -r1.48 --- lams_monitoring/conf/language/lams/ApplicationResources_en_AU.properties 9 Oct 2013 16:28:36 -0000 1.47 +++ lams_monitoring/conf/language/lams/ApplicationResources_en_AU.properties 27 Dec 2013 13:40:26 -0000 1.48 @@ -303,6 +303,7 @@ lesson.copy.prompt =(now press Ctrl+C to copy to clipboard) learners.search.phrase.tooltip =You can use multiple keywords by separating them with ; learner.group.select.all =Select/Unselect all +learner.group.remove.progress =You are about to remove student(s) from a lesson. The student(s) will not have access to this lesson any longer. Do you also want to remove the student(s) progress? #======= End labels: Exported 297 labels for en AU ===== Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java,v diff -u -r1.106 -r1.107 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 11 Dec 2013 11:47:38 -0000 1.106 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 27 Dec 2013 13:40:27 -0000 1.107 @@ -636,20 +636,23 @@ HttpServletResponse response) throws IOException, JSONException { long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); Lesson lesson = getLessonService().getLesson(lessonId); - Organisation organisation = lesson.getOrganisation(); + // monitor user opted for removing lesson progress for following users + List removedLearners = parseUserList(request, "removedLearners"); + for (User removedLearner : removedLearners) { + getLessonService().removeLearnerProgress(lessonId, removedLearner.getUserId()); + if (LamsDispatchAction.log.isDebugEnabled()) { + LamsDispatchAction.log.debug("Removed progress for user ID: " + removedLearner.getUserId() + + " in lesson ID: " + lessonId); + } + } + List learners = parseUserList(request, "learners"); - String learnerGroupName = organisation.getName() + " learners"; + getLessonService().setLearners(lesson, learners); List staff = parseUserList(request, "monitors"); - // add the creator as staff, if not already done - String staffGroupName = organisation.getName() + " staff"; + getLessonService().setStaffMembers(lesson, staff); - IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet() - .getServletContext()); - monitoringService.createLessonClassForLesson(lessonId, organisation, learnerGroupName, learners, - staffGroupName, staff, getUserId()); - return null; } Index: lams_monitoring/web/monitor.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/web/monitor.jsp,v diff -u -r1.21 -r1.22 --- lams_monitoring/web/monitor.jsp 4 Sep 2013 12:01:14 -0000 1.21 +++ lams_monitoring/web/monitor.jsp 27 Dec 2013 13:40:26 -0000 1.22 @@ -41,6 +41,7 @@ var FORCE_COMPLETE_DROP_FAIL_LABEL = ''; var LEARNER_GROUP_COUNT_LABEL = ''; var LEARNER_GROUP_SHOW_LABEL = ''; + var LEARNER_GROUP_REMOVE_PROGRESS = ''; var LEARNER_GROUP_LIST_TITLE_LABEL = ''; var VIEW_LEARNER_BUTTON_LABEL = ''; var EMAIL_BUTTON_LABEL = ''; Index: lams_monitoring/web/includes/javascript/monitorLesson.js =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/web/includes/javascript/monitorLesson.js,v diff -u -r1.31 -r1.32 --- lams_monitoring/web/includes/javascript/monitorLesson.js 10 Dec 2013 13:23:11 -0000 1.31 +++ lams_monitoring/web/includes/javascript/monitorLesson.js 27 Dec 2013 13:40:26 -0000 1.32 @@ -146,27 +146,50 @@ sortDialogList('classMonitor'); colorDialogList('classLearner'); colorDialogList('classMonitor'); + + var selectedLearners = getSelectedClassUserList('classLearnerList'); + $(this).dialog('option', 'initSelectedLearners', selectedLearners); }, 'buttons' : [ { 'text' : 'Save', 'id' : 'classDialogSaveButton', 'click' : function() { - var dialog = $(this); - var learners = getSelectedClassUserList('classLearnerList'); - var monitors = getSelectedClassUserList('classMonitorList'); + var removedLearners = [], + dialog = $(this), + initSelectedLearners = dialog.dialog('option', 'initSelectedLearners'), + learners = getSelectedClassUserList('classLearnerList'), + monitors = getSelectedClassUserList('classMonitorList'); + + // check for learners removed from lesson + $.each(initSelectedLearners, function(index, selectedLearnerId){ + if ($.inArray(selectedLearnerId, learners) == -1) { + removedLearners.push(selectedLearnerId); + } + }); + + // check if monitoring user really wants to remove progress + if (removedLearners.length > 0 && !confirm(LEARNER_GROUP_REMOVE_PROGRESS)){ + removedLearners = []; + } + $.ajax({ url : LAMS_URL + 'monitoring/monitoring.do', cache : false, data : { - 'method' : 'updateLessonClass', - 'lessonID' : lessonId, - 'learners' : learners, - 'monitors' : monitors + 'method' : 'updateLessonClass', + 'lessonID' : lessonId, + 'learners' : learners.join(), + 'monitors' : monitors.join(), + 'removedLearners' : removedLearners.join() }, success : function() { dialog.dialog('close'); - refreshMonitor('lesson'); + if (removedLearners.length > 0) { + refreshMonitor(); + } else { + refreshMonitor('lesson'); + } } }); } @@ -413,10 +436,10 @@ * Stringifies user IDs who were selected in Edit Class dialog. */ function getSelectedClassUserList(containerId) { - var list = ''; + var list = []; $('#' + containerId).children('div.dialogListItem').each(function(){ if ($('input:checked', this).length > 0){ - list += $(this).attr('userId') + ','; + list.push($(this).attr('userId')); } }); return list;