Index: lams_central/src/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as =================================================================== diff -u -rf97897727119dae10c986e1b47b181b32971698d -r7ee61481a406b75c5f18533602349926b939c932 --- lams_central/src/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision f97897727119dae10c986e1b47b181b32971698d) +++ lams_central/src/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision 7ee61481a406b75c5f18533602349926b939c932) @@ -104,42 +104,29 @@ * Adds a template activity to the model. * */ - public function addActivity(activity:Activity):Boolean{ + public function addActivity(activity:Activity):Object{ var success = false; //create an Activity from the template actvity. Debugger.log('activity:'+activity.title+':'+activity.activityUIID,4,'addActivity','DesignDataModel'); - - //validate the activity ?? - + //validate the activity ? //validate if we can do it? - - - - //TODO: 2nd time, after undo, in this is failing....; - - //dispatch an event before the design has changed dispatchEvent({type:'ddmBeforeUpdate',target:this}); - - //ObjectUtils.printObject(activity); - - //TODO: MAYBE the UIID being created is the same as an existing activity after an undo, therefore overwriting in the hash table _activities.put(activity.activityUIID, activity); - + //pull it out to check it var tmp:Activity = _activities.get(activity.activityUIID) - Debugger.log('Succesfully added:'+tmp.title+':'+tmp.activityUIID,4,'addActivity','DesignDataModel'); - + if(tmp){ + Debugger.log('Succesfully added:'+tmp.title+':'+tmp.activityUIID,4,'addActivity','DesignDataModel'); + }else{ + return new LFError("Adding activity failed","addActivity",this,'activityUIID:'+activity.activityUIID); + } //dispatch an event now the design has changed dispatchEvent({type:'ddmUpdate',target:this}); - //TODO: Better validation of the addition - success = true; - - return success; } /**