Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r6950295e2d5e90ffae268faeae946718654ddc7b -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 6950295e2d5e90ffae268faeae946718654ddc7b) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -279,6 +279,9 @@ error.finish.date.passed =The time allocated for this lesson has expired. You cannot access it anymore. Contact the instructor for assistance. index.emailnotifications =Notifications index.emailnotifications.tooltip =Email notifications +index.conditions =Conditions +index.conditions.tooltip =Conditions of participation in lesson +label.conditions.box.title =Lesson "{0}" will only be available after these lesson(s) are completed: label.portrait.please.wait =Please wait label.portrait.take.snapshot.from.webcamera =Take portrait using Webcam label.portrait.configure =Configure Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java =================================================================== diff -u -r6950295e2d5e90ffae268faeae946718654ddc7b -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 6950295e2d5e90ffae268faeae946718654ddc7b) +++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -56,6 +56,7 @@ import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.UserOrganisationRole; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.CentralConstants; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.IndexUtils; @@ -300,7 +301,8 @@ // remove lessons which do not have preceding lessons completed Iterator> lessonIter = map.entrySet().iterator(); while (lessonIter.hasNext()) { - if (!lessonService.checkLessonReleaseConditions(lessonIter.next().getKey(), userId)) { + Entry entry = lessonIter.next(); + if (entry.getValue().isDependent() && !lessonService.checkLessonReleaseConditions(entry.getKey(), userId)) { lessonIter.remove(); } } @@ -340,28 +342,24 @@ Integer userRole = (contains(roles, Role.ROLE_GROUP_MANAGER)) ? Role.ROLE_GROUP_MANAGER : Role.ROLE_MONITOR; Map staffMap = getLessonService().getLessonsByOrgAndUserWithCompletedFlag(userId, orgId, userRole); + boolean isGroupManagerOrMonitor = contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR); for (IndexLessonBean bean : staffMap.values()) { if (map.containsKey(bean.getId())) { bean = map.get(bean.getId()); } List lessonLinks = bean.getLinks(); - if (lessonLinks == null) + if (lessonLinks == null) { lessonLinks = new ArrayList(); - if (stateId.equals(OrganisationState.ACTIVE)) { - if (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR)) { - lessonLinks.add(new IndexLinkBean("index.monitor", "javascript:openMonitorLesson(" + bean.getId() - + ")", null, "mycourses-monitor-img", null)); - - } - } else if (stateId.equals(OrganisationState.ARCHIVED)) { - if (contains(roles, Role.ROLE_GROUP_MANAGER)) { - lessonLinks.add(new IndexLinkBean("index.monitor", "javascript:openMonitorLesson(" + bean.getId() - + ")", null, "mycourses-monitor-img", null)); - } } + if ((isGroupManagerOrMonitor && stateId.equals(OrganisationState.ACTIVE)) + || (stateId.equals(OrganisationState.ARCHIVED) && contains(roles, Role.ROLE_GROUP_MANAGER))) { + lessonLinks.add(new IndexLinkBean("index.monitor", + "javascript:openMonitorLesson(" + bean.getId() + ")", null, "mycourses-monitor-img", null)); + } + // Adding lesson notifications links if enabled - if (bean.isEnableLessonNotifications() && (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR))) { + if (isGroupManagerOrMonitor && bean.isEnableLessonNotifications()) { String emailnotificationsUrl = Configuration.get(ConfigurationKeys.SERVER_URL) + "/monitoring/emailNotifications.do?method=getLessonView&lessonID=" + bean.getId() + "&KeepThis=true&TB_iframe=true&height=560&width=800"; @@ -370,9 +368,9 @@ } // Adding gradebook course monitor links if enabled - if ((contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR)) - && org.getEnableGradebookForMonitors() - || (parent != null && parent.getEnableGradebookForMonitors())) { + if (isGroupManagerOrMonitor + && (org.getEnableGradebookForMonitors() || (parent != null && parent + .getEnableGradebookForMonitors()))) { try { String encodedOrgName = URLEncoder.encode(URLEncoder.encode(org.getName(), "UTF8"), "UTF8"); String link = "javascript:openGradebookLessonMonitorPopup(" + "'" + encodedOrgName + "','" @@ -384,6 +382,15 @@ log.error("Error while encoding course name, skipping gradebook lesson monitor link", e); } } + + // Add lesson conditions thickbox if it has dependencies + if (isGroupManagerOrMonitor && bean.isDependent()) { + String conditionsLink = Configuration.get(ConfigurationKeys.SERVER_URL) + + "/lessonConditions.do?method=getIndexLessonConditions&" + CentralConstants.PARAM_LESSON_ID + + "=" + bean.getId() + "&KeepThis=true&TB_iframe=true&height=480&width=610"; + lessonLinks.add(new IndexLinkBean("index.conditions", conditionsLink, "thickbox" + orgId, + "mycourses-conditions-img", "index.conditions.tooltip")); + } if (lessonLinks.size() > 0) { bean.setLinks(lessonLinks); Index: lams_central/src/java/org/lamsfoundation/lams/web/LessonConditionsAction.java =================================================================== diff -u --- lams_central/src/java/org/lamsfoundation/lams/web/LessonConditionsAction.java (revision 0) +++ lams_central/src/java/org/lamsfoundation/lams/web/LessonConditionsAction.java (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -0,0 +1,113 @@ +/**************************************************************** + * 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.web; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.actions.DispatchAction; +import org.lamsfoundation.lams.index.IndexLessonBean; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.service.LessonService; +import org.lamsfoundation.lams.util.CentralConstants; +import org.lamsfoundation.lams.util.WebUtil; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * This Action takes care of operations on lesson conditional release based on preceding lesson completion. + * @author Marcin Cieslak + * + * @struts.action path="/lessonConditions" parameter="method" validate="false" + * @struts.action-forward name="indexLessonConditions" path="/indexLessonConditions.jsp" + */ +public class LessonConditionsAction extends DispatchAction { + private static final Logger logger = Logger.getLogger(LessonConditionsAction.class); + + private static final String FORWARD_INDEX_LESSON_CONDITION = "indexLessonConditions"; + + private static final String PARAM_PRECEDING_LESSONS = "precedingLessons"; + private static final String PARAM_PRECEDING_LESSON_ID = "precedingLessonId"; + + private static LessonService lessonService; + + /** + * Prepares data for thickbox displayed on Index page. + */ + public ActionForward getIndexLessonConditions(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + Long lessonId = WebUtil.readLongParam(request, CentralConstants.PARAM_LESSON_ID, false); + Lesson lesson = getLessonService().getLesson(lessonId); + List precedingLessons = new ArrayList(lesson.getPrecedingLessons().size()); + for (Lesson precedingLesson : lesson.getPrecedingLessons()) { + IndexLessonBean precedingLessonBean = new IndexLessonBean(precedingLesson.getLessonId(), + precedingLesson.getLessonName()); + precedingLessons.add(precedingLessonBean); + } + request.setAttribute(CentralConstants.PARAM_LESSON_ID, lesson.getLessonId()); + request.setAttribute(CentralConstants.PARAM_TITLE, lesson.getLessonName()); + request.setAttribute(LessonConditionsAction.PARAM_PRECEDING_LESSONS, precedingLessons); + + return mapping.findForward(LessonConditionsAction.FORWARD_INDEX_LESSON_CONDITION); + } + + /** + * Removes given lesson from dependecies and displays updated list in thickbox. + */ + public ActionForward removeLessonDependency(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + Long lessonId = WebUtil.readLongParam(request, CentralConstants.PARAM_LESSON_ID, false); + Long removedPrecedingLessonId = WebUtil.readLongParam(request, PARAM_PRECEDING_LESSON_ID, false); + + Lesson lesson = getLessonService().getLesson(lessonId); + Iterator precedingLessonIter = lesson.getPrecedingLessons().iterator(); + while (precedingLessonIter.hasNext()) { + if (precedingLessonIter.next().getLessonId().equals(removedPrecedingLessonId)) { + precedingLessonIter.remove(); + break; + } + } + + // after operation, display contents again + return getIndexLessonConditions(mapping, form, request, response); + } + + private LessonService getLessonService() { + if (LessonConditionsAction.lessonService == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + LessonConditionsAction.lessonService = (LessonService) ctx.getBean("lessonService"); + } + return LessonConditionsAction.lessonService; + } +} Index: lams_central/web/css/defaultHTML.css =================================================================== diff -u -rcb6d628cd53fe3d51e4f67cbaff7390651a048da -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/web/css/defaultHTML.css (.../defaultHTML.css) (revision cb6d628cd53fe3d51e4f67cbaff7390651a048da) +++ lams_central/web/css/defaultHTML.css (.../defaultHTML.css) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -1364,6 +1364,9 @@ .mycourses-notifications-img {background: url('../images/css/notifications_go.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; } +.mycourses-conditions-img {background: url('../images/css/conditions.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; +} + /* Date and time restriction area in monitor */ #restrictUsageDiv {font-size: 13px; padding-bottom: 10px; padding-left: 18px; padding-top: -5px;} #restrictUsageDiv :first-child {padding-bottom: 10px; padding-top: -5px;} Index: lams_central/web/css/defaultHTML_rtl.css =================================================================== diff -u -rcb6d628cd53fe3d51e4f67cbaff7390651a048da -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/web/css/defaultHTML_rtl.css (.../defaultHTML_rtl.css) (revision cb6d628cd53fe3d51e4f67cbaff7390651a048da) +++ lams_central/web/css/defaultHTML_rtl.css (.../defaultHTML_rtl.css) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -1357,6 +1357,9 @@ .mycourses-notifications-img {background: url('../images/css/notifications_go.png') no-repeat 0 3px; margin-right:5px; padding:5px 0px 5px 25px; } +.mycourses-conditions-img {background: url('../images/css/conditions.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; +} + /* Date and time restriction area in monitor */ #restrictUsageDiv {font-size: 13px; padding-bottom: 10px; padding-left: 18px; padding-top: -5px;} #restrictUsageDiv :first-child {padding-bottom: 10px; padding-top: -5px;} Index: lams_central/web/css/defaultMainHTML.css =================================================================== diff -u -r7329c82c5388fbb86b6a0a2b27a71151ee8f116e -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/web/css/defaultMainHTML.css (.../defaultMainHTML.css) (revision 7329c82c5388fbb86b6a0a2b27a71151ee8f116e) +++ lams_central/web/css/defaultMainHTML.css (.../defaultMainHTML.css) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -959,9 +959,10 @@ .mycourses-completed-img {background: url('../images/css/lesson_completed.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; } +.mycourses-conditions-img {background: url('../images/css/conditions.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; +} - /*IE style workarounds */ * html #header { /*layout of the header */ Index: lams_central/web/css/highContrast.css =================================================================== diff -u -r7329c82c5388fbb86b6a0a2b27a71151ee8f116e -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/web/css/highContrast.css (.../highContrast.css) (revision 7329c82c5388fbb86b6a0a2b27a71151ee8f116e) +++ lams_central/web/css/highContrast.css (.../highContrast.css) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -1361,6 +1361,9 @@ .mycourses-completed-img {background: url('../images/css/lesson_completed.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; } +.mycourses-conditions-img {background: url('../images/css/conditions.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; +} + /*IE style workarounds */ * html #content { Index: lams_central/web/css/highContrast_rtl.css =================================================================== diff -u -r7329c82c5388fbb86b6a0a2b27a71151ee8f116e -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/web/css/highContrast_rtl.css (.../highContrast_rtl.css) (revision 7329c82c5388fbb86b6a0a2b27a71151ee8f116e) +++ lams_central/web/css/highContrast_rtl.css (.../highContrast_rtl.css) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -1354,6 +1354,9 @@ .mycourses-completed-img {background: url('../images/css/lesson_completed.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; } +.mycourses-conditions-img {background: url('../images/css/conditions.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; +} + /*IE style workarounds */ * html #content { background-color:#fff; Index: lams_central/web/css/ramsthemeHTML.css =================================================================== diff -u -r7329c82c5388fbb86b6a0a2b27a71151ee8f116e -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_central/web/css/ramsthemeHTML.css (.../ramsthemeHTML.css) (revision 7329c82c5388fbb86b6a0a2b27a71151ee8f116e) +++ lams_central/web/css/ramsthemeHTML.css (.../ramsthemeHTML.css) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -293,6 +293,9 @@ .mycourses-addlesson-img {background: url('../images/ramsthemecss/mycourses_addlesson.jpg') no-repeat 0 3px; margin-right:5px; padding:5px 0px 5px 25px; } +.mycourses-conditions-img {background: url('../images/css/conditions.png') no-repeat 0 3px; margin-left:20px; margin-right:5px; padding:5px 0px 5px 25px; +} + /*layout of the forum tables with the colored table heading cell */ table.forum { width:93%; Index: lams_central/web/images/css/conditions.png =================================================================== diff -u Binary files differ Index: lams_central/web/indexLessonConditions.jsp =================================================================== diff -u --- lams_central/web/indexLessonConditions.jsp (revision 0) +++ lams_central/web/indexLessonConditions.jsp (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -0,0 +1,51 @@ +<%@ page contentType="text/html; charset=utf-8" language="java"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-lams" prefix="lams"%> + + + + + + + + + + +
+
+

