Index: lams_admin/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_admin/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_admin/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_admin/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_admin/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision d56929f06ad90a63082d514e6521adc175f3de27)
+++ lams_admin/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -143,50 +191,6 @@
- Help tag
- Help tag
-
-
- help
- org.lamsfoundation.lams.web.tag.HelpTag
- empty
-
-
- Help tag
- module
- false
-
- true
-
-
-
- Help tag
- toolSignature
- false
-
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
-
-
-
Checks whether Flash enabled for learner
Checks whether Flash enabled for learner
Index: lams_build/lib/lams/lams-central.jar
===================================================================
diff -u -r1edbb81f16cedfcc1326e4eca6e520b5b48cbddc -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
Binary files differ
Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -r0c8690c0ea9d545ef75c3f0391de11794e6ebfc9 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
Binary files differ
Index: lams_central/.classpath
===================================================================
diff -u -rf964c1062c52d93be83ace1aa252b45deff63d5e -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/.classpath (.../.classpath) (revision f964c1062c52d93be83ace1aa252b45deff63d5e)
+++ lams_central/.classpath (.../.classpath) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -6,7 +6,7 @@
-
+
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/dto/ToolDTO.java
===================================================================
diff -u
--- lams_central/src/java/org/lamsfoundation/lams/authoring/dto/ToolDTO.java (revision 0)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/dto/ToolDTO.java (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -0,0 +1,55 @@
+/****************************************************************
+ * 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.authoring.dto;
+
+import org.lamsfoundation.lams.tool.Tool;
+
+public class ToolDTO {
+ private Long toolId;
+ private String toolDisplayName;
+
+ public Long getToolId() {
+ return toolId;
+ }
+
+ public void setToolId(Long toolID) {
+ this.toolId = toolID;
+ }
+
+ public String getToolDisplayName() {
+ return toolDisplayName;
+ }
+
+ public void setToolDisplayName(String displayName) {
+ this.toolDisplayName = displayName;
+ }
+
+ public ToolDTO() {
+ }
+
+ public ToolDTO(Tool tool) {
+ toolId = tool.getToolId();
+ toolDisplayName = tool.getToolDisplayName();
+ }
+}
\ No newline at end of file
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java
===================================================================
diff -u -r1be0e401e81dae9a7c3197d9e4c820b4e0a8ef6d -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 1be0e401e81dae9a7c3197d9e4c820b4e0a8ef6d)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -32,6 +32,7 @@
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;
@@ -42,6 +43,7 @@
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;
@@ -72,7 +74,6 @@
import org.lamsfoundation.lams.learningdesign.dto.AuthoringActivityDTO;
import org.lamsfoundation.lams.learningdesign.dto.DesignDetailDTO;
import org.lamsfoundation.lams.learningdesign.dto.LearningDesignDTO;
-import org.lamsfoundation.lams.learningdesign.dto.LearningLibraryDTO;
import org.lamsfoundation.lams.learningdesign.dto.ValidationErrorDTO;
import org.lamsfoundation.lams.learningdesign.exception.LearningDesignException;
import org.lamsfoundation.lams.learningdesign.service.ILearningDesignService;
@@ -104,6 +105,7 @@
import org.lamsfoundation.lams.util.FileUtil;
import org.lamsfoundation.lams.util.FileUtilException;
import org.lamsfoundation.lams.util.MessageService;
+import org.lamsfoundation.lams.util.WebUtil;
import org.lamsfoundation.lams.util.wddx.FlashMessage;
import org.lamsfoundation.lams.util.wddx.WDDXProcessor;
import org.lamsfoundation.lams.util.wddx.WDDXTAGS;
@@ -118,2032 +120,1937 @@
*/
public class AuthoringService implements IAuthoringService, BeanFactoryAware {
- protected Logger log = Logger.getLogger(AuthoringService.class);
+ protected Logger log = Logger.getLogger(AuthoringService.class);
- /** Required DAO's */
- protected LearningDesignDAO learningDesignDAO;
+ /** Required DAO's */
+ protected LearningDesignDAO learningDesignDAO;
- protected LearningLibraryDAO learningLibraryDAO;
+ protected LearningLibraryDAO learningLibraryDAO;
- protected ActivityDAO activityDAO;
+ protected ActivityDAO activityDAO;
- protected BaseDAO baseDAO;
+ protected BaseDAO baseDAO;
- protected TransitionDAO transitionDAO;
+ protected TransitionDAO transitionDAO;
- protected ToolDAO toolDAO;
+ protected ToolDAO toolDAO;
- protected LicenseDAO licenseDAO;
+ protected LicenseDAO licenseDAO;
- protected GroupingDAO groupingDAO;
+ protected GroupingDAO groupingDAO;
- protected GroupDAO groupDAO;
+ protected GroupDAO groupDAO;
- protected CompetenceDAO competenceDAO;
+ protected CompetenceDAO competenceDAO;
- protected CompetenceMappingDAO competenceMappingDAO;
+ protected CompetenceMappingDAO competenceMappingDAO;
- protected SystemToolDAO systemToolDAO;
+ protected SystemToolDAO systemToolDAO;
- protected PedagogicalPlannerDAO pedagogicalPlannerDAO;
+ protected PedagogicalPlannerDAO pedagogicalPlannerDAO;
- protected ILamsCoreToolService lamsCoreToolService;
+ protected ILamsCoreToolService lamsCoreToolService;
- protected ILearningDesignService learningDesignService;
+ protected ILearningDesignService learningDesignService;
- protected MessageService messageService;
+ protected MessageService messageService;
- protected ILessonService lessonService;
+ protected ILessonService lessonService;
- protected IMonitoringService monitoringService;
+ protected IMonitoringService monitoringService;
- protected IWorkspaceManagementService workspaceManagementService;
+ protected IWorkspaceManagementService workspaceManagementService;
- protected ILogEventService logEventService;
+ protected ILogEventService logEventService;
- protected ToolContentIDGenerator contentIDGenerator;
+ protected ToolContentIDGenerator contentIDGenerator;
- /** The bean factory is used to create ObjectExtractor objects */
- protected BeanFactory beanFactory;
+ /** The bean factory is used to create ObjectExtractor objects */
+ protected BeanFactory beanFactory;
- public AuthoringService() {
+ public AuthoringService() {
- }
+ }
- public void setPedagogicalPlannerDAO(
- PedagogicalPlannerDAO pedagogicalPlannerDAO) {
- this.pedagogicalPlannerDAO = pedagogicalPlannerDAO;
- }
+ public void setPedagogicalPlannerDAO(PedagogicalPlannerDAO pedagogicalPlannerDAO) {
+ this.pedagogicalPlannerDAO = pedagogicalPlannerDAO;
+ }
- /***************************************************************************
- * Setter Methods
- **************************************************************************/
- /**
- * Set i18n MessageService
- */
- public void setMessageService(MessageService messageService) {
- this.messageService = messageService;
- }
+ /***************************************************************************
+ * Setter Methods
+ **************************************************************************/
+ /**
+ * Set i18n MessageService
+ */
+ public void setMessageService(MessageService messageService) {
+ this.messageService = messageService;
+ }
- /**
- * @param groupDAO
- * The groupDAO to set.
- */
- public void setGroupDAO(GroupDAO groupDAO) {
- this.groupDAO = groupDAO;
- }
+ /**
+ * @param groupDAO
+ * The groupDAO to set.
+ */
+ public void setGroupDAO(GroupDAO groupDAO) {
+ this.groupDAO = groupDAO;
+ }
- public void setGroupingDAO(GroupingDAO groupingDAO) {
- this.groupingDAO = groupingDAO;
- }
+ public void setGroupingDAO(GroupingDAO groupingDAO) {
+ this.groupingDAO = groupingDAO;
+ }
- /**
- *
- * @return
- */
- public CompetenceDAO getCompetenceDAO() {
- return competenceDAO;
- }
+ /**
+ *
+ * @return
+ */
+ public CompetenceDAO getCompetenceDAO() {
+ return competenceDAO;
+ }
- /**
- *
- * @param competenceDAO
- */
- public void setCompetenceDAO(CompetenceDAO competenceDAO) {
- this.competenceDAO = competenceDAO;
- }
+ /**
+ *
+ * @param competenceDAO
+ */
+ public void setCompetenceDAO(CompetenceDAO competenceDAO) {
+ this.competenceDAO = competenceDAO;
+ }
- /**
- *
- * @return
- */
- public CompetenceMappingDAO getCompetenceMappingDAO() {
- return competenceMappingDAO;
- }
+ /**
+ *
+ * @return
+ */
+ public CompetenceMappingDAO getCompetenceMappingDAO() {
+ return competenceMappingDAO;
+ }
- /**
- *
- * @param competenceMappingDAO
- */
- public void setCompetenceMappingDAO(
- CompetenceMappingDAO competenceMappingDAO) {
- this.competenceMappingDAO = competenceMappingDAO;
- }
+ /**
+ *
+ * @param competenceMappingDAO
+ */
+ public void setCompetenceMappingDAO(CompetenceMappingDAO competenceMappingDAO) {
+ this.competenceMappingDAO = competenceMappingDAO;
+ }
- /**
- * @param transitionDAO
- * The transitionDAO to set
- */
- public void setTransitionDAO(TransitionDAO transitionDAO) {
- this.transitionDAO = transitionDAO;
- }
+ /**
+ * @param transitionDAO
+ * The transitionDAO to set
+ */
+ public void setTransitionDAO(TransitionDAO transitionDAO) {
+ this.transitionDAO = transitionDAO;
+ }
- /**
- * @param learningDesignDAO
- * The learningDesignDAO to set.
- */
- public void setLearningDesignDAO(LearningDesignDAO learningDesignDAO) {
- this.learningDesignDAO = learningDesignDAO;
- }
+ /**
+ * @param learningDesignDAO
+ * The learningDesignDAO to set.
+ */
+ public void setLearningDesignDAO(LearningDesignDAO learningDesignDAO) {
+ this.learningDesignDAO = learningDesignDAO;
+ }
- /**
- * @param learningLibraryDAO
- * The learningLibraryDAO to set.
- */
- public void setLearningLibraryDAO(LearningLibraryDAO learningLibraryDAO) {
- this.learningLibraryDAO = learningLibraryDAO;
- }
+ /**
+ * @param learningLibraryDAO
+ * The learningLibraryDAO to set.
+ */
+ public void setLearningLibraryDAO(LearningLibraryDAO learningLibraryDAO) {
+ this.learningLibraryDAO = learningLibraryDAO;
+ }
- /**
- * @param baseDAO
- * The baseDAO to set.
- */
- public void setBaseDAO(BaseDAO baseDAO) {
- this.baseDAO = baseDAO;
- }
+ /**
+ * @param baseDAO
+ * The baseDAO to set.
+ */
+ public void setBaseDAO(BaseDAO baseDAO) {
+ this.baseDAO = baseDAO;
+ }
- /**
- * @param activityDAO
- * The activityDAO to set.
- */
- public void setActivityDAO(ActivityDAO activityDAO) {
- this.activityDAO = activityDAO;
- }
+ /**
+ * @param activityDAO
+ * The activityDAO to set.
+ */
+ public void setActivityDAO(ActivityDAO activityDAO) {
+ this.activityDAO = activityDAO;
+ }
- /**
- * @param toolDAO
- * The toolDAO to set
- */
- public void setToolDAO(ToolDAO toolDAO) {
- this.toolDAO = toolDAO;
- }
+ /**
+ * @param toolDAO
+ * The toolDAO to set
+ */
+ public void setToolDAO(ToolDAO toolDAO) {
+ this.toolDAO = toolDAO;
+ }
- /**
- * @param toolDAO
- * The toolDAO to set
- */
- public void setSystemToolDAO(SystemToolDAO systemToolDAO) {
- this.systemToolDAO = systemToolDAO;
- }
+ /**
+ * @param toolDAO
+ * The toolDAO to set
+ */
+ public void setSystemToolDAO(SystemToolDAO systemToolDAO) {
+ this.systemToolDAO = systemToolDAO;
+ }
- /**
- * @param licenseDAO
- * The licenseDAO to set
- */
- public void setLicenseDAO(LicenseDAO licenseDAO) {
- this.licenseDAO = licenseDAO;
- }
+ /**
+ * @param licenseDAO
+ * The licenseDAO to set
+ */
+ public void setLicenseDAO(LicenseDAO licenseDAO) {
+ this.licenseDAO = licenseDAO;
+ }
- public ILamsCoreToolService getLamsCoreToolService() {
- return lamsCoreToolService;
- }
+ public ILamsCoreToolService getLamsCoreToolService() {
+ return lamsCoreToolService;
+ }
- public void setLamsCoreToolService(ILamsCoreToolService lamsCoreToolService) {
- this.lamsCoreToolService = lamsCoreToolService;
- }
+ public void setLamsCoreToolService(ILamsCoreToolService lamsCoreToolService) {
+ this.lamsCoreToolService = lamsCoreToolService;
+ }
- public ILearningDesignService getLearningDesignService() {
- return learningDesignService;
- }
+ public ILearningDesignService getLearningDesignService() {
+ return learningDesignService;
+ }
- /**
- * @param learningDesignService
- * The Learning Design Validator Service
- */
- public void setLearningDesignService(
- ILearningDesignService learningDesignService) {
- this.learningDesignService = learningDesignService;
- }
+ /**
+ * @param learningDesignService
+ * The Learning Design Validator Service
+ */
+ public void setLearningDesignService(ILearningDesignService learningDesignService) {
+ this.learningDesignService = learningDesignService;
+ }
- public MessageService getMessageService() {
- return messageService;
- }
+ @Override
+ public MessageService getMessageService() {
+ return messageService;
+ }
- public ILessonService getLessonService() {
- return lessonService;
- }
+ public ILessonService getLessonService() {
+ return lessonService;
+ }
- public void setLessonService(ILessonService lessonService) {
- this.lessonService = lessonService;
- }
+ public void setLessonService(ILessonService lessonService) {
+ this.lessonService = lessonService;
+ }
- public void setMonitoringService(IMonitoringService monitoringService) {
- this.monitoringService = monitoringService;
- }
+ public void setMonitoringService(IMonitoringService monitoringService) {
+ this.monitoringService = monitoringService;
+ }
- public void setWorkspaceManagementService(
- IWorkspaceManagementService workspaceManagementService) {
- this.workspaceManagementService = workspaceManagementService;
- }
+ public void setWorkspaceManagementService(IWorkspaceManagementService workspaceManagementService) {
+ this.workspaceManagementService = workspaceManagementService;
+ }
- public void setLogEventService(ILogEventService logEventService) {
- this.logEventService = logEventService;
- }
+ public void setLogEventService(ILogEventService logEventService) {
+ this.logEventService = logEventService;
+ }
- /**
- * @param contentIDGenerator
- * The contentIDGenerator to set.
- */
- public void setContentIDGenerator(ToolContentIDGenerator contentIDGenerator) {
- this.contentIDGenerator = contentIDGenerator;
- }
+ /**
+ * @param contentIDGenerator
+ * The contentIDGenerator to set.
+ */
+ public void setContentIDGenerator(ToolContentIDGenerator contentIDGenerator) {
+ this.contentIDGenerator = contentIDGenerator;
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesign(java.lang.Long)
- */
- public LearningDesign getLearningDesign(Long learningDesignID) {
- return learningDesignDAO.getLearningDesignById(learningDesignID);
- }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesign(java.lang.Long)
+ */
+ @Override
+ public LearningDesign getLearningDesign(Long learningDesignID) {
+ return learningDesignDAO.getLearningDesignById(learningDesignID);
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#saveLearningDesign(org.lamsfoundation.lams.learningdesign.LearningDesign)
- */
- public void saveLearningDesign(LearningDesign learningDesign) {
- learningDesignDAO.insertOrUpdate(learningDesign);
- }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#saveLearningDesign(org.lamsfoundation.lams.learningdesign.LearningDesign)
+ */
+ @Override
+ public void saveLearningDesign(LearningDesign learningDesign) {
+ learningDesignDAO.insertOrUpdate(learningDesign);
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningDesigns()
- */
- public List getAllLearningDesigns() {
- return learningDesignDAO.getAllLearningDesigns();
- }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningDesigns()
+ */
+ @Override
+ public List getAllLearningDesigns() {
+ return learningDesignDAO.getAllLearningDesigns();
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningLibraries()
- */
- public List getAllLearningLibraries() {
- return learningLibraryDAO.getAllLearningLibraries();
- }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningLibraries()
+ */
+ @Override
+ public List getAllLearningLibraries() {
+ return learningLibraryDAO.getAllLearningLibraries();
+ }
- public BeanFactory getBeanFactory() {
- return beanFactory;
- }
+ public BeanFactory getBeanFactory() {
+ return beanFactory;
+ }
- public void setBeanFactory(BeanFactory beanFactory) {
- this.beanFactory = beanFactory;
- }
+ @Override
+ public void setBeanFactory(BeanFactory beanFactory) {
+ this.beanFactory = beanFactory;
+ }
- /***************************************************************************
- * Utility/Service Methods
- **************************************************************************/
+ /***************************************************************************
+ * Utility/Service Methods
+ **************************************************************************/
- /**
- * Helper method to retrieve the user data. Gets the id from the user
- * details in the shared session
- *
- * @return the user id
- */
- public static Integer getUserId() {
- HttpSession ss = SessionManager.getSession();
- UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER);
- return learner != null ? learner.getUserID() : null;
- }
+ /**
+ * Helper method to retrieve the user data. Gets the id from the user details in the shared session
+ *
+ * @return the user id
+ */
+ public static Integer getUserId() {
+ HttpSession ss = SessionManager.getSession();
+ UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ return learner != null ? learner.getUserID() : null;
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolOutputDefinitions(java.lang.Long,
- * int)
- */
- public String getToolOutputDefinitions(Long toolContentID,
- int definitionType) throws IOException {
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolOutputDefinitions(java.lang.Long, int)
+ */
+ @Override
+ public String getToolOutputDefinitions(Long toolContentID, int definitionType) throws IOException {
- SortedMap defns = lamsCoreToolService
- .getOutputDefinitionsFromTool(toolContentID, definitionType);
+ SortedMap defns = lamsCoreToolService.getOutputDefinitionsFromTool(toolContentID,
+ definitionType);
- ArrayList defnDTOList = new ArrayList(
- defns != null ? defns.size() : 0);
- if (defns != null) {
- for (ToolOutputDefinition defn : defns.values()) {
- defnDTOList.add(new ToolOutputDefinitionDTO(defn));
- }
- }
-
- FlashMessage flashMessage = new FlashMessage(
- "getToolOutputDefinitions", defnDTOList);
- return flashMessage.serializeMessage();
+ ArrayList defnDTOList = new ArrayList(
+ defns != null ? defns.size() : 0);
+ if (defns != null) {
+ for (ToolOutputDefinition defn : defns.values()) {
+ defnDTOList.add(new ToolOutputDefinitionDTO(defn));
+ }
}
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolOutputDefinitions(java.lang.Long,
- * int, java.lang.Long)
- */
- public String getToolOutputDefinitions(Long outputToolContentID,
- int definitionType, Long inputToolContentID) throws IOException {
+ FlashMessage flashMessage = new FlashMessage("getToolOutputDefinitions", defnDTOList);
+ return flashMessage.serializeMessage();
+ }
- SortedMap defns = lamsCoreToolService
- .getOutputDefinitionsFromToolFiltered(outputToolContentID,
- definitionType, inputToolContentID);
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolOutputDefinitions(java.lang.Long, int,
+ * java.lang.Long)
+ */
+ @Override
+ public String getToolOutputDefinitions(Long outputToolContentID, int definitionType, Long inputToolContentID)
+ throws IOException {
- ArrayList defnDTOList = new ArrayList(
- defns != null ? defns.size() : 0);
- if (defns != null) {
- for (ToolOutputDefinition defn : defns.values()) {
- defnDTOList.add(new ToolOutputDefinitionDTO(defn));
- }
- }
+ SortedMap defns = lamsCoreToolService.getOutputDefinitionsFromToolFiltered(
+ outputToolContentID, definitionType, inputToolContentID);
- FlashMessage flashMessage = new FlashMessage(
- "getToolOutputDefinitions", defnDTOList);
- return flashMessage.serializeMessage();
+ ArrayList defnDTOList = new ArrayList(
+ defns != null ? defns.size() : 0);
+ if (defns != null) {
+ for (ToolOutputDefinition defn : defns.values()) {
+ defnDTOList.add(new ToolOutputDefinitionDTO(defn));
+ }
}
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesignDetails(java.lang.Long,
- * java.lang.Long)
- */
- public String getLearningDesignDetails(Long learningDesignID,
- String languageCode) throws IOException {
- FlashMessage flashMessage = null;
+ FlashMessage flashMessage = new FlashMessage("getToolOutputDefinitions", defnDTOList);
+ return flashMessage.serializeMessage();
+ }
- LearningDesignDTO learningDesignDTO = learningDesignService
- .getLearningDesignDTO(learningDesignID, languageCode);
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesignDetails(java.lang.Long,
+ * java.lang.Long)
+ */
+ @Override
+ public String getLearningDesignDetails(Long learningDesignID, String languageCode) throws IOException {
+ FlashMessage flashMessage = null;
- if (learningDesignDTO == null) {
- flashMessage = FlashMessage.getNoSuchLearningDesignExists(
- "getLearningDesignDetails", learningDesignID);
- } else {
- flashMessage = new FlashMessage("getLearningDesignDetails",
- learningDesignDTO);
- }
- return flashMessage.serializeMessage();
+ LearningDesignDTO learningDesignDTO = learningDesignService
+ .getLearningDesignDTO(learningDesignID, languageCode);
+
+ if (learningDesignDTO == null) {
+ flashMessage = FlashMessage.getNoSuchLearningDesignExists("getLearningDesignDetails", learningDesignID);
+ } else {
+ flashMessage = new FlashMessage("getLearningDesignDetails", learningDesignDTO);
}
+ return flashMessage.serializeMessage();
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#isLearningDesignAvailable(LearningDesign,
- * java.lang.Integer)
- */
- public boolean isLearningDesignAvailable(LearningDesign design,
- Integer userID) throws LearningDesignException, IOException {
- if (design == null) {
- throw new LearningDesignException(FlashMessage
- .getNoSuchLearningDesignExists("getLearningDesignDetails",
- design.getLearningDesignId()).serializeMessage());
- }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#isLearningDesignAvailable(LearningDesign,
+ * java.lang.Integer)
+ */
+ @Override
+ public boolean isLearningDesignAvailable(LearningDesign design, Integer userID) throws LearningDesignException,
+ IOException {
+ if (design == null) {
+ throw new LearningDesignException(FlashMessage.getNoSuchLearningDesignExists("getLearningDesignDetails",
+ design.getLearningDesignId()).serializeMessage());
+ }
- if (design.getEditOverrideUser() != null
- && design.getEditOverrideLock() != null) {
- return design.getEditOverrideUser().getUserId().equals(userID) ? true
- : !design.getEditOverrideLock();
- } else {
- return true;
- }
+ if ((design.getEditOverrideUser() != null) && (design.getEditOverrideLock() != null)) {
+ return design.getEditOverrideUser().getUserId().equals(userID) ? true : !design.getEditOverrideLock();
+ } else {
+ return true;
}
+ }
- private void setLessonLock(LearningDesign design, boolean lock) {
- Lesson lesson = null;
+ private void setLessonLock(LearningDesign design, boolean lock) {
+ Lesson lesson = null;
- // lock active lesson
- Set lessons = design.getLessons();
- Iterator it = lessons.iterator();
+ // lock active lesson
+ Set lessons = design.getLessons();
+ Iterator it = lessons.iterator();
- while (it.hasNext()) {
- lesson = (Lesson) it.next();
- lesson.setLockedForEdit(lock);
- }
+ while (it.hasNext()) {
+ lesson = (Lesson) it.next();
+ lesson.setLockedForEdit(lock);
}
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#setupEditOnFlyLock(LearningDesign,
- * java.lang.Integer)
- */
- public boolean setupEditOnFlyLock(Long learningDesignID, Integer userID)
- throws LearningDesignException, UserException, IOException {
- User user = (User) baseDAO.find(User.class, userID);
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#setupEditOnFlyLock(LearningDesign,
+ * java.lang.Integer)
+ */
+ @Override
+ public boolean setupEditOnFlyLock(Long learningDesignID, Integer userID) throws LearningDesignException,
+ UserException, IOException {
+ User user = (User) baseDAO.find(User.class, userID);
- LearningDesign design = learningDesignID != null ? getLearningDesign(learningDesignID)
- : null;
+ LearningDesign design = learningDesignID != null ? getLearningDesign(learningDesignID) : null;
- if (isLearningDesignAvailable(design, userID)) {
+ if (isLearningDesignAvailable(design, userID)) {
- if (design.getLessons().isEmpty()) {
- throw new LearningDesignException(
- "There are no lessons attached to the design."); // TODO:
- // add
- // error
- // msg
- } else if (user == null) {
- throw new UserException(messageService.getMessage(
- "no.such.user.exist", new Object[] { userID }));
- }
+ if (design.getLessons().isEmpty()) {
+ throw new LearningDesignException("There are no lessons attached to the design."); // TODO:
+ // add
+ // error
+ // msg
+ } else if (user == null) {
+ throw new UserException(messageService.getMessage("no.such.user.exist", new Object[] { userID }));
+ }
- setLessonLock(design, true);
+ setLessonLock(design, true);
- // lock Learning Design
- design.setEditOverrideLock(true);
- design.setEditOverrideUser(user);
+ // lock Learning Design
+ design.setEditOverrideLock(true);
+ design.setEditOverrideUser(user);
- learningDesignDAO.update(design);
+ learningDesignDAO.update(design);
- return true;
- } else {
- return false;
- }
+ return true;
+ } else {
+ return false;
}
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#setupEditOnFlyGate(java.lang.Long,
- * java.lang.Integer)
- */
- public String setupEditOnFlyGate(Long learningDesignID, Integer userID)
- throws UserException, IOException {
- User user = (User) baseDAO.find(User.class, userID);
- LearningDesign design = learningDesignID != null ? getLearningDesign(learningDesignID)
- : null;
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#setupEditOnFlyGate(java.lang.Long,
+ * java.lang.Integer)
+ */
+ @Override
+ public String setupEditOnFlyGate(Long learningDesignID, Integer userID) throws UserException, IOException {
+ User user = (User) baseDAO.find(User.class, userID);
+ LearningDesign design = learningDesignID != null ? getLearningDesign(learningDesignID) : null;
- if (user == null) {
- throw new UserException(messageService.getMessage(
- "no.such.user.exist", new Object[] { userID }));
- }
+ if (user == null) {
+ throw new UserException(messageService.getMessage("no.such.user.exist", new Object[] { userID }));
+ }
- // parse Learning Design to find last read - only Activity
- EditOnFlyProcessor processor = new EditOnFlyProcessor(design,
- activityDAO);
+ // parse Learning Design to find last read - only Activity
+ EditOnFlyProcessor processor = new EditOnFlyProcessor(design, activityDAO);
- processor.parseLearningDesign();
+ processor.parseLearningDesign();
- ArrayList activities = processor.getLastReadOnlyActivity();
+ ArrayList activities = processor.getLastReadOnlyActivity();
- // add new System Gate after last read-only Activity
- addSystemGateAfterActivity(activities, design);
+ // add new System Gate after last read-only Activity
+ addSystemGateAfterActivity(activities, design);
- setLessonLock(design, false);
+ setLessonLock(design, false);
- learningDesignDAO.update(design);
+ learningDesignDAO.update(design);
- return new FlashMessage("setupEditOnFlyGate", true).serializeMessage();
- }
+ return new FlashMessage("setupEditOnFlyGate", true).serializeMessage();
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#finishEditOnFly(java.lang.Long,
- * java.lang.Integer)
- */
- public String finishEditOnFly(Long learningDesignID, Integer userID,
- boolean cancelled) throws IOException {
- FlashMessage flashMessage = null;
- Lesson lesson = null;
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#finishEditOnFly(java.lang.Long,
+ * java.lang.Integer)
+ */
+ @Override
+ public String finishEditOnFly(Long learningDesignID, Integer userID, boolean cancelled) throws IOException {
+ FlashMessage flashMessage = null;
+ Lesson lesson = null;
- LearningDesign design = learningDesignID != null ? learningDesignDAO
- .getLearningDesignById(learningDesignID) : null;
+ LearningDesign design = learningDesignID != null ? learningDesignDAO.getLearningDesignById(learningDesignID)
+ : null;
- User user = (User) baseDAO.find(User.class, userID);
- if (user == null) {
- flashMessage = FlashMessage.getNoSuchUserExists("finishEditOnFly",
- userID);
- }
+ User user = (User) baseDAO.find(User.class, userID);
+ if (user == null) {
+ flashMessage = FlashMessage.getNoSuchUserExists("finishEditOnFly", userID);
+ }
- if (design != null) { /*
- * only the user who is editing the design may
- * unlock it
- */
- if (design.getEditOverrideUser().equals(user)) {
- design.setEditOverrideLock(false);
- design.setEditOverrideUser(null);
+ if (design != null) { /*
+ * only the user who is editing the design may
+ * unlock it
+ */
+ if (design.getEditOverrideUser().equals(user)) {
+ design.setEditOverrideLock(false);
+ design.setEditOverrideUser(null);
- Set lessons = design.getLessons(); /* unlock lesson */
+ Set lessons = design.getLessons(); /* unlock lesson */
- Iterator it = lessons.iterator();
- while (it.hasNext()) {
- lesson = (Lesson) it.next();
- lesson.setLockedForEdit(false);
- }
+ Iterator it = lessons.iterator();
+ while (it.hasNext()) {
+ lesson = (Lesson) it.next();
+ lesson.setLockedForEdit(false);
+ }
- /*
- * parse Learning Design to find last read - only Activity (
- * hopefully the system gate in this case )
- */
- EditOnFlyProcessor processor = new EditOnFlyProcessor(design,
- activityDAO);
+ /*
+ * parse Learning Design to find last read - only Activity (
+ * hopefully the system gate in this case )
+ */
+ EditOnFlyProcessor processor = new EditOnFlyProcessor(design, activityDAO);
- processor.parseLearningDesign();
+ processor.parseLearningDesign();
- ArrayList activities = processor
- .getLastReadOnlyActivity();
+ ArrayList activities = processor.getLastReadOnlyActivity();
- // open and release waiting list on system gate
- GateActivity gate = null;
+ // open and release waiting list on system gate
+ GateActivity gate = null;
- if (activities != null) {
- if (!activities.isEmpty()
- && activities.get(0).isGateActivity()) {
- gate = (GateActivity) activities.get(0);
- }
- }
+ if (activities != null) {
+ if (!activities.isEmpty() && activities.get(0).isGateActivity()) {
+ gate = (GateActivity) activities.get(0);
+ }
+ }
- if (gate != null) {
- // remove inputted system gate
- design = removeTempSystemGate(gate, design);
- }
+ if (gate != null) {
+ // remove inputted system gate
+ design = removeTempSystemGate(gate, design);
+ }
- // LDEV-1899 only mark learners uncompleted if a change was
- // saved
- if (!cancelled) {
- // the lesson may now have additional activities on the end,
- // so clear any completed flags
- lessonService.performMarkLessonUncompleted(lesson
- .getLessonId());
- }
+ // LDEV-1899 only mark learners uncompleted if a change was
+ // saved
+ if (!cancelled) {
+ // the lesson may now have additional activities on the end,
+ // so clear any completed flags
+ lessonService.performMarkLessonUncompleted(lesson.getLessonId());
+ }
- initialiseToolActivityForRuntime(design, lesson);
- learningDesignDAO.insertOrUpdate(design);
+ initialiseToolActivityForRuntime(design, lesson);
+ learningDesignDAO.insertOrUpdate(design);
- flashMessage = new FlashMessage("finishEditOnFly", lesson
- .getLessonId());
+ flashMessage = new FlashMessage("finishEditOnFly", lesson.getLessonId());
- } else {
- flashMessage = FlashMessage.getNoSuchUserExists(
- "finishEditOnFly", userID);
- }
- } else {
+ } else {
+ flashMessage = FlashMessage.getNoSuchUserExists("finishEditOnFly", userID);
+ }
+ } else {
- flashMessage = FlashMessage.getNoSuchLearningDesignExists(
- "finishEditOnFly", learningDesignID);
- }
-
- return flashMessage.serializeMessage();
-
+ flashMessage = FlashMessage.getNoSuchLearningDesignExists("finishEditOnFly", learningDesignID);
}
- /**
- * Remove a temp. System Gate from the design. Requires removing the gate
- * from any learner progress entries - should only be a current activity but
- * remove it from previous and next, just in case.
- *
- * This will leave a "hole" in the learner progress, but the progress engine
- * can take care of that.
- *
- * @param gate
- * @param design
- * @return Learning Design with removed System Gate
- */
- public LearningDesign removeTempSystemGate(GateActivity gate,
- LearningDesign design) {
- // get transitions
- Transition toTransition = gate.getTransitionTo();
- Transition fromTransition = gate.getTransitionFrom();
+ return flashMessage.serializeMessage();
- // rearrange to-transition and/or delete redundant transition
- if (toTransition != null && fromTransition != null) {
+ }
- toTransition.setToActivity(fromTransition.getToActivity());
- fromTransition.getToActivity().setTransitionTo(toTransition);
- toTransition.setToUIID(toTransition.getToActivity()
- .getActivityUIID());
+ /**
+ * Remove a temp. System Gate from the design. Requires removing the gate from any learner progress entries - should
+ * only be a current activity but remove it from previous and next, just in case.
+ *
+ * This will leave a "hole" in the learner progress, but the progress engine can take care of that.
+ *
+ * @param gate
+ * @param design
+ * @return Learning Design with removed System Gate
+ */
+ @Override
+ public LearningDesign removeTempSystemGate(GateActivity gate, LearningDesign design) {
+ // get transitions
+ Transition toTransition = gate.getTransitionTo();
+ Transition fromTransition = gate.getTransitionFrom();
- design.getTransitions().remove(fromTransition);
- transitionDAO.update(toTransition);
+ // rearrange to-transition and/or delete redundant transition
+ if ((toTransition != null) && (fromTransition != null)) {
- } else if (toTransition != null && fromTransition == null) {
- toTransition.getFromActivity().setTransitionFrom(null);
- design.getTransitions().remove(toTransition);
- } else if (toTransition == null && fromTransition != null) {
- design.setFirstActivity(fromTransition.getToActivity());
- fromTransition.getToActivity().setTransitionTo(null);
- design.getTransitions().remove(fromTransition);
- }
+ toTransition.setToActivity(fromTransition.getToActivity());
+ fromTransition.getToActivity().setTransitionTo(toTransition);
+ toTransition.setToUIID(toTransition.getToActivity().getActivityUIID());
- // remove temp system gate
- design.getActivities().remove(gate);
+ design.getTransitions().remove(fromTransition);
+ transitionDAO.update(toTransition);
- // increment design version field
- design.setDesignVersion(design.getDesignVersion() + 1);
+ } else if ((toTransition != null) && (fromTransition == null)) {
+ toTransition.getFromActivity().setTransitionFrom(null);
+ design.getTransitions().remove(toTransition);
+ } else if ((toTransition == null) && (fromTransition != null)) {
+ design.setFirstActivity(fromTransition.getToActivity());
+ fromTransition.getToActivity().setTransitionTo(null);
+ design.getTransitions().remove(fromTransition);
+ }
- // need to remove it from any learner progress entries
- lessonService.removeProgressReferencesToActivity(gate);
+ // remove temp system gate
+ design.getActivities().remove(gate);
- return design;
- }
+ // increment design version field
+ design.setDesignVersion(design.getDesignVersion() + 1);
- /**
- * Add a temp. System Gate. to the design.
- *
- * @param activities
- * @param design
- */
- public void addSystemGateAfterActivity(ArrayList activities,
- LearningDesign design) {
- GateActivity gate = null;
+ // need to remove it from any learner progress entries
+ lessonService.removeProgressReferencesToActivity(gate);
- Integer syncType = new Integer(Activity.SYSTEM_GATE_ACTIVITY_TYPE);
- Integer activityType = new Integer(Activity.SYSTEM_GATE_ACTIVITY_TYPE);
- Integer maxId = design.getMaxID();
- // messageService.getMessage(MSG_KEY_SYNC_GATE );
- String title = "System Gate";
+ return design;
+ }
- SystemTool systemTool = systemToolDAO
- .getSystemToolByID(SystemTool.SYSTEM_GATE);
- Activity activity = activities.isEmpty() ? null : (Activity) activities
- .get(0);
+ /**
+ * Add a temp. System Gate. to the design.
+ *
+ * @param activities
+ * @param design
+ */
+ public void addSystemGateAfterActivity(ArrayList activities, LearningDesign design) {
+ GateActivity gate = null;
- try { /* create new System Gate Activity */
- gate = (GateActivity) Activity.getActivityInstance(syncType
- .intValue());
- gate.setActivityTypeId(activityType.intValue());
- gate.setActivityCategoryID(Activity.CATEGORY_SYSTEM);
- gate.setSystemTool(systemTool);
- gate.setActivityUIID(++maxId);
- gate.setTitle(title != null ? title : "Gate");
- gate.setGateOpen(false);
- gate.setWaitingLearners(null);
- gate.setGateActivityLevelId(GateActivity.LEARNER_GATE_LEVEL);
- gate.setApplyGrouping(false); // not nullable so default to false
- gate.setGroupingSupportType(Activity.GROUPING_SUPPORT_OPTIONAL);
- gate.setOrderId(null);
- gate.setDefineLater(Boolean.FALSE);
- gate.setCreateDateTime(new Date());
- gate.setRunOffline(Boolean.FALSE);
- gate.setReadOnly(Boolean.TRUE);
- gate.setLearningDesign(design);
+ Integer syncType = new Integer(Activity.SYSTEM_GATE_ACTIVITY_TYPE);
+ Integer activityType = new Integer(Activity.SYSTEM_GATE_ACTIVITY_TYPE);
+ Integer maxId = design.getMaxID();
+ // messageService.getMessage(MSG_KEY_SYNC_GATE );
+ String title = "System Gate";
- design.getActivities().add(gate);
- baseDAO.insert(gate);
+ SystemTool systemTool = systemToolDAO.getSystemToolByID(SystemTool.SYSTEM_GATE);
+ Activity activity = activities.isEmpty() ? null : (Activity) activities.get(0);
- Transition fromTransition;
- Transition newTransition = new Transition();
- Activity toActivity = null;
+ try { /* create new System Gate Activity */
+ gate = (GateActivity) Activity.getActivityInstance(syncType.intValue());
+ gate.setActivityTypeId(activityType.intValue());
+ gate.setActivityCategoryID(Activity.CATEGORY_SYSTEM);
+ gate.setSystemTool(systemTool);
+ gate.setActivityUIID(++maxId);
+ gate.setTitle(title != null ? title : "Gate");
+ gate.setGateOpen(false);
+ gate.setWaitingLearners(null);
+ gate.setGateActivityLevelId(GateActivity.LEARNER_GATE_LEVEL);
+ gate.setApplyGrouping(false); // not nullable so default to false
+ gate.setGroupingSupportType(Activity.GROUPING_SUPPORT_OPTIONAL);
+ gate.setOrderId(null);
+ gate.setDefineLater(Boolean.FALSE);
+ gate.setCreateDateTime(new Date());
+ gate.setRunOffline(Boolean.FALSE);
+ gate.setReadOnly(Boolean.TRUE);
+ gate.setLearningDesign(design);
- if (activity != null) {
- // update transitions
- fromTransition = activity.getTransitionFrom();
+ design.getActivities().add(gate);
+ baseDAO.insert(gate);
- if (fromTransition != null) {
- toActivity = fromTransition.getToActivity();
+ Transition fromTransition;
+ Transition newTransition = new Transition();
+ Activity toActivity = null;
- fromTransition.setToActivity(gate);
+ if (activity != null) {
+ // update transitions
+ fromTransition = activity.getTransitionFrom();
- fromTransition.setToUIID(gate.getActivityUIID());
- newTransition.setTransitionUIID(++maxId);
- newTransition.setFromActivity(gate);
- newTransition.setFromUIID(gate.getActivityUIID());
- newTransition.setToActivity(toActivity);
- newTransition.setToUIID(toActivity.getActivityUIID());
- newTransition.setLearningDesign(design);
+ if (fromTransition != null) {
+ toActivity = fromTransition.getToActivity();
- gate.setTransitionFrom(newTransition);
- toActivity.setTransitionTo(newTransition);
- gate.setTransitionTo(fromTransition);
+ fromTransition.setToActivity(gate);
- // set x / y position for Gate
- Integer x1 = activity.getXcoord() != null ? activity
- .getXcoord() : 0;
+ fromTransition.setToUIID(gate.getActivityUIID());
+ newTransition.setTransitionUIID(++maxId);
+ newTransition.setFromActivity(gate);
+ newTransition.setFromUIID(gate.getActivityUIID());
+ newTransition.setToActivity(toActivity);
+ newTransition.setToUIID(toActivity.getActivityUIID());
+ newTransition.setLearningDesign(design);
- Integer x2 = toActivity.getXcoord() != null ? toActivity
- .getXcoord() : 0;
+ gate.setTransitionFrom(newTransition);
+ toActivity.setTransitionTo(newTransition);
+ gate.setTransitionTo(fromTransition);
- gate.setXcoord(new Integer((x1.intValue() + 123 + x2
- .intValue()) / 2 - 13));
+ // set x / y position for Gate
+ Integer x1 = activity.getXcoord() != null ? activity.getXcoord() : 0;
- Integer y1 = activity.getYcoord() != null ? activity
- .getYcoord() : 0;
- Integer y2 = toActivity.getYcoord() != null ? toActivity
- .getYcoord() : 0;
+ Integer x2 = toActivity.getXcoord() != null ? toActivity.getXcoord() : 0;
- gate.setYcoord(new Integer((y1.intValue() + 50 + y2
- .intValue()) / 2));
+ gate.setXcoord(new Integer((x1.intValue() + 123 + x2.intValue()) / 2 - 13));
- } else {
- // fromTransition = newTransition;
+ Integer y1 = activity.getYcoord() != null ? activity.getYcoord() : 0;
+ Integer y2 = toActivity.getYcoord() != null ? toActivity.getYcoord() : 0;
- newTransition.setTransitionUIID(++maxId);
- newTransition.setFromActivity(activity);
- newTransition.setFromUIID(activity.getActivityUIID());
- newTransition.setToActivity(gate);
- newTransition.setToUIID(gate.getActivityUIID());
- newTransition.setLearningDesign(design);
+ gate.setYcoord(new Integer((y1.intValue() + 50 + y2.intValue()) / 2));
- activity.setTransitionFrom(fromTransition);
- gate.setTransitionTo(fromTransition);
+ } else {
+ // fromTransition = newTransition;
- Integer x1 = activity.getTransitionTo() != null ? activity
- .getTransitionTo().getFromActivity().getXcoord()
- : 0; /* set x/y position for Gate */
- Integer x2 = activity.getXcoord() != null ? activity
- .getXcoord() : 0;
+ newTransition.setTransitionUIID(++maxId);
+ newTransition.setFromActivity(activity);
+ newTransition.setFromUIID(activity.getActivityUIID());
+ newTransition.setToActivity(gate);
+ newTransition.setToUIID(gate.getActivityUIID());
+ newTransition.setLearningDesign(design);
- if (x1 != null && x2 != null) {
- gate.setXcoord(x2 >= x1 ? new Integer(
- x2.intValue() + 123 + 13 + 20) : new Integer(x2
- .intValue() - 13 - 20));
- } else {
- gate.setXcoord(new Integer(
- x2.intValue() + 123 + 13 + 20));
- }
+ activity.setTransitionFrom(fromTransition);
+ gate.setTransitionTo(fromTransition);
- gate.setYcoord(activity.getYcoord() + 25);
- }
+ Integer x1 = activity.getTransitionTo() != null ? activity.getTransitionTo().getFromActivity()
+ .getXcoord() : 0; /* set x/y position for Gate */
+ Integer x2 = activity.getXcoord() != null ? activity.getXcoord() : 0;
- } else {
- // no read-only activities insert gate at start of sequence
- fromTransition = newTransition;
+ if ((x1 != null) && (x2 != null)) {
+ gate.setXcoord(x2 >= x1 ? new Integer(x2.intValue() + 123 + 13 + 20) : new Integer(x2
+ .intValue() - 13 - 20));
+ } else {
+ gate.setXcoord(new Integer(x2.intValue() + 123 + 13 + 20));
+ }
- toActivity = design.getFirstActivity();
+ gate.setYcoord(activity.getYcoord() + 25);
+ }
- newTransition.setTransitionUIID(++maxId);
- newTransition.setToActivity(toActivity);
- newTransition.setToUIID(toActivity.getActivityUIID());
- newTransition.setFromActivity(gate);
- newTransition.setFromUIID(gate.getActivityUIID());
- newTransition.setLearningDesign(design);
+ } else {
+ // no read-only activities insert gate at start of sequence
+ fromTransition = newTransition;
- gate.setTransitionFrom(fromTransition);
- toActivity.setTransitionTo(fromTransition);
+ toActivity = design.getFirstActivity();
- // keep gate door closed to stop learner's from going past this
- // point
- gate.setGateOpen(false);
+ newTransition.setTransitionUIID(++maxId);
+ newTransition.setToActivity(toActivity);
+ newTransition.setToUIID(toActivity.getActivityUIID());
+ newTransition.setFromActivity(gate);
+ newTransition.setFromUIID(gate.getActivityUIID());
+ newTransition.setLearningDesign(design);
- // set gate as first activity in sequence
- design.setFirstActivity(gate);
+ gate.setTransitionFrom(fromTransition);
+ toActivity.setTransitionTo(fromTransition);
- // set x / y position for Gate
- Integer x1 = toActivity.getXcoord() != null ? toActivity
- .getXcoord() : 0;
+ // keep gate door closed to stop learner's from going past this
+ // point
+ gate.setGateOpen(false);
- Integer x2 = toActivity.getTransitionFrom() != null ? toActivity
- .getTransitionFrom().getToActivity().getXcoord()
- : null;
+ // set gate as first activity in sequence
+ design.setFirstActivity(gate);
- if (x1 != null && x2 != null) {
- gate.setXcoord(x2 >= x1 ? new Integer(
- x1.intValue() - 13 - 20) : new Integer(x1
- .intValue() + 123 + 13 + 20));
- } else {
- gate.setXcoord(new Integer(x1.intValue() - 13 - 20));
- }
+ // set x / y position for Gate
+ Integer x1 = toActivity.getXcoord() != null ? toActivity.getXcoord() : 0;
- gate.setYcoord(toActivity.getYcoord() + 25);
- }
+ Integer x2 = toActivity.getTransitionFrom() != null ? toActivity.getTransitionFrom().getToActivity()
+ .getXcoord() : null;
- design.getTransitions().add(newTransition);
- design.setMaxID(maxId);
+ if ((x1 != null) && (x2 != null)) {
+ gate.setXcoord(x2 >= x1 ? new Integer(x1.intValue() - 13 - 20) : new Integer(
+ x1.intValue() + 123 + 13 + 20));
+ } else {
+ gate.setXcoord(new Integer(x1.intValue() - 13 - 20));
+ }
- // increment design version field
- design.setDesignVersion(design.getDesignVersion() + 1);
+ gate.setYcoord(toActivity.getYcoord() + 25);
+ }
- if (gate != null) {
- activityDAO.update(gate);
- }
- if (activity != null) {
- activityDAO.update(activity);
- }
- if (toActivity != null) {
- activityDAO.update(toActivity);
- }
+ design.getTransitions().add(newTransition);
+ design.setMaxID(maxId);
- if (fromTransition != null && !fromTransition.equals(newTransition)) {
- baseDAO.update(fromTransition);
- }
- if (newTransition != null) {
- baseDAO.insert(newTransition);
- }
- if (design != null) {
- learningDesignDAO.insertOrUpdate(design);
- }
+ // increment design version field
+ design.setDesignVersion(design.getDesignVersion() + 1);
- } catch (NullPointerException npe) {
- log.error(npe.getMessage(), npe);
- }
+ if (gate != null) {
+ activityDAO.update(gate);
+ }
+ if (activity != null) {
+ activityDAO.update(activity);
+ }
+ if (toActivity != null) {
+ activityDAO.update(toActivity);
+ }
+ if ((fromTransition != null) && !fromTransition.equals(newTransition)) {
+ baseDAO.update(fromTransition);
+ }
+ if (newTransition != null) {
+ baseDAO.insert(newTransition);
+ }
+ if (design != null) {
+ learningDesignDAO.insertOrUpdate(design);
+ }
+
+ } catch (NullPointerException npe) {
+ log.error(npe.getMessage(), npe);
}
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getFirstUnattemptedActivity(org.lamsfoundation.lams.learningdesign.LearningDesign)
- */
- public Activity getFirstUnattemptedActivity(LearningDesign design)
- throws LearningDesignException {
- Activity activity = design.getFirstActivity();
+ }
- while (activity.getReadOnly() && activity.getTransitionFrom() != null) {
- activity = activity.getTransitionFrom().getToActivity();
- }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getFirstUnattemptedActivity(org.lamsfoundation.lams.learningdesign.LearningDesign)
+ */
+ @Override
+ public Activity getFirstUnattemptedActivity(LearningDesign design) throws LearningDesignException {
+ Activity activity = design.getFirstActivity();
- return activity;
+ while (activity.getReadOnly() && (activity.getTransitionFrom() != null)) {
+ activity = activity.getTransitionFrom().getToActivity();
}
- private void initialiseToolActivityForRuntime(LearningDesign design,
- Lesson lesson) throws MonitoringServiceException {
- Date now = new Date();
+ return activity;
+ }
- Set activities = design.getActivities();
- for (Iterator i = activities.iterator(); i.hasNext();) {
- Activity activity = (Activity) i.next();
+ private void initialiseToolActivityForRuntime(LearningDesign design, Lesson lesson)
+ throws MonitoringServiceException {
+ Date now = new Date();
- if (activity.isInitialised()) {
- if (!activity.isActivityReadOnly() && activity.isToolActivity()) {
- // Activity is initialised so it was set up previously. So
- // its tool content will be okay
- // but the run offline flags and define later flags might
- // have been changed, so they need to be updated
- // Content ID shouldn't change, but we update it in case it
- // does change while we update the status flags.
- ToolActivity toolActivity = (ToolActivity) activityDAO
- .getActivityByActivityId(activity.getActivityId());
- Long newContentId = lamsCoreToolService
- .notifyToolOfStatusFlags(toolActivity);
- toolActivity.setToolContentId(newContentId);
- }
+ Set activities = design.getActivities();
+ for (Iterator i = activities.iterator(); i.hasNext();) {
+ Activity activity = (Activity) i.next();
- } else {
- // this is a new activity - need to set up the content, do any
- // scheduling, etc
- // always have to copy the tool content, even though it may
- // point to unique content - that way if the
- // teacher has double clicked on the tool icon (and hence set up
- // a tool content id) but not saved any content
- // the code in copyToolContent will ensure that there is content
- // for this activity. So we end up with a few
- // unused records - we are trading database space for
- // reliability. If we don't ensure that there is always
- // a content record, then shortcomings in the createToolSession
- // code may throw exceptions.
- if (activity.isToolActivity()) {
- ToolActivity toolActivity = (ToolActivity) activityDAO
- .getActivityByActivityId(activity.getActivityId());
- Long newContentId = lamsCoreToolService
- .notifyToolToCopyContent(toolActivity, true, null);
- toolActivity.setToolContentId(newContentId);
+ if (activity.isInitialised()) {
+ if (!activity.isActivityReadOnly() && activity.isToolActivity()) {
+ // Activity is initialised so it was set up previously. So
+ // its tool content will be okay
+ // but the run offline flags and define later flags might
+ // have been changed, so they need to be updated
+ // Content ID shouldn't change, but we update it in case it
+ // does change while we update the status flags.
+ ToolActivity toolActivity = (ToolActivity) activityDAO.getActivityByActivityId(activity
+ .getActivityId());
+ Long newContentId = lamsCoreToolService.notifyToolOfStatusFlags(toolActivity);
+ toolActivity.setToolContentId(newContentId);
+ }
- // LDEV-2510 init tool sessions for support activities added during live edit
- monitoringService.initToolSessionIfSuitable(toolActivity, lesson);
- } else {
- Integer newMaxId = monitoringService.startSystemActivity(
- activity, design.getMaxID(), now, lesson
- .getLessonName());
- if (newMaxId != null) {
- design.setMaxID(newMaxId);
- }
- }
- activity.setInitialised(Boolean.TRUE);
- activityDAO.update(activity);
- }
+ } else {
+ // this is a new activity - need to set up the content, do any
+ // scheduling, etc
+ // always have to copy the tool content, even though it may
+ // point to unique content - that way if the
+ // teacher has double clicked on the tool icon (and hence set up
+ // a tool content id) but not saved any content
+ // the code in copyToolContent will ensure that there is content
+ // for this activity. So we end up with a few
+ // unused records - we are trading database space for
+ // reliability. If we don't ensure that there is always
+ // a content record, then shortcomings in the createToolSession
+ // code may throw exceptions.
+ if (activity.isToolActivity()) {
+ ToolActivity toolActivity = (ToolActivity) activityDAO.getActivityByActivityId(activity
+ .getActivityId());
+ Long newContentId = lamsCoreToolService.notifyToolToCopyContent(toolActivity, true, null);
+ toolActivity.setToolContentId(newContentId);
+
+ // LDEV-2510 init tool sessions for support activities added during live edit
+ monitoringService.initToolSessionIfSuitable(toolActivity, lesson);
+ } else {
+ Integer newMaxId = monitoringService.startSystemActivity(activity, design.getMaxID(), now,
+ lesson.getLessonName());
+ if (newMaxId != null) {
+ design.setMaxID(newMaxId);
+ }
}
+ activity.setInitialised(Boolean.TRUE);
+ activityDAO.update(activity);
+ }
}
+ }
- public LearningDesign copyLearningDesign(Long originalDesignID,
- Integer copyType, Integer userID, Integer workspaceFolderID,
- boolean setOriginalDesign) throws UserException,
- LearningDesignException, WorkspaceFolderException, IOException {
+ @Override
+ public LearningDesign copyLearningDesign(Long originalDesignID, Integer copyType, Integer userID,
+ Integer workspaceFolderID, boolean setOriginalDesign) throws UserException, LearningDesignException,
+ WorkspaceFolderException, IOException {
- LearningDesign originalDesign = learningDesignDAO
- .getLearningDesignById(originalDesignID);
- if (originalDesign == null) {
- throw new LearningDesignException(messageService.getMessage(
- "no.such.learningdesign.exist",
- new Object[] { originalDesignID }));
- }
+ LearningDesign originalDesign = learningDesignDAO.getLearningDesignById(originalDesignID);
+ if (originalDesign == null) {
+ throw new LearningDesignException(messageService.getMessage("no.such.learningdesign.exist",
+ new Object[] { originalDesignID }));
+ }
- User user = (User) baseDAO.find(User.class, userID);
- if (user == null) {
- throw new UserException(messageService.getMessage(
- "no.such.user.exist", new Object[] { userID }));
- }
+ User user = (User) baseDAO.find(User.class, userID);
+ if (user == null) {
+ throw new UserException(messageService.getMessage("no.such.user.exist", new Object[] { userID }));
+ }
- WorkspaceFolder workspaceFolder = (WorkspaceFolder) baseDAO.find(
- WorkspaceFolder.class, workspaceFolderID);
- if (workspaceFolder == null) {
- throw new WorkspaceFolderException(messageService.getMessage(
- "no.such.workspace.exist",
- new Object[] { workspaceFolderID }));
- }
+ WorkspaceFolder workspaceFolder = (WorkspaceFolder) baseDAO.find(WorkspaceFolder.class, workspaceFolderID);
+ if (workspaceFolder == null) {
+ throw new WorkspaceFolderException(messageService.getMessage("no.such.workspace.exist",
+ new Object[] { workspaceFolderID }));
+ }
- if (!workspaceManagementService.isUserAuthorizedToModifyFolderContents(
- workspaceFolder.getWorkspaceFolderId(), user.getUserId())) {
- throw new UserAccessDeniedException(
- "User with user_id of "
- + user.getUserId()
- + " is not authorized to copy a learning design into the workspace folder "
- + workspaceFolder.getWorkspaceFolderId());
- }
+ if (!workspaceManagementService.isUserAuthorizedToModifyFolderContents(workspaceFolder.getWorkspaceFolderId(),
+ user.getUserId())) {
+ throw new UserAccessDeniedException("User with user_id of " + user.getUserId()
+ + " is not authorized to copy a learning design into the workspace folder "
+ + workspaceFolder.getWorkspaceFolderId());
+ }
- return copyLearningDesign(originalDesign, copyType, user,
- workspaceFolder, setOriginalDesign, null, null);
+ return copyLearningDesign(originalDesign, copyType, user, workspaceFolder, setOriginalDesign, null, null);
+ }
+
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyLearningDesign(org.lamsfoundation.lams.learningdesign.LearningDesign,
+ * java.lang.Integer, org.lamsfoundation.lams.usermanagement.User,
+ * org.lamsfoundation.lams.usermanagement.WorkspaceFolder, java.lang.Boolean, java.lang.String)
+ */
+ @Override
+ public LearningDesign copyLearningDesign(LearningDesign originalLearningDesign, Integer copyType, User user,
+ WorkspaceFolder workspaceFolder, boolean setOriginalDesign, String newDesignName, String customCSV)
+
+ {
+ String newTitle = newDesignName;
+ if (newTitle == null) {
+ newTitle = getUniqueNameForLearningDesign(originalLearningDesign.getTitle(),
+ workspaceFolder != null ? workspaceFolder.getWorkspaceFolderId() : null);
}
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyLearningDesign(org.lamsfoundation.lams.learningdesign.LearningDesign,
- * java.lang.Integer, org.lamsfoundation.lams.usermanagement.User,
- * org.lamsfoundation.lams.usermanagement.WorkspaceFolder,
- * java.lang.Boolean, java.lang.String)
- */
- public LearningDesign copyLearningDesign(
- LearningDesign originalLearningDesign, Integer copyType, User user,
- WorkspaceFolder workspaceFolder, boolean setOriginalDesign,
- String newDesignName, String customCSV)
+ LearningDesign newLearningDesign = LearningDesign.createLearningDesignCopy(originalLearningDesign, copyType,
+ setOriginalDesign);
+ newLearningDesign.setTitle(newTitle);
+ newLearningDesign.setUser(user);
+ newLearningDesign.setWorkspaceFolder(workspaceFolder);
+ newLearningDesign.setEditOverrideLock(false); // clear the live edit
+ // flag
+ learningDesignDAO.insert(newLearningDesign);
- {
- String newTitle = newDesignName;
- if (newTitle == null) {
- newTitle = getUniqueNameForLearningDesign(originalLearningDesign
- .getTitle(), workspaceFolder != null ? workspaceFolder
- .getWorkspaceFolderId() : null);
- }
+ updateDesignCompetences(originalLearningDesign, newLearningDesign, false);
+ HashMap newActivities = updateDesignActivities(originalLearningDesign, newLearningDesign, 0,
+ customCSV);
+ updateDesignTransitions(originalLearningDesign, newLearningDesign, newActivities, 0);
- LearningDesign newLearningDesign = LearningDesign
- .createLearningDesignCopy(originalLearningDesign, copyType,
- setOriginalDesign);
- newLearningDesign.setTitle(newTitle);
- newLearningDesign.setUser(user);
- newLearningDesign.setWorkspaceFolder(workspaceFolder);
- newLearningDesign.setEditOverrideLock(false); // clear the live edit
- // flag
- learningDesignDAO.insert(newLearningDesign);
+ // set first activity assumes that the transitions are all set up
+ // correctly.
+ newLearningDesign.setFirstActivity(newLearningDesign.calculateFirstActivity());
+ newLearningDesign.setFloatingActivity(newLearningDesign.calculateFloatingActivity());
+ newLearningDesign.setLearningDesignUIID(originalLearningDesign.getLearningDesignUIID());
- updateDesignCompetences(originalLearningDesign, newLearningDesign,
- false);
- HashMap newActivities = updateDesignActivities(
- originalLearningDesign, newLearningDesign, 0, customCSV);
- updateDesignTransitions(originalLearningDesign, newLearningDesign,
- newActivities, 0);
+ updateCompetenceMappings(newLearningDesign.getCompetences(), newActivities);
- // set first activity assumes that the transitions are all set up
- // correctly.
- newLearningDesign.setFirstActivity(newLearningDesign
- .calculateFirstActivity());
- newLearningDesign.setFloatingActivity(newLearningDesign
- .calculateFloatingActivity());
- newLearningDesign.setLearningDesignUIID(originalLearningDesign
- .getLearningDesignUIID());
+ updateEvaluations(newActivities);
- updateCompetenceMappings(newLearningDesign.getCompetences(),
- newActivities);
+ return newLearningDesign;
+ }
- updateEvaluations(newActivities);
+ /**
+ * @throws UserException
+ * @throws WorkspaceFolderException
+ * @throws IOException
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#insertLearningDesign(java.lang.Long,
+ * java.lang.Long, java.lang.Integer, java.lang.Boolean, java.lang.String, java.lang.Integer)
+ */
+ @Override
+ public LearningDesign insertLearningDesign(Long originalDesignID, Long designToImportID, Integer userID,
+ boolean createNewLearningDesign, String newDesignName, Integer workspaceFolderID, String customCSV)
+ throws UserException, WorkspaceFolderException, IOException {
- return newLearningDesign;
+ User user = (User) baseDAO.find(User.class, userID);
+ if (user == null) {
+ throw new UserException(messageService.getMessage("no.such.user.exist", new Object[] { userID }));
}
- /**
- * @throws UserException
- * @throws WorkspaceFolderException
- * @throws IOException
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#insertLearningDesign(java.lang.Long,
- * java.lang.Long, java.lang.Integer, java.lang.Boolean,
- * java.lang.String, java.lang.Integer)
- */
- public LearningDesign insertLearningDesign(Long originalDesignID,
- Long designToImportID, Integer userID,
- boolean createNewLearningDesign, String newDesignName,
- Integer workspaceFolderID, String customCSV) throws UserException,
- WorkspaceFolderException, IOException {
+ LearningDesign mainDesign = learningDesignDAO.getLearningDesignById(originalDesignID);
+ if (mainDesign == null) {
+ throw new LearningDesignException(messageService.getMessage("no.such.learningdesign.exist",
+ new Object[] { originalDesignID }));
+ }
- User user = (User) baseDAO.find(User.class, userID);
- if (user == null) {
- throw new UserException(messageService.getMessage(
- "no.such.user.exist", new Object[] { userID }));
- }
+ LearningDesign designToImport = learningDesignDAO.getLearningDesignById(designToImportID);
+ if (designToImport == null) {
+ throw new LearningDesignException(messageService.getMessage("no.such.learningdesign.exist",
+ new Object[] { designToImportID }));
+ }
- LearningDesign mainDesign = learningDesignDAO
- .getLearningDesignById(originalDesignID);
- if (mainDesign == null) {
- throw new LearningDesignException(messageService.getMessage(
- "no.such.learningdesign.exist",
- new Object[] { originalDesignID }));
- }
+ if (createNewLearningDesign) {
+ WorkspaceFolder workspaceFolder = (WorkspaceFolder) baseDAO.find(WorkspaceFolder.class, workspaceFolderID);
+ if (workspaceFolder == null) {
+ throw new WorkspaceFolderException(messageService.getMessage("no.such.workspace.exist",
+ new Object[] { workspaceFolderID }));
+ }
+ if (!workspaceManagementService.isUserAuthorizedToModifyFolderContents(
+ workspaceFolder.getWorkspaceFolderId(), user.getUserId())) {
+ throw new UserAccessDeniedException("User with user_id of " + user.getUserId()
+ + " is not authorized to store a copy a learning design into the workspace folder "
+ + workspaceFolder);
+ }
- LearningDesign designToImport = learningDesignDAO
- .getLearningDesignById(designToImportID);
- if (designToImport == null) {
- throw new LearningDesignException(messageService.getMessage(
- "no.such.learningdesign.exist",
- new Object[] { designToImportID }));
- }
+ mainDesign = copyLearningDesign(mainDesign, LearningDesign.COPY_TYPE_NONE, user, workspaceFolder, false,
+ newDesignName, customCSV);
+ } else {
+ // updating the existing design so check the rights to the folder
+ // containing the design. If this is in live edit mode
+ boolean authorised = workspaceManagementService.isUserAuthorizedToModifyFolderContents(mainDesign
+ .getWorkspaceFolder().getWorkspaceFolderId(), user.getUserId());
+ if (!authorised) {
+ authorised = (mainDesign.getEditOverrideLock() != null)
+ && mainDesign.getEditOverrideLock().booleanValue()
+ && userID.equals(mainDesign.getEditOverrideUser().getUserId());
+ }
+ if (!authorised) {
+ throw new UserAccessDeniedException("User with user_id of " + user.getUserId()
+ + " is not authorized to update a learning design into the workspace folder "
+ + mainDesign.getWorkspaceFolder());
+ }
+ }
- if (createNewLearningDesign) {
- WorkspaceFolder workspaceFolder = (WorkspaceFolder) baseDAO.find(
- WorkspaceFolder.class, workspaceFolderID);
- if (workspaceFolder == null) {
- throw new WorkspaceFolderException(messageService.getMessage(
- "no.such.workspace.exist",
- new Object[] { workspaceFolderID }));
- }
- if (!workspaceManagementService
- .isUserAuthorizedToModifyFolderContents(workspaceFolder
- .getWorkspaceFolderId(), user.getUserId())) {
- throw new UserAccessDeniedException(
- "User with user_id of "
- + user.getUserId()
- + " is not authorized to store a copy a learning design into the workspace folder "
- + workspaceFolder);
- }
+ // now dump the import design into our main sequence. Leave the first
+ // activity ui id for the design as it is.
+ int uiidOffset = mainDesign.getMaxID().intValue();
+ updateDesignCompetences(designToImport, mainDesign, true);
+ HashMap newActivities = updateDesignActivities(designToImport, mainDesign, uiidOffset,
+ customCSV);
+ updateDesignTransitions(designToImport, mainDesign, newActivities, uiidOffset);
+ mainDesign.setMaxID(LearningDesign.addOffset(designToImport.getMaxID(), uiidOffset));
+ mainDesign.setValidDesign(Boolean.FALSE);
+ mainDesign.setLastModifiedDateTime(new Date());
+ learningDesignDAO.update(mainDesign);
- mainDesign = copyLearningDesign(mainDesign,
- LearningDesign.COPY_TYPE_NONE, user, workspaceFolder,
- false, newDesignName, customCSV);
- } else {
- // updating the existing design so check the rights to the folder
- // containing the design. If this is in live edit mode
- boolean authorised = workspaceManagementService
- .isUserAuthorizedToModifyFolderContents(mainDesign
- .getWorkspaceFolder().getWorkspaceFolderId(), user
- .getUserId());
- if (!authorised) {
- authorised = mainDesign.getEditOverrideLock() != null
- && mainDesign.getEditOverrideLock().booleanValue()
- && userID.equals(mainDesign.getEditOverrideUser()
- .getUserId());
- }
- if (!authorised) {
- throw new UserAccessDeniedException(
- "User with user_id of "
- + user.getUserId()
- + " is not authorized to update a learning design into the workspace folder "
- + mainDesign.getWorkspaceFolder());
- }
- }
+ insertCompetenceMappings(mainDesign.getCompetences(), designToImport.getCompetences(), newActivities);
- // now dump the import design into our main sequence. Leave the first
- // activity ui id for the design as it is.
- int uiidOffset = mainDesign.getMaxID().intValue();
- updateDesignCompetences(designToImport, mainDesign, true);
- HashMap newActivities = updateDesignActivities(
- designToImport, mainDesign, uiidOffset, customCSV);
- updateDesignTransitions(designToImport, mainDesign, newActivities,
- uiidOffset);
- mainDesign.setMaxID(LearningDesign.addOffset(designToImport.getMaxID(),
- uiidOffset));
- mainDesign.setValidDesign(Boolean.FALSE);
- mainDesign.setLastModifiedDateTime(new Date());
- learningDesignDAO.update(mainDesign);
+ // For some reason, the evaluations will not save on insert when the
+ // learning design is saved, so doing it manually here
- insertCompetenceMappings(mainDesign.getCompetences(), designToImport
- .getCompetences(), newActivities);
+ this.updateEvaluations(newActivities);
- // For some reason, the evaluations will not save on insert when the
- // learning design is saved, so doing it manually here
+ // for (Integer activityKey : newActivities.keySet()) {
+ // Activity activity = newActivities.get(activityKey);
+ // if (activity.isToolActivity()) {
+ // ToolActivity toolAct = (ToolActivity) activity;
+ // baseDAO.insertOrUpdateAll(toolAct.getActivityEvaluations());
+ // }
+ // }
- this.updateEvaluations(newActivities);
+ return mainDesign;
+ }
- // for (Integer activityKey : newActivities.keySet()) {
- // Activity activity = newActivities.get(activityKey);
- // if (activity.isToolActivity()) {
- // ToolActivity toolAct = (ToolActivity) activity;
- // baseDAO.insertOrUpdateAll(toolAct.getActivityEvaluations());
- // }
- // }
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyLearningDesignToolContent(org.lamsfoundation.lams.learningdesign.LearningDesign,
+ * org.lamsfoundation.lams.learningdesign.LearningDesign, java.lang.Integer)
+ */
+ private LearningDesign copyLearningDesignToolContent(LearningDesign design, LearningDesign originalLearningDesign,
+ Integer copyType, String customCSV) throws LearningDesignException {
- return mainDesign;
+ for (Iterator i = design.getActivities().iterator(); i.hasNext();) {
+ Activity currentActivity = (Activity) i.next();
+ if (currentActivity.isToolActivity()) {
+ copyActivityToolContent(currentActivity, design.getCopyTypeID(),
+ originalLearningDesign.getLearningDesignId(), customCSV);
+ }
}
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyLearningDesignToolContent(org.lamsfoundation.lams.learningdesign.LearningDesign,
- * org.lamsfoundation.lams.learningdesign.LearningDesign,
- * java.lang.Integer)
- */
- private LearningDesign copyLearningDesignToolContent(LearningDesign design,
- LearningDesign originalLearningDesign, Integer copyType,
- String customCSV) throws LearningDesignException {
+ return design;
+ }
- for (Iterator i = design.getActivities().iterator(); i.hasNext();) {
- Activity currentActivity = (Activity) i.next();
- if (currentActivity.isToolActivity()) {
- copyActivityToolContent(currentActivity,
- design.getCopyTypeID(), originalLearningDesign
- .getLearningDesignId(), customCSV);
- }
- }
+ /**
+ * @param originalLearningDesign
+ * @param copyType
+ * @param currentActivity
+ */
+ private void copyActivityToolContent(Activity activity, Integer ldCopyType, Long originalLearningDesignId,
+ String customCSV) {
+ try {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ // copy the content, but don't set the define later flags if it is
+ // preview
+ Long newContentId = lamsCoreToolService.notifyToolToCopyContent(toolActivity,
+ ldCopyType != LearningDesign.COPY_TYPE_PREVIEW, customCSV);
+ toolActivity.setToolContentId(newContentId);
- return design;
+ // clear read only field
+ toolActivity.setReadOnly(false);
+
+ } catch (DataMissingException e) {
+ String error = "Unable to copy a design / initialise the lesson. Data is missing for activity "
+ + activity.getActivityUIID() + " in learning design " + originalLearningDesignId
+ + " default content may be missing for the tool. Error was " + e.getMessage();
+ log.error(error, e);
+ throw new LearningDesignException(error, e);
+ } catch (ToolException e) {
+ String error = "Unable to copy a design / initialise the lesson. Tool encountered an error copying the data is missing for activity "
+ + activity.getActivityUIID()
+ + " in learning design "
+ + originalLearningDesignId
+ + " default content may be missing for the tool. Error was " + e.getMessage();
+ log.error(error, e);
+ throw new LearningDesignException(error, e);
}
+ }
- /**
- * @param originalLearningDesign
- * @param copyType
- * @param currentActivity
- */
- private void copyActivityToolContent(Activity activity, Integer ldCopyType,
- Long originalLearningDesignId, String customCSV) {
- try {
- ToolActivity toolActivity = (ToolActivity) activity;
- // copy the content, but don't set the define later flags if it is
- // preview
- Long newContentId = lamsCoreToolService.notifyToolToCopyContent(
- toolActivity,
- ldCopyType != LearningDesign.COPY_TYPE_PREVIEW, customCSV);
- toolActivity.setToolContentId(newContentId);
+ /**
+ * Updates the Activity information in the newLearningDesign based on the originalLearningDesign. This any grouping
+ * details.
+ *
+ * As new activities are created, the UIID is incremented by the uiidOffset. If we are just copying a sequence this
+ * will be set to 0. But if we are importing a sequence into another sequence, this will be an offset value so we
+ * new ids guaranteed to be outside of the range of the main sequence (this may mean gaps in the uiids but that
+ * doesn't matter).
+ *
+ * @param originalLearningDesign
+ * The LearningDesign to be copied
+ * @param newLearningDesign
+ * The copy of the originalLearningDesign
+ * @return Map of all the new activities, where the key is the UIID value. This is used as an input to
+ * updateDesignTransitions
+ */
+ private HashMap updateDesignActivities(LearningDesign originalLearningDesign,
+ LearningDesign newLearningDesign, int uiidOffset, String customCSV) {
+ HashMap newActivities = new HashMap(); // key
+ // is
+ // UIID
+ HashMap newGroupings = new HashMap(); // key
+ // is
+ // UIID
- // clear read only field
- toolActivity.setReadOnly(false);
+ // as we create the activities, we need to record any "first child"
+ // UIID's for the sequence activity to process later
+ Map firstChildUIIDToSequence = new HashMap();
- } catch (DataMissingException e) {
- String error = "Unable to copy a design / initialise the lesson. Data is missing for activity "
- + activity.getActivityUIID()
- + " in learning design "
- + originalLearningDesignId
- + " default content may be missing for the tool. Error was "
- + e.getMessage();
- log.error(error, e);
- throw new LearningDesignException(error, e);
- } catch (ToolException e) {
- String error = "Unable to copy a design / initialise the lesson. Tool encountered an error copying the data is missing for activity "
- + activity.getActivityUIID()
- + " in learning design "
- + originalLearningDesignId
- + " default content may be missing for the tool. Error was "
- + e.getMessage();
- log.error(error, e);
- throw new LearningDesignException(error, e);
- }
+ Set oldParentActivities = originalLearningDesign.getParentActivities();
+ if (oldParentActivities != null) {
+ Iterator iterator = oldParentActivities.iterator();
+ while (iterator.hasNext()) {
+ processActivity((Activity) iterator.next(), newLearningDesign, newActivities, newGroupings, null,
+ originalLearningDesign.getLearningDesignId(), uiidOffset, customCSV);
+ }
}
- /**
- * Updates the Activity information in the newLearningDesign based on the
- * originalLearningDesign. This any grouping details.
- *
- * As new activities are created, the UIID is incremented by the uiidOffset.
- * If we are just copying a sequence this will be set to 0. But if we are
- * importing a sequence into another sequence, this will be an offset value
- * so we new ids guaranteed to be outside of the range of the main sequence
- * (this may mean gaps in the uiids but that doesn't matter).
- *
- * @param originalLearningDesign
- * The LearningDesign to be copied
- * @param newLearningDesign
- * The copy of the originalLearningDesign
- * @return Map of all the new activities, where the key is the UIID value.
- * This is used as an input to updateDesignTransitions
- */
- private HashMap updateDesignActivities(
- LearningDesign originalLearningDesign,
- LearningDesign newLearningDesign, int uiidOffset, String customCSV) {
- HashMap newActivities = new HashMap(); // key
- // is
- // UIID
- HashMap newGroupings = new HashMap(); // key
- // is
- // UIID
+ Collection activities = newActivities.values();
- // as we create the activities, we need to record any "first child"
- // UIID's for the sequence activity to process later
- Map firstChildUIIDToSequence = new HashMap();
+ // Go back and find all the grouped activities and assign them the new
+ // groupings, based on the UIID. Can't
+ // be done as we go as the grouping activity may be processed after the
+ // grouped activity.
+ for (Activity activity : activities) {
+ if (activity.getGroupingUIID() != null) {
+ activity.setGrouping(newGroupings.get(activity.getGroupingUIID()));
+ }
+ }
- Set oldParentActivities = originalLearningDesign.getParentActivities();
- if (oldParentActivities != null) {
- Iterator iterator = oldParentActivities.iterator();
- while (iterator.hasNext()) {
- processActivity((Activity) iterator.next(), newLearningDesign,
- newActivities, newGroupings, null,
- originalLearningDesign.getLearningDesignId(),
- uiidOffset, customCSV);
- }
+ // fix up any old "default activity" in the complex activities and the
+ // input activities
+ // and fix any branch mappings
+ for (Activity activity : activities) {
+ if (activity.isComplexActivity()) {
+ ComplexActivity newComplex = (ComplexActivity) activity;
+ Activity oldDefaultActivity = newComplex.getDefaultActivity();
+ if (oldDefaultActivity != null) {
+ Activity newDefaultActivity = newActivities.get(LearningDesign.addOffset(
+ oldDefaultActivity.getActivityUIID(), uiidOffset));
+ newComplex.setDefaultActivity(newDefaultActivity);
}
+ }
- Collection activities = newActivities.values();
+ if (activity.isSequenceActivity()) {
+ SequenceActivity newSequenceActivity = (SequenceActivity) activity;
+ // Need to check if the sets are not null as these are new
+ // objects and Hibernate may not have backed them with
+ // collections yet.
+ if ((newSequenceActivity.getBranchEntries() != null)
+ && (newSequenceActivity.getBranchEntries().size() > 0)) {
- // Go back and find all the grouped activities and assign them the new
- // groupings, based on the UIID. Can't
- // be done as we go as the grouping activity may be processed after the
- // grouped activity.
- for (Activity activity : activities) {
- if (activity.getGroupingUIID() != null) {
- activity.setGrouping(newGroupings.get(activity
- .getGroupingUIID()));
- }
- }
+ Activity parentActivity = newSequenceActivity.getParentActivity();
+ if (parentActivity.isChosenBranchingActivity()
+ || (parentActivity.isGroupBranchingActivity() && (parentActivity.getDefineLater() != null) && parentActivity
+ .getDefineLater().booleanValue())) {
+ // Don't have any preset up entries for a teacher chosen
+ // or a define later group based branching.
+ // Must be copying a design that was run previously.
+ newSequenceActivity.getBranchEntries().clear();
- // fix up any old "default activity" in the complex activities and the
- // input activities
- // and fix any branch mappings
- for (Activity activity : activities) {
- if (activity.isComplexActivity()) {
- ComplexActivity newComplex = (ComplexActivity) activity;
- Activity oldDefaultActivity = newComplex.getDefaultActivity();
- if (oldDefaultActivity != null) {
- Activity newDefaultActivity = newActivities
- .get(LearningDesign.addOffset(oldDefaultActivity
- .getActivityUIID(), uiidOffset));
- newComplex.setDefaultActivity(newDefaultActivity);
+ } else {
+ Iterator beIter = newSequenceActivity.getBranchEntries().iterator();
+ while (beIter.hasNext()) {
+ // sequence activity will be correct but the
+ // branching activity and the grouping will be wrong
+ // the condition was copied by the sequence activity
+ // copy
+ BranchActivityEntry entry = (BranchActivityEntry) beIter.next();
+ BranchingActivity oldBranchingActivity = (BranchingActivity) entry.getBranchingActivity();
+ entry.setBranchingActivity(newActivities.get(LearningDesign.addOffset(
+ oldBranchingActivity.getActivityUIID(), uiidOffset)));
+ Group oldGroup = entry.getGroup();
+ if (oldGroup != null) {
+ Grouping oldGrouping = oldGroup.getGrouping();
+ Grouping newGrouping = newGroupings.get(LearningDesign.addOffset(
+ oldGrouping.getGroupingUIID(), uiidOffset));
+ if (newGrouping != null) {
+ entry.setGroup(newGrouping.getGroup(LearningDesign.addOffset(
+ oldGroup.getGroupUIID(), uiidOffset)));
}
+ }
}
- if (activity.isSequenceActivity()) {
- SequenceActivity newSequenceActivity = (SequenceActivity) activity;
- // Need to check if the sets are not null as these are new
- // objects and Hibernate may not have backed them with
- // collections yet.
- if (newSequenceActivity.getBranchEntries() != null
- && newSequenceActivity.getBranchEntries().size() > 0) {
-
- Activity parentActivity = newSequenceActivity
- .getParentActivity();
- if (parentActivity.isChosenBranchingActivity()
- || parentActivity.isGroupBranchingActivity()
- && parentActivity.getDefineLater() != null
- && parentActivity.getDefineLater().booleanValue()) {
- // Don't have any preset up entries for a teacher chosen
- // or a define later group based branching.
- // Must be copying a design that was run previously.
- newSequenceActivity.getBranchEntries().clear();
-
- } else {
- Iterator beIter = newSequenceActivity
- .getBranchEntries().iterator();
- while (beIter.hasNext()) {
- // sequence activity will be correct but the
- // branching activity and the grouping will be wrong
- // the condition was copied by the sequence activity
- // copy
- BranchActivityEntry entry = (BranchActivityEntry) beIter
- .next();
- BranchingActivity oldBranchingActivity = (BranchingActivity) entry
- .getBranchingActivity();
- entry.setBranchingActivity(newActivities
- .get(LearningDesign.addOffset(
- oldBranchingActivity
- .getActivityUIID(),
- uiidOffset)));
- Group oldGroup = entry.getGroup();
- if (oldGroup != null) {
- Grouping oldGrouping = oldGroup.getGrouping();
- Grouping newGrouping = newGroupings
- .get(LearningDesign.addOffset(
- oldGrouping.getGroupingUIID(),
- uiidOffset));
- if (newGrouping != null) {
- entry.setGroup(newGrouping
- .getGroup(LearningDesign.addOffset(
- oldGroup.getGroupUIID(),
- uiidOffset)));
- }
- }
- }
-
- }
- }
- }
-
- if (activity.getInputActivities() != null
- && activity.getInputActivities().size() > 0) {
- Set newInputActivities = new HashSet();
- Iterator inputIter = activity.getInputActivities().iterator();
- while (inputIter.hasNext()) {
- Activity elem = (Activity) inputIter.next();
- newInputActivities.add(newActivities.get(LearningDesign
- .addOffset(elem.getActivityUIID(), uiidOffset)));
- }
- activity.getInputActivities().clear();
- activity.getInputActivities().addAll(newInputActivities);
- }
+ }
}
+ }
- // The activities collection in the learning design may already exist
- // (as we have already done a save on the design).
- // If so, we can't just override the existing collection as the cascade
- // causes an error.
- // newLearningDesign.getActivities() will create a new TreeSet(new
- // ActivityOrderComparator()) if there isn't an existing set
- // If the uiidOffset is > 0, then we are adding activities, so we don't
- // want to clear first.
- if (uiidOffset == 0) {
- newLearningDesign.getActivities().clear();
+ if ((activity.getInputActivities() != null) && (activity.getInputActivities().size() > 0)) {
+ Set newInputActivities = new HashSet();
+ Iterator inputIter = activity.getInputActivities().iterator();
+ while (inputIter.hasNext()) {
+ Activity elem = (Activity) inputIter.next();
+ newInputActivities.add(newActivities.get(LearningDesign.addOffset(elem.getActivityUIID(),
+ uiidOffset)));
}
+ activity.getInputActivities().clear();
+ activity.getInputActivities().addAll(newInputActivities);
+ }
+ }
- newLearningDesign.getActivities().addAll(activities);
+ // The activities collection in the learning design may already exist
+ // (as we have already done a save on the design).
+ // If so, we can't just override the existing collection as the cascade
+ // causes an error.
+ // newLearningDesign.getActivities() will create a new TreeSet(new
+ // ActivityOrderComparator()) if there isn't an existing set
+ // If the uiidOffset is > 0, then we are adding activities, so we don't
+ // want to clear first.
+ if (uiidOffset == 0) {
+ newLearningDesign.getActivities().clear();
+ }
- // On very rare occasions, we've had Hibernate try to save the branching
- // entries before saving the branching activity
- // which throws an exception as the branch_activity_id is null. So force
- // any branching activities to save first.
- // And yes, this IS a hack. (See LDEV-1786)
- for (Activity activity : activities) {
- if (activity.isBranchingActivity()) {
- activityDAO.insert(activity);
- }
- }
+ newLearningDesign.getActivities().addAll(activities);
- return newActivities;
-
+ // On very rare occasions, we've had Hibernate try to save the branching
+ // entries before saving the branching activity
+ // which throws an exception as the branch_activity_id is null. So force
+ // any branching activities to save first.
+ // And yes, this IS a hack. (See LDEV-1786)
+ for (Activity activity : activities) {
+ if (activity.isBranchingActivity()) {
+ activityDAO.insert(activity);
+ }
}
- /**
- * As part of updateDesignActivities(), process an activity and, via
- * recursive calls, the activity's child activities. Need to keep track of
- * any new groupings created so we can go back and update the grouped
- * activities with their new groupings at the end. Also copies the tool
- * content.
- *
- * @param activity
- * Activity to process. May not be null.
- * @param newLearningDesign
- * The new learning design. May not be null.
- * @param newActivities
- * Temporary set of new activities - as activities are processed
- * they are added to the set. May not be null.
- * @param newGroupings
- * Temporary set of new groupings. Key is the grouping UUID. May
- * not be null.
- * @param parentActivity
- * This activity's parent activity (if one exists). May be null.
- */
- private void processActivity(Activity activity,
- LearningDesign newLearningDesign,
- Map newActivities,
- Map newGroupings, Activity parentActivity,
- Long originalLearningDesignId, int uiidOffset, String customCSV) {
- Activity newActivity = getActivityCopy(activity, newGroupings,
- uiidOffset);
- newActivity.setActivityUIID(newActivity.getActivityUIID());
- newActivity.setLearningDesign(newLearningDesign);
- newActivity.setReadOnly(false);
- if (parentActivity != null) {
- newActivity.setParentActivity(parentActivity);
- newActivity.setParentUIID(parentActivity.getActivityUIID());
- ((ComplexActivity)parentActivity).getActivities().add(newActivity);
- }
+ return newActivities;
- if (!(newActivity.isFloatingActivity() && newLearningDesign
- .getFloatingActivity() != null)) {
- newActivities.put(newActivity.getActivityUIID(), newActivity);
- }
+ }
- if (newActivity.isToolActivity()) {
- copyActivityToolContent(newActivity, newLearningDesign
- .getCopyTypeID(), originalLearningDesignId, customCSV);
- }
+ /**
+ * As part of updateDesignActivities(), process an activity and, via recursive calls, the activity's child
+ * activities. Need to keep track of any new groupings created so we can go back and update the grouped activities
+ * with their new groupings at the end. Also copies the tool content.
+ *
+ * @param activity
+ * Activity to process. May not be null.
+ * @param newLearningDesign
+ * The new learning design. May not be null.
+ * @param newActivities
+ * Temporary set of new activities - as activities are processed they are added to the set. May not be
+ * null.
+ * @param newGroupings
+ * Temporary set of new groupings. Key is the grouping UUID. May not be null.
+ * @param parentActivity
+ * This activity's parent activity (if one exists). May be null.
+ */
+ private void processActivity(Activity activity, LearningDesign newLearningDesign,
+ Map newActivities, Map newGroupings, Activity parentActivity,
+ Long originalLearningDesignId, int uiidOffset, String customCSV) {
+ Activity newActivity = getActivityCopy(activity, newGroupings, uiidOffset);
+ newActivity.setActivityUIID(newActivity.getActivityUIID());
+ newActivity.setLearningDesign(newLearningDesign);
+ newActivity.setReadOnly(false);
+ if (parentActivity != null) {
+ newActivity.setParentActivity(parentActivity);
+ newActivity.setParentUIID(parentActivity.getActivityUIID());
+ ((ComplexActivity) parentActivity).getActivities().add(newActivity);
+ }
- Set oldChildActivities = getChildActivities(activity);
- if (oldChildActivities != null) {
- Iterator childIterator = oldChildActivities.iterator();
- while (childIterator.hasNext()) {
- Activity childActivity = (Activity) childIterator.next();
+ if (!(newActivity.isFloatingActivity() && (newLearningDesign.getFloatingActivity() != null))) {
+ newActivities.put(newActivity.getActivityUIID(), newActivity);
+ }
- // If Floating Activity(s) exist in BOTH designs then we:
- // Transfer the floating activities from the main design to the
- // one that is to be imported.
- // Number of activities may overflow the max limit for the
- // container - to be handled in flash
- // when design is opened.
- FloatingActivity fParentActivity = null;
- Activity refParentActivity = null;
+ if (newActivity.isToolActivity()) {
+ copyActivityToolContent(newActivity, newLearningDesign.getCopyTypeID(), originalLearningDesignId, customCSV);
+ }
- if (childActivity.isFloating()
- && newLearningDesign.getFloatingActivity() != null) {
- fParentActivity = newLearningDesign.getFloatingActivity();
- } else {
- refParentActivity = newActivity;
- }
+ Set oldChildActivities = getChildActivities(activity);
+ if (oldChildActivities != null) {
+ Iterator childIterator = oldChildActivities.iterator();
+ while (childIterator.hasNext()) {
+ Activity childActivity = (Activity) childIterator.next();
- if (childActivity.isFloating() && fParentActivity != null) {
- childActivity.setOrderId(fParentActivity.getActivities()
- .size()
- + childActivity.getOrderId() + 1);
- }
+ // If Floating Activity(s) exist in BOTH designs then we:
+ // Transfer the floating activities from the main design to the
+ // one that is to be imported.
+ // Number of activities may overflow the max limit for the
+ // container - to be handled in flash
+ // when design is opened.
+ FloatingActivity fParentActivity = null;
+ Activity refParentActivity = null;
- Activity pActivity = fParentActivity != null ? (Activity) fParentActivity
- : refParentActivity;
- processActivity(childActivity, newLearningDesign,
- newActivities, newGroupings, pActivity,
- originalLearningDesignId, uiidOffset, customCSV);
+ if (childActivity.isFloating() && (newLearningDesign.getFloatingActivity() != null)) {
+ fParentActivity = newLearningDesign.getFloatingActivity();
+ } else {
+ refParentActivity = newActivity;
+ }
- }
+ if (childActivity.isFloating() && (fParentActivity != null)) {
+ childActivity.setOrderId(fParentActivity.getActivities().size() + childActivity.getOrderId() + 1);
}
+
+ Activity pActivity = fParentActivity != null ? (Activity) fParentActivity : refParentActivity;
+ processActivity(childActivity, newLearningDesign, newActivities, newGroupings, pActivity,
+ originalLearningDesignId, uiidOffset, customCSV);
+
+ }
}
+ }
- /**
- * Updates the Transition information in the newLearningDesign based on the
- * originalLearningDesign
- *
- * @param originalLearningDesign
- * The LearningDesign to be copied
- * @param newLearningDesign
- * The copy of the originalLearningDesign
- */
- public void updateDesignTransitions(LearningDesign originalLearningDesign,
- LearningDesign newLearningDesign,
- HashMap newActivities, int uiidOffset) {
- HashSet newTransitions = new HashSet();
- Set oldTransitions = originalLearningDesign.getTransitions();
- Iterator iterator = oldTransitions.iterator();
- while (iterator.hasNext()) {
- Transition transition = (Transition) iterator.next();
- Transition newTransition = Transition.createCopy(transition,
- uiidOffset);
- Activity toActivity = null;
- Activity fromActivity = null;
- if (newTransition.getToUIID() != null) {
- toActivity = newActivities.get(newTransition.getToUIID());
- if (transition.isProgressTransition()) {
- toActivity.setTransitionTo(newTransition);
- }
- }
- if (newTransition.getFromUIID() != null) {
- fromActivity = newActivities.get(newTransition.getFromUIID());
- // check if we are dealing with a "real" transition, not data
- // flow
- if (transition.isProgressTransition()) {
- fromActivity.setTransitionFrom(newTransition);
- }
- }
- newTransition.setToActivity(toActivity);
- newTransition.setFromActivity(fromActivity);
- newTransition.setLearningDesign(newLearningDesign);
- transitionDAO.insert(newTransition);
- newTransitions.add(newTransition);
+ /**
+ * Updates the Transition information in the newLearningDesign based on the originalLearningDesign
+ *
+ * @param originalLearningDesign
+ * The LearningDesign to be copied
+ * @param newLearningDesign
+ * The copy of the originalLearningDesign
+ */
+ public void updateDesignTransitions(LearningDesign originalLearningDesign, LearningDesign newLearningDesign,
+ HashMap newActivities, int uiidOffset) {
+ HashSet newTransitions = new HashSet();
+ Set oldTransitions = originalLearningDesign.getTransitions();
+ Iterator iterator = oldTransitions.iterator();
+ while (iterator.hasNext()) {
+ Transition transition = (Transition) iterator.next();
+ Transition newTransition = Transition.createCopy(transition, uiidOffset);
+ Activity toActivity = null;
+ Activity fromActivity = null;
+ if (newTransition.getToUIID() != null) {
+ toActivity = newActivities.get(newTransition.getToUIID());
+ if (transition.isProgressTransition()) {
+ toActivity.setTransitionTo(newTransition);
}
-
- // The transitions collection in the learning design may already exist
- // (as we have already done a save on the design).
- // If so, we can't just override the existing collection as the cascade
- // causes an error.
- // If the uiidOffset is > 0, then we are adding transitions (rather than
- // replacing), so we don't want to clear first.
- if (newLearningDesign.getTransitions() != null) {
- if (uiidOffset == 0) {
- newLearningDesign.getTransitions().clear();
- }
- newLearningDesign.getTransitions().addAll(newTransitions);
- } else {
- newLearningDesign.setTransitions(newTransitions);
+ }
+ if (newTransition.getFromUIID() != null) {
+ fromActivity = newActivities.get(newTransition.getFromUIID());
+ // check if we are dealing with a "real" transition, not data
+ // flow
+ if (transition.isProgressTransition()) {
+ fromActivity.setTransitionFrom(newTransition);
}
+ }
+ newTransition.setToActivity(toActivity);
+ newTransition.setFromActivity(fromActivity);
+ newTransition.setLearningDesign(newLearningDesign);
+ transitionDAO.insert(newTransition);
+ newTransitions.add(newTransition);
+ }
+ // The transitions collection in the learning design may already exist
+ // (as we have already done a save on the design).
+ // If so, we can't just override the existing collection as the cascade
+ // causes an error.
+ // If the uiidOffset is > 0, then we are adding transitions (rather than
+ // replacing), so we don't want to clear first.
+ if (newLearningDesign.getTransitions() != null) {
+ if (uiidOffset == 0) {
+ newLearningDesign.getTransitions().clear();
+ }
+ newLearningDesign.getTransitions().addAll(newTransitions);
+ } else {
+ newLearningDesign.setTransitions(newTransitions);
}
- /**
- * Updates the competence information in the newLearningDesign based on the
- * originalLearningDesign
- *
- * @param originalLearningDesign
- * The LearningDesign to be copied
- * @param newLearningDesign
- * The copy of the originalLearningDesign
- */
- public void updateDesignCompetences(LearningDesign originalLearningDesign,
- LearningDesign newLearningDesign, boolean insert) {
- HashSet newCompeteces = new HashSet();
+ }
- Set oldCompetences = originalLearningDesign
- .getCompetences();
- if (oldCompetences != null) {
- for (Competence competence : oldCompetences) {
- Competence newCompetence = competence.createCopy(competence);
- newCompetence.setLearningDesign(newLearningDesign);
+ /**
+ * Updates the competence information in the newLearningDesign based on the originalLearningDesign
+ *
+ * @param originalLearningDesign
+ * The LearningDesign to be copied
+ * @param newLearningDesign
+ * The copy of the originalLearningDesign
+ */
+ public void updateDesignCompetences(LearningDesign originalLearningDesign, LearningDesign newLearningDesign,
+ boolean insert) {
+ HashSet newCompeteces = new HashSet();
- // check for existing competences to prevent duplicates
- if (competenceDAO.getCompetence(newLearningDesign,
- newCompetence.getTitle()) == null) {
- competenceDAO.saveOrUpdate(newCompetence);
- }
- newCompeteces.add(newCompetence);
- }
+ Set oldCompetences = originalLearningDesign.getCompetences();
+ if (oldCompetences != null) {
+ for (Competence competence : oldCompetences) {
+ Competence newCompetence = competence.createCopy(competence);
+ newCompetence.setLearningDesign(newLearningDesign);
+
+ // check for existing competences to prevent duplicates
+ if (competenceDAO.getCompetence(newLearningDesign, newCompetence.getTitle()) == null) {
+ competenceDAO.saveOrUpdate(newCompetence);
}
- if (newLearningDesign.getCompetences() != null) {
- if (!insert) {
- newLearningDesign.getCompetences().clear();
- newLearningDesign.getCompetences().addAll(newCompeteces);
- } else {
- // handle inserting sequences
- for (Competence newCompetence : newCompeteces) {
- boolean alreadyExistsInLD = false;
- for (Competence existingCompetence : originalLearningDesign
- .getCompetences()) {
- if (newCompetence.getTitle().equals(
- existingCompetence.getTitle())) {
- alreadyExistsInLD = true;
- break;
- }
- }
- if (!alreadyExistsInLD) {
- newLearningDesign.getCompetences().add(newCompetence);
- }
- }
+ newCompeteces.add(newCompetence);
+ }
+ }
+ if (newLearningDesign.getCompetences() != null) {
+ if (!insert) {
+ newLearningDesign.getCompetences().clear();
+ newLearningDesign.getCompetences().addAll(newCompeteces);
+ } else {
+ // handle inserting sequences
+ for (Competence newCompetence : newCompeteces) {
+ boolean alreadyExistsInLD = false;
+ for (Competence existingCompetence : originalLearningDesign.getCompetences()) {
+ if (newCompetence.getTitle().equals(existingCompetence.getTitle())) {
+ alreadyExistsInLD = true;
+ break;
}
-
- } else {
- newLearningDesign.setCompetences(newCompeteces);
+ }
+ if (!alreadyExistsInLD) {
+ newLearningDesign.getCompetences().add(newCompetence);
+ }
}
+ }
+ } else {
+ newLearningDesign.setCompetences(newCompeteces);
}
- public void insertCompetenceMappings(Set oldCompetences,
- Set newCompetences,
- HashMap newActivities) {
+ }
- for (Integer activityKey : newActivities.keySet()) {
- Activity activity = newActivities.get(activityKey);
- if (activity.isToolActivity()) {
- Set newCompetenceMappings = new HashSet();
- ToolActivity newToolActivity = (ToolActivity) activity;
- if (newToolActivity.getCompetenceMappings() != null) {
- for (CompetenceMapping competenceMapping : newToolActivity
- .getCompetenceMappings()) {
- CompetenceMapping newMapping = new CompetenceMapping();
- newMapping.setToolActivity(newToolActivity);
+ public void insertCompetenceMappings(Set oldCompetences, Set newCompetences,
+ HashMap newActivities) {
- // Check if competence mapping title already exists as a
- // competence in the original sequence
- // If so, simply use the existing competence to map to.
- if (oldCompetences != null
- && oldCompetences.size() > 0
- && getCompetenceFromSet(oldCompetences,
- competenceMapping.getCompetence()
- .getTitle()) != null) {
- newMapping.setCompetence(getCompetenceFromSet(
- oldCompetences, competenceMapping
- .getCompetence().getTitle()));
- competenceMappingDAO.insert(newMapping);
- newCompetenceMappings.add(newMapping);
- }
- // If competence was not already existing in the ld, add
- // a new mappping
- else if (newCompetences != null
- && newCompetences.size() > 0
- && getCompetenceFromSet(newCompetences,
- competenceMapping.getCompetence()
- .getTitle()) != null) {
- newMapping.setCompetence(getCompetenceFromSet(
- newCompetences, competenceMapping
- .getCompetence().getTitle()));
- competenceMappingDAO.insert(newMapping);
- newCompetenceMappings.add(newMapping);
- }
- }
- }
- newToolActivity.getCompetenceMappings().addAll(
- newCompetenceMappings);
+ for (Integer activityKey : newActivities.keySet()) {
+ Activity activity = newActivities.get(activityKey);
+ if (activity.isToolActivity()) {
+ Set newCompetenceMappings = new HashSet();
+ ToolActivity newToolActivity = (ToolActivity) activity;
+ if (newToolActivity.getCompetenceMappings() != null) {
+ for (CompetenceMapping competenceMapping : newToolActivity.getCompetenceMappings()) {
+ CompetenceMapping newMapping = new CompetenceMapping();
+ newMapping.setToolActivity(newToolActivity);
+
+ // Check if competence mapping title already exists as a
+ // competence in the original sequence
+ // If so, simply use the existing competence to map to.
+ if ((oldCompetences != null)
+ && (oldCompetences.size() > 0)
+ && (getCompetenceFromSet(oldCompetences, competenceMapping.getCompetence().getTitle()) != null)) {
+ newMapping.setCompetence(getCompetenceFromSet(oldCompetences, competenceMapping
+ .getCompetence().getTitle()));
+ competenceMappingDAO.insert(newMapping);
+ newCompetenceMappings.add(newMapping);
}
+ // If competence was not already existing in the ld, add
+ // a new mappping
+ else if ((newCompetences != null)
+ && (newCompetences.size() > 0)
+ && (getCompetenceFromSet(newCompetences, competenceMapping.getCompetence().getTitle()) != null)) {
+ newMapping.setCompetence(getCompetenceFromSet(newCompetences, competenceMapping
+ .getCompetence().getTitle()));
+ competenceMappingDAO.insert(newMapping);
+ newCompetenceMappings.add(newMapping);
+ }
+ }
}
+ newToolActivity.getCompetenceMappings().addAll(newCompetenceMappings);
+ }
}
+ }
- public Competence getCompetenceFromSet(Set competences,
- String title) {
- Competence ret = null;
- for (Competence competence : competences) {
- if (competence.getTitle().equals(title)) {
- ret = competence;
- break;
- }
- }
- return ret;
+ public Competence getCompetenceFromSet(Set competences, String title) {
+ Competence ret = null;
+ for (Competence competence : competences) {
+ if (competence.getTitle().equals(title)) {
+ ret = competence;
+ break;
+ }
}
+ return ret;
+ }
- /**
- * Updates the competence information in the newLearningDesign based on the
- * originalLearningDesign
- *
- * @param originalLearningDesign
- * The LearningDesign to be copied
- * @param newLearningDesign
- * The copy of the originalLearningDesign
- */
- public void updateCompetenceMappings(Set newCompetences,
- HashMap newActivities) {
- for (Integer activityKey : newActivities.keySet()) {
- Activity activity = newActivities.get(activityKey);
- if (activity.isToolActivity()) {
- Set newCompetenceMappings = new HashSet();
- ToolActivity newToolActivity = (ToolActivity) activity;
- if (newToolActivity.getCompetenceMappings() != null) {
- for (CompetenceMapping competenceMapping : newToolActivity
- .getCompetenceMappings()) {
- CompetenceMapping newMapping = new CompetenceMapping();
- if (newCompetences != null) {
- for (Competence newCompetence : newCompetences) {
- if (competenceMapping.getCompetence()
- .getTitle().equals(
- newCompetence.getTitle())) {
- newMapping.setToolActivity(newToolActivity);
- newMapping.setCompetence(newCompetence);
- competenceMappingDAO.insert(newMapping);
- newCompetenceMappings.add(newMapping);
- }
- }
- }
- }
+ /**
+ * Updates the competence information in the newLearningDesign based on the originalLearningDesign
+ *
+ * @param originalLearningDesign
+ * The LearningDesign to be copied
+ * @param newLearningDesign
+ * The copy of the originalLearningDesign
+ */
+ public void updateCompetenceMappings(Set newCompetences, HashMap newActivities) {
+ for (Integer activityKey : newActivities.keySet()) {
+ Activity activity = newActivities.get(activityKey);
+ if (activity.isToolActivity()) {
+ Set newCompetenceMappings = new HashSet();
+ ToolActivity newToolActivity = (ToolActivity) activity;
+ if (newToolActivity.getCompetenceMappings() != null) {
+ for (CompetenceMapping competenceMapping : newToolActivity.getCompetenceMappings()) {
+ CompetenceMapping newMapping = new CompetenceMapping();
+ if (newCompetences != null) {
+ for (Competence newCompetence : newCompetences) {
+ if (competenceMapping.getCompetence().getTitle().equals(newCompetence.getTitle())) {
+ newMapping.setToolActivity(newToolActivity);
+ newMapping.setCompetence(newCompetence);
+ competenceMappingDAO.insert(newMapping);
+ newCompetenceMappings.add(newMapping);
}
- newToolActivity.getCompetenceMappings().addAll(
- newCompetenceMappings);
- // activityDAO.update(newToolActivity);
+ }
}
+ }
}
+ newToolActivity.getCompetenceMappings().addAll(newCompetenceMappings);
+ // activityDAO.update(newToolActivity);
+ }
}
+ }
- private void updateEvaluations(HashMap newActivities) {
+ private void updateEvaluations(HashMap newActivities) {
- for (Integer key : newActivities.keySet()) {
- Activity activity = newActivities.get(key);
- if (activity.isToolActivity()) {
- Set newActivityEvaluations = ((ToolActivity) activity)
- .getActivityEvaluations();
+ for (Integer key : newActivities.keySet()) {
+ Activity activity = newActivities.get(key);
+ if (activity.isToolActivity()) {
+ Set newActivityEvaluations = ((ToolActivity) activity).getActivityEvaluations();
- if (newActivityEvaluations != null) {
- baseDAO.insertOrUpdateAll(newActivityEvaluations);
- }
- }
+ if (newActivityEvaluations != null) {
+ baseDAO.insertOrUpdateAll(newActivityEvaluations);
}
+ }
}
+ }
- /**
- * Determines the type of activity and returns a deep-copy of the same
- *
- * @param activity
- * The object to be deep-copied
- * @param newGroupings
- * Temporary set of new groupings. Key is the grouping UUID. May
- * not be null.
- * @return Activity The new deep-copied Activity object
- */
- private Activity getActivityCopy(final Activity activity,
- Map newGroupings, int uiidOffset) {
- if (Activity.GROUPING_ACTIVITY_TYPE == activity.getActivityTypeId()
- .intValue()) {
- GroupingActivity newGroupingActivity = (GroupingActivity) activity
- .createCopy(uiidOffset);
- // now we need to manually add the grouping to the session, as we
- // can't easily
- // set up a cascade
- Grouping grouping = newGroupingActivity.getCreateGrouping();
- grouping.setGroupingUIID(grouping.getGroupingUIID());
- if (grouping != null) {
- groupingDAO.insert(grouping);
- newGroupings.put(grouping.getGroupingUIID(), grouping);
- }
- return newGroupingActivity;
- } else {
- return activity.createCopy(uiidOffset);
- }
+ /**
+ * Determines the type of activity and returns a deep-copy of the same
+ *
+ * @param activity
+ * The object to be deep-copied
+ * @param newGroupings
+ * Temporary set of new groupings. Key is the grouping UUID. May not be null.
+ * @return Activity The new deep-copied Activity object
+ */
+ private Activity getActivityCopy(final Activity activity, Map newGroupings, int uiidOffset) {
+ if (Activity.GROUPING_ACTIVITY_TYPE == activity.getActivityTypeId().intValue()) {
+ GroupingActivity newGroupingActivity = (GroupingActivity) activity.createCopy(uiidOffset);
+ // now we need to manually add the grouping to the session, as we
+ // can't easily
+ // set up a cascade
+ Grouping grouping = newGroupingActivity.getCreateGrouping();
+ grouping.setGroupingUIID(grouping.getGroupingUIID());
+ if (grouping != null) {
+ groupingDAO.insert(grouping);
+ newGroupings.put(grouping.getGroupingUIID(), grouping);
+ }
+ return newGroupingActivity;
+ } else {
+ return activity.createCopy(uiidOffset);
}
+ }
- /**
- * Returns a set of child activities for the given parent activity
- *
- * @param parentActivity
- * The parent activity
- * @return HashSet Set of the activities that belong to the parentActivity
- */
- private HashSet getChildActivities(Activity parentActivity) {
- HashSet childActivities = new HashSet();
- List list = activityDAO.getActivitiesByParentActivityId(parentActivity
- .getActivityId());
- if (list != null) {
- childActivities.addAll(list);
- }
- return childActivities;
+ /**
+ * Returns a set of child activities for the given parent activity
+ *
+ * @param parentActivity
+ * The parent activity
+ * @return HashSet Set of the activities that belong to the parentActivity
+ */
+ private HashSet getChildActivities(Activity parentActivity) {
+ HashSet childActivities = new HashSet();
+ List list = activityDAO.getActivitiesByParentActivityId(parentActivity.getActivityId());
+ if (list != null) {
+ childActivities.addAll(list);
}
+ return childActivities;
+ }
- /**
- * This method saves a new Learning Design to the database. It received a
- * WDDX packet from flash, deserializes it and then finally persists it to
- * the database.
- *
- * A user may update an existing learning design if they have user/owner
- * rights to the folder or they are doing live edit. A user may create a new
- * learning design only if they have user/owner rights to the folder.
- *
- * Note: it does not validate the design - that must be done separately.
- *
- * @param wddxPacket
- * The WDDX packet received from Flash
- * @return Long learning design id
- * @throws Exception
- */
- public Long storeLearningDesignDetails(String wddxPacket) throws Exception {
+ /**
+ * This method saves a new Learning Design to the database. It received a WDDX packet from flash, deserializes it
+ * and then finally persists it to the database.
+ *
+ * A user may update an existing learning design if they have user/owner rights to the folder or they are doing live
+ * edit. A user may create a new learning design only if they have user/owner rights to the folder.
+ *
+ * Note: it does not validate the design - that must be done separately.
+ *
+ * @param wddxPacket
+ * The WDDX packet received from Flash
+ * @return Long learning design id
+ * @throws Exception
+ */
+ @Override
+ public Long storeLearningDesignDetails(String wddxPacket) throws Exception {
- Hashtable table = (Hashtable) WDDXProcessor.deserialize(wddxPacket);
- Integer workspaceFolderID = WDDXProcessor.convertToInteger(table,
- WDDXTAGS.WORKSPACE_FOLDER_ID);
+ Hashtable table = (Hashtable) WDDXProcessor.deserialize(wddxPacket);
+ Integer workspaceFolderID = WDDXProcessor.convertToInteger(table, WDDXTAGS.WORKSPACE_FOLDER_ID);
- User user = null;
- Integer userID = getUserId();
- if (userID != null) {
- user = (User) baseDAO.find(User.class, userID);
- }
- if (user == null) {
- throw new UserException("UserID missing or user not found.");
- }
+ User user = null;
+ Integer userID = AuthoringService.getUserId();
+ if (userID != null) {
+ user = (User) baseDAO.find(User.class, userID);
+ }
+ if (user == null) {
+ throw new UserException("UserID missing or user not found.");
+ }
- WorkspaceFolder workspaceFolder = null;
- boolean authorised = false;
- if (workspaceFolderID != null) {
- workspaceFolder = (WorkspaceFolder) baseDAO.find(
- WorkspaceFolder.class, workspaceFolderID);
- authorised = workspaceManagementService
- .isUserAuthorizedToModifyFolderContents(workspaceFolderID,
- userID);
- }
+ WorkspaceFolder workspaceFolder = null;
+ boolean authorised = false;
+ if (workspaceFolderID != null) {
+ workspaceFolder = (WorkspaceFolder) baseDAO.find(WorkspaceFolder.class, workspaceFolderID);
+ authorised = workspaceManagementService.isUserAuthorizedToModifyFolderContents(workspaceFolderID, userID);
+ }
- Long learningDesignId = WDDXProcessor.convertToLong(table,
- "learningDesignID");
- LearningDesign existingLearningDesign = learningDesignId != null ? learningDesignDAO
- .getLearningDesignById(learningDesignId)
- : null;
- if (!authorised
- && existingLearningDesign != null
- && Boolean.TRUE.equals(existingLearningDesign
- .getEditOverrideLock())) {
- authorised = userID.equals(existingLearningDesign
- .getEditOverrideUser().getUserId());
- }
- if (!authorised) {
- throw new UserException(
- "User with user_id of "
- + userID
- + " is not authorized to store a design in this workspace folder "
- + workspaceFolderID);
- }
+ Long learningDesignId = WDDXProcessor.convertToLong(table, "learningDesignID");
+ LearningDesign existingLearningDesign = learningDesignId != null ? learningDesignDAO
+ .getLearningDesignById(learningDesignId) : null;
+ if (!authorised && (existingLearningDesign != null)
+ && Boolean.TRUE.equals(existingLearningDesign.getEditOverrideLock())) {
+ authorised = userID.equals(existingLearningDesign.getEditOverrideUser().getUserId());
+ }
+ if (!authorised) {
+ throw new UserException("User with user_id of " + userID
+ + " is not authorized to store a design in this workspace folder " + workspaceFolderID);
+ }
- IObjectExtractor extractor = (IObjectExtractor) beanFactory
- .getBean(IObjectExtractor.OBJECT_EXTRACTOR_SPRING_BEANNAME);
- LearningDesign design = extractor.extractSaveLearningDesign(table,
- existingLearningDesign, workspaceFolder, user);
+ IObjectExtractor extractor = (IObjectExtractor) beanFactory
+ .getBean(IObjectExtractor.OBJECT_EXTRACTOR_SPRING_BEANNAME);
+ LearningDesign design = extractor.extractSaveLearningDesign(table, existingLearningDesign, workspaceFolder,
+ user);
- if (extractor.getMode().intValue() == 1) {
+ if (extractor.getMode().intValue() == 1) {
- // adding the customCSV to the call if it is present
- String customCSV = null;
- if (table.containsKey(WDDXTAGS.CUSTOM_CSV)) {
- customCSV = WDDXProcessor.convertToString(table,
- WDDXTAGS.CUSTOM_CSV);
- }
+ // adding the customCSV to the call if it is present
+ String customCSV = null;
+ if (table.containsKey(WDDXTAGS.CUSTOM_CSV)) {
+ customCSV = WDDXProcessor.convertToString(table, WDDXTAGS.CUSTOM_CSV);
+ }
- copyLearningDesignToolContent(design, design, design
- .getCopyTypeID(), customCSV);
+ copyLearningDesignToolContent(design, design, design.getCopyTypeID(), customCSV);
- }
-
- logEventService.logEvent(LogEvent.TYPE_TEACHER_LEARNING_DESIGN_CREATE, userID, design.getLearningDesignId(), null, null);
-
- return design.getLearningDesignId();
}
- /**
- * Validate the learning design, updating the valid flag appropriately.
- *
- * This needs to be run in a separate transaction to
- * storeLearningDesignDetails to ensure the database is fully updated before
- * the validation occurs (due to some quirks we are finding using Hibernate)
- *
- * @param learningDesignId
- * @throws Exception
- */
- public Vector validateLearningDesign(
- Long learningDesignId) {
- LearningDesign learningDesign = learningDesignDAO
- .getLearningDesignById(learningDesignId);
- Vector listOfValidationErrorDTOs = learningDesignService
- .validateLearningDesign(learningDesign);
- Boolean valid = listOfValidationErrorDTOs.size() > 0 ? Boolean.FALSE
- : Boolean.TRUE;
- learningDesign.setValidDesign(valid);
- learningDesignDAO.insertOrUpdate(learningDesign);
- return listOfValidationErrorDTOs;
- }
+ logEventService.logEvent(LogEvent.TYPE_TEACHER_LEARNING_DESIGN_CREATE, userID, design.getLearningDesignId(),
+ null, null);
- public Vector getToolActivities(
- Long learningDesignId, String languageCode) {
- LearningDesign learningDesign = learningDesignDAO
- .getLearningDesignById(learningDesignId);
- Vector listOfAuthoringActivityDTOs = new Vector();
+ return design.getLearningDesignId();
+ }
- for (Iterator i = learningDesign.getActivities().iterator(); i
- .hasNext();) {
- Activity currentActivity = (Activity) i.next();
- if (currentActivity.isToolActivity()) {
- try {
- // Normally we pass in an array for the branch mappings as
- // the second parameter to new AuthoringActivityDTO()
- // but we don't need to in this case as it is only doing it
- // for tool activities, and the extra parameter is only
- // used for branching activities
- ToolActivity toolActivity = (ToolActivity) activityDAO
- .getActivityByActivityId(currentActivity
- .getActivityId());
- AuthoringActivityDTO activityDTO = new AuthoringActivityDTO(
- toolActivity, null, languageCode);
- listOfAuthoringActivityDTOs.add(activityDTO);
- } catch (ToolException e) {
- String error = "" + e.getMessage();
- log.error(error, e);
- throw new LearningDesignException(error, e);
- }
- }
- }
+ /**
+ * Validate the learning design, updating the valid flag appropriately.
+ *
+ * This needs to be run in a separate transaction to storeLearningDesignDetails to ensure the database is fully
+ * updated before the validation occurs (due to some quirks we are finding using Hibernate)
+ *
+ * @param learningDesignId
+ * @throws Exception
+ */
+ @Override
+ public Vector validateLearningDesign(Long learningDesignId) {
+ LearningDesign learningDesign = learningDesignDAO.getLearningDesignById(learningDesignId);
+ Vector listOfValidationErrorDTOs = learningDesignService
+ .validateLearningDesign(learningDesign);
+ Boolean valid = listOfValidationErrorDTOs.size() > 0 ? Boolean.FALSE : Boolean.TRUE;
+ learningDesign.setValidDesign(valid);
+ learningDesignDAO.insertOrUpdate(learningDesign);
+ return listOfValidationErrorDTOs;
+ }
- return listOfAuthoringActivityDTOs;
- }
+ @Override
+ public Vector getToolActivities(Long learningDesignId, String languageCode) {
+ LearningDesign learningDesign = learningDesignDAO.getLearningDesignById(learningDesignId);
+ Vector listOfAuthoringActivityDTOs = new Vector();
- /**
- * (non-Javadoc)
- *
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningDesignDetails()
- */
- public String getAllLearningDesignDetails() throws IOException {
- Iterator iterator = getAllLearningDesigns().iterator();
- ArrayList arrayList = createDesignDetailsPacket(iterator);
- FlashMessage flashMessage = new FlashMessage(
- "getAllLearningDesignDetails", arrayList);
- return flashMessage.serializeMessage();
- }
-
- /**
- * This is a utility method used by the method
- * getAllLearningDesignDetails
to pack the required
- * information in a data transfer object.
- *
- * @param iterator
- * @return Hashtable The required information in a Hashtable
- */
- private ArrayList createDesignDetailsPacket(Iterator iterator) {
- ArrayList arrayList = new ArrayList();
- while (iterator.hasNext()) {
- LearningDesign learningDesign = (LearningDesign) iterator.next();
- DesignDetailDTO designDetailDTO = learningDesign
- .getDesignDetailDTO();
- arrayList.add(designDetailDTO);
+ for (Iterator i = learningDesign.getActivities().iterator(); i.hasNext();) {
+ Activity currentActivity = (Activity) i.next();
+ if (currentActivity.isToolActivity()) {
+ try {
+ // Normally we pass in an array for the branch mappings as
+ // the second parameter to new AuthoringActivityDTO()
+ // but we don't need to in this case as it is only doing it
+ // for tool activities, and the extra parameter is only
+ // used for branching activities
+ ToolActivity toolActivity = (ToolActivity) activityDAO.getActivityByActivityId(currentActivity
+ .getActivityId());
+ AuthoringActivityDTO activityDTO = new AuthoringActivityDTO(toolActivity, null, languageCode);
+ listOfAuthoringActivityDTOs.add(activityDTO);
+ } catch (ToolException e) {
+ String error = "" + e.getMessage();
+ log.error(error, e);
+ throw new LearningDesignException(error, e);
}
- return arrayList;
+ }
}
- /**
- * (non-Javadoc)
- *
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesignsForUser(java.lang.Long)
- */
- public String getLearningDesignsForUser(Long userID) throws IOException {
- List list = learningDesignDAO.getLearningDesignByUserId(userID);
- ArrayList arrayList = createDesignDetailsPacket(list.iterator());
- FlashMessage flashMessage = new FlashMessage(
- "getLearningDesignsForUser", arrayList);
- return flashMessage.serializeMessage();
+ return listOfAuthoringActivityDTOs;
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningDesignDetails()
+ */
+ @Override
+ public String getAllLearningDesignDetails() throws IOException {
+ Iterator iterator = getAllLearningDesigns().iterator();
+ ArrayList arrayList = createDesignDetailsPacket(iterator);
+ FlashMessage flashMessage = new FlashMessage("getAllLearningDesignDetails", arrayList);
+ return flashMessage.serializeMessage();
+ }
+
+ /**
+ * This is a utility method used by the method getAllLearningDesignDetails
to pack the required
+ * information in a data transfer object.
+ *
+ * @param iterator
+ * @return Hashtable The required information in a Hashtable
+ */
+ private ArrayList createDesignDetailsPacket(Iterator iterator) {
+ ArrayList arrayList = new ArrayList();
+ while (iterator.hasNext()) {
+ LearningDesign learningDesign = (LearningDesign) iterator.next();
+ DesignDetailDTO designDetailDTO = learningDesign.getDesignDetailDTO();
+ arrayList.add(designDetailDTO);
}
+ return arrayList;
+ }
- /**
- * (non-Javadoc)
- *
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningLibraryDetails()
- */
- public String getAllLearningLibraryDetails(String languageCode)
- throws IOException {
- FlashMessage flashMessage = new FlashMessage(
- "getAllLearningLibraryDetails", learningDesignService
- .getAllLearningLibraryDetails(languageCode));
- return flashMessage.serializeMessage();
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesignsForUser(java.lang.Long)
+ */
+ @Override
+ public String getLearningDesignsForUser(Long userID) throws IOException {
+ List list = learningDesignDAO.getLearningDesignByUserId(userID);
+ ArrayList arrayList = createDesignDetailsPacket(list.iterator());
+ FlashMessage flashMessage = new FlashMessage("getLearningDesignsForUser", arrayList);
+ return flashMessage.serializeMessage();
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAllLearningLibraryDetails()
+ */
+ @Override
+ public String getAllLearningLibraryDetails(String languageCode) throws IOException {
+ FlashMessage flashMessage = new FlashMessage("getAllLearningLibraryDetails",
+ learningDesignService.getAllLearningLibraryDetails(languageCode));
+ return flashMessage.serializeMessage();
+ }
+
+ /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#generateToolContentID(java.lang.Long) */
+
+ @Override
+ public String getToolContentIDFlash(Long toolID) throws IOException {
+ Long toolContentID = generateToolContentID(toolID);
+ if (toolContentID == null) {
+ return FlashMessage.getNoSuchTool("getToolContentID", toolID).serializeMessage();
}
- /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolContentID(java.lang.Long) */
+ FlashMessage flashMessage = new FlashMessage("getToolContentID", toolContentID);
+ return flashMessage.serializeMessage();
+ }
- public String getToolContentID(Long toolID) throws IOException {
- Tool tool = toolDAO.getToolByID(toolID);
- if (tool == null) {
- log.error("The toolID " + toolID
- + " is not valid. A Tool with tool id " + toolID
- + " does not exist on the database.");
- return FlashMessage.getNoSuchTool("getToolContentID", toolID)
- .serializeMessage();
- }
+ @Override
+ public Long generateToolContentID(Long toolID) {
+ Tool tool = toolDAO.getToolByID(toolID);
+ if (tool == null) {
+ log.error("The toolID " + toolID + " is not valid. A Tool with tool id " + toolID
+ + " does not exist on the database.");
+ return null;
+ }
- Long newContentID = contentIDGenerator.getNextToolContentIDFor(tool);
- FlashMessage flashMessage = new FlashMessage("getToolContentID",
- newContentID);
+ return contentIDGenerator.getNextToolContentIDFor(tool);
+ }
- return flashMessage.serializeMessage();
+ /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyToolContent(java.lang.Long) */
+ @Override
+ public String copyToolContent(Long toolContentID, String customCSV) throws IOException {
+ Long newContentID = lamsCoreToolService.notifyToolToCopyContent(toolContentID, customCSV);
+ FlashMessage flashMessage = new FlashMessage("copyToolContent", newContentID);
+ return flashMessage.serializeMessage();
+ }
+
+ /**
+ * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyMultipleToolContent(java.lang.Integer,
+ * java.util.List)
+ */
+ @Override
+ public String copyMultipleToolContent(Integer userId, List toolContentIds, String customCSV) {
+ StringBuffer idMap = new StringBuffer();
+ for (Long oldToolContentId : toolContentIds) {
+ if (oldToolContentId != null) {
+ Long newToolContentId = lamsCoreToolService.notifyToolToCopyContent(oldToolContentId, customCSV);
+ idMap.append(oldToolContentId);
+ idMap.append('=');
+ idMap.append(newToolContentId);
+ idMap.append(',');
+ }
}
+ // return the id list, stripping off the trailing ,
+ return idMap.length() > 0 ? idMap.substring(0, idMap.length() - 1) : "";
+ }
- /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyToolContent(java.lang.Long) */
- public String copyToolContent(Long toolContentID, String customCSV)
- throws IOException {
- Long newContentID = lamsCoreToolService.notifyToolToCopyContent(
- toolContentID, customCSV);
- FlashMessage flashMessage = new FlashMessage("copyToolContent",
- newContentID);
- return flashMessage.serializeMessage();
+ /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAvailableLicenses() */
+ @Override
+ public Vector getAvailableLicenses() {
+ List licenses = licenseDAO.findAll(License.class);
+ Vector licenseDTOList = new Vector(licenses.size());
+ Iterator iter = licenses.iterator();
+ while (iter.hasNext()) {
+ License element = (License) iter.next();
+ licenseDTOList.add(element.getLicenseDTO(Configuration.get(ConfigurationKeys.SERVER_URL)));
}
+ return licenseDTOList;
+ }
- /**
- * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyMultipleToolContent(java.lang.Integer,
- * java.util.List)
- */
- public String copyMultipleToolContent(Integer userId,
- List toolContentIds, String customCSV) {
- StringBuffer idMap = new StringBuffer();
- for (Long oldToolContentId : toolContentIds) {
- if (oldToolContentId != null) {
- Long newToolContentId = lamsCoreToolService
- .notifyToolToCopyContent(oldToolContentId, customCSV);
- idMap.append(oldToolContentId);
- idMap.append('=');
- idMap.append(newToolContentId);
- idMap.append(',');
- }
- }
- // return the id list, stripping off the trailing ,
- return idMap.length() > 0 ? idMap.substring(0, idMap.length() - 1) : "";
+ /**
+ * Delete a learning design from the database. Does not remove any content stored in tools - that is done by the
+ * LamsCoreToolService
+ */
+ @Override
+ public void deleteLearningDesign(LearningDesign design) {
+ if (design == null) {
+ log.error("deleteLearningDesign: unable to delete learning design as design is null.");
+ return;
}
- /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAvailableLicenses() */
- public Vector getAvailableLicenses() {
- List licenses = licenseDAO.findAll(License.class);
- Vector licenseDTOList = new Vector(licenses.size());
- Iterator iter = licenses.iterator();
- while (iter.hasNext()) {
- License element = (License) iter.next();
- licenseDTOList.add(element.getLicenseDTO(Configuration
- .get(ConfigurationKeys.SERVER_URL)));
+ // remove all the tool content for the learning design
+ Set acts = design.getActivities();
+ Iterator iter = acts.iterator();
+ while (iter.hasNext()) {
+ Activity activity = (Activity) iter.next();
+ if (activity.isToolActivity()) {
+ try {
+ ToolActivity toolActivity = (ToolActivity) activityDAO.getActivityByActivityId(activity
+ .getActivityId());
+ lamsCoreToolService.notifyToolToDeleteContent(toolActivity);
+ } catch (ToolException e) {
+ log.error("Unable to delete tool content for activity" + activity
+ + " as activity threw an exception", e);
}
- return licenseDTOList;
+ }
}
- /**
- * Delete a learning design from the database. Does not remove any content
- * stored in tools - that is done by the LamsCoreToolService
- */
- public void deleteLearningDesign(LearningDesign design) {
- if (design == null) {
- log
- .error("deleteLearningDesign: unable to delete learning design as design is null.");
- return;
- }
+ // remove the learning design
+ learningDesignDAO.delete(design);
+ }
- // remove all the tool content for the learning design
- Set acts = design.getActivities();
- Iterator iter = acts.iterator();
- while (iter.hasNext()) {
- Activity activity = (Activity) iter.next();
- if (activity.isToolActivity()) {
- try {
- ToolActivity toolActivity = (ToolActivity) activityDAO
- .getActivityByActivityId(activity.getActivityId());
- lamsCoreToolService.notifyToolToDeleteContent(toolActivity);
- } catch (ToolException e) {
- log.error("Unable to delete tool content for activity"
- + activity + " as activity threw an exception", e);
- }
- }
- }
+ /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#generateUniqueContentFolder() */
+ @Override
+ public String generateUniqueContentFolder() throws FileUtilException, IOException {
- // remove the learning design
- learningDesignDAO.delete(design);
- }
+ String newUniqueContentFolderID = FileUtil.generateUniqueContentFolderID();
- /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#generateUniqueContentFolder() */
- public String generateUniqueContentFolder() throws FileUtilException,
- IOException {
+ FlashMessage flashMessage = new FlashMessage("createUniqueContentFolder", newUniqueContentFolderID);
- String newUniqueContentFolderID = FileUtil
- .generateUniqueContentFolderID();
+ return flashMessage.serializeMessage();
+ }
- FlashMessage flashMessage = new FlashMessage(
- "createUniqueContentFolder", newUniqueContentFolderID);
+ /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getHelpURL() */
+ @Override
+ public String getHelpURL() throws Exception {
- return flashMessage.serializeMessage();
+ FlashMessage flashMessage = null;
+
+ String helpURL = Configuration.get(ConfigurationKeys.HELP_URL);
+ if (helpURL != null) {
+ flashMessage = new FlashMessage("getHelpURL", helpURL);
+ } else {
+ throw new Exception();
}
- /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getHelpURL() */
- public String getHelpURL() throws Exception {
+ return flashMessage.serializeMessage();
+ }
- FlashMessage flashMessage = null;
+ /**
+ * Get a unique name for a learning design, based on the names of the learning designs in the folder. If the
+ * learning design has duplicated name in same folder, then the new name will have a timestamp. The new name format
+ * will be oldname_ddMMYYYY_idx. The idx will be auto incremental index number, start from 1. Warning - this may be
+ * quite intensive as it gets all the learning designs in a folder.
+ *
+ * @param originalLearningDesign
+ * @param workspaceFolder
+ * @param copyType
+ * @return
+ */
+ @Override
+ public String getUniqueNameForLearningDesign(String originalTitle, Integer workspaceFolderId) {
- String helpURL = Configuration.get(ConfigurationKeys.HELP_URL);
- if (helpURL != null) {
- flashMessage = new FlashMessage("getHelpURL", helpURL);
- } else {
- throw new Exception();
- }
+ String newName = originalTitle;
+ if (workspaceFolderId != null) {
+ List ldTitleList = learningDesignDAO.getLearningDesignTitlesByWorkspaceFolder(workspaceFolderId);
+ int idx = 1;
- return flashMessage.serializeMessage();
+ Calendar calendar = Calendar.getInstance();
+ int mth = calendar.get(Calendar.MONTH) + 1;
+ String mthStr = new Integer(mth).toString();
+ if (mth < 10) {
+ mthStr = "0" + mthStr;
+ }
+ int day = calendar.get(Calendar.DAY_OF_MONTH);
+ String dayStr = new Integer(day).toString();
+ if (day < 10) {
+ dayStr = "0" + dayStr;
+ }
+ String nameMid = dayStr + mthStr + calendar.get(Calendar.YEAR);
+ while (ldTitleList.contains(newName)) {
+ newName = originalTitle + "_" + nameMid + "_" + idx;
+ idx++;
+ }
}
+ return newName;
+ }
- /**
- * Get a unique name for a learning design, based on the names of the
- * learning designs in the folder. If the learning design has duplicated
- * name in same folder, then the new name will have a timestamp. The new
- * name format will be oldname_ddMMYYYY_idx. The idx will be auto
- * incremental index number, start from 1. Warning - this may be quite
- * intensive as it gets all the learning designs in a folder.
- *
- * @param originalLearningDesign
- * @param workspaceFolder
- * @param copyType
- * @return
- */
- public String getUniqueNameForLearningDesign(String originalTitle,
- Integer workspaceFolderId) {
+ /**
+ * Creates a LD with only one, given activity.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Long createSingleActivityLearningDesign(String learningDesignTitle, Long toolID, Long toolContentID,
+ String contentFolderID) {
+ Integer userID = AuthoringService.getUserId();
+ User user = (User) baseDAO.find(User.class, userID);
- String newName = originalTitle;
- if (workspaceFolderId != null) {
- List ldTitleList = learningDesignDAO
- .getLearningDesignTitlesByWorkspaceFolder(workspaceFolderId);
- int idx = 1;
+ 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,
+ user, null, null, null, null, null, null, null, null, null, null, contentFolderID, false, null, 1);
+ learningDesign.setWorkspaceFolder(user.getWorkspace().getDefaultFolder());
+ learningDesignDAO.insert(learningDesign);
- Calendar calendar = Calendar.getInstance();
- int mth = calendar.get(Calendar.MONTH) + 1;
- String mthStr = new Integer(mth).toString();
- if (mth < 10) {
- mthStr = "0" + mthStr;
- }
- int day = calendar.get(Calendar.DAY_OF_MONTH);
- String dayStr = new Integer(day).toString();
- if (day < 10) {
- dayStr = "0" + dayStr;
- }
- String nameMid = dayStr + mthStr + calendar.get(Calendar.YEAR);
- while (ldTitleList.contains(newName)) {
- newName = originalTitle + "_" + nameMid + "_" + idx;
- idx++;
- }
- }
- return newName;
+ ToolActivity templateActivity = (ToolActivity) activityDAO.getTemplateActivityByLibraryID(toolID);
+ ToolActivity activity = (ToolActivity) templateActivity.createCopy(1);
+ activity.setLearningDesign(learningDesign);
+ activity.setToolContentId(toolContentID);
+ activity.setActivityUIID(1);
+ // some random coordinates
+ activity.setXcoord(300);
+ activity.setYcoord(300);
+ activityDAO.insert(activity);
+
+ learningDesign.getActivities().add(activity);
+ learningDesign.setFirstActivity(activity);
+ learningDesign.setValidDesign(true);
+ learningDesignDAO.update(learningDesign);
+
+ Long learningDesingID = learningDesign.getLearningDesignId();
+
+ LogEvent logEvent = new LogEvent();
+ logEvent.setLogEventTypeId(LogEvent.TYPE_TEACHER_LEARNING_DESIGN_CREATE);
+ logEvent.setLearningDesignId(learningDesingID);
+ logEvent.setUser(user);
+ logEvent.setOccurredDateTime(learningDesign.getCreateDateTime());
+ baseDAO.insert(logEvent);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Created a single activity LD with ID: " + learningDesingID);
}
+ return learningDesingID;
+ }
- public Grouping getGroupingById(Long groupingID) {
- return groupingDAO.getGroupingById(groupingID);
+ @Override
+ public Grouping getGroupingById(Long groupingID) {
+ return groupingDAO.getGroupingById(groupingID);
+ }
+
+ @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) {
+ log.error("The toolID " + toolID + " is not valid. A Tool with tool id " + toolID
+ + " does not exist on the database.");
+ return null;
+ }
+
+ String authorUrl = Configuration.get(ConfigurationKeys.SERVER_URL) + tool.getAuthorUrl();
+ if (toolContentID != null) {
+ authorUrl = WebUtil.appendParameterToURL(authorUrl, AttributeNames.PARAM_TOOL_CONTENT_ID,
+ toolContentID.toString());
+ }
+ if (contentFolderID != null) {
+ authorUrl = WebUtil
+ .appendParameterToURL(authorUrl, AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID);
+ }
+ return authorUrl;
+ }
}
\ No newline at end of file
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java
===================================================================
diff -u -r1a5446e3a1f962f1bb831c1bbaef14acf9d3635c -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision 1a5446e3a1f962f1bb831c1bbaef14acf9d3635c)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Vector;
+import org.lamsfoundation.lams.authoring.dto.ToolDTO;
import org.lamsfoundation.lams.learningdesign.Activity;
import org.lamsfoundation.lams.learningdesign.GateActivity;
import org.lamsfoundation.lams.learningdesign.Grouping;
@@ -59,7 +60,7 @@
* Returns a populated LearningDesign object corresponding to the given learningDesignID
*
* @param learningDesignID
- * The learning_design_id of the design which has to be fetched
+ * The learning_design_id of the design which has to be fetched
* @return LearningDesign The populated LearningDesign object corresponding to the given learningDesignID
*/
public LearningDesign getLearningDesign(Long learningDesignID);
@@ -69,20 +70,20 @@
* Does not set the original
*
* @param originalLearningDesign
- * The source learning design id.
+ * The source learning design id.
* @param copyType
- * purpose of copying the design. Can have one of the follwing values
- *
- * - LearningDesign.COPY_TYPE_NONE (for authoring enviornment)
- * - LearningDesign.COPY_TYPE_LESSON (for monitoring enviornment while creating a Lesson)
- * - LearningDesign.COPY_TYPE_PREVIEW (for previewing purposes)
- *
+ * purpose of copying the design. Can have one of the follwing values
+ *
+ * - LearningDesign.COPY_TYPE_NONE (for authoring enviornment)
+ * - LearningDesign.COPY_TYPE_LESSON (for monitoring enviornment while creating a Lesson)
+ * - LearningDesign.COPY_TYPE_PREVIEW (for previewing purposes)
+ *
* @param user
- * The user who has sent this request(author/teacher)
+ * The user who has sent this request(author/teacher)
* @param setOriginalDesign
- * If true, then sets the originalLearningDesign field in the new design
+ * If true, then sets the originalLearningDesign field in the new design
* @param custom
- * comma separated values used for tool adapters
+ * comma separated values used for tool adapters
* @return LearningDesign The new copy of learning design.
*/
public LearningDesign copyLearningDesign(LearningDesign originalLearningDesign, Integer copyType, User user,
@@ -94,20 +95,20 @@
* original learning design field, so it should not be used for creating lesson learning designs.
*
* @param originalLearningDesingID
- * the source learning design id.
+ * the source learning design id.
* @param copyType
- * purpose of copying the design. Can have one of the follwing values
- *
- * - LearningDesign.COPY_TYPE_NONE (for authoring enviornment)
- * - LearningDesign.COPY_TYPE_LESSON (for monitoring enviornment while creating a Lesson)
- * - LearningDesign.COPY_TYPE_PREVIEW (for previewing purposes)
- *
+ * purpose of copying the design. Can have one of the follwing values
+ *
+ * - LearningDesign.COPY_TYPE_NONE (for authoring enviornment)
+ * - LearningDesign.COPY_TYPE_LESSON (for monitoring enviornment while creating a Lesson)
+ * - LearningDesign.COPY_TYPE_PREVIEW (for previewing purposes)
+ *
* @param userID
- * The user_id of the user who has sent this request(author/teacher)
+ * The user_id of the user who has sent this request(author/teacher)
* @param workspaceFolderID
- * The workspacefolder where this copy of the design would be saved
+ * The workspacefolder where this copy of the design would be saved
* @param setOriginalDesign
- * If true, then sets the originalLearningDesign field in the new design
+ * If true, then sets the originalLearningDesign field in the new design
* @return new LearningDesign
*/
public LearningDesign copyLearningDesign(Long originalLearningDesignID, Integer copyType, Integer userID,
@@ -120,22 +121,22 @@
* sequence activity. Always sets the type to COPY_TYPE_NONE.
*
* @param originalDesignID
- * The design to be "modified". Required.
+ * The design to be "modified". Required.
* @param designToImportID
- * The design to be imported into originalLearningDesign. Required.
+ * The design to be imported into originalLearningDesign. Required.
* @param userId
- * Current User. Required.
+ * Current User. Required.
* @param customCSV
- * The custom CSV required to insert tool adapter tools, so their content can be copied in the
- * external server
+ * The custom CSV required to insert tool adapter tools, so their content can be copied in the external
+ * server
* @param createNewLearningDesign
- * If true, then a copy of the originalLearningDesign is made and the copy modified. If it is false,
- * then the originalLearningDesign is modified. Required.
+ * If true, then a copy of the originalLearningDesign is made and the copy modified. If it is false, then
+ * the originalLearningDesign is modified. Required.
* @param newDesignName
- * New name for the design if a new design is being create. Optional.
+ * New name for the design if a new design is being create. Optional.
* @param workspaceFolderID
- * The folder in which to put the new learning design if createNewLearningDesign = true. May be null
- * if createNewLearningDesign = false
+ * The folder in which to put the new learning design if createNewLearningDesign = true. May be null if
+ * createNewLearningDesign = false
* @return New / updated learning design
*/
public LearningDesign insertLearningDesign(Long originalDesignID, Long designToImportID, Integer userID,
@@ -156,7 +157,7 @@
* Returns a string representing the requested LearningDesign in WDDX format
*
* @param learningDesignID
- * The learning_design_id of the design whose WDDX packet is requested
+ * The learning_design_id of the design whose WDDX packet is requested
* @return String The requested LearningDesign in WDDX format
* @throws Exception
*/
@@ -169,7 +170,7 @@
* Note: it does not validate the design - that must be done separately.
*
* @param wddxPacket
- * The WDDX packet to be stored in the database
+ * The WDDX packet to be stored in the database
* @return Long learning design id
* @throws Exception
*/
@@ -223,15 +224,15 @@
* Saves the LearningDesign to the database. Will update if already saved. Used when a design is run.
*
* @param learningDesign
- * The LearningDesign to be saved
+ * The LearningDesign to be saved
*/
public void saveLearningDesign(LearningDesign learningDesign);
/**
* Returns a list of LearningDesign's in WDDX format, belonging to the given user
*
* @param user
- * The user_id of the User for whom the designs are to be fetched
+ * The user_id of the User for whom the designs are to be fetched
* @return The requested list of LearningDesign's in WDDX format
* @throws IOException
*/
@@ -253,11 +254,13 @@
* flash in WDDX format.
*
* @param toolID
- * The toolID in which to generate the new tool content id for
+ * The toolID in which to generate the new tool content id for
* @return String The new tool content id in WDDX Format
*/
- public String getToolContentID(Long toolID) throws IOException;
+ public String getToolContentIDFlash(Long toolID) throws IOException;
+ public Long generateToolContentID(Long toolID);
+
/**
* Calls an appropriate tool to copy the content indicated by toolContentId. Returns a string representing the new
* tool content id in WDDX format.
@@ -266,9 +269,9 @@
* ToolActivity - never a Gate or Grouping or Complex activity.
*
* @param toolContentID
- * The toolContentID indicating the content to copy
+ * The toolContentID indicating the content to copy
* @param customCSV
- * The customCSV if this is a tool adapter tool.
+ * The customCSV if this is a tool adapter tool.
* @return String The new tool content id in WDDX Format
*/
public String copyToolContent(Long toolContentID, String customCSV) throws IOException;
@@ -284,11 +287,11 @@
* It should only be called on a ToolActivity - never a Gate or Grouping or Complex activity.
*
* @param userId
- * Id of the user requesting the copy
+ * Id of the user requesting the copy
* @param customCSV
- * the customCSV required to copy tool adapter tools
+ * the customCSV required to copy tool adapter tools
* @param toolContentIDs
- * The toolContentIDs indicating the content to copy
+ * The toolContentIDs indicating the content to copy
* @return New Id map in format oldId1=newId1,oldId2=newId2,oldId3=newId3
*/
public String copyMultipleToolContent(Integer userId, List toolContentIds, String customCSV);
@@ -321,9 +324,9 @@
* learning design in WDDX format.
*
* @param design
- * The learning design whose WDDX packet is requested
+ * The learning design whose WDDX packet is requested
* @param userID
- * user_id of the User who will be editing the design.
+ * user_id of the User who will be editing the design.
* @throws UserException
* @throws LearningDesignException
* @throws IOException
@@ -338,11 +341,11 @@
*
*
* @param learningDesignID
- * The learning_design_id of the design for which editing has finished.
+ * The learning_design_id of the design for which editing has finished.
* @param userID
- * user_id of the User who has finished editing the design.
+ * user_id of the User who has finished editing the design.
* @param cancelled
- * flag specifying whether user cancelled or saved the edit
+ * flag specifying whether user cancelled or saved the edit
* @return wddx packet.
* @throws IOException
*/
@@ -398,5 +401,11 @@
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 createSingleActivityLearningDesign(String learningDesignTitle, Long toolID, Long toolContentID,
+ String contentFolderID);
}
\ No newline at end of file
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java
===================================================================
diff -u -r936b2a52791d8b519db737f96a5c24ffe410cd16 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 936b2a52791d8b519db737f96a5c24ffe410cd16)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -25,6 +25,8 @@
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Vector;
import javax.servlet.ServletException;
@@ -36,9 +38,20 @@
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
+import org.apache.tomcat.util.json.JSONException;
+import org.apache.tomcat.util.json.JSONObject;
import org.lamsfoundation.lams.authoring.service.IAuthoringService;
+import org.lamsfoundation.lams.learningdesign.dto.LicenseDTO;
+import org.lamsfoundation.lams.lesson.Lesson;
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
import org.lamsfoundation.lams.tool.ToolOutputDefinition;
+import org.lamsfoundation.lams.usermanagement.Organisation;
+import org.lamsfoundation.lams.usermanagement.Role;
+import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.usermanagement.service.IUserManagementService;
+import org.lamsfoundation.lams.util.CentralConstants;
+import org.lamsfoundation.lams.util.FileUtil;
import org.lamsfoundation.lams.util.FileUtilException;
import org.lamsfoundation.lams.util.WebUtil;
import org.lamsfoundation.lams.util.audit.IAuditService;
@@ -60,6 +73,8 @@
private static Logger log = Logger.getLogger(AuthoringAction.class);
private static IAuditService auditService;
+ private static IMonitoringService monitoringService;
+ private static IUserManagementService userManagementService;
public IAuthoringService getAuthoringService() {
WebApplicationContext webContext = WebApplicationContextUtils.getRequiredWebApplicationContext(this
@@ -85,15 +100,15 @@
* to the request's PrintWriter.
*
* @param mapping
- * action mapping (for the forward to the success jsp)
+ * action mapping (for the forward to the success jsp)
* @param request
- * needed to check the USE_JSP_OUTPUT parameter
+ * needed to check the USE_JSP_OUTPUT parameter
* @param response
- * to write out the wddx packet if not using the jsp
+ * to write out the wddx packet if not using the jsp
* @param wddxPacket
- * wddxPacket or message to be sent/displayed
+ * wddxPacket or message to be sent/displayed
* @param parameterName
- * session attribute to set if USE_JSP_OUTPUT is set
+ * session attribute to set if USE_JSP_OUTPUT is set
* @throws IOException
*/
private ActionForward outputPacket(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response,
@@ -111,7 +126,7 @@
try {
Long toolContentID = WebUtil.readLongParam(request, "toolContentID", false);
Integer definitionType = ToolOutputDefinition.DATA_OUTPUT_DEFINITION_TYPE_CONDITION; // WebUtil.readIntParam(request,
- // "toolOutputDefinitionType");
+ // "toolOutputDefinitionType");
wddxPacket = authoringService.getToolOutputDefinitions(toolContentID, definitionType);
} catch (Exception e) {
@@ -201,7 +216,7 @@
IAuthoringService authoringService = getAuthoringService();
try {
Long toolID = WebUtil.readLongParam(request, "toolID", false);
- wddxPacket = authoringService.getToolContentID(toolID);
+ wddxPacket = authoringService.getToolContentIDFlash(toolID);
} catch (Exception e) {
wddxPacket = handleException(e, "getAllLearningLibraryDetails", authoringService, true).serializeMessage();
}
@@ -239,13 +254,14 @@
* @return String The required information in WDDX format
* @throws IOException
*/
+ @SuppressWarnings("unchecked")
public ActionForward getAvailableLicenses(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws ServletException, Exception {
FlashMessage flashMessage = null;
try {
IAuthoringService authoringService = getAuthoringService();
- Vector licenses = authoringService.getAvailableLicenses();
+ Vector licenses = authoringService.getAvailableLicenses();
flashMessage = new FlashMessage("getAvailableLicenses", licenses);
} catch (Exception e) {
AuthoringAction.log.error("getAvailableLicenses: License details unavailable due to system error.", e);
@@ -299,6 +315,74 @@
}
/**
+ * Creates a copy of default tool content.
+ */
+ public ActionForward createToolContent(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, JSONException {
+ IAuthoringService authoringService = getAuthoringService();
+ Long toolID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_ID);
+ // generate the next unique content ID for the tool
+ Long toolContentID = authoringService.generateToolContentID(toolID);
+ if (toolContentID != null) {
+ String contentFolderID = FileUtil.generateUniqueContentFolderID();
+ String authorUrl = authoringService.getToolAuthorUrl(toolID, toolContentID, contentFolderID);
+ if (authorUrl != null) {
+ JSONObject responseJSON = new JSONObject();
+ responseJSON.put("authorURL", authorUrl);
+ // return the generated values
+ responseJSON.put(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentID);
+ responseJSON.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID);
+ response.setContentType("application/json;charset=utf-8");
+ response.getWriter().write(responseJSON.toString());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Creates a LD with the given activity and starts a lesson with default class and settings.
+ */
+ @SuppressWarnings("unchecked")
+ public ActionForward createSingleActivityLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+ IAuthoringService authoringService = getAuthoringService();
+ Long toolID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_ID);
+ 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
+ Long learningDesignID = authoringService.createSingleActivityLearningDesign(learningDesignTitle, toolID,
+ toolContentID, contentFolderID);
+ 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);
+
+ List staffList = new LinkedList();
+ staffList.add(user);
+
+ // add organisation's learners as lesson participants
+ List learnerList = new LinkedList();
+ Vector learnerVector = getUserManagementService().getUsersFromOrganisationByRole(organisationID,
+ Role.LEARNER, false, true);
+ learnerList.addAll(learnerVector);
+ getMonitoringService().createLessonClassForLesson(lesson.getLessonId(), organisation,
+ organisation.getName() + "Learners", learnerList, organisation.getName() + "Staff", staffList,
+ userID);
+
+ getMonitoringService().startLesson(lesson.getLessonId(), userID);
+
+ if (AuthoringAction.log.isDebugEnabled()) {
+ AuthoringAction.log.debug("Created a single activity lesson with ID: " + lesson.getLessonId());
+ }
+ }
+ return null;
+ }
+
+ /**
* Handle flash error.
*
* @param e
@@ -331,4 +415,22 @@
return AuthoringAction.auditService;
}
-}
+ private IMonitoringService getMonitoringService() {
+ if (AuthoringAction.monitoringService == null) {
+ WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ AuthoringAction.monitoringService = (IMonitoringService) ctx.getBean("monitoringService");
+ }
+ return AuthoringAction.monitoringService;
+ }
+
+ private IUserManagementService getUserManagementService() {
+ if (AuthoringAction.userManagementService == null) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ AuthoringAction.userManagementService = (IUserManagementService) wac
+ .getBean(CentralConstants.USER_MANAGEMENT_SERVICE_BEAN_NAME);
+ }
+ return AuthoringAction.userManagementService;
+ }
+}
\ No newline at end of file
Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java
===================================================================
diff -u -r67dfbf3258ae491f495d918b8c397819ffed018f -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 67dfbf3258ae491f495d918b8c397819ffed018f)
+++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -44,11 +45,14 @@
import org.apache.struts.action.ActionForm;
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.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;
@@ -77,9 +81,10 @@
private static Logger log = Logger.getLogger(DisplayGroupAction.class);
private static IUserManagementService service;
private static LessonService lessonService;
+ private static IAuthoringService authoringService;
private Integer stateId = OrganisationState.ACTIVE;
- @SuppressWarnings( { "unchecked" })
+ @SuppressWarnings({ "unchecked" })
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
@@ -110,8 +115,8 @@
if (StringUtils.equals(display, "contents")) {
iob = new IndexOrgBean(org.getOrganisationId(), org.getName(), org.getOrganisationType()
.getOrganisationTypeId());
- iob = populateContentsOrgBean(iob, org, roles, request.getRemoteUser(), request
- .isUserInRole(Role.SYSADMIN));
+ iob = populateContentsOrgBean(iob, org, roles, request.getRemoteUser(),
+ request.isUserInRole(Role.SYSADMIN));
forwardPath = "groupContents";
} else if (StringUtils.equals(display, "header")) {
iob = createHeaderOrgBean(org, roles, request.getRemoteUser(), request.isUserInRole(Role.SYSADMIN),
@@ -122,14 +127,15 @@
true);
}
+ request.setAttribute("tools", getAuthoringService().getAllToolDTOs());
request.setAttribute("orgBean", iob);
request.setAttribute("allowSorting", allowSorting);
}
return mapping.findForward(forwardPath);
}
- @SuppressWarnings( { "unchecked" })
+ @SuppressWarnings({ "unchecked" })
private IndexOrgBean createHeaderOrgBean(Organisation org, List roles, String username,
boolean isSysAdmin, boolean includeContents) throws SQLException, NamingException {
IndexOrgBean orgBean = new IndexOrgBean(org.getOrganisationId(), org.getName(), org.getOrganisationType()
@@ -146,32 +152,33 @@
}
if (org.getEnableGradebookForLearners() && contains(roles, Role.ROLE_LEARNER)) {
- try {
- // for some reason the name needs to be encoded twice so it's encoded on JSP page as well
- String encodedOrgName = URLEncoder.encode(URLEncoder.encode(org.getName(), "UTF8"), "UTF8");
- String link = "javascript:openGradebookLearnerPopup(" + "'" + encodedOrgName + "','"
- + Configuration.get(ConfigurationKeys.SERVER_URL)
- + "/gradebook/gradebookLearning.do?dispatch=courseLearner&organisationID="
- + org.getOrganisationId() + "'," + "750,400,0,0);";
-
- links.add(new IndexLinkBean("index.coursegradebook.learner", link, "my-grades-button", null, null));
- } catch (UnsupportedEncodingException e) {
- log.error("Error while encoding course name, skipping gradebook course monitor link", e);
- }
+ try {
+ // for some reason the name needs to be encoded twice so it's encoded on JSP page as well
+ String encodedOrgName = URLEncoder.encode(URLEncoder.encode(org.getName(), "UTF8"), "UTF8");
+ String link = "javascript:openGradebookLearnerPopup(" + "'" + encodedOrgName + "','"
+ + Configuration.get(ConfigurationKeys.SERVER_URL)
+ + "/gradebook/gradebookLearning.do?dispatch=courseLearner&organisationID="
+ + org.getOrganisationId() + "'," + "750,400,0,0);";
+
+ links.add(new IndexLinkBean("index.coursegradebook.learner", link, "my-grades-button", null, null));
+ } catch (UnsupportedEncodingException e) {
+ DisplayGroupAction.log.error(
+ "Error while encoding course name, skipping gradebook course monitor link", e);
+ }
}
-
+
if ((contains(roles, Role.ROLE_GROUP_ADMIN) || contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles,
- Role.ROLE_MONITOR))
- && stateId.equals(OrganisationState.ACTIVE)) {
+ Role.ROLE_MONITOR)) && stateId.equals(OrganisationState.ACTIVE)) {
if (orgBean.getType().equals(OrganisationType.COURSE_TYPE)) {
if ((!isSysAdmin)
&& (contains(roles, Role.ROLE_GROUP_ADMIN) || contains(roles, Role.ROLE_GROUP_MANAGER))) {
moreLinks.add(new IndexLinkBean("index.classman", "javascript:openOrgManagement("
+ org.getOrganisationId() + ")", "manage-group-button", null, null));
}
- if (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR))
+ 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));
+ }
moreLinks.add(new IndexLinkBean("index.searchlesson", Configuration.get(ConfigurationKeys.SERVER_URL)
+ "/findUserLessons.do?dispatch=getResults&courseID=" + org.getOrganisationId()
+ "&KeepThis=true&TB_iframe=true&height=400&width=600", "search-lesson thickbox"
@@ -186,7 +193,8 @@
}
// Adding gradebook course monitor links if enabled
- if (org.getEnableGradebookForMonitors() && (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR))) {
+ if (org.getEnableGradebookForMonitors()
+ && (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR))) {
try {
// for some reason the name needs to be encoded twice so it's encoded on JSP page as well
String encodedOrgName = URLEncoder.encode(URLEncoder.encode(org.getName(), "UTF8"), "UTF8");
@@ -197,14 +205,16 @@
moreLinks.add(new IndexLinkBean("index.coursegradebook", link, "course-gradebook-button", null,
"index.coursegradebook.tooltip"));
} catch (UnsupportedEncodingException e) {
- log.error("Error while encoding course name, skipping gradebook course monitor link", e);
+ DisplayGroupAction.log.error(
+ "Error while encoding course name, skipping gradebook course monitor link", e);
}
}
- } else {//CLASS_TYPE
- if (contains(roles, Role.ROLE_GROUP_MANAGER) || contains(roles, Role.ROLE_MONITOR))
+ } 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));
+ }
// Adding gradebook course monitor links if enabled
if (org.getParentOrganisation().getEnableGradebookForMonitors()
@@ -219,7 +229,8 @@
moreLinks.add(new IndexLinkBean("index.coursegradebook.subgroup", link, "mycourses-mark-img",
null, null));
} catch (UnsupportedEncodingException e) {
- log.error("Error while encoding course name, skipping gradebook course monitor link", e);
+ DisplayGroupAction.log.error(
+ "Error while encoding course name, skipping gradebook course monitor link", e);
}
}
}
@@ -244,13 +255,13 @@
String username, boolean isSysAdmin) throws SQLException, NamingException {
User user = (User) getService().findByProperty(User.class, "login", username).get(0);
- // set lesson beans
+ // set lesson beans
List lessonBeans = null;
try {
Map map = populateLessonBeans(user.getUserId(), org.getOrganisationId(), roles);
lessonBeans = IndexUtils.sortLessonBeans(org.getOrderedLessonIds(), map);
} catch (Exception e) {
- log.error("Failed retrieving user's lessons from database: " + e, e);
+ DisplayGroupAction.log.error("Failed retrieving user's lessons from database: " + e, e);
}
orgBean.setLessons(lessonBeans);
@@ -265,7 +276,7 @@
List userOrganisationRoles = getService().getUserOrganisationRoles(
organisation.getOrganisationId(), username);
// don't list the subgroup if user is not a member, and not a group admin/manager
- if (userOrganisationRoles == null || userOrganisationRoles.isEmpty()) {
+ if ((userOrganisationRoles == null) || userOrganisationRoles.isEmpty()) {
if (!contains(roles, Role.ROLE_GROUP_ADMIN) && !contains(roles, Role.ROLE_GROUP_MANAGER)
&& !isSysAdmin) {
continue;
@@ -274,8 +285,9 @@
for (UserOrganisationRole userOrganisationRole : userOrganisationRoles) {
classRoles.add(userOrganisationRole.getRole().getRoleId());
}
- if (contains(roles, Role.ROLE_GROUP_MANAGER))
+ if (contains(roles, Role.ROLE_GROUP_MANAGER)) {
classRoles.add(Role.ROLE_GROUP_MANAGER);
+ }
childOrgBeans.add(createHeaderOrgBean(organisation, classRoles, username, isSysAdmin, true));
}
}
@@ -295,12 +307,13 @@
// remove lessons which do not have preceding lessons completed
Iterator> lessonIter = map.entrySet().iterator();
while (lessonIter.hasNext()) {
- Entry entry = lessonIter.next();
- if (entry.getValue().isDependent() && !lessonService.checkLessonReleaseConditions(entry.getKey(), userId)) {
+ Entry entry = lessonIter.next();
+ if (entry.getValue().isDependent()
+ && !DisplayGroupAction.lessonService.checkLessonReleaseConditions(entry.getKey(), userId)) {
lessonIter.remove();
}
}
-
+
for (IndexLessonBean bean : map.values()) {
List lessonLinks = new ArrayList();
String url = null;
@@ -319,14 +332,14 @@
}
}
}
- if (lessonLinks.size() > 0 || url != null) {
+ if ((lessonLinks.size() > 0) || (url != null)) {
bean.setUrl(url);
bean.setLinks(lessonLinks);
}
}
// getting the organisation
- Organisation org = (Organisation) service.findById(Organisation.class, orgId);
+ Organisation org = (Organisation) DisplayGroupAction.service.findById(Organisation.class, orgId);
// Getting the parent organisation if applicable
Organisation parent = org.getParentOrganisation();
@@ -336,7 +349,8 @@
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);
+ 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());
@@ -345,24 +359,23 @@
if (lessonLinks == null) {
lessonLinks = new ArrayList();
}
-
-
+
if ((isGroupManagerOrMonitor && stateId.equals(OrganisationState.ACTIVE))
|| (stateId.equals(OrganisationState.ARCHIVED) && contains(roles, Role.ROLE_GROUP_MANAGER))) {
- lessonLinks.add(new IndexLinkBean("index.monitor",
- "javascript:showMonitorLessonDialog(" + bean.getId() + ")", null, "mycourses-monitor-img", null));
+ lessonLinks.add(new IndexLinkBean("index.monitor", "javascript:showMonitorLessonDialog(" + bean.getId()
+ + ")", null, "mycourses-monitor-img", null));
}
// Adding lesson notifications links if enabled
if (isGroupManagerOrMonitor && bean.isEnableLessonNotifications()) {
- lessonLinks.add(new IndexLinkBean("index.emailnotifications", "javascript:showNotificationsDialog(null,"
- + bean.getId() + ")", null, "mycourses-notifications-img",
- "index.emailnotifications.tooltip"));
+ lessonLinks.add(new IndexLinkBean("index.emailnotifications",
+ "javascript:showNotificationsDialog(null," + bean.getId() + ")", null,
+ "mycourses-notifications-img", "index.emailnotifications.tooltip"));
}
// Adding gradebook course monitor links if enabled
if (isGroupManagerOrMonitor
- && (org.getEnableGradebookForMonitors() || (parent != null && parent
+ && (org.getEnableGradebookForMonitors() || ((parent != null) && parent
.getEnableGradebookForMonitors()))) {
try {
String encodedOrgName = URLEncoder.encode(URLEncoder.encode(org.getName(), "UTF8"), "UTF8");
@@ -372,7 +385,8 @@
lessonLinks.add(new IndexLinkBean("index.coursegradebookmonitor", link, null, "mycourses-mark-img",
null));
} catch (UnsupportedEncodingException e) {
- log.error("Error while encoding course name, skipping gradebook lesson monitor link", e);
+ DisplayGroupAction.log.error(
+ "Error while encoding course name, skipping gradebook lesson monitor link", e);
}
}
@@ -384,7 +398,7 @@
lessonLinks.add(new IndexLinkBean("index.conditions", conditionsLink, "thickbox" + orgId,
"mycourses-conditions-img", "index.conditions.tooltip"));
}
-
+
// Add delete lesson option
if (isGroupManagerOrMonitor) {
String removeLessonLink = "javascript:removeLesson(" + bean.getId() + ")";
@@ -409,27 +423,37 @@
private boolean contains(List roles, Integer roleId) {
for (int i = 0; i < roles.size(); i++) {
- if (roleId.equals(roles.get(i)))
+ if (roleId.equals(roles.get(i))) {
return true;
+ }
}
return false;
}
private IUserManagementService getService() {
- if (service == null) {
+ if (DisplayGroupAction.service == null) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
.getServletContext());
- service = (IUserManagementService) ctx.getBean("userManagementService");
+ DisplayGroupAction.service = (IUserManagementService) ctx.getBean("userManagementService");
}
- return service;
+ return DisplayGroupAction.service;
}
private LessonService getLessonService() {
- if (lessonService == null) {
+ if (DisplayGroupAction.lessonService == null) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
.getServletContext());
- lessonService = (LessonService) ctx.getBean("lessonService");
+ DisplayGroupAction.lessonService = (LessonService) ctx.getBean("lessonService");
}
- return lessonService;
+ return DisplayGroupAction.lessonService;
}
-}
+
+ private IAuthoringService getAuthoringService() {
+ if (DisplayGroupAction.authoringService == null) {
+ WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ DisplayGroupAction.authoringService = (IAuthoringService) ctx.getBean("authoringService");
+ }
+ return DisplayGroupAction.authoringService;
+ }
+}
\ No newline at end of file
Index: lams_central/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_central/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_central/web/includes/javascript/groupDisplay.js
===================================================================
diff -u -r4af02ecbccab467c19f535fd5c6bf38ab8e7ef7a -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_central/web/includes/javascript/groupDisplay.js (.../groupDisplay.js) (revision 4af02ecbccab467c19f535fd5c6bf38ab8e7ef7a)
+++ lams_central/web/includes/javascript/groupDisplay.js (.../groupDisplay.js) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -36,106 +36,147 @@
});
// initialise lesson dialog
- $('#addLessonDialog')
- .dialog(
- {
- 'autoOpen' : false,
- 'height' : 600,
- 'width' : 800,
- 'modal' : true,
- 'resizable' : false,
- 'hide' : 'fold',
- 'open' : function() {
- // load contents after opening the dialog
- $('#addLessonFrame')
- .attr(
- 'src',
- LAMS_URL
- + 'home.do?method=addLesson&organisationID='
- + $(this).dialog('option',
- 'orgID'));
- },
- 'close' : function() {
- // refresh if lesson was added
- if ($(this).dialog('option', 'refresh')) {
- refresh();
- }
- }
- // tabs are the title bar, so remove dialog's one
- }).closest('.ui-dialog').children('.ui-dialog-titlebar')
- .remove();
-
+ $('#addLessonDialog').dialog(
+ {
+ 'autoOpen' : false,
+ 'height' : 600,
+ 'width' : 800,
+ 'modal' : true,
+ 'resizable' : false,
+ 'hide' : 'fold',
+ 'open' : function() {
+ // load contents after opening the dialog
+ $('#addLessonFrame')
+ .attr(
+ 'src',
+ LAMS_URL
+ + 'home.do?method=addLesson&organisationID='
+ + $(this).dialog('option',
+ 'orgID'));
+ },
+ 'close' : function() {
+ // refresh if lesson was added
+ if ($(this).dialog('option', 'refresh')) {
+ loadOrgTab(null, true);
+ }
+ }
+ // tabs are the title bar, so remove dialog's one
+ }).closest('.ui-dialog').children('.ui-dialog-titlebar')
+ .remove();
+
+ // initialise single activity lesson dialog
+ $('#addSingleActivityLessonDialog').dialog(
+ {
+ 'autoOpen' : false,
+ 'height' : 600,
+ 'width' : 850,
+ 'modal' : true,
+ 'resizable' : false,
+ 'hide' : 'fold',
+ 'title' : LABELS.SINGLE_ACTIVITY_LESSON_TITLE,
+ 'open' : function() {
+ var dialog = $(this);
+ var toolID = dialog.dialog('option', 'toolID');
+ $.ajax({
+ async : false,
+ cache : false,
+ url : LAMS_URL + "authoring/author.do",
+ dataType : 'json',
+ data : {
+ 'method' : 'createToolContent',
+ 'toolID' : toolID
+ },
+ success : function(response) {
+ dialog.dialog('option', 'toolContentID', response.toolContentID);
+ dialog.dialog('option', 'contentFolderID', response.contentFolderID);
+ $('#addSingleActivityLessonFrame').attr('src',
+ response.authorURL + '¬ifyCloseURL='
+ + encodeURIComponent(LAMS_URL
+ + 'dialogCloser.jsp?function=closeAddSingleActivityLessonDialog&noopener=true'));
+ }
+ });
+ },
+ 'close' : function() {
+ $('#addSingleActivityLessonFrame').attr('src', null);
+ // refresh if lesson was added
+ if ($(this).dialog('option', 'refresh')) {
+ loadOrgTab(null, true);
+ }
+ }
+ });
+
// initialise monitor dialog
- $('#monitorDialog')
- .dialog(
- {
- 'autoOpen' : false,
- 'height' : 600,
- 'width' : 800,
- 'modal' : true,
- 'resizable' : false,
- 'hide' : 'fold',
- 'open' : function() {
- // load contents after opening the dialog
- $('#monitorFrame')
- .attr(
- 'src',
- LAMS_URL
- + 'monitoring/monitoring.do?method=monitorLesson&lessonID='
- + $(this).dialog('option',
- 'lessonID'));
- },
- 'close' : function() {
- // refresh if lesson was added
- if ($(this).dialog('option', 'refresh')) {
- refresh();
- }
- }
- }).closest('.ui-dialog').children('.ui-dialog-titlebar')
- .remove();
+ $('#monitorDialog').dialog(
+ {
+ 'autoOpen' : false,
+ 'height' : 600,
+ 'width' : 800,
+ 'modal' : true,
+ 'resizable' : false,
+ 'hide' : 'fold',
+ 'open' : function() {
+ // load contents after opening the dialog
+ $('#monitorFrame')
+ .attr(
+ 'src',
+ LAMS_URL
+ + 'monitoring/monitoring.do?method=monitorLesson&lessonID='
+ + $(this).dialog('option',
+ 'lessonID'));
+ },
+ 'close' : function() {
+ // refresh if lesson was added
+ if ($(this).dialog('option', 'refresh')) {
+ loadOrgTab(null, true);
+ }
+ }
+ }).closest('.ui-dialog').children('.ui-dialog-titlebar')
+ .remove();
// initialise notifications dialog
- $('#notificationsDialog')
- .dialog(
- {
- 'autoOpen' : false,
- 'height' : 600,
- 'width' : 850,
- 'modal' : true,
- 'resizable' : false,
- 'hide' : 'fold',
- 'title' : LABELS.EMAIL_NOTIFICATIONS_TITLE,
- 'open' : function() {
- var lessonID = $(this).dialog('option', 'lessonID');
- // if lesson ID is given, use lesson view; otherwise
- // use course view
- if (lessonID) {
- // load contents after opening the dialog
- $('#notificationsFrame')
- .attr(
- 'src',
- LAMS_URL
- + 'monitoring/emailNotifications.do?method=getLessonView&lessonID='
- + lessonID);
- } else {
- var orgID = $(this).dialog('option', 'orgID');
- $('#notificationsFrame')
- .attr(
- 'src',
- LAMS_URL
- + 'monitoring/emailNotifications.do?method=getCourseView&organisationID='
- + orgID);
- }
- },
- 'close' : function() {
- $('#notificationsFrame').attr('src', null);
- }
- });
+ $('#notificationsDialog').dialog(
+ {
+ 'autoOpen' : false,
+ 'height' : 600,
+ 'width' : 850,
+ 'modal' : true,
+ 'resizable' : false,
+ 'hide' : 'fold',
+ 'title' : LABELS.EMAIL_NOTIFICATIONS_TITLE,
+ 'open' : function() {
+ var lessonID = $(this).dialog('option', 'lessonID');
+ // if lesson ID is given, use lesson view; otherwise
+ // use course view
+ if (lessonID) {
+ // load contents after opening the dialog
+ $('#notificationsFrame')
+ .attr(
+ 'src',
+ LAMS_URL
+ + 'monitoring/emailNotifications.do?method=getLessonView&lessonID='
+ + lessonID);
+ } else {
+ var orgID = $(this).dialog('option', 'orgID');
+ $('#notificationsFrame')
+ .attr(
+ 'src',
+ LAMS_URL
+ + 'monitoring/emailNotifications.do?method=getCourseView&organisationID='
+ + orgID);
+ }
+ },
+ 'close' : function() {
+ $('#notificationsFrame').attr('src', null);
+ }
+ });
}
-function loadOrgTab(orgTab) {
- if (!orgTab.text()) {
- var orgId = orgTab.attr("id").split('-')[1];
+function loadOrgTab(orgTab, refresh) {
+ if (!orgTab) {
+ orgTab = $('div[id^=orgTab-' + $('#orgTabs').tabs('option','active') + ']');
+ }
+ if (refresh || !orgTab.text()) {
+ var orgId = orgTab.attr("id").split('-')[2];
orgTab.load(
"displayGroup.do",
@@ -357,6 +398,13 @@
$("#addLessonDialog").dialog('option', 'orgID', orgID).dialog('open');
}
+function showAddSingleActivityLessonDialog(orgID, toolID) {
+ $("#addSingleActivityLessonDialog").dialog('option', {
+ 'orgID' : orgID,
+ 'toolID' : toolID
+ }).dialog('open');
+}
+
function showNotificationsDialog(organisationID, lessonID) {
$("#notificationsDialog").dialog('option', {
'orgID' : organisationID,
@@ -372,6 +420,40 @@
.dialog('close');
}
+function closeAddSingleActivityLessonDialog(action) {
+ $('#addSingleActivityLessonFrame').attr('src', null);
+ var dialog = $('#addSingleActivityLessonDialog');
+ var save = action == 'save';
+
+ if (save) {
+ var ldTitle = '';
+ while (ldTitle == '') {
+ ldTitle = prompt('Please enter a title for the lesson');
+ if (ldTitle == '') {
+ alert('You must enter a title. If you do not want to save the lesson, click Cancel');
+ }
+ }
+
+ if (ldTitle) {
+ $.ajax({
+ async : false,
+ cache : false,
+ url : LAMS_URL + "authoring/author.do",
+ dataType : 'text',
+ data : {
+ 'method' : 'createSingleActivityLesson',
+ 'organisationID' : dialog.dialog('option', 'orgID'),
+ 'toolID' : dialog.dialog('option', 'toolID'),
+ 'toolContentID' : dialog.dialog('option', 'toolContentID'),
+ 'contentFolderID' : dialog.dialog('option', 'contentFolderID'),
+ 'title' : ldTitle
+ }
+ });
+ }
+ }
+ dialog.dialog('option', 'refresh', save).dialog('close');
+}
+
function closeMonitorLessonDialog(refresh) {
$('#monitorFrame').attr('src', null);
// was the dialog just closed or a new lesson really added?
Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java
===================================================================
diff -u -r4af02ecbccab467c19f535fd5c6bf38ab8e7ef7a -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision 4af02ecbccab467c19f535fd5c6bf38ab8e7ef7a)
+++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -26,6 +26,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -61,6 +62,7 @@
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.usermanagement.dto.UserFlashDTO;
import org.lamsfoundation.lams.usermanagement.dto.UserManageBean;
+import org.lamsfoundation.lams.usermanagement.util.CollapsedOrgDTOComparator;
import org.lamsfoundation.lams.util.Configuration;
import org.lamsfoundation.lams.util.ConfigurationKeys;
import org.lamsfoundation.lams.util.HashUtil;
@@ -1126,6 +1128,7 @@
}
}
}
+ Collections.sort(dtoList, new CollapsedOrgDTOComparator());
return dtoList;
}
Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/util/CollapsedOrgDTOComparator.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/usermanagement/util/CollapsedOrgDTOComparator.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/util/CollapsedOrgDTOComparator.java (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.usermanagement.util;
+
+import java.util.Comparator;
+
+import org.lamsfoundation.lams.usermanagement.dto.CollapsedOrgDTO;
+
+public class CollapsedOrgDTOComparator implements Comparator {
+
+ @Override
+ public int compare(CollapsedOrgDTO o1, CollapsedOrgDTO o2) {
+ return o1.getOrgName().compareToIgnoreCase(o2.getOrgName());
+ }
+}
\ No newline at end of file
Index: lams_common/src/java/org/lamsfoundation/lams/web/util/AttributeNames.java
===================================================================
diff -u -r7817bc4fce30416c9737875ae2d137be0c6aa8ba -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_common/src/java/org/lamsfoundation/lams/web/util/AttributeNames.java (.../AttributeNames.java) (revision 7817bc4fce30416c9737875ae2d137be0c6aa8ba)
+++ lams_common/src/java/org/lamsfoundation/lams/web/util/AttributeNames.java (.../AttributeNames.java) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -44,6 +44,7 @@
public static final String PARAM_ROLE = "role";
public static final String PARAM_SESSION_STATUS = "sessionStatus";
public static final String PARAM_USER_ID = "userID";
+ public static final String PARAM_TOOL_ID = "toolID";
public static final String PARAM_TOOL_CONTENT_ID = "toolContentID";
public static final String PARAM_TOOL_SESSION_ID = "toolSessionID";
public static final String PARAM_CURRENT_ACTIVITY_ID = "currentActivityID";
Index: lams_learning/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_learning/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_learning/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_learning/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_learning/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision d56929f06ad90a63082d514e6521adc175f3de27)
+++ lams_learning/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -143,50 +191,6 @@
- Help tag
- Help tag
-
-
- help
- org.lamsfoundation.lams.web.tag.HelpTag
- empty
-
-
- Help tag
- module
- false
-
- true
-
-
-
- Help tag
- toolSignature
- false
-
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
-
-
-
Checks whether Flash enabled for learner
Checks whether Flash enabled for learner
Index: lams_monitoring/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_monitoring/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_monitoring/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_monitoring/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_monitoring/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision d56929f06ad90a63082d514e6521adc175f3de27)
+++ lams_monitoring/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -143,50 +191,6 @@
- Help tag
- Help tag
-
-
- help
- org.lamsfoundation.lams.web.tag.HelpTag
- empty
-
-
- Help tag
- module
- false
-
- true
-
-
-
- Help tag
- toolSignature
- false
-
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
-
-
-
Checks whether Flash enabled for learner
Checks whether Flash enabled for learner
Index: lams_tool_assessment/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_assessment/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_tool_assessment/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_tool_assessment/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rc62dac7b0a64132b9228ec2367b4749fe37205a9 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_assessment/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision c62dac7b0a64132b9228ec2367b4749fe37205a9)
+++ lams_tool_assessment/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -143,47 +191,14 @@
- Help tag
- Help tag
+ Checks whether Flash enabled for learner
+ Checks whether Flash enabled for learner
- help
- org.lamsfoundation.lams.web.tag.HelpTag
+ LearnerFlashEnabled
+ org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
empty
-
- Help tag
- module
- false
-
- true
-
-
-
- Help tag
- toolSignature
- false
-
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
@@ -445,7 +460,7 @@
Passon
/WEB-INF/tags/Passon.tag
-
+
Date
/WEB-INF/tags/Date.tag
@@ -493,16 +508,17 @@
- Checks whether Flash enabled for learner
- Checks whether Flash enabled for learner
-
-
- LearnerFlashEnabled
- org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
- empty
-
+ Checks whether Flash enabled for learner
+ Checks whether Flash enabled for learner
+
+
+ LearnerFlashEnabled
+ org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
+ empty
+
head
/WEB-INF/tags/Head.tag
-
+
+
Index: lams_tool_assessment/web/pages/authoring/parts/overallfeedbacklist.jsp
===================================================================
diff -u -r85413a1cbf05b75538871b89b6efa333ec700293 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_assessment/web/pages/authoring/parts/overallfeedbacklist.jsp (.../overallfeedbacklist.jsp) (revision 85413a1cbf05b75538871b89b6efa333ec700293)
+++ lams_tool_assessment/web/pages/authoring/parts/overallfeedbacklist.jsp (.../overallfeedbacklist.jsp) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -100,6 +100,9 @@
<%-- This script will adjust assessment item input area height according to the new instruction item amount. --%>
Index: lams_tool_bbb/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_bbb/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_tool_bbb/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_tool_bbb/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_bbb/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision d56929f06ad90a63082d514e6521adc175f3de27)
+++ lams_tool_bbb/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -143,47 +191,14 @@
- Help tag
- Help tag
+ Checks whether Flash enabled for learner
+ Checks whether Flash enabled for learner
- help
- org.lamsfoundation.lams.web.tag.HelpTag
+ LearnerFlashEnabled
+ org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
empty
-
- Help tag
- module
- false
-
- true
-
-
-
- Help tag
- toolSignature
- false
-
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
@@ -445,7 +460,7 @@
Passon
/WEB-INF/tags/Passon.tag
-
+
Date
/WEB-INF/tags/Date.tag
@@ -493,16 +508,17 @@
- Checks whether Flash enabled for learner
- Checks whether Flash enabled for learner
-
-
- LearnerFlashEnabled
- org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
- empty
-
+ Checks whether Flash enabled for learner
+ Checks whether Flash enabled for learner
+
+
+ LearnerFlashEnabled
+ org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
+ empty
+
head
/WEB-INF/tags/Head.tag
-
+
+
Index: lams_tool_chat/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_chat/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_tool_chat/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_tool_chat/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_chat/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision d56929f06ad90a63082d514e6521adc175f3de27)
+++ lams_tool_chat/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -143,50 +191,6 @@
- Help tag
- Help tag
-
-
- help
- org.lamsfoundation.lams.web.tag.HelpTag
- empty
-
-
- Help tag
- module
- false
-
- true
-
-
-
- Help tag
- toolSignature
- false
-
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
-
-
-
Checks whether Flash enabled for learner
Checks whether Flash enabled for learner
Index: lams_tool_chat/web/pages/authoring/addCondition.jsp
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_chat/web/pages/authoring/addCondition.jsp (.../addCondition.jsp) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_chat/web/pages/authoring/addCondition.jsp (.../addCondition.jsp) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -38,7 +38,7 @@
-
Index: lams_tool_chat/web/pages/authoring/conditionList.jsp
===================================================================
diff -u -rcd0d0b28a7c27711a74ce2b41821f3ccf5c80df9 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_chat/web/pages/authoring/conditionList.jsp (.../conditionList.jsp) (revision cd0d0b28a7c27711a74ce2b41821f3ccf5c80df9)
+++ lams_tool_chat/web/pages/authoring/conditionList.jsp (.../conditionList.jsp) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -82,10 +82,10 @@
<%-- This script will works when a new resoruce Condition submit in order to refresh "TaskList List" panel. --%>
Index: lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r07b55d09d9f4f900a326b1763ee91d269bcca940 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 07b55d09d9f4f900a326b1763ee91d269bcca940)
+++ lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -106,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld
===================================================================
diff -u -rc62dac7b0a64132b9228ec2367b4749fe37205a9 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision c62dac7b0a64132b9228ec2367b4749fe37205a9)
+++ lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -11,6 +11,10 @@
LAMSTags
+
+ org.lamsfoundation.lams.web.SessionListener
+
+
Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/
@@ -44,6 +48,50 @@
+ Help tag
+ Help tag
+
+
+ help
+ org.lamsfoundation.lams.web.tag.HelpTag
+ empty
+
+
+ Help tag
+ module
+ false
+
+ true
+
+
+
+ Help tag
+ toolSignature
+ false
+
+ true
+
+
+
+ Help tag
+ page
+ false
+
+ true
+
+
+
+ Help tag
+ style
+ false
+
+ true
+
+
+
+
+
+
Get the configuration value for the specified key
Configuration value
@@ -123,67 +171,34 @@
- Help tag
- Help tag
+ Converts role name into form usable as message resources key
+ Converts role name into form usable as message resources key
- help
- org.lamsfoundation.lams.web.tag.HelpTag
+ role
+ org.lamsfoundation.lams.web.tag.RoleTag
empty
- Help tag
- module
- false
+ Converts role name into form usable as message resources key
+ role
+ true
true
-
- Help tag
- toolSignature
- false
- true
-
-
-
- Help tag
- page
- false
-
- true
-
-
-
- Help tag
- style
- false
-
- true
-
-
-
- Converts role name into form usable as message daco key
- Converts role name into form usable as message daco key
+ Checks whether Flash enabled for learner
+ Checks whether Flash enabled for learner
- role
- org.lamsfoundation.lams.web.tag.RoleTag
+ LearnerFlashEnabled
+ org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
empty
-
- Converts role name into form usable as message daco key
- role
- true
-
- true
-
-
-
@@ -457,6 +472,10 @@
ImgButtonWrapper
/WEB-INF/tags/ImgButtonWrapper.tag
+
+
+ TextSearch
+ /WEB-INF/tags/TextSearch.tag
textarea
@@ -489,16 +508,17 @@
- Checks whether Flash enabled for learner
- Checks whether Flash enabled for learner
-
-
- LearnerFlashEnabled
- org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
- empty
-
+ Checks whether Flash enabled for learner
+ Checks whether Flash enabled for learner
+
+
+ LearnerFlashEnabled
+ org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag
+ empty
+
head
/WEB-INF/tags/Head.tag
-
+
+
Index: lams_tool_daco/web/includes/javascript/dacoAuthoring.js
===================================================================
diff -u -r843648563725cffa91af1dfd96dce9682d39b410 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_daco/web/includes/javascript/dacoAuthoring.js (.../dacoAuthoring.js) (revision 843648563725cffa91af1dfd96dce9682d39b410)
+++ lams_tool_daco/web/includes/javascript/dacoAuthoring.js (.../dacoAuthoring.js) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -15,7 +15,10 @@
//Resizes the question input area so it is visible on the screen.
function resizeQuestionInputArea (){
- var questionInputArea = window.top.document.getElementById('questionInputArea');
+ var questionInputArea = window.document.getElementById('questionInputArea');
+ if (!questionInputArea) {
+ questionInputArea = window.top.document.getElementById('questionInputArea');
+ }
questionInputArea.style.height=questionInputArea.contentWindow.document.body.scrollHeight+10+'px';
}
@@ -123,5 +126,5 @@
//Cancels a question adding procedure
function cancelDacoQuestion(){
- window.top.hideQuestionInputArea();
+ window.hideQuestionInputArea ? window.hideQuestionInputArea() : window.top.hideQuestionInputArea();
}
\ No newline at end of file
Index: lams_tool_daco/web/pages/authoring/parts/questionlist.jsp
===================================================================
diff -u -rce3e782fd6844641f7298e09104f8d7554f073ff -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_daco/web/pages/authoring/parts/questionlist.jsp (.../questionlist.jsp) (revision ce3e782fd6844641f7298e09104f8d7554f073ff)
+++ lams_tool_daco/web/pages/authoring/parts/questionlist.jsp (.../questionlist.jsp) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -68,9 +68,10 @@
<%-- This script will work when a new question is submited in order to refresh "Question List" panel. --%>
\ No newline at end of file
Index: lams_tool_dimdim/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r889235949834f3e9887318d10d0b21860f6b7b3c -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_dimdim/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 889235949834f3e9887318d10d0b21860f6b7b3c)
+++ lams_tool_dimdim/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -83,7 +83,11 @@
}
}
function doSubmit_Form_Only() {
- document.getElementById("${formID}").submit();
+ var form = document.getElementById("${formID}");
+ //invoke onsubmit event if it's available, submit form afterwards
+ if (form.onsubmit == null || (form.onsubmit != null) && form.onsubmit()) {
+ form.submit();
+ }
}
function doCancel() {
if(confirm("")){
@@ -102,7 +106,7 @@
doAjaxCall(clearSessionUrl);
} else {
if ('${param.noopener}' == 'true' || notifyCloseURL.indexOf('noopener=true') >= 0) {
- window.location.href = notifyCloseURL;
+ window.location.href = notifyCloseURL + '&action=' + nextAction;
} else if (window.parent.opener == null){
doAjaxCall(notifyCloseURL);
} else {
Index: lams_tool_dimdim/web/WEB-INF/tags/CKEditor.tag
===================================================================
diff -u -rc4f48ae00b40f09c6be7d1a595054933dca54623 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_dimdim/web/WEB-INF/tags/CKEditor.tag (.../CKEditor.tag) (revision c4f48ae00b40f09c6be7d1a595054933dca54623)
+++ lams_tool_dimdim/web/WEB-INF/tags/CKEditor.tag (.../CKEditor.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -53,6 +53,9 @@
CKEDITOR.basePath = "${ckEditorBasePath}";
+ var editor = CKEDITOR.instances["${id}"];
+ if (editor) { editor.destroy(true); }
+
var instance = CKEDITOR.replace( "${id}", {
width : "${width}",
height : "${height}",
Index: lams_tool_dimdim/web/WEB-INF/tags/Head.tag
===================================================================
diff -u -r4c8de20e6e3ea73f98892f70662508e4011e96f6 -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520
--- lams_tool_dimdim/web/WEB-INF/tags/Head.tag (.../Head.tag) (revision 4c8de20e6e3ea73f98892f70662508e4011e96f6)
+++ lams_tool_dimdim/web/WEB-INF/tags/Head.tag (.../Head.tag) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520)
@@ -32,6 +32,7 @@
<%@ tag body-content="scriptless"%>