Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2b350be06485bbfe1da8c66def9fc2cd81e883a8) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -496,6 +496,6 @@ error.context.exists =This URL context is taken config.learner.collapsible.progress.panel =Set collapsible panel for progress bar in Learner config.authoring.suffix =Add unique suffix when importing Learning Designs -config.authoring.single.activity =Allow creating single activity lessons +config.authoring.single.activity =Enable single activity lessons #======= End labels: Exported 490 labels for en AU ===== Index: lams_admin/conf/xdoclet/struts-forms.xml =================================================================== diff -u -r4aa7a60c90a430b0c6a20a46ca8cfccbe302edbf -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_admin/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision 4aa7a60c90a430b0c6a20a46ca8cfccbe302edbf) +++ lams_admin/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -14,6 +14,7 @@ + Index: lams_admin/web/organisation/createOrEdit.jsp =================================================================== diff -u -rcb6d628cd53fe3d51e4f67cbaff7390651a048da -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_admin/web/organisation/createOrEdit.jsp (.../createOrEdit.jsp) (revision cb6d628cd53fe3d51e4f67cbaff7390651a048da) +++ lams_admin/web/organisation/createOrEdit.jsp (.../createOrEdit.jsp) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -119,6 +119,12 @@ + + + + + + Index: lams_build/lib/lams/lams-monitoring.jar =================================================================== diff -u -r7c54f2f8ceb8616ab1ba941f37af07ce79b1c29c -r430f979ac0574e45242bd6e3df353d8592276121 Binary files differ Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -r430f979ac0574e45242bd6e3df353d8592276121 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== diff -u -rdfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision dfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -32,7 +32,6 @@ import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -43,7 +42,6 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.authoring.IObjectExtractor; -import org.lamsfoundation.lams.authoring.dto.ToolDTO; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ActivityEvaluation; @@ -94,7 +92,9 @@ import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.service.ILamsCoreToolService; +import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.Workspace; import org.lamsfoundation.lams.usermanagement.WorkspaceFolder; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.exception.UserAccessDeniedException; @@ -1969,19 +1969,45 @@ } /** - * Creates a LD with only one, given activity. + * Creates a LD with only one, given activity. If organisation is given, the LD will not be stored in user folder, + * but will be put straight into run sequences folder of the organisation. */ @Override @SuppressWarnings("unchecked") public Long insertSingleActivityLearningDesign(String learningDesignTitle, Long toolID, Long toolContentID, - String contentFolderID) { + String contentFolderID, Integer organisationID) { Integer userID = AuthoringService.getUserId(); User user = (User) baseDAO.find(User.class, userID); LearningDesign learningDesign = new LearningDesign(null, null, null, learningDesignTitle, null, null, 1, false, - false, null, null, 1, new Date(), Configuration.get(ConfigurationKeys.SERVER_VERSION_NUMBER), user, + false, null, null, null, new Date(), Configuration.get(ConfigurationKeys.SERVER_VERSION_NUMBER), user, user, null, null, null, null, null, null, null, null, null, null, contentFolderID, false, null, 1); - learningDesign.setWorkspaceFolder(user.getWorkspace().getDefaultFolder()); + + WorkspaceFolder folder = null; + + if (organisationID == null) { + folder = user.getWorkspace().getDefaultFolder(); + learningDesign.setCopyTypeID(LearningDesign.COPY_TYPE_NONE); + } else { + learningDesign.setCopyTypeID(LearningDesign.COPY_TYPE_LESSON); + // taken from MonitoringService#initializeLesson() + int MAX_DEEP_LEVEL_FOLDER = 50; + Organisation organisation = (Organisation) baseDAO.find(Organisation.class, organisationID); + for (int idx = 0; idx < MAX_DEEP_LEVEL_FOLDER; idx++) { + if ((organisation == null) || (folder != null)) { + break; + } + Workspace workspace = organisation.getWorkspace(); + if (workspace != null) { + folder = workspace.getDefaultRunSequencesFolder(); + } + if (folder == null) { + organisation = organisation.getParentOrganisation(); + } + } + } + + learningDesign.setWorkspaceFolder(folder); learningDesignDAO.insert(learningDesign); ToolActivity templateActivity = (ToolActivity) activityDAO.getTemplateActivityByLibraryID(toolID); @@ -2020,20 +2046,6 @@ } @Override - @SuppressWarnings("unchecked") - public List getAllToolDTOs() { - List tools = toolDAO.getAllTools(); - List result = new LinkedList(); - for (Tool tool : tools) { - if (tool.isValid()) { - ToolDTO dto = new ToolDTO(tool); - result.add(dto); - } - } - return result; - } - - @Override public String getToolAuthorUrl(Long toolID, Long toolContentID, String contentFolderID) { Tool tool = toolDAO.getToolByID(toolID); if (tool == null) { Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java =================================================================== diff -u -rdfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision dfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -35,6 +35,7 @@ import org.lamsfoundation.lams.learningdesign.dto.AuthoringActivityDTO; import org.lamsfoundation.lams.learningdesign.dto.ValidationErrorDTO; import org.lamsfoundation.lams.learningdesign.exception.LearningDesignException; +import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.WorkspaceFolder; import org.lamsfoundation.lams.usermanagement.exception.UserException; @@ -401,11 +402,9 @@ public String getUniqueNameForLearningDesign(String originalTitle, Integer workspaceFolderId); public Grouping getGroupingById(Long groupingID); - - public List getAllToolDTOs(); - + public String getToolAuthorUrl(Long toolID, Long toolContentID, String contentFolderID); public Long insertSingleActivityLearningDesign(String learningDesignTitle, Long toolID, Long toolContentID, - String contentFolderID); + String contentFolderID, Integer organisationID); } \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java =================================================================== diff -u -rdfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision dfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -350,16 +350,16 @@ Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); String contentFolderID = request.getParameter(AttributeNames.PARAM_CONTENT_FOLDER_ID); String learningDesignTitle = request.getParameter(AttributeNames.PARAM_TITLE); - // created the LD + Integer organisationID = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); + // create the LD and put it in Run Sequences folder in the given organisation Long learningDesignID = authoringService.insertSingleActivityLearningDesign(learningDesignTitle, toolID, - toolContentID, contentFolderID); + toolContentID, contentFolderID, organisationID); if (learningDesignID != null) { - Integer organisationID = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); Integer userID = getUserId(); - Lesson lesson = getMonitoringService().initializeLesson(learningDesignTitle, "", learningDesignID, - organisationID, userID, null, false, false, true, false, false, false, false, null, null); - Organisation organisation = getMonitoringService().getOrganisation(organisationID); User user = (User) getUserManagementService().findById(User.class, userID); + Lesson lesson = getMonitoringService().initializeLessonWithoutLDcopy(learningDesignTitle, "", + learningDesignID, user, null, false, false, true, false, false, false, false, null, null); + Organisation organisation = getMonitoringService().getOrganisation(organisationID); List staffList = new LinkedList(); staffList.add(user); Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 2b350be06485bbfe1da8c66def9fc2cd81e883a8) +++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -23,13 +23,14 @@ /* $Id$ */ package org.lamsfoundation.lams.web; +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -46,13 +47,14 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.authoring.dto.ToolDTO; -import org.lamsfoundation.lams.authoring.service.IAuthoringService; import org.lamsfoundation.lams.index.IndexLessonBean; import org.lamsfoundation.lams.index.IndexLinkBean; import org.lamsfoundation.lams.index.IndexOrgBean; +import org.lamsfoundation.lams.learningdesign.dto.LearningLibraryDTO; +import org.lamsfoundation.lams.learningdesign.dto.LibraryActivityDTO; +import org.lamsfoundation.lams.learningdesign.service.ILearningDesignService; import org.lamsfoundation.lams.lesson.Lesson; import org.lamsfoundation.lams.lesson.service.LessonService; -import org.lamsfoundation.lams.tool.Tool; import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.OrganisationState; import org.lamsfoundation.lams.usermanagement.OrganisationType; @@ -78,10 +80,18 @@ */ public class DisplayGroupAction extends Action { + // sorts Tool display names + private static final Comparator TOOL_NAME_COMPARATOR = new Comparator() { + @Override + public int compare(ToolDTO o1, ToolDTO o2) { + return o1.getToolDisplayName().toLowerCase().compareTo(o2.getToolDisplayName().toLowerCase()); + } + }; + private static Logger log = Logger.getLogger(DisplayGroupAction.class); private static IUserManagementService service; private static LessonService lessonService; - private static IAuthoringService authoringService; + private static ILearningDesignService learningDesignService; private Integer stateId = OrganisationState.ACTIVE; @SuppressWarnings({ "unchecked" }) @@ -127,11 +137,13 @@ true); } - request.setAttribute("tools", getAuthoringService().getAllToolDTOs()); request.setAttribute("orgBean", iob); request.setAttribute("allowSorting", allowSorting); - request.setAttribute("singleActivityLessonsEnabled", - Configuration.get(ConfigurationKeys.SINGLE_ACTIVITY_LESSONS_ENABLED)); + if (org.getEnableSingleActivityLessons() + && (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR))) { + // if sinble activity lessons are enabled, put sorted list of tools + request.setAttribute("tools", getToolDTOs(request.getRemoteUser())); + } } return mapping.findForward(forwardPath); @@ -178,8 +190,10 @@ + 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", "javascript:showAddLessonDialog(" - + org.getOrganisationId() + ")", "add-lesson-button", null, null)); + String name = org.getEnableSingleActivityLessons() ? "index.addlesson.single" : "index.addlesson"; + links.add(new IndexLinkBean(name, + "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() @@ -214,8 +228,10 @@ } else {// CLASS_TYPE if (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR)) { - links.add(new IndexLinkBean("index.addlesson", "javascript:showAddLessonDialog(" - + org.getOrganisationId() + ")", "add-lesson-button", null, null)); + String name = org.getEnableSingleActivityLessons() ? "index.addlesson.single" : "index.addlesson"; + links.add(new IndexLinkBean(name, + "javascript:showAddLessonDialog(" + org.getOrganisationId() + ")", "add-lesson-button", + null, null)); } // Adding gradebook course monitor links if enabled @@ -432,6 +448,30 @@ return false; } + /** + * Gets basic information on available tools: IDs and i18n names. + */ + private List getToolDTOs(String userName) throws IOException { + User user = (User) getService().findByProperty(User.class, "login", userName).get(0); + String languageCode = user.getLocale().getLanguageIsoCode(); + ArrayList learningLibraries = getLearningDesignService().getAllLearningLibraryDetails( + languageCode); + List tools = new ArrayList(); + for (LearningLibraryDTO learningLibrary : learningLibraries) { + // skip invalid and complex tools + if (learningLibrary.getValidFlag() && (learningLibrary.getTemplateActivities().size() == 1)) { + ToolDTO tool = new ToolDTO(); + tool.setToolId(learningLibrary.getLearningLibraryID()); + tool.setToolDisplayName(((LibraryActivityDTO) learningLibrary.getTemplateActivities().get(0)) + .getActivityTitle()); + tools.add(tool); + } + } + + Collections.sort(tools, DisplayGroupAction.TOOL_NAME_COMPARATOR); + return tools; + } + private IUserManagementService getService() { if (DisplayGroupAction.service == null) { WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() @@ -449,13 +489,13 @@ } return DisplayGroupAction.lessonService; } - - private IAuthoringService getAuthoringService() { - if (DisplayGroupAction.authoringService == null) { + + private ILearningDesignService getLearningDesignService() { + if (DisplayGroupAction.learningDesignService == null) { WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() .getServletContext()); - DisplayGroupAction.authoringService = (IAuthoringService) ctx.getBean("authoringService"); + DisplayGroupAction.learningDesignService = (ILearningDesignService) ctx.getBean("learningDesignService"); } - return DisplayGroupAction.authoringService; + return DisplayGroupAction.learningDesignService; } } \ No newline at end of file Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Organisation.hbm.xml =================================================================== diff -u -rcb6d628cd53fe3d51e4f67cbaff7390651a048da -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Organisation.hbm.xml (.../Organisation.hbm.xml) (revision cb6d628cd53fe3d51e4f67cbaff7390651a048da) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Organisation.hbm.xml (.../Organisation.hbm.xml) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -62,7 +62,7 @@ + not-null="true" length="1"> @hibernate.property column="admin_add_new_users" length="1" not-null="true" @@ -71,7 +71,7 @@ + not-null="true" length="1"> @hibernate.property column="admin_browse_all_users" length="1" not-null="true" @@ -80,15 +80,15 @@ + not-null="true" length="1"> @hibernate.property column="admin_change_status" length="1" not-null="true" @hibernate.property column="admin_create_guest" @@ -97,7 +97,7 @@ @hibernate.property column="enable_course_notifications" @@ -107,7 +107,7 @@ + not-null="true" length="1"> @hibernate.property column="enable_monitor_gradebook" length="1" not-null="true" @@ -116,12 +116,22 @@ + not-null="true" length="1"> @hibernate.property column="enable_learner_gradebook" length="1" not-null="true" + + + + @hibernate.property column="enable_single_activity_lessons" + length="1" not-null="true" + + + Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040017.sql =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040017.sql (.../patch02040017.sql) (revision 2b350be06485bbfe1da8c66def9fc2cd81e883a8) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040017.sql (.../patch02040017.sql) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -4,8 +4,8 @@ SET FOREIGN_KEY_CHECKS=0; -- LDEV-3070 Allow single activity lesson creation on redesigned index page -insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('SingleActivityLessonsEnabled','false', 'config.authoring.single.activity', 'config.header.features', 'BOOLEAN', 0); +ALTER TABLE lams_organisation ADD COLUMN enable_single_activity_lessons TINYINT(1) NOT NULL DEFAULT 0 + AFTER enable_learner_gradebook; -- If there were no errors, commit and restore autocommit to on SET FOREIGN_KEY_CHECKS=0; Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java =================================================================== diff -u -r1b117caf4135f53248542cbc97d71aac448f3de9 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java (.../LearningDesignService.java) (revision 1b117caf4135f53248542cbc97d71aac448f3de9) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java (.../LearningDesignService.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -219,10 +219,7 @@ Locale locale = LocaleContextHolder.getLocale(); if (log.isDebugEnabled()) { - if (locale != null) { - log.debug("internationaliseActivities: Locale has lang/country " + locale.getLanguage() + "," - + locale.getCountry()); - } else { + if (locale == null) { log.debug("internationaliseActivities: Locale missing."); } } Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/Organisation.java =================================================================== diff -u -ree6a40ada6ae3bea48ecdedc5cad0ce3e7a3f3d8 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/Organisation.java (.../Organisation.java) (revision ee6a40ada6ae3bea48ecdedc5cad0ce3e7a3f3d8) +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/Organisation.java (.../Organisation.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -96,6 +96,9 @@ /** persistent field */ private Boolean enableGradebookForLearners; + + /** persistent field */ + private Boolean enableSingleActivityLessons; /** persistent field */ private Date archivedDate; @@ -377,4 +380,11 @@ this.enableGradebookForLearners = enableGradebookForLearners; } -} + public Boolean getEnableSingleActivityLessons() { + return enableSingleActivityLessons; + } + + public void setEnableSingleActivityLessons(Boolean enableSingleActivityLessons) { + this.enableSingleActivityLessons = enableSingleActivityLessons; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 2b350be06485bbfe1da8c66def9fc2cd81e883a8) +++ lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -284,7 +284,4 @@ // CNG-26 Add to lams_configuration and set to false // if you don't want imported LD to have __ appended public static String SUFFIX_IMPORTED_LD = "SuffixImportedLD"; - - // LDEV-3070 Allow single activity lesson creation on redesigned index page - public static String SINGLE_ACTIVITY_LESSONS_ENABLED = "SingleActivityLessonsEnabled"; } \ No newline at end of file Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== diff -u -r1b117caf4135f53248542cbc97d71aac448f3de9 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 1b117caf4135f53248542cbc97d71aac448f3de9) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -59,6 +59,15 @@ public MessageService getMessageService(); /** + * Intialise lesson without creating Learning Design copy, i.e. the original LD will be used. + */ + public Lesson initializeLessonWithoutLDcopy(String lessonName, String lessonDescription, long learningDesignID, + User user, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, + Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, + Boolean liveEditEnabled, Boolean enableLessonNotifications, Integer scheduledNumberDaysToLessonFinish, + Lesson precedingLesson); + + /** * Initialize a new lesson so as to start the learning process. It needs to notify lams which learning design it * belongs to. The initialize process doesn't involve the setup of lesson class and organization. * @@ -95,32 +104,29 @@ Integer numberDaysToLessonFinish, Long precedingLessonId); /** - * Initialize a new lesson so as to start the learning process for a normal - * or preview learning session. It needs to notify lams which learning - * design it belongs to. The initialize process doesn't involve the setup of - * lesson class and organization. + * Initialize a new lesson so as to start the learning process for a normal or preview learning session. It needs to + * notify lams which learning design it belongs to. The initialize process doesn't involve the setup of lesson class + * and organization. * * @param creatorUserId * the user who want to create this lesson. * @param lessonPacket - * The WDDX packet containing the required initialisation - * paramaters + * The WDDX packet containing the required initialisation paramaters * @return WDDX message packet containing the Lesson ID * @throws Exception */ public String initializeLesson(Integer creatorUserId, String lessonPacket) throws Exception; /** - * Create new lesson according to the learning design specified by the user, - * but for a preview session rather than a normal learning session. The - * design is not assigned to any workspace folder. + * Create new lesson according to the learning design specified by the user, but for a preview session rather than a + * normal learning session. The design is not assigned to any workspace folder. */ public Lesson initializeLessonForPreview(String lessonName, String lessonDescription, long learningDesignId, - Integer userID, String customCSV, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled); + 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: + * Create a lession according to the input lession WDDX package. The sample package is following: *
      * 
