Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r0e442ec998f242b5d7874b92488fb86fa881bf5e -ra2c2ffbc4808b62204aabfd45b1697ef623f4f89
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 0e442ec998f242b5d7874b92488fb86fa881bf5e)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision a2c2ffbc4808b62204aabfd45b1697ef623f4f89)
@@ -512,6 +512,7 @@
authoring.fla.paste.error =Sorry, you can not paste this type of activity
authoring.fla.preview.error =Error while initialising lesson for preview
authoring.fla.cross.branching.error =Cross-branching transitions are not allowed
+authoring.fla.end.match.error =: a branch that ends in this branching does not start in it
authoring.fla.ok.button =OK
authoring.fla.cancel.button =Cancel
authoring.fla.clear.all.button =Clear all
Index: lams_central/web/authoring/authoring.jsp
===================================================================
diff -u -r0e442ec998f242b5d7874b92488fb86fa881bf5e -ra2c2ffbc4808b62204aabfd45b1697ef623f4f89
--- lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 0e442ec998f242b5d7874b92488fb86fa881bf5e)
+++ lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision a2c2ffbc4808b62204aabfd45b1697ef623f4f89)
@@ -112,7 +112,9 @@
PASTE_ERROR : '',
PREVIEW_ERROR : '',
CROSS_BRANCHING_ERROR : '',
+ END_MATCH_ERROR : '',
+
// PropertyLib
OK_BUTTON : '',
CANCEL_BUTTON : '',
Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js
===================================================================
diff -u -ra2205b107dfd14d2ee5f5527ef0528b6c16bf014 -ra2c2ffbc4808b62204aabfd45b1697ef623f4f89
--- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision a2205b107dfd14d2ee5f5527ef0528b6c16bf014)
+++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision a2c2ffbc4808b62204aabfd45b1697ef623f4f89)
@@ -2030,8 +2030,8 @@
$.each(layout.activities, function(){
// add all branch activities for iteration and saving
if (this instanceof ActivityDefs.BranchingEdgeActivity){
+ var branchingActivity = this.branchingActivity;
if (this.isStart){
- var branchingActivity = this.branchingActivity;
branchingActivity.defaultActivityUIID = null;
layoutActivityDefs.push(branchingActivity);
@@ -2078,12 +2078,55 @@
branchingActivity.defaultActivityUIID = branchingActivity.branches[0].uiid;
branchingActivity.branches[0].defaultBranch = true;
}
+ } else {
+ // validate if all branches start and end in the same branching
+ $.each(this.transitions.to, function(){
+ error = true;
+ var activity = this.fromActivity;
+ do {
+ if (activity instanceof ActivityDefs.BranchingEdgeActivity) {
+ if (activity.isStart) {
+ if (branchingActivity == activity.branchingActivity) {
+ // found out that the branch starts in the proper point
+ error = false;
+ break;
+ }
+ // the branch is shared between two branchings
+ // it should have been detected when adding a transition
+ alert(LABELS.CROSS_BRANCHING_ERROR);
+ return false;
+ }
+ // a nested branching encountered when crawling, just jump over it
+ activity = activity.branchingActivity.start;
+ }
+
+ // keep crawling
+ if (activity.transitions && activity.transitions.to.length > 0) {
+ activity = activity.transitions.to[0].fromActivity;
+ } else {
+ activity = null;
+ }
+ } while (activity);
+
+ if (error) {
+ alert(branchingActivity.title + LABELS.END_MATCH_ERROR);
+ return false;
+ }
+ });
+
+ if (error) {
+ return false;
+ }
}
} else {
layoutActivityDefs.push(this);
}
});
+ if (error) {
+ return false;
+ }
+
if (layout.floatingActivity){
layoutActivityDefs.push(layout.floatingActivity);
}