Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -re17b56c0f30981cec5fe7d3c3c39dbc45707c166 -rdcb7977d20f0d29b809b2139a6814bc113c4485c --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e17b56c0f30981cec5fe7d3c3c39dbc45707c166) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision dcb7977d20f0d29b809b2139a6814bc113c4485c) @@ -459,6 +459,7 @@ authoring.fla.branching.create.confirm =Transition from this activity already exists.\\nDo you want to create branching here? authoring.fla.transition.to.exists.error =Transition to this activity already exists. authoring.fla.circular.sequence.error =You are not allowed to have a circular sequence. +authoring.fla.activity.in.container.error =You can not add this type of activity to an optional/support activity. authoring.fla.default.annotation.label.title =Label authoring.fla.region.fit.button.tooltip =Fit authoring.fla.new.folder.button =New Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -re17b56c0f30981cec5fe7d3c3c39dbc45707c166 -rdcb7977d20f0d29b809b2139a6814bc113c4485c --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision e17b56c0f30981cec5fe7d3c3c39dbc45707c166) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision dcb7977d20f0d29b809b2139a6814bc113c4485c) @@ -459,6 +459,7 @@ authoring.fla.branching.create.confirm =Transition from this activity already exists.\\nDo you want to create branching here? authoring.fla.transition.to.exists.error =Transition to this activity already exists. authoring.fla.circular.sequence.error =You are not allowed to have a circular sequence. +authoring.fla.activity.in.container.error =You can not add this type of activity to an optional/support activity. authoring.fla.default.annotation.label.title =Label authoring.fla.region.fit.button.tooltip =Fit authoring.fla.new.folder.button =New Index: lams_central/web/authoring/authoring.jsp =================================================================== diff -u -re17b56c0f30981cec5fe7d3c3c39dbc45707c166 -rdcb7977d20f0d29b809b2139a6814bc113c4485c --- lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision e17b56c0f30981cec5fe7d3c3c39dbc45707c166) +++ lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision dcb7977d20f0d29b809b2139a6814bc113c4485c) @@ -53,6 +53,7 @@ BRANCHING_CREATE_CONFIRM : '', TRANSITION_TO_EXISTS_ERROR : '', CIRCULAR_SEQUENCE_ERROR : '', + ACTIVITY_IN_CONTAINER_ERROR : '', // DecorationLib DEFAULT_ANNOTATION_LABEL_TITLE : '', Index: lams_central/web/includes/javascript/authoring/authoringActivity.js =================================================================== diff -u -re17b56c0f30981cec5fe7d3c3c39dbc45707c166 -rdcb7977d20f0d29b809b2139a6814bc113c4485c --- lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision e17b56c0f30981cec5fe7d3c3c39dbc45707c166) +++ lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision dcb7977d20f0d29b809b2139a6814bc113c4485c) @@ -987,6 +987,14 @@ }); } if (container) { + // system activities can not be added to optional and support activities + if (activity instanceof ActivityDefs.GateActivity + || activity instanceof ActivityDefs.GroupingActivity + || activity instanceof ActivityDefs.BranchingEdgeActivity){ + alert(LABELS.ACTIVITY_IN_CONTAINER_ERROR); + return false; + } + if ($.inArray(activity, container.childActivities) == -1) { $.each(activity.transitions.from, function(){ ActivityLib.removeTransition(this); @@ -1013,6 +1021,7 @@ }); GeneralLib.setModified(true); + return true; }, Index: lams_central/web/includes/javascript/authoring/authoringHandler.js =================================================================== diff -u -re837b7b90d6cbae5ecf051b9c9ba61b3097e0c51 -rdcb7977d20f0d29b809b2139a6814bc113c4485c --- lams_central/web/includes/javascript/authoring/authoringHandler.js (.../authoringHandler.js) (revision e837b7b90d6cbae5ecf051b9c9ba61b3097e0c51) +++ lams_central/web/includes/javascript/authoring/authoringHandler.js (.../authoringHandler.js) (revision dcb7977d20f0d29b809b2139a6814bc113c4485c) @@ -127,18 +127,22 @@ // finally transform the dragged elements var transformation = object.items.shape.attr('transform'); object.items.transform(''); - if (transformation.length > 0) { - // find new X and Y and redraw the object - var box = object.items.shape.getBBox(), - x = box.x, + + var box = object.items.shape.getBBox(), + originalCoordinates = { + x : box.x, // adjust this coordinate for annotation labels - y = box.y + (object instanceof DecorationDefs.Label ? 6 : 0); - object.draw(x + transformation[0][1], - y + transformation[0][2]); + y : box.y + (object instanceof DecorationDefs.Label ? 6 : 0) + }; + + if (transformation.length > 0) { + object.draw(originalCoordinates.x + transformation[0][1], + originalCoordinates.y + transformation[0][2]); } // add space if dropped object is next to border GeneralLib.resizePaper(); + return originalCoordinates; }, @@ -244,12 +248,18 @@ ActivityLib.removeActivity(activity); } else { // finalise movement - rewrite coordinates, see if the activity was not added to a container - HandlerLib.dropObject(activity); + - var translatedEvent = GeneralLib.translateEventOnCanvas(event), + var originalCoordinates = HandlerLib.dropObject(activity), + translatedEvent = GeneralLib.translateEventOnCanvas(event), endX = translatedEvent[0], - endY = translatedEvent[1]; - ActivityLib.dropActivity(activity, endX, endY); + endY = translatedEvent[1], + dropAllowed = ActivityLib.dropActivity(activity, endX, endY); + + if (!dropAllowed) { + // dropping the activity in this place is forbidden, revert the changes + activity.draw(originalCoordinates.x, originalCoordinates.y); + } } } // start dragging the activity