+ + ${title} + +

+ + + + There are no dependencies for this lesson. + + +
    + +
  • + + +
  • +
    +
+
+
+
+
+ +
\ No newline at end of file Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml =================================================================== diff -u -r6950295e2d5e90ffae268faeae946718654ddc7b -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml (.../Lesson.hbm.xml) (revision 6950295e2d5e90ffae268faeae946718654ddc7b) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml (.../Lesson.hbm.xml) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -125,7 +125,7 @@ - + @@ -134,7 +134,7 @@ - + @@ -273,7 +273,9 @@ - SELECT l.lesson_id, l.name, l.description, l.lesson_state_id, lp.lesson_completed_flag, l.enable_lesson_notifications + + SELECT l.lesson_id, l.name, l.description, l.lesson_state_id, lp.lesson_completed_flag, l.enable_lesson_notifications, + (SELECT TRUE FROM lams_lesson_dependency ld WHERE ld.lesson_id = l.lesson_id LIMIT 1) AS dependent FROM (lams_lesson l, lams_learning_design ld, lams_group g, lams_user_group ug, lams_grouping gi) LEFT JOIN lams_learner_progress lp ON lp.user_id = ug.user_id AND lp.lesson_id = l.lesson_id WHERE l.learning_design_id = ld.learning_design_id @@ -294,7 +296,9 @@ - SELECT l.lesson_id, l.name, l.description, l.lesson_state_id, lp.lesson_completed_flag, l.enable_lesson_notifications + + SELECT l.lesson_id, l.name, l.description, l.lesson_state_id, lp.lesson_completed_flag, l.enable_lesson_notifications, + (SELECT TRUE FROM lams_lesson_dependency ld WHERE ld.lesson_id = l.lesson_id LIMIT 1) AS dependent FROM (lams_lesson l, lams_learning_design ld, lams_group g, lams_user_group ug, lams_grouping gi) LEFT JOIN lams_learner_progress lp ON lp.user_id = ug.user_id AND lp.lesson_id = l.lesson_id WHERE l.learning_design_id = ld.learning_design_id @@ -315,7 +319,9 @@ - SELECT l.lesson_id, l.name, l.description, l.lesson_state_id, lp.lesson_completed_flag, l.enable_lesson_notifications + + SELECT l.lesson_id, l.name, l.description, l.lesson_state_id, lp.lesson_completed_flag, l.enable_lesson_notifications, + (SELECT TRUE FROM lams_lesson_dependency ld WHERE ld.lesson_id = l.lesson_id LIMIT 1) AS dependent FROM (lams_lesson l, lams_learning_design ld) LEFT JOIN lams_learner_progress lp ON lp.user_id = :userId AND lp.lesson_id = l.lesson_id WHERE l.learning_design_id = ld.learning_design_id Index: lams_common/db/sql/create_lams_11_tables.sql =================================================================== diff -u -r6950295e2d5e90ffae268faeae946718654ddc7b -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 6950295e2d5e90ffae268faeae946718654ddc7b) +++ lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -1204,12 +1204,12 @@ , PRIMARY KEY (config_key) )TYPE=InnoDB; -CREATE TABLE lams_lesson_release ( +CREATE TABLE lams_lesson_dependency ( lesson_id BIGINT(20) , preceding_lesson_id BIGINT(20) - , CONSTRAINT FK_lams_lesson_release_1 FOREIGN KEY (lesson_id) + , CONSTRAINT FK_lams_lesson_dependency_1 FOREIGN KEY (lesson_id) REFERENCES lams_lesson (lesson_id) ON DELETE CASCADE ON UPDATE CASCADE - , CONSTRAINT FK_lams_lesson_release_2 FOREIGN KEY (preceding_lesson_id) + , CONSTRAINT FK_lams_lesson_dependency_2 FOREIGN KEY (preceding_lesson_id) REFERENCES lams_lesson (lesson_id) ON DELETE CASCADE ON UPDATE CASCADE , PRIMARY KEY (lesson_id,preceding_lesson_id) )TYPE=InnoDB; \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql =================================================================== diff -u -r6950295e2d5e90ffae268faeae946718654ddc7b -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql (.../patch02040006.sql) (revision 6950295e2d5e90ffae268faeae946718654ddc7b) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql (.../patch02040006.sql) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -111,12 +111,12 @@ values ('EnableServerRegistration', 'false', 'config.server2server.registration.enable', 'config.header.system', 'BOOLEAN', 1); -- LDEV-2782 Conditional release for lessons -CREATE TABLE lams_lesson_release ( +CREATE TABLE lams_lesson_dependency ( lesson_id BIGINT(20) , preceding_lesson_id BIGINT(20) - , CONSTRAINT FK_lams_lesson_release_1 FOREIGN KEY (lesson_id) + , CONSTRAINT FK_lams_lesson_dependency_1 FOREIGN KEY (lesson_id) REFERENCES lams_lesson (lesson_id) ON DELETE CASCADE ON UPDATE CASCADE - , CONSTRAINT FK_lams_lesson_release_2 FOREIGN KEY (preceding_lesson_id) + , CONSTRAINT FK_lams_lesson_dependency_2 FOREIGN KEY (preceding_lesson_id) REFERENCES lams_lesson (lesson_id) ON DELETE CASCADE ON UPDATE CASCADE , PRIMARY KEY (lesson_id,preceding_lesson_id) )TYPE=InnoDB; Index: lams_common/src/java/org/lamsfoundation/lams/index/IndexLessonBean.java =================================================================== diff -u -rcb6d628cd53fe3d51e4f67cbaff7390651a048da -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_common/src/java/org/lamsfoundation/lams/index/IndexLessonBean.java (.../IndexLessonBean.java) (revision cb6d628cd53fe3d51e4f67cbaff7390651a048da) +++ lams_common/src/java/org/lamsfoundation/lams/index/IndexLessonBean.java (.../IndexLessonBean.java) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -43,20 +43,27 @@ private Integer state; private boolean completed; private boolean enableLessonNotifications; + private boolean dependent; private List links; + public IndexLessonBean(Long id, String name) { + this.id = id; + this.name = name; + } + public IndexLessonBean(String name, String url) { this.name = name; this.url = url; } - public IndexLessonBean(Long id, String name, String description, Integer state, boolean completed, boolean enableLessonNotifications) { + public IndexLessonBean(Long id, String name, String description, Integer state, boolean completed, boolean enableLessonNotifications, boolean dependent) { this.id = id; this.name = name; this.description = description; this.state = state; this.completed = completed; this.enableLessonNotifications = enableLessonNotifications; + this.dependent = dependent; } public IndexLessonBean(Long id, String name, String description, String url, Integer state, boolean completed, @@ -151,4 +158,12 @@ public void setEnableLessonNotifications(boolean enableLessonNotifications) { this.enableLessonNotifications = enableLessonNotifications; } + + public boolean isDependent() { + return dependent; + } + + public void setDependent(boolean hasDependencies) { + this.dependent = hasDependencies; + } } Index: lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java =================================================================== diff -u -r6950295e2d5e90ffae268faeae946718654ddc7b -rc989378786b026ab4d78cd8064eaa6d7e63c4db6 --- lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java (.../LessonService.java) (revision 6950295e2d5e90ffae268faeae946718654ddc7b) +++ lams_common/src/java/org/lamsfoundation/lams/lesson/service/LessonService.java (.../LessonService.java) (revision c989378786b026ab4d78cd8064eaa6d7e63c4db6) @@ -777,8 +777,10 @@ lessonCompleted = lessonCompleted == null ? false : lessonCompleted.booleanValue(); Boolean enableLessonNotifications = (Boolean) tuple[5]; enableLessonNotifications = enableLessonNotifications == null ? false : enableLessonNotifications.booleanValue(); + Boolean dependent = (Boolean) tuple[6]; + dependent = dependent == null ? false : dependent.booleanValue(); IndexLessonBean bean = new IndexLessonBean(lessonId, lessonName, lessonDescription, lessonState, - lessonCompleted, enableLessonNotifications); + lessonCompleted, enableLessonNotifications, dependent); map.put(new Long(lessonId), bean); } }