Index: lams_build/lib/lams/lams-monitoring.jar =================================================================== diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java =================================================================== diff -u -r0a29fecdac875617ddbb0f0dda8d098e63991c50 -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 0a29fecdac875617ddbb0f0dda8d098e63991c50) +++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -170,10 +170,8 @@ + org.getOrganisationId() + ")", "manage-group-button", null, null)); } if (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR)) - links.add(new IndexLinkBean("index.addlesson", Configuration.get(ConfigurationKeys.SERVER_URL) - + "/home.do?method=addLesson&courseID=" + org.getOrganisationId() + "&classID=" + "" - + "&KeepThis=true&TB_iframe=true&height=480&width=610", "add-lesson-button thickbox" - + org.getOrganisationId(), null, null)); + links.add(new IndexLinkBean("index.addlesson", "javascript:showAddLessonDialog(" + + org.getOrganisationId() + ")", "add-lesson-button", null, null)); moreLinks.add(new IndexLinkBean("index.searchlesson", Configuration.get(ConfigurationKeys.SERVER_URL) + "/findUserLessons.do?dispatch=getResults&courseID=" + org.getOrganisationId() + "&KeepThis=true&TB_iframe=true&height=400&width=600", "search-lesson thickbox" @@ -206,11 +204,8 @@ } else {//CLASS_TYPE if (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR)) - links.add(new IndexLinkBean("index.addlesson", Configuration.get(ConfigurationKeys.SERVER_URL) - + "/home.do?method=addLesson&courseID=" + org.getParentOrganisation().getOrganisationId() - + "&classID=" + org.getOrganisationId() - + "&KeepThis=true&TB_iframe=true&height=480&width=610", "add-lesson-button thickbox" - + org.getOrganisationId(), null, null)); + links.add(new IndexLinkBean("index.addlesson", "javascript:showAddLessonDialog(" + + org.getOrganisationId() + ")", "add-lesson-button", null, null)); // Adding gradebook course monitor links if enabled if (org.getParentOrganisation().getEnableGradebookForMonitors() Index: lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java =================================================================== diff -u -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) +++ lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -30,7 +30,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.HashSet; import java.util.Set; import java.util.TreeSet; import java.util.Vector; @@ -92,7 +91,6 @@ * @struts:action-forward name="author" path="/author.jsp" * @struts:action-forward name="monitorLesson" path="/monitorLesson.jsp" * @struts:action-forward name="addLesson" path="/addLesson.jsp" - * @struts:action-forward name="newLesson" path="/newLesson.jsp" * @struts:action-forward name="error" path=".error" * @struts:action-forward name="message" path=".message" * @struts:action-forward name="passwordChange" path=".passwordChange" @@ -331,48 +329,8 @@ } } - /** - * request for add lesson wizard - */ - public ActionForward addLesson(ActionMapping mapping, ActionForm form, HttpServletRequest req, - HttpServletResponse res) throws IOException, ServletException { - - try { - HomeAction.log.debug("request addLesson"); - - Integer courseId = WebUtil.readIntParam(req, AttributeNames.PARAM_COURSE_ID, false); - Integer classId = WebUtil.readIntParam(req, AttributeNames.PARAM_CLASS_ID, true); - - UserDTO user = getUser(); - if (user == null) { - HomeAction.log.error("admin: User missing from session. "); - return mapping.findForward("error"); - } else { - Integer orgId = classId != null ? classId : courseId; - if (getService().isUserInRole(user.getUserID(), orgId, Role.MONITOR) - || getService().isUserInRole(user.getUserID(), orgId, Role.GROUP_MANAGER)) { - HomeAction.log.debug("user is staff"); - String orgName = ((Organisation) getService().findById(Organisation.class, orgId)).getName(); - - req.setAttribute(AttributeNames.PARAM_ORGANISATION_ID, orgId); - req.setAttribute(AttributeNames.PARAM_ORGANISATION_NAME, orgName); - - return mapping.findForward("addLesson"); - } else { - HomeAction.log.error("User " + user.getLogin() - + " tried to get staff screen but isn't staff in organisation: " + orgId); - return displayMessage(mapping, req, "error.authorisation"); - } - } - - } catch (Exception e) { - HomeAction.log.error("Failed to load add lesson", e); - return mapping.findForward("error"); - } - } - @SuppressWarnings("unchecked") - public ActionForward newLesson(ActionMapping mapping, ActionForm form, HttpServletRequest req, + public ActionForward addLesson(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws IOException, UserAccessDeniedException, JSONException, RepositoryCheckedException { UserDTO userDTO = getUser(); @@ -428,7 +386,7 @@ } req.setAttribute("availablePrecedingLessons", availableLessons); - return mapping.findForward("newLesson"); + return mapping.findForward("addLesson"); } public ActionForward createLearningDesignThumbnail(ActionMapping mapping, ActionForm form, HttpServletRequest req, Index: lams_central/web/addLesson.jsp =================================================================== diff -u -r4c7972524def37c1472ee59358f25f9e564a8fd3 -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision 4c7972524def37c1472ee59358f25f9e564a8fd3) +++ lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -1,23 +1,230 @@ - +<%@ page contentType="text/html; charset=utf-8" language="java"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-core" prefix="c"%> -<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> -<%@ taglib uri="tags-lams" prefix="lams" %> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-core" prefix="c" %> - + - &orgName="/> - <fmt:message key="title.add.lesson.window"/> - + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + +
+
+
+ +
+
+ + +
+
+
+ +
+
+ + +
+
+ + + + + + + + + + + + + + + + + +
+
+ + +
+
+
+ + +
+ + +
+
+
+ +
+
+ + +
+
+
+ + +
+ + +
+
+
+ +
+
+ +
+
+ + + + + + + + - -
-

+
+ +
+
+ +
+ + + + + +
+ +
+
+
+
+
+
+
+
+ + + + + +
+ + + +
+ +
- - - +
+
+
+ + + +
+
+ +
+
+ +
+
+ +
+ + \ No newline at end of file Index: lams_central/web/css/addLesson.css =================================================================== diff -u --- lams_central/web/css/addLesson.css (revision 0) +++ lams_central/web/css/addLesson.css (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -0,0 +1,266 @@ +div#tabs { + width: 768px; + height: 574px; +} + +div.tabContent { + height: 543px; + overflow: auto; +} + +.ui-tabs .ui-tabs-panel { + padding: 0px; +} + +.ui-spinner { + margin-left: 10px; +} + +div#tabs ul li a, a.ygtvspacer, a#closeButton, a#addButton { + border-bottom: none; +} + +a#closeButton { + position: absolute; + right: 10px; + top: 11px; + width: 19px; + height: 18px; +} + +a#closeButton span { + background-color: #D0E5F5; +} + +a#addButton { + position: absolute; + right: 60px; + top: 6px; + width: 80px; + padding: 5px 0 5px 25px; + vertical-align: center; + font-weight:bolder; + border: thin solid #2E6E9E; + background-color: #D0E5F5; +} + +table.tabTable { + height: 517px; + table-layout: fixed; + border-top: thin dotted #2E6E9E; +} + +div.tabTitle { + padding: 5px 0px 5px 0px; + font-size: small; + font-weight: bold; + text-align: center; +} + +.errorMessage { + font-weight: bold; + color: red; +} + +.errorField { + border: thick solid red; +} + + +td#learningDesignTreeCell { + padding: 2px 2px 0px 5px; + vertical-align: top; + width: 35%; + border-right: thin dotted #2E6E9E; +} + +div#learningDesignTree { + overflow: auto; + height: 510px; +} + +.ygtv-highlight1, .ygtv-highlight1 .ygtvlabel { + background-color: #dfeffc; +} + +td#canvasControlCell { + padding: 2px 0px 0px 10px; + height: 15px; +} + +td#canvasControlCell a { + color: #47BC23; +} + +td#canvasCell { + text-align: center; + padding: 10px 0px 0px 10px; +} + +div#canvasDiv { + overflow: auto; + height: 452px; +} + +.ldChoiceDependentCanvasElement { + display: none; +} + +img#ldScreenshotLoading, div#ldNotChosenError { + padding-top: 200px; +} + +td#lessonNameCell { + height: 20px; + padding: 0px 0px 5px 10px; +} + +#lessonNameInput { + width:370px; + margin-left: 10px; +} + + +td.userContainerCell { + vertical-align: top; + padding: 5px 5px 0px 5px; +} + +td.userConainterTransferCell { + height: 100px; + width: 16px; + padding: 18px 3px 8px 3px; + vertical-align: top; +} + +td.userConainterTransferTopCell { + vertical-align: bottom; +} + +td.userConainterTransferCell img { + cursor: pointer; +} + +.draggableUser { + padding: 3px 0px 3px 0px; + cursor: default; +} + +.userContainer { + height: 210px; + overflow: auto; + border: thin solid black; + padding : 5px; +} + +.userContainerTitle { + padding: 0px 0px 5px 0px; + height: 15px; + font-size: small; + font-weight: bold; + text-align: center; +} + +.sortUsersButton { + text-align: right; + padding-right: 3px; + float: right; + cursor: pointer; +} + +.droppableHighlight { + padding : 1px; + border: 5px solid #5c9ccc; +} + +.draggableUserSelected { + background-color: #5c9ccc !important; + color: white !important; +} + + +div#tabAdvanced, div#tabConditions { + padding-left: 30px; +} + +input[type="checkbox"] { + margin: 10px 5px 0px 0px; + border: none; +} + +.fieldSectionTitle { + padding: 15px 0px 5px 15px; + font-size: small; + font-weight: bold; +} + +.fieldSectionDescription { + padding: 10px 0px 10px 0px; +} + +div#introDescriptionDiv { + padding: 0px 10px 0px 30px; +} + +div#introDescriptionLabelDiv { + padding: 5px 0px 15px 0px; +} + +textarea#introDescription { + display: none; +} + +#introImageField { + margin-top: 20px; +} + +table#splitLearnersTable { + height: 40px; + display: none; +} + +td#splitLearnersCell { + padding: 0px 0px 0px 30px; +} + +#splitLearnersCountField { + width: 50px; + margin: 0px 0px 0px 5px !important; +} + +td#splitLearnersDescriptionCell { + padding: 0px; +} + +span#splitLearnersDescription { + font-style: italic; +} + +#schedulingEnableField { + margin-bottom: 15px; +} + +#schedulingDatetimeField { + margin: 0px 0px 10px 50px; + display: none; +} + + +#precedingLessonIdField { + margin: 0px 0px 0px 70px; + display: none; +} + +div#timeLimitDiv { + padding: 10px 0px 0px 30px; + display: none; +} + +#timeLimitDaysField { + width: 50px; + margin: 0px 0px 0px 5px !important; +} + +#timeLimitIndividualField { + margin-top: 15px; +} \ No newline at end of file Fisheye: Tag 4f284603a74199f14d9eb0d5e1cc04b89755ba31 refers to a dead (removed) revision in file `lams_central/web/css/newLesson.css'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_central/web/groupContents.jsp =================================================================== diff -u -r910872499b502ccfcae4f620bedb1fa7e1b991ad -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_central/web/groupContents.jsp (.../groupContents.jsp) (revision 910872499b502ccfcae4f620bedb1fa7e1b991ad) +++ lams_central/web/groupContents.jsp (.../groupContents.jsp) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -98,7 +98,7 @@ ( ) - "> + @@ -199,4 +199,4 @@ - + \ No newline at end of file Index: lams_central/web/groupHeader.jsp =================================================================== diff -u -r4ab52d60ee545b9b76bcc65f75c5a400f6105c30 -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_central/web/groupHeader.jsp (.../groupHeader.jsp) (revision 4ab52d60ee545b9b76bcc65f75c5a400f6105c30) +++ lams_central/web/groupHeader.jsp (.../groupHeader.jsp) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -18,7 +18,7 @@
- + @@ -50,10 +50,5 @@ -
  • - - - -
  • Index: lams_central/web/includes/javascript/addLesson.js =================================================================== diff -u --- lams_central/web/includes/javascript/addLesson.js (revision 0) +++ lams_central/web/includes/javascript/addLesson.js (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -0,0 +1,497 @@ +// ********** MAIN FUNCTIONS ********** +var tree; +var lastSelectedUsers = {}; +var sortOrderAscending = {}; +var submitInProgress = false; + +function initLessonTab(){ + $('#ldScreenshotAuthor').load(function(){ + // hide "loading" animation + $('.ldChoiceDependentCanvasElement').css('display', 'none'); + // show the thumbnail + $('#ldScreenshotAuthor').css('display', 'inline'); + // resize if needed + var resized = resizeImage('ldScreenshotAuthor', 477, null); + toggleCanvasResize(resized ? CANVAS_RESIZE_OPTION_FIT + : CANVAS_RESIZE_OPTION_NONE); + }); + + // generate LD tree; folderContents is declared in newLesson.jsp + var treeNodes = parseFolderTreeNode(folderContents); + // there should be no focus, just highlight + YAHOO.widget.TreeView.FOCUS_CLASS_NAME = null; + tree = new YAHOO.widget.TreeView('learningDesignTree', treeNodes); + tree.singleNodeHighlight = true; + tree.subscribe('clickEvent', function(event){ + if (!event.node.data.learningDesignId){ + // it is a folder + return false; + } + + $('#lessonNameInput').val(event.node.label); + + // display "loading" animation and finally LD thumbnail + $('.ldChoiceDependentCanvasElement').css('display', 'none'); + if (event.node.highlightState == 0) { + $('#ldScreenshotLoading').css('display', 'inline'); + $('#ldScreenshotAuthor').attr('src', LD_THUMBNAIL_URL_BASE + event.node.data.learningDesignId); + $('#ldScreenshotAuthor').css('width', 'auto').css('height', 'auto'); + } else { + toggleCanvasResize(CANVAS_RESIZE_OPTION_NONE); + } + }); + tree.subscribe('clickEvent',tree.onEventToggleHighlight); + tree.render(); + + // if empty folders were empty in the start, they would have been displayed as leafs + // instead, there is a dummy element in the start which is removed + // when user opens the folder + var emptyFolderNodes = tree.getNodesBy(function(node){ + var firstNode = node.children[0]; + return firstNode && firstNode.data.isDummy; + }); + + $.each(emptyFolderNodes, function(){ + this.setDynamicLoad(function(node, callback){ + tree.removeChildren(node); + callback(); + }); + }); + + tree.getRoot().children[0].expand(); +} + + +function initClassTab(){ + // users variable is declared in newLesson.jsp + fillUserContainer(users.selectedLearners, 'selected-learners'); + fillUserContainer(users.unselectedLearners, 'unselected-learners'); + fillUserContainer(users.selectedMonitors, 'selected-monitors'); + fillUserContainer(users.unselectedMonitors, 'unselected-monitors'); + + $('.draggableUser').each(function(){ + $(this).draggable({ 'scope' : getDraggableScope($(this).parents('.userContainer').attr('id')), + 'appendTo' : 'body', + 'containment' : '#classTable', + 'revert' : 'invalid', + 'distance' : 20, + 'scroll' : false, + 'cursor' : 'move', + 'helper' : function(event){ + // include the user from which dragging started + $(this).addClass('draggableUserSelected'); + + // copy selected users + var helperContainer = $('
    '); + $(this).siblings('.draggableUserSelected').andSelf().each(function(){ + $(this).clone().appendTo(helperContainer); + }); + return helperContainer; + } + }).click(function(event){ + var wasSelected = $(this).hasClass('draggableUserSelected'); + var parentId = $(this).parent().attr('id'); + // this is needed for shift+click + var lastSelectedUser = lastSelectedUsers[parentId]; + + if (event.shiftKey && lastSelectedUser && lastSelectedUser != this) { + // clear current selection + $(this).siblings().andSelf().removeClass('draggableUserSelected'); + + // find range of users to select + var lastSelectedIndex = $(lastSelectedUser).index(); + var index = $(this).index(); + + var startingElem = lastSelectedIndex > index ? this : lastSelectedUser; + var endingElem = lastSelectedIndex > index ? lastSelectedUser : this; + + $(startingElem).nextUntil(endingElem).andSelf().add(endingElem) + .addClass('draggableUserSelected'); + } else { + if (!event.ctrlKey) { + // clear current sleection + $(this).siblings().andSelf().removeClass('draggableUserSelected'); + } + + if (wasSelected && !event.shiftKey){ + $(this).removeClass('draggableUserSelected'); + lastSelectedUsers[parentId] = null; + } else { + $(this).addClass('draggableUserSelected'); + lastSelectedUsers[parentId] = this; + } + } + }); + }); + + $('.userContainer').each(function(){ + var containerId = $(this).attr('id'); + + $(this).droppable({'scope' : containerId, + 'activeClass' : 'droppableHighlight', + 'tolerance' : 'touch', + 'accept' : function (draggable) { + return acceptDraggable(draggable, containerId); + }, + 'drop' : function () { + transferUsers(containerId); + } + }); + }); + + $('.sortUsersButton').click(function(){ + sortUsers($(this).attr('id')); + }); +} + + +function initAdvancedTab(){ + CKEDITOR.on('instanceReady', function(e){ + // CKEditor needs to load first, then only hide the whole div to prevent errors + $('#introDescriptionDiv').hide(); + }); + + $('#splitLearnersCountField').spinner({ + 'incremental' : false, + 'min' : 1, + 'max' : users.selectedLearners ? users.selectedLearners.length : 1, + 'stop' : updateSplitLearnersFields + }).spinner('value', 1); + + $('#splitLearnersField').change(function(){ + if ($(this).is(':checked')) { + $('#splitLearnersTable').show('slow'); + updateSplitLearnersFields(); + } else { + $('#splitLearnersTable').hide('slow'); + } + }); + + $('#introEnableField').change(function(){ + if ($(this).is(':checked')) { + $('#introDescriptionDiv').show('slow'); + } else { + $('#introDescriptionDiv').hide('slow'); + } + }); + + $('#presenceEnableField').change(function(){ + $('#imEnableField').prop('disabled', !$(this).is(':checked')); + }); + + $('#schedulingEnableField').change(function(){ + if ($(this).is(':checked')) { + $('#schedulingDatetimeField').show('slow'); + } else { + $('#schedulingDatetimeField').hide('slow'); + } + }); + + $('#startMonitorField').change(function(){ + var checked = !$(this).is(':checked'); + if (!checked) { + $('#schedulingEnableField, #precedingLessonEnableField, ' + + '#timeLimitEnableField, #timeLimitIndividualField').attr('checked', false); + $('#timeLimitIndividualField, #precedingLessonIdField, #schedulingDatetimeField').prop('disabled', true); + $('#timeLimitDaysField').spinner('disable'); + $('#schedulingDatetimeField').val(null); + } + + $('#schedulingEnableField, #precedingLessonEnableField, #timeLimitEnableField').prop('disabled', !checked); + }); + + $('#schedulingDatetimeField').datetimepicker({ + 'minDate' : 0 + }); +} + +function initConditionsTab(){ + $('#precedingLessonEnableField').change(function(){ + if ($(this).is(':checked')) { + $('#precedingLessonIdField').show('slow'); + } else { + $('#precedingLessonIdField').hide('slow'); + } + }); + + $('#timeLimitDaysField').spinner({ + 'min' : 0, + 'max' : 180 + }).spinner('value', 30); + + $('#timeLimitEnableField').change(function(){ + if ($(this).is(':checked')) { + $('#timeLimitDiv').show('slow'); + } else { + $('#timeLimitDiv').hide('slow'); + } + }); +} + + +function addLesson(){ + if (submitInProgress) { + return; + } + // some validation at first + var lessonName = $('#lessonNameInput').val(); + if (lessonName){ + $('#lessonNameInput').removeClass('errorField'); + } + + var ldNode = tree.getHighlightedNode(); + if (!ldNode || !ldNode.data.learningDesignId) { + $('#ldNotChosenError').show(); + $('#tabs').tabs('option', 'selected', 0); + return; + } + $('#ldIdField').val(ldNode.data.learningDesignId); + + if (!lessonName){ + $('#lessonNameInput').addClass('errorField'); + $('#tabs').tabs('option', 'selected', 0); + return; + } + $('#lessonNameField').val(lessonName); + + + var learners = getSelectedUserList('selected-learners'); + if (learners == ''){ + $('
    ').addClass('errorMessage') + .text(LABEL_MISSING_LEARNERS) + .appendTo('#selected-learners'); + $('#tabs').tabs('option', 'selected', 1); + return; + } + $('#learnersField').val(learners); + + var monitors = getSelectedUserList('selected-monitors'); + if (monitors == ''){ + $('
    ').addClass('errorMessage') + .text(LABEL_MISSING_MONITORS) + .appendTo('#selected-monitors'); + $('#tabs').tabs('option', 'selected', 1); + return; + } + $('#monitorsField').val(learners); + + if ($('#splitLearnersField').is(':checked')) { + var maxLearnerCount = $('#selected-learners div.draggableUser').length; + var learnerCount = $('#splitLearnersCountField').spinner('value'); + var instances = Math.ceil(maxLearnerCount/learnerCount); + $('#splitNumberLessonsField').val(instances); + } + + // copy CKEditor contents to textarea for submit + $('#introDescription').val(CKEDITOR.instances['introDescription'].getData()); + + submitInProgress = true; + $('#lessonForm').ajaxSubmit({ + 'success' : function(){ + window.parent.closeAddLessonDialog(true); + }}); +} + +// ********** LESSON TAB FUNCTIONS ********** + +function resizeImage(id, width, height) { + var resized = false; + var elem = $('#' + id); + + if (width != null && elem.width() > width) { + elem.css('width', width); + resized = true; + } + if (height != null && elem.height() > height) { + elem.css('height', height); + resized = true; + } + return resized; +} + + +function toggleCanvasResize(mode) { + var toggleCanvasResizeLink = $('#toggleCanvasResizeLink'); + switch (mode) { + case CANVAS_RESIZE_OPTION_NONE: + toggleCanvasResizeLink.css('display', 'none'); + break; + case CANVAS_RESIZE_OPTION_FIT: + toggleCanvasResizeLink.html(CANVAS_RESIZE_LABEL_FULL).one('click', + function() { + toggleCanvasResize(CANVAS_RESIZE_OPTION_FULL) + }); + toggleCanvasResizeLink.css('display', 'inline'); + resizeImage('ldScreenshotAuthor', 477, null); + break; + case CANVAS_RESIZE_OPTION_FULL: + toggleCanvasResizeLink.html(CANVAS_RESIZE_LABEL_FIT).one('click', + function() { + toggleCanvasResize(CANVAS_RESIZE_OPTION_FIT) + }); + toggleCanvasResizeLink.css('display', 'inline'); + $('#ldScreenshotAuthor').css('width', 'auto').css('height', 'auto'); + break; + } +} + + +function parseFolderTreeNode(nodeJSON) { + var result = []; + + if (!nodeJSON.folders && !nodeJSON.learningDesigns) { + // add dummy node, otherwise empty folder is displayed as a leaf + result.push({'type' : 'text', + 'label' : '(dummy)', + 'isDummy' : true + }); + } else { + if (nodeJSON.folders) { + $.each(nodeJSON.folders, function(){ + result.push({'type' : 'text', + 'label' : this.name, + 'children' : parseFolderTreeNode(this) + }); + }); + } + if (nodeJSON.learningDesigns) { + $.each(nodeJSON.learningDesigns, function(){ + result.push({'type' : 'text', + 'label' : this.name, + 'learningDesignId' : this.learningDesignId + }); + }); + } + } + + return result; +} + +// ********** CLASS TAB FUNCTIONS ********** + +function fillUserContainer(users, containerId) { + if (users) { + // create user DIVs + $.each(users, function(index, userJSON) { + $('#' + containerId).append($('
    ').attr({ + 'userId' : userJSON.userID, + 'sortKey' : userJSON.lastName+userJSON.firstName + }) + .addClass('draggableUser') + .text(userJSON.firstName + ' ' + userJSON.lastName + + ' (' + userJSON.login + ')') + ); + }); + + sortUsers('sort-' + containerId); + } +} + + +function getDraggableScope(containerId) { + // switch scope to opposite after drop, so user can be dragged back if needed + var scopeParts = containerId.split('-'); + return (scopeParts[0] == 'selected' ? 'unselected' : 'selected') + '-' + scopeParts[1]; +} + + +function colorDraggableUsers(container) { + // every second line is different + $(container).find('div.draggableUser').each(function(index, userDiv){ + // exact colour should be defined in CSS, but it's easier this way... + $(this).css('background-color', index % 2 ? '#dfeffc' : 'inherit'); + }); +} + + +function getSelectedUserList(containerId) { + var list = ''; + $('#' + containerId).children('div.draggableUser').each(function(){ + list += $(this).attr('userId') + ','; + }); + return list; +} + +function sortUsers(buttonId) { + var container = $('#' + buttonId.substring(buttonId.indexOf('-') + 1)); + var users = container.children('div.draggableUser'); + if (users.length > 1) { + var sortOrderAsc = sortOrderAscending[buttonId]; + + users.each(function(){ + $(this).detach(); + }).sort(function(a, b){ + var keyA = $(a).attr('sortKey'); + var keyB = $(b).attr('sortKey'); + var result = keyA > keyB ? 1 : keyA < keyB ? -1 : 0; + return sortOrderAsc ? -result : result; + }).each(function(){ + $(this).appendTo(container); + }); + + var button = $('#' + buttonId); + if (sortOrderAsc) { + button.html('▼'); + sortOrderAscending[buttonId] = false; + } else { + button.html('▲'); + sortOrderAscending[buttonId] = true; + } + + colorDraggableUsers(container); + } +} + +function acceptDraggable(draggable, toContainerId) { + // forbid current user from being removed from monitors + return toContainerId != 'unselected-monitors' + || $(draggable).attr('userId') != userId; +} + +function transferUsers(toContainerId) { + var toContainer = $('#' + toContainerId); + var fromContainerId = getDraggableScope(toContainerId); + var fromContainer = $('#' + fromContainerId); + var selectedUsers = fromContainer.children('.draggableUserSelected'); + if (selectedUsers.length > 0){ + // remove error message, if exists + toContainer.children('.errorMessage').remove(); + + // move the selected users + selectedUsers.each(function(){ + if (acceptDraggable(this, toContainerId)) { + $(this).css({'top' : '0px', + 'left' : '0px', + }) + .draggable('option', 'scope', fromContainerId) + .appendTo(toContainer); + } + }); + + + // recolour both containers + toContainer.children().removeClass('draggableUserSelected'); + colorDraggableUsers(toContainer); + colorDraggableUsers(fromContainer); + + if (toContainerId.indexOf('learners') > 0) { + // number of selected learners changed, so update this control too + updateSplitLearnersFields(); + } + } +} + +// ********** ADVANCED TAB FUNCTIONS ********** + +function updateSplitLearnersFields(){ + if ($('#splitLearnersField').is(':checked')) { + // put users into groups + var maxLearnerCount = $('#selected-learners div.draggableUser').length; + var learnerCount = $('#splitLearnersCountField').spinner('option', 'max', maxLearnerCount < 1 ? 1 : maxLearnerCount) + .spinner('value'); + var instances = Math.ceil(maxLearnerCount/learnerCount); + learnerCount = Math.ceil(maxLearnerCount/instances); + var description = SPLIT_LEARNERS_DESCRIPTION.replace('[0]', instances).replace('[1]', learnerCount); + $('#splitLearnersDescription').html(description); + } +} \ No newline at end of file Fisheye: Tag 4f284603a74199f14d9eb0d5e1cc04b89755ba31 refers to a dead (removed) revision in file `lams_central/web/includes/javascript/newLesson.js'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_central/web/main.jsp =================================================================== diff -u -r7abac347cede2ecdc3059eb0ca5855b6679f72bd -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_central/web/main.jsp (.../main.jsp) (revision 7abac347cede2ecdc3059eb0ca5855b6679f72bd) +++ lams_central/web/main.jsp (.../main.jsp) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -58,6 +58,7 @@ function closeAddLessonDialog(refresh) { $('#addLessonFrame').attr('src', null); + // was the dialog just closed or a new lesson really added? if latter, refresh the list $("#addLessonDialog").dialog('option', 'refresh', refresh ? true : false) .dialog('close'); } @@ -109,7 +110,7 @@ 'hide' : 'fold', 'open' : function(){ // load contents after opening the dialog - $('#addLessonFrame').attr('src', 'home.do?method=newLesson&organisationID=' + $('#addLessonFrame').attr('src', 'home.do?method=addLesson&organisationID=' + $(this).dialog('option', 'orgID')); }, 'close' : function() { Fisheye: Tag 4f284603a74199f14d9eb0d5e1cc04b89755ba31 refers to a dead (removed) revision in file `lams_central/web/newLesson.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== diff -u -r27a9e58b46446d891cf6b081e8fb6fb6f6294e2e -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 27a9e58b46446d891cf6b081e8fb6fb6f6294e2e) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -118,32 +118,6 @@ Integer userID, String customCSV, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled); /** - * Create a lession according to the input lession WDDX package. The sample - * package is following: - *
    -     * 
    - * 135 - * 10 - * 78 - * 12 - * 3456 - * - *
    - *
    - *

    - * The lesson will includes creator who create this lesson as staff and - * learner. - * - * @param creatorUserId - * The lesson creator, who will be add to lesson as staff and - * learner. - * @param lessionPackage - * @return - */ - public String createLessonClassForLessonWDDX(Integer creatorUserId, String lessionPackage) - throws UserAccessDeniedException; - - /** * Setup the lesson class and organization for a lesson according to the * input from monitoring GUI interface. * @@ -888,11 +862,6 @@ public LearnerProgress getLearnerProgress(Integer learnerId, Long lessonId); /** - * Initialize and create multiple lessons in one call. - */ - public List initializeAndCreateLessons(Integer creatorUserId, String lessonPacket) throws Exception; - - /** * Set a groups name */ public void setGroupName(Long groupID, String name); Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== diff -u -raffc66817dcbf5a677c7742c13fb93a9b35ae97a -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision affc66817dcbf5a677c7742c13fb93a9b35ae97a) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -572,102 +572,6 @@ } /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#createLessonClassForLessonWDDX(Integer, - * String, java.util.Integer) - */ - public String createLessonClassForLessonWDDX(Integer creatorUserId, String lessonPacket) - throws UserAccessDeniedException { - FlashMessage flashMessage = null; - - try { - Hashtable table = (Hashtable) WDDXProcessor.deserialize(lessonPacket); - - // todo: convert:data type: - Integer orgId = WDDXProcessor.convertToInteger(MonitoringConstants.KEY_ORGANISATION_ID, table - .get(MonitoringConstants.KEY_ORGANISATION_ID)); - long lessonId = WDDXProcessor.convertToLong(MonitoringConstants.KEY_LESSON_ID, - table.get(MonitoringConstants.KEY_LESSON_ID)).longValue(); - - // get leaner group info - Hashtable learnerMap = (Hashtable) table.get(MonitoringConstants.KEY_LEARNER); - List learners = (List) learnerMap.get(MonitoringConstants.KEY_USERS); - String learnerGroupName = WDDXProcessor.convertToString(learnerMap, MonitoringConstants.KEY_GROUP_NAME); - - // get staff group info - Hashtable staffMap = (Hashtable) table.get(MonitoringConstants.KEY_STAFF); - List staffs = (List) staffMap.get(MonitoringConstants.KEY_USERS); - String staffGroupName = WDDXProcessor.convertToString(staffMap, MonitoringConstants.KEY_GROUP_NAME); - - Organisation organisation = (Organisation) baseDAO.find(Organisation.class, orgId); - User creator = (User) baseDAO.find(User.class, creatorUserId); - - if (learners == null || learners.size() <= 0) { - learners = new LinkedList(); - Vector learnersList = userManagementService.getUsersFromOrganisationByRole(orgId, Role.LEARNER, false, true); - learners.addAll(learnersList); - } - - if (staffs == null || staffs.size() <= 0) { - staffs = new LinkedList(); - } - - // create the lesson class - add all the users in this organisation - // to the lesson class - // add user as staff - List learnerList = new LinkedList(); - Iterator iter = learners.iterator(); - while (iter.hasNext()) { - try { - Object user = iter.next(); - - if(user instanceof User) - learnerList.add((User) user); - else { - int id = ((Double) user).intValue(); - learnerList.add((User) baseDAO.find(User.class, id)); - } - - } catch (Exception e) { - MonitoringService.log.error("Error parsing learner ID from " + lessonPacket); - continue; - } - } - // get staff user info - List staffList = new LinkedList(); - staffList.add(creator); - iter = staffs.iterator(); - - while (iter.hasNext()) { - try { - int id = ((Double) iter.next()).intValue(); - staffList.add((User) baseDAO.find(User.class, id)); - } catch (Exception e) { - MonitoringService.log.error("Error parsing staff ID from " + lessonPacket); - continue; - } - } - - // Create Lesson class - createLessonClassForLesson(lessonId, organisation, learnerGroupName, learnerList, staffGroupName, - staffList, creatorUserId); - - flashMessage = new FlashMessage("createLesson", Boolean.TRUE); - } catch (Exception e) { - MonitoringService.log.error("Exception occured trying to create a lesson class ", e); - flashMessage = new FlashMessage("createLesson", e.getMessage(), FlashMessage.ERROR); - } - - String message = "Failed on creating flash message:" + flashMessage; - try { - message = flashMessage.serializeMessage(); - } catch (IOException e) { - MonitoringService.log.error(message); - } - - return message; - } - - /** *

    * Pre-condition: This method must be called under the condition of the the * new lesson exists (without lesson class). @@ -2985,159 +2889,6 @@ public LearnerProgress getLearnerProgress(Integer learnerId, Long lessonId) { return learnerService.getProgress(learnerId, lessonId); } - - /** - * Same as initializeLesson, but for multiple lessons, returning multiple - * lesson ids. Used internally by startLessons - */ - private List initializeLessons(Integer creatorUserId, String lessonPacket) throws Exception { - ArrayList lessonIds = new ArrayList(); - - try { - Hashtable table = (Hashtable) WDDXProcessor.deserialize(lessonPacket); - - // parse WDDX values - - String title = WDDXProcessor.convertToString("lessonName", table.get("lessonName")); - String desc = WDDXProcessor.convertToString("lessonDescription", table.get("lessonDescription")); - int copyType = WDDXProcessor.convertToInt("copyType", table.get("copyType")); - Integer organisationId = WDDXProcessor.convertToInteger("organisationID", table.get("organisationID")); - long ldId = WDDXProcessor.convertToLong(AttributeNames.PARAM_LEARNINGDESIGN_ID, table - .get(AttributeNames.PARAM_LEARNINGDESIGN_ID)); - String customCSV = WDDXProcessor.convertToString(WDDXTAGS.CUSTOM_CSV, table.get(WDDXTAGS.CUSTOM_CSV)); - boolean enableLessonIntro = WDDXProcessor.convertToBoolean("enableLessonIntro", - table.get("enableLessonIntro")); - boolean displayDesignImage = WDDXProcessor.convertToBoolean("displayDesignImage", - table.get("displayDesignImage")); - boolean learnerExportAvailable = WDDXProcessor.convertToBoolean("learnerExportPortfolio", - table.get("learnerExportPortfolio")); - boolean learnerPresenceAvailable = WDDXProcessor.convertToBoolean("enablePresence", - table.get("enablePresence")); - boolean learnerImAvailable = WDDXProcessor.convertToBoolean("enableIm", table.get("enableIm")); - boolean liveEditEnabled = WDDXProcessor.convertToBoolean("enableLiveEdit", table.get("enableLiveEdit")); - Boolean enableLessonNotifications = WDDXProcessor.convertToBoolean("enableLessonNotifications", table.get("enableLessonNotifications")); - int numLessons = WDDXProcessor.convertToInt("numberLessonsSplit", table.get("numberLessonsSplit")); - Integer scheduledNumberDaysToLessonFinish = WDDXProcessor.convertToInteger("scheduledNumberDaysToLessonFinish", table.get("scheduledNumberDaysToLessonFinish")); - Long precedingLessonId = WDDXProcessor.convertToLong("organisationID", table.get("precedingLessonID")); - - // initialize multiple lessons - if (numLessons > 0) { - for (int i = 1; i <= numLessons; i++) { - Lesson newLesson = initializeLesson(title + " " + i, desc, ldId, organisationId, creatorUserId, - customCSV, enableLessonIntro, displayDesignImage, learnerExportAvailable, - learnerPresenceAvailable, learnerImAvailable, liveEditEnabled, enableLessonNotifications, - scheduledNumberDaysToLessonFinish, precedingLessonId); - lessonIds.add(newLesson.getLessonId()); - } - } - - } catch (Exception e) { - MonitoringService.log.error("Exception occured trying to initialise lessons ", e); - throw new Exception(e); - } - - return lessonIds; - } - - /** - * Same as create, but for multiple lessons, returning multiple lesson ids. - * Used internally by startLessons - */ - private boolean createLessonClasses(Integer creatorUserId, String lessonPacket, List lessonIds) { - try { - Hashtable table = (Hashtable) WDDXProcessor.deserialize(lessonPacket); - - // multiple lesson info - int numLessons = WDDXProcessor.convertToInt("numberLessonsSplit", table.get("numberLessonsSplit")); - int learnersPerLesson = WDDXProcessor.convertToInt("numberLearnersSplit", table.get("numberLearnersSplit")); - - // todo: convert:data type: - Integer orgId = WDDXProcessor.convertToInteger(MonitoringConstants.KEY_ORGANISATION_ID, table - .get(MonitoringConstants.KEY_ORGANISATION_ID)); - - // get learner group info - Hashtable learnerMap = (Hashtable) table.get(MonitoringConstants.KEY_LEARNER); - // ignored - // List learners = (List) - // learnerMap.get(MonitoringConstants.KEY_USERS); - String learnerGroupName = WDDXProcessor.convertToString(learnerMap, MonitoringConstants.KEY_GROUP_NAME); - // get staff group info - Hashtable staffMap = (Hashtable) table.get(MonitoringConstants.KEY_STAFF); - List staffs = (List) staffMap.get(MonitoringConstants.KEY_USERS); - String staffGroupName = WDDXProcessor.convertToString(staffMap, MonitoringConstants.KEY_GROUP_NAME); - - if (staffs == null) { - staffs = new LinkedList(); - } - - Organisation organisation = (Organisation) baseDAO.find(Organisation.class, orgId); - User creator = (User) baseDAO.find(User.class, creatorUserId); - - // prepare staff list - List staffList = new LinkedList(); - staffList.add(creator); - Iterator iter = staffs.iterator(); - while (iter.hasNext()) { - try { - int id = ((Double) iter.next()).intValue(); - staffList.add((User) baseDAO.find(User.class, id)); - } catch (Exception e) { - MonitoringService.log.error("Error parsing staff ID from " + lessonPacket); - continue; - } - } - - // get all learners - List allLearners = new LinkedList(); - Set userOrgs = organisation.getUserOrganisations(); - iter = userOrgs.iterator(); - while (iter.hasNext()) { - UserOrganisation userOrg = (UserOrganisation) iter.next(); - allLearners.add(userOrg.getUser()); - } - - for (int i = 0; i < numLessons; i++) { - Long lessonId = lessonIds.get(i); - List learnerList = new LinkedList(); - // get every numLessons'th learner - for (int j = i; j < allLearners.size(); j += numLessons) { - learnerList.add(allLearners.get(j)); - } - // Create Lesson class - if (lessonId != null) { - createLessonClassForLesson(lessonId, organisation, learnerGroupName + " " + i, learnerList, - staffGroupName + " " + i, staffList, creatorUserId); - } else { - // run out of lessons (shouldn't reach here) - log.error("Not enough lessons created for numLessons value of numLessons=" + numLessons - + " (got up to " + i + ")"); - return false; - } - } - - return true; - } catch (Exception e) { - MonitoringService.log.error("Exception occured trying to create a lesson class ", e); - return false; - } - - } - - /** - * Start multiple lessons in one call. - */ - public List initializeAndCreateLessons(Integer creatorUserId, String lessonPacket) throws Exception { - - List lessonIds = new ArrayList(); - try { - lessonIds = initializeLessons(creatorUserId, lessonPacket); - createLessonClasses(creatorUserId, lessonPacket, lessonIds); - } catch (Exception e) { - MonitoringService.log.error("Exception occured trying to start lessons ", e); - throw new Exception(e); - } - return lessonIds; - } /** * Set a group's name Fisheye: Tag 4f284603a74199f14d9eb0d5e1cc04b89755ba31 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/CreateLessonServlet.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4f284603a74199f14d9eb0d5e1cc04b89755ba31 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/InitializeAndCreateLessons.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4f284603a74199f14d9eb0d5e1cc04b89755ba31 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/InitializeAndCreateLessonsServlet.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -r7abac347cede2ecdc3059eb0ca5855b6679f72bd -r4f284603a74199f14d9eb0d5e1cc04b89755ba31 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 7abac347cede2ecdc3059eb0ca5855b6679f72bd) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 4f284603a74199f14d9eb0d5e1cc04b89755ba31) @@ -152,70 +152,7 @@ } } - // --------------------------------------------------------------------- - // Struts Dispatch Method - // --------------------------------------------------------------------- /** - * This STRUTS action method will initialize a lesson for specific learning design with the given lesson title and - * lesson description. - *

    - * If initialization is successed, this method will return a WDDX message which includes the ID of new lesson. - * - * @param mapping - * An ActionMapping class that will be used by the Action class to tell the ActionServlet where to send - * the end-user. - * - * @param form - * The ActionForm class that will contain any data submitted by the end-user via a form. - * @param request - * A standard Servlet HttpServletRequest class. - * @param response - * A standard Servlet HttpServletResponse class. - * @return An ActionForward class that will be returned to the ActionServlet indicating where the user is to go - * next. - * @throws IOException - * @throws ServletException - * @deprecated - */ - public ActionForward initializeLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - - IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet() - .getServletContext()); - FlashMessage flashMessage = null; - - try { - String title = WebUtil.readStrParam(request, "lessonName"); - if (title == null) { - title = "lesson"; - } - String desc = WebUtil.readStrParam(request, "lessonDescription", true); - if (desc == null) { - desc = "description"; - } - Integer organisationId = WebUtil.readIntParam(request, "organisationID", true); - long ldId = WebUtil.readLongParam(request, AttributeNames.PARAM_LEARNINGDESIGN_ID); - Boolean learnerExportAvailable = WebUtil.readBooleanParam(request, "learnerExportPortfolio", false); - Boolean learnerPresenceAvailable = WebUtil.readBooleanParam(request, "learnerPresenceAvailable", false); - Boolean learnerImAvailable = WebUtil.readBooleanParam(request, "learnerImAvailable", false); - Boolean liveEditEnabled = WebUtil.readBooleanParam(request, "liveEditEnabled", false); - Lesson newLesson = monitoringService.initializeLesson(title, desc, ldId, organisationId, getUserId(), null, - Boolean.FALSE, Boolean.FALSE, learnerExportAvailable, learnerPresenceAvailable, learnerImAvailable, - liveEditEnabled, Boolean.FALSE, null, null); - - flashMessage = new FlashMessage("initializeLesson", newLesson.getLessonId()); - } catch (Exception e) { - flashMessage = handleException(e, "initializeLesson", monitoringService); - } - - String message = flashMessage.serializeMessage(); - - PrintWriter writer = response.getWriter(); - writer.println(message); - return null; - } - - /** * The Struts dispatch method that starts a lesson that has been created beforehand. Most likely, the request to * start lesson should be triggered by the flash component. This method will delegate to the Spring service bean to * complete all the steps for starting a lesson. Finally, a wddx acknowledgement message will be serialized and sent @@ -257,7 +194,7 @@ return null; } - public ActionForward newLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, + public ActionForward addLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ParseException { String lessonName = request.getParameter("lessonName"); int organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); @@ -415,48 +352,6 @@ } /** - * The Struts dispatch method that finsh a lesson on schedule that has been started beforehand. - * - * @param mapping - * An ActionMapping class that will be used by the Action class to tell the ActionServlet where to send - * the end-user. - * - * @param form - * The ActionForm class that will contain any data submitted by the end-user via a form. - * @param request - * A standard Servlet HttpServletRequest class. - * @param response - * A standard Servlet HttpServletResponse class. - * @return An ActionForward class that will be returned to the ActionServlet indicating where the user is to go - * next. - * @throws IOException - * @throws ServletException - * @throws - */ - public ActionForward finishOnScheduleLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet() - .getServletContext()); - FlashMessage flashMessage = null; - - try { - long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); - int scheduledNumberDaysToLessonFinish = WebUtil.readIntParam(request, - MonitoringConstants.PARAM_SCHEDULED_NUMBER_DAYS_TO_LESSON_FINISH); - monitoringService.finishLessonOnSchedule(lessonId, scheduledNumberDaysToLessonFinish, getUserId()); - flashMessage = new FlashMessage("finishOnScheduleLesson", Boolean.TRUE); - } catch (Exception e) { - flashMessage = handleException(e, "finishOnScheduleLesson", monitoringService); - } - - String message = flashMessage.serializeMessage(); - - PrintWriter writer = response.getWriter(); - writer.println(message); - return null; - } - - /** * The Struts dispatch method to archive a lesson. A wddx acknowledgement message will be serialized and sent back * to the flash component. *