Index: lams_build/lib/lams/lams.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v
diff -u -r1.404 -r1.405
Binary files differ
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java,v
diff -u -r1.43 -r1.44
--- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java 17 Feb 2014 11:16:57 -0000 1.43
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java 2 Apr 2014 10:14:25 -0000 1.44
@@ -111,7 +111,7 @@
public ActionForward openAuthoring(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException {
- request.setAttribute("tools", getLearningDesignService().getToolDTOs(request.getRemoteUser()));
+ request.setAttribute("tools", getLearningDesignService().getToolDTOs(true, request.getRemoteUser()));
request.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID, FileUtil.generateUniqueContentFolderID());
return mapping.findForward("openAutoring");
}
Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java,v
diff -u -r1.44 -r1.45
--- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java 17 Sep 2013 16:23:06 -0000 1.44
+++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java 2 Apr 2014 10:14:25 -0000 1.45
@@ -110,8 +110,8 @@
iob.setAllowSorting(allowSorting && iob.getAllowSorting());
if (org.getEnableSingleActivityLessons()
&& (roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR))) {
- // if sinble activity lessons are enabled, put sorted list of tools
- request.setAttribute("tools", getLearningDesignService().getToolDTOs(request.getRemoteUser()));
+ // if single activity lessons are enabled, put sorted list of tools
+ request.setAttribute("tools", getLearningDesignService().getToolDTOs(false, request.getRemoteUser()));
}
}
Index: lams_central/web/author2.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/Attic/author2.jsp,v
diff -u -r1.20 -r1.21
--- lams_central/web/author2.jsp 6 Mar 2014 12:31:37 -0000 1.20
+++ lams_central/web/author2.jsp 2 Apr 2014 10:14:25 -0000 1.21
@@ -126,8 +126,9 @@
-
@@ -405,7 +406,29 @@
+
+
+
Index: lams_central/web/css/authoring.css
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/css/authoring.css,v
diff -u -r1.13 -r1.14
--- lams_central/web/css/authoring.css 17 Feb 2014 11:16:56 -0000 1.13
+++ lams_central/web/css/authoring.css 2 Apr 2014 10:14:25 -0000 1.14
@@ -239,7 +239,7 @@
}
td#templateContainerCell {
- width: 152px;
+ width: 150px;
border: black thin solid;
vertical-align: top;
background-color: rgb(219, 230, 252);
@@ -262,7 +262,7 @@
div.template div {
float: right;
- width: 92px;
+ width: 89px;
padding-top: 11px;
font-size: 10pt;
font-family: serif;
Index: lams_central/web/includes/javascript/authoring/authoringActivity.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringActivity.js,v
diff -u -r1.18 -r1.19
--- lams_central/web/includes/javascript/authoring/authoringActivity.js 31 Mar 2014 13:41:04 -0000 1.18
+++ lams_central/web/includes/javascript/authoring/authoringActivity.js 2 Apr 2014 10:14:25 -0000 1.19
@@ -72,7 +72,7 @@
this.loadPropertiesDialogContent = PropertyLib.groupingProperties;
- this.draw = ActivityLib.draw.grouping;
+ this.draw = ActivityLib.draw.grouping;
this.draw(x, y);
},
@@ -149,6 +149,26 @@
},
+ ParallelActivity : function(id, uiid, learningLibraryID, x, y, title, childActivities){
+ DecorationLib.Container.call(this, title);
+
+ this.id = +id;
+ this.uiid = +uiid || ++layout.ld.maxUIID;
+ this.learningLibraryID = +learningLibraryID;
+ this.transitions = {
+ 'from' : [],
+ 'to' : []
+ };
+ if (childActivities){
+ this.childActivities = childActivities;
+ }
+
+ this.loadPropertiesDialogContent = PropertyLib.parallelProperties;
+
+ this.draw = ActivityLib.draw.parallelActivity;
+ this.draw(x, y);
+ },
+
/**
* Constructor for an Optional Activity.
*/
@@ -369,6 +389,40 @@
},
+ parallelActivity : function(x, y) {
+ if (x == undefined || y == undefined) {
+ // if no new coordinates are given, just redraw the activity
+ x = this.items.shape.getBBox().x;
+ y = this.items.shape.getBBox().y;
+ }
+
+ if (this.childActivities && this.childActivities.length > 0) {
+ // draw one by one, vertically
+ var activityY = y + 30,
+ allElements = paper.set(),
+ optionalActivity = this;
+ $.each(this.childActivities, function(orderID){
+ this.parentActivity = optionalActivity;
+ this.orderID = orderID + 1;
+ this.draw(x + 20, activityY);
+ activityY = this.items.shape.getBBox().y2 + 10;
+ allElements.push(this.items.shape);
+ });
+ // area containing all drawn child activities
+ var box = allElements.getBBox();
+
+ this.drawContainer(x, y, box.x2 + 20, box.y2 + 20, layout.colors.optionalActivity);
+ } else {
+ this.drawContainer(x, y, x + 50, y + 70, layout.colors.optionalActivity);
+ }
+
+ // allow transition drawing and other activity behaviour
+ this.items.shape.unmousedown().mousedown(HandlerLib.activityMousedownHandler);
+
+ this.items.data('parentObject', this);
+ },
+
+
optionalActivity : function(x, y, ignoredParam1, ignoredParam2, childActivities) {
if (x == undefined || y == undefined) {
// if no new coordinates are given, just redraw the activity
Index: lams_central/web/includes/javascript/authoring/authoringDecoration.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringDecoration.js,v
diff -u -r1.2 -r1.3
--- lams_central/web/includes/javascript/authoring/authoringDecoration.js 6 Mar 2014 12:31:37 -0000 1.2
+++ lams_central/web/includes/javascript/authoring/authoringDecoration.js 2 Apr 2014 10:14:25 -0000 1.3
@@ -65,7 +65,10 @@
this.items = paper.set();
if (this.title) {
var label = paper.text(x + 7, y + 10, this.title)
- .attr('text-anchor', 'start')
+ .attr({
+ 'text-anchor' : 'start',
+ 'cursor' : 'pointer'
+ })
.toBack();
this.items.push(label);
@@ -79,10 +82,11 @@
'fill' : color,
'cursor' : 'pointer'
})
- .mousedown(HandlerLib.containerMousedownHandler)
- .click(HandlerLib.itemClickHandler)
.toBack();
this.items.push(this.items.shape);
+
+ this.items.mousedown(HandlerLib.containerMousedownHandler)
+ .click(HandlerLib.itemClickHandler);
},
/**
@@ -231,5 +235,6 @@
// set prototype hierarchy
DecorationLib.Region.prototype = new DecorationLib.Container;
+ActivityLib.ParallelActivity.prototype = new DecorationLib.Container;
ActivityLib.OptionalActivity.prototype = new DecorationLib.Container;
ActivityLib.FloatingActivity.prototype = new DecorationLib.Container;
\ No newline at end of file
Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringGeneral.js,v
diff -u -r1.18 -r1.19
--- lams_central/web/includes/javascript/authoring/authoringGeneral.js 31 Mar 2014 13:41:04 -0000 1.18
+++ lams_central/web/includes/javascript/authoring/authoringGeneral.js 2 Apr 2014 10:14:25 -0000 1.19
@@ -92,12 +92,37 @@
*/
function initTemplates(){
$('.template').each(function(){
- var toolId = +$(this).attr('toolId');
+ var learningLibraryID = +$(this).attr('learningLibraryId'),
+ activityCategoryID = +$(this).attr('activityCategoryId'),
+ parallelChildActivities = null;
+
+ if (activityCategoryID == 5) {
+ // mark which HTML templates construct this parallel activity
+ switch(learningLibraryID){
+ case 28:
+ // share resources and forum
+ parallelChildActivities = $('.template[learningLibraryId=12]')
+ .add($('.template[learningLibraryId=6]'));
+ break;
+ case 29:
+ // chat and scribe
+ parallelChildActivities = $('.template[learningLibraryId=3]')
+ .add($('.template[learningLibraryId=20]'));
+ break;
+ case 30:
+ // forum and scribe
+ parallelChildActivities = $('.template[learningLibraryId=6]')
+ .add($('.template[learningLibraryId=20]'));
+ break;
+ }
+ }
+
// register tool properties so they are later easily accessible
- layout.toolMetadata[toolId] = {
- 'iconPath' : $('img', this).attr('src'),
- 'supportsOutputs' : $(this).attr('supportsOutputs'),
- 'activityCategoryID' : +$(this).attr('activityCategoryID')
+ layout.toolMetadata[learningLibraryID] = {
+ 'iconPath' : $('img', this).attr('src'),
+ 'supportsOutputs' : $(this).attr('supportsOutputs'),
+ 'activityCategoryID' : activityCategoryID,
+ 'parallelChildActivities' : parallelChildActivities
};
// if a tool's name is too long and gets broken into two lines
@@ -140,15 +165,34 @@
$(draggable.helper).remove();
// calculate the position and create an instance of the tool activity
- var toolID = draggable.draggable.attr('toolId'),
+ var learningLibraryID = +draggable.draggable.attr('learningLibraryId'),
+ activityCategoryID = +draggable.draggable.attr('activityCategoryId'),
x = draggable.offset.left + canvas.scrollLeft() - canvas.offset().left,
y = draggable.offset.top + canvas.scrollTop() - canvas.offset().top,
label = $('div', draggable.draggable).text(),
- activity = new ActivityLib.ToolActivity(null, null, null, toolID, x, y, label),
+ activity = null,
translatedEvent = ActivityLib.translateEventOnCanvas(event),
eventX = translatedEvent[0],
eventY = translatedEvent[1];
+ if (activityCategoryID == 5) {
+ // construct child activities out of previously referenced HTML templates
+ var childActivities = [];
+ layout.toolMetadata[learningLibraryID].parallelChildActivities.each(function(){
+ var toolActivityLibraryID = +$(this).attr('learningLibraryId'),
+ toolLabel = $('div', this).text(),
+ childActivity = new ActivityLib.ToolActivity(null, null, null,
+ toolActivityLibraryID, x, y, toolLabel);
+
+ layout.activities.push(childActivity);
+ childActivities.push(childActivity);
+ });
+
+ activity = new ActivityLib.ParallelActivity(null, null, learningLibraryID, x, y, label, childActivities);
+ } else {
+ activity = new ActivityLib.ToolActivity(null, null, null, learningLibraryID, x, y, label);
+ }
+
layout.activities.push(activity);
ActivityLib.dropActivity(activity, eventX, eventY);
}
@@ -464,7 +508,7 @@
case 3: var gateType = 'sync';
case 4: var gateType = gateType || 'schedule';
case 5: var gateType = gateType || 'permision';
- case 6:
+ case 14:
var gateType = gateType || 'condition';
activity = new ActivityLib.GateActivity(activityData.activityID,
activityData.activityUIID,
@@ -473,6 +517,16 @@
gateType);
break;
+ // Parallel Activity
+ case 6:
+ activity = new ActivityLib.ParallelActivity(activityData.activityID,
+ activityData.activityUIID,
+ activityData.learningLibraryID,
+ activityData.xCoord,
+ activityData.yCoord,
+ activityData.activityTitle);
+ break;
+
// Optional Activity
case 7:
activity = new ActivityLib.OptionalActivity(activityData.activityID,
@@ -627,11 +681,13 @@
}
}
- // find Optional Activity
+ // find Optional/Parallel Activity
if (activityData.parentActivityID && !activity.parentActivity) {
$.each(layout.activities, function(){
- if (activityData.parentActivityID == this.id && this instanceof ActivityLib.OptionalActivity) {
- // add a Tool Activity as a Optional Activity element
+ if (activityData.parentActivityID == this.id
+ && (this instanceof ActivityLib.ParallelActivity
+ || this instanceof ActivityLib.OptionalActivity)) {
+ // add a Tool Activity as a Optional/Parallel Activity element
if (!this.childActivities) {
this.childActivities = [];
}
@@ -824,16 +880,17 @@
activityBox = activity.items ? activity.items.shape.getBBox() : null,
activityTypeID = null,
toolID = activity.toolID,
+ learningLibraryID = toolID ? toolID : activity.learningLibraryID,
iconPath = null,
isGrouped = activity.grouping ? true : false,
parentActivityID = activity.parentActivity ? activity.parentActivity.id : null;
if (toolID) {
activityTypeID = 1;
// find out what is the icon for tool acitivty
- var templateIcon = $('.template[toolId=' + toolID +'] img');
+ var templateIcon = $('.template[learningLibraryId=' + learningLibraryID +'] img');
if (templateIcon.width() > 0) {
- iconPath = layout.toolMetadata[toolID].iconPath;
+ iconPath = layout.toolMetadata[learningLibraryID].iconPath;
}
}
// translate activity type to back-end understandable
@@ -880,8 +937,10 @@
case 'sync' : activityTypeID = 3; break;
case 'schedule' : activityTypeID = 4; break;
case 'permision' : activityTypeID = 5; break;
- case 'condition' : activityTypeID = 6; break;
+ case 'condition' : activityTypeID = 14; break;
}
+ } else if (activity instanceof ActivityLib.ParallelActivity) {
+ activityTypeID = 6;
} else if (activity instanceof ActivityLib.OptionalActivity) {
activityTypeID = 7;
} else if (activity instanceof ActivityLib.BranchingActivity) {
@@ -917,7 +976,7 @@
'activityID' : activity.id,
'activityUIID' : activity.uiid,
'toolID' : toolID,
- 'learningLibraryID' : toolID,
+ 'learningLibraryID' : learningLibraryID,
'toolContentID' : activity.toolContentID,
'stopAfterActivity' : false,
'groupingSupportType' : 2,
@@ -930,8 +989,9 @@
'xCoord' : activityBox ? parseInt(activityBox.x) : null,
'yCoord' : activityBox ? parseInt(activityBox.y) : null,
'activityTitle' : activity.title,
- 'activityCategoryID' : activity instanceof ActivityLib.ToolActivity ?
- layout.toolMetadata[toolID].activityCategoryID : 1,
+ 'activityCategoryID' : activity instanceof ActivityLib.ToolActivity
+ || activity instanceof ActivityLib.ParallelActivity ?
+ layout.toolMetadata[learningLibraryID].activityCategoryID : 1,
'activityTypeID' : activityTypeID,
'orderID' : activity.orderID,
'defaultActivityUIID' : activity.defaultActivityUIID,
Index: lams_central/web/includes/javascript/authoring/authoringHandler.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringHandler.js,v
diff -u -r1.9 -r1.10
--- lams_central/web/includes/javascript/authoring/authoringHandler.js 6 Mar 2014 12:31:37 -0000 1.9
+++ lams_central/web/includes/javascript/authoring/authoringHandler.js 2 Apr 2014 10:14:25 -0000 1.10
@@ -106,7 +106,8 @@
items.attr('cursor', 'move');
var parentObject = draggedElement.data('parentObject');
- sticky = parentObject && (parentObject instanceof ActivityLib.OptionalActivity
+ sticky = parentObject && (parentObject instanceof ActivityLib.ParallelActivity
+ || parentObject instanceof ActivityLib.OptionalActivity
|| parentObject instanceof ActivityLib.FloatingActivity);
if (sticky) {
$.each(parentObject.childActivities, function(){
@@ -388,7 +389,8 @@
if (event.ctrlKey) {
// when CTRL is held down, start drawing a transition
HandlerLib.drawTransitionStartHandler(activity, event, x, y);
- } else {
+ } else if (!activity.parentActivity
+ || !(activity.parentActivity instanceof ActivityLib.ParallelActivity)){
var mouseupHandler = function(event){
if (HandlerLib.isElemenentBinned(event)) {
// if the activity was over rubbish bin, remove it
@@ -481,7 +483,9 @@
}
} else {
HandlerLib.dropObject(container);
- if (container instanceof ActivityLib.FloatingActivity) {
+ if (container instanceof ActivityLib.FloatingActivity
+ || container instanceof ActivityLib.OptionalActivity
+ || container instanceof ActivityLib.ParallelActivity) {
ActivityLib.dropActivity(container);
}
}
Index: lams_central/web/includes/javascript/authoring/authoringMenu.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringMenu.js,v
diff -u -r1.17 -r1.18
--- lams_central/web/includes/javascript/authoring/authoringMenu.js 31 Mar 2014 13:41:04 -0000 1.17
+++ lams_central/web/includes/javascript/authoring/authoringMenu.js 2 Apr 2014 10:14:25 -0000 1.18
@@ -274,7 +274,7 @@
* Opens "Save sequence" dialog where an user can choose where to save the Learning Design.
*/
saveLearningDesign : function(showDialog){
- if (!showDialog) {
+ if (!showDialog && layout.ld.learningDesignID) {
saveLearningDesign(layout.ld.folderID, layout.ld.learningDesignID, layout.ld.title);
return;
}
Index: lams_central/web/includes/javascript/authoring/authoringProperty.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringProperty.js,v
diff -u -r1.8 -r1.9
--- lams_central/web/includes/javascript/authoring/authoringProperty.js 21 Mar 2014 08:14:04 -0000 1.8
+++ lams_central/web/includes/javascript/authoring/authoringProperty.js 2 Apr 2014 10:14:25 -0000 1.9
@@ -181,12 +181,15 @@
*/
toolProperties : function() {
var activity = this,
- content = activity.propertiesContent;
+ content = activity.propertiesContent,
+ allowsGrouping = !this.parentActivity || !(this.parentActivity instanceof ActivityLib.ParallelActivity);
+
if (!content) {
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentTool').clone().attr('id', null)
.show().data('parentObject', activity);
$('.propertiesContentFieldTitle', content).val(activity.title);
+ $('.propertiesContentFieldGrouping', content).closest('tr').remove();
$('input, select', content).change(function(){
// extract changed properties and redraw the activity
@@ -198,11 +201,15 @@
activity.title = newTitle;
redrawNeeded = true;
}
- var newGroupingValue = $('.propertiesContentFieldGrouping option:selected', content)
- .data('grouping');
- if (newGroupingValue != activity.grouping) {
- activity.grouping = newGroupingValue;
- redrawNeeded = true;
+
+ var selectedGrouping = $('.propertiesContentFieldGrouping option:selected', content);
+ if (selectedGrouping.length > 0){
+ var newGroupingValue = $('.propertiesContentFieldGrouping option:selected', content)
+ .data('grouping');
+ if (newGroupingValue != activity.grouping) {
+ activity.grouping = newGroupingValue;
+ redrawNeeded = true;
+ }
}
if (redrawNeeded) {
@@ -211,7 +218,9 @@
});
}
- PropertyLib.fillGroupingDropdown(content, activity.grouping);
+ if (allowsGrouping){
+ PropertyLib.fillGroupingDropdown(content, activity.grouping);
+ }
},
@@ -406,6 +415,46 @@
/**
+ * Properties dialog content for Parallel activities.
+ */
+ parallelProperties : function() {
+ var activity = this,
+ content = activity.propertiesContent;
+
+ if (!content) {
+ // first run, create the content
+ content = activity.propertiesContent = $('#propertiesContentParallel').clone().attr('id', null)
+ .show().data('parentObject', activity);
+ $('.propertiesContentFieldTitle', content).val(activity.title);
+
+ $('input, select', content).change(function(){
+ // extract changed properties and redraw the activity
+ var content = $(this).closest('.dialogContainer'),
+ activity = content.data('parentObject'),
+ redrawNeeded = false,
+ newTitle = $('.propertiesContentFieldTitle', content).val();
+ if (newTitle != activity.title) {
+ activity.title = newTitle;
+ redrawNeeded = true;
+ }
+ var newGroupingValue = $('.propertiesContentFieldGrouping option:selected', content)
+ .data('grouping');
+ if (newGroupingValue != activity.grouping) {
+ activity.grouping = newGroupingValue;
+ redrawNeeded = true;
+ }
+
+ if (redrawNeeded) {
+ activity.draw();
+ }
+ });
+ }
+
+ PropertyLib.fillGroupingDropdown(content, activity.grouping);
+ },
+
+
+ /**
* Properties dialog content for Optional Activity.
*/
optionalActivityProperties : function() {
@@ -536,7 +585,7 @@
var emptyOption = $(''),
groupingDropdown = $('.propertiesContentFieldGrouping', content).empty().append(emptyOption);
$.each(layout.activities, function(){
- if (this instanceof ActivityLib.GropuingActivity) {
+ if (this instanceof ActivityLib.GroupingActivity) {
var option = $('').text(this.title)
.appendTo(groupingDropdown)
// store reference to grouping object
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ILearningDesignService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ILearningDesignService.java,v
diff -u -r1.14 -r1.15
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ILearningDesignService.java 10 Sep 2013 08:32:41 -0000 1.14
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ILearningDesignService.java 2 Apr 2014 10:14:23 -0000 1.15
@@ -103,5 +103,5 @@
String createBranchingSVG(Long branchingActivityId, int imageFormat) throws IOException;
- public List getToolDTOs(String userName) throws IOException;
+ public List getToolDTOs(boolean includeParallel, String userName) throws IOException;
}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java,v
diff -u -r1.28 -r1.29
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java 3 Dec 2013 20:29:57 -0000 1.28
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java 2 Apr 2014 10:14:23 -0000 1.29
@@ -209,30 +209,38 @@
/**
* Gets basic information on available tools.
*/
- public List getToolDTOs(String userName) throws IOException {
+ public List getToolDTOs(boolean includeParallel, String userName) throws IOException {
User user = (User) learningLibraryDAO.findByProperty(User.class, "login", userName).get(0);
String languageCode = user.getLocale().getLanguageIsoCode();
- ArrayList learningLibraries = getAllLearningLibraryDetails(
- languageCode);
+ ArrayList learningLibraries = getAllLearningLibraryDetails(languageCode);
List tools = new ArrayList();
for (LearningLibraryDTO learningLibrary : learningLibraries) {
- // skip invalid and complex tools
- if (learningLibrary.getValidFlag() && (learningLibrary.getTemplateActivities().size() == 1)) {
- LibraryActivityDTO libraryActivityDTO = (LibraryActivityDTO) learningLibrary.getTemplateActivities().get(0);
+ // skip invalid tools
+ boolean isParallel = learningLibrary.getTemplateActivities().size() > 1;
+ if (learningLibrary.getValidFlag() && (includeParallel || !isParallel)) {
+ LibraryActivityDTO libraryActivityDTO = (LibraryActivityDTO) learningLibrary.getTemplateActivities()
+ .get(0);
ToolDTO toolDTO = new ToolDTO();
- toolDTO.setToolId(learningLibrary.getLearningLibraryID());
- toolDTO.setToolDisplayName(libraryActivityDTO.getActivityTitle());
- toolDTO.setActivityCategoryID(libraryActivityDTO.getActivityCategoryID());
-
- Tool tool = (Tool) learningLibraryDAO.find(Tool.class, learningLibrary.getLearningLibraryID());
- if (tool != null) {
- String iconPath = libraryActivityDTO.getLibraryActivityUIImage();
- iconPath = iconPath.substring(0, iconPath.lastIndexOf('/') + 1);
- iconPath += "icon_" + tool.getToolIdentifier() + ".svg";
- toolDTO.setIconPath(iconPath);
-
- toolDTO.setSupportsOutputs(tool.getSupportsOutputs());
+ if (!isParallel) {
+ toolDTO.setToolId(libraryActivityDTO.getToolID());
}
+ toolDTO.setLearningLibraryId(learningLibrary.getLearningLibraryID());
+ toolDTO.setToolDisplayName(isParallel ? learningLibrary.getTitle() : libraryActivityDTO
+ .getActivityTitle());
+ toolDTO.setActivityCategoryID(isParallel ? Activity.CATEGORY_SPLIT : libraryActivityDTO
+ .getActivityCategoryID());
+
+ if (libraryActivityDTO.getToolID() != null) {
+ Tool tool = (Tool) learningLibraryDAO.find(Tool.class, libraryActivityDTO.getToolID());
+ if (tool != null) {
+ String iconPath = libraryActivityDTO.getLibraryActivityUIImage();
+ iconPath = iconPath.substring(0, iconPath.lastIndexOf('/') + 1);
+ iconPath += "icon_" + tool.getToolIdentifier() + ".svg";
+ toolDTO.setIconPath(iconPath);
+
+ toolDTO.setSupportsOutputs(tool.getSupportsOutputs());
+ }
+ }
tools.add(toolDTO);
}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolDTO.java,v
diff -u -r1.3 -r1.4
--- lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolDTO.java 3 Dec 2013 20:29:57 -0000 1.3
+++ lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolDTO.java 2 Apr 2014 10:14:23 -0000 1.4
@@ -25,6 +25,7 @@
public class ToolDTO {
private Long toolId;
+ private Long learningLibraryId;
private String toolDisplayName;
private String iconPath;
private Boolean supportsOutputs;
@@ -72,4 +73,12 @@
public void setActivityCategoryID(Integer activityCategoryID) {
this.activityCategoryID = activityCategoryID;
}
+
+ public Long getLearningLibraryId() {
+ return learningLibraryId;
+ }
+
+ public void setLearningLibraryId(Long learningLibraryId) {
+ this.learningLibraryId = learningLibraryId;
+ }
}
\ No newline at end of file
|