Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r4aa7a60c90a430b0c6a20a46ca8cfccbe302edbf -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 Binary files differ Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r4ab52d60ee545b9b76bcc65f75c5a400f6105c30 -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4ab52d60ee545b9b76bcc65f75c5a400f6105c30) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -358,6 +358,7 @@ label.tab.lesson =Lesson label.tab.class =Class label.tab.advanced =Advanced +label.tab.conditions =Conditions label.tab.lesson.title =Select the sequence to add a lesson, and click on Add now label.tab.class.title =Please use drag n' drop to select or unselect monitors and learners label.tab.lesson.name =Lesson name: @@ -385,5 +386,12 @@ label.tab.advanced.field.split.number =No. learners per lesson label.tab.advanced.field.scheduling =Enable scheduling label.tab.advanced.split.desc =[0] instances of this lesson will be created
and approximately [1] will be allocated to each lesson - +label.tab.conditions.dependencies =Dependencies +label.tab.conditions.dependencies.desc =Select a lesson that students will need to complete before they can see the lesson you are about to create. +label.tab.conditions.timelimit =Time limitations +label.tab.conditions.timelimit.desc =Set the number of days the lesson will be available to students. After this period the lesson will no longer be shown.
If the time should count from the moment the learner starts the lesson, select the option for individual time limit. +label.tab.conditions.timelimit.days =Number days: +label.tab.conditions.timelimit.individual =Is this time limit for each individual? +label.tab.conditions.enable =Enable +label.tab.conditions.dependencies.desc =Select a lesson that students will need to complete before they can see the lesson you are about to create. #======= End labels: Exported 345 labels for en AU ===== Index: lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java =================================================================== diff -u -r4ab52d60ee545b9b76bcc65f75c5a400f6105c30 -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 --- lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision 4ab52d60ee545b9b76bcc65f75c5a400f6105c30) +++ lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -30,6 +30,9 @@ 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; import javax.servlet.ServletException; @@ -52,7 +55,9 @@ import org.lamsfoundation.lams.learningdesign.dao.IGroupUserDAO; import org.lamsfoundation.lams.learningdesign.service.ILearningDesignService; import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.dto.LessonDTO; import org.lamsfoundation.lams.lesson.service.ILessonService; +import org.lamsfoundation.lams.lesson.util.LessonDTOComparator; import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.Role; import org.lamsfoundation.lams.usermanagement.User; @@ -366,6 +371,7 @@ } } + @SuppressWarnings("unchecked") public ActionForward newLesson(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws IOException, UserAccessDeniedException, JSONException, RepositoryCheckedException { @@ -387,7 +393,7 @@ userJSON.put("firstName", user.getFirstName()); userJSON.put("lastName", user.getLastName()); userJSON.put("login", user.getLogin()); - + users.append("selectedLearners", userJSON); } @@ -399,17 +405,29 @@ userJSON.put("firstName", user.getFirstName()); userJSON.put("lastName", user.getLastName()); userJSON.put("login", user.getLogin()); - + if (userDTO.getUserID().equals(user.getUserID())) { // creator is always selected users.append("selectedMonitors", userJSON); } else { users.append("unselectedMonitors", userJSON); } } - + req.setAttribute("users", users.toString()); + // find lessons which can be set as preceding ones for newly created lesson + Organisation organisation = (Organisation) getService().findById(Organisation.class, organisationID); + Set availableLessons = new TreeSet(new LessonDTOComparator()); + for (Lesson availableLesson : (Set) organisation.getLessons()) { + Integer availableLessonState = availableLesson.getLessonStateId(); + if (!Lesson.REMOVED_STATE.equals(availableLessonState) + && !Lesson.FINISHED_STATE.equals(availableLessonState)) { + availableLessons.add(new LessonDTO(availableLesson)); + } + } + req.setAttribute("availablePrecedingLessons", availableLessons); + return mapping.findForward("newLesson"); } @@ -455,7 +473,7 @@ if (publicFolder != null) { folderContents.add(publicFolder); } - // special behaviour for organisation folders + // special behaviour for organisation folders } else if (folderID.equals(WorkspaceAction.ORG_FOLDER_ID)) { folderContents = getWorkspaceManagementService().getAccessibleOrganisationWorkspaceFolders(userID); Index: lams_central/web/css/newLesson.css =================================================================== diff -u -r16d6f695b233ecc989e47a607820ab78f07e7caf -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 --- lams_central/web/css/newLesson.css (.../newLesson.css) (revision 16d6f695b233ecc989e47a607820ab78f07e7caf) +++ lams_central/web/css/newLesson.css (.../newLesson.css) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -11,6 +11,10 @@ padding: 0px; } +.ui-spinner { + margin-left: 10px; +} + div#tabs ul li a, a.ygtvspacer, a#closeButton, a#addButton { border-bottom: none; } @@ -153,11 +157,11 @@ } -div#tabAdvanced { +div#tabAdvanced, div#tabConditions { padding-left: 30px; } -div#tabAdvanced input[type="checkbox"] { +input[type="checkbox"] { margin: 5px 5px 0px 0px; border: none; } @@ -168,15 +172,15 @@ font-weight: bold; } -.fieldInnerSection { - padding-left: 30px; +.fieldSectionDescription { + padding: 10px 0px 10px 0px; } -div#introSection { - padding-top: 5px; +.fieldInnerSection { + padding: 10px 0px 0px 30px; } -div#introSection span { +div.fieldInnerSection span { vertical-align: top; } @@ -207,5 +211,19 @@ } #schedulingDatetimeField { - margin-left: 40px; + margin-left: 50px; +} + + +#precedingLessonIdField { + margin: 0px 0px 0px 70px; +} + +#timeLimitDaysField { + width: 50px; + margin: 0px 0px 0px 5px !important; +} + +#timeLimitIndividualField { + margin-top: 15px; } \ No newline at end of file Index: lams_central/web/includes/javascript/newLesson.js =================================================================== diff -u -r16d6f695b233ecc989e47a607820ab78f07e7caf -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 --- lams_central/web/includes/javascript/newLesson.js (.../newLesson.js) (revision 16d6f695b233ecc989e47a607820ab78f07e7caf) +++ lams_central/web/includes/javascript/newLesson.js (.../newLesson.js) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -189,20 +189,40 @@ $('#startMonitorField').change(function(){ var checked = !$(this).is(':checked'); - var schedulingEnableField = $('#schedulingEnableField'); if (!checked) { - schedulingEnableField.attr('checked', false); - $('#schedulingDatetimeField').val(null).prop('disabled', true); + $('#schedulingEnableField, #precedingLessonEnableField, ' + + '#timeLimitEnableField, #timeLimitIndividualField').attr('checked', false); + $('#timeLimitIndividualField, #precedingLessonIdField, #schedulingDatetimeField').prop('disabled', true); + $('#timeLimitDaysField').spinner('disable'); + $('#schedulingDatetimeField').val(null); } - schedulingEnableField.prop('disabled', !checked); + + $('#schedulingEnableField, #precedingLessonEnableField, #timeLimitEnableField').prop('disabled', !checked); }); $('#schedulingDatetimeField').datetimepicker({ 'minDate' : 0 }); } +function initConditionsTab(){ + $('#precedingLessonEnableField').change(function(){ + $('#precedingLessonIdField').prop('disabled', !$(this).is(':checked')); + }); + + $('#timeLimitDaysField').spinner({ + 'disabled' : true, + 'min' : 0, + 'max' : 180 + }).spinner('value', 30); + + $('#timeLimitEnableField').change(function(){ + $('#timeLimitDaysField').spinner($(this).is(':checked') ? 'enable' : 'disable'); + $('#timeLimitIndividualField').prop('disabled', !$(this).is(':checked')); + }); +} + function addLesson(){ if (submitInProgress) { return; Index: lams_central/web/newLesson.jsp =================================================================== diff -u -r16d6f695b233ecc989e47a607820ab78f07e7caf -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 --- lams_central/web/newLesson.jsp (.../newLesson.jsp) (revision 16d6f695b233ecc989e47a607820ab78f07e7caf) +++ lams_central/web/newLesson.jsp (.../newLesson.jsp) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -1,6 +1,7 @@ <%@ 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"%> @@ -45,6 +46,7 @@ initLessonTab(); initClassTab(); initAdvancedTab(); + initConditionsTab(); }); @@ -63,6 +65,7 @@
  • +
  • @@ -122,9 +125,8 @@ - +
    - @@ -136,12 +138,12 @@
    -
    +

    + disabled="disabled">
    @@ -152,7 +154,7 @@


    -
    +
    @@ -165,8 +167,29 @@
    -
    + +
    +
    +
    + + + +
    +
    + +
    +
    + +
    +
    +
    \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/lesson/util/LessonDTOComparator.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/lesson/util/LessonDTOComparator.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/lesson/util/LessonDTOComparator.java (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -0,0 +1,45 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.lesson.util; + +import java.util.Comparator; + +import org.lamsfoundation.lams.lesson.dto.LessonDTO; + +/** + * The same as LessonComparator, but works for DTOs. + */ +public class LessonDTOComparator implements Comparator { + + @Override + public int compare(LessonDTO o1, LessonDTO o2) { + if ((o1 != null) && (o2 != null)) { + return (int) (o1.getLessonID() - o2.getLessonID()); + } else if (o1 != null) { + return 1; + } else { + return -1; + } + } +} \ No newline at end of file Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -r4ab52d60ee545b9b76bcc65f75c5a400f6105c30 -rbbcfb64b7bb6d251110a5a26299604958c4bc5b2 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 4ab52d60ee545b9b76bcc65f75c5a400f6105c30) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision bbcfb64b7bb6d251110a5a26299604958c4bc5b2) @@ -262,6 +262,7 @@ String lessonName = request.getParameter("lessonName"); int organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); long ldId = WebUtil.readLongParam(request, AttributeNames.PARAM_LEARNINGDESIGN_ID); + boolean introEnable = WebUtil.readBooleanParam(request, "introEnable", false); String introDescription = request.getParameter("introDescription"); boolean introImage = WebUtil.readBooleanParam(request, "introImage", false); @@ -276,6 +277,14 @@ Date schedulingDatetime = schedulingEnable ? MonitoringAction.LESSON_SCHEDULING_DATETIME_FORMAT.parse(request .getParameter("schedulingDatetime")) : null; + boolean precedingLessonEnable = WebUtil.readBooleanParam(request, "precedingLessonEnable", false); + Long precedingLessonId = WebUtil.readLongParam(request, "precedingLessonId", true); + boolean timeLimitEnableField = WebUtil.readBooleanParam(request, "timeLimitEnableField", false); + Integer timeLimitDaysField = WebUtil.readIntParam(request, "timeLimitDaysField", true); + boolean timeLimitIndividualField = WebUtil.readBooleanParam(request, "timeLimitIndividualField", false); + Integer timeLimitIndividual = timeLimitEnableField && timeLimitIndividualField ? timeLimitDaysField : null; + Integer timeLimitLesson = timeLimitEnableField && !timeLimitIndividualField ? timeLimitDaysField : null; + IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet() .getServletContext()); @@ -338,7 +347,7 @@ } Lesson lesson = monitoringService.initializeLesson(lessonInstanceName, introDescription, ldId, organisationId, userId, null, introEnable, introImage, portfolioEnable, presenceEnable, imEnable, - enableLiveEdit, notificationsEnable, null, null); + enableLiveEdit, notificationsEnable, timeLimitIndividual, precedingLessonId); monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation, learnerGroupInstanceName, lessonInstanceLearners, staffGroupInstanceName, staff, userId); @@ -347,8 +356,14 @@ if (schedulingDatetime == null) { monitoringService.startLesson(lesson.getLessonId(), userId); } else { + // if lesson should start in few days, set it here monitoringService.startLessonOnSchedule(lesson.getLessonId(), schedulingDatetime, userId); } + + // if lesson should finish in few days, set it here + if (timeLimitLesson != null) { + monitoringService.finishLessonOnSchedule(lesson.getLessonId(), timeLimitLesson, userId); + } } } @@ -670,7 +685,7 @@ response.getWriter().print(jsonObject); return null; } - + /** *

    *