* 135 @@ -130,23 +136,20 @@ * 3456 * *
- *
+ *
*

- * The lesson will includes creator who create this lesson as staff and - * learner. + * 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. + * 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. + * Setup the lesson class and organization for a lesson according to the input from monitoring GUI interface. * * @param lessonId * the lesson without lesson class and organization @@ -167,46 +170,39 @@ throws UserAccessDeniedException; /** - * Start the specified the lesson. It must be created before calling this - * service. + * Start the specified the lesson. It must be created before calling this service. * * @param lessonId * the specified the lesson id. * @param userId * checks that the user is a staff member for this lesson * @throws LamsToolServiceException - * the exception occurred during the lams and tool interaction - * to start a lesson. + * the exception occurred during the lams and tool interaction to start a lesson. */ public void startLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** - * Do any normal initialisation needed for gates and branching. Done both - * when a lesson is started, or for new activities added during a Live Edit. - * Returns a new MaxID for the design if needed. If MaxID is returned, - * update the design with this new value and save the whole design (as - * initialiseSystemActivities has changed the design). + * Do any normal initialisation needed for gates and branching. Done both when a lesson is started, or for new + * activities added during a Live Edit. Returns a new MaxID for the design if needed. If MaxID is returned, update + * the design with this new value and save the whole design (as initialiseSystemActivities has changed the design). */ public Integer startSystemActivity(Activity activity, Integer currentMaxId, Date lessonStartTime, String lessonName); /** *

- * Runs the system scheduler to start the scheduling for opening gate and - * closing gate. It invlovs a couple of steps to start the scheduler: + * Runs the system scheduler to start the scheduling for opening gate and closing gate. It invlovs a couple of steps + * to start the scheduler: *

- *
  • 1. Initialize the resource needed by scheduling job by setting them - * into the job data map.
  • 2. Create customized triggers for the - * scheduling.
  • 3. start the scheduling job
  • + *
  • 1. Initialize the resource needed by scheduling job by setting them into the job data map.
  • 2. Create + * customized triggers for the scheduling.
  • 3. start the scheduling job
  • * * @param scheduleGate * the gate that needs to be scheduled. * @param schedulingStartTime - * the time on which the gate open should be based if an offset - * is used. For starting a lesson, this is the lessonStartTime. - * For live edit, it is now. + * the time on which the gate open should be based if an offset is used. For starting a lesson, this is + * the lessonStartTime. For live edit, it is now. * @param lessonName - * the name lesson incorporating this gate - used for the - * description of the Quartz job. Optional. + * the name lesson incorporating this gate - used for the description of the Quartz job. Optional. * @returns An updated gate, that should be saved by the calling code. */ public ScheduleGateActivity runGateScheduler(ScheduleGateActivity scheduleGate, Date schedulingStartTime, @@ -237,11 +233,9 @@ throws UserAccessDeniedException; /** - * Finish a lesson.A Finished lesson can be viewed on the monitoring - * interface. It should be an "inactive" lesson. A Finished lesson is listed - * on the learner interface but all the learner can do is view the progress - * bar and do an export portfolio - they cannot access any of the tool - * screens. + * Finish a lesson.A Finished lesson can be viewed on the monitoring interface. It should be an "inactive" lesson. A + * Finished lesson is listed on the learner interface but all the learner can do is view the progress bar and do an + * export portfolio - they cannot access any of the tool screens. * * @param lessonId * @param userId @@ -252,85 +246,73 @@ public void finishLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** - * Set whether or not the export portfolio button is available in learner. - * Sets it to FALSE if learnerExportAvailable is null. Checks that the user - * is a staff member of this lesson before updating. + * Set whether or not the export portfolio button is available in learner. Sets it to FALSE if + * learnerExportAvailable is null. Checks that the user is a staff member of this lesson before updating. * * @param lessonId * @param userId * @param learnerExportAvailable - * @return new value for learnerExportAvailable. Normally will be same as - * input parameter, will only be different if the value cannot be - * updated for some reason. + * @return new value for learnerExportAvailable. Normally will be same as input parameter, will only be different if + * the value cannot be updated for some reason. */ public Boolean setLearnerPortfolioAvailable(long lessonId, Integer userId, Boolean learnerExportAvailable); /** - * Set whether or not the learner presence button is available in monitor. - * Sets it to FALSE if learnerExportAvailable is null. Checks that the user - * is a staff member of this lesson before updating. + * Set whether or not the learner presence button is available in monitor. Sets it to FALSE if + * learnerExportAvailable is null. Checks that the user is a staff member of this lesson before updating. * * @param lessonId * @param userId * @param learnerPresenceAvailable - * @return new value for learnerPresenceAvailable. Normally will be same as - * input parameter, will only be different if the value cannot be - * updated for some reason. + * @return new value for learnerPresenceAvailable. Normally will be same as input parameter, will only be different + * if the value cannot be updated for some reason. */ public Boolean setPresenceAvailable(long lessonId, Integer userId, Boolean learnerPresenceAvailable); /** - * Set whether or not the learner IM button is available in monitor. - * Sets it to FALSE if learnerExportAvailable is null. Checks that the user - * is a staff member of this lesson before updating. + * Set whether or not the learner IM button is available in monitor. Sets it to FALSE if learnerExportAvailable is + * null. Checks that the user is a staff member of this lesson before updating. * * @param lessonId * @param userId * @param learnerImPresenceAvailable - * @return new value for learnerPresenceImAvailable. Normally will be same as - * input parameter, will only be different if the value cannot be - * updated for some reason. + * @return new value for learnerPresenceImAvailable. Normally will be same as input parameter, will only be + * different if the value cannot be updated for some reason. */ public Boolean setPresenceImAvailable(long lessonId, Integer userId, Boolean learnerPresenceImAvailable); /** - * Set whether or not the live edit is available in monitor. - * Sets it to FALSE if learnerExportAvailable is null. Checks that the user - * is a staff member of this lesson before updating. + * Set whether or not the live edit is available in monitor. Sets it to FALSE if learnerExportAvailable is null. + * Checks that the user is a staff member of this lesson before updating. * * @param lessonId * @param userId * @param liveEditEnabled - * @return new value for liveEditEnabled. Normally will be same as - * input parameter, will only be different if the value cannot be - * updated for some reason. + * @return new value for liveEditEnabled. Normally will be same as input parameter, will only be different if the + * value cannot be updated for some reason. */ public Boolean setLiveEditEnabled(long lessonId, Integer userId, Boolean liveEditEnabled); - + /** - * Force Complete works on an individual user. The teacher may complete it - * up to a particular activity, or till the end of the sequence which - * activity id is null indicating complete to end. Note, the give activity - * will be complete as well. + * Force Complete works on an individual user. The teacher may complete it up to a particular activity, or till the + * end of the sequence which activity id is null indicating complete to end. Note, the give activity will be + * complete as well. * * @param learnerId * @param requesterId - * the user id of the person requesting the force complete. For - * security check + * the user id of the person requesting the force complete. For security check * @param lessonId * @param activityId - * force complete to this activity(this activity will be force - * complete as well). If null value, force will complete all - * activities in this lesson. + * force complete to this activity(this activity will be force complete as well). If null value, force + * will complete all activities in this lesson. * @return success message. */ public String forceCompleteLessonByUser(Integer learnerId, Integer requesterId, long lessonId, Long activityId); - + public String forceCompleteActivitiesByUser(Integer learnerId, Integer requesterId, long lessonId, Long activityId); - + /** - * Archive the specified lesson. When archived, the data is retained but the - * learners cannot access the details. + * Archive the specified lesson. When archived, the data is retained but the learners cannot access the details. * * @param lessonId * the specified the lesson id. @@ -348,8 +330,8 @@ public void unarchiveLesson(long lessonId, Integer userId); /** - * A lesson can only be suspended if it is started. The purpose of - * suspending is to hide the lesson from learners temporarily. + * A lesson can only be suspended if it is started. The purpose of suspending is to hide the lesson from learners + * temporarily. * * @param lessonId * the lesson ID which will be suspended. @@ -359,8 +341,8 @@ public void suspendLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** - * Unsuspend a lesson, which state must be Lesson.SUSPEND_STATE. Returns the - * lesson back to its previous state. Otherwise an exception will be thrown. + * Unsuspend a lesson, which state must be Lesson.SUSPEND_STATE. Returns the lesson back to its previous state. + * Otherwise an exception will be thrown. * * @param lessonId * @param userId @@ -370,9 +352,8 @@ /** *

    - * Teachers sometimes find that there are just too many "old" designs and - * wish to remove them and never access them again. This function disables - * the lesson - it does not remove the contents from the database + * Teachers sometimes find that there are just too many "old" designs and wish to remove them and never access them + * again. This function disables the lesson - it does not remove the contents from the database *

    * * @param lessonId @@ -383,11 +364,9 @@ public void removeLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** - * Set the gate to open to let all the learners through. This learning - * service is triggerred by the system scheduler. Will return true - * GateActivity (or subclass) object, rather than a hibernate proxy. This is - * needed so that the class can be returned to the web layer for proper - * handling. + * Set the gate to open to let all the learners through. This learning service is triggerred by the system + * scheduler. Will return true GateActivity (or subclass) object, rather than a hibernate proxy. This is needed so + * that the class can be returned to the web layer for proper handling. * * @param gate * the id of the gate we need to open. @@ -412,12 +391,11 @@ public GateActivity closeGate(Long gateId); /** - * This method returns the details for the given Lesson in WDDX format. - * Object inside the packet is a LessonDetailsDTO. + * This method returns the details for the given Lesson in WDDX format. Object inside the packet is a + * LessonDetailsDTO. * * @param lessonID - * The lesson_id of the Lesson for which the details have to be - * fetched + * The lesson_id of the Lesson for which the details have to be fetched * @param userID * The user who is fetching the Lesson details * @return String The requested details in wddx format @@ -450,74 +428,68 @@ * @throws IOException */ public String getLessonStaff(Long lessonID, Integer userID) throws IOException; - + /** * Returns users by search type criteria. It's sorted by first and last user names. * - * @param searchType one of 11 constants from MonitoringConstants defining search type + * @param searchType + * one of 11 constants from MonitoringConstants defining search type * @param lessonId * @param lessonIds * @param activityId * @param xDaystoFinish * @param orgId * @return */ - Collection getUsersByEmailNotificationSearchType(int searchType, Long lessonId, String[] lessonIds, Long activityId, Integer xDaystoFinish, Integer orgId); + Collection getUsersByEmailNotificationSearchType(int searchType, Long lessonId, String[] lessonIds, + Long activityId, Integer xDaystoFinish, Integer orgId); /** * This method returns the LearningDesign details for a given Lesson * * @param lessonID - * The lesson_id of the Lesson whose LearningDesign details are - * required + * The lesson_id of the Lesson whose LearningDesign details are required * @return String The requested details in wddx format * @throws IOException */ public String getLearningDesignDetails(Long lessonID) throws IOException; /** - * This method returns the progress information of all learners in a given - * Lesson. + * This method returns the progress information of all learners in a given Lesson. * * @param lessonID - * The lesson_id of the Lesson whose progress information is - * required + * The lesson_id of the Lesson whose progress information is required * @param userID * The user id of the user requesting the progress details * @param completedOnly - * true if the data we are affect is completed activities data (included completed time values). + * true if the data we are affect is completed activities data (included completed time values). * @return String The requested information in wddx format * @throws IOException */ public String getAllLearnersProgress(Long lessonID, Integer userID, Boolean completedOnly) throws IOException; /** - * This method returns the progress information of all learners in a given - * Lesson. + * This method returns the progress information of all learners in a given Lesson. * * @param lessonID - * The lesson_id of the Lesson whose progress information is - * required + * The lesson_id of the Lesson whose progress information is required * @param learnerID - * The learner_id of the class learner whose progress information is required - * If null, provide all learner's progress information. + * The learner_id of the class learner whose progress information is required If null, provide all + * learner's progress information. * @param userID * The user id of the user requesting the progress details * @return String The requested information in wddx format * @throws IOException */ public String getAllCompletedActivities(Long lessonID, Long learnerID, Integer userID) throws IOException; - /** - * This method returns a batch of progress information of learners in a - * given Lesson. It returns the first batch of users, using the learner's - * name as the sorting order. The batch size is determined by the - * LEARNER_PROGRESS_BATCH size in the database. + * This method returns a batch of progress information of learners in a given Lesson. It returns the first batch of + * users, using the learner's name as the sorting order. The batch size is determined by the LEARNER_PROGRESS_BATCH + * size in the database. * * @param lessonID - * The lesson_id of the Lesson whose progress information is - * required + * The lesson_id of the Lesson whose progress information is required * @param userID * The user id of the user requesting the progress details * @return String The requested information in wddx format @@ -526,14 +498,12 @@ public String getInitialLearnersProgress(Long lessonID, Integer userID) throws IOException; /** - * This method returns the next batch of progress information of learners in - * a given Lesson. The batch size is determined by the - * LEARNER_PROGRESS_BATCH size in the database, and the next batch starts at - * after the supplied user_id + * This method returns the next batch of progress information of learners in a given Lesson. The batch size is + * determined by the LEARNER_PROGRESS_BATCH size in the database, and the next batch starts at after the supplied + * user_id * * @param lessonID - * The lesson_id of the Lesson whose progress information is - * required + * The lesson_id of the Lesson whose progress information is required * @param lastUserID * The user id of the last user from the previous batch * @param userID @@ -544,35 +514,29 @@ public String getAdditionalLearnersProgress(Long lessonID, Integer lastUserID, Integer userID) throws IOException; /** - * This method is called when the user clicks the 'Contribute' tab in the - * monitoring enviornment. It returns a list of activities "in the order" - * they have to be performed and with additional information as to what kind - * of contribution (Define later content, Moderation, Contribution, - * Permission for gate activity, Chosen Grouing etc.) is reuired from the - * user(teacher/staff). + * This method is called when the user clicks the 'Contribute' tab in the monitoring enviornment. It returns a list + * of activities "in the order" they have to be performed and with additional information as to what kind of + * contribution (Define later content, Moderation, Contribution, Permission for gate activity, Chosen Grouing etc.) + * is reuired from the user(teacher/staff). * * @param lessonID - * The lesson_id of the Lesson for which the information has to - * be fetched. + * The lesson_id of the Lesson for which the information has to be fetched. * @return String The required information in WDDX format * @throws IOException */ public String getAllContributeActivities(Long lessonID) throws IOException, LearningDesignProcessorException; - + public List getAllContributeActivityDTO(Long lessonID); - + /** - * This method returns the url associated with the activity in the - * monitoring enviornment. This is the URL that opens up when the - * user/teacher clicks on the activity in the monitoring enviornment and - * then selects a learner OR in the LEARNER tab when a learner's activity is - * clicked. + * This method returns the url associated with the activity in the monitoring enviornment. This is the URL that + * opens up when the user/teacher clicks on the activity in the monitoring enviornment and then selects a learner OR + * in the LEARNER tab when a learner's activity is clicked. * * This is also known as the learner progress url. * * @param lessonID - * The lesson_id of the Lesson for which the information has to - * be fetched. + * The lesson_id of the Lesson for which the information has to be fetched. * @param activityID * The activity_id of the activity for which the URL is required * @param learnerID @@ -590,8 +554,7 @@ * This method returns the define later url for the given activity. * * @param lessonID - * The lesson_id of the Lesson for which the information has to - * be fetched. + * The lesson_id of the Lesson for which the information has to be fetched. * @param activityID * The activity_id of the Activity whose URL will be returned * @param userID @@ -606,8 +569,7 @@ * This method returns the monitor url for the given activity * * @param lessonID - * The lesson_id of the Lesson for which the information has to - * be fetched. + * The lesson_id of the Lesson for which the information has to be fetched. * @param activityID * The activity_id of the Activity whose URL will be returned * @param userID @@ -619,17 +581,14 @@ throws IOException, LamsToolServiceException; /** - * This method moves the learning design corresponding to the given Lesson - * into the specified workspaceFolder. But before this action is performed - * it checks whether the user is authorized to do so. If not, Flash is - * notified of the same. As of now it is assumed that only the owner of - * lesson/learning design can move it + * This method moves the learning design corresponding to the given Lesson into the specified workspaceFolder. But + * before this action is performed it checks whether the user is authorized to do so. If not, Flash is notified of + * the same. As of now it is assumed that only the owner of lesson/learning design can move it * * @param lessonID * The lesson_id of the Lesson which has to be moved * @param targetWorkspaceFolderID - * The workspace_folder_id of the WorkspaceFolder to which the - * lesson has to be moved + * The workspace_folder_id of the WorkspaceFolder to which the lesson has to be moved * @param userID * The user_id of the User who has requested this operation * @return String The acknowledgement message/error in WDDX format @@ -661,8 +620,8 @@ public Activity getActivityById(Long activityId); /** - * Return an activity object based on the requested id. Where possible, give - * it the type we want so that it can be cast properly. + * Return an activity object based on the requested id. Where possible, give it the type we want so that it can be + * cast properly. * * @param activityId * id of the activity. @@ -691,9 +650,8 @@ public String checkGateStatus(Long activityID, Long lessonID) throws IOException; /** - * Returns an acknowledgement that the gate has been released. Returns true - * if the gate has been released and false otherwise. This information is - * packaged in WDDX format + * Returns an acknowledgement that the gate has been released. Returns true if the gate has been released and false + * otherwise. This information is packaged in WDDX format * * @param activityID * The activity_id of the Activity whose gate must be checked @@ -704,8 +662,8 @@ public String releaseGate(Long activityID) throws IOException; /** - * Perform chosen grouping. The groups contains a list of Hashtable which - * contain following information for each group:
    + * Perform chosen grouping. The groups contains a list of Hashtable which contain following information for each + * group:
    *
      *
    1. List of learners in this group
    2. *
    3. Order ID
    4. @@ -722,8 +680,7 @@ // Preview Methods // --------------------------------------------------------------------- /** - * Create the lesson class and the staff class for a preview lesson. The - * lesson is not attached to any organisation. + * Create the lesson class and the staff class for a preview lesson. The lesson is not attached to any organisation. * * @param userID * User ID of the teacher running the preview. Mandatory. @@ -734,50 +691,43 @@ public abstract Lesson createPreviewClassForLesson(int userID, long lessonID) throws UserAccessDeniedException; /** - * Remove all the details for a particular preview lessons. The transaction - * handling for this method should be REQUIRES_NEW, which allows each lesson - * to be deleted separately. + * Remove all the details for a particular preview lessons. The transaction handling for this method should be + * REQUIRES_NEW, which allows each lesson to be deleted separately. * * @param lessonID * ID of the lesson which is the preview session. Mandatory. */ public abstract void deletePreviewLesson(long lessonID); /** - * Remove all the "old" preview lessons. Removes all preview lessons older - * than the number of days specified in the configuration file. + * Remove all the "old" preview lessons. Removes all preview lessons older than the number of days specified in the + * configuration file. *

      - * Calls deletePreviewLesson(long lessonID) to do the actual deletion, so if - * one lesson throws a database exception when deleting, the other lessons - * should delete okay (as deletePreviewLesson uses a REQUIRES_NEW - * transaction) + * Calls deletePreviewLesson(long lessonID) to do the actual deletion, so if one lesson throws a database exception + * when deleting, the other lessons should delete okay (as deletePreviewLesson uses a REQUIRES_NEW transaction) * * @return number of lessons deleted. */ public abstract int deleteAllOldPreviewLessons(); /* Supports the Chosen Groupings and Branching */ /** - * Get all the active learners in the lesson who are not in a group or in a - * branch. + * Get all the active learners in the lesson who are not in a group or in a branch. * - * If the activity is a grouping activity, then set useCreatingGrouping = - * true to base the list on the create grouping. Otherwise leave it false - * and it will use the grouping applied to the activity - this is used for + * If the activity is a grouping activity, then set useCreatingGrouping = true to base the list on the create + * grouping. Otherwise leave it false and it will use the grouping applied to the activity - this is used for * branching activities. * * @param activityID * @param lessonID * @param useCreateGrouping - * true/false for GroupingActivities, always false for - * non-GroupingActivities + * true/false for GroupingActivities, always false for non-GroupingActivities * @return Sorted set of Users, sorted by surname */ public SortedSet getClassMembersNotGrouped(Long lessonID, Long activityID, boolean useCreateGrouping); /** - * Add a new group to a grouping activity. If name already exists or the - * name is blank, does not add a new group. + * Add a new group to a grouping activity. If name already exists or the name is blank, does not add a new group. * * @param activityID * id of the activity @@ -789,9 +739,8 @@ throws LessonServiceException, MonitoringServiceException; /** - * Remove a group to from a grouping activity. If the group does not exists - * then nothing happens. If the group is already used (e.g. a tool session - * exists) then it throws a LessonServiceException. + * Remove a group to from a grouping activity. If the group does not exists then nothing happens. If the group is + * already used (e.g. a tool session exists) then it throws a LessonServiceException. * * @param activityID * id of the activity @@ -802,26 +751,23 @@ public abstract void removeGroup(Long activityID, Long groupID) throws LessonServiceException; /** - * Add learners to a group. Doesn't necessarily check if the user is already - * in another group. + * Add learners to a group. Doesn't necessarily check if the user is already in another group. */ public abstract void addUsersToGroup(Long activityID, Long groupID, String learnerIDs[]) throws LessonServiceException; /** - * Remove a user to a group. If the user is not in the group, then nothing - * is changed. + * Remove a user to a group. If the user is not in the group, then nothing is changed. * * @throws LessonServiceException */ public abstract void removeUsersFromGroup(Long activityID, Long groupID, String learnerIDs[]) throws LessonServiceException; /** - * Add learners to a branch. Doesn't necessarily check if the user is - * already in another branch. Assumes there should only be one group for - * this branch. Use for Teacher Chosen Branching. Don't use for Group Based - * Branching as there could be more than one group for the branch. + * Add learners to a branch. Doesn't necessarily check if the user is already in another branch. Assumes there + * should only be one group for this branch. Use for Teacher Chosen Branching. Don't use for Group Based Branching + * as there could be more than one group for the branch. * * @param sequenceActivityID * Activity id of the sequenceActivity representing this branch @@ -831,9 +777,8 @@ public void addUsersToBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException; /** - * Remove learners from a branch. Assumes there should only be one group for - * this branch. Use for Teacher Chosen Branching. Don't use for Group Based - * Branching as there could be more than one group for the branch. + * Remove learners from a branch. Assumes there should only be one group for this branch. Use for Teacher Chosen + * Branching. Don't use for Group Based Branching as there could be more than one group for the branch. * * @param sequenceActivityID * Activity id of the sequenceActivity representing this branch @@ -843,15 +788,14 @@ public void removeUsersFromBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException; /** - * Has anyone started this branch / branching activity ? Irrespective of the - * groups. Used to determine if a branch mapping can be removed. + * Has anyone started this branch / branching activity ? Irrespective of the groups. Used to determine if a branch + * mapping can be removed. */ public boolean isActivityAttempted(Activity activity) throws LessonServiceException; /** - * Match group(s) to a branch. Doesn't necessarily check if the group is - * already assigned to another branch. Use for Group Based Branching and - * define later. + * Match group(s) to a branch. Doesn't necessarily check if the group is already assigned to another branch. Use for + * Group Based Branching and define later. * * @param sequenceActivityID * Activity id of the sequenceActivity representing this branch @@ -861,8 +805,8 @@ public void addGroupToBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException; /** - * Remove group / branch mapping. Cannot be done if any users in the group - * have started the branch. Used for group based branching in define later. + * Remove group / branch mapping. Cannot be done if any users in the group have started the branch. Used for group + * based branching in define later. * * @param sequenceActivityID * Activity id of the sequenceActivity representing this branch @@ -872,20 +816,17 @@ public void removeGroupFromBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException; /** - * Get all the groups that exist for the related grouping activity that have - * not been allocated to a branch. + * Get all the groups that exist for the related grouping activity that have not been allocated to a branch. * * @param branchingActivityID * Activity id of the branchingActivity */ public SortedSet getGroupsNotAssignedToBranch(Long branchingActivityID) throws LessonServiceException; /** - * Get the list of users who have attempted an activity. This is based on - * the progress engine records. This will give the users in all tool - * sessions for an activity (if it is a tool activity) or it will give all - * the users who have attempted an activity that doesn't have any tool - * sessions, i.e. system activities such as branching. + * Get the list of users who have attempted an activity. This is based on the progress engine records. This will + * give the users in all tool sessions for an activity (if it is a tool activity) or it will give all the users who + * have attempted an activity that doesn't have any tool sessions, i.e. system activities such as branching. */ public List getLearnersHaveAttemptedActivity(Activity activity) throws LessonServiceException; @@ -895,17 +836,17 @@ /** * Set a groups name */ - public void setGroupName(Long groupID, String name); - - /** Open Time Chart */ - public Boolean openTimeChart(long lessonId, Integer userId) throws UserAccessDeniedException; + public void setGroupName(Long groupID, String name); - /** Get Organisation by organisationId */ - public Organisation getOrganisation(Integer organisationId); - - public void initToolSessionIfSuitable(ToolActivity activity, Lesson lesson); - - /** + /** Open Time Chart */ + public Boolean openTimeChart(long lessonId, Integer userId) throws UserAccessDeniedException; + + /** Get Organisation by organisationId */ + public Organisation getOrganisation(Integer organisationId); + + public void initToolSessionIfSuitable(ToolActivity activity, Lesson lesson); + + /** * Used in admin to clone lessons using the given lesson Ids (from another group) into the given group. Given staff * and learner ids should already be members of the group. * Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== diff -u -r1b117caf4135f53248542cbc97d71aac448f3de9 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 1b117caf4135f53248542cbc97d71aac448f3de9) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -437,19 +437,16 @@ // Don't use unlimited loop to avoid dead lock. For instance, orgA // is orgB parent, but orgB parent is orgA as well. for (int idx = 0; idx < MAX_DEEP_LEVEL_FOLDER; idx++) { - if (org != null) { - Workspace workspace = org.getWorkspace(); - if (workspace != null) { - runSeqFolder = workspace.getDefaultRunSequencesFolder(); - } - if (runSeqFolder == null) { - org = org.getParentOrganisation(); - } else { - break; - } - } else { + if ((org == null) || (runSeqFolder != null)) { break; } + Workspace workspace = org.getWorkspace(); + if (workspace != null) { + runSeqFolder = workspace.getDefaultRunSequencesFolder(); + } + if (runSeqFolder == null) { + org = org.getParentOrganisation(); + } } } @@ -485,6 +482,28 @@ learnerPresenceAvailable, learnerImAvailable, liveEditEnabled, null, null, null); } + /** + * Intialise lesson without creating Learning Design copy, i.e. the original LD will be used. + */ + public Lesson initializeLessonWithoutLDcopy(String lessonName, String lessonDescription, long learningDesignID, + User user, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, + Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, + Boolean liveEditEnabled, Boolean enableLessonNotifications, Integer scheduledNumberDaysToLessonFinish, + Lesson precedingLesson) { + LearningDesign learningDesign = authoringService.getLearningDesign(learningDesignID); + if (learningDesign == null) { + throw new MonitoringServiceException("Learning design for id=" + learningDesignID + + " is missing. Unable to initialize lesson."); + } + Lesson lesson = createNewLesson(lessonName, lessonDescription, user, learningDesign, + enableLessonIntro, displayDesignImage, learnerExportAvailable, learnerPresenceAvailable, + learnerImAvailable, liveEditEnabled, enableLessonNotifications, scheduledNumberDaysToLessonFinish, + precedingLesson); + auditAction(MonitoringService.AUDIT_LESSON_CREATED_KEY, new Object[] { lessonName, learningDesign.getTitle(), + learnerExportAvailable }); + return lesson; + } + public Lesson initializeLesson(String lessonName, String lessonDescription, LearningDesign originalLearningDesign, User user, WorkspaceFolder workspaceFolder, int copyType, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, @@ -1353,7 +1372,7 @@ Activity parentActivity = stopActivity.getParentActivity(); // if user is moved into branch, see if he is allowed to do that - if (parentActivity != null && parentActivity.isSequenceActivity()) { + if ((parentActivity != null) && parentActivity.isSequenceActivity()) { SequenceActivity sequenceActivity = (SequenceActivity) parentActivity; Group group = sequenceActivity.getSoleGroupForBranch(); if ((group == null) || !group.hasLearner(learner)) { @@ -1390,13 +1409,13 @@ return stopReason != null ? stopReason : messageService .getMessage(MonitoringService.FORCE_COMPLETE_STOP_MESSAGE_STOPPED_UNEXPECTEDLY); } - + /** * @throws LamsToolServiceException * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#forceCompleteLessonByUser(Integer,long,long) */ public String forceCompleteLessonByUser(Integer learnerId, Integer requesterId, long lessonId, Long activityId) { - //TODO: REMOVE THIS METHOD AFTER OLD, FLASH MONITORING IS REMOVED + // TODO: REMOVE THIS METHOD AFTER OLD, FLASH MONITORING IS REMOVED Lesson lesson = lessonDAO.getLesson(new Long(lessonId)); checkOwnerOrStaffMember(requesterId, lesson, "force complete"); @@ -1415,8 +1434,8 @@ Activity currentActivity = learnerProgress.getCurrentActivity(); String stopReason = null; if (currentActivity != null) { - stopReason = forceCompleteActivity(learner, lessonId, learnerProgress, currentActivity, - stopActivity, new ArrayList()); + stopReason = forceCompleteActivity(learner, lessonId, learnerProgress, currentActivity, stopActivity, + new ArrayList()); } return stopReason != null ? stopReason : messageService Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java =================================================================== diff -u -rd5b13766f602aa85ed8be456dfab8defa9b2ecc6 -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision d5b13766f602aa85ed8be456dfab8defa9b2ecc6) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -889,7 +889,9 @@ dacoQuestionList.addAll(questions); sessionMap.put(DacoConstants.ATTR_DACO_FORM, dacoForm); - + request.getSession().setAttribute(AttributeNames.PARAM_NOTIFY_CLOSE_URL, + request.getParameter(AttributeNames.PARAM_NOTIFY_CLOSE_URL)); + return mapping.findForward(DacoConstants.SUCCESS); } Index: lams_tool_daco/web/pages/authoring/authoring.jsp =================================================================== diff -u -r701ee9220cb7323ae5abe5234baa5a50a56a617b -r430f979ac0574e45242bd6e3df353d8592276121 --- lams_tool_daco/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 701ee9220cb7323ae5abe5234baa5a50a56a617b) +++ lams_tool_daco/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 430f979ac0574e45242bd6e3df353d8592276121) @@ -95,7 +95,8 @@ + contentFolderID="${formBean.contentFolderID}" + cancelConfirmMsgKey="message.authoring.cancel.save" />