Index: lams_flash/.project
===================================================================
diff -u
--- lams_flash/.project (revision 0)
+++ lams_flash/.project (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,11 @@
+
+
+ lams_flash
+
+
+
+
+
+
+
+
Index: lams_flash/src/central/flash/LoadQue.as
===================================================================
diff -u
--- lams_flash/src/central/flash/LoadQue.as (revision 0)
+++ lams_flash/src/central/flash/LoadQue.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,239 @@
+
+/**
+******************************************
+
+ @class: LoadQue Class
+ @author: Kenneth Bunch (krb0723@hotmail.com)
+
+ IMPLEMENTS
+ ASBroadcaster
+
+ PUBLIC METHODS
+ addItem
+ clear
+ start
+
+ PRIVATE METHODS
+ $preloadNext
+ $loadItem
+ $onItemData
+ $onTotalData
+
+ EVENT
+ onItemData
+ onTotalData
+ onLoadFailure
+ onLoad
+
+******************************************
+*/
+
+
+/**
+ @class LoadQue
+*/
+
+import mx.events.*
+import mx.utils.*
+
+class LoadQue {
+
+ var _$que;
+ var _$root;
+ var _$index;
+ var _$currItem;
+ var _$interval;
+ var _$container;
+ var addEventListener:Function;
+ var dispatchEvent:Function;
+ //var broadcastMessage:Function;
+
+ function LoadQue(container) {
+ this._$root = container;
+ this._$que = new Array();
+ this._$container = new LoadVars();
+ this._$index = 0;
+ this._$currItem = null;
+ this._$interval = null;
+
+ EventDispatcher.initialize(this);
+
+ this.addEventListener("onItemData", container);
+ this.addEventListener("onTotalData", container);
+ this.addEventListener("onLoadFailure", container);
+ this.addEventListener("onLoad", container);
+ }
+
+ /**
+ @method (PRIVATE): $preloadNext
+
+ @description
+ - preloads the next item in the que
+ */
+ private function $preloadNext(){
+
+ var controller;
+
+ controller = this;
+ this._$currItem = this._$que[this._$index++];
+ this._$container.load(this._$currItem.url);
+ // monitor load of item
+ clearInterval(this._$interval);
+ // monitor immediately
+ this.$onItemData();
+ // monitor on interval
+ this._$interval = setInterval(this, "$onItemData", 100);
+ // handle success or failure of complete load
+ this._$container.onLoad = function(bSuccess){
+ controller.$onLoad(bSuccess);
+ };
+ }
+
+
+ /**
+ @method (PRIVATE): $onItemData
+
+ @description
+ - handles data as it is received for an item
+ */
+ private function $onItemData(){
+
+ var itemPercent;
+
+ itemPercent =Math.round(( this._$container.getBytesLoaded() / this._$container.getBytesTotal() )*100);
+
+ if(!isNaN(itemPercent)){
+ dispatchEvent({target:this, type:"onItemData", iPercent:itemPercent, sID:this._$currItem.id});
+ //this.broadcastMessage("onItemData", itemPercent, this._$currItem.id);
+ }
+ }
+
+
+ /**
+ @method (PRIVATE): $onTotalData
+
+ @description
+ - handles data as each item is completely loaded
+ */
+ private function $onTotalData(){
+
+ var totalPercent;
+
+ // report total percent loaded
+ totalPercent = Math.round((this._$index/this._$que.length) * 100);
+
+ if (!isNaN(totalPercent)){
+ dispatchEvent({target:this, type:"onTotalData", iPercent:totalPercent});
+ //this.broadcastMessage("onTotalData", totalPercent);
+ }
+ };
+
+
+ /**
+ @method (PRIVATE): $onLoad
+
+ @description
+ - fired when all data for an item is loaded
+ */
+ private function $onLoad(bSuccess){
+
+ clearInterval(this._$interval);
+
+ if (bSuccess){
+ // broadcast that item was loaded
+ this.$onItemData();
+ // load the item
+ if (this._$currItem.item != null){
+ this.$loadItem();
+ }
+ } else {
+ // report non loaded items
+ dispatchEvent({target:this, type:"onLoadFailure", sID:this._$currItem.id});
+ //this.broadcastMessage("onLoadFailure", this._$currItem.id);
+ }
+
+ this.$onTotalData();
+
+ // que next or report completed preload
+ if ( this._$que.length > (this._$index) ){
+ this.$preloadNext();
+ } else{
+ dispatchEvent({target:this, type:"onLoad"});
+ //this.broadcastMessage("onLoad");
+ }
+ }
+
+
+ /**
+ @method (PRIVATE): $loadItem
+
+ @description
+ - loads current item into container
+ */
+ public function $loadItem() {
+ // load item into assigned holder
+ if (typeof this._$currItem.item == "movieclip"){
+ this._$currItem.item.loadMovie(this._$currItem.url);
+ } else if(this._$currItem.item instanceof Sound) {
+ this._$currItem.item.loadSound(this._$currItem.url,false)
+ } else {
+ this._$currItem.item.load(this._$currItem.url);
+ }
+ }
+
+ /**
+ @method (PUBLIC): addItem
+
+ @param : sUrl
+ - url of item to load
+ @param : [oTarget, sID]
+ - [OPTIONAL] target to load item into OR id to associate with item
+ @param : [sID]
+ - [OPTIONAL] id to be associated with item
+
+ @description
+ - adds items to preload into movie
+ method is overload and can be passed args in the following combos
+ addItem(sUrl);
+ addItem(sUrl, oTarget);
+ addItem(sUrl, sID);
+ addItem(sUrl, oTarget, sID);
+ */
+ public function addItem(sUrl){
+
+ var target, idString;
+ if (arguments.length < 3){
+ target = (typeof arguments[1] != "string") ? arguments[1] : null;
+ idString = (typeof arguments[1] == "string") ? arguments[1] : this._$que.length+1;
+ } else{
+ target = arguments[1];
+ idString = (typeof arguments[2] != null) ? arguments[2] : this._$que.length+1;
+ }
+ this._$que.push({url:sUrl, item:target, id:idString});
+ }
+
+
+ /**
+ @method (PUBLIC): clear
+
+ @description
+ - clears the que
+ */
+ public function clear(){
+
+ this._$que = new Array();
+ this._$index = 0;
+ }
+
+ /**
+ @method (PUBLIC): start
+
+ @description
+ - starts loading the elements of the que
+ */
+ public function start(){
+
+ this.$preloadNext();
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/importUpdate_lc.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lam_addseq_wiz.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lams_authoring.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lams_authoring_main.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lams_learner.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lams_monitoring_main.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lams_monitoring_v1.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/lams_wizard_main.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/learnerProgress_lc.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/main.as
===================================================================
diff -u
--- lams_flash/src/central/flash/main.as (revision 0)
+++ lams_flash/src/central/flash/main.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,98 @@
+import org.lamsfoundation.lams.authoring.Application;
+import org.lamsfoundation.lams.common.util.StringUtils;
+
+_global.myRoot = this;
+this._lockroot = true;
+
+//Temp values to be removed / repplaced at deployment
+/**/
+if(StringUtils.isEmpty(serverURL)){
+ //_root.serverURL = "http://dolly.uklams.net:8080/lams/";
+ _root.serverURL = "http://localhost:8080/lams/";
+ Debugger.log('serverURL is not defined, using defualt:'+_root.serverURL ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(userID)){
+ _root.userID = 4;
+ Debugger.log('userID is not defined, using defualt:'+_root.userID ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(version)){
+ _root.version = "undefined";
+ Debugger.log('version is not defined.', Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(mode)){
+ _root.mode = 1;
+ Debugger.log('Mode is not defined, using defualt:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(layout)){
+ _root.layout = "normal";
+ Debugger.log('Mode is not defined, using defualt:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(learningDesignID)){
+ _root.learningDesignID = null;
+ Debugger.log('LearningDesignID is not defined, using default:'+_root.learningDesignID,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(lang)){
+ _root.lang = "en";
+}
+
+if(StringUtils.isEmpty(country)){
+ _root.country = undefined;
+}
+
+if(StringUtils.isEmpty(build)){
+ _root.build = "2.0";
+}
+
+if(StringUtils.isEmpty(uniqueID)){
+ _root.uniqueID = 0;
+ Debugger.log('Unique ID is not defined.',Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(langDate)){
+ _root.langDate = "01-01-1970";
+}
+
+if(StringUtils.isEmpty(actColour)){
+ _root.actColour = "true";
+}
+
+if(StringUtils.isEmpty(requestSrc)) {
+ _root.requestSrc = null;
+}
+
+if(StringUtils.isEmpty(isMac)) {
+ _root.isMac = false;
+}
+
+//Set stage alignment to top left and prent scaling
+Stage.align = "TL";
+Stage.scaleMode = "noScale";
+
+
+//Start the application, passing in the top level clip, i.e. _root
+var app:Application = Application.getInstance();
+app.main(this);
+
+//------------------------------Local connection to JSPs for progress data ------------------------------
+var receive_lc = new LocalConnection();
+//-------------------------------------- Functions to setProgress data, called by the LocalConnection object in learner JSPs
+receive_lc.setImportDesign = function(learningDesignID, refresh) {
+ Debugger.log(arguments.toString(), 'importUpdate_lc.setImportDesign');
+ app.getCanvas().openDesignByImport(learningDesignID);
+ myRoot.refresh;
+};
+var success = receive_lc.connect("importUpdate_lc_" + uniqueID);
+
+
+//Make app listener for stage resize events
+Stage.addListener(app);
+
+
+
+
Index: lams_flash/src/central/flash/main2.as
===================================================================
diff -u
--- lams_flash/src/central/flash/main2.as (revision 0)
+++ lams_flash/src/central/flash/main2.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,63 @@
+import org.lamsfoundation.lams.learner.Application;
+import org.lamsfoundation.lams.common.util.StringUtils;
+
+//Temp values to be removed / repplaced at deployment
+/**/
+_global.myRoot = this;
+
+if(StringUtils.isEmpty(serverURL)){
+ //_root.serverURL = "http://dolly.uklams.net:8080/lams/";
+ _root.serverURL = "http://localhost:8080/lams/";
+ Debugger.log('serverURL is not defined, using defualt:'+_root.serverURL ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(userID)){
+ _root.userID = 4;
+ Debugger.log('userID is not defined, using defualt:'+_root.userID ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(mode)){
+ _root.mode = 1;
+ Debugger.log('Mode is not defined, using defualt:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(lessonID)){
+ _root.lessonID = 1;
+ Debugger.log('Lesson ID is not defined, using defualt:'+_root.lessonID,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(uniqueID)){
+ _root.uniqueID = 0;
+ Debugger.log('Unique ID is not defined.',Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(langDate)){
+ _root.langDate = "01-01-1970";
+}
+
+//Set stage alignment to top left and prent scaling
+Stage.align = "TL";
+Stage.scaleMode = "noScale";
+
+
+//Start the application, passing in the top level clip, i.e. _root
+var app:Application = Application.getInstance();
+app.main(this);
+
+//------------------------------Local connection to JSPs for progress data ------------------------------
+var receive_lc = new LocalConnection();
+//-------------------------------------- Functions to setProgress data, called by the LocalConnection object in learner JSPs
+receive_lc.setProgressData = function(attempted, completed, current, lessonID, version, refresh) {
+ Debugger.log(arguments.toString(), 'learnerProgress_lc.setProgressData');
+ app.refreshProgress(attempted, completed, current, lessonID, version);
+ myRoot.refresh = refresh;
+};
+
+var success = receive_lc.connect("learnerProgress_lc_" + uniqueID);
+
+//Make app listener for stage resize events
+Stage.addListener(app);
+
+
+
+
Index: lams_flash/src/central/flash/main_addseq.as
===================================================================
diff -u
--- lams_flash/src/central/flash/main_addseq.as (revision 0)
+++ lams_flash/src/central/flash/main_addseq.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,57 @@
+import org.lamsfoundation.lams.wizard.Application;
+import org.lamsfoundation.lams.common.util.StringUtils;
+
+//Temp values to be removed / repplaced at deployment
+/**/
+if(StringUtils.isEmpty(serverURL)){
+ //_root.serverURL = "http://dolly.uklams.net:8080/lams/";
+ //_root.serverURL = "http://shaun.melcoe.mq.edu.au:8080/lams/";
+ _root.serverURL = "http://localhost:8080/lams/";
+ Debugger.log('serverURL is not defined, using defualt:'+_root.serverURL ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(userID)){
+ _root.userID = 4;
+ Debugger.log('userID is not defined, using defualt:'+_root.userID ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(mode)){
+ _root.mode = 2;
+ Debugger.log('Mode is not defined, using defualt:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(courseID)){
+ _root.courseID = undefined; // Playpen (test)
+ Debugger.log('CourseID is not defined, using defualt:'+_root.courseID,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(classID)){
+ _root.classID = undefined; // Playpen (test)
+ Debugger.log('ClassID is not defined, using defualt:'+_root.classID,Debugger.CRITICAL,'main','ROOT');
+}
+
+
+if(StringUtils.isEmpty(build)){
+ _root.build = 2.0;
+ Debugger.log('Build is not defined, using defualt:'+_root.build,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(langDate)){
+ _root.langDate = "01-01-1970";
+}
+
+//Set stage alignment to top left and prent scaling
+Stage.align = "TL";
+Stage.scaleMode = "noScale";
+
+
+//Start the application, passing in the top level clip, i.e. _root
+var app:Application = Application.getInstance();
+app.main(this);
+
+//Make app listener for stage resize events
+Stage.addListener(app);
+
+
+
+
Index: lams_flash/src/central/flash/main_monitoring.as
===================================================================
diff -u
--- lams_flash/src/central/flash/main_monitoring.as (revision 0)
+++ lams_flash/src/central/flash/main_monitoring.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,65 @@
+import org.lamsfoundation.lams.monitoring.Application;
+import org.lamsfoundation.lams.common.util.StringUtils;
+import org.lamsfoundation.lams.common.util.Debugger;
+//Temp values to be removed / repplaced at deployment
+/**/
+if(StringUtils.isEmpty(serverURL)){
+ //_root.serverURL = "http://dolly.uklams.net:8080/lams/";
+ _root.serverURL = "http://localhost:8080/lams/";
+ Debugger.log('serverURL is not defined, using defualt:'+_root.serverURL ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(userID)){
+ _root.userID = 4;
+ Debugger.log('userID is not defined, using defualt:'+_root.userID ,Debugger.CRITICAL,'main','ROOT');
+}
+Debugger.log('lesson launch is set as:'+_root.lessonLaunch ,Debugger.CRITICAL,'main','ROOT');
+
+if (StringUtils.isEmpty(lessonLaunch)){
+ _root.lessonLaunch = false;
+ Debugger.log('lesson launch is set as:'+_root.lessonLaunch ,Debugger.CRITICAL,'mainin if condition','ROOT');
+}
+if (StringUtils.isEmpty(editOnFly)){
+ _root.editOnFly = false;
+ Debugger.log('editOnFly is set as:'+_root.editOnFly ,Debugger.CRITICAL,'mainin if condition','ROOT');
+}
+if(StringUtils.isEmpty(mode)){
+ _root.mode = 1;
+ Debugger.log('Mode is not defined, using defualt:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(version)){
+ _root.version = "undefined";
+ Debugger.log('version is not defined.', Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(lessonID)){
+ _root.lessonID = 1;
+ Debugger.log('LessonID is not defined, using defualt:'+_root.lessonID,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(langDate)){
+ _root.langDate = "01-01-1970";
+}
+
+if(StringUtils.isEmpty(actColour)){
+ _root.actColour = "true";
+}
+
+_root.monitoringURL = "monitoring/monitoring.do?method="
+
+//Set stage alignment to top left and prent scaling
+Stage.align = "TL";
+Stage.scaleMode = "noScale";
+
+
+//Start the application, passing in the top level clip, i.e. _root
+var app:Application = Application.getInstance();
+app.main(this);
+
+//Make app listener for stage resize events
+Stage.addListener(app);
+
+
+
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Activity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Activity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Activity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,759 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.*
+import org.lamsfoundation.lams.common.util.*
+
+/*
+*Activity Data storage class. USed as a base class for extending to be Tool, Gate and Complex
+*
+*
+* * static final variables indicating the type of activities
+* /******************************************************************
+ public static var TOOL_ACTIVITY_TYPE:Number = 1;
+ public static var GROUPING_ACTIVITY_TYPE:Number = 2;
+ public static var SYNCH_GATE_ACTIVITY_TYPE:Number = 3;
+ public static var SCHEDULE_GATE_ACTIVITY_TYPE:Number = 4;
+ public static var PERMISSION_GATE_ACTIVITY_TYPE:Number = 5;
+ public static var PARALLEL_ACTIVITY_TYPE:Number = 6;
+ public static var OPTIONAL_ACTIVITY_TYPE:Number = 7;
+ public static var SEQUENCE_ACTIVITY_TYPE:Number = 8;
+
+ * static final variables indicating the the category of activities
+ *******************************************************************
+ public static var CATEGORY_SYSTEM:Number = 1;
+ public static var CATEGORY_COLLABORATION:Number = 2;
+ public static var CATEGORY_ASSESSMENT:Number = 3;
+ public static var CATEGORY_CONTENT:Number = 4;
+ public static var CATEGORY_SPLIT:Number = 5;
+ /******************************************************************
+
+
+ /**
+ * static final variables indicating the grouping_support of activities
+ *******************************************************************
+ public static var GROUPING_SUPPORT_NONE:Number = 1;
+ public static var GROUPING_SUPPORT_OPTIONAL:Number = 2;
+ public static var GROUPING_SUPPORT_REQUIRED:Number = 3;
+ /******************************************************************
+
+*
+* @author DC
+* @version 0.1
+*/
+class org.lamsfoundation.lams.authoring.Activity {
+
+
+
+ /*
+ //---------------------------------------------------------------------
+ // Class Level Constants
+ //---------------------------------------------------------------------
+ /**
+ * static final variables indicating the type of activities
+ * available for a LearningDesign
+ ******************************************************************/
+ public static var TOOL_ACTIVITY_TYPE:Number = 1;
+ public static var GROUPING_ACTIVITY_TYPE:Number = 2;
+ public static var NO_GATE_ACTIVITY_TYPE:Number = 30
+ public static var SYNCH_GATE_ACTIVITY_TYPE:Number = 3;
+ public static var SCHEDULE_GATE_ACTIVITY_TYPE:Number = 4;
+ public static var PERMISSION_GATE_ACTIVITY_TYPE:Number = 5;
+ public static var PARALLEL_ACTIVITY_TYPE:Number = 6;
+ public static var OPTIONAL_ACTIVITY_TYPE:Number = 7;
+ public static var SEQUENCE_ACTIVITY_TYPE:Number = 8;
+ public static var SYSTEM_GATE_ACTIVITY_TYPE:Number = 9;
+ /******************************************************************/
+
+ /**
+ * static final variables indicating the the category of activities
+ *******************************************************************/
+ public static var CATEGORY_SYSTEM:Number = 1;
+ public static var CATEGORY_COLLABORATION:Number = 2;
+ public static var CATEGORY_ASSESSMENT:Number = 3;
+ public static var CATEGORY_CONTENT:Number = 4;
+ public static var CATEGORY_SPLIT:Number = 5;
+ /******************************************************************/
+
+
+ /**
+ * static final variables indicating the grouping_support of activities
+ *******************************************************************/
+ public static var GROUPING_SUPPORT_NONE:Number = 1;
+ public static var GROUPING_SUPPORT_OPTIONAL:Number = 2;
+ public static var GROUPING_SUPPORT_REQUIRED:Number = 3;
+ /******************************************************************/
+
+ //Activity Properties:
+ // * indicates required field
+ //---------------------------------------------------------------------
+ // Instance variables
+ //---------------------------------------------------------------------
+
+ private var _objectType:String; //*
+ private var _activityTypeID:Number; //*
+
+
+ private var _activityID:Number;
+ private var _activityCategoryID:Number; //*
+
+ private var _activityUIID:Number; //*
+
+ private var _learningLibraryID:Number; //*
+ //TODO: This will be removed by mai this week.
+ private var _learningDesignID:Number;
+ private var _libraryActivityID:Number;
+
+ private var _parentActivityID:Number;
+ private var _parentUIID:Number;
+
+
+ private var _orderID:Number;
+
+ private var _groupingID:Number;
+ private var _groupingUIID:Number;
+ private var _isActivitySelected:String
+
+
+ private var _title:String; //*
+ private var _description:String; //*
+ private var _helpText:String;
+ private var _xCoord:Number;
+ private var _yCoord:Number;
+ private var _libraryActivityUIImage:String;
+ private var _applyGrouping:Boolean;
+ private var _activityToolContentID:Number;
+
+ private var _runOffline:Boolean;
+ /*
+ * these have now been removed, set in the tool content instead
+ private var _offlineInstructions:String;
+ private var _onlineInstructions:String;
+ */
+ private var _defineLater:Boolean;
+ private var _createDateTime:Date;
+
+ private var _groupingSupportType:Number; //*
+
+ private var _readOnly:Boolean;
+
+
+
+ //Constructor
+ /**
+ * Creates an activity with the minimum of fields.
+ *
+ * @param learningActivityTypeId
+ * @param learningLibraryId
+ * @param toolId
+ * @param toolContentId
+ * @param helpText
+ * @param libraryActivityUIImage
+ */
+ function Activity(activityUIID:Number){
+ Debugger.log('activityUIID:'+activityUIID,Debugger.GEN,'constructor','Activity');
+ //assign the values:
+
+ _activityUIID = activityUIID;
+ //set default calues
+ _objectType = "Activity"; //should be "Activity"
+ _applyGrouping = false;
+ _runOffline = false;
+ _defineLater = false;
+ _readOnly = false;
+ _createDateTime = new Date();
+
+ }
+
+ //static class level methods
+ /**
+ * Created an array of activity types to be can be used as a dataprovider
+ * @usage
+ * @return
+ */
+ public static function getGateActivityTypes():Array{
+ var types:Array = [];
+ //types.addItem({label: Dictionary.getValue('none_act_lbl'), data: 0});
+ types.addItem({label: Dictionary.getValue('trans_dlg_nogate'), data: NO_GATE_ACTIVITY_TYPE});
+ types.addItem({label: Dictionary.getValue('synch_act_lbl'), data: SYNCH_GATE_ACTIVITY_TYPE});
+ types.addItem({label: Dictionary.getValue('sched_act_lbl'), data: SCHEDULE_GATE_ACTIVITY_TYPE});
+ types.addItem({label: Dictionary.getValue('perm_act_lbl'), data: PERMISSION_GATE_ACTIVITY_TYPE});
+ return types;
+ }
+
+
+
+
+ //helper methods
+
+
+ public function isGateActivity():Boolean{
+ if (_activityTypeID == SYNCH_GATE_ACTIVITY_TYPE){
+ return true;
+ }else if(_activityTypeID == SCHEDULE_GATE_ACTIVITY_TYPE){
+ return true
+ }else if (_activityTypeID == PERMISSION_GATE_ACTIVITY_TYPE){
+ return true;
+ }else if (_activityTypeID == SYSTEM_GATE_ACTIVITY_TYPE){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ public function isSystemGateActivity():Boolean{
+ return _activityTypeID == SYSTEM_GATE_ACTIVITY_TYPE;
+ }
+
+ public function isGroupActivity():Boolean{
+ if (_activityTypeID == GROUPING_ACTIVITY_TYPE){
+ return true;
+ }
+ }
+
+ public function isOptionalActivity():Boolean{
+ if (_activityTypeID == OPTIONAL_ACTIVITY_TYPE){
+ return true;
+ }
+ }
+
+
+ public function isParallelActivity():Boolean{
+ if (_activityTypeID == PARALLEL_ACTIVITY_TYPE){
+ return true;
+ }
+ }
+ /**
+ * Populates all the fields in this activity from a dto object contaning the following fields
+ * NB: This is not very clever, if the field in the dto is blank then the value is overwritten in the class...
+ *
+ *
+ *
+ * @usage
+ * @param dto //the dto containing these fields
+ * @return
+ */
+ public function populateFromDTO(dto:Object){
+
+
+ //activity properties:
+ _activityTypeID = dto.activityTypeID;
+ _activityID = dto.activityID;
+ _activityCategoryID = dto.activityCategoryID;
+ _activityUIID = dto.activityUIID;
+ _learningLibraryID = dto.learningLibraryID;
+ _learningDesignID = dto.learningDesignID;
+ _libraryActivityID = dto.libraryActivityID;
+
+ if(StringUtils.isWDDXNull(dto.parentActivityID)) { _parentActivityID = null }
+ else { _parentActivityID = dto.parentActivityID; }
+
+ if(StringUtils.isWDDXNull(dto.parentUIID)) {_parentUIID = null }
+ else { _parentUIID = dto.parentUIID}
+
+ _orderID = dto.orderID
+ _groupingID = dto.groupingID;
+ _groupingUIID = dto.groupingUIID
+ _title = dto.activityTitle;
+ _description = dto.description;
+ _helpText = dto.helpText;
+ _yCoord = dto.yCoord;
+ _xCoord = dto.xCoord;
+ _libraryActivityUIImage = dto.libraryActivityUIImage;
+ _applyGrouping = dto.applyGrouping;
+ _runOffline = dto.runOffline;
+ _defineLater = dto.defineLater;
+ _createDateTime = dto.createDateTime;
+ _groupingSupportType = dto.groupingSupportType;
+ _readOnly = dto.readOnly;
+
+
+
+
+
+ }
+
+ public function toData(){
+ var dto:Object = new Object();
+ //DC - Changed mode of toData to be ommiting fields with undefined values
+
+ if(_activityTypeID){ dto.activityTypeID = _activityTypeID; }
+ if(_activityID){ dto.activityID = _activityID; }
+ if(_activityCategoryID){ dto.activityCategoryID = _activityCategoryID; }
+ if(_activityUIID){ dto.activityUIID = _activityUIID; }
+ if(_learningLibraryID){ dto.learningLibraryID = _learningLibraryID; }
+ if(_learningDesignID){ dto.learningDesignID = _learningDesignID; }
+ if(_libraryActivityID){ dto.libraryActivityID = _libraryActivityID; }
+ //if(_parentActivityID){ dto.parentActivityID = _parentActivityID; }
+ //if(_parentUIID){ dto.parentUIID = _parentUIID; }
+ if(_orderID){ dto.orderID = _orderID; }
+ if(_groupingID){ dto.groupingID = _groupingID; }
+ if(_groupingUIID){ dto.groupingUIID = _groupingUIID; }
+ if(_title){ dto.activityTitle = _title; }
+ if(_description){ dto.description = _description; }
+ if(_helpText){ dto.helpText = _helpText; }
+ if(_yCoord){ dto.yCoord = _yCoord; }
+ if(_xCoord){ dto.xCoord = _xCoord; }
+ if(_libraryActivityUIImage){dto.libraryActivityUIImage= _libraryActivityUIImage;}
+
+ dto.parentUIID = (_parentUIID==null) ? Config.NUMERIC_NULL_VALUE : _parentUIID;
+ dto.parentActivityID = (_parentActivityID==null) ? Config.NUMERIC_NULL_VALUE : _parentActivityID;
+
+ //bnools need to be included - so do as follows:
+ dto.applyGrouping = (_applyGrouping==null) ? false : _applyGrouping;
+ dto.runOffline = (_runOffline==null) ? false : _runOffline;
+ dto.defineLater = (_defineLater==null) ? false : _defineLater;
+ if(_createDateTime){ dto.createDateTime = _createDateTime; }
+ if(_groupingSupportType){ dto.groupingSupportType = _groupingSupportType; }
+ if(_readOnly){ dto.readOnly = _readOnly; }
+
+
+
+ return dto;
+ }
+
+ public function clone():Activity{
+ /*
+ var n = new Activity(null);
+ //objectType is in the constructor
+ n.activityTypeID = _activityTypeID;
+ n.activityID = _activityID;
+ n.activityCategoryID = _activityCategoryID;
+ n.activityUIID = _activityUIID;
+ n.learningLibraryID = _learningLibraryID;
+ n.learningDesignID = _learningDesignID;
+ n.libraryActivityID = _libraryActivityID;
+ n.parentActivityID = _parentActivityID;
+ n.parentUIID = _parentUIID
+ n.orderID = _orderID
+ n.groupingID = _groupingID;
+ n.groupingUIID = _groupingUIID
+ n.title = _title;
+ n.description = _description;
+ n.helpText = _helpText;
+ n.yCoord = _yCoord;
+ n.xCoord = _xCoord;
+ n.libraryActivityUIImage = _libraryActivityUIImage;
+ n.applyGrouping = _applyGrouping;
+ n.runOffline = _runOffline;
+ //n.offlineInstructions = _offlineInstructions;
+ n.defineLater = _defineLater;
+ n.createDateTime = _createDateTime;
+ n.groupingSupportType = _groupingSupportType;
+ */
+ var dto:Object = toData();
+ var n = new Activity(null);
+ n.populateFromDTO(dto);
+ return n;
+
+ }
+
+
+ //getters and setters:
+ public function set objectType(a:String):Void{
+ _objectType = a;
+ }
+ public function get objectType():String{
+ return _objectType;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newactivityTypeID
+ * @return
+ */
+ public function set activityTypeID (newactivityTypeID:Number):Void {
+ _activityTypeID = newactivityTypeID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get activityTypeID ():Number {
+ return _activityTypeID;
+ }
+
+ public function set activityToolContentID (newToolContentID:Number) {
+ _activityToolContentID = newToolContentID;
+ }
+
+ public function get activityToolContentID ():Number {
+ return _activityToolContentID;
+ }
+
+
+ public function set activityID(a:Number):Void{
+ _activityID = a;
+ }
+ public function get activityID():Number{
+ return _activityID;
+ }
+
+/**
+ *
+ * @usage
+ * @param newactivityCategoryID
+ * @return
+ */
+ public function set activityCategoryID (newactivityCategoryID:Number):Void {
+ _activityCategoryID = newactivityCategoryID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get activityCategoryID ():Number {
+ return _activityCategoryID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newactivityUIID
+ * @return
+ */
+ public function set activityUIID (newactivityUIID:Number):Void {
+ _activityUIID = newactivityUIID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get activityUIID ():Number {
+ return _activityUIID;
+ }
+
+ public function set learningLibraryID(a:Number):Void{
+ _learningLibraryID = a;
+ }
+ public function get learningLibraryID():Number{
+ return _learningLibraryID;
+ }
+
+ public function set learningDesignID(a:Number):Void{
+ _learningDesignID = a;
+ }
+ public function get learningDesignID():Number{
+ return _learningDesignID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newlibraryActivityID
+ * @return
+ */
+ public function set libraryActivityID (newlibraryActivityID:Number):Void {
+ _libraryActivityID = newlibraryActivityID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get libraryActivityID ():Number {
+ return _libraryActivityID;
+ }
+
+/**
+ *
+ * @usage
+ * @param newparentActivityID
+ * @return
+ */
+ public function set parentActivityID (newparentActivityID:Number):Void {
+ _parentActivityID = newparentActivityID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get parentActivityID ():Number {
+ return _parentActivityID;
+ }
+
+/**
+ *
+ * @usage
+ * @param newparentUIID
+ * @return
+ */
+ public function set parentUIID (newparentUIID:Number):Void {
+ _parentUIID = newparentUIID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get parentUIID ():Number {
+ return _parentUIID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param neworderID
+ * @return
+ */
+ public function set orderID (neworderID:Number):Void {
+ _orderID = neworderID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get orderID ():Number {
+ return _orderID;
+ }
+
+
+ public function set title(a:String):Void{
+ _title = a;
+ }
+ public function get title():String{
+ return _title;
+ }
+
+ public function set description(a:String):Void{
+ _description = a;
+ }
+ public function get description():String{
+ return _description;
+ }
+
+ public function set helpText(a:String):Void{
+ _helpText = a;
+ }
+ public function get helpText():String{
+ return _helpText;
+ }
+
+ /**
+ * Rounds the value to an integer
+ * @usage
+ * @param a
+ * @return
+ */
+ public function set xCoord(a:Number):Void{
+ _xCoord = Math.round(a);
+ }
+ public function get xCoord():Number{
+ return _xCoord;
+ }
+ /**
+ * Rounds the value to an integer
+ * @usage
+ * @param a
+ * @return
+ */
+ public function set yCoord(a:Number):Void{
+ _yCoord = Math.round(a);
+ }
+ public function get yCoord():Number{
+ return _yCoord;
+ }
+
+ public function set libraryActivityUIImage(a:String):Void{
+ _libraryActivityUIImage = a;
+ }
+ public function get libraryActivityUIImage():String{
+ return _libraryActivityUIImage;
+ }
+
+ public function set runOffline(a:Boolean):Void{
+ _runOffline = a;
+ }
+ public function get runOffline():Boolean{
+ return _runOffline;
+ }
+
+ public function set defineLater(a:Boolean):Void{
+ _defineLater = a;
+ }
+ public function get defineLater():Boolean{
+ return _defineLater;
+ }
+
+ public function set createDateTime(a:Date):Void{
+ _createDateTime = a;
+ }
+ public function get createDateTime():Date{
+ return _createDateTime;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newgroupingID
+ * @return
+ */
+ public function set groupingID (newgroupingID:Number):Void {
+ _groupingID = newgroupingID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get groupingID ():Number {
+ return _groupingID;
+ }
+
+
+ /**
+ *
+ * @usage
+ * @param newgroupingUIID
+ * @return
+ */
+ public function set groupingUIID (newgroupingUIID:Number):Void {
+ _groupingUIID = newgroupingUIID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get groupingUIID ():Number {
+ trace('returning:'+_groupingUIID);
+ return _groupingUIID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param selected CA
+ * @return
+ */
+ public function set selectActivity (stat:String):Void {
+ _isActivitySelected = stat;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get selectActivity ():String {
+ trace('returning:'+_isActivitySelected);
+ return _isActivitySelected;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newapplyGrouping
+ * @return
+ */
+ public function set applyGrouping (newapplyGrouping:Boolean):Void {
+ _applyGrouping = newapplyGrouping;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get applyGrouping ():Boolean {
+ return _applyGrouping;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newgroupingSupportType
+ * @return
+ */
+ public function set groupingSupportType (newgroupingSupportType:Number):Void {
+ _groupingSupportType = newgroupingSupportType;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get groupingSupportType ():Number {
+ return _groupingSupportType;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newgroupingSupportType
+ * @return
+ */
+ public function set readOnly (readOnly:Boolean):Void {
+ _readOnly = readOnly;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get readOnly ():Boolean {
+ return _readOnly;
+ }
+
+ public function isReadOnly():Boolean {
+ return _readOnly;
+ }
+
+
+
+
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Application.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Application.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Application.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,850 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.* //Design Data model n stuffimport org.lamsfoundation.lams.authoring.* //Design Data model n stuff
+import org.lamsfoundation.lams.authoring.tk.* //Toolkit
+import org.lamsfoundation.lams.authoring.tb.* //Toolbar
+import org.lamsfoundation.lams.authoring.cv.* //Canvas
+import org.lamsfoundation.lams.authoring.layout.* //Authoring Layout Managers
+import org.lamsfoundation.lams.common.ws.* //Workspace
+import org.lamsfoundation.lams.common.comms.* //communications
+import org.lamsfoundation.lams.common.util.* //Utils
+import org.lamsfoundation.lams.common.dict.* //Dictionary
+import org.lamsfoundation.lams.common.ui.* //User interface
+import org.lamsfoundation.lams.common.style.* //Themes/Styles
+import org.lamsfoundation.lams.common.layout.* // Layouts
+import org.lamsfoundation.lams.common.*
+import mx.managers.*
+import mx.utils.*
+
+/**
+* Application - LAMS Application
+* @author DI
+*/
+class org.lamsfoundation.lams.authoring.Application extends ApplicationParent {
+
+ private static var SHOW_DEBUGGER:Boolean = false;
+
+ private static var MODULE:String = "authoring";
+
+ private static var _controlKeyPressed:String;
+ public static var TOOLBAR_X:Number = 0;
+ public static var TOOLBAR_Y:Number = 21;
+ public static var TOOLBAR_HEIGHT:Number = 35;
+
+ public static var TOOLKIT_X:Number = 0;
+ public static var TOOLKIT_Y:Number = 55;
+
+ public static var CANVAS_X:Number = 180;
+ public static var CANVAS_Y:Number = 55;
+ public static var CANVAS_W:Number = 1000;
+ public static var CANVAS_H:Number = 200;
+
+ public static var PI_X:Number = 180;
+ public static var PI_Y:Number = 551;
+ public static var PI_W:Number = 616;
+
+ public static var WORKSPACE_X:Number = 200;
+ public static var WORKSPACE_Y:Number = 200;
+ public static var WORKSPACE_W:Number = 300;
+ public static var WORKSPACE_H:Number = 200;
+
+ private static var LOADING_ROOT_DEPTH:Number = 100; //depth of the loading movie
+ private static var APP_ROOT_DEPTH:Number = 10; //depth of the application root
+ private static var DIALOGUE_DEPTH:Number = 20; //depth of the dialogue box
+ private static var TOOLTIP_DEPTH:Number = 60; //depth of the tooltip
+ private static var CURSOR_DEPTH:Number = 70; //depth of the cursors
+ private static var CCURSOR_DEPTH:Number = 101;
+ public static var MENU_DEPTH:Number = 25; //depth of the menu
+ public static var PI_DEPTH:Number = 35; //depth of the menu
+ public static var TOOLBAR_DEPTH:Number = 50; //depth of the menu
+ private static var UI_LOAD_CHECK_INTERVAL:Number = 50;
+ private static var UI_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+ private static var DATA_LOAD_CHECK_INTERVAL:Number = 50;
+ private static var DATA_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+
+ private static var QUESTION_MARK_KEY:Number = 191;
+ private static var X_KEY:Number = 88;
+ private static var C_KEY:Number = 67;
+ private static var D_KEY:Number = 68;
+ //private static var T_KEY:Number = 84;
+ private static var V_KEY:Number = 86;
+ private static var Z_KEY:Number = 90;
+ private static var Y_KEY:Number = 89;
+ private static var F12_KEY:Number = 123;
+
+ public static var CUT_TYPE:Number = 0;
+ public static var COPY_TYPE:Number = 1;
+
+ private static var COMMON_COMPONENT_NO = 4;
+
+ private var _uiLoadCheckCount = 0; // instance counter for number of times we have checked to see if theme and dict are loaded
+ private var _dataLoadCheckCount = 0;
+
+ private var _ddm:DesignDataModel;
+ private var _toolbar:Toolbar;
+ private var _toolkit:Toolkit;
+ private var _canvas:Canvas;
+ private var _PI:PropertyInspectorNew;
+
+ private var _workspace:Workspace;
+ private var _ccm:CustomContextMenu;
+ private var _debugDialog:MovieClip; //Reference to the debug dialog
+
+ private var _dialogueContainer_mc:MovieClip; //Dialog container
+ private var _tooltipContainer_mc:MovieClip; //Tooltip container
+ private var _cursorContainer_mc:MovieClip; //Cursor container
+ private var _menu_mc:MovieClip; //Menu bar clip
+ private var _container_mc:MovieClip; //Main container
+ private var _pi_mc:MovieClip;
+ private var _toolbarContainer_mc:MovieClip; //Container for Toolbar
+ private var _UILoadCheckIntervalID:Number; //Interval ID for periodic check on UILoad status
+ private var _UILoaded:Boolean; //UI Loading status
+
+ private var _DataLoadCheckIntervalID:Number;
+
+ //UI Elements
+ private var _toolbarLoaded:Boolean; //These are flags set to true when respective element is 'loaded'
+ private var _canvasLoaded:Boolean;
+ private var _toolkitLoaded:Boolean;
+ private var _menuLoaded:Boolean;
+ private var _showCMItem:Boolean;
+ private var _piLoaded:Boolean;
+
+ //clipboard
+ private var _clipboardData:Object;
+ private var _clipboardPasteCount:Number;
+
+ // set up Key Listener
+ //private var keyListener:Object;
+
+ // operation modes
+ private var _isEditMode:Boolean;
+ private var _root_layout:String;
+ private var _layout:LFLayout;
+
+ //Application instance is stored as a static in the application class
+ private static var _instance:Application = null;
+
+ /**
+ * Application - Constructor
+ */
+ private function Application(){
+ super(this);
+ _toolkitLoaded = false;
+ _canvasLoaded = false;
+ _menuLoaded = false;
+ _toolbarLoaded = false;
+ _piLoaded = false;
+ _module = Application.MODULE;
+ _PI = new PropertyInspectorNew();
+ _ccm = CustomContextMenu.getInstance();
+ _root_layout = (_root.layout != undefined || _root.layout != null) ? _root.layout : null;
+
+ //Mouse.addListener(someListener);
+ }
+
+ /**
+ * Retrieves an instance of the Application singleton
+ */
+ public static function getInstance():Application{
+ if(Application._instance == null){
+ Application._instance = new Application();
+ }
+ return Application._instance;
+ }
+
+ /**
+ * Main entry point to the application
+ */
+ public function main(container_mc:MovieClip){
+
+ if(_root_layout == ApplicationParent.EDIT_MODE)
+ _isEditMode = true;
+ else
+ _isEditMode = false;
+
+
+ _container_mc = container_mc;
+ _UILoaded = false;
+
+ var layout_component_no = (_isEditMode) ? EditOnFlyLayoutManager.COMPONENT_NO : DefaultLayoutManager.COMPONENT_NO;
+ loader.start(COMMON_COMPONENT_NO + layout_component_no);
+
+ _customCursor_mc = _container_mc.createEmptyMovieClip('_customCursor_mc', CCURSOR_DEPTH);
+
+ //add the cursors:
+ Cursor.addCursor(C_HOURGLASS);
+ Cursor.addCursor(C_OPTIONAL);
+ Cursor.addCursor(C_TRANSITION);
+ Cursor.addCursor(C_GATE);
+ Cursor.addCursor(C_GROUP);
+
+
+ //Get the instance of config class
+ _config = Config.getInstance();
+
+ //Assign the config load event to
+ _config.addEventListener('load',Delegate.create(this,configLoaded));
+
+ //Set up Key handler
+ //TODO take out after testing and uncomment same key handler in ready();
+ Key.addListener(this);
+ _container_mc.tabChildren = true;
+ }
+
+ /**
+ * Called when the config class has loaded
+ */
+ private function configLoaded(){
+ //Now that the config class is ready setup the UI and data, call to setupData() first in
+ //case UI element constructors use objects instantiated with setupData()
+ loader.complete();
+ setupData();
+ checkDataLoaded();
+
+ }
+
+ /**
+ * Loads and sets up event listeners for Theme, Dictionary etc.
+ */
+ private function setupData() {
+
+ //Get the language, create+load dictionary and setup load handler.
+ var language:String = String(_config.getItem('language'));
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('load',Delegate.create(this,onDictionaryLoad));
+ _dictionary.load(language);
+
+
+
+ //Set reference to StyleManager and load Themes and setup load handler.
+ var theme:String = String(_config.getItem('theme'));
+ _themeManager = ThemeManager.getInstance();
+ _themeManager.addEventListener('load',Delegate.create(this,onThemeLoad));
+ _themeManager.loadTheme(theme);
+ Debugger.getInstance().crashDumpSeverityLevel = Number(_config.getItem('crashDumpSeverityLevelLog'));
+ Debugger.getInstance().severityLevel = Number(_config.getItem('severityLevelLog'));
+
+ }
+
+
+ /**
+ * Periodically checks if data has been loaded
+ */
+ private function checkDataLoaded() {
+
+ // first time through set interval for method polling
+ if(!_DataLoadCheckIntervalID) {
+ _DataLoadCheckIntervalID = setInterval(Proxy.create(this, checkDataLoaded), DATA_LOAD_CHECK_INTERVAL);
+ } else {
+ _dataLoadCheckCount++;
+ // if dictionary and theme data loaded setup UI
+ if(_dictionaryLoaded && _themeLoaded) {
+ clearInterval(_DataLoadCheckIntervalID);
+ setupUI();
+ checkUILoaded();
+
+
+ } else if(_dataLoadCheckCount >= DATA_LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('reached timeout waiting for data to load.',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UILoadCheckIntervalID);
+
+
+ }
+ }
+ }
+
+ /**
+ * Runs periodically and dispatches events as they are ready
+ */
+ private function checkUILoaded() {
+ //If it's the first time through then set up the interval to keep polling this method
+ if(!_UILoadCheckIntervalID) {
+ _UILoadCheckIntervalID = setInterval(Proxy.create(this,checkUILoaded),UI_LOAD_CHECK_INTERVAL);
+ } else {
+ _uiLoadCheckCount++;
+ //If all events dispatched clear interval and call start()
+ if(_UILoaded && _dictionaryEventDispatched && _themeEventDispatched){
+ //Debugger.log('Clearing Interval and calling start :',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UILoadCheckIntervalID);
+ start();
+ }else {
+ //If UI loaded check which events can be broadcast
+ if(_UILoaded){
+ //Debugger.log('ALL UI LOADED, waiting for all true to dispatch init events: _dictionaryLoaded:'+_dictionaryLoaded+'_themeLoaded:'+_themeLoaded ,Debugger.GEN,'checkUILoaded','Application');
+
+ //If dictionary is loaded and event hasn't been dispatched - dispatch it
+ if(_dictionaryLoaded && !_dictionaryEventDispatched){
+ _dictionaryEventDispatched = true;
+ _dictionary.broadcastInit();
+ }
+ //If theme is loaded and theme event hasn't been dispatched - dispatch it
+ if(_themeLoaded && !_themeEventDispatched){
+ _themeEventDispatched = true;
+ _themeManager.broadcastThemeChanged();
+ }
+
+ if(_uiLoadCheckCount >= UI_LOAD_CHECK_TIMEOUT_COUNT){
+ //if we havent loaded the dict or theme by the timeout count then give up
+ Debugger.log('raeached time out waiting to load dict and themes, giving up.',Debugger.CRITICAL,'checkUILoaded','Application');
+ var msg:String = "";
+ if(!_themeEventDispatched){
+ msg+=Dictionary.getValue("app_chk_themeload");
+ }
+ if(!_dictionaryEventDispatched){
+ msg+="The lanaguage data has not been loaded.";
+ }
+ msg+=Dictionary.getValue("app_fail_continue");
+ var e:LFError = new LFError(msg,"Canvas.setDroppedTemplateActivity",this,'_themeEventDispatched:'+_themeEventDispatched+' _dictionaryEventDispatched:'+_dictionaryEventDispatched);
+ e.showErrorAlert();
+ //todo: give the user a message
+ clearInterval(_UILoadCheckIntervalID);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is called by each UI element as it loads to notify Application that it's loaded
+ * When all UIElements are loaded the Application can set UILoaded flag true allowing events to be dispatched
+ * and methods called on the UI Elements
+ *
+ * @param UIElementID:String - Identifier for the Element that was loaded
+ */
+ public function UIElementLoaded(evt:Object) {
+ Debugger.log('UIElementLoaded: ' + evt.target.className,Debugger.GEN,'UIElementLoaded','Application');
+ if(evt.type=='load'){
+ //Which item has loaded
+ switch (evt.target.className) {
+ case 'Toolkit' :
+ _toolkitLoaded = true;
+ break;
+ case 'Canvas' :
+ _canvasLoaded = true;
+ break;
+ case 'LFMenuBar' :
+ _menuLoaded = true;
+ break;
+ case 'Toolbar' :
+ _toolbarLoaded = true;
+ break;
+ case 'PropertyInspectorNew' :
+ _piLoaded = true;
+ break;
+ default:
+ }
+
+ _layout.manager.addLayoutItem(evt.target.className, evt.target);
+
+ loader.complete();
+
+ if(_layout.manager.completedLayout) {
+ _UILoaded = true;
+ } else {
+ _UILoaded = false;
+ }
+ }
+ }
+
+
+ /**
+ * Create all UI Elements
+ */
+ private function setupUI(){
+ //Make the base context menu hide built in items so we don't have zoom in etc
+ _ccm.showCustomCM(_ccm.loadMenu("application", "authoring"))
+
+ //Create the application root
+ _appRoot_mc = _container_mc.createEmptyMovieClip('appRoot_mc',APP_ROOT_DEPTH);
+
+ //Create screen elements
+ _dialogueContainer_mc = _container_mc.createEmptyMovieClip('_dialogueContainer_mc',DIALOGUE_DEPTH);
+ _cursorContainer_mc = _container_mc.createEmptyMovieClip('_cursorContainer_mc',CURSOR_DEPTH);
+ _toolbarContainer_mc = _container_mc.createEmptyMovieClip('_toolbarContainer_mc',TOOLBAR_DEPTH);
+ _pi_mc = _container_mc.createEmptyMovieClip('_pi_mc',PI_DEPTH);
+
+ // Tooltip
+ _tooltipContainer_mc = _container_mc.createEmptyMovieClip('_tooltipContainer_mc',TOOLTIP_DEPTH);
+
+ // Workspace
+ _workspace = new Workspace();
+
+ setupLayout();
+
+ setTabIndex();
+ }
+
+ private function setupLayout():Void {
+ var manager = (_isEditMode) ? ILayoutManager(new EditOnFlyLayoutManager('editonfly')) : ILayoutManager(new DefaultLayoutManager('default'));
+ _layout = new LFLayout(this, manager);
+ _layout.init();
+ }
+
+ private function setTabIndex(selectedTab:String){
+
+ //All Buttons Tab Index
+ _menu_mc.tabIndex = 100;
+ _toolbarContainer_mc.tabIndex = 200;
+ //_toolkit.tabIndex = 3;
+ _pi_mc.tabIndex = 400;
+ }
+
+ /**
+ * Runs when application setup has completed. At this point the init/loading screen can be removed and the user can
+ * work with the application
+ */
+ private function start(){
+
+ //Fire off a resize to set up sizes
+ onResize();
+
+ //Remove the loading screen
+ loader.stop();
+
+ if(SHOW_DEBUGGER){
+ showDebugger();
+ }
+
+ if(getCanvas().getCanvasModel().autoSaveWait) {
+ // enable menu item - recover...
+ LFMenuBar.getInstance().enableRecover(true);
+ }
+
+ if(_isEditMode) {
+ Debugger.log("Authoring started in Edit-On-The-Fly Mode", Debugger.CRITICAL, "start", "Application");
+ var ldID = Number(_root.learningDesignID);
+ canvas.openDesignForEditOnFly(ldID);
+ } else {
+ Debugger.log("Authoring started in Author Mode", Debugger.CRITICAL, "start", "Application");
+ }
+
+ }
+
+ /**
+ * Opens the preferences dialog
+ */
+ public function showPrefsDialog() {
+ PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue("prefs_dlg_title"),closeButton:true,scrollContentPath:'preferencesDialog'});
+ }
+
+ /**
+ * Receives events from the Stage resizing
+ */
+ public function onResize(){
+
+ //Get the stage width and height and call onResize for stage based objects
+ var w:Number = Stage.width;
+ var h:Number = Stage.height;
+
+ var someListener:Object = new Object();
+
+ someListener.onMouseUp = function () {
+
+ _layout.manager.resize(w, h);
+
+ }
+
+ _layout.manager.resize(w, h);
+
+
+
+ }
+
+ /**
+ * Handles KEY Releases for Application
+ */
+ private function onKeyUp(){
+ Debugger.log('Key released.',Debugger.GEN,'onKeyUp','Application');
+ if(!Key.isDown(Key.CONTROL)) {
+ if(_controlKeyPressed == ApplicationParent.TRANSITION) {
+ Debugger.log('Control Key released.',Debugger.GEN,'onKeyUp','Application');
+
+ var c:String = Cursor.getCurrentCursor();
+
+ if(c == ApplicationParent.C_TRANSITION){
+ _controlKeyPressed = "";
+ _canvas.stopTransitionTool();
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Handles KEY presses for Application
+ */
+ private function onKeyDown(){
+
+ //var mouseListener:Object = new Object();
+ //Debugger.log('Key.isDown(Key.CONTROL): ' + Key.isDown(Key.CONTROL),Debugger.GEN,'onKeyDown','Application');
+ //Debugger.log('Key: ' + Key.getCode(),Debugger.GEN,'onKeyDown','Application');
+ //the debug window:
+ if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
+ if (!_debugDialog.content){
+ showDebugger();
+ }else {
+ hideDebugger();
+ }
+ }else if (Key.isDown(Key.CONTROL) && Key.isDown(X_KEY)) {
+ //for copy and paste
+ //assuming that we are in the canvas...
+ cut();
+ }else if (Key.isDown(Key.CONTROL) && Key.isDown(C_KEY)) {
+ copy();
+ }else if (Key.isDown(F12_KEY)) {
+ trace("P Pressed")
+ PropertyInspectorNew(_pi_mc).localOnRelease();
+
+ }else if (Key.isDown(Key.CONTROL) && Key.isDown(V_KEY)) {
+ paste();
+
+ }else if (Key.isDown(Key.CONTROL) && Key.isDown(Z_KEY)) {
+ //undo
+ _canvas.undo();
+
+ }else if (Key.isDown(Key.CONTROL) && Key.isDown(Y_KEY)) {
+
+
+ }else if(Key.isDown(Key.CONTROL)) {
+ var c:String = Cursor.getCurrentCursor();
+ if(c != ApplicationParent.C_TRANSITION){
+ _controlKeyPressed = ApplicationParent.TRANSITION;
+ _canvas.startTransitionTool()
+ }
+
+
+ }
+
+ }
+
+ public function transition_keyPressed(){
+ _controlKeyPressed = "transition";
+ if(_canvas.model.activeTool != "TRANSITION"){
+ _canvas.toggleTransitionTool();
+ }
+ }
+ public function showDebugger():Void{
+ _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
+ }
+
+ public function hideDebugger():Void{
+ _debugDialog.deletePopUp();
+ }
+
+ /**
+ * stores a reference to the object
+ * @usage
+ * @param obj
+ * @return
+ */
+ public function setClipboardData(obj:Object, type:Number):Void{
+ // initialise new clipboard object
+ _clipboardData = new Object();
+ _clipboardData.data = obj;
+ _clipboardData.type = type;
+ _clipboardData.count = 0;
+
+ trace("clipBoard data id"+_clipboardData);
+ }
+
+ /**
+ * returns a reference to the object on the clipboard.
+ * Note it must be cloned to be used. this should be taken care of by the destination class
+ * @usage
+ * @return
+ */
+ public function getClipboardData():Object{
+ return _clipboardData;
+ }
+
+
+ public function cut():Void{
+ trace("testing cut");
+ var ca = _canvas.model.selectedItem
+ if (CanvasActivity(ca) != null){
+ if (ca.activity.parentUIID == null || ca.activity.parentUIID == undefined){
+ setClipboardData(ca, CUT_TYPE);
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_cut_invalid'));
+ }
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('al_activity_copy_invalid'));
+ }
+ //_canvas.removeActivity(_canvas.model.selectedItem.activity.activityUIID);
+ }
+
+ public function copy():Void{
+ trace("testing copy");
+ var ca = _canvas.model.selectedItem
+ if (CanvasActivity(ca) != null){
+ if (ca.activity.parentUIID == null || ca.activity.parentUIID == undefined){
+ setClipboardData(ca, COPY_TYPE);
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_copy_invalid'));
+ }
+ }else{
+ LFMessage.showMessageAlert(Dictionary.getValue('al_activity_copy_invalid'));
+ }
+ }
+
+ public function openEditActivtiyContent():Void{
+ trace("testing openEditActivtiyContent");
+ var ca = _canvas.model.selectedItem
+ if (CanvasActivity(ca) != null){
+ _canvas.view.getController().activityDoubleClick(ca);
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('al_activity_openContent_invalid'));
+ }
+ }
+
+ public function paste():Void{
+ trace("testing paste");
+ _clipboardData.count++;
+ _canvas.setPastedItem(getClipboardData());
+ }
+
+ public function expandPI():Void{
+ if (!_PI.isPIExpanded()){
+ _canvas.model.setPIHeight(_PI.piFullHeight());
+ }
+ }
+
+ public function help():Void{
+ var ca = _canvas.model.selectedItem
+ if (CanvasActivity(ca) != null){
+ _canvas.getHelp(ca);
+ }
+ }
+
+ /**
+ * get the ddm form the canvas.. this method is here as the ddm used to be stored inthe application.
+ * returns the the Design Data Model
+ */
+ public function getDesignDataModel():DesignDataModel{
+ return _canvas.ddm;
+ }
+
+ /**
+ * returns the the toolkit instance
+ */
+ public function getToolkit():Toolkit{
+ return _toolkit;
+ }
+
+ /**
+ * returns the the toolbar instance
+ */
+ public function getToolbar():Toolbar{
+ return _toolbar;
+ }
+
+ public function set toolbar(a:Toolbar) {
+ _toolbar = a;
+ }
+
+ public function get toolbar():Toolbar {
+ return _toolbar;
+ }
+
+ public function set toolkit(a:Toolkit) {
+ _toolkit = a;
+ }
+
+ public function get toolkit():Toolkit {
+ return _toolkit;
+ }
+
+ public function set menubar(a:MovieClip) {
+ _menu_mc = a;
+ }
+
+ public function get menubar():MovieClip {
+ return _menu_mc;
+ }
+
+ public function set pi(a:MovieClip) {
+ _pi_mc = a;
+ }
+
+ public function get pi():MovieClip {
+ return _pi_mc;
+ }
+
+ /**
+ * returns the the canvas instance
+ */
+ public function getCanvas():Canvas{
+ return _canvas;
+ }
+
+ public function set canvas(a:Canvas) {
+ _canvas = a;
+ }
+
+ public function get canvas():Canvas {
+ return _canvas;
+ }
+
+ public function get controlKeyPressed():String{
+ return _controlKeyPressed;
+ }
+
+ public function set controlKeyPressed(key:String){
+ _controlKeyPressed = key;
+ }
+
+ public function set root_layout(a:String){
+ _root_layout = a;
+ }
+
+ /**
+ * returns the the workspace instance
+ */
+ public function getWorkspace():Workspace{
+ return _workspace;
+ }
+
+ /**
+ * Opens the help->about dialog
+ */
+ public function showAboutDialog() {
+ var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:"About - LAMS Author",closeButton:true,scrollContentPath:'helpaboutDialog'});
+ //dialog.addEventListener('contentLoaded',);
+ // dict: title:Dictionary.getValue('ls_win_helpabout_title')
+ }
+
+ /**
+ * Returns the Dialogue conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get dialogue():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._dialogueContainer_mc != undefined) {
+ return _instance._dialogueContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the tooltip conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get tooltip():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._tooltipContainer_mc != undefined) {
+ return _instance._tooltipContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Cursor conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get cursor():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._cursorContainer_mc != undefined) {
+ return _instance._cursorContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns true if in Edit Mode (for Edit-On-The-Fly) otherwise false
+ *
+ */
+ static function get isEditMode():Boolean {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._isEditMode != undefined) {
+ return _instance._isEditMode;
+ } else {
+
+ }
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.authoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get root():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._appRoot_mc != undefined) {
+ return _instance._appRoot_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if _appRoot hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.authoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get containermc():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._container_mc != undefined) {
+ return _instance._container_mc;
+ } else {
+
+ }
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.authoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get toolbarContainer():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._toolbarContainer_mc != undefined) {
+ return _instance._toolbarContainer_mc;
+ } else {
+
+ }
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ComplexActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ComplexActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ComplexActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,159 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.*;
+/*
+* This class represents all the complex activity types. they are not much different, so we can handle them in one class.
+* For reference these are the activity types
+*
+* public static var PARALLEL_ACTIVITY_TYPE:Number = 6;
+* public static var OPTIONAL_ACTIVITY_TYPE:Number = 7;
+* public static var SEQUENCE_ACTIVITY_TYPE:Number = 8;
+*
+* @author DC
+* @version 0.1
+* @see Activity
+*/
+class ComplexActivity extends Activity{
+
+ private var _maxOptions:Number;
+ private var _minOptions:Number;
+ private var _optionsInstructions:String;
+
+
+
+ function ComplexActivity(activityUIID:Number){
+ super(activityUIID);
+ }
+
+
+ /**
+ * Creates a complex activity from a dto... which is nice
+ * @usage
+ * @param dto
+ * @return
+ */
+ public function populateFromDTO(dto:Object){
+ super.populateFromDTO(dto);
+ if(_activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE){
+ _maxOptions = dto.maxOptions;
+ _minOptions = dto.minOptions;
+ //TODO: This is missing in the Library packet - tell mai.
+ _optionsInstructions = dto.optionsInstructions;
+ }
+ }
+
+ /**
+ * Creates an object containing all the props of the ComplexActivity.
+ * If a value is null then it is ommitted... if itsd the null value from const
+ * then its included
+ * @usage
+ * @return the DTO
+ */
+ public function toData():Object{
+ var dto:Object = super.toData();
+ if(_activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE){
+ if(_maxOptions){ dto.maxOptions = _maxOptions; }
+ if(_minOptions){ dto.minOptions = _minOptions; }
+ if(_optionsInstructions){ dto.optionsInstructions = _optionsInstructions; }
+ }
+ return dto;
+ }
+
+ /**
+ * Creates an exact copy of this ComplexActivity
+ * @usage
+ * @return the copy
+ */
+ public function clone():ComplexActivity{
+ var dto:Object = toData();
+ var ca = new ComplexActivity();
+ ca.populateFromDTO(dto);
+ return ca;
+ }
+
+
+ /**
+ * Used by OPTIONAL_ACTIVITY_TYPE
+ * @usage
+ * @param newmaxOptions
+ * @return
+ */
+ public function set maxOptions (newmaxOptions:Number):Void {
+ _maxOptions = newmaxOptions;
+ }
+ /**
+ * used by OPTIONAL_ACTIVITY_TYPE
+ * @usage
+ * @return
+ */
+ public function get maxOptions ():Number {
+ return _maxOptions;
+ }
+
+
+ /**
+ * used by OPTIONAL_ACTIVITY_TYPE
+ * @usage
+ * @param newminOptions
+ * @return
+ */
+ public function set minOptions (newminOptions:Number):Void {
+ _minOptions = newminOptions;
+ }
+ /**
+ * used by OPTIONAL_ACTIVITY_TYPE
+ * @usage
+ * @return
+ */
+ public function get minOptions ():Number {
+ return _minOptions;
+ }
+
+
+ /**
+ *
+ * @usage
+ * @param newoptionsInstructions
+ * @return
+ */
+ public function set optionsInstructions (newoptionsInstructions:String):Void {
+ _optionsInstructions = newoptionsInstructions;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get optionsInstructions ():String {
+ return _optionsInstructions;
+ }
+
+
+
+
+
+
+
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,1134 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.*;
+import mx.events.*
+/*
+*
+* DesignDataModel stores all the data relating to the design
+*
+* Note the hashtable of _activities might contain the following types:
+* 1) ToolActivities
+* 2) Grouping activities which reference a _groupings element
+* 3) Parallel activities which reference 2 or more other _activitiy elements
+* 4) Optional activities which reference 2 or more other _activitiy elements
+* 5) Gate activities
+*
+*
+* @author DC
+* @version 0.1
+*
+*/
+
+class org.lamsfoundation.lams.authoring.DesignDataModel {
+
+ public static var COPY_TYPE_ID_AUTHORING:Number = 1;
+ public static var COPY_TYPE_ID_RUN:Number = 2;
+ public static var COPY_TYPE_ID_PREVIEW:Number = 3;
+
+
+ //LearningDesign Properties:
+
+ private var _objectType:String;
+ private var _copyTypeID:Number;
+
+
+ private var _learningDesignID:Number;
+ private var _prevLearningDesignID:Number; // used for backup retrieval of the learning Design ID
+ private var _title:String;
+ private var _description:String;
+ private var _helpText:String;
+ private var _version:String;
+ private var _designVersion:Number;
+ private var _userID:Number;
+ private var _editOverrideUserID:Number;
+ private var _editOverrideUserFullName:String;
+ private var _duration:Number;
+ private var _readOnly:Boolean;
+ private var _editOverrideLock:Boolean
+ private var _autoSaved:Boolean
+ private var _saveMode:Number;
+ private var _validDesign:Boolean;
+ private var _modified:Boolean;
+ private var _maxID:Number;
+ private var _firstActivityID:Number;
+ private var _firstActivityUIID:Number;
+ //James has asked for previous and next fields so I can build up a sequence map of LDs when browsing workspaces...
+ private var _parentLearningDesignID:Number;
+ private var _activities:Hashtable;
+ private var _transitions:Hashtable;
+ private var _groupings:Hashtable;
+
+
+ private var _licenseID:Number;
+ private var _licenseText:String;
+ private var _workspaceFolderID:Number;
+ private var _createDateTime:Date;
+ private var _lastModifiedDateTime:Date;
+ private var _dateReadOnly:Date;
+
+ private var _contentFolderID:String;
+
+ //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ //Constructor
+ function DesignDataModel(){
+ //initialise the hashtables
+ _activities = new Hashtable("_activities");
+ _transitions = new Hashtable("_transitions");
+ _groupings = new Hashtable("_groupings");
+
+ //set the defualts:
+ _objectType = "LearningDesign";
+ _copyTypeID = COPY_TYPE_ID_AUTHORING;
+ _version = null;
+ _readOnly = false;
+ _editOverrideLock = false;
+ _validDesign = false;
+ _autoSaved = false;
+
+ _userID = Config.getInstance().userID;
+
+ EventDispatcher.initialize(this);
+
+ //dispatch an event now the design has changed
+ dispatchEvent({type:'ddmUpdate',target:this});
+
+
+ }
+ /*
+ public function getChildActivities(ActivityUIID:Number):Array{
+ var _child:Array = new Array();
+ var values = _activities.values();
+ for (var i=0; i.setDesign(design:Object)
+ * @param design
+ * @return success
+ */
+ public function setDesign(design:Object):Boolean{
+ //note the design must be empty to call this
+ //note: Dont fire the update event as we dont want to store this change in an undo!
+ //TODO: Validate that the design is clear
+ var success:Boolean = false;
+ //TODO:Validate if design is saved if not notify user
+ success = true;
+ //_global.breakpoint();
+ Debugger.log('Setting design ID:'+design.learningDesignID,Debugger.GEN,'setDesign','DesignDataModel');
+ Debugger.log('Printing the design revieced:...\n'+ObjectUtils.toString(design),Debugger.VERBOSE,'setDesign','DesignDataModel');
+
+
+ _learningDesignID = design.learningDesignID;
+ _title = design.title;
+ _description = design.description;
+ _helpText = design.helpText;
+ _version = design.version;
+ _designVersion = design.designVersion;
+
+ _userID = design.userID;
+ _editOverrideUserID = design.editOverrideUserID;
+ _editOverrideUserFullName = design.editOverrideUserFullName;
+ _workspaceFolderID = design.workspaceFolderID;
+ _createDateTime = design.createDateTime;
+ _readOnly = design.readOnly;
+ _editOverrideLock = design.editOverrideLock;
+ _validDesign = design.validDesign;
+
+ _maxID = design.maxID;
+ _firstActivityID = design.firstActivityUIID;
+ _copyTypeID = design.copyTypeID;
+
+ _licenseID = design.licenseID;
+ _licenseText = design.licenseText;
+
+ _contentFolderID = design.contentFolderID;
+
+ //set the activities in the hash table
+ for(var i=0; i 0){
+
+ for(var i=0; i 0){
+
+ for(var i=0; i 0){
+
+ for(var i=0; i
+ * //activity properties:
+ * _activityTypeID = dto.activityTypeID;
+ * _activityID = dto.activityID;
+ * _activityCategoryID = dto.activityCategoryID;
+ * _activityUIID = dto.activityUIID;
+ * _learningLibraryID = dto.learningLibraryID;
+ * _learningDesignID = dto.learningDesignID;
+ * _libraryActivityID = dto.libraryActivityID;
+ * _parentActivityID = dto.parentActivityID;
+ * _parentUIID = dto.parentUIID;
+ * _orderID = dto.orderID;
+ * _groupingID = dto.groupingID;
+ * _groupingUIID = dto.groupingUIID;
+ * _title = dto.title;
+ * _description = dto.description;
+ * _helpText = dto.helpText;
+ * _yCoord = dto.yCoord;
+ * _xCoord = dto.xCoord;
+ * _libraryActivityUIImage = dto.libraryActivityUIImage;
+ * _applyGrouping = dto.applyGrouping;
+ * _runOffline = dto.runOffline;
+ * //now removed
+ * //_offlineInstructions = dto.offlineInstructions;
+ * //_onlineInstructions = dto.onlineInstructions;
+ * _defineLater = dto.defineLater;
+ * _createDateTime = dto.createDateTime;
+ * _groupingSupportType = dto.groupingSupportType;
+ *
+ * //Toolactivity class props
+ * _authoringURL = dto.authoringURL;
+ * _toolDisplayName = dto.toolDisplayName;
+ * _toolContentID = dto.toolContentID;
+ * _toolID = dto.toolID;
+ * _supportsContribute = dto.supportsContribute;
+ * _supportsDefineLater = dto.supportsDefineLater;
+ * _supportsModeration = dto.supportsRunOffline;
+ *
+ * @usage
+ * @param dto Object containing all ToolActivity fields:
+ * @return Noting
+ */
+ public function populateFromDTO(dto:Object):Void{
+ /*
+ //activity properties:
+ _activityTypeID = dto.activityTypeID;
+ _activityID = dto.activityID;
+ _activityCategoryID = dto.activityCategoryID;
+ _activityUIID = dto.activityUIID;
+ _learningLibraryID = dto.learningLibraryID;
+ _learningDesignID = dto.learningDesignID;
+ _libraryActivityID = dto.libraryActivityID;
+ _parentActivityID = dto.parentActivityID;
+ _parentUIID = dto.parentUIID
+ _orderID = dto.orderID
+ _groupingID = dto.groupingID;
+ _groupingUIID = dto.groupingUIID
+ _title = dto.title;
+ _description = dto.description;
+ _helpText = dto.helpText;
+ _yCoord = dto.yCoord;
+ _xCoord = dto.xCoord;
+ _libraryActivityUIImage = dto.libraryActivityUIImage;
+ _applyGrouping = dto.applyGrouping;
+ _runOffline = dto.runOffline;
+ _defineLater = dto.defineLater;
+ _createDateTime = dto.createDateTime;
+ _groupingSupportType = dto.groupingSupportType;
+ */
+
+
+ //first do the super method for activity props
+ super.populateFromDTO(dto);
+ //Toolactivity class props
+ if(StringUtils.isWDDXNull(dto.authoringURL)) { _authoringURL = null }
+ else { _authoringURL = dto.authoringURL; }
+
+ if(StringUtils.isWDDXNull(dto.helpURL)) { _helpURL = null }
+ else { _helpURL = dto.helpURL; }
+
+ if(StringUtils.isWDDXNull(dto.toolDisplayName)) { _toolDisplayName = null }
+ else { _toolDisplayName = dto.toolDisplayName; }
+
+ if(StringUtils.isWDDXNull(dto.toolSignature)) { _toolSignature = null }
+ else { _toolSignature = dto.toolSignature; }
+
+ if(StringUtils.isWDDXNull(dto.toolContentID)) { _toolContentID = null }
+ else { _toolContentID = dto.toolContentID; }
+
+ if(StringUtils.isWDDXNull(dto.toolID)) { _toolID = null }
+ else { _toolID = dto.toolID; }
+
+ _supportsContribute = dto.supportsContribute;
+ _supportsDefineLater = dto.supportsDefineLater;
+ _supportsModeration = dto.supportsRunOffline
+ activityToolContentID = _toolContentID;
+ trace("Tool "+_toolDisplayName +" has ToolContent ID: "+_toolContentID)
+ //maybe return isValid();
+ }
+
+
+ //to data for serialising:
+
+ public function toData():Object{
+ var dto = super.toData();
+ dto.authoringURL = (_authoringURL) ? _authoringURL : Config.STRING_NULL_VALUE;
+ dto.helpURL = (_helpURL) ? _helpURL : Config.STRING_NULL_VALUE;
+ dto.toolDisplayName = (_toolDisplayName) ? _toolDisplayName: Config.STRING_NULL_VALUE;
+ dto.toolSignature = (_toolSignature) ? _toolSignature: Config.STRING_NULL_VALUE;
+ //if(isCopy) { Application.getInstance().getCanvas().getCanvasModel().setDefaultToolContentID(this); }
+
+ dto.toolContentID = (_toolContentID) ? _toolContentID: Config.NUMERIC_NULL_VALUE;
+
+ dto.toolID = (_toolID) ? _toolID: Config.NUMERIC_NULL_VALUE;
+
+
+ /* THESE are internal flags, not part of the design
+ dto.supportsContribute = (_supportsContribute!=null) ? _supportsContribute: Config.BOOLEAN_NULL_VALUE;
+ dto.supportsDefineLater = (_supportsDefineLater!=null) ? _supportsDefineLater: Config.BOOLEAN_NULL_VALUE;
+ dto.supportsModeration = (_supportsModeration!=null) ? _supportsModeration: Config.BOOLEAN_NULL_VALUE;
+ dto.supportsRunOffline = (_supportsRunOffline!=null) ? _supportsRunOffline: Config.BOOLEAN_NULL_VALUE;
+ */
+ return dto;
+ }
+
+ public function clone():ToolActivity{
+ //var n:Activity = super.clone();
+
+ var n:ToolActivity = new ToolActivity(null);
+
+ //parents properties:
+ n.objectType = _objectType;
+ n.activityTypeID = _activityTypeID;
+ n.activityID = _activityID;
+ n.activityCategoryID = _activityCategoryID;
+ n.activityUIID = _activityUIID;
+ n.learningLibraryID = _learningLibraryID;
+ n.learningDesignID = _learningDesignID;
+ n.libraryActivityID = _libraryActivityID;
+ n.parentActivityID = _parentActivityID;
+ n.parentUIID = _parentUIID
+ n.orderID = _orderID
+ n.groupingID = _groupingID;
+ n.groupingUIID = _groupingUIID
+ n.title = _title;
+ n.description = _description;
+ n.helpText = _helpText;
+ n.yCoord = _yCoord;
+ n.xCoord = _xCoord;
+ n.libraryActivityUIImage = _libraryActivityUIImage;
+ n.applyGrouping = _applyGrouping;
+ n.runOffline = _runOffline;
+ //now removed
+ //n.offlineInstructions = _offlineInstructions;
+ //n.onlineInstructions = _onlineInstructions;
+ n.defineLater = _defineLater;
+ n.createDateTime = _createDateTime;
+ n.groupingSupportType = _groupingSupportType;
+
+ //class props
+ n.authoringURL = _authoringURL;
+ n.helpURL = _helpURL;
+ n.toolDisplayName = _toolDisplayName;
+ n.toolSignature = _toolSignature;
+ n.toolContentID = _toolContentID;
+ n.toolID = _toolID;
+ n.supportsContribute = _supportsContribute;
+ n.supportsDefineLater = _supportsDefineLater;
+ n.supportsModeration = _supportsRunOffline;
+
+ return n;
+
+
+ }
+
+ //GETTERS + SETTERS
+
+ /**
+ *
+ * @usage
+ * @param newauthoringurl
+ * @return
+ */
+ public function set authoringURL (newauthoringurl:String):Void {
+ _authoringURL = newauthoringurl;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get authoringURL ():String {
+ return _authoringURL;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newtoolDisplayName
+ * @return
+ */
+ public function set toolDisplayName (newtoolDisplayName:String):Void {
+ _toolDisplayName = newtoolDisplayName;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get toolDisplayName ():String {
+ return _toolDisplayName;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newtoolSignature
+ * @return
+ */
+ public function set toolSignature (newtoolSignature:String):Void {
+ _toolSignature = newtoolSignature;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get toolSignature ():String {
+ return _toolSignature;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newtoolContentID
+ * @return
+ */
+ public function set toolContentID (newtoolContentID:Number):Void {
+ _toolContentID = newtoolContentID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get toolContentID ():Number {
+ return _toolContentID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newtoolID
+ * @return
+ */
+ public function set toolID (newtoolID:Number):Void {
+ _toolID = newtoolID;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get toolID ():Number {
+ return _toolID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newsupportsContribute
+ * @return
+ */
+ public function set supportsContribute (newsupportsContribute:Boolean):Void {
+ _supportsContribute = newsupportsContribute;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get supportsContribute ():Boolean {
+ return _supportsContribute;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newsupportsDefineLater
+ * @return
+ */
+ public function set supportsDefineLater (newsupportsDefineLater:Boolean):Void {
+ _supportsDefineLater = newsupportsDefineLater;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get supportsDefineLater ():Boolean {
+ return _supportsDefineLater;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newsupportsModeration
+ * @return
+ */
+ public function set supportsModeration (newsupportsModeration:Boolean):Void {
+ _supportsModeration = newsupportsModeration;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get supportsModeration ():Boolean {
+ return _supportsModeration;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newsupportsRunOffline
+ * @return
+ */
+ public function set supportsRunOffline (newsupportsRunOffline:Boolean):Void {
+ _supportsRunOffline = newsupportsRunOffline;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get supportsRunOffline ():Boolean {
+ return _supportsRunOffline;
+ }
+
+/**
+ *
+ * @usage
+ * @param newmonitoringUrl
+ * @return
+ */
+ public function set monitoringUrl (newmonitoringUrl:String):Void {
+ _monitoringURL = newmonitoringUrl;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get monitoringUrl ():String {
+ return _monitoringURL;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newcontributeUrl
+ * @return
+ */
+ public function set contributeUrl (newcontributeUrl:String):Void {
+ _contributeURL = newcontributeUrl;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get contributeUrl ():String {
+ return _contributeURL;
+ }
+
+
+ /**
+ *
+ * @usage
+ * @param newhelpurl
+ * @return
+ */
+ public function set helpURL (newhelpurl:String):Void {
+ _helpURL = newhelpurl;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get helpURL ():String {
+ return _helpURL;
+ }
+
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Transition.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Transition.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Transition.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,199 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.util.*;
+
+/**
+* Transition data class. Transitions are used in the design to join up activities. Stored in the DDM
+*
+* @author DC
+* @version 0.1
+* @comments DesignDataModel stores a complete learning design
+*/
+class org.lamsfoundation.lams.authoring.Transition {
+
+ //Transition properties
+
+ private var _transitionID:Number;
+ private var _transitionUIID:Number;
+ private var _fromActivityID:Number;
+ private var _fromUIID:Number;
+ private var _mod_fromActivityID:Number;
+ private var _mod_fromUIID:Number;
+ private var _toActivityID:Number;
+ private var _toUIID:Number;
+ private var _mod_toActivityID:Number;
+ private var _mod_toUIID:Number;
+
+ private var _title:String;
+ private var _description:String;
+
+ private var _createDateTime:Date;
+ //TODO 05-10-05: This will be removed by mai this week
+ private var _learningDesignID:Number;
+
+
+ function Transition(transitionUIID,
+ fromUIID,
+ toUIID,
+ learningDesignID){
+ _transitionUIID = transitionUIID;
+ _fromUIID = fromUIID;
+ _toUIID = toUIID;
+ _learningDesignID = learningDesignID;
+
+ _mod_fromActivityID = null
+ _mod_fromUIID = null;
+ _mod_toActivityID = null;
+ _mod_toUIID = null;
+
+ Debugger.log('Created a new transition, transitionUIID:'+transitionUIID,Debugger.GEN,'Constructor','Transition');
+
+ }
+
+
+ public function isToGateActivity():Boolean{
+ var ddm = Application.getInstance().getDesignDataModel();
+ var a:Activity = ddm.getActivityByUIID(this.toActivityID);
+ return a.isGateActivity();
+ }
+
+
+ public function toData():Object{
+ var dto:Object = new Object();
+ dto.transitionID = (_transitionID) ? _transitionID : Config.NUMERIC_NULL_VALUE;
+ dto.transitionUIID= (transitionUIID) ? transitionUIID : Config.NUMERIC_NULL_VALUE;
+ dto.fromActivityID = (_fromActivityID) ? _fromActivityID : Config.NUMERIC_NULL_VALUE;
+ dto.fromUIID = (_fromUIID) ? _fromUIID : Config.NUMERIC_NULL_VALUE;
+ dto.toActivityID = (_toActivityID) ? _toActivityID : Config.NUMERIC_NULL_VALUE;
+ dto.toUIID = (_toUIID) ? _toUIID : Config.NUMERIC_NULL_VALUE;
+ dto.title = (_title) ? _title : Config.STRING_NULL_VALUE;
+ dto.description = (_description) ? _description : Config.STRING_NULL_VALUE;
+ dto.createDateTime = (_createDateTime) ? _createDateTime : Config.DATE_NULL_VALUE;
+ dto.learningDesignID = (_learningDesignID) ? _learningDesignID : Config.NUMERIC_NULL_VALUE;
+ return dto;
+ }
+
+ public function set transitionID(a:Number):Void{
+ _transitionID = a;
+ }
+ public function get transitionID():Number{
+ return _transitionID;
+ }
+
+ public function set transitionUIID(a:Number):Void{
+ _transitionUIID = a;
+ }
+
+ public function get transitionUIID():Number{
+ return _transitionUIID;
+ }
+
+ public function set fromActivityID(a:Number):Void{
+ _fromActivityID = a;
+ }
+ public function get fromActivityID():Number{
+ return _fromActivityID;
+ }
+
+ public function set mod_fromActivityID(a:Number):Void{
+ _mod_fromActivityID = a;
+ }
+ public function get mod_fromActivityID():Number{
+ return _mod_fromActivityID;
+ }
+
+ public function set fromUIID(a:Number):Void{
+ _fromUIID = a;
+ }
+ public function get fromUIID():Number{
+ return _fromUIID;
+ }
+
+ public function set mod_fromUIID(a:Number):Void{
+ _mod_fromUIID = a;
+ }
+ public function get mod_fromUIID():Number{
+ return _mod_fromUIID;
+ }
+
+ public function set toActivityID(a:Number):Void{
+ _toActivityID = a;
+ }
+ public function get toActivityID():Number{
+ return _toActivityID;
+ }
+
+ public function set mod_toActivityID(a:Number):Void{
+ _mod_toActivityID = a;
+ }
+ public function get mod_toActivityID():Number{
+ return _mod_toActivityID;
+ }
+
+ public function set toUIID(a:Number):Void{
+ _toUIID = a;
+ }
+ public function get toUIID():Number{
+ return _toUIID;
+ }
+
+ public function set mod_toUIID(a:Number):Void{
+ _mod_toUIID = a;
+ }
+ public function get mod_toUIID():Number{
+ return _mod_toUIID;
+ }
+
+ public function set title(a:String):Void{
+ _title = a;
+ }
+ public function get title():String{
+ return _title;
+ }
+
+ public function set description(a:String):Void{
+ _description = a;
+ }
+ public function get description():String{
+ return _description;
+ }
+
+ public function set createDateTime(a:Date):Void{
+ _createDateTime = a;
+ }
+ public function get createDateTime():Date{
+ return _createDateTime;
+ }
+
+
+ public function set learningDesignID(a):Void{
+ _learningDesignID = a;
+ }
+ public function get learningDesignID():Number{
+ return _learningDesignID;
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Bin.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Bin.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Bin.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.util.ui.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.cv.*;
+
+
+/**
+* CanvasActivity -
+*/
+class org.lamsfoundation.lams.authoring.cv.Bin extends MovieClip{
+
+
+ //this is set by the init object
+ private var _canvasController:CanvasController;
+ private var _canvasView:CanvasView;
+ private var _tip:ToolTip;
+ //locals
+ private var tooltipXoffset:Number = 100;
+ private var up_mc:MovieClip;
+ private var over_mc:MovieClip;
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ function Bin(){
+ Debugger.log('hello',4,'Constructor','Bin');
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+ }
+
+ public function init():Void{
+ //set up handlers
+ _tip = new ToolTip();
+ up_mc.addEventListener("onRollOver",this);
+ up_mc.addEventListener("onRollOut",this);
+ up_mc.addEventListener("onRelease",this);
+ draw();
+ }
+
+ private function draw(){
+ over_mc._visible = false;
+ up_mc._visible = true;
+ }
+
+ private function onRelease():Void{
+ Debugger.log('onRelease:'+this,Debugger.GEN,'onRelease','Bin');
+ _tip.CloseToolTip();
+ }
+
+ private function onRollOver():Void{
+ var Xpos = (Application.CANVAS_X+ this._x)-tooltipXoffset;
+ var Ypos = (Application.CANVAS_Y+ this._y);
+ var ttHolder = Application.tooltip;
+ //var ttMessage = btnObj.label;
+ var ttMessage = Dictionary.getValue("bin_tooltip");
+ //param "true" is to specify that tooltip needs to be shown above the component
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, true);
+ }
+
+ private function onRollOut():Void{
+ _tip.CloseToolTip();
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Canvas.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Canvas.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Canvas.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,1470 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.cv.*
+import org.lamsfoundation.lams.authoring.tk.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.comms.*
+import org.lamsfoundation.lams.authoring.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.ws.Workspace
+import org.lamsfoundation.lams.common.ApplicationParent
+import org.lamsfoundation.lams.common.*
+import mx.managers.*
+import mx.utils.*
+
+/**
+ * The canvas is the main screen area of the LAMS application where activies are added and sequenced
+ * Note - This holds the DesignDataModel _ddm
+ * @version 1.0
+ * @since
+ */
+class org.lamsfoundation.lams.authoring.cv.Canvas {
+
+ //Constants
+ //public static var USE_PROPERTY_INSPECTOR = true;
+
+ //Model
+ private var canvasModel:CanvasModel;
+
+ //View
+ private var canvasView:CanvasView;
+
+ // CookieMonster (SharedObjects)
+ private var _cm:CookieMonster;
+ private var _comms:Communication;
+
+ private var _canvasView_mc:MovieClip;
+ private var app:Application;
+ private var _ddm:DesignDataModel;
+ private var _dictionary:Dictionary;
+ private var _config:Config;
+ private var doc;
+ private var _newToolContentID:Number;
+ private var _newChildToolContentID:Number;
+ private var _undoStack:Array;
+ private var _redoStack:Array;
+ private var toolActWidth:Number = 123;
+ private var toolActHeight:Number = 50;
+ private var complexActWidth:Number = 143;
+ private var _isBusy:Boolean;
+ // auto-save interval
+ //private static var AUTOSAVE_DEFAULT_CHECK_INTERVAL:Number = 10000;
+ private static var AUTOSAVE_CONFIG:String = "autosave";
+ private static var AUTOSAVE_TAG:String = "cv.ddm.autosave.user.";
+ //private var _pi:MovieClip; //Property inspector
+ private var _bin:MovieClip;//bin
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ /**
+ * Canvas Constructor
+ *
+ * @param target_mc Target clip for attaching view
+ */
+ public function Canvas (target_mc:MovieClip,depth:Number,x:Number,y:Number,w:Number,h:Number){
+ mx.events.EventDispatcher.initialize(this);
+
+ //Design Data Model.
+ _ddm = new DesignDataModel();
+
+ //Create the model.
+ //pass in a ref to this container
+ canvasModel = new CanvasModel(this);
+
+ _dictionary = Dictionary.getInstance();
+
+ //Create the view
+ _canvasView_mc = target_mc.createChildAtDepth("canvasView",DepthManager.kTop);
+
+ //Cast toolkit view clip as ToolkitView and initialise passing in model
+ canvasView = CanvasView(_canvasView_mc);
+ canvasView.init(canvasModel,undefined,x,y,w,h);
+
+
+ //Get reference to application and design data model
+ app = Application.getInstance();
+
+
+ //Get a ref to the cookie monster
+ _cm = CookieMonster.getInstance();
+ _comms = ApplicationParent.getInstance().getComms();
+
+ _undoStack = new Array();
+ _redoStack = new Array();
+ _isBusy = false;
+ //some initialisation:
+
+
+ //Add listener to view so that we know when it's loaded
+ canvasView.addEventListener('load',Proxy.create(this,viewLoaded));
+
+ _ddm.addEventListener('ddmUpdate',Proxy.create(this,onDDMUpdated));
+ _ddm.addEventListener('ddmBeforeUpdate',Proxy.create(this,onDDMBeforeUpdate));
+
+
+
+ //Register view with model to receive update events
+ canvasModel.addObserver(canvasView);
+
+
+ //Set the position by setting the model which will call update on the view
+ canvasModel.setPosition(x,y);
+ //Initialise size to the designed size
+ canvasModel.setSize(w,h);
+
+ //muist comne after the canvasView as we use the defaultController method to get a controller ref.
+ //_dictionary.addEventListener('init',Proxy.create(this,setupPI));
+
+ //if in monitor, dont do it!
+ initBin();
+
+
+ }
+
+
+ /**
+ * Method used to open a Property Inspector on popup window. Not used any more
+ *
+ * @usage
+ * @return
+
+ public function setupPI(){
+ if(USE_PROPERTY_INSPECTOR){
+ initPropertyInspector();
+ }
+ }
+ */
+
+ /**
+ * Event dispatched from the view once it's loaded
+ */
+ public function viewLoaded(evt:Object) {
+ //Debugger.log('Canvas view loaded: ' + evt.type,Debugger.GEN,'viewLoaded','Canvas');
+ if(evt.type=='load') {
+ var autosave_config_interval = Config.getInstance().getItem(AUTOSAVE_CONFIG);
+ if(autosave_config_interval > 0) {
+ if(CookieMonster.cookieExists(AUTOSAVE_TAG + _root.userID)) {
+ canvasModel.autoSaveWait = true;
+ }
+ setInterval(Proxy.create(this,autoSave), autosave_config_interval);
+ }
+
+ clearCanvas(true);
+
+ dispatchEvent({type:'load',target:this});
+
+ }else {
+ Debugger.log('Event type not recognised : ' + evt.type,Debugger.CRITICAL,'viewLoaded','Canvas');
+ }
+ }
+
+ /**
+ * Opens the help->about dialog
+ */
+ public function openAboutLams() {
+
+ var controller:CanvasController = canvasView.getController();
+
+ var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('about_popup_title_lbl', [Dictionary.getValue('stream_reference_lbl')]),closeButton:true,scrollContentPath:'AboutLams'});
+ dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
+
+ }
+
+
+
+ /**
+ * Opens a design using workspace and user to select design ID
+ * passes the callback function to recieve selected ID
+ */
+ public function openDesignBySelection(){
+ //Work space opens dialog and user will select view
+ if(_ddm.modified){
+ LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doOpenDesignBySelection), null);
+ } else {
+ doOpenDesignBySelection();
+ }
+ }
+
+ public function doOpenDesignBySelection():Void{
+ var callback:Function = Proxy.create(this, openDesignById);
+ var ws = Application.getInstance().getWorkspace();
+ ws.userSelectItem(callback);
+ }
+
+ /**
+ * Request design from server using supplied ID.
+ * @usage
+ * @param designId
+ * @return
+ */
+ public function openDesignById(workspaceResultDTO:Object){
+ //Application.getInstance().getWorkspace().getWV().workspaceDialog.closeThisDialogue();
+ Application.getInstance().getWorkspace().getWV().clearDialog();
+ ObjectUtils.toString(workspaceResultDTO);
+ var designId:Number = workspaceResultDTO.selectedResourceID;
+
+ var callback:Function = Proxy.create(this,setDesign);
+
+ //Application.getInstance().getComms().getRequest('flashxml/learning_design.xml',callback, false);
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designId,callback, false);
+ //var designObject:Object = Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesign&learningDesignID='+designId,callback);
+
+
+ }
+
+ /**
+ * Request imported design from server
+ *
+ * @usage
+ * @param learningDesignID
+ * @return
+ */
+
+ public function openDesignByImport(learningDesignID:Number){
+ var callback:Function = Proxy.create(this,setDesign, true);
+ canvasModel.importing = true;
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+learningDesignID,callback, false);
+
+ }
+
+ /**
+ * Request runtime-sequence design from server to be editted.
+ *
+ * @usage
+ * @param learningDesignID
+ * @return
+ */
+
+ public function openDesignForEditOnFly(learningDesignID:Number){
+ var callback:Function = Proxy.create(this,setDesign, true);
+ canvasModel.editing = true;
+
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+learningDesignID,callback, false);
+
+ }
+
+ /**
+ * Auto-saves current DDM (Learning Design on Canvas) to SharedObject
+ *
+ * @usage
+ * @return
+ */
+
+ private function autoSave(){
+ if(!canvasModel.autoSaveWait && (canvasModel.activitiesDisplayed.size() > 0)) {
+ if(!ddm.readOnly) {
+ var tag:String = AUTOSAVE_TAG + _root.userID;
+
+ var dto:Object = _ddm.getDesignForSaving();
+ dto.lastModifiedDateTime = new Date();
+ dto.readOnly = true;
+
+ // remove existing auto-saved ddm
+ if (CookieMonster.cookieExists(tag)) {
+ CookieMonster.deleteCookie(tag);
+ }
+
+ // auto-save existing ddm
+ var res = CookieMonster.save(dto,tag,true);
+
+ if(!res){
+ // error auto-saving
+ var msg:String = Dictionary.getValue('cv_autosave_err_msg');
+ LFMessage.showMessageAlert(msg);
+ }
+ }
+ } else if(canvasModel.autoSaveWait) {
+ discardAutoSaveDesign();
+ }
+
+ }
+
+ /**
+ * Show auto-save confirmation message
+ *
+ * @usage
+ * @return
+ */
+
+ public function showRecoverMessage() {
+ var recData:Object = CookieMonster.open(AUTOSAVE_TAG + _root.userID,true);
+
+ //var timeDiff:Number = new Date().getTime() - recData.lastModifiedDateTime.getTime();
+ //var saveDelay:Number = timeDiff/1000/60;
+
+ LFMessage.showMessageConfirm(Dictionary.getValue('cv_autosave_rec_msg'), Proxy.create(this, recoverDesign, recData), Proxy.create(this, discardAutoSaveDesign), null, null, Dictionary.getValue('cv_autosave_rec_title'));
+ }
+
+
+ /**
+ * Recover design data from SharedObject and save.
+ *
+ * @usage
+ * @return
+ */
+
+ public function recoverDesign(recData:Object) {
+ setDesign(recData);
+ discardAutoSaveDesign();
+ }
+
+ private function discardAutoSaveDesign() {
+ canvasModel.autoSaveWait = false;
+ CookieMonster.deleteCookie(AUTOSAVE_TAG + _root.userID);
+ LFMenuBar.getInstance().enableRecover(false);
+ }
+
+ public function saveDesign(){
+ if((_ddm.learningDesignID == undefined || _ddm.learningDesignID == "" || _ddm.learningDesignID == null || _ddm.learningDesignID =="undefined") || _ddm.learningDesignID == Config.NUMERIC_NULL_VALUE && (_ddm.title == "" || _ddm.title == undefined || _ddm.title == null)){
+
+ // raise alert if design is empty
+ if (canvasModel.activitiesDisplayed.size() < 1){
+ Cursor.showCursor(Application.C_DEFAULT);
+ var msg:String = Dictionary.getValue('al_empty_design');
+ LFMessage.showMessageAlert(msg);
+ }else {
+ saveDesignToServerAs(Workspace.MODE_SAVE);
+ }
+
+ }else if(_ddm.readOnly && !_ddm.editOverrideLock){
+ saveDesignToServerAs(Workspace.MODE_SAVEAS);
+ }else if(_ddm.editOverrideLock){
+ var errors:Array = canvasModel.validateDesign();
+
+ if(errors.length > 0) {
+ var errorPacket = new Object();
+ errorPacket.messages = errors;
+
+ var msg:String = Dictionary.getValue('cv_invalid_design_on_apply_changes');
+ //public static function howMessageConfirm(msg, okHandler:Function, cancelHandler:Function,okLabel:String,cancelLabel:String){
+ var okHandler = Proxy.create(this,showDesignValidationIssues, errorPacket);
+ LFMessage.showMessageConfirm(msg,okHandler,null,Dictionary.getValue('cv_show_validation'));
+ Cursor.showCursor(Application.C_DEFAULT);
+ } else {
+ saveDesignToServer(); // design is valid, save normal
+ }
+
+ }else{
+ saveDesignToServer();
+ }
+ }
+
+ /**
+ * Launch workspace browser dialog and set the design metat data for saving
+ * E.g. Title, Desc, Folder etc... also license if required?
+ * @usage
+ * @param tabToShow The tab to be selected when the dialogue opens.
+ * @param mode save mode
+ * @return
+ */
+ public function saveDesignToServerAs(mode:String){
+ // if design as not been previously saved then we should use SAVE mode
+ if(_ddm.learningDesignID == null) { mode = Workspace.MODE_SAVE }
+ else {
+ //hold exisiting learningDesignID value in model (backup)
+ _ddm.prevLearningDesignID = _ddm.learningDesignID;
+
+ //clear the learningDesignID so it will not overwrite the existing one
+ _ddm.learningDesignID = null;
+ }
+
+
+ var onOkCallback:Function = Proxy.create(this, saveDesignToServer);
+ var ws = Application.getInstance().getWorkspace();
+ ws.setDesignProperties("LOCATION", mode, onOkCallback);
+
+
+ }
+ /**
+ * Updates the design with the detsils form the workspace :
+ * *
+ * _resultDTO.selectedResourceID //The ID of the resource that was selected when the dialogue closed
+ * _resultDTO.resourceName //The contents of the Name text field
+ * _resultDTO.resourceDescription //The contents of the description field on the propertirs tab
+ * _resultDTO.resourceLicenseText //The contents of the license text field
+ * _resultDTO.resourceLicenseID //The ID of the selected license from the drop down.
+ *
+ * And then saves the design to the sever by posting XML via comms class
+ * @usage
+ * @return
+ */
+ public function saveDesignToServer(workspaceResultDTO:Object):Boolean{
+ _global.breakpoint();
+
+ //TODO: Set the results from wsp into design.
+ if(workspaceResultDTO != null){
+ if(workspaceResultDTO.selectedResourceID != null){
+ //must be overwriting an existing design as we have a new resourceID
+ _ddm.learningDesignID = workspaceResultDTO.selectedResourceID;
+ }
+ _ddm.workspaceFolderID = workspaceResultDTO.targetWorkspaceFolderID;
+ _ddm.title = workspaceResultDTO.resourceName;
+ _ddm.description = workspaceResultDTO.resourceDescription;
+ _ddm.licenseText = workspaceResultDTO.resourceLicenseText;
+ _ddm.licenseID = workspaceResultDTO.resourceLicenseID;
+ }
+ var mode:String = Application.getInstance().getWorkspace().getWorkspaceModel().currentMode;
+
+ _ddm.saveMode = (mode == Workspace.MODE_SAVEAS) ? 1 : 0;
+
+ Debugger.log('SAVE MODE:'+_ddm.saveMode,Debugger.CRITICAL,'saveDesignToServer','Canvas');
+
+
+ var dto:Object = _ddm.getDesignForSaving();
+
+ var callback:Function = Proxy.create(this,onStoreDesignResponse);
+
+ Application.getInstance().getComms().sendAndReceive(dto,"servlet/authoring/storeLearningDesignDetails",callback,false);
+ //Application.getInstance().getComms().sendAndReceive(dto,"http://dolly.uklams.net:8080/lams/authoring/authorServlet",onStoreDesignResponse,true);
+ //Application.getInstance().getComms().sendAndReceive(dto,"http://geo.uklams.net/testing/printPost.php",onStoreDesignResponse,true);
+
+ return true;
+ //public function sendAndReceive(dto:Object, requestURL:String,handler:Function,isFullURL){
+ }
+
+ /**
+ * now contains a validation response packet
+ * Displays to the user the results of the response.
+ * @usage
+ * @param r //the validation response
+ * @return
+ */
+ public function onStoreDesignResponse(r):Void{
+ //Debugger.log('Response:'+ObjectUtils.printObject(response),Debugger.GEN,'onStoreDesignResponse','Canvas');
+ Application.getInstance().getWorkspace().getWV().clearDialog();
+
+ if(r instanceof LFError){
+ // reset old learning design ID if failed completing a save-as operation
+ if(_ddm.prevLearningDesignID != null && _ddm.saveMode == 1) {
+ _ddm.prevLearningDesignID = null;
+ }
+
+ Cursor.showCursor(Application.C_DEFAULT);
+ r.showErrorAlert();
+ }else{
+ //_global.breakpoint();
+ //Debugger.log('_ddm.learningDesignID:'+_ddm.learningDesignID,Debugger.GEN,'setDroppedTemplateActivity','Canvas');
+ discardAutoSaveDesign();
+
+ _ddm.learningDesignID = r.learningDesignID;
+ _ddm.validDesign = r.valid;
+
+ if(_ddm.saveMode == 1){
+ Debugger.log('save mode: ' +_ddm.saveMode,Debugger.GEN,'onStoreDesignResponse','Canvas');
+ Debugger.log('updating activities.... ',Debugger.GEN,'onStoreDesignResponse','Canvas');
+
+ updateToolActivities(r);
+
+ _ddm.readOnly = false;
+ _ddm.copyTypeID = DesignDataModel.COPY_TYPE_ID_AUTHORING;
+
+ } else {
+ Debugger.log('save mode: ' +_ddm.saveMode,Debugger.GEN,'onStoreDesignResponse','Canvas');
+
+ }
+
+ _ddm.modified = false;
+
+ ApplicationParent.extCall("setSaved", "true");
+
+ LFMenuBar.getInstance().enableExport(true);
+ Debugger.log('_ddm.learningDesignID:'+_ddm.learningDesignID,Debugger.GEN,'onStoreDesignResponse','Canvas');
+
+
+ if(_ddm.validDesign){
+ //var msg:String = "Congratulations! - Your design is valid has been saved"+r.learningDesignID;
+ //TODO take this from the dictionary
+ var msg:String = Dictionary.getValue('cv_valid_design_saved');
+ var _requestSrc = _root.requestSrc;
+ if(_requestSrc != null) {
+ //show the window, on load, populate it
+ var cc:CanvasController = canvasView.getController();
+ var saveConfirmDialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('al_alert'),closeButton:false,scrollContentPath:"SaveConfirmDialog",msg:msg, requestSrc:_requestSrc, canvasModel:canvasModel,canvasController:cc});
+
+ //var extHandler = Proxy.create(this,closeReturnExt);
+ //LFMessage.showMessageConfirm(msg, null, extHandler, null, Dictionary.getValue('cv_close_return_to_ext_src', [_requestSrc]));
+ } else if(_ddm.editOverrideLock) {
+ var finishEditHandler = Proxy.create(this,finishEditOnFly);
+ msg = Dictionary.getValue('cv_eof_changes_applied');
+ LFMessage.showMessageAlert(msg, finishEditHandler);
+ } else {
+ LFMessage.showMessageAlert(msg);
+ }
+ } else {
+ var msg:String = Dictionary.getValue('cv_invalid_design_saved');
+ //public static function howMessageConfirm(msg, okHandler:Function, cancelHandler:Function,okLabel:String,cancelLabel:String){
+ var okHandler = Proxy.create(this,showDesignValidationIssues,r);
+ LFMessage.showMessageConfirm(msg,okHandler,null,Dictionary.getValue('cv_show_validation'));
+ }
+
+ checkValidDesign();
+ checkReadOnlyDesign();
+ Cursor.showCursor(Application.C_DEFAULT);
+ }
+ }
+
+ public function showDesignValidationIssues(responsePacket){
+ Debugger.log(responsePacket.messages.length+' issues',Debugger.GEN,'showDesignValidationIssues','Canvas');
+ var dp = new Array();
+ for(var i=0; i0){
+ //get the last state off the stack
+ var snapshot = _undoStack.pop();
+
+ //get a copy of the current design and stick it in redo
+ _redoStack.push(_ddm.toData());
+
+ clearCanvas(true);
+ //set the current design to the snapshot value
+ _ddm.setDesign(snapshot,true);
+ canvasModel.setDirty();
+
+ }else{
+ Debugger.log("Cannot Undo! no data on stack!",Debugger.GEN,'redo','Canvas');
+ }
+ }
+
+ /**
+ * Redo last what was undone by the undo method.
+ * NOTE: if a new edit is made, the re-do stack is cleared
+ * @usage
+ * @return
+ */
+ public function redo():Void{
+
+ if(_redoStack.length > 0){
+ //get the last state off the stack
+ var snapshot = _redoStack.pop();
+
+ _undoStack.push(_ddm.toData());
+
+ clearCanvas(true);
+
+ _ddm.setDesign(snapshot,true);
+ canvasModel.setDirty();
+
+ }else{
+ Debugger.log("Cannot Redo! no data on stack!",Debugger.GEN,'redo','Canvas');
+ }
+
+ }
+
+ /**
+ * Open the Help page for the selected Tool (Canvas) Activity
+ *
+ * @param ca CanvasActivity
+ * @return
+ */
+
+ public function getHelp(ca:CanvasActivity) {
+
+ if(ca.activity.helpURL != undefined || ca.activity.helpURL != null) {
+ Debugger.log("Opening help page with locale " + _root.lang + _root.country + ": " + ca.activity.helpURL,Debugger.GEN,'getHelp','Canvas');
+ var locale:String = _root.lang + _root.country;
+
+ ApplicationParent.extCall("openURL", ca.activity.helpURL + app.module + "#" + ca.activity.toolSignature + app.module + "-" + locale);
+
+ } else {
+ if (ca.activity.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE){
+ var callback:Function = Proxy.create(this, openGroupHelp);
+ app.getHelpURL(callback)
+ }else if (ca.activity.activityTypeID == Activity.SYNCH_GATE_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.SCHEDULE_GATE_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.PERMISSION_GATE_ACTIVITY_TYPE){
+ var callback:Function = Proxy.create(this, openGateHelp);
+ app.getHelpURL(callback)
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_helpURL_undefined', [ca.activity.toolDisplayName]));
+ }
+ }
+ }
+
+ private function openGroupHelp(url:String){
+ var actToolSignature:String = Application.FLASH_TOOLSIGNATURE_GROUP
+ var locale:String = _root.lang + _root.country;
+ var target:String = actToolSignature + app.module + '#' + actToolSignature+ app.module + '-' + locale;
+
+ ApplicationParent.extCall("openURL", url + target);
+ }
+
+ private function openGateHelp(url:String){
+ var actToolSignature:String = Application.FLASH_TOOLSIGNATURE_GATE
+ var locale:String = _root.lang + _root.country;
+ var target:String = actToolSignature + app.module + '#' + actToolSignature + app.module + '-' + locale;
+ ApplicationParent.extCall("openURL", url + target);
+ }
+
+ public function get toolActivityWidth():Number{
+ return toolActWidth;
+ }
+
+ public function get toolActivityHeight():Number{
+ return toolActHeight;
+ }
+
+ public function get complexActivityWidth():Number{
+ return complexActWidth;
+ }
+
+ private function setBusy():Void{
+ if(_isBusy){
+ //Debugger.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',1,'checkBusy','org.lamsfoundation.lams.common.util.Hashtable');
+ //Debugger.log('!!!!!!!!!!!!!!!!!!!! HASHTABLE ACCESED WHILE BUSY !!!!!!!!!!!!!!!!',1,'checkBusy','org.lamsfoundation.lams.common.util.Hashtable');
+ //Debugger.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',1,'checkBusy','org.lamsfoundation.lams.common.util.Hashtable');
+ }
+ _isBusy=true;
+ }
+
+ private function clearBusy():Void{
+ _isBusy=false;
+ }
+ /**
+ * Used by application to set the Position
+ * @param x
+ * @param y
+ */
+ public function setPosition(x:Number,y:Number):Void{
+ canvasModel.setPosition(x,y);
+ }
+
+ public function get model():CanvasModel{
+ return getCanvasModel();
+ }
+
+ public function getCanvasModel():CanvasModel{
+ return canvasModel;
+ }
+
+ public function get view():MovieClip{
+ return getCanvasView();
+ }
+
+
+ public function getCanvasView():MovieClip{
+ return canvasView;
+ }
+
+ public function get className():String{
+ return 'Canvas';
+ }
+
+ public function get ddm():DesignDataModel{
+ return _ddm;
+ }
+
+ public function get taWidth():Number{
+ return toolActWidth
+ }
+
+ public function get taHeight():Number{
+ return toolActHeight
+ }
+
+ /*
+ public function getPropertyInspector():MovieClip{
+ return _pi;
+ }
+ */
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get bin ():MovieClip {
+ return _bin;
+ }
+
+
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,602 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.util.ui.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.cv.*;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView;
+import org.lamsfoundation.lams.common.style.*
+import mx.controls.*
+import com.polymercode.Draw;
+import mx.managers.*
+import mx.containers.*;
+import mx.events.*
+import mx.utils.*
+
+/**
+* CanvasActivity -
+*/
+class org.lamsfoundation.lams.authoring.cv.CanvasActivity extends MovieClip implements ICanvasActivity{
+//class org.lamsfoundation.lams.authoring.cv.CanvasActivity extends MovieClip{
+
+ public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
+ public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
+ public static var GATE_ACTIVITY_HEIGHT:Number =28;
+ public static var GATE_ACTIVITY_WIDTH:Number = 28;
+ public static var ICON_WIDTH:Number = 25;
+ public static var ICON_HEIGHT:Number = 25;
+
+ //this is set by the init object
+ private var _canvasController:CanvasController;
+ private var _canvasView:CanvasView;
+ private var _monitorController:MonitorController;
+ private var _monitorView;
+ private var mm:MonitorModel; // used only when called from Monitor Environment
+ private var _canvasModel:CanvasModel;
+ private var _tm:ThemeManager;
+ private var _ccm:CustomContextMenu;
+ //TODO:This should be ToolActivity
+ private var _activity:Activity;
+
+ private var _isSelected:Boolean;
+ private var app:Application;
+
+ private var learnerOffset_X:Number = 4;
+ private var learnerOffset_Y:Number = 3;
+ private var learnerContainer:MovieClip;
+
+ private var _module:String;
+ private var icon_mc:MovieClip;
+ private var icon_mcl:MovieClipLoader;
+ private var bkg_pnl:MovieClip;
+ private var act_pnl:MovieClip;
+ private var title_lbl:MovieClip;
+ private var groupIcon_mc:MovieClip;
+ private var stopSign_mc:MovieClip;
+ private var clickTarget_mc:MovieClip;
+ private var canvasActivity_mc:MovieClip;
+ private var canvasActivityGrouped_mc:MovieClip;
+ private var _dcStartTime:Number = 0;
+ private var _doubleClicking:Boolean;
+ private var _visibleWidth:Number;
+ private var _visibleHeight:Number;
+ private var _base_mc:MovieClip;
+ private var _selected_mc:MovieClip;
+ private var fade_mc:MovieClip;
+ private var bgNegative:String = "original";
+ private var authorMenu:ContextMenu
+
+
+ function CanvasActivity(){
+ //Debugger.log("_activity:"+_activity.title,4,'Constructor','CanvasActivity');
+ _tm = ThemeManager.getInstance();
+ _ccm = CustomContextMenu.getInstance();
+ //Get reference to application and design data model
+ app = Application.getInstance();
+ //let it wait one frame to set up the components.
+ //this has to be set b4 the do later :)
+ if(_activity.isGateActivity()){
+ _visibleHeight = CanvasActivity.GATE_ACTIVITY_HEIGHT;
+ _visibleWidth = CanvasActivity.GATE_ACTIVITY_WIDTH;
+ }else if(_activity.isGroupActivity()){
+ _visibleHeight = CanvasActivity.TOOL_ACTIVITY_HEIGHT;
+ _visibleWidth = CanvasActivity.TOOL_ACTIVITY_WIDTH;
+ }else{
+ _visibleHeight = CanvasActivity.TOOL_ACTIVITY_HEIGHT;
+ _visibleWidth = CanvasActivity.TOOL_ACTIVITY_WIDTH;
+ }
+ _base_mc = this;
+ //call init if we have passed in the _activity as an initObj in the attach movie,
+ //otherwise wait as the class outside will call it
+ if(_activity != undefined){
+ init();
+ }
+
+ }
+
+ public function init(initObj):Void{
+ //clickTarget_mc.onRollOver = Proxy.create (this, localOnRollOver);
+ //clickTarget_mc.onRollOut = Proxy.create (this, localOnRollOut);
+ //clickTarget_mc.onPress = Proxy.create (this, localOnPress);
+ //clickTarget_mc.onRelease = Proxy.create (this, localOnRelease);
+ //clickTarget_mc.onReleaseOutside = Proxy.create (this, localOnReleaseOutside);
+
+ if(initObj){
+ _module = initObj._module;
+ if (_module == "monitoring"){
+ _monitorView = initObj._monitorView;
+ _monitorController = initObj._monitorController;
+ learnerContainer = initObj.learnerContainer;
+ }else {
+ _canvasView = initObj._canvasView;
+ _canvasController = initObj._canvasController;
+ }
+ _activity = initObj.activity;
+ }
+
+ _canvasModel = CanvasModel(_canvasController.getModel());
+ showAssets(false);
+
+ if (_activity.selectActivity == "false"){
+ _isSelected = false;
+ refresh();
+ }
+
+
+ if(!_activity.isGateActivity() && !_activity.isGroupActivity()){
+ loadIcon();
+ }
+ setStyles();
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
+ }
+
+ private function showAssets(isVisible:Boolean){
+ groupIcon_mc._visible = isVisible;
+ title_lbl._visible = isVisible;
+ icon_mc._visible = isVisible;
+ stopSign_mc._visible = isVisible;
+ canvasActivity_mc._visible = isVisible;
+ clickTarget_mc._visible = isVisible;
+ canvasActivityGrouped_mc._visible = isVisible;
+ fade_mc._visible = isVisible;
+ }
+
+ /**
+ * Updates the CanvasActivity display fields with the current data
+ * @usage
+ * @return
+ */
+ public function refresh(setNegative:Boolean):Void{
+ bgNegative = String(setNegative);
+ trace("called from PI")
+ setStyles();
+ draw();
+ setSelected(_isSelected);
+ }
+
+ public function setSelected(isSelected){
+ Debugger.log(_activity.title+" isSelected:"+isSelected,4,'setSelected','CanvasActivity');
+ var MARGIN = 5;
+ if(isSelected){
+ //draw a selected border
+ var tgt_mc;
+ if(_activity.isGateActivity()){
+ tgt_mc = stopSign_mc;
+ }else if(_activity.groupingUIID > 0){
+ tgt_mc = canvasActivityGrouped_mc;
+ }else{
+ tgt_mc = canvasActivity_mc;
+ }
+ Debugger.log("tgt_mc:"+tgt_mc,4,'setSelected','CanvasActivity');
+ //vars
+ var tl_x = tgt_mc._x - MARGIN; //top left x
+ var tl_y = tgt_mc._y - MARGIN; //top left y
+ var tr_x = tgt_mc._x + tgt_mc._width + MARGIN;//top right x
+ var tr_y = tl_y; //top right y
+ var br_x = tr_x; //bottom right x
+ var br_y = tgt_mc._y + tgt_mc._height + MARGIN;//bottom right y
+ var bl_x = tl_x; //biottom left x
+ var bl_y = br_y; //bottom left y
+
+ if(_selected_mc){
+ _selected_mc.removeMovieClip();
+ }
+ _selected_mc = _base_mc.createEmptyMovieClip('_selected_mc',_base_mc.getNextHighestDepth());
+
+ var dashStyle:mx.styles.CSSStyleDeclaration = _tm.getStyleObject("CAHighlightBorder");
+ var color:Number = dashStyle.getStyle("color");
+
+ Draw.dashTo(_selected_mc,tl_x,tl_y,tr_x,tr_y,2,3,2,color);
+ Draw.dashTo(_selected_mc,tr_x,tr_y,br_x,br_y,2,3,2,color);
+ Draw.dashTo(_selected_mc,br_x,br_y,bl_x,bl_y,2,3,2,color);
+ Draw.dashTo(_selected_mc,bl_x,bl_y,tl_x,tl_y,2,3,2,color);
+
+ _isSelected = isSelected;
+
+ }else{
+ //hide the selected border
+ _selected_mc.removeMovieClip();
+ }
+
+ }
+
+
+ private function loadIcon():Void{
+ icon_mc = this.createEmptyMovieClip("icon_mc", this.getNextHighestDepth());
+ var ml = new MovieLoader(Config.getInstance().serverUrl+_activity.libraryActivityUIImage,setUpActIcon,this,icon_mc);
+
+ // swap depths if transparent layer visible
+ if(fade_mc._visible) {
+ icon_mc.swapDepths(fade_mc);
+ }
+ }
+
+ private function setUpActIcon(icon_mc):Void{
+ icon_mc._x = (CanvasActivity.TOOL_ACTIVITY_WIDTH / 2) - (icon_mc._width / 2);
+ icon_mc._y = (CanvasActivity.TOOL_ACTIVITY_HEIGHT / 2) - (icon_mc._height / 2) - 6;
+ }
+
+ private function drawLearners():Void {
+ mm = MonitorModel(_monitorController.getModel());
+
+ var learner_X = _activity.xCoord + learnerOffset_X;
+ var learner_Y = _activity.yCoord + learnerOffset_Y;
+ var parentAct:Activity = mm.getMonitor().ddm.getActivityByUIID(_activity.parentUIID)
+
+ var xCoord = _activity.xCoord;
+
+ if (_activity.parentUIID != null) {
+ xCoord = parentAct.xCoord;
+
+ if(parentAct.activityTypeID != Activity.PARALLEL_ACTIVITY_TYPE){
+ xCoord = parentAct.xCoord + _activity.xCoord;
+ learner_X = (learner_X != null) ? learner_X + parentAct.xCoord : null;
+ learner_Y = learner_Y + parentAct.yCoord;
+ }
+
+ }
+
+ // get the length of learners from the Monitor Model and run a for loop.
+ for (var j=0; j (xCoord + 112)) {
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), learnerContainer.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:true });
+ return;
+ }
+
+ // attach icon
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), learnerContainer.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:false });
+
+ // space icons
+ learner_X += 10;
+ }
+ }
+ }
+
+ /**
+ * Add + icon to indicate that more users are currently at the Activity.
+ * We are unable to display all the users across the Activity's panel.
+ *
+ * @usage
+ * @param target The target reference, this class OR a parent
+ * @param x_pos The X position of the icon
+ * @return
+ */
+
+
+ /**
+ * Does the work of laying out the screen assets.
+ * Depending on type of Activity different bits will be shown
+ * @usage
+ * @return
+ */
+ private function draw(){
+
+ // Drawing learner on the activty.
+ if(_module == "monitoring")
+ drawLearners();
+
+ Debugger.log(_activity.title+',_activity.isGateActivity():'+_activity.isGateActivity(),4,'draw','CanvasActivity');
+ setStyles();
+
+ var theIcon_mc:MovieClip;
+ title_lbl._visible = true;
+ clickTarget_mc._visible = true;
+ fade_mc._visible = false;
+
+ Debugger.log("Edit lock: " + app.canvas.ddm.editOverrideLock, Debugger.CRITICAL, 'draw', 'CanvasActivity');
+ Debugger.log("Read only: " + _activity.isReadOnly(), Debugger.CRITICAL, 'draw', 'CanvasActivity');
+
+ if(_activity.isReadOnly() && app.canvas.ddm.editOverrideLock == 1){
+ Debugger.log("Making transparent layer visible. ", Debugger.CRITICAL, 'draw', 'CanvasActivity');
+ fade_mc._visible = true;
+ }
+
+ if(_activity.isGateActivity()){
+ stopSign_mc._visible = true;
+ stopSign_mc._x = 0;
+ stopSign_mc._y = 0;
+
+
+ } else {
+
+ //chose the icon:
+ if(_activity.isGroupActivity()){
+ groupIcon_mc._visible = true;
+ icon_mc._visible = false;
+ theIcon_mc = groupIcon_mc;
+ }else{
+ groupIcon_mc._visible = false;
+ icon_mc._visible = true;
+ theIcon_mc = icon_mc;
+ }
+
+ /*
+ * some bug here - size always reported as 0x0 and wehn set to ICON_WIDTH it stays at 0, so maybe icon is still loading...
+ trace(theIcon_mc._width+'x'+theIcon_mc._height );
+ theIcon_mc._width = CanvasActivity.ICON_WIDTH;
+ theIcon_mc._height = CanvasActivity.ICON_HEIGHT;
+ trace('CanvasActivity.ICON_HEIGHT:'+CanvasActivity.ICON_HEIGHT);
+ trace('ICON_HEIGHT:'+ICON_HEIGHT);
+ trace(theIcon_mc._width+'x'+theIcon_mc._height );
+ */
+
+ theIcon_mc._visible = true;
+
+ //chose the background mc
+ if(_activity.groupingUIID > 0){
+ canvasActivityGrouped_mc._visible = true;
+ canvasActivity_mc._visible=false;
+ }else{
+ canvasActivity_mc._visible=true;
+ canvasActivityGrouped_mc._visible = false;
+ }
+
+ title_lbl.visible=true;
+ //clickTarget_mc._visible=true;
+ stopSign_mc._visible = false;
+
+ //write text
+ title_lbl.text = _activity.title;
+
+ clickTarget_mc._width = TOOL_ACTIVITY_WIDTH;
+ clickTarget_mc._height= TOOL_ACTIVITY_HEIGHT;
+
+ }
+
+ //position
+ _x = _activity.xCoord //- (clickTarget_mc._width/2);
+ _y = _activity.yCoord //- (clickTarget_mc._height/2);
+
+ Debugger.log('canvasActivity_mc._visible'+canvasActivity_mc._visible,4,'draw','CanvasActivity');
+ _visible = true;
+ if (_activity.runOffline){
+ bgNegative = "true"
+ setStyles();
+ }
+ }
+
+
+ private function onRollOver():Void{
+ if (_module == "monitoring"){
+ _ccm.showCustomCM(_ccm.loadMenu("activity", "monitoring"))
+ }else {
+ _ccm.showCustomCM(_ccm.loadMenu("activity", "authoring"))
+ }
+ }
+
+ private function onRollOut():Void{
+ if (_module == "monitoring"){
+ _ccm.showCustomCM(_ccm.loadMenu("canvas", "monitoring"))
+ }else {
+ _ccm.showCustomCM(_ccm.loadMenu("canvas", "authoring"))
+ }
+ }
+
+ private function onPress():Void{
+
+
+ // check double-click
+ var now:Number = new Date().getTime();
+
+ if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
+ trace("Module passed is: "+_module)
+ if (app.controlKeyPressed != "transition"){
+ _doubleClicking = true;
+ if (_module == "monitoring"){
+ Debugger.log('DoubleClicking: '+this.activity.activityID,Debugger.GEN,'onPress','CanvasActivity For Monitoring');
+ _monitorController.activityDoubleClick(this, "MonitorTabView");
+ }else {
+ Debugger.log('DoubleClicking: '+this,Debugger.CRITICAL,'onPress','CanvasActivity');
+ _canvasController.activityDoubleClick(this);
+ }
+ }
+ app.controlKeyPressed = "";
+
+ }else{
+
+ _doubleClicking = false;
+
+ //Debugger.log('_canvasController:'+_canvasController,Debugger.GEN,'onPress','CanvasActivity');
+ if (_module == "monitoring"){
+ Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','CanvasActivity for monitoring');
+ _monitorController.activityClick(this);
+ }else {
+ Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','CanvasActivity');
+ _canvasController.activityClick(this);
+ }
+
+ }
+
+ _dcStartTime = now;
+
+ }
+
+ private function onRelease():Void{
+ if(!_doubleClicking){
+ Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','CanvasActivity');
+ trace("Activity ID is: "+this.activity.activityUIID)
+ if (_module == "monitoring"){
+ _monitorController.activityRelease(this);
+ }else {
+ _canvasController.activityRelease(this);
+ }
+ }
+
+ }
+
+ private function onReleaseOutside():Void{
+ Debugger.log('ReleasingOutside:'+this,Debugger.GEN,'onReleaseOutside','CanvasActivity');
+ if (_module == "monitoring"){
+ _monitorController.activityReleaseOutside(this);
+ }else {
+ _canvasController.activityReleaseOutside(this);
+ }
+ }
+
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleWidth ():Number {
+ return _visibleWidth;
+ }
+
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleHeight ():Number {
+ return _visibleHeight;
+ }
+
+
+ public function set isSetSelected(v:Boolean):Void{
+ _isSelected = v;
+ }
+
+ public function get activity():Activity{
+ return getActivity();
+ }
+
+ public function set activity(a:Activity){
+ setActivity(a);
+ }
+
+
+ public function getActivity():Activity{
+ return _activity;
+
+ }
+
+ public function setActivity(a:Activity){
+ _activity = a;
+ }
+
+
+ private function getAssociatedStyle():Object{
+ trace("Category ID for Activity "+_activity.title +": "+_activity.activityCategoryID)
+ var styleObj:Object = new Object();
+
+ if(_root.actColour == "true") {
+ switch (String(_activity.activityCategoryID)){
+ case '0' :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ break;
+ case '1' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '2' :
+ styleObj = _tm.getStyleObject('ACTPanel2')
+ break;
+ case '3' :
+ styleObj = _tm.getStyleObject('ACTPanel5')
+ break;
+ case '4' :
+ styleObj = _tm.getStyleObject('ACTPanel4')
+ break;
+ case '5' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '6' :
+ styleObj = _tm.getStyleObject('ACTPanel3')
+ break;
+ default :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ }
+ } else {
+ styleObj = _tm.getStyleObject('ACTPanel');
+ }
+
+ return styleObj;
+ }
+
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and applies them
+ * directly to the instanced
+ * @usage
+ * @return
+ */
+
+
+ private function setStyles() {
+ var my_color:Color = new Color(this);
+ var styleObj;
+
+ var transNegative = {ra:-100, ga:-100, ba:-100, rb:255, gb:255, bb:255};
+ var transPositive = {ra:100, ga:100, ba:100, rb:0, gb:0, bb:0};
+ styleObj = _tm.getStyleObject('CALabel');
+ title_lbl.setStyle('styleName',styleObj);
+ title_lbl.setStyle("textAlign", "center")
+ if (bgNegative == "true"){
+ my_color.setTransform(transNegative);
+ }else if(bgNegative == "false"){
+ my_color.setTransform(transPositive);
+ }else if(bgNegative == "original"){
+
+ if (this.activity.parentUIID != null || this.activity.parentUIID != undefined){
+ if (_module != "monitoring"){
+ var parentAct = _canvasModel.getCanvas().ddm.getActivityByUIID(this.activity.parentUIID)
+ }else {
+ var parentAct = mm.getMonitor().ddm.getActivityByUIID(this.activity.parentUIID)
+ }
+ //if(parentAct.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE){
+ //trace("called by view")
+ //styleObj = _tm.getStyleObject('ACTPanel1')
+ //act_pnl.setStyle('styleName',styleObj);
+ //}else {
+
+ styleObj = getAssociatedStyle() //_tm.getStyleObject('ACTPanel')
+ act_pnl.setStyle('styleName',styleObj);
+ //}
+ } else {
+ styleObj = getAssociatedStyle() //_tm.getStyleObject('ACTPanel')
+ act_pnl.setStyle('styleName',styleObj);
+ }
+
+ }
+
+ }
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasController.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasController.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasController.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,554 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.*
+import org.lamsfoundation.lams.authoring.cv.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.dict.*
+import com.polymercode.Draw;
+import mx.utils.*
+
+
+/*
+* Makes changes to the Canvas Authoring model's data based on user input.
+*/
+class org.lamsfoundation.lams.authoring.cv.CanvasController extends AbstractController {
+
+ private var _canvasModel:CanvasModel;
+ private var _canvasView:CanvasView;
+ private var _pi:PropertyInspectorNew;
+ private var app:Application;
+ private var _isBusy:Boolean;
+
+ /**
+ * Constructor
+ *
+ * @param cm The model to modify.
+ */
+ public function CanvasController (cm:Observable) {
+ super (cm);
+ //have to do an upcast
+ _canvasModel = CanvasModel(getModel());
+ _canvasView = CanvasView(getView());
+ _pi = new PropertyInspectorNew();
+ app = Application.getInstance();
+ _isBusy = false;
+ }
+
+ public function activityClick(ca:Object):Void{
+ _canvasModel.selectedItem = null;
+ Debugger.log('activityClick CanvasActivity:'+ca.activity.activityUIID + ' orderID: ' + ca.activity.orderID,Debugger.GEN,'activityClick','CanvasController');
+ Debugger.log('Check if transition tool active :'+_canvasModel.isTransitionToolActive(),Debugger.GEN,'activityClick','CanvasController');
+ //if transition tool active
+ if(_canvasModel.isTransitionToolActive()){
+
+ var transitionTarget = createValidTransitionTarget(ca, true);
+ if(transitionTarget instanceof LFError){
+ transitionTarget.showErrorAlert(null);
+ }else{
+ _canvasModel.addActivityToTransition(transitionTarget);
+ _canvasModel.getCanvas().view.initDrawTempTrans();
+ }
+
+ }else{
+
+ //just select the activity
+
+ var parentAct = _canvasModel.getCanvas().ddm.getActivityByUIID(ca.activity.parentUIID)
+
+ if(ca.activity.parentUIID != null && parentAct.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE){
+
+ // _canvasModel.selectedItem = ca;
+ _canvasModel.isDragging = false;
+ } else {
+ //_canvasModel.selectedItem = ca;
+ _canvasModel.isDragging = true;
+ ca.startDrag(false);
+ }
+ }
+
+ }
+
+ public function clearAllSelections(optionalOnCanvas:Array, parallelOnCanvas:Array){
+ for (var i=0; i 142 || ca._x < -129 || ca._y < -55 || ca._y > optionalOnCanvas[i].getpanelHeight){
+ trace (ca.activity.activityUIID+" had a hitTest with canvas.")
+ //give it the new co-ords and 'drop' it
+
+ ca.activity.xCoord = (_xmouse - _canvasModel.getPosition().x) - (_canvasModel.getCanvas().taWidth/2);
+ ca.activity.yCoord = (_ymouse - _canvasModel.getPosition().y) - (_canvasModel.getCanvas().taHeight/2);
+ _canvasModel.removeOptionalCA(ca, optionalOnCanvas[i].activity.activityUIID);
+ } else {
+ activitySnapBack(ca);
+ }
+ }
+ }
+ }
+
+ } else {
+
+ //if we are on the optional Activity remove this activity from canvas and assign it a parentID of optional activity and place it in the optional activity window.
+ for (var i=0; i= 2){
+ //TODO: show an error
+ return new LFError("Too many activities in the Transition","addActivityToTransition",this);
+ }
+
+ Debugger.log('Adding Activity.UIID:'+activity.activityUIID,Debugger.GEN,'addActivityToTransition','CanvasModel');
+ _transitionActivities.push(activity);
+ var fromAct = _transitionActivities[0].activityUIID
+ var toAct = _transitionActivities[1].activityUIID
+ if(_transitionActivities.length == 2){
+ //check we have 2 valid acts to create the transition.
+ if(fromAct == toAct){
+ return new LFError("You cannot create a Transition between the same Activities","addActivityToTransition",this);
+ }
+ if(!_cv.ddm.activities.containsKey(fromAct)){
+ return new LFError("First activity of the Transition is missing, UIID:"+_transitionActivities[0].activityUIID,"addActivityToTransition",this);
+ }
+ if(!_cv.ddm.activities.containsKey(toAct)){
+ return new LFError(Dictionary.getValue('cv_trans_target_act_missing'),"addActivityToTransition",this);
+ }
+ //check there is not already a transition to or from this activity:
+ var transitionsArray:Array = _cv.ddm.transitions.values();
+
+ /**/
+ for(var i=0;i 0 || ddm_activity.parentUIID > 0){
+ return r = "CHILD";
+ }
+
+ //if they are the same (ref should point to same act) then nothing to do.
+ //if the ddm does not have an act displayed then we need to remove it from the cm
+ //if the ddm has an act that cm does not ref, then we need to add it.
+
+ if(ddm_activity === cm_activity){
+ return r = "SAME";
+ }
+
+ //check for a new act in the dmm
+ if(cm_activity == null || cm_activity == undefined){
+ return r = "NEW";
+ }
+
+ //check if act has been removed from canvas
+ if(ddm_activity == null || ddm_activity == undefined){
+ return r = "DELETE";
+ }
+
+
+ }
+
+ /**
+ * Compares 2 transitions, decides if they are new, the same or to be deleted
+ * @usage
+ * @param ddm_transition
+ * @param cm_transition
+ * @return
+ */
+ private function compareTransitions(ddm_transition:Transition, cm_transition:Transition):Object{
+ Debugger.log('Comparing ddm_activity:'+ddm_transition.title+'('+ddm_transition.transitionUIID+') WITH cm_transition:'+cm_transition.title+'('+cm_transition.transitionUIID+')',Debugger.GEN,'compareTransitions','CanvasModel');
+ var r:Object = new Object();
+ if(ddm_transition === cm_transition){
+ return r = "SAME";
+ }
+
+ //check for a new act in the dmm
+ if(cm_transition == null){
+ return r = "NEW";
+ }
+
+ //check if act has been removed from canvas
+ if(ddm_transition == null){
+ return r = "DELETE";
+ }
+
+
+ }
+
+ /**
+ * Compares the design in the CanvasModel (what is displayed on the screen)
+ * against the design in the DesignDataModel and updates the Canvas Model accordingly.
+ * NOTE: Design elements are added to the DDM here, but removed in the View
+ *
+ * @usage
+ * @return
+ */
+ private function refreshDesign(){
+
+ //porobbably need to get a bit more granular
+ Debugger.log('Running',Debugger.GEN,'refreshDesign','CanvasModel');
+ //go through the design and see what has changed, compare DDM to canvasModel
+ var ddmActivity_keys:Array = _cv.ddm.activities.keys();
+ Debugger.log('ddmActivity_keys.length:'+ddmActivity_keys.length,Debugger.GEN,'refreshDesign','CanvasModel');
+ //Debugger.log('ddmActivity_keys::'+ddmActivity_keys.toString(),Debugger.GEN,'refreshDesign','CanvasModel');
+ var cmActivity_keys:Array = _activitiesDisplayed.keys();
+ Debugger.log('cmActivity_keys.length:'+cmActivity_keys.length,Debugger.GEN,'refreshDesign','CanvasModel');
+ //Debugger.log('cmActivity_keys:'+cmActivity_keys.toString(),Debugger.GEN,'refreshDesign','CanvasModel');
+
+
+
+ var longest = Math.max(ddmActivity_keys.length, cmActivity_keys.length);
+
+ //chose which array we are going to loop over
+ var indexArray:Array;
+
+ if(ddmActivity_keys.length == longest){
+ indexArray = ddmActivity_keys;
+ }else{
+ indexArray = cmActivity_keys;
+ }
+
+
+ //loop through and do comparison
+ for(var i=0;i 0) {
+ if (noInputTransition.length == 0) {
+ errorMap.push(new ValidationIssue(ValidationIssue.INPUT_TRANSITION_ERROR_CODE, Dictionary.getValue(ValidationIssue.INPUT_TRANSITION_ERROR_TYPE2_KEY)));
+ } else if (noInputTransition.length > 1) {
+ //there is more than one activity with no input transitions
+ for(var i=0; i 1) {
+ //there is more than one activity with no output transitions
+ for(var i=0; i 1) {
+ if(actTransitions.into == null && actTransitions.out == null)
+ errorMap.push(new ValidationIssue(ValidationIssue.ACTIVITY_TRANSITION_ERROR_CODE, Dictionary.getValue(ValidationIssue.ACTIVITY_TRANSITION_ERROR_KEY), activity.activityUIID));
+
+ } else if(noOfActivities == 1) {
+ if(actTransitions.into != null || actTransitions.out != null)
+ errorMap.push(new ValidationIssue(ValidationIssue.ACTIVITY_TRANSITION_ERROR_CODE, Dictionary.getValue(ValidationIssue.ACTIVITY_TRANSITION_ERROR_KEY), activity.activityUIID));
+ }
+
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////// EDITING ACTIVITIES /////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Called on double clicking an activity
+ * @usage
+ * @return
+ */
+ public function openToolActivityContent(ta:ToolActivity):Void{
+ trace("tool content Id for "+ta.title+" is: "+ta.toolContentID)
+ Debugger.log('ta:'+ta.title+'toolContentID:'+ta.toolContentID+" and learningLibraryID: "+ta.learningLibraryID,Debugger.GEN,'openToolActivityContent','CanvasModel');
+ //check if we have a toolContentID
+
+ var defaultContentID:Number = Application.getInstance().getToolkit().getDefaultContentID(ta.toolContentID,ta.toolID);
+ Debugger.log('ta:'+ta.title+'toolContentID:'+ta.toolContentID+', default content ID:'+defaultContentID,Debugger.GEN,'openToolActivityContent','CanvasModel');
+ if(ta.toolContentID == defaultContentID){
+ getNewToolContentID(ta);
+ }else{
+
+ //if we have a good toolID lets open it
+ if(ta.toolContentID > 0){
+ var url:String;
+ var cfg = Config.getInstance();
+ var ddm = _cv.ddm;
+ if(ta.authoringURL.indexOf("?") != -1){
+ //09-11-05 Change to toolContentID and remove userID.
+ //url = cfg.serverUrl+ta.authoringURL + '&toolContentId='+ta.toolContentID+'&userID='+cfg.userID;
+ url = cfg.serverUrl+ta.authoringURL + '&toolContentID='+ta.toolContentID+'&contentFolderID='+ddm.contentFolderID;
+ }else{
+ //url = cfg.serverUrl+ta.authoringURL + '?toolContentId='+ta.toolContentID+'&userID='+cfg.userID;
+ url = cfg.serverUrl+ta.authoringURL + '?toolContentID='+ta.toolContentID+'&contentFolderID='+ddm.contentFolderID;
+ }
+
+ Debugger.log('Opening url:'+url,Debugger.GEN,'openToolActivityContent','CanvasModel');
+
+ JsPopup.getInstance().launchPopupWindow(url, 'ToolActivityContent', 600, 800, true, true, false, false, false);
+
+ // set modified (not-saved) flag so that potential changes cannot be lost.
+ ApplicationParent.extCall('setSaved', 'false');
+
+ }else{
+ new LFError("We dont have a valid toolContentID","openToolActivityContent",this);
+ }
+
+ }
+
+
+
+
+ }
+
+ public function getNewToolContentID(ta:ToolActivity):Void{
+ Debugger.log('ta:'+ta.title+', activityUIID:'+ta.activityUIID,Debugger.GEN,'getNewToolContentID','CanvasModel');
+ var callback:Function = Proxy.create(this,setNewToolContentID,ta);
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getToolContentID&toolID='+ta.toolID,callback, false);
+ }
+
+ public function setNewToolContentID(toolContentID:Number,ta:ToolActivity):Void{
+ Debugger.log('new content ID from server:'+toolContentID,Debugger.GEN,'setNewToolContentID','CanvasModel');
+ ta.toolContentID = toolContentID;
+ Debugger.log('ta:'+ta.title+',toolContentID:'+ta.toolContentID+', activityUIID:'+ta.activityUIID,Debugger.GEN,'setNewToolContentID','CanvasModel');
+ openToolActivityContent(ta);
+ }
+
+ public function setDefaultToolContentID(ta:ToolActivity):Void{
+ ta.toolContentID = Application.getInstance().getToolkit().getDefaultContentID(ta.toolContentID,ta.toolID);
+ Debugger.log('ta:'+ta.title+',toolContentID:'+ta.toolContentID+', activityUIID:'+ta.activityUIID,Debugger.GEN,'setDefaultToolContentID','CanvasModel');
+ }
+
+
+
+ /**
+ * Notify registered listeners that a data model change has happened
+ */
+ public function broadcastViewUpdate(_updateType,_data){
+ dispatchEvent({type:'viewUpdate',target:this,updateType:_updateType,data:_data});
+ trace('broadcast');
+ }
+
+
+
+ /**
+ * Returns a reference to the Activity Movieclip for the UIID passed in. Gets from _activitiesDisplayed Hashable
+ * @usage
+ * @param UIID
+ * @return Activity Movie clip
+ */
+ public function getActivityMCByUIID(UIID:Number):MovieClip{
+
+ var a_mc:MovieClip = _activitiesDisplayed.get(UIID);
+ //Debugger.log('UIID:'+UIID+'='+a_mc,Debugger.GEN,'getActivityMCByUIID','CanvasModel');
+ return a_mc;
+ }
+ /*
+ public function setContainerRef(c:Canvas):Void{
+ _cv = c;
+ }
+
+ */
+ //Getters n setters
+
+ public function getCanvas():Canvas{
+ return _cv;
+ }
+
+ public function get activitiesDisplayed():Hashtable{
+ return _activitiesDisplayed;
+ }
+
+ public function get transitionsDisplayed():Hashtable{
+ return _transitionsDisplayed;
+ }
+
+ public function get isDrawingTransition():Boolean{
+ return _isDrawingTransition;
+ }
+ /**
+ *
+ * @usage
+ * @param newactivetool
+ * @return
+ */
+ public function set activeTool (newactivetool:String):Void {
+ _activeTool = newactivetool;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newactivetool
+ * @return
+ */
+ public function setActiveTool (newactivetool):Void {
+ _activeTool = newactivetool;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get activeTool ():String {
+ return _activeTool;
+ }
+
+ private function setSelectedItem(newselectItem:Object){
+ prevSelectedItem = _selectedItem;
+ _selectedItem = newselectItem;
+ broadcastViewUpdate("SELECTED_ITEM");
+ }
+
+ public function setSelectedItemByUIID(uiid:Number){
+ var selectedCanvasElement;
+ if(_activitiesDisplayed.get(uiid) != null){
+ selectedCanvasElement = _activitiesDisplayed.get(uiid);
+ }else{
+ selectedCanvasElement = _transitionsDisplayed.get(uiid);
+ }
+ setSelectedItem(selectedCanvasElement);
+
+ }
+ /**
+ *
+ * @usage
+ * @param newselectItem
+ * @return
+ */
+ public function set selectedItem (newselectItem:Object):Void {
+ setSelectedItem(newselectItem);
+ }
+
+ public function set prevSelectedItem (oldselectItem:Object):Void {
+ _prevSelectedItem = oldselectItem;
+ }
+
+ public function get prevSelectedItem():Object {
+ return _prevSelectedItem;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get selectedItem ():Object {
+ return _selectedItem;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get isDragging ():Boolean {
+ return _isDragging;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function set isDragging (newisDragging:Boolean):Void{
+ _isDragging = newisDragging;
+ }
+
+ public function get importing():Boolean {
+ return _importing;
+ }
+
+ public function set importing(importing:Boolean):Void {
+ _importing = importing;
+ }
+
+ public function get editing():Boolean {
+ return _editing;
+ }
+
+ public function set editing(editing:Boolean):Void {
+ _editing = editing;
+ }
+
+ public function get autoSaveWait():Boolean {
+ return _autoSaveWait;
+ }
+
+ public function set autoSaveWait(autoSaveWait:Boolean):Void {
+ _autoSaveWait = autoSaveWait;
+ }
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasOptionalActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasOptionalActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasOptionalActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,371 @@
+ /***************************************************************************
+* 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
+* ************************************************************************
+*/
+import org.lamsfoundation.lams.common. *;
+import org.lamsfoundation.lams.common.util. *;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.ui. *;
+import org.lamsfoundation.lams.authoring. *;
+import org.lamsfoundation.lams.authoring.cv. *;
+import org.lamsfoundation.lams.monitoring.mv. *;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+//import org.lamsfoundation.lams.authoring.cv.DesignDataModel;
+import org.lamsfoundation.lams.common.style. *;
+import mx.controls. *;
+import mx.managers. *
+/**
+* CanvasOptionalActivity
+* This is the UI / view representation of a complex (Optional) activity
+*/
+class org.lamsfoundation.lams.authoring.cv.CanvasOptionalActivity extends MovieClip implements ICanvasActivity{
+
+ private var CHILD_OFFSET_X : Number = 8;
+ private var CHILD_OFFSET_Y : Number = 57;
+ private var CHILD_INCRE : Number = 60;
+
+ private var newContainerXCoord:Number;
+ private var newContainerYCoord:Number;
+
+ private var learnerOffset_X:Number = 4;
+ private var learnerOffset_Y:Number = 3;
+ private var learnerContainer:MovieClip;
+
+ //this is set by the init object
+ private var _canvasController : CanvasController;
+ private var _canvasView : CanvasView;
+ private var _monitorController : MonitorController;
+ private var _monitorTabView : MonitorTabView;
+ private var _ca = ComplexActivity;
+ //Set by the init obj
+ private var _activity : Activity;
+ private var _children : Array;
+ private var children_mc : Array
+ private var panelHeight : Number;
+ private var actMinOptions: Number;
+ private var actMaxOptions: Number;
+ //refs to screen items:
+ private var container_pnl : Panel;
+ private var header_pnl : Panel;
+ private var act_pnl : Panel;
+ private var title_lbl : Label;
+ private var actCount_lbl : Label;
+ //locals
+ private var childActivities_mc : MovieClip;
+ private var optionalActivity_mc : MovieClip;
+ private var clickTarget_mc : MovieClip;
+ private var padlockClosed_mc : MovieClip;
+ private var padlockOpen_mc : MovieClip;
+ private var _dcStartTime : Number = 0;
+ private var _doubleClicking : Boolean;
+ // Only for Monitor Optional Container children
+ private var fromModuleTab:String;
+ private var learner:Object = new Object();
+ private var containerPanelHeader:MovieClip;
+ private var completed_mc:MovieClip;
+ private var current_mc:MovieClip;
+ private var todo_mc:MovieClip;
+ //---------------------------//
+ private var child_mc : MovieClip;
+ private var _locked : Boolean = false;
+ private var _visibleHeight : Number;
+ private var _visibleWidth : Number;
+ private var _tm : ThemeManager;
+ private var _ddm : DesignDataModel;
+ private var _dictionary:Dictionary;
+
+ function CanvasOptionalActivity () {
+ optionalActivity_mc = this
+ _ddm = new DesignDataModel ();
+
+ _visible = false;
+ _tm = ThemeManager.getInstance ();
+ _dictionary = Dictionary.getInstance();
+ _visibleHeight = container_pnl._height;
+ _visibleWidth = container_pnl._width;
+ _ca = new ComplexActivity(_activity.activityUIID)
+ _activity.activityCategoryID = Activity.CATEGORY_SYSTEM;
+
+ MovieClipUtils.doLater (Proxy.create (this, init));
+ }
+
+ public function init():Void {
+ clickTarget_mc.onPress = Proxy.create (this, localOnPress);
+ clickTarget_mc.onRelease = Proxy.create (this, localOnRelease);
+ clickTarget_mc.onReleaseOutside = Proxy.create (this, localOnReleaseOutside);
+
+ actMinOptions = _ca.minOptions;
+ actMaxOptions = _ca.maxOptions;
+
+ _ddm.getComplexActivityChildren(_activity.activityUIID);
+ showStatus(false);
+
+ CHILD_OFFSET_X = 8;
+ CHILD_OFFSET_Y = 57;
+
+ for (var j=0; j (_activity.xCoord + 112)){
+ learner_X = _activity.xCoord + learnerOffset_X
+ learner_Y = 27
+ hasPlus = true;
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), learnerContainer.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus });
+ return;
+ }
+
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), learnerContainer.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus});
+ learner_X = learner_X+10
+ }
+ }
+ }
+
+
+ private function draw (){
+
+ //clickTarget_mc.swapDepths(childActivities_mc.getNextHighestDepth());
+ var numOfChildren = _children.length
+ panelHeight = CHILD_OFFSET_Y + (numOfChildren * CHILD_INCRE);
+ setStyles ()
+ //write text
+ title_lbl.text = _activity.title //Dictionary.getValue('opt_activity_title'); //'Optional Activities'
+ //_activity.title = 'Optional Activities';
+ actCount_lbl.text = _children.length +" - "+ Dictionary.getValue('lbl_num_activities'); //" activities";
+
+ //position the container (this)
+ if(numOfChildren > 1){
+ container_pnl._height = CHILD_OFFSET_Y + (numOfChildren * CHILD_INCRE);
+ }
+
+ _x = _activity.xCoord;
+ _y = _activity.yCoord;
+
+ //dimentions of container (this)
+ setLocking();
+
+ if(fromModuleTab == "monitorMonitorTab")
+ drawLearners();
+
+ Debugger.log ("I am in Draw :" + _activity.title + 'uiID:' + _activity.activityUIID + ' children:' + _children.length, Debugger.GEN, 'Draw', 'CanvasOptionalActivity');
+ _visible = true;
+ //child1_mc._visible = true;
+ }
+
+ private function setLocking():Void{
+ if (_locked){
+ padlockClosed_mc._visible = true;
+ padlockOpen_mc._visible = false;
+ clickTarget_mc._height = container_pnl._height;
+ }else{
+ padlockOpen_mc._visible = true;
+ padlockClosed_mc._visible = false;
+ clickTarget_mc._height = 45;
+ }
+ }
+
+ public function set locked(setLock:Boolean):Void {
+ _locked = setLock;
+ setLocking();
+
+ }
+
+ public function get locked():Boolean {
+ return _locked;
+ }
+
+ private function localOnPress ():Void{
+
+ // check double-click
+ var now : Number = new Date ().getTime ();
+ if ((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY) {
+ Debugger.log ('DoubleClicking:' + this, Debugger.GEN, 'localOnPress', 'CanvasOptionalActivity');
+ _doubleClicking = true;
+ //if we double click on the glass mask - then open the container to allow the usr to see the activities inside.
+ if (_locked && !(_activity.isReadOnly() && (fromModuleTab == null || fromModuleTab == undefined))) {
+ _locked = false;
+ }else {
+ if(_activity.isReadOnly() && (fromModuleTab == null || fromModuleTab == undefined)) {
+ /** TODO: Change label warning */
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_dbclick_readonly'));
+ }
+ _locked = true;
+ }
+ draw();
+ }else {
+ Debugger.log ('SingleClicking:+' + this, Debugger.GEN, 'localOnPress', 'CanvasOptionalActivity');
+ _doubleClicking = false;
+ _canvasController.activityClick (this);
+ }
+ _dcStartTime = now;
+ }
+
+
+ private function localOnRelease ():Void{
+ Debugger.log ('_doubleClicking:' + _doubleClicking + ', localOnRelease:' + this, Debugger.GEN, 'localOnRelease', 'CanvasOptionalActivity');
+ if (! _doubleClicking) {
+ _canvasController.activityRelease (this);
+ }
+ }
+
+
+ private function localOnReleaseOutside():Void {
+ Debugger.log ('localOnReleaseOutside:' + this, Debugger.GEN, 'localOnReleaseOutside', 'CanvasOptionalActivity');
+ _canvasController.activityReleaseOutside (this);
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleWidth():Number {
+ return _visibleWidth;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleHeight():Number {
+ return _visibleHeight;
+ }
+
+ public function get actChildren():Array {
+ return _children;
+ }
+
+ public function get children():Array {
+ return children_mc;
+ }
+
+ public function get getpanelHeight():Number {
+ return panelHeight;
+ }
+
+ private function getAssociatedStyle():Object{
+ trace("Category ID for Activity "+_activity.title +": "+_activity.activityCategoryID)
+ var styleObj:Object = new Object();
+ switch (String(_activity.activityCategoryID)){
+ case '0' :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ break;
+ case '1' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '2' :
+ styleObj = _tm.getStyleObject('ACTPanel2')
+ break;
+ case '3' :
+ styleObj = _tm.getStyleObject('ACTPanel5')
+ break;
+ case '4' :
+ styleObj = _tm.getStyleObject('ACTPanel4')
+ break;
+ case '5' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '6' :
+ styleObj = _tm.getStyleObject('ACTPanel3')
+ break;
+ default :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ }
+ return styleObj;
+ }
+
+ private function setStyles():Void {
+ var styleObj = _tm.getStyleObject ('label');
+ title_lbl.setStyle (styleObj);
+ styleObj = _tm.getStyleObject ('PIlabel');
+ actCount_lbl.setStyle ('styleName', styleObj);
+ styleObj = _tm.getStyleObject ('OptHeadPanel');
+ header_pnl.setStyle ('styleName', styleObj);
+ //styleObj = _tm.getStyleObject ('OptActContainerPanel');
+ styleObj = getAssociatedStyle();
+ container_pnl.setStyle ('styleName', styleObj);
+ }
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasParallelActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasParallelActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasParallelActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,370 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.cv.*;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+import org.lamsfoundation.lams.common.style.*;
+import mx.controls.*;
+import mx.managers.*
+
+
+/**
+* CanvasParallelActivity
+* This is the UI / view representation of a complex (parralel) activity
+*/
+class org.lamsfoundation.lams.authoring.cv.CanvasParallelActivity extends MovieClip implements ICanvasActivity{
+
+ private var CHILD_OFFSET_X:Number = 8;
+ private var CHILD1_OFFSET_Y:Number = 45 //67.5;
+ private var CHILD2_OFFSET_Y:Number = 108 //130.5;
+
+ private var newContainerXCoord:Number;
+ private var newContainerYCoord:Number;
+
+ //this is set by the init object
+ private var _canvasController:CanvasController;
+ private var _canvasView:CanvasView;
+ private var _monitorController:MonitorController;
+ private var _monitorTabView : MonitorTabView;
+ private var _tm:ThemeManager;
+
+ //Set by the init obj
+ private var _activity:Activity;
+ private var _children:Array;
+
+ //refs to screen items:
+ private var container_pnl:Panel;
+ private var header_pnl:Panel;
+ private var title_lbl:Label;
+ private var actCount_lbl:Label;
+ private var childActivities_mc:MovieClip;
+ private var clickTarget_mc:MovieClip;
+ private var padlockClosed_mc:MovieClip;
+ private var padlockOpen_mc:MovieClip;
+
+ private var learnerOffset_X:Number = 4;
+ private var learnerOffset_Y:Number = 3;
+ private var learnerContainer:MovieClip;
+
+ private var _ddm:DesignDataModel;
+ private var _dcStartTime:Number = 0;
+ private var _doubleClicking:Boolean;
+ private var child1_mc:MovieClip;
+ private var child2_mc:MovieClip;
+ private var _locked:Boolean = false;
+ private var _visibleHeight:Number;
+ private var _visibleWidth:Number;
+
+ // Only for Monitor Optional Container children
+ private var fromModuleTab:String;
+ private var learner:Object = new Object();
+ private var containerPanelHeader:MovieClip;
+ private var completed_mc:MovieClip;
+ private var current_mc:MovieClip;
+ private var todo_mc:MovieClip;
+
+
+ function CanvasParallelActivity(){
+ Debugger.log("_activity:"+_activity.title+'uiID:'+_activity.activityUIID+' children:'+_children.length,Debugger.GEN,'Constructor','CanvasParallelActivity');
+ _visible = false;
+ _tm = ThemeManager.getInstance();
+ _ddm = new DesignDataModel()
+ _visibleHeight = container_pnl._height;
+ _visibleWidth = container_pnl._width;
+
+ MovieClipUtils.doLater(Proxy.create(this,init));
+ }
+
+ public function init():Void{
+
+
+
+ //set up some handlers:
+ clickTarget_mc.onPress = Proxy.create(this,localOnPress);
+ clickTarget_mc.onRelease = Proxy.create(this,localOnRelease);
+ clickTarget_mc.onReleaseOutside = Proxy.create(this,localOnReleaseOutside);
+
+ _ddm.getComplexActivityChildren(_activity.activityUIID);
+
+ showStatus(false);
+
+ var child1:Activity;
+ var child2:Activity;
+ if(_children[0].orderID < _children[1].orderID){
+ child1 = _children[0];
+ child2 = _children[1];
+
+ }else{
+ child1 = _children[1];
+ child2 = _children[0];
+
+ }
+ //set the positioning co-ords
+ newContainerXCoord = container_pnl._width/2
+ newContainerYCoord = container_pnl._height/2
+ child1.xCoord = CHILD_OFFSET_X //+ (newContainerXCoord-CHILD_OFFSET_X);
+ child1.yCoord = CHILD1_OFFSET_Y;
+ child2.xCoord = CHILD_OFFSET_X //+ (newContainerXCoord-CHILD_OFFSET_X);
+ child2.yCoord = CHILD2_OFFSET_Y //+ newContainerYCoord;
+ //so now it is placed on in the IDE and we just call init
+ if (fromModuleTab == "monitorMonitorTab"){
+ child1_mc.init({activity:child1,_monitorController:_monitorController,_monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
+ child2_mc.init({activity:child2,_monitorController:_monitorController,_monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
+
+ }else {
+ trace("called when seleting act")
+ child1_mc.init({activity:child1,_canvasController:_canvasController,_canvasView:_canvasView});
+ child2_mc.init({activity:child2,_canvasController:_canvasController,_canvasView:_canvasView});
+
+ }
+
+
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
+ }
+
+ public function refreshChildren():Void {
+ child1_mc.setSelected(false);
+ child2_mc.setSelected(false);
+ }
+
+ private function showStatus(isVisible:Boolean){
+ completed_mc._visible = isVisible;
+ current_mc._visible = isVisible;
+ todo_mc._visible = isVisible;
+ }
+
+ public function get activity():Activity{
+ return getActivity();
+ }
+
+ public function set activity(a:Activity){
+ setActivity(a);
+ }
+
+ public function getActivity():Activity{
+ return _activity;
+
+ }
+
+ public function setActivity(a:Activity){
+ _activity = a;
+ }
+
+
+ private function getAssociatedStyle():Object{
+ trace("Category ID for Activity "+_activity.title +": "+_activity.activityCategoryID)
+ var styleObj:Object = new Object();
+ switch (String(_activity.activityCategoryID)){
+ case '0' :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ break;
+ case '1' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '2' :
+ styleObj = _tm.getStyleObject('ACTPanel2')
+ break;
+ case '3' :
+ styleObj = _tm.getStyleObject('ACTPanel5')
+ break;
+ case '4' :
+ styleObj = _tm.getStyleObject('ACTPanel4')
+ break;
+ case '5' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '6' :
+ styleObj = _tm.getStyleObject('ACTPanel3')
+ break;
+ default :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ }
+ return styleObj;
+ }
+
+ private function drawLearners():Void {
+ var mm:MonitorModel = MonitorModel(_monitorController.getModel());
+ var learner_X = _activity.xCoord + learnerOffset_X;
+ var learner_Y = _activity.yCoord + learnerOffset_Y;
+
+ // get the length of learners from the Monitor Model and run a for loop.
+ for (var j=0; j (_activity.xCoord + 112)){
+ learner_X = _activity.xCoord + learnerOffset_X
+ learner_Y = 27
+ hasPlus = true;
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), learnerContainer.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus });
+ return;
+ }
+
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), learnerContainer.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus});
+ learner_X = learner_X+10
+ }
+ }
+ }
+
+ private function draw(){
+
+ //write text
+ title_lbl.text = _activity.title;
+
+ if(fromModuleTab == "monitorMonitorTab")
+ drawLearners()
+
+ //position the container (this)
+ _x = _activity.xCoord //- newContainerXCoord;
+ _y = _activity.yCoord
+
+ setLocking()
+ setStyles()
+ _visible = true;
+
+ }
+
+ private function setStyles():Void {
+ var styleObj = _tm.getStyleObject ('label');
+ title_lbl.setStyle (styleObj);
+ styleObj = getAssociatedStyle();
+ container_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject ('parallelHeadPanel');
+ header_pnl.setStyle('styleName',styleObj);
+ //container_pnl.setStyle("backgroundColor",0x4289FF);
+ }
+
+ private function setLocking():Void{
+ if(_locked){
+ padlockClosed_mc._visible = true;
+ padlockOpen_mc._visible = false;
+ clickTarget_mc._height = 173;
+ }else{
+ padlockOpen_mc._visible = true;
+ padlockClosed_mc._visible = false;
+ clickTarget_mc._height = 30;
+ }
+ }
+
+ public function set locked(setLock:Boolean):Void {
+ _locked = setLock;
+ setLocking();
+
+ }
+
+ public function get locked():Boolean {
+ return _locked;
+ }
+
+ private function localOnPress():Void{
+
+ // check double-click
+ var now:Number = new Date().getTime();
+
+ if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
+ Debugger.log('DoubleClicking:'+this,Debugger.GEN,'localOnPress','CanvasParallelActivity');
+ _doubleClicking = true;
+
+ //if we double click on the glass mask - then open the container to allow the usr to see the activities inside.
+ if(_locked && !(_activity.isReadOnly() && (fromModuleTab == null || fromModuleTab == undefined))){
+ _locked = false;
+ }else {
+ if(_activity.isReadOnly() && (fromModuleTab == null || fromModuleTab == undefined)) {
+ /** TODO: Change label warning */
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_dbclick_readonly'));
+ }
+
+ _locked = true;
+ }
+ draw();
+
+
+
+ }else{
+ Debugger.log('SingleClicking:+'+this,Debugger.GEN,'localOnPress','CanvasParallelActivity');
+ _doubleClicking = false;
+ _canvasController.activityClick(this);
+
+ }
+
+ _dcStartTime = now;
+
+ }
+
+ private function localOnRelease():Void{
+ Debugger.log('_doubleClicking:'+_doubleClicking+', localOnRelease:'+this,Debugger.GEN,'localOnRelease','CanvasParallelActivity');
+ if ( ! _doubleClicking) {
+ _canvasController.activityRelease(this);
+ }
+
+ }
+
+ private function localOnReleaseOutside():Void{
+ Debugger.log('localOnReleaseOutside:'+this,Debugger.GEN,'localOnReleaseOutside','CanvasParallelActivity');
+ _canvasController.activityReleaseOutside(this);
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleWidth ():Number {
+ return _visibleWidth;
+ }
+
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleHeight ():Number {
+ return _visibleHeight;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get actChildren():Array {
+ return _children;
+ }
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasTransition.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasTransition.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasTransition.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,335 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.cv.*;
+
+
+/**
+* -+ -
+*/
+class org.lamsfoundation.lams.authoring.cv.CanvasTransition extends MovieClip{
+ //set by passing initObj to mc.createClass()
+ private var _canvasController:CanvasController;
+ private var _canvasView:CanvasView;
+ private var _transition:Transition;
+
+ private var _drawnLineStyle:Number;
+
+ private var arrow_mc:MovieClip;
+ private var stopArrow_mc:MovieClip;
+ private var stopSign_mc:MovieClip;
+
+
+ private var _startPoint:Point;
+ private var _midPoint:Point;
+ private var _endPoint:Point;
+ private var _fromAct_edgePoint:Point;
+ private var _toAct_edgePoint:Point;
+ private var xPos:Number;
+
+
+ private var _dcStartTime:Number = 0;
+ private var _doubleClicking:Boolean;
+
+
+
+ function CanvasTransition(){
+
+ Debugger.log("_transition.fromUIID:"+_transition.fromUIID,4,'Constructor','CanvasTransition');
+ Debugger.log("_transition.toUIID:"+_transition.toUIID,4,'Constructor','CanvasTransition');
+ arrow_mc._visible = false;
+ stopArrow_mc._visible = false;
+ stopSign_mc._visible = false;
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+ //init();
+ }
+
+ public function init():Void{
+ //Debugger.log('Running,',4,'init','CanvasTransition');
+ //todo: all a get style for this
+ _drawnLineStyle = 0x777E9D;
+ draw();
+ }
+
+ public function get transition():Transition{
+ return _transition;
+ }
+
+ public function set transition(t:Transition){
+ _transition = t;
+ }
+
+ public function get midPoint():Point{
+ return _midPoint;
+ }
+
+ public function get toAct_edgePoint():Point{
+ return _toAct_edgePoint;
+ }
+
+ public function get fromAct_edgePoint():Point{
+ return _fromAct_edgePoint;
+ }
+
+ /**
+ * Renders the transition to stage
+ * @usage
+ * @return
+ */
+ private function draw():Void{
+ //Debugger.log('',4,'draw','CanvasTransition');
+
+ var cv:Canvas = Application.getInstance().getCanvas();
+
+ //var fromAct = cv.ddm.getActivityByUIID(_transition.fromUIID);
+ //var toAct = cv.ddm.getActivityByUIID(_transition.toUIID);
+
+ var fromAct_mc;
+ var toAct_mc;
+
+ if(_transition.mod_fromUIID != null) fromAct_mc = cv.model.getActivityMCByUIID(_transition.mod_fromUIID);
+ else fromAct_mc = cv.model.getActivityMCByUIID(_transition.fromUIID);
+
+ if(_transition.mod_toUIID != null) toAct_mc = cv.model.getActivityMCByUIID(_transition.mod_toUIID);
+ else toAct_mc = cv.model.getActivityMCByUIID(_transition.toUIID);
+
+ //var startPoint:Point = MovieClipUtils.getCenterOfMC(fromAct_mc);
+ //var endPoint:Point = MovieClipUtils.getCenterOfMC(toAct_mc);
+
+ //TODO: check if its a gate transition and if so render a shorty
+ var isGateTransition = toAct_mc.activity.isGateActivity();
+
+
+ var offsetToCentre_x = fromAct_mc.getVisibleWidth() / 2;
+ var offsetToCentre_y = fromAct_mc.getVisibleHeight() / 2;
+ Debugger.log('fromAct_mc.getActivity().xCoord:'+fromAct_mc.getActivity().xCoord,4,'draw','CanvasTransition');
+ Debugger.log('offsetToCentre_x:'+offsetToCentre_x,4,'draw','CanvasTransition');
+
+
+ _startPoint = new Point(fromAct_mc.getActivity().xCoord+offsetToCentre_x,fromAct_mc.getActivity().yCoord+offsetToCentre_y);
+
+ var toOTC_x:Number = toAct_mc.getVisibleWidth() /2;
+ var toOTC_y:Number = toAct_mc.getVisibleHeight() /2;
+
+ _endPoint = new Point(toAct_mc.getActivity().xCoord+toOTC_x,toAct_mc.getActivity().yCoord+toOTC_y);
+
+ Debugger.log('fromAct_mc:'+fromAct_mc,4,'draw','CanvasTransition');
+ Debugger.log('toAct_mc:'+toAct_mc,4,'draw','CanvasTransition');
+
+ this.lineStyle(2, _drawnLineStyle);
+ this.moveTo(_startPoint.x, _startPoint.y);
+
+ //this.dashTo(startX, startY, endX, endY, 8, 4);
+ this.lineTo(_endPoint.x, _endPoint.y);
+ Debugger.log('drawn line from:'+_startPoint.x+','+_startPoint.y+'to:'+_endPoint.x+','+_endPoint.y,4,'draw','CanvasTransition');
+
+ // calc activity root angles
+ var fromAct_Angle:Number = Math.atan2(offsetToCentre_y, offsetToCentre_x);
+ var toAct_Angle:Number = Math.atan2(toOTC_y,toOTC_x);
+
+ var fromAct_Deg:Number = convertToDegrees(fromAct_Angle);
+ var toAct_Deg:Number = convertToDegrees(toAct_Angle);
+
+ Debugger.log("fromAct root angle: " + fromAct_Deg, Debugger.CRITICAL, "draw", "CanvasTransition");
+ Debugger.log("toAct root angle: " + toAct_Deg, Debugger.CRITICAL, "draw", "CanvasTransition");
+
+ // gradient
+ var angle:Number = Math.atan2((_endPoint.y- _startPoint.y),(_endPoint.x- _startPoint.x));
+ var degs:Number = convertToDegrees(angle);
+
+ Debugger.log("angle: " + angle, Debugger.CRITICAL, "draw", "CanvasTransition");
+ Debugger.log("degs: " + degs, Debugger.CRITICAL, "draw", "CanvasTransition");
+
+ // get edgepoint for connected activities
+ _fromAct_edgePoint = calcEdgePoint(degs, offsetToCentre_x, offsetToCentre_y, fromAct_Deg, _startPoint);
+ _toAct_edgePoint = (degs >= 0) ? calcEdgePoint(degs - 180, toOTC_x, toOTC_y, toAct_Deg, _endPoint)
+ : calcEdgePoint(degs + 180, toOTC_x, toOTC_y, toAct_Deg, _endPoint);
+
+ // calc midpoint
+ if(_fromAct_edgePoint != null & _toAct_edgePoint != null) {
+ arrow_mc._x = (_fromAct_edgePoint.x + _toAct_edgePoint.x)/2;
+ arrow_mc._y = (_fromAct_edgePoint.y + _toAct_edgePoint.y)/2;
+ } else {
+ arrow_mc._x = (_startPoint.x + _endPoint.x)/2;
+ arrow_mc._y = (_startPoint.y + _endPoint.y)/2;
+ }
+
+ Debugger.log("startPoint: (" + _startPoint.x + ", " + _startPoint.y + ")", Debugger.CRITICAL, "draw", "CanvasTransition");
+ Debugger.log("fromAct edge point: (" + _fromAct_edgePoint.x + ", " + _fromAct_edgePoint.y + ")", Debugger.CRITICAL, "draw", "CanvasTransition");
+ Debugger.log("toAct edge point: (" + _toAct_edgePoint.x + ", " + _toAct_edgePoint.y + ")", Debugger.CRITICAL, "draw", "CanvasTransition");
+ Debugger.log("endPoint: (" + _endPoint.x + ", " + _endPoint.y + ")", Debugger.CRITICAL, "draw", "CanvasTransition");
+
+ Debugger.log("mid point: (" + _midPoint.x + ", " + _midPoint.y + ")", Debugger.CRITICAL, "draw", "CanvasTransition");
+
+ arrow_mc._rotation = degs;
+ arrow_mc._visible = true;
+
+ _midPoint = new Point(arrow_mc._x,arrow_mc._y);
+
+ xPos = this._x
+ trace("x position of start point: "+xPos)
+
+ /*
+ stopArrow_mc._rotation = degs;
+
+ // calculate the position for the stop sign
+ stopSign_mc._x = arrow_mc._x;
+ stopSign_mc._y = arrow_mc._y;
+ stopArrow_mc._x = arrow_mc._x;
+ stopArrow_mc._y = arrow_mc._y;
+ */
+
+ }
+ /*
+ private function updateSynchStatus():Void{
+
+ if(completionType == "synchronize_teacher"){
+ stopSign._visible = true;
+ stopSignArrow._visible = true;
+ }else{
+ stopSign._visible = false;
+ stopSignArrow._visible = false;
+ }
+
+ }
+*/
+
+ public function get xPosition():Number{
+ return xPos;
+ }
+
+ private static function convertToDegrees(angle:Number):Number {
+ return Math.round(angle*180/Math.PI);
+ }
+
+ private static function convertToRadians(degrees:Number):Number {
+ return degrees/180*Math.PI;
+ }
+
+ private function getQuadrant(d:Number) {
+ if(d >= 0 && d < 90) {
+ return "q3";
+ } else if(d < 0 && d >= - 90) {
+ return "q2";
+ } else if(d < -90 && d >= -180) {
+ return "q1";
+ } else {
+ return "q4";
+ }
+ }
+
+ private function calcEdgePoint(_d:Number, x_offset:Number, y_offset:Number, _act_d:Number, point:Point):Point {
+ var _edgePoint:Point = new Point();
+ var d:Number = _d;
+ var quad:String = getQuadrant(d);
+
+ switch(quad) {
+ case "q1":
+ d = 180 + d;
+
+ _edgePoint.y = (d >= _act_d) ? point.y - y_offset : point.y - (x_offset * calcTangent(d, false));
+ _edgePoint.x = (d >= _act_d) ? point.x - (y_offset * calcTangent(d, true)) : point.x - x_offset;;
+
+ break;
+ case "q2":
+ d = Math.abs(d);
+
+ _edgePoint.y = (d >= _act_d) ? point.y - y_offset : point.y - (x_offset * calcTangent(d, false));
+ _edgePoint.x = (d >= _act_d) ? point.x + (y_offset * calcTangent(d, true)) : point.x + x_offset;;
+
+ break;
+ case "q3":
+
+ _edgePoint.y = (d >= _act_d) ? point.y + y_offset : point.y + (x_offset * calcTangent(d, false));
+ _edgePoint.x = (d >= _act_d) ? point.x + (y_offset * calcTangent(d, true)) : point.x + x_offset;
+
+
+ break;
+ case "q4":
+ d = 180 - d;
+
+ _edgePoint.y = (d >= _act_d) ? point.y + y_offset : point.y + (x_offset * calcTangent(d, false));
+ _edgePoint.x = (d >= _act_d) ? point.x - (y_offset * calcTangent(d, true)) : point.x - x_offset;;
+
+ break;
+ default:
+ // ERR: No Quadrant found
+ break;
+ }
+
+ return _edgePoint;
+ }
+
+ private function calcTangent(_d:Number, _use_adj_angle:Boolean) {
+ var d:Number = (_use_adj_angle) ? 90 - _d: _d;
+ return Math.tan(convertToRadians(d));
+ }
+
+ private function onPress():Void{
+ // check double-click
+ var now:Number = new Date().getTime();
+ //Debugger.log('now:'+now,Debugger.GEN,'onPress','CanvasTransition');
+ //Debugger.log('_dcStartTime:'+_dcStartTime,Debugger.GEN,'onPress','CanvasTransition');
+ Debugger.log('now - _dcStartTime:'+(now - _dcStartTime)+' Config.DOUBLE_CLICK_DELAY:'+Config.DOUBLE_CLICK_DELAY,Debugger.GEN,'onPress','CanvasTransition');
+ if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
+ //Debugger.log('DoubleClicking:'+this,Debugger.GEN,'onPress','CanvasTransition');
+ _doubleClicking = true;
+ _canvasController.transitionDoubleClick(this);
+
+
+ }else{
+ Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','CanvasTransition');
+ _doubleClicking = false;
+
+ //Debugger.log('_canvasController:'+_canvasController,Debugger.GEN,'onPress','CanvasTransition');
+ _canvasController.transitionClick(this);
+
+
+ }
+
+ _dcStartTime = now;
+
+ }
+
+ private function onRelease():Void{
+ if(!_doubleClicking){
+ //Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','CanvasTransition');
+ _canvasController.transitionRelease(this);
+ }
+
+ }
+
+ private function onReleaseOutside():Void{
+ //Debugger.log('ReleasingOutside:'+this,Debugger.GEN,'onReleaseOutside','CanvasTransition');
+ _canvasController.transitionReleaseOutside(this);
+ }
+
+
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasView.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasView.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasView.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,637 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.authoring.cv.*
+import org.lamsfoundation.lams.authoring.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.CommonCanvasView
+import com.polymercode.Draw;
+import mx.controls.*
+import mx.managers.*
+import mx.containers.*;
+import mx.events.*
+import mx.utils.*
+
+
+/**
+*Authoring view for the canvas
+* Relects changes in the CanvasModel
+*/
+
+class org.lamsfoundation.lams.authoring.cv.CanvasView extends CommonCanvasView {
+ //constants:
+ private var GRID_HEIGHT:Number;
+ private var GRID_WIDTH:Number;
+ private var H_GAP:Number;
+ private var V_GAP:Number;
+
+ private var _tm:ThemeManager;
+ private var _cm:CanvasModel;
+ //Canvas clip
+ private var _canvas_mc:MovieClip;
+ private var canvas_scp:ScrollPane;
+ private var bkg_pnl:Panel;
+ private var isRread_only:Boolean = false;
+ private var isRedit_on_fly:Boolean = false;
+ private var read_only:MovieClip;
+ private var titleBar:MovieClip;
+ private var leftCurve:MovieClip;
+ private var rightCurve:MovieClip;
+ private var nameBG:MovieClip;
+ //private var act_pnl:Panel;
+
+ private var designName_lbl:Label;
+
+ private var _gridLayer_mc:MovieClip;
+ private var _transitionLayer_mc:MovieClip;
+ private var _activityLayerComplex_mc:MovieClip;
+ private var _activityLayer_mc:MovieClip;
+
+ private var startTransX:Number;
+ private var startTransY:Number;
+ private var lastScreenWidth:Number = 1024;
+ private var lastScreenHeight:Number = 768;
+
+ private var _transitionPropertiesOK:Function;
+ private var _canvasView:CanvasView;
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+
+ /**
+ * Constructor
+ */
+ function CanvasView(){
+ _canvasView = this;
+ _tm = ThemeManager.getInstance();
+ //Init for event delegation
+ mx.events.EventDispatcher.initialize(this);
+ }
+
+ /**
+ * Called to initialise Canvas . CAlled by the Canvas container
+ */
+ public function init(m:Observable,c:Controller,x:Number,y:Number,w:Number,h:Number){
+ //Invoke superconstructor, which sets up MVC relationships.
+ //if(c==undefined){
+ // c==defaultController();
+ //}
+ super (m, c);
+ //Set up parameters for the grid
+ H_GAP = 10;
+ V_GAP = 10;
+ _cm = CanvasModel(m)
+
+ //register to recive updates form the model
+ _cm.addEventListener('viewUpdate',this);
+
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+ }
+
+ /**
+ * Recieved update events from the CanvasModel. Dispatches to relevent handler depending on update.Type
+ * @usage
+ * @param event
+ */
+ public function viewUpdate(event:Object):Void{
+ Debugger.log('Recived an Event dispather UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','CanvasView');
+ //Update view from info object
+ //Debugger.log('Recived an UPDATE!, updateType:'+infoObj.updateType,4,'update','CanvasView');
+ var cm:CanvasModel = event.target;
+
+ switch (event.updateType){
+ case 'POSITION' :
+ setPosition(cm);
+ break;
+ case 'SIZE' :
+ setSize(cm);
+ break;
+ case 'DRAW_ACTIVITY':
+ drawActivity(event.data,cm);
+ break;
+ case 'HIDE_ACTIVITY':
+ hideActivity(event.data,cm);
+ break;
+ case 'REMOVE_ACTIVITY':
+ removeActivity(event.data,cm);
+ break;
+ case 'DRAW_TRANSITION':
+ drawTransition(event.data,cm);
+ break;
+ case 'HIDE_TRANSITION':
+ hideTransition(event.data,cm);
+ break;
+ case 'REMOVE_TRANSITION':
+ removeTransition(event.data,cm);
+ break;
+ case 'SELECTED_ITEM' :
+ highlightActivity(cm);
+ break;
+
+ case 'POSITION_TITLEBAR':
+ setDesignTitle(cm);
+ break;
+ /*
+ case 'STOP_TRANSITION_TOOL':
+ stopDrawingTransition(cm);
+ break;
+ */
+ default :
+ Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView');
+ }
+
+ }
+ /*
+ public function onRelease(){
+ getController().canvasRelease(_canvas_mc);
+ }
+ */
+
+ /**
+ * layout visual elements on the canvas on initialisation
+ */
+ private function draw(){
+ //get the content path for the sp
+ _canvas_mc = canvas_scp.content;
+ //Debugger.log('_canvas_mc'+_canvas_mc,Debugger.GEN,'draw','CanvasView');
+
+ bkg_pnl = _canvas_mc.createClassObject(Panel, "bkg_pnl", getNextHighestDepth());
+ //set up the
+ //_canvas_mc = this;
+ _gridLayer_mc = _canvas_mc.createEmptyMovieClip("_gridLayer_mc", _canvas_mc.getNextHighestDepth());
+ _transitionLayer_mc = _canvas_mc.createEmptyMovieClip("_transitionLayer_mc", _canvas_mc.getNextHighestDepth());
+
+ _activityLayerComplex_mc = _canvas_mc.createEmptyMovieClip("_activityLayerComplex_mc", _canvas_mc.getNextHighestDepth());
+
+ _activityLayer_mc = _canvas_mc.createEmptyMovieClip("_activityLayer_mc", _canvas_mc.getNextHighestDepth());
+
+ titleBar = _canvasView.attachMovie("DesignTitleBar", "titleBar", _canvasView.getNextHighestDepth())
+ //var styleObj = _tm.getStyleObject('redLabel');
+ var styleObj = _tm.getStyleObject('label');
+ read_only = _canvasView.attachMovie('Label', 'read_only', _canvasView.getNextHighestDepth(), {_x:5, _y:titleBar._y, _visible:true, autoSize:"left", html:true, styleName:styleObj});
+ //read_only.text = Dictionary.getValue('cv_readonly_lbl');
+
+ //_canvas_mc.addEventListener('onRelease',this);
+ bkg_pnl.onRelease = function(){
+ trace('_canvas_mc.onRelease');
+ Application.getInstance().getCanvas().getCanvasView().getController().canvasRelease(this);
+ }
+ bkg_pnl.useHandCursor = false;
+ setDesignTitle();
+
+ styleTitleBar();
+ setStyles();
+
+ //Debugger.log('canvas view dispatching load event'+_canvas_mc,Debugger.GEN,'draw','CanvasView');
+ //Dispatch load event
+ dispatchEvent({type:'load',target:this});
+ }
+
+ private function setDesignTitle(cm:CanvasModel){
+ //titleBar.designName_lbl.text = ""+Dictionary.getValue('pi_title')+"";
+ var dTitle:String;
+ var titleToCheck:String;
+ if (isRread_only){
+ dTitle = cm.getCanvas().ddm.title + " ("+Dictionary.getValue('cv_readonly_lbl')+")"
+ titleToCheck = cm.getCanvas().ddm.title + Dictionary.getValue('cv_readonly_lbl')
+ } else if(isRedit_on_fly) {
+ dTitle = cm.getCanvas().ddm.title + " ("+Dictionary.getValue('cv_edit_on_fly_lbl')+")"
+ titleToCheck = cm.getCanvas().ddm.title + Dictionary.getValue('cv_edit_on_fly_lbl')
+ }else {
+ dTitle = cm.getCanvas().ddm.title
+ titleToCheck = dTitle
+ }
+ if (dTitle == undefined || dTitle == null || dTitle == ""){
+ dTitle = Dictionary.getValue('cv_untitled_lbl');
+ titleToCheck = dTitle
+ }
+
+ read_only.text = dTitle;
+ setSizeTitleBar(titleToCheck);
+ }
+
+ private function setSizeTitleBar(dTitle:String):Void{
+ dTitle = StringUtils.replace(dTitle, " ", "")
+ _canvasView.createTextField("designTitle", _canvasView.getNextHighestDepth(), -10000, -10000, 20, 20)
+ var nameTextFormat = new TextFormat();
+ nameTextFormat.bold = true;
+ nameTextFormat.font = "Verdana";
+ nameTextFormat.size = 12;
+
+ var titleTxt = _canvasView["designTitle"];
+ titleTxt.multiline = false;
+ titleTxt.autoSize = true
+ titleTxt.text = dTitle;
+ titleTxt.setNewTextFormat(nameTextFormat);
+
+ var bgWidth = titleTxt.textWidth;
+ titleBar.nameBG._width = bgWidth;
+ titleBar.nameBGShadow._width = bgWidth;
+ titleBar.nameBG._visible = true;
+ titleBar.rightCurve._x = bgWidth+27;
+ titleBar.rightCurveShadow._x = titleBar.rightCurve._x+2
+
+ }
+
+
+ private function positionTitleBar(cm:CanvasModel):Void{
+ titleBar._y = canvas_scp._y;
+ titleBar._x = (canvas_scp.width/2)-(titleBar._width/2)
+ read_only._x = titleBar._x + 5;
+
+ }
+
+ private function styleTitleBar():Void {
+
+ var titleBarBg:mx.styles.CSSStyleDeclaration = _tm.getStyleObject("BGPanel");
+ var titleBarBgShadow:mx.styles.CSSStyleDeclaration = _tm.getStyleObject("BGPanelShadow");
+
+ var nameBGColor:Color = new Color(titleBar.nameBG);
+ var nameBGShadowColor:Color = new Color(titleBar.nameBGShadow);
+ var rightCurveColor:Color = new Color(titleBar.rightCurve);
+ var rightCurveShadowColor:Color = new Color(titleBar.rightCurveShadow);
+
+ var bgColor:Number = titleBarBg.getStyle("backgroundColor");
+ var bgShadowColor:Number = titleBarBgShadow.getStyle("backgroundColor");
+
+ nameBGColor.setRGB(bgColor);
+ nameBGShadowColor.setRGB(bgShadowColor);
+ rightCurveColor.setRGB(bgColor);
+ rightCurveShadowColor.setRGB(bgShadowColor);
+
+ }
+
+ public function initDrawTempTrans(){
+ Debugger.log("Initialising drawing temp. Transition", Debugger.GEN, "initDrawTempTrans", "CanvasView");
+ _activityLayer_mc.createEmptyMovieClip("tempTrans", _activityLayer_mc.getNextHighestDepth());
+ _activityLayer_mc.attachMovie("squareHandle", "h1", _activityLayer_mc.getNextHighestDepth());
+ _activityLayer_mc.attachMovie("squareHandle", "h2", _activityLayer_mc.getNextHighestDepth());
+ _activityLayer_mc.h1._x = _canvas_mc._xmouse
+ _activityLayer_mc.h1._y = _canvas_mc._ymouse
+ trace("startTransX: "+_activityLayer_mc.h1._x)
+ _activityLayer_mc.tempTrans.onEnterFrame = drawTempTrans;
+ trace("startTransY: "+_activityLayer_mc.h1._y)
+
+ }
+
+ /**
+ * used to draw temp dotted transtion.
+ * @usage
+ * @return
+ */
+ private function drawTempTrans(){
+ //var drawLineColor =
+ trace("_activityLayer_mc.tempTrans: "+this)
+ trace("startTransX: "+startTransX)
+ trace("startTransY: "+startTransY)
+ trace("_parent._parent: "+_parent._parent);
+ Debugger.log("Started drawing temp. Transition", Debugger.GEN, "drawTempTrans", "CanvasView");
+
+ this.clear();
+
+ Debugger.log("Runtime movieclips cleared from CanvasView: clear()", Debugger.GEN, "drawTempTrans", "CanvasView");
+
+ Draw.dashTo(this, _parent.h1._x, _parent.h1._y, _parent._parent._xmouse - 3, _parent._parent._ymouse - 3, 7, 4);
+ _parent.h2._x = _parent._parent._xmouse - 3
+ _parent.h2._y = _parent._parent._ymouse - 3
+ }
+
+ public function removeTempTrans(){
+ Debugger.log("Stopped drawing temp. Transition", Debugger.GEN, "removeTempTrans", "CanvasView");
+ trace("stopped Drawing ")
+ delete _activityLayer_mc.tempTrans.onEnterFrame;
+ _activityLayer_mc.tempTrans.removeMovieClip();
+ _activityLayer_mc.h1.removeMovieClip();
+ _activityLayer_mc.h2.removeMovieClip();
+ }
+
+
+ /**
+ * Draws new or replaces existing activity to canvas stage.
+ * @usage
+ * @param a - Activity to be drawn
+ * @param cm - Refernce to the model
+ * @return Boolean - successfullit
+ */
+ private function drawActivity(a:Activity,cm:CanvasModel):Boolean{
+ var s:Boolean = false;
+ //Debugger.log('a.title:'+a.title,4,'drawActivity','CanvasView');
+ //var initObj:Object = {_activity=a};
+ //_global.breakpoint();
+ var cvv = CanvasView(this);
+
+ var cvc = getController();
+ //Debugger.log('I am in drawActivity and Activity typeID :'+a+' added to the cm.activitiesDisplayed hashtable :'+newActivity_mc,4,'drawActivity','CanvasView');
+ Debugger.log('I am in drawActivity and Activity typeID :'+a.activityTypeID+' added to the cm.activitiesDisplayed hashtable :'+newActivity_mc,4,'drawActivity','CanvasView');
+ //take action depending on act type
+ if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity()){
+ var newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasActivity",DepthManager.kTop,{_activity:a,_canvasController:cvc,_canvasView:cvv});
+ cm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
+ Debugger.log('Tool or gate activity a.title:'+a.title+','+a.activityUIID+' added to the cm.activitiesDisplayed hashtable:'+newActivity_mc,4,'drawActivity','CanvasView');
+ }
+ if (a.isGateActivity()){
+ var newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasGateActivity",DepthManager.kTop,{_activity:a,_canvasController:cvc,_canvasView:cvv});
+ cm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
+ Debugger.log('Gate activity a.title:'+a.title+','+a.activityUIID+' added to the cm.activitiesDisplayed hashtable:'+newActivity_mc,4,'drawActivity','CanvasView');
+ }
+ if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE){
+ //get the children
+ var children:Array = cm.getCanvas().ddm.getComplexActivityChildren(a.activityUIID);
+ //var newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasParallelActivity",DepthManager.kTop,{_activity:a,_children:children,_canvasController:cvc,_canvasView:cvv});
+ var newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasParallelActivity",DepthManager.kTop,{_activity:a,_children:children,_canvasController:cvc,_canvasView:cvv, _locked:a.isReadOnly()});
+ cm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
+ Debugger.log('Parallel activity a.title:'+a.title+','+a.activityUIID+' added to the cm.activitiesDisplayed hashtable :'+newActivity_mc,4,'drawActivity','CanvasView');
+ }
+ if(a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE){
+ var children:Array = cm.getCanvas().ddm.getComplexActivityChildren(a.activityUIID);
+ //var newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasParallelActivity",DepthManager.kTop,{_activity:a,_children:children,_canvasController:cvc,_canvasView:cvv});
+ var newActivity_mc = _activityLayerComplex_mc.createChildAtDepth("CanvasOptionalActivity",DepthManager.kTop,{_activity:a,_children:children,_canvasController:cvc,_canvasView:cvv,_locked:a.isReadOnly()});
+ cm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
+ Debugger.log('Optional activity Type a.title:'+a.title+','+a.activityUIID+' added to the cm.activitiesDisplayed hashtable :'+newActivity_mc,4,'drawActivity','CanvasView');
+
+ }else{
+ Debugger.log('The activity:'+a.title+','+a.activityUIID+' is of unknown type, it cannot be drawn',Debugger.CRITICAL,'drawActivity','CanvasView');
+ }
+
+
+
+
+
+ //position
+ //newActivity_mc._x = a.xCoord;
+ //newActivity_mc._y = a.yCoord;
+
+ //newActivity_mc._visible = true;
+
+ s = true;
+
+ return s;
+ }
+
+ /**
+ * Add to canvas stage but keep hidden from view.
+ *
+ * @usage
+ * @param a
+ * @param cm
+ * @return true if successful
+ */
+
+ private function hideActivity(a:Activity, cm:CanvasModel):Boolean {
+ var cvv = CanvasView(this);
+ var cvc = getController();
+
+ if (a.isSystemGateActivity()){
+ var newActivityObj = new Object();
+ newActivityObj.activity = a;
+
+ cm.activitiesDisplayed.put(a.activityUIID,newActivityObj);
+
+ Debugger.log('Gate activity a.title:'+a.title+','+a.activityUIID+' added (hidden) to the cm.activitiesDisplayed hashtable:'+newActivityObj,4,'hideActivity','CanvasView');
+ }
+
+ return true;
+ }
+
+ /**
+ * Removes existing activity from canvas stage. DOES not affect DDM. called by an update, so DDM change is already made
+ * @usage
+ * @param a - Activity to be Removed
+ * @param cm - Refernce to the model
+ * @return Boolean - successfull
+ */
+ private function removeActivity(a:Activity,cm:CanvasModel):Boolean{
+ //Debugger.log('a.title:'+a.title,4,'removeActivity','CanvasView');
+ var r = cm.activitiesDisplayed.remove(a.activityUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+ return s;
+ }
+
+ /**
+ * Draws a transition on the canvas.
+ * @usage
+ * @param t The transition to draw
+ * @param cm the canvas model.
+ * @return
+ */
+ private function drawTransition(t:Transition,cm:CanvasModel):Boolean{
+ var s:Boolean = true;
+ //Debugger.log('t.fromUIID:'+t.fromUIID+', t.toUIID:'+t.toUIID,Debugger.GEN,'drawTransition','CanvasView');
+ var cvv = CanvasView(this);
+ var cvc = getController();
+ var newTransition_mc:MovieClip = _transitionLayer_mc.createChildAtDepth("CanvasTransition",DepthManager.kTop,{_transition:t,_canvasController:cvc,_canvasView:cvv});
+
+ cm.transitionsDisplayed.put(t.transitionUIID,newTransition_mc);
+ Debugger.log('drawn a transition:'+t.transitionUIID+','+newTransition_mc,Debugger.GEN,'drawTransition','CanvasView');
+ return s;
+
+ }
+
+ /**
+ * Hides a transition on the canvas.
+ *
+ * @usage
+ * @param t The transition to hide
+ * @param cm The canvas model
+ * @return true if successful
+ */
+
+ private function hideTransition(t:Transition, cm:CanvasModel):Boolean{
+ var cvv = CanvasView(this);
+ var cvc = getController();
+ var newTransition_mc:MovieClip = _transitionLayer_mc.createChildAtDepth("CanvasTransition",DepthManager.kTop,{_transition:t,_canvasController:cvc,_canvasView:cvv, _visible:false});
+
+ cm.transitionsDisplayed.put(t.transitionUIID,newTransition_mc);
+ Debugger.log('drawn (hidden) a transition:'+t.transitionUIID+','+newTransition_mc,Debugger.GEN,'hideTransition','CanvasView');
+
+
+ return true;
+ }
+
+ /**
+ * Removes a transition from the canvas
+ * @usage
+ * @param t The transition to remove
+ * @param cm The canvas model
+ * @return
+ */
+ private function removeTransition(t:Transition,cm:CanvasModel){
+ //Debugger.log('t.uiID:'+t.transitionUIID,Debugger.CRITICAL,'removeTransition','CanvasView');
+ var r = cm.transitionsDisplayed.remove(t.transitionUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+ return s;
+ }
+
+
+ /**
+ * Create a popup dialog to set transition parameters
+ * @param pos - Position, either 'centre' or an object containing x + y coordinates
+ */
+ public function createTransitionPropertiesDialog(pos:Object,callBack:Function){
+ //Debugger.log('Call',Debugger.GEN,'createTransitionPropertiesDialog','CanvasView');
+ var dialog:MovieClip;
+ _transitionPropertiesOK = callBack;
+ //Check to see whether this should be a centered or positioned dialog
+ if(typeof(pos)=='string'){
+ //Debugger.log('pos:'+pos,Debugger.GEN,'createTransitionPropertiesDialog','CanvasView');
+ dialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('trans_dlg_title'),closeButton:true,scrollContentPath:"TransitionProperties"});
+ } else {
+ dialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('trans_dlg_title'),closeButton:true,scrollContentPath:"TransitionProperties",_x:pos.x,_y:pos.y});
+ }
+ //Assign dialog load handler
+ dialog.addEventListener('contentLoaded',Delegate.create(this,transitionDialogLoaded));
+ //okClickedCallback = callBack;
+ }
+
+ /**
+ * called when the transitionDialogLoaded is loaded
+ */
+ public function transitionDialogLoaded(evt:Object) {
+ //Debugger.log('!evt.type:'+evt.type,Debugger.GEN,'dialogLoaded','CanvasView');
+ //Check type is correct
+ if(evt.type == 'contentLoaded'){
+ //Set up callback for ok button click
+ //Debugger.log('!evt.target.scrollContent:'+evt.target.scrollContent,Debugger.GEN,'dialogLoaded','CanvasView');
+ evt.target.scrollContent.addEventListener('okClicked',_transitionPropertiesOK);
+ }else {
+ //TODO DI 25/05/05 raise wrong event type error
+ }
+ }
+
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(cm:CanvasModel):Void{
+ //positionTitleBar();
+ var s:Object = cm.getSize();
+ var newWidth:Number = Math.max(s.w, lastScreenWidth)
+ var newHeight:Number = Math.max(s.h, lastScreenHeight)
+ canvas_scp.setSize(s.w,s.h);
+ bkg_pnl.setSize(newWidth,newHeight);
+
+ //Create the grid. The gris is re-drawn each time the canvas is resized.
+ //var grid_mc = Grid.drawGrid(_gridLayer_mc,Math.round(s.w),Math.round(s.h),V_GAP,H_GAP);
+ var grid_mc = Grid.drawGrid(_gridLayer_mc,Math.round(newWidth),Math.round(newHeight),V_GAP,H_GAP);
+
+ //position bin in canvas.
+ var bin = cm.getCanvas().bin;
+ bin._x = (s.w - bin._width) - 20;
+ bin._y = (s.h - bin._height) - 20;
+ canvas_scp.redraw(true);
+ lastScreenWidth = newWidth
+ lastScreenHeight = newHeight
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ * @usage
+ * @return
+ */
+ private function setStyles() {
+
+ var styleObj = _tm.getStyleObject('CanvasPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+
+ //styleObj = _tm.getStyleObject('label');
+ //titleBar.designName_lbl.setStyle('styleName',styleObj);
+
+
+
+ }
+
+ public function setTTData(tData:Object):Void{
+
+ //transTargetMC = tData.transTargetMC
+ //tempTrans_mc = tData.tempTrans_mc
+ //startTransX = tData.startTransX
+ //startTransY = tData.startTransY
+ }
+
+ public function getTTData():Object{
+ var tData:Object = new Object();
+ //tData.transTargetMC = transTargetMC
+ //tData.tempTrans_mc = tempTrans_mc
+ //tData.startTransX = startTransX
+ //tData.startTransY = startTransY
+ return tData
+ }
+ /**
+ * Sets the position of the canvas on stage, called from update
+ * @param cm Canvas model object
+ */
+ private function setPosition(cm:CanvasModel):Void{
+ var p:Object = cm.getPosition();
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ public function getViewMc(testString:String):MovieClip{
+ trace("passed on argument is "+testString)
+ return _canvas_mc;
+ }
+
+ public function getTransitionLayer():MovieClip{
+ return _transitionLayer_mc;
+ }
+
+ public function get activityLayer():MovieClip{
+ return _activityLayer_mc;
+ }
+
+ public function showReadOnly(b:Boolean){
+ isRread_only = b;
+ }
+
+ public function showEditOnFly(b:Boolean){
+ isRedit_on_fly = b;
+ }
+
+ /**
+ * Overrides method in abstract view to ensure cortect type of controller is returned
+ * @usage
+ * @return CanvasController
+ */
+ public function getController():CanvasController{
+ var c:Controller = super.getController();
+ return CanvasController(c);
+ }
+
+ /**
+ * Returns the default controller for this view .
+ * Overrides AbstractView.defaultController()
+ */
+ public function defaultController (model:Observable):Controller {
+ return new CanvasController(model);
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ICanvasActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ICanvasActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ICanvasActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.authoring.*
+import org.lamsfoundation.lams.authoring.cv.*
+
+/**
+ * Specifies the minimum services that a canvaas element must provide
+ */
+interface org.lamsfoundation.lams.authoring.cv.ICanvasActivity {
+
+
+ /**
+ * Sets the activity for this Canvas Element. If its a complex activity it will get the mainActivity.
+ */
+ public function getActivity():Activity;
+
+ /**
+ * Sets the activity for this Canvas Element. If its a complex activity it will set the mainActivity.
+ */
+ public function setActivity(newActivity:Activity);
+
+ /**
+ * Retrieves the visible width and height of the canvas element, usefull for the transition class
+ */
+ public function getVisibleWidth():Number;
+
+ public function getVisibleHeight():Number;
+
+
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/PropertyInspector.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/PropertyInspector.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/PropertyInspector.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,906 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.cv.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.*
+import mx.controls.*
+import mx.utils.*
+import mx.managers.*
+import mx.events.*
+/*
+*
+* @author DC
+* @version 0.1
+* @comments Property Inspector for the canvas
+*
+*/
+class PropertyInspector extends MovieClip{
+
+ private var _canvasModel:CanvasModel;
+ private var _canvasController:CanvasController;
+ private var _dictionary:Dictionary;
+ //References to components + clips
+ private var _container:MovieClip; //The container window that holds the dialog. Will contain any init params that were passed into createPopUp
+ //private var PI_sp:MovieClip;
+ //private var PI_mc:MovieClip;
+ private var _tm:ThemeManager;
+ private var toolDisplayName_lbl:Label;
+ private var _depth:Number;
+
+ //Properties tab
+ private var title_lbl:Label;
+ private var title_txt:TextInput;
+ private var desc_lbl:Label;
+ private var desc_txt:TextInput;
+
+ private var grouping_lbl:Label;
+ private var currentGrouping_lbl:Label;
+ private var appliedGroupingActivity_cmb:ComboBox;
+
+ private var editGrouping_btn:Button;
+ private var runOffline_chk:CheckBox;
+ private var defineLater_chk:CheckBox;
+
+ //gates
+ private var gateType_lbl:Label;
+ private var gateType_cmb:ComboBox;
+ private var startOffset_lbl:Label;
+ private var endOffset_lbl:Label;
+ private var hours_lbl:Label;
+ private var mins_lbl:Label;
+ private var hours_stp:NumericStepper;
+ private var mins_stp:NumericStepper;
+ private var endHours_stp:NumericStepper;
+ private var endMins_stp:NumericStepper;
+
+ //grouping
+ private var groupType_lbl:Label;
+ private var numGroups_lbl:Label;
+ private var numLearners_lbl:Label;
+ private var groupType_cmb:ComboBox;
+ private var numGroups_rdo:RadioButton;
+ private var numLearners_rdo:RadioButton;
+ private var rndGroup_radio:RadioButtonGroup;
+ private var numGroups_stp:NumericStepper;
+ private var numLearners_stp:NumericStepper;
+
+ //Complex Activity
+ private var min_lbl:Label;
+ private var max_lbl:Label;
+ private var min_act:ComboBox;
+ private var max_act:ComboBox;
+
+ //screen assets:
+ private var body_pnl:Label;
+ private var bar_pnl:Label;
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ /**
+ * Constructor
+ */
+ function PropertyInspector(){
+ //register to recive updates form the model
+ Debugger.log('Constructor',Debugger.GEN,'PropertyInspector','PropertyInspector');
+ _tm = ThemeManager.getInstance();
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+
+ _dictionary = Dictionary.getInstance();
+ //_dictionary.addEventListener('init',Proxy.create(this,setupLabels));
+ }
+
+ public function init():Void{
+
+ //var yPos:Number = 0;
+ _depth = this.getNextHighestDepth();
+ //set SP the content path:
+ //PI_sp.contentPath = "empty_mc";
+ //PI_mc = PI_sp.content.attachMovie("PI_items","PI_items",_depth++);
+
+ _canvasModel = _container._canvasModel;
+ _canvasController = _container._canvasController;
+ //_global.breakpoint();
+ _canvasModel.addEventListener('viewUpdate',this);
+
+ //Debugger.log('_canvasModel: ' + _canvasModel,Debugger.GEN,'init','PropertyInspector');
+
+ //set up handlers
+ title_txt.addEventListener("focusOut",this);
+ desc_txt.addEventListener("focusOut",this);
+ runOffline_chk.addEventListener("click",this);
+ defineLater_chk.addEventListener("click",this);
+
+ rndGroup_radio.addEventListener("click",Delegate.create(this,onGroupingMethodChange));
+ groupType_cmb.addEventListener("change",Delegate.create(this,onGroupTypeChange));
+ gateType_cmb.addEventListener("change",Delegate.create(this,onGateTypeChange));
+ appliedGroupingActivity_cmb.addEventListener("change",Delegate.create(this,onAppliedGroupingChange));
+ hours_stp.addEventListener("change",Delegate.create(this,onScheduleOffsetChange));
+ mins_stp.addEventListener("change",Delegate.create(this,onScheduleOffsetChange));
+ hours_stp.addEventListener("focusOut",Delegate.create(this,onScheduleOffsetChange));
+ mins_stp.addEventListener("focusOut",Delegate.create(this,onScheduleOffsetChange));
+ endHours_stp.addEventListener("change",Delegate.create(this,onScheduleOffsetChange));
+ endMins_stp.addEventListener("change",Delegate.create(this,onScheduleOffsetChange));
+ endHours_stp.addEventListener("focusOut",Delegate.create(this,onScheduleOffsetChange));
+ endMins_stp.addEventListener("focusOut",Delegate.create(this,onScheduleOffsetChange));
+ numGroups_stp.addEventListener("change",Delegate.create(this,updateGroupingMethodData));
+ numLearners_stp.addEventListener("change",Delegate.create(this,updateGroupingMethodData));
+ numLearners_stp.addEventListener("focusOut",Delegate.create(this,updateGroupingMethodData));
+ numGroups_stp.addEventListener("focusOut",Delegate.create(this,updateGroupingMethodData));
+
+ this.onEnterFrame = setupLabels;
+
+ }
+
+ public function setupLabels(){
+
+ //trace("I am in PI setupLabels")
+ //trace("PI_mc "+PI_mc)
+ gateType_lbl.text = Dictionary.getValue('trans_dlg_gatetypecmb');
+ hours_lbl.text = Dictionary.getValue('pi_hours');
+ mins_lbl.text = Dictionary.getValue('pi_mins');
+ startOffset_lbl.text = Dictionary.getValue('pi_start_offset');
+ endOffset_lbl.text = Dictionary.getValue('pi_end_offset');
+
+ groupType_lbl.text = Dictionary.getValue('pi_group_type');
+ numGroups_lbl.text = Dictionary.getValue('pi_num_groups');
+ numLearners_lbl.text = Dictionary.getValue('pi_num_learners');
+
+ //Properties tab
+ title_lbl.text = Dictionary.getValue('pi_lbl_title');
+ desc_lbl.text = Dictionary.getValue('pi_lbl_desc');
+ grouping_lbl.text = Dictionary.getValue('pi_lbl_group');
+ currentGrouping_lbl.text = Dictionary.getValue('pi_lbl_currentgroup');
+ defineLater_chk.label = Dictionary.getValue('pi_definelater');
+ runOffline_chk.label = Dictionary.getValue('pi_runoffline');
+
+ //Complex Activity
+ min_lbl.text = Dictionary.getValue('pi_min_act');
+ max_lbl.text = Dictionary.getValue('pi_max_act');
+
+ //populate the synch type combo:
+ gateType_cmb.dataProvider = Activity.getGateActivityTypes();
+ groupType_cmb.dataProvider = Grouping.getGroupingTypesDataProvider();
+
+ //Call to apply style to all the labels and input fields
+ setStyles();
+
+ //fire event to say we have loaded
+ _container.contentLoaded();
+ delete this.onEnterFrame;
+ //hide all the controls at startup
+ showGroupingControls(false);
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+
+
+ }
+
+ /**
+ * Recieves update events from the model.
+ * @usage
+ * @param event
+ * @return
+ */
+ public function viewUpdate(event:Object):Void{
+ //Debugger.log('Recived an Event dispather UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','PropertyInspector');
+ //Update view from info object
+
+ var cm:CanvasModel = event.target;
+
+ switch (event.updateType){
+ case 'SELECTED_ITEM' :
+ updateItemProperties(cm);
+ break;
+
+
+ default :
+ //Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView');
+ }
+
+ }
+
+ /**
+ * Get called when something is selected in the cavas.
+ * Updates the details in the property inspector widgets
+ * Depending on the type of item selected, different controls will be shown
+ * @usage
+ * @param cm
+ * @return
+ */
+ private function updateItemProperties(cm:CanvasModel):Void{
+ //try to cast the selected item to see what we have (instance of des not seem to work)
+ if(CanvasActivity(cm.selectedItem) != null){
+ // its a Canvas activity then
+ Debugger.log('Its a canvas activity',4,'updateItemProperties','PropertyInspector');
+ var ca = CanvasActivity(cm.selectedItem);
+ var a:Activity = ca.activity;
+ if(a.isGateActivity()){
+ //its a gate
+
+ showGroupingControls(false);
+ showToolActivityControls(false);
+ showOptionalControls(false);
+ showGateControls(true);
+ showAppliedGroupingControls(true);
+ //showGeneralProperties(a)
+ showGateActivityProperties(GateActivity(a));
+ checkEnableGateControls();
+ showAppliedGroupingProperties(a);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ showGeneralControls(true);
+ //PI_sp.refreshPane();
+ }else if(a.isGroupActivity()){
+ //its a grouping activity
+
+ showGroupingControls(true);
+ showGeneralControls(true);
+ showOptionalControls(false);
+ showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(true);
+ //showGeneralProperties(a)
+ populateGroupingProperties(GroupingActivity(a));
+ showAppliedGroupingProperties(a);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ //PI_sp.refreshPane();
+
+ }else{
+ //its a tool activity
+
+ showOptionalControls(false);
+ showGeneralControls(true);
+ showGroupingControls(false);
+ showToolActivityControls(true);
+ showGateControls(false);
+ showAppliedGroupingControls(true);
+ showToolActivityProperties(ToolActivity(a));
+ //showGeneralProperties(a)
+ showAppliedGroupingProperties(a);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ //PI_sp.refreshPane();
+ }
+
+
+ }else if(CanvasOptionalActivity(cm.selectedItem) != null){
+ var co = CanvasOptionalActivity(cm.selectedItem);
+ var cca:ComplexActivity = ComplexActivity(co.activity);
+ //its an optional activity
+ showOptionalControls(true);
+ showGeneralControls(true);
+ showGroupingControls(false);
+ //showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(true);
+ //showGeneralProperties(cca)
+ populateGroupingProperties(GroupingActivity(cca));
+ showAppliedGroupingProperties(cca);
+ showOptionalActivityProperties(cca);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(cca.title);
+ desc_txt.text = StringUtils.cleanNull(cca.description);
+ //PI_sp.refreshPane();
+ }else if(CanvasParallelActivity(cm.selectedItem) != null){
+ var co = CanvasParallelActivity(cm.selectedItem);
+ var cca:ComplexActivity = ComplexActivity(co.activity);
+ //its an parallel activity
+ showOptionalControls(false);
+ showGeneralControls(true);
+ showGroupingControls(false);
+ //showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(true);
+ //showGeneralProperties(cca)
+ populateGroupingProperties(GroupingActivity(cca));
+ showAppliedGroupingProperties(cca);
+ showParallelActivityProperties(cca);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(cca.title);
+ desc_txt.text = StringUtils.cleanNull(cca.description);
+ }else if(CanvasTransition(cm.selectedItem) != null){
+ var ct = CanvasTransition(cm.selectedItem);
+ var t:Transition = ct.transition;
+ Debugger.log('Its a canvas transition',4,'updateItemProperties','PropertyInspector');
+
+ showTransitionProperties(t);
+ //showGeneralProperties(t)
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showGroupingControls(false);
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+ //PI_sp.complete;
+
+ }else{
+ Debugger.log('Its a something we dont know',Debugger.CRITICAL,'updateItemProperties','PropertyInspector');
+ showGroupingControls(false);
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+
+ //PI_sp.complete
+ }
+ }
+
+ private function showToolActivityControls(v:Boolean){
+
+
+ //desc_lbl.visible = v;
+ //desc_txt.visible = v;
+ grouping_lbl.visible = v;
+ currentGrouping_lbl.visible = v;
+ runOffline_chk.visible = v;
+ defineLater_chk.visible = v;
+ editGrouping_btn.visible = v;
+ }
+
+
+ private function showGeneralControls(v:Boolean){
+
+ title_lbl.visible = v;
+ title_txt.visible = v;
+ desc_lbl.visible = v;
+ desc_txt.visible = v;
+ }
+
+ private function showOptionalControls(v:Boolean){
+
+ min_lbl.visible = v;
+ max_lbl.visible = v;
+ min_act.visible = v;
+ max_act.visible = v;
+
+
+ }
+
+ private function showGateControls(v:Boolean){
+ trace('showGateControls....'+v);
+ hours_lbl.visible = v;
+ mins_lbl.visible = v;
+ hours_stp.visible = v;
+ mins_stp.visible = v;
+ endHours_stp.visible = v;
+ endMins_stp.visible = v;
+ gateType_lbl.visible = v;
+ gateType_cmb.visible = v;
+ startOffset_lbl.visible = v;
+ endOffset_lbl.visible = v;
+
+ }
+
+ /**
+ * Shows or hides the app.lied grouping
+ * AND title fields
+ * @usage
+ * @param v
+ * @return
+ */
+ private function showAppliedGroupingControls(v:Boolean){
+ trace('show grp controls.....'+v);
+ grouping_lbl.visible = v;
+ appliedGroupingActivity_cmb.visible = v;
+
+
+
+ }
+
+ private function showGroupingControls(v:Boolean){
+ //grouping
+ groupType_lbl.visible = v;
+ groupType_cmb.visible = v;
+ if(v){
+ showRelevantGroupOptions();
+ }else{
+ numGroups_lbl.visible = v;
+ numLearners_lbl.visible = v;
+ numGroups_rdo.visible = v;
+ numLearners_rdo.visible = v;
+ numGroups_stp.visible = v;
+ numLearners_stp.visible = v;
+
+ }
+
+ }
+
+ private function showToolActivityProperties(ta:ToolActivity){
+
+
+ toolDisplayName_lbl.text = StringUtils.cleanNull(ta.toolDisplayName);
+ //title_txt.text = StringUtils.cleanNull(ta.title);
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ runOffline_chk.selected = ta.runOffline;
+ defineLater_chk.selected = ta.defineLater;
+
+ currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ta.runOffline.groupingUIID);
+
+
+ }
+
+ private function showGeneralProperties(ta:ToolActivity){
+
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ }
+
+ private function showOptionalActivityProperties(ca:ComplexActivity){
+
+
+ toolDisplayName_lbl.text = Dictionary.getValue('pi_optional_title');
+ //title_txt.text = StringUtils.cleanNull(ta.title);
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ runOffline_chk.selected = ca.runOffline;
+ defineLater_chk.selected = ca.defineLater;
+
+ currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ca.runOffline.groupingUIID);
+
+
+ }
+
+ private function showParallelActivityProperties(ca:ComplexActivity){
+
+
+ toolDisplayName_lbl.text = Dictionary.getValue('pi_parallel_title');
+ //title_txt.text = StringUtils.cleanNull(ta.title);
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ runOffline_chk.selected = ca.runOffline;
+ defineLater_chk.selected = ca.defineLater;
+
+ currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ca.runOffline.groupingUIID);
+
+
+ }
+
+ private function showGateActivityProperties(ga:GateActivity){
+ toolDisplayName_lbl.text = Dictionary.getValue('pi_activity_type_gate');
+ //loop through combo to find SI of our gate activity type
+ for (var i=0; i"
+ gateType_lbl.text = Dictionary.getValue('trans_dlg_gatetypecmb');
+ days_lbl.text = Dictionary.getValue('pi_days');
+ hours_lbl.text = Dictionary.getValue('pi_hours');
+ mins_lbl.text = Dictionary.getValue('pi_mins');
+ hoursEnd_lbl.text = Dictionary.getValue('pi_hours');
+ minsEnd_lbl.text = Dictionary.getValue('pi_mins');
+ startOffset_lbl.text = Dictionary.getValue('pi_start_offset');
+ endOffset_lbl.text = Dictionary.getValue('pi_end_offset');
+
+ groupType_lbl.text = Dictionary.getValue('pi_group_type');
+ numGroups_lbl.text = Dictionary.getValue('pi_num_groups');
+ numLearners_lbl.text = Dictionary.getValue('pi_num_learners');
+
+ //Properties tab
+ title_lbl.text = Dictionary.getValue('pi_lbl_title');
+ desc_lbl.text = Dictionary.getValue('pi_lbl_desc');
+ grouping_lbl.text = Dictionary.getValue('pi_lbl_group');
+ //grouping_opt_lbl.text = Dictionary.getValue('pi_lbl_group');
+ currentGrouping_lbl.text = Dictionary.getValue('pi_lbl_currentgroup');
+ defineLater_chk.label = Dictionary.getValue('pi_definelater');
+ runOffline_chk.label = Dictionary.getValue('pi_runoffline');
+
+ //Complex Activity
+ min_lbl.text = Dictionary.getValue('pi_min_act');
+ max_lbl.text = Dictionary.getValue('pi_max_act');
+
+ //populate the synch type combo:
+ gateType_cmb.dataProvider = Activity.getGateActivityTypes();
+ groupType_cmb.dataProvider = Grouping.getGroupingTypesDataProvider();
+
+ //Call to apply style to all the labels and input fields
+ setStyles();
+
+ //fire event to say we have loaded
+
+ delete this.onEnterFrame;
+ //hide all the controls at startup
+
+ delimitLine._visible = false;
+ hideAllSteppers(false);
+ showGroupingControls(false);
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+ showGeneralInfo(true);
+
+ dispatchEvent({type:'load',target:this});
+ }
+ private function hideAllSteppers(v):Void{
+ hours_stp.visible = v
+ mins_stp.visible = v
+ endHours_stp.visible = v
+ endMins_stp.visible = v
+ numGroups_stp.visible = v
+ numRandomGroups_stp.visible = v
+ numLearners_stp.visible = v
+ minAct_stp.visible = v
+ maxAct_stp.visible = v
+ }
+
+ private function setTabIndex(selectedTab:String){
+
+ //Tool Activities
+ title_txt.tabIndex = 401
+ applied_grouping_lbl.tabIndex = 402
+ appliedGroupingActivity_cmb.tabIndex = 402
+ runOffline_chk.tabIndex = 403
+ defineLater_chk.tabIndex = 404
+
+ //Optional Activities
+ desc_txt.tabIndex = 402
+ minAct_stp.tabIndex = 403
+ maxAct_stp.tabIndex = 404
+
+ //Gate Activities
+ //gateType_cmb.enabled = true
+ gateType_cmb.tabIndex = 402
+ days_stp.tabIndex = 403
+ hours_stp.tabIndex = 404
+ mins_stp.tabIndex = 405
+ endHours_stp.tabIndex = 406
+ endMins_stp.tabIndex = 407
+
+ //Grouping Activities
+ //groupType_cmb.enabled = true
+ groupType_cmb.tabIndex = 402
+ numGroups_stp.tabIndex = 403
+ numGroups_rdo.tabIndex = 404
+ numRandomGroups_stp.tabIndex = 405
+ numLearners_rdo.tabIndex = 406
+ numLearners_stp.tabIndex = 407
+
+ }
+
+ public function localOnRelease():Void{
+
+ if (_piIsExpended){
+ trace("P Pressed in 'localOnRelease' and _piIsExpended is: "+_piIsExpended)
+ _piIsExpended = false
+ _canvasModel.setPIHeight(piHeightHide);
+ showExpand(true);
+
+ }else {
+ trace("P Pressed in 'localOnRelease' and _piIsExpended is: "+_piIsExpended)
+ _piIsExpended = true
+ _canvasModel.setPIHeight(piHeightFull);
+ showExpand(false);
+ //Application.getInstance().onResize();
+ }
+ }
+
+ public function isPIExpanded():Boolean{
+ return _piIsExpended;
+ }
+
+ public function piFullHeight():Number{
+ return piHeightFull;
+ }
+
+
+ public function showExpand(e:Boolean){
+
+ //show hide the icons
+ expand_mc._visible = e;
+ collapse_mc._visible = !e;
+
+ }
+
+ public function localOnReleaseOutside():Void{
+ Debugger.log('Release outside so no event has been fired, current state is: ' + _piIsExpended,Debugger.GEN,'localOnReleaseOutside','PropertyInspectorNew');
+
+ }
+ /**
+ * Recieves update events from the model.
+ * @usage
+ * @param event
+ * @return
+ */
+ public function viewUpdate(event:Object):Void{
+ Debugger.log('Recived an Event dispather UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','PropertyInspectorNew');
+ //Update view from info object
+
+ var cm:CanvasModel = event.target;
+
+ switch (event.updateType){
+ case 'SELECTED_ITEM' :
+ //title_txt.setFocus();
+ updateItemProperties(cm);
+
+ break;
+
+
+ default :
+ //Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView');
+ }
+
+ }
+
+ /**
+ * Get called when something is selected in the cavas.
+ * Updates the details in the property inspector widgets
+ * Depending on the type of item selected, different controls will be shown
+ * @usage
+ * @param cm
+ * @return
+ */
+ private function updateItemProperties(cm:CanvasModel):Void{
+ //try to cast the selected item to see what we have (instance of des not seem to work)
+ if(CanvasActivity(cm.selectedItem) != null){
+ cover_pnl.visible = false;
+ // its a Canvas activity then
+ Debugger.log('Its a canvas activity',4,'updateItemProperties','PropertyInspector');
+ var ca = CanvasActivity(cm.selectedItem);
+ var a:Activity = ca.activity;
+ var cao = CanvasOptionalActivity(cm.selectedItem);
+ var cap = CanvasParallelActivity(cm.selectedItem);
+ var caco:ComplexActivity = ComplexActivity(cao.activity);
+ var cacp:ComplexActivity = ComplexActivity(cap.activity);
+ if(a.isGateActivity()){
+ //its a gate
+ delimitLine._visible = true;
+ showGroupingControls(false);
+ showToolActivityControls(false);
+ showGeneralInfo(false);
+ showOptionalControls(false);
+ showGateControls(true, !a.readOnly);
+ showAppliedGroupingControls(false);
+ //showGeneralProperties(a)
+ checkEnableGateControls();
+ showGateActivityProperties(GateActivity(a));
+
+ showAppliedGroupingProperties(a);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ showGeneralControls(true, !a.readOnly);
+
+ //PI_sp.refreshPane();
+ }else if(a.isGroupActivity()){
+ //its a grouping activity
+ delimitLine._visible = true;
+ showGroupingControls(true, !a.readOnly);
+ showGeneralControls(true, !a.readOnly);
+ showOptionalControls(false);
+ showGeneralInfo(false);
+ showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+ //showGeneralProperties(a)
+ populateGroupingProperties(GroupingActivity(a));
+ showAppliedGroupingProperties(a);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ //PI_sp.refreshPane();
+
+ }else if(a.isOptionalActivity()){
+ //its a grouping activity
+ delimitLine._visible = true;
+
+ showGeneralControls(true, !a.readOnly);
+ showGroupingControls(false);
+ //showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showGeneralInfo(false);
+ showAppliedGroupingControls(false);
+ showOptionalControls(true, !a.readOnly);
+ //showGeneralProperties(cca)
+ populateGroupingProperties(GroupingActivity(caco));
+ showAppliedGroupingProperties(caco);
+ showOptionalActivityProperties(caco);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ //PI_sp.refreshPane();
+ }else if(a.isParallelActivity()){
+ //its a grouping activity
+ delimitLine._visible = true;
+ //its an parallel activity
+ showOptionalControls(false);
+ showGeneralControls(true, !a.readOnly);
+ showGeneralInfo(false);
+ showGroupingControls(false);
+ //showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(true, !a.readOnly);
+ //showGeneralProperties(cca)
+ populateGroupingProperties(GroupingActivity(cacp));
+ showAppliedGroupingProperties(cacp);
+ showParallelActivityProperties(cacp);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ }else{
+ //its a tool activity
+ delimitLine._visible = true;
+ showOptionalControls(false);
+ showGeneralControls(true, !a.readOnly);
+ showGroupingControls(false);
+ showGeneralInfo(false);
+ showAppliedGroupingControls(true, !a.readOnly);
+ showToolActivityControls(true, !a.readOnly);
+ showGateControls(false);
+ //showAppliedGroupingControls(true);
+ showToolActivityProperties(ToolActivity(a));
+ //showGeneralProperties(a)
+ showAppliedGroupingProperties(a);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(a.title);
+ desc_txt.text = StringUtils.cleanNull(a.description);
+ //PI_sp.refreshPane();
+ }
+
+
+ }else if(CanvasOptionalActivity(cm.selectedItem) != null){
+ cover_pnl.visible = false;
+ var co = CanvasOptionalActivity(cm.selectedItem);
+ var cca:ComplexActivity = ComplexActivity(co.activity);
+ //its an optional activity
+ delimitLine._visible = true;
+
+ showGeneralControls(true, !co.activity.readOnly);
+ showGroupingControls(false);
+ //showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showGeneralInfo(false);
+ showAppliedGroupingControls(false);
+ showOptionalControls(true, !co.activity.readOnly);
+ //showGeneralProperties(cca)
+ populateGroupingProperties(GroupingActivity(cca));
+ showAppliedGroupingProperties(cca);
+ showOptionalActivityProperties(cca);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(cca.title);
+ desc_txt.text = StringUtils.cleanNull(cca.description);
+ //PI_sp.refreshPane();
+ }else if(CanvasParallelActivity(cm.selectedItem) != null){
+ cover_pnl.visible = false;
+ var co = CanvasParallelActivity(cm.selectedItem);
+ var cca:ComplexActivity = ComplexActivity(co.activity);
+ delimitLine._visible = true;
+ //its an parallel activity
+ showOptionalControls(false);
+ showGeneralControls(true, !co.activity.readOnly);
+ showGeneralInfo(false);
+ showGroupingControls(false);
+ //showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(true, !co.activity.readOnly);
+ //showGeneralProperties(cca)
+ populateGroupingProperties(GroupingActivity(cca));
+ showAppliedGroupingProperties(cca);
+ showParallelActivityProperties(cca);
+ //show the title
+ title_txt.text = StringUtils.cleanNull(cca.title);
+ desc_txt.text = StringUtils.cleanNull(cca.description);
+ }else if(CanvasTransition(cm.selectedItem) != null){
+ cover_pnl.visible = false;
+ var ct = CanvasTransition(cm.selectedItem);
+ var t:Transition = ct.transition;
+ Debugger.log('Its a canvas transition',4,'updateItemProperties','PropertyInspector');
+ delimitLine._visible = false;
+ showTransitionProperties(t);
+ //showGeneralProperties(t)
+ showGeneralInfo(false);
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showGroupingControls(false);
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+ //PI_sp.complete;
+
+ }else{
+ cover_pnl.visible = false;
+ Debugger.log('Its a something we dont know',Debugger.CRITICAL,'updateItemProperties','PropertyInspector');
+ showGeneralInfo(true);
+ delimitLine._visible = false;
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" "//Dictionary.getValue('pi_title_generalinfo');
+ showGroupingControls(false);
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showRelevantGroupOptions();
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+
+ //PI_sp.complete
+ }
+ }
+
+ private function showToolActivityControls(v:Boolean, e:Boolean){
+
+
+ //desc_lbl.visible = v;
+ //desc_txt.visible = v;
+ var a = _canvasModel.selectedItem.activity;
+ var parentAct = _canvasModel.getCanvas().ddm.getActivityByUIID(a.parentUIID)
+ if (a.parentUIID != null && parentAct.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE) {
+ applied_grouping_lbl.visible = v
+ appliedGroupingActivity_cmb.visible = false;
+
+ applied_grouping_lbl.enabled = e;
+
+ }else {
+ applied_grouping_lbl.visible = false
+ appliedGroupingActivity_cmb.visible = v;
+
+ appliedGroupingActivity_cmb.enabled = e;
+
+ }
+
+
+ grouping_lbl.visible = v;
+ currentGrouping_lbl.visible = v;
+ runOffline_chk.visible = v;
+ defineLater_chk.visible = v;
+ editGrouping_btn.visible = v;
+
+ if(e != null) {
+ grouping_lbl.enabled = e;
+ currentGrouping_lbl.enabled = e;
+ runOffline_chk.enabled = e;
+ defineLater_chk.enabled = e;
+ editGrouping_btn.enabled = e;
+ }
+ }
+
+
+ private function showGeneralInfo(v:Boolean, e:Boolean){
+ total_num_activities_lbl.visible = v;
+ total_num_activities_lbl.enabled = (e != null) ? e : true;
+ }
+
+ private function showGeneralControls(v:Boolean, e:Boolean){
+
+ title_lbl.visible = v;
+ title_txt.visible = v;
+
+ if(e != null) {
+ title_lbl.enabled = e;
+ title_txt.enabled = e;
+ }
+ }
+
+ private function showOptionalControls(v:Boolean, e:Boolean){
+
+ min_lbl.visible = v;
+ max_lbl.visible = v;
+ minAct_stp.visible = v;
+ maxAct_stp.visible = v;
+ desc_lbl.visible = v;
+ desc_txt.visible = v;
+
+ if(e != null) {
+ min_lbl.enabled = e;
+ max_lbl.enabled = e;
+ minAct_stp.enabled = e;
+ maxAct_stp.enabled = e;
+ desc_lbl.enabled = e;
+ desc_txt.enabled = e;
+ }
+
+ grouping_lbl.visible = false;
+
+
+ }
+
+ private function showGateControls(v:Boolean, e:Boolean){
+ days_lbl.visible = v;
+ hours_lbl.visible = v;
+ mins_lbl.visible = v;
+ hoursEnd_lbl.visible = v;
+ minsEnd_lbl.visible = v;
+ days_stp.visible = v;
+ hours_stp.visible = v;
+ mins_stp.visible = v;
+ gateType_lbl.visible = v;
+ gateType_cmb.visible = v;
+ startOffset_lbl.visible = v;
+
+ if(e != null) {
+ days_lbl.enabled = e;
+ hours_lbl.enabled = e;
+ mins_lbl.enabled = e;
+ hoursEnd_lbl.enabled = e;
+ minsEnd_lbl.enabled = e;
+ days_stp.enabled = e;
+ hours_stp.enabled = e;
+ mins_stp.enabled = e;
+ gateType_lbl.enabled = e;
+ gateType_cmb.enabled = e;
+ startOffset_lbl.enabled = e;
+ }
+
+ }
+
+ /**
+ * Shows or hides the app.lied grouping
+ * AND title fields
+ * @usage
+ * @param v
+ * @return
+ */
+ private function showAppliedGroupingControls(v:Boolean, e:Boolean){
+ grouping_lbl.visible = v;
+ appliedGroupingActivity_cmb.visible = v;
+
+ if(e != null) {
+ grouping_lbl.enabled = e;
+ appliedGroupingActivity_cmb.enabled = e;
+ }
+
+ }
+
+ private function checkEnabledGroupControl(){
+ var ca = _canvasModel.selectedItem;
+ var parentAct = _canvasModel.getCanvas().ddm.getActivityByUIID(ca.activity.parentUIID)
+ if (ca.activity.parentUIID != null && parentAct.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE) {
+ appliedGroupingActivity_cmb.enabled = false;
+ }else {
+ appliedGroupingActivity_cmb.enabled = false;
+ }
+ }
+
+ private function showGroupingControls(v:Boolean, e:Boolean){
+ //grouping
+ groupType_lbl.visible = v;
+ groupType_cmb.visible = v;
+ if(v){
+ showRelevantGroupOptions();
+ }else{
+ numGroups_lbl.visible = v;
+ numLearners_lbl.visible = v;
+ numGroups_rdo.visible = v;
+ numLearners_rdo.visible = v;
+ numGroups_stp.visible = v;
+ numRandomGroups_stp.visible = v;
+ numLearners_stp.visible = v;
+
+ }
+
+ }
+
+ private function showToolActivityProperties(ta:ToolActivity){
+
+
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+StringUtils.cleanNull(ta.toolDisplayName);
+ //title_txt.text = StringUtils.cleanNull(ta.title);
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ runOffline_chk.selected = ta.runOffline;
+ defineLater_chk.selected = ta.defineLater;
+
+ currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ta.runOffline.groupingUIID);
+
+
+ }
+
+ private function showGeneralProperties(ta:ToolActivity){
+
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ }
+
+ private function showOptionalActivityProperties(ca:ComplexActivity){
+
+
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_optional_title');
+ //title_txt.text = StringUtils.cleanNull(ta.title);
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ runOffline_chk.selected = ca.runOffline;
+ defineLater_chk.selected = ca.defineLater;
+ trace("min options when starting: "+ca.minOptions)
+ if (ca.minOptions == undefined){
+ minAct_stp.value = 0
+ }else{
+ minAct_stp.value = ca.minOptions
+ }
+
+ if (ca.maxOptions == undefined){
+ maxAct_stp.value = 0
+ }else{
+ maxAct_stp.value = ca.maxOptions
+ }
+ currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ca.runOffline.groupingUIID);
+
+
+ }
+
+ private function updateOptionalData(){
+ var oa = _canvasModel.selectedItem.activity;
+ var o = ComplexActivity(oa);
+ o.minOptions = minAct_stp.value;
+ o.maxOptions = maxAct_stp.value;
+ oa.init();
+
+ setModified();
+ }
+
+ private function showParallelActivityProperties(ca:ComplexActivity){
+
+
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_parallel_title');
+ //title_txt.text = StringUtils.cleanNull(ta.title);
+ //desc_txt.text = StringUtils.cleanNull(ta.description);
+ runOffline_chk.selected = ca.runOffline;
+ defineLater_chk.selected = ca.defineLater;
+
+ currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ca.runOffline.groupingUIID);
+
+
+ }
+
+ private function showGateActivityProperties(ga:GateActivity){
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_activity_type_gate');
+ //loop through combo to find SI of our gate activity type
+ trace("gate Type is: "+ga.activityTypeID)
+ for (var i=0; i - "+Dictionary.getValue('pi_activity_type_grouping');
+ Debugger.log('This is the grouping object:',Debugger.GEN,'populateGroupingProperties','PropertyInspector');
+ ObjectUtils.printObject(g);
+ //loop through combo to fins SI of our gate activity type
+ for (var i=0; i= menuList.length-2){
+ _toolbarMenu[i]._x = this.flow_btn._x;
+ _toolbarMenu[i]._y = (_toolbarMenu[i-1]._y+_toolbarMenu[i-1].height)+btnOffset_Y
+ }
+
+ if (i == menuList.length){
+ btn_text.removeTextField();
+ }
+
+ }
+
+
+ }
+
+ }
+
+ private function getToolbarButtonXPos(toolbarMenu:Array, i:Number, count:Number):Number {
+ var _count:Number = count;
+
+ if(toolbarMenu[i] == null && i >= 0) {
+ _count++;
+ return getToolbarButtonXPos(toolbarMenu, i-1, _count);
+ } else if(toolbarMenu[i] != null) {
+ return (_count > 1) ? (toolbarMenu[i]._x+toolbarMenu[i].width)+btnOffset_X+(_count*SPACER_WIDTH) : (toolbarMenu[i]._x+toolbarMenu[i].width)+btnOffset_X;
+ } else {
+ return btnOffset_X;
+ }
+
+ }
+
+ /*
+ * Updates state of the Toolbar, called by Toolbar Model
+ *
+ * @param o The model object that is broadcasting an update.
+ * @param infoObj object with details of changes to model
+ */
+ public function update (o:Observable,infoObj:Object):Void {
+ //Cast the generic observable object into the Toolbar model.
+ var tm:ToolbarModel = ToolbarModel(o);
+
+ //Update view from info object
+ switch (infoObj.updateType) {
+ case 'POSITION' :
+ setPosition(tm);
+ break;
+ case 'SIZE' :
+ setSize(tm);
+ break;
+ case 'BUTTON' :
+ setState(tm, infoObj);
+ break;
+ case 'SETMENU' :
+ setupButtons(tm, infoObj.data);
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.ToolbarView');
+ }
+ }
+
+ /**
+ * Sets the botton state of the Toolbar on stage, called from update
+ */
+ private function setState(tm:ToolbarModel, infoObj:Object):Void{
+ Debugger.log('button name in setButtonState is : '+infoObj.button, Debugger.GEN,'setState','ToolbarView');
+ if (infoObj.button == "preview"){
+
+ this.preview_btn.enabled = infoObj.buttonstate;
+ }
+ }
+
+ public function showToolTip(btnObj, btnTT:String):Void{
+ var Xpos = Application.TOOLBAR_X+ btnObj._x;
+ var Ypos = (Application.TOOLBAR_Y+ btnObj._y+btnObj.height)+5;
+ var ttHolder = Application.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ /**
+ * Sets the size of the Toolbar on stage, called from update
+ */
+ private function setSize(tm:ToolbarModel):Void{
+
+ var s:Object = tm.getSize();
+ //Size panel
+ trace('toolbar view setting width to '+s.w);
+ bkg_pnl.setSize(s.w,bkg_pnl._height);
+ }
+
+ /**
+ * Sets the position of the Toolbar on stage, called from update
+ * @param tm Toolbar model object
+ */
+ private function setPosition(tm:ToolbarModel):Void{
+ var p:Object = tm.getPosition();
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ /**
+ * Set the styles for the PI called from init. and themeChanged event handler
+ */
+ private function setStyles() {
+
+ var styleObj = _tm.getStyleObject('button');
+ new_btn.setStyle('styleName',styleObj);
+ open_btn.setStyle('styleName',styleObj);
+ save_btn.setStyle('styleName',styleObj);
+ apply_changes_btn.setStyle('styleName', styleObj);
+ copy_btn.setStyle('styleName',styleObj);
+ paste_btn.setStyle('styleName',styleObj);
+ trans_btn.setStyle('styleName',styleObj);
+ optional_btn.setStyle('styleName',styleObj);
+ gate_btn.setStyle('styleName',styleObj);
+ flow_btn.setStyle('styleName',styleObj);
+ branch_btn.setStyle('styleName',styleObj);
+ group_btn.setStyle('styleName', styleObj);
+ preview_btn.setStyle('styleName',styleObj);
+ cancel_btn.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('BGPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('FlowPanel');
+ flow_bkg_pnl.setStyle('styleName',styleObj);
+
+ }
+
+ /**
+ * Overrides method in abstract view to ensure cortect type of controller is returned
+ * @usage
+ * @return ToolbarController
+ */
+ public function getController():ToolbarController{
+ var c:Controller = super.getController();
+ return ToolbarController(c);
+ }
+
+ /*
+ * Returns the default controller for this view.
+ */
+ public function defaultController (model:Observable):Controller {
+ return new ToolbarController(model);
+ }
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/TemplateActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/TemplateActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/TemplateActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,356 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.tk.*;
+import mx.controls.*;
+import mx.managers.*;
+import mx.events.*;
+
+/**
+* TemplateActivity -
+* these are the visual elements in the toolkit -
+* each one representing a LearningLibrary template activity
+*/
+class org.lamsfoundation.lams.authoring.tk.TemplateActivity extends MovieClip{
+
+ private var _tm:ThemeManager;
+ //private var Tip:ToolTip;
+ //private var ttHolder:MovieClip;
+ //Declarations
+ private var bkg_pnl:MovieClip;
+ private var title_lbl:Label;
+ private var select_btn:Button;
+ private var icon_mc:MovieClip;
+
+ private var _instance:TemplateActivity;
+ private var icon_mcl:MovieClipLoader;
+ private var _taPanelStyle:Object;
+ //this is set by the init object
+ //contains refs to the classInstances of the activities in this TemplateActivity
+ private var _activities:Array;
+ private var _mainActivity:Activity;
+ private var _childActivities:Array;
+ private var yPos:Number;
+
+ private var _toolkitView:ToolkitView;
+
+ /**
+ * Constructor - creates an onEnterFrame doLater call to init
+ */
+ function TemplateActivity() {
+
+ _tm = ThemeManager.getInstance();
+ _childActivities = new Array();
+ //Tip = new ToolTip();
+ //ttHolder = Application.tooltip;
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+ }
+
+ /**
+ * Initialises the class. set up button handlers
+ */
+ function init():Void{
+ _instance = this;
+
+ var tkv = ToolkitView(_toolkitView);
+
+
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+ //_global.breakpoint();
+ setStyles();
+ Debugger.log('_activities.length:'+_activities.length,Debugger.GEN,'init','TemplateActivity');
+ //find the 'main'/container activity
+ if(_activities.length > 1){
+ for (var i=0; i<_activities.length; i++){
+
+ if(_activities[i].activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE){
+ _mainActivity = _activities[i];
+ //SOMEBODY THINK OF THE CHILDREN!
+ setUpComplexActivity();
+
+ }
+ }
+ }else if(_activities.length == 1){
+ _mainActivity = _activities[0];
+ }else{
+ new LFError("The activities array recieved is not valid, maybe undefined","init",this);
+ //we must bail entirely now to prevent a crash or loop
+ this.removeMovieClip();
+ }
+
+
+
+
+ icon_mcl = new MovieClipLoader();
+ icon_mcl.addListener(this);
+
+ //Debugger.log('_toolkitView:'+_toolkitView.getClassname(),4,'init','TemplateActivity');
+ //set up the button handlers
+ select_btn.onPress = Proxy.create(this,this['select']);
+ select_btn.onRollOver = Proxy.create(this,this['rollOver']);
+ select_btn.onRollOut = Proxy.create(this,this['rollOut']);
+ //create an mc to hold th icon
+ icon_mc = this.createEmptyMovieClip("icon_mc",getNextHighestDepth());
+ loadIcon();
+
+
+ }
+
+ /*private function initTT(){
+
+ trace("ttHolder to pass: "+ttHolder)
+ var ttMessage:String = ""+_mainActivity.title+""+_mainActivity.description;
+ Tip = new ToolTip(ttHolder, ttMessage);
+ }*/
+ /**
+ * Populates the _childActivities array if this is a complex activity
+ * @usage
+ * @return
+ */
+ private function setUpComplexActivity(){
+ if(_mainActivity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE){
+ //populate the _childActivities hash
+ for(var i=0; i<_activities.length; i++){
+ if(_activities[i].parentActivityID == _mainActivity.activityID){
+ //TODO: Check they are tool activities, if not give a warning and bail.
+ _childActivities.push(_activities[i]);
+ }
+ }
+ }else{
+ new LFError("Cannot handle this activity type yet","setUpComplexActivity",this,'_mainActivity.activityTypeID:'+_mainActivity.activityTypeID);
+ }
+ }
+
+ /**
+ * Loads the icon for the temopate activity using a movieclip loader
+ *
+ */
+ private function loadIcon(loadDefaultIcon:Boolean):Void{
+ //Debugger.log('Loading icon:'+Config.getInstance().serverUrl+_toolActivity.libraryActivityUIImage,4,'loadIcon','TemplateActivity');
+ //TODO: Get URL from packet when its done.
+ //icon_mcl.loadClip(Config.getInstance().serverUrl+"images/icon_chat.swf",icon_mc);
+ if(loadDefaultIcon){
+ Debugger.log('Going to use default icon: images/icon_missing.swf',Debugger.GEN,'loadIcon','TemplateActivity');
+ //icon_missing.swf
+ _mainActivity.libraryActivityUIImage = "images/icon_missing.swf";
+ //icon_mcl.loadClip(Config.getInstance().serverUrl+"images/icon_missing.swf",icon_mc);
+
+ }
+ var icon_url = Config.getInstance().serverUrl+_mainActivity.libraryActivityUIImage;
+ Debugger.log('Loading icon:'+icon_url,4,'loadIcon','TemplateActivity');
+ icon_mcl.loadClip(icon_url,icon_mc);
+ }
+
+ /**
+ * Called by the MovieClip loader that loaded thie icon.
+ *
+ * @param icon_mc The target mc that got the loaded movie
+ */
+ private function onLoadInit(icon_mc:MovieClip):Void{
+ Debugger.log('icon_mc:'+icon_mc,4,'onLoadInit','TemplateActivity');
+ //now icon is loaded lets call draw to display the stuff
+ draw();
+ }
+
+ private function onLoadError(icon_mc:MovieClip,errorCode:String):Void{
+ switch(errorCode){
+
+ case 'URLNotFound' :
+ Debugger.log('TemplateActivity icon failed to load - URL is not found:'+icon_mc._url,Debugger.CRITICAL,'onLoadError','TemplateActivity');
+ break;
+ case 'LoadNeverCompleted' :
+ Debugger.log('TemplateActivity icon failed to load - Load never completed:'+icon_mc,Debugger.CRITICAL,'onLoadError','TemplateActivity');
+ break;
+ }
+
+ //if there was an error - try and load the missing.swf
+ loadIcon(true);
+ //draw();
+
+ }
+
+ /**
+ * Does the visual rendering work of this TemplateActivity
+ */
+ private function draw():Void{
+ var toolTitle:String = _mainActivity.title
+ if (toolTitle.length > 15){
+ toolTitle = toolTitle.substr(0, 15)+"..."
+ }
+
+ title_lbl.text= toolTitle;
+ //attach the icon now...
+ var ICON_OFFSETX = 3;
+ var ICON_OFFSETY = 6;
+ icon_mc._width = 20;
+ icon_mc._height = 20;
+ icon_mc._x = ICON_OFFSETX;
+ icon_mc._y = ICON_OFFSETY;
+
+ //initTT()
+ //toolTip.text = _mainActivity.title;
+ //Debugger.log('icon_mc._width:'+icon_mc._width,4,'draw','TemplateActivity');
+ //Debugger.log('icon_mc._height:'+icon_mc._height,4,'draw','TemplateActivity');
+ }
+
+ private function getAssociatedStyle():Object{
+ trace("Category ID for Activity "+_mainActivity.title +": "+_mainActivity.activityCategoryID)
+ var styleObj:Object = new Object();
+ switch (String(_mainActivity.activityCategoryID)){
+ case '0' :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ break;
+ case '1' :
+ styleObj = _tm.getStyleObject('ACTPanel1')
+ break;
+ case '2' :
+ styleObj = _tm.getStyleObject('ACTPanel2')
+ break;
+ case '3' :
+ styleObj = _tm.getStyleObject('ACTPanel3')
+ break;
+ case '4' :
+ styleObj = _tm.getStyleObject('ACTPanel4')
+ break;
+ case '5' :
+ styleObj = _tm.getStyleObject('ACTPanel5')
+ break;
+ default :
+ styleObj = _tm.getStyleObject('ACTPanel0')
+ }
+ return styleObj;
+ }
+
+ private function setStyles():Void{
+ Debugger.log('Running....',Debugger.GEN,'setStyles','TemplateActivity');
+ var styleObj;
+ _taPanelStyle = _tm.getStyleObject('TAPanel'); //getAssociatedStyle()
+ bkg_pnl.setStyle('styleName',_taPanelStyle);
+ styleObj = _tm.getStyleObject('label');
+ title_lbl.setStyle('styleName',styleObj);
+
+ }
+
+ /**
+ * Gets this TemplateActivity's data
+ */
+ public function get toolActivity():Object{
+ /*
+ //if we only have one element then return that cos it must be a single toolActiivity
+ if(_activities.length ==1){
+ return _mainActivity;
+ }else{
+ return new LFError("There is more than one item in the activities array, may be a complex activity - cant return a ToolActitiy","get toolActivity",this);
+ }
+ */
+ Debugger.log('This function is deprecated, use mainActivity instead',Debugger.MED,'getToolActivity','TemplateActivity');
+ return _mainActivity;
+
+ }
+
+ public function get mainActivity():Activity{
+ return _mainActivity;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newactivities
+ * @return
+ */
+ public function set activities (newactivities:Array):Void {
+ _activities = newactivities;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get activities ():Array {
+ return _activities;
+ }
+
+
+
+ public function setState(selected:Boolean):Void{
+ if(selected){
+ var _taSelectedPanelStyle = _tm.getStyleObject("TAPanelSelected");
+ bkg_pnl.setStyle("styleName", _taSelectedPanelStyle);
+ }else{
+ rollOut();
+ }
+ }
+
+ private function select():Void{
+ _toolkitView.hideToolTip();
+ var toolkitController = _toolkitView.getController();
+ toolkitController.selectTemplateActivity(this);
+ }
+
+ private function rollOver():Void{
+
+ var _taRolloverPanelStyle = _tm.getStyleObject("TAPanelRollover");
+
+ bkg_pnl.setStyle("styleName", _taRolloverPanelStyle);
+
+ var ttMessage:String = ""+_mainActivity.title+" \n"+_mainActivity.description;
+ var ttypos = yPos + select_btn._height
+ var ttxpos = 2
+ _toolkitView.showToolTip(ttMessage, ttxpos, ttypos);
+
+
+
+ }
+
+ private function rollOut():Void{
+ bkg_pnl.setStyle("styleName",_taPanelStyle);
+ _toolkitView.hideToolTip();
+ }
+
+
+ /**
+ *
+ * @usage
+ * @param newchildActivities
+ * @return
+ */
+ public function set childActivities (newchildActivities:Array):Void {
+ _childActivities = newchildActivities;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get childActivities ():Array {
+ return _childActivities;
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/Toolkit.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/Toolkit.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/Toolkit.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,316 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.tk.*;
+import org.lamsfoundation.lams.common.util.*;
+import mx.managers.*;
+
+/*
+* Toolit (formally Library) is where all the available tools are displayed.
+* Seen on the left hand side of the app.
+*/
+class Toolkit {
+ // Model
+ private var toolkitModel:ToolkitModel;
+ // View
+ private var toolkitView:ToolkitView;
+ private var toolkitView_mc:MovieClip;
+
+ private var _className:String = "Toolkit";
+
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+ /*
+ * Toolkit Constructor
+ *
+ * @param target_mc Target clip for attaching view
+ */
+ function Toolkit(target_mc:MovieClip,depth:Number,x:Number,y:Number){
+ mx.events.EventDispatcher.initialize(this);
+
+ //Create the model
+ toolkitModel = new ToolkitModel();
+
+ //Create the view
+ toolkitView_mc = target_mc.createChildAtDepth("toolkitView",DepthManager.kTop);
+ toolkitView_mc.addEventListener('load',Proxy.create(this,viewLoaded));
+
+ //Cast toolkit view clip as ToolkitView and initialise passing in model
+ toolkitView = ToolkitView(toolkitView_mc);
+ toolkitView.init(toolkitModel,undefined);
+
+ //Register view with model to receive update events
+ toolkitModel.addObserver(toolkitView);
+
+ //Set the position by setting the model which will call update on the view
+ toolkitModel.setPosition(x,y);
+
+ //Initialise size to the designed size
+ toolkitModel.setSize(toolkitView_mc._width,toolkitView_mc._height);
+
+ //go and get some toolkits
+ getToolkitLibraries();
+ }
+
+ /**
+ * Called by view when loaded
+ */
+ private function viewLoaded() {
+ //dispatch load event
+ Debugger.log('dispatching event',Debugger.GEN,'viewLoaded','Toolkit');
+ dispatchEvent({type:'load',target:this});
+ }
+
+
+ /*
+ * Gets the latest toolkit activities from the server.
+ * sets up a call back via comms object
+ *
+ */
+ public function getToolkitLibraries():Void{
+ Debugger.log('Running',4,'getToolkitActivities','Toolkit');
+
+ var callback:Function = Proxy.create(this,setToolkitLibraries);
+ //Application.getInstance().getComms().getRequest('flashxml/all_library_details.xml',callback,false);
+ //Application.getInstance().getComms().getRequest('http://dolly.uklams.net/lams/lams_authoring/liblist.xml',callback,true);
+ //TODO: sort out with the aussies what is going on with this structure
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getAllLearningLibraryDetails',callback);
+ }
+
+
+ /**
+ * Call back, get the response from getToolkitLibraries server call
+ * @usage
+ * @param toolkits
+ * @return
+ */
+ public function setToolkitLibraries(toolkits:Array):Void{
+
+ Debugger.log('Recieved toolkits array length:'+toolkits.length,4,'setToolkitActivities','Toolkit');
+ //TODO: Validate if correct data?
+ //go throught the recieved toolkits and make ToolActivities from them:
+ for(var i=0; i< toolkits.length; i++){
+ var toolkit:Object = toolkits[i];
+
+ var classInstanceRefs = new Array();
+ //loop through the template activities, there should only be one for LAMS 1.1
+ //but coding a loop so we can use it later
+
+ //this templateActivities array may contain other types, such as Parallel activities check with Fiona.
+
+ for(var j=0; j
+ toolAct.activityID = ta.activityID;
+ toolAct.activityTypeID = ta.activityTypeID;
+ toolAct.description = ta.description;
+ toolAct.helpText = ta.helpText;
+ //NOTE 09-11-05: this has changed from libraryActivityUiImage to libraryActivityUIImage
+ toolAct.libraryActivityUIImage = ta.libraryActivityUIImage;
+ toolAct.title = ta.title;
+ toolAct.learningLibraryID = toolkit.learningLibraryID;
+ //TODO get this field included in lib packet
+ toolAct.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
+
+ toolAct.authoringURL = ta.tool.authoringURL;
+ toolAct.toolContentID = ta.tool.toolContentID;
+ toolAct.toolID = ta.tool.toolID;
+ toolAct.toolDisplayName = ta.tool.toolDisplayName;
+ toolAct.supportsContribute = ta.tool.supportsContribute;
+ toolAct.supportsDefineLater = ta.tool.supportsDefineLater;
+ toolAct.supportsModeration = ta.tool.supportsModeration;
+ toolAct.supportsRunOffline = ta.tool.supportsRunOffline;
+
+ toolActivities.push(toolAct);
+ */
+ }
+
+ //put the instance ref array into the toolkit object
+ toolkit.classInstanceRefs = classInstanceRefs;
+ toolkit.activityTitle = classInstanceRefs[0].title;
+
+ }
+
+
+ //sets these in the toolkit model in a hashtable by lib id
+ toolkitModel.setToolkitLibraries(toolkits);
+
+
+
+ /**
+ * Returns the TemplateActivity as Toolactivity
+ * @usage
+ * @return ToolActivity
+ */
+
+ /*
+ function getAsToolActivity():ToolActivity{
+ activityUIID:Number,
+ activityTypeID:Number,
+ activityCategoryID:Number,
+ learningLibraryID:Number,
+ libraryActivityUIImage:String,
+ toolContentUIID:Number,
+ toolUIID:Number){
+
+
+ var myToolAct = new ToolActivity( _templateActivityData.activityUIID,
+ _templateActivityData.activityCategoryID,
+ _
+
+
+
+ );
+
+
+
+ }
+
+*/
+
+ }
+
+ /**
+ * Retrieves the defaultContentID for a given learning libraryID and toolID.
+ * It is the content ID that was in the library packet when it arrived
+ * @usage
+ * @param lid - The learning library id
+ * @param tid - The tool id
+ * @return default content ID
+ */
+ public function getDefaultContentID(lid:Number,tid:Number):Number{
+ var ll:Object = toolkitModel.getLearningLibrary(lid);
+ for (var i=0; i= optionalX && iconMouseX <= (optionalX + optionalWidth)){
+ if (iconMouseY >= optionalY && iconMouseY <= (optionalY + optionalHeight)){
+ isCanvasDrop = false;
+ dragIcon_mc.removeMovieClip();
+ trace("optional Container is hitted")
+ if (optionalOnCanvas[i].locked){
+ var msg:String = Dictionary.getValue('act_lock_chk');
+ LFMessage.showMessageAlert(msg);
+ }else{
+ trace("hit with optional")
+ var ta:TemplateActivity;
+ ta = _toolkitModel.getSelectedTemplateActivity();
+ cv.setDroppedTemplateActivity(ta, optionalOnCanvas[i].activity.activityUIID);
+ }
+ }
+ }
+ }
+ if(isCanvasDrop){
+
+ //remove the drag icon
+ dragIcon_mc.removeMovieClip();
+
+ var ta:TemplateActivity;
+ ta = _toolkitModel.getSelectedTemplateActivity();
+ Debugger.log('ta:'+ta.toolActivity.title,4,'canvasDrop','ToolkitController');
+ cv.setDroppedTemplateActivity(ta);
+ }
+ }
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitModel.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitModel.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitModel.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,246 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.Observable;
+import org.lamsfoundation.lams.authoring.tk.*;
+import org.lamsfoundation.lams.common.util.*;
+//import org.springsoft.aslib.*;
+
+/**
+* Model for the Toolbar
+*/
+class ToolkitModel extends Observable {
+ private var _className:String = "ToolkitModel";
+
+ private var __width:Number;
+ private var __height:Number;
+ private var __x:Number;
+ private var __y:Number;
+ private var _isDirty:Boolean;
+ private var infoObj:Object;
+
+ /**
+ * View state data
+ */
+ private var _currentlySelectedTemplateActivity:TemplateActivity;
+ private var _lastSelectedTemplateActivity:TemplateActivity;
+ private var _currentToolkitDescription:String;
+
+ /**
+ * Container for the Libraries. There maybe many template actvities per learning library.
+ * Currently (1.1) there is only ever one.
+ */
+ private var _toolkitLearningLibraries:Hashtable;
+
+ /**
+ * Constructor.
+ */
+ public function ToolkitModel(){
+ Debugger.log('Running',4,'Constructor','ToolkitModel');
+ _toolkitLearningLibraries = new Hashtable();
+ }
+
+ /**
+ * Sets the data for the toolkit (ToolkitLibraries). Called by the toolkit container. Sends the update to the view. (LIBRARIES_UPDATED
+ * @usage
+ * @param toolkits array of toolkits, also contains the classInstanceRefs array.
+ * @return
+ */
+ public function setToolkitLibraries(tls:Array):Boolean{
+ //Debugger.log('_className:'+_className,4,'setToolkitLibraryActivities','ToolkitModel');
+
+ //_global.breakpoint();
+ var updateOk:Boolean=false;
+ //clear the old lot:
+ _toolkitLearningLibraries.clear();
+
+ //sort the array
+ tls.sortOn("activityTitle", Array.CASEINSENSITIVE);
+
+ //populate the hashtable.
+ for(var i=0; i 25){
+ tkTitle = tkTitle.substr(0, 24)+"..."
+ }
+ title_lbl.text = ""+tkTitle+"";
+
+
+ }
+ /**
+ * Sets up the toolkit, its actually attached in toolkit.as
+ */
+ public function createToolkit():Void {
+ //Work out difference between scrollpane and panel (container) width
+ _scrollPanelWidthDiff = bkg_pnl.width - toolkitLibraries_sp.width;
+ delete this.onEnterFrame;
+ _depth = this.getNextHighestDepth();
+
+
+ setStyles();
+ //dispatch load event
+ dispatchEvent({type:'load',target:this});
+ //Debugger.log('_toolkit_mc.desc_panel:'+this.desc_panel,4,'createToolkit','ToolkitView');
+ //layoutToolkit();
+ }
+
+
+ /**
+ * Updates state of the tookit, called by the model
+ *
+ * @param o The model object that is broadcasting an update.
+ * @param infoObj object with details of changes to model. will contain one field "update type"
+ */
+ public function update (o:Observable,infoObj:Object):Void {
+ //Update view from info object
+ //Debugger.log('Recived an UPDATE!, updateType:'+infoObj.updateType,4,'update','ToolkitView');
+ switch (infoObj.updateType) {
+ case 'LIBRARIES_UPDATED' :
+ updateLibraries(o);
+ break;
+ case 'TEMPLATE_ACTIVITY_SELECTED' :
+ updateSelectedTemplateActivity(o);
+ break;
+ case 'SIZE' :
+ //set the size
+ setSize(o);
+ break;
+ case 'POSITION' :
+ //set the position of the clip based on the view
+ setPosition(o);
+ break;
+ default :
+ //TODO: DI-Deal with default case where button type is not caught
+ }
+ }
+
+ /**
+ * Change toolkit size
+ */
+ private function setSize(o:Observable):Void{
+ //Cast the observable instance into the model and get size info
+ var m = ToolkitModel(o);
+ var s:Object = m.getSize();
+ //Panel
+ bkg_pnl.setSize(s.w,s.h);
+ //Debugger.log('s.w:' + s.w,Debugger.GEN,'setSize','org.lamsfoundation.lams.ToolkitView');
+ //Debugger.log('s.h:' + s.h,Debugger.GEN,'setSize','org.lamsfoundation.lams.ToolkitView');
+ //Debugger.log('libraryActivityDesc_txa._y:' + libraryActivityDesc_txa._y,Debugger.GEN,'setSize','org.lamsfoundation.lams.ToolkitView');
+ //Debugger.log('libraryActivityDesc_txa.height:' + libraryActivityDesc_txa.height,Debugger.GEN,'setSize','org.lamsfoundation.lams.ToolkitView');
+
+ //Calculate scrollpane size
+ var spWidth:Number = s.w-_scrollPanelWidthDiff;
+ var spHeight:Number = s.h-(libraryActivityDesc_txa._y+libraryActivityDesc_txa.height)
+
+ //Scrollpane
+ if(spWidth > 0 && spHeight>0) {
+ toolkitLibraries_sp.setSize(spWidth,spHeight);
+ }
+
+ }
+
+ /**
+ * Set the toolkit position
+ */
+ private function setPosition(o:Observable):Void{
+ //Cast observable instance into model and get position and set it on clip
+ var m = ToolkitModel(o);
+ var p:Object = m.getPosition();
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ /**
+ * Updates learning library activities. Creates a templateActivity mc / class for each one.
+ * NOTE: Each library element contains an array of templateActivities.
+ * templateActivities array may contain just one ToolActivity, or a container activity
+ * like Parralel and corresponding child activities
+ *
+ * @param o The model object that is broadcasting an update.
+ */
+ private function updateLibraries(o:Observable){
+ //Debugger.log('Running',4,'updateLibraries','ToolkitView');
+
+ var yPos:Number = 0;
+
+ //set SP the content path:
+ toolkitLibraries_sp.contentPath = "empty_mc";
+
+ var tkv = ToolkitView(this);
+ var tkm = ToolkitModel(o);
+ //get the hashtable
+ var myLibs:Hashtable = tkm.getToolkitLibraries();
+
+ //loop through the libraries
+ var keys:Array = myLibs.keys();
+ //keys.sortOn("title", Array.CASEINSENSITIVE);
+ for(var i=0; i 1){
+ Debugger.log('Template activities library length is greater than 1, may be complex activity',Debugger.GEN,'updateLibraries','ToolkitView');
+ }
+
+ //NOW we pass in the whole array, as complex activities are supprted in this way
+ var activities:Array = learningLib.classInstanceRefs;
+ //Debugger.log('toolActivity '+ta.title+'('+ta.activityID+')',4,'updateLibraries','ToolkitView');
+ var templateActivity_mc = toolkitLibraries_sp.content.attachMovie("TemplateActivity","ta_"+learningLib.learningLibraryID,_depth++,{_activities:activities,_toolkitView:tkv, yPos:yPos});
+
+ //position it
+ templateActivity_mc._y = yPos;
+ yPos += templateActivity_mc._height;
+
+
+ }
+
+ //toolkitLibraries_sp.refreshPane();
+
+
+ }
+
+ public function showToolTip(ttMsg:String, xpos:Number, ypos:Number, btnObj):Void{
+ var ttHolder = Application.tooltip;
+ var ttMessage:String;
+ var Xpos:Number;
+ var Ypos:Number;
+ if (btnObj != undefined){
+ Xpos = Application.TOOLKIT_X+ libraryActivityDesc_txa._x;
+ Ypos = Application.TOOLKIT_Y+ libraryActivityDesc_txa._y;
+ ttMessage = title_lbl.text;
+ }else {
+ Xpos = Application.TOOLKIT_X+toolkitLibraries_sp._x + xpos
+ Ypos = Application.TOOLKIT_Y+toolkitLibraries_sp._y + ypos
+ ttMessage = ttMsg;
+ }
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ /**
+ *The currently selected Template Activity
+ *
+ * @param o The model object that is broadcasting an update.
+ */
+ private function updateSelectedTemplateActivity(o:Observable):Void{
+ //_global.breakpoint();
+ //gett the model
+ var tkm = ToolkitModel(o);
+ //set the states of TKActs
+ var l = tkm.getLastSelectedTemplateActivity();
+ l.setState(false);
+ var c = tkm.getSelectedTemplateActivity();
+ c.setState(true);
+ //Update the descripotion panel
+ libraryActivityDesc_txa.text = "
"+c.toolActivity.title+"
"+c.toolActivity.description+"
";
+
+ //set up the drag
+ initDrag(c);
+
+ }
+
+
+ private function initDrag(selectedTA):Void{
+ //TODO: change myRoot to in application
+ //dragIcon_mc = _root.createChildAtDepth('dummy_mc',DepthManager.kTop);
+
+ //dragIcon_mc.loadMovie('http://dolly.uklams.net/lams/lams_central/icons/icon_chat.swf');
+
+ //dragIcon_mc = _root.createObjectAtDepth("dummy_mc",DepthManager.kCursor);
+
+ dragIcon_mc = Application.cursor.createEmptyMovieClip("dragIcon_mc",Application.cursor.getNextHighestDepth());
+
+ //dragIcon_mc = _root.createObjectAtDepth("dummy_mc",DepthManager.kCursor);
+ //dragIcon_mc = Application.root.createObjectAtDepth("dummy_mc",DepthManager.kCursor);
+
+ //Debugger.log('dragIcon_mc:'+dragIcon_mc,4,'initDrag','ToolkitView');
+ //TODO: Here we need to load the right icon.
+
+ dragIcon_mcl.loadClip(Config.getInstance().serverUrl+selectedTA.toolActivity.libraryActivityUIImage,dragIcon_mc);
+ //dragIcon_mc = _global.myRoot.duplicateMovieClip('dragIcon_mc',DepthManager.kTopmost);
+ //Debugger.log('dragIcon_mc:'+dragIcon_mc,4,'initDrag','ToolkitView');
+
+ }
+ /*
+ function onMouseUp(){
+ //Debugger.log('hiya',4,'onMouseUp','TemplateActivity');
+ Mouse.removeListener(this);
+ //check if we are selected
+
+
+ //TODO:hitTest against the canvas
+
+ }
+ */
+
+ private function setUpDrag(aDragIcon_mc):Void{
+ //Debugger.log('aDragIcon_mc:'+aDragIcon_mc,4,'setUpDrag','TemplateActivity');
+ //Debugger.log('this:'+this,4,'setUpDrag','TemplateActivity');
+ Cursor.showCursor(Application.C_DEFAULT);
+ dragIcon_mc = aDragIcon_mc;
+ Application.getInstance().getCanvas().model.activeTool = null;
+ //canvasModel = new CanvasModel(this);
+ _dragging = true;
+ Application.cursor.onMouseMove = Proxy.create(this,this['dragIcon']);
+ Application.cursor.onMouseUp = Proxy.create(this,this['dropIcon']);
+ /*
+ Application.cursor.onMouseMove = function(){
+ dragIcon_mc._visible = true;
+ dragIcon_mc.startDrag(true);
+
+ Mouse.addListener(this);
+ }
+ */
+
+ /*
+ Application.cursor.onMouseUp = function(){
+ Debugger.log('this:'+this,4,'dragIcon_mc.onRelease','TemplateActivity');
+ broadcastToolkitDrop();
+ }
+ */
+
+ }
+
+ private function dragIcon():Void{
+ //Debugger.log('_dragging:'+_dragging,4,'dragIcon','TemplateActivity');
+ if(_dragging){
+ dragIcon_mc._visible = true;
+ dragIcon_mc._x = Application.cursor._xmouse-(dragIcon_mc._width/2);
+ dragIcon_mc._y = Application.cursor._ymouse-(dragIcon_mc._height/2);
+ }
+
+ }
+
+ private function dropIcon():Void{
+ _dragging = false;
+ delete Application.cursor.onMouseMove;
+ delete Application.cursor.onMouseUp;
+
+ ToolkitController(getController()).iconDrop(dragIcon_mc);
+
+
+
+ }
+
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('BGPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('scrollpane');
+ toolkitLibraries_sp.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('textarea');
+ libraryActivityDesc_txa.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('label');
+ title_lbl.setStyle('styleName',styleObj);
+
+ }
+
+ public function get className():String{
+ return _className;
+ }
+
+ /**
+ * Gets the ToolkitModel
+ *
+ * @returns model
+ */
+ public function getModel():ToolkitModel{
+ return ToolkitModel(model);
+ }
+
+ /**
+ * Returns the default controller for this view (ToolkitController).
+ * Overrides AbstractView.defaultController()
+ */
+ public function defaultController (model:Observable):Controller {
+ return new ToolkitController(model);
+ }
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Application.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Application.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Application.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,434 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.comms.*; //communications
+import org.lamsfoundation.lams.common.dict.*; // dictionary
+import org.lamsfoundation.lams.common.style.*; // styles/themes
+import org.lamsfoundation.lams.common.util.*; // utilities
+import org.lamsfoundation.lams.common.ui.*; // ui
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.learner.*;
+import org.lamsfoundation.lams.learner.ls.*;
+import mx.managers.*
+import mx.utils.*
+/**
+* Application - LAMS Learner Application
+* @author Mitchell Seaton
+*/
+class Application extends ApplicationParent {
+
+ // private constants
+ //private var _comms:Communication;
+ private var _lesson:Lesson;
+ private var _header_mc:MovieClip;
+ private var _scratchpad_mc:MovieClip;
+
+ private static var SHOW_DEBUGGER:Boolean = false;
+ private static var MODULE:String = "learner";
+
+ private static var QUESTION_MARK_KEY:Number = 191;
+
+ public static var HEADER_X:Number = 0;
+ public static var HEADER_Y:Number = 0;
+ public static var LESSON_X:Number = 0;
+ public static var LESSON_Y:Number = 82;
+ public static var SPAD_X:Number = 0;
+ public static var SPAD_Y:Number = 554;
+ public static var SPAD_H:Number = 220;
+
+
+ private static var APP_ROOT_DEPTH:Number = 10; //depth of the application root
+ private static var HEADER_DEPTH:Number = 20;
+ private static var TOOLTIP_DEPTH:Number = 60; //depth of the cursors
+
+ private static var CCURSOR_DEPTH:Number = 101;
+
+ // UI Elements
+
+ private static var UI_LOAD_CHECK_INTERVAL:Number = 50;
+ private static var UI_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+ private static var DATA_LOAD_CHECK_INTERVAL:Number = 50;
+ private static var DATA_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+
+ private var _uiLoadCheckCount = 0; // instance counter for number of times we have checked to see if theme and dict are loaded
+ private var _dataLoadCheckCount = 0;
+
+ private var _UILoadCheckIntervalID:Number; //Interval ID for periodic check on UILoad status
+ private var _DataLoadCheckIntervalID:Number;
+
+ private var _dictionaryLoaded:Boolean; //Dictionary loaded flag
+ private var _dictionaryEventDispatched:Boolean //Event status flag
+ private var _themeLoaded:Boolean; //Theme loaded flag
+ private var _themeEventDispatched:Boolean //Dictionary loaded flag
+
+ private var _UILoaded:Boolean; //UI Loading status
+
+ private var _lessonLoaded:Boolean; //Lesson loaded flag
+ private var _headerLoaded:Boolean;
+ private var _scratchpadLoaded:Boolean;
+
+
+ //Application instance is stored as a static in the application class
+ private static var _instance:Application = null;
+ private var _container_mc:MovieClip; //Main container
+ private var _tooltipContainer_mc:MovieClip; //Tooltip container
+ private var _debugDialog:MovieClip; //Reference to the debug dialog
+
+
+ /**
+ * Application - Constructor
+ */
+ private function Application(){
+ super(this);
+
+ _lessonLoaded = false;
+ _headerLoaded = false;
+ _scratchpadLoaded = false;
+
+ _module = Application.MODULE;
+
+ }
+
+ /**
+ * Retrieves an instance of the Application singleton
+ */
+ public static function getInstance():Application{
+ if(Application._instance == null){
+ Application._instance = new Application();
+ }
+ return Application._instance;
+ }
+
+ /**
+ * Main entry point to the application
+ */
+ public function main(container_mc:MovieClip){
+
+ _container_mc = container_mc;
+ _UILoaded = false;
+
+ _customCursor_mc = _container_mc.createEmptyMovieClip('_customCursor_mc', CCURSOR_DEPTH);
+
+ //add the cursors:
+ Cursor.addCursor(C_HOURGLASS);
+
+ //Get the instance of config class
+ _config = Config.getInstance();
+
+ //Assign the config load event to
+ _config.addEventListener('load',Delegate.create(this,configLoaded));
+
+
+ Key.addListener(this);
+
+ }
+
+ /**
+ * Called when the config class has loaded
+ */
+ private function configLoaded(){
+ //Now that the config class is ready setup the UI and data, call to setupData() first in
+ //case UI element constructors use objects instantiated with setupData()
+
+ setupData();
+ checkDataLoaded();
+
+ }
+
+ /**
+ * Loads and sets up event listeners for Theme, Dictionary etc.
+ */
+ private function setupData() {
+
+ //Get the language, create+load dictionary and setup load handler.
+ var language:String = String(_config.getItem('language'));
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('load',Delegate.create(this,onDictionaryLoad));
+ _dictionary.load(language);
+
+
+
+ //Set reference to StyleManager and load Themes and setup load handler.
+ var theme:String = String(_config.getItem('theme'));
+ _themeManager = ThemeManager.getInstance();
+ _themeManager.addEventListener('load',Delegate.create(this,onThemeLoad));
+ _themeManager.loadTheme(theme);
+ Debugger.getInstance().crashDumpSeverityLevel = Number(_config.getItem('crashDumpSeverityLevelLog'));
+ Debugger.getInstance().severityLevel = Number(_config.getItem('severityLevelLog'));
+
+ }
+
+ /**
+ * Periodically checks if data has been loaded
+ */
+ private function checkDataLoaded() {
+ // first time through set interval for method polling
+ if(!_DataLoadCheckIntervalID) {
+ _DataLoadCheckIntervalID = setInterval(Proxy.create(this, checkDataLoaded), DATA_LOAD_CHECK_INTERVAL);
+ } else {
+ _dataLoadCheckCount++;
+ // if dictionary and theme data loaded setup UI
+ if(_dictionaryLoaded && _themeLoaded) {
+ clearInterval(_DataLoadCheckIntervalID);
+
+ setupUI();
+ checkUILoaded();
+
+
+ } else if(_dataLoadCheckCount >= DATA_LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('reached timeout waiting for data to load.',Debugger.CRITICAL,'checkDataLoaded','Application');
+ clearInterval(_DataLoadCheckIntervalID);
+
+
+ }
+ }
+ }
+
+
+ private function setupUI():Void {
+ trace('Setting up UI...');
+
+ //Create the application root
+ _appRoot_mc = _container_mc.createEmptyMovieClip('appRoot_mc',APP_ROOT_DEPTH);
+
+ _header_mc = _appRoot_mc.createChildAtDepth('LHeader', DepthManager.kTop, {_x:HEADER_X,_y:HEADER_Y});
+ _tooltipContainer_mc = _container_mc.createEmptyMovieClip('_tooltipContainer_mc',TOOLTIP_DEPTH);
+ _header_mc.addEventListener('load',Proxy.create(this,UIElementLoaded));
+
+ _lesson = new Lesson(_appRoot_mc,LESSON_X,LESSON_Y);
+ _lesson.addEventListener('load',Proxy.create(this,UIElementLoaded));
+
+ _scratchpad_mc = _container_mc.createChildAtDepth('LScratchPad', DepthManager.kTop, {_x:SPAD_X, _y:SPAD_Y, _lessonModel:_lesson.model, _lessonController:_lesson.view.getController()});
+ _scratchpad_mc.addEventListener('load', Proxy.create(this, UIElementLoaded));
+ }
+
+ /**
+ * Runs periodically and dispatches events as they are ready
+ */
+ private function checkUILoaded() {
+ trace('checking UI loaded...');
+ //If it's the first time through then set up the interval to keep polling this method
+ if(!_UILoadCheckIntervalID) {
+ _UILoadCheckIntervalID = setInterval(Proxy.create(this,checkUILoaded),UI_LOAD_CHECK_INTERVAL);
+ } else {
+ _uiLoadCheckCount++;
+
+ //If UI loaded check which events can be broadcast
+ if(_UILoaded){
+ clearInterval(_UILoadCheckIntervalID);
+ start();
+
+ if(_uiLoadCheckCount >= UI_LOAD_CHECK_TIMEOUT_COUNT){
+ //if we havent loaded the library by the timeout count then give up
+ Debugger.log('raeached time out waiting to load library, giving up.',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UILoadCheckIntervalID);
+ }
+ }
+ }
+ }
+
+ /**
+ * This is called by each UI element as it loads to notify Application that it's loaded
+ * When all UIElements are loaded the Application can set UILoaded flag true allowing events to be dispatched
+ * and methods called on the UI Elements
+ *
+ * @param UIElementID:String - Identifier for the Element that was loaded
+ */
+ public function UIElementLoaded(evt:Object) {
+ if(evt.type=='load'){
+ //Which item has loaded
+ switch (evt.target.className) {
+ case 'Lesson' :
+ trace('Lesson loaded...');
+ _lessonLoaded = true;
+ break;
+ case 'Header' :
+ trace('Header loaded...');
+ _headerLoaded = true;
+ break;
+ case 'Scratchpad' :
+ trace('Scratchpad loaded...');
+ _scratchpadLoaded = true;
+ break;
+ default:
+ }
+
+ //If all of them are loaded set UILoad accordingly
+ if(_lessonLoaded && _headerLoaded && _scratchpadLoaded){
+ _UILoaded=true;
+ }
+
+ }
+ }
+
+ /**
+ * Runs when application setup has completed. At this point the init/loading screen can be removed and the user can
+ * work with the application
+ */
+ private function start(){
+ trace('starting...');
+
+ //Fire off a resize to set up sizes
+ onResize();
+
+ if(SHOW_DEBUGGER){
+ showDebugger();
+ }
+
+ // load lesson
+ _lesson.getLesson();
+ }
+
+ /**
+ * Receives events from the Stage resizing
+ */
+ public function onResize(){
+
+ //Get the stage width and height and call onResize for stage based objects
+ var w:Number = Stage.width;
+ var h:Number = Stage.height;
+
+ var someListener:Object = new Object();
+ someListener.onMouseUp = function () {
+ _lesson.setSize(w,h-(LESSON_Y+_lesson.model.getSpadHeight()));
+
+ _scratchpad_mc._y = h - _lesson.model.getSpadHeight();
+ }
+
+ Header(_header_mc).resize(w);
+
+ _lesson.setSize(w,h-(LESSON_Y+_lesson.model.getSpadHeight()));
+ //Property Inspector
+ //_pi_mc.setSize(w-_toolkit.width,_pi_mc._height)
+ _scratchpad_mc._y = h - _lesson.model.getSpadHeight();
+
+ }
+
+ /**
+ * Updated the progress data in the lesson model with received progress data
+ *
+ * @param attempted
+ * @param completed
+ * @param current
+ */
+
+ public function refreshProgress(attempted:String, completed:String, current:String, lessonID:String, version:Number){
+ Debugger.log('attempted: ' + attempted,Debugger.CRITICAL,'refreshProgress','Application');
+ Debugger.log('completed: ' + completed,Debugger.CRITICAL,'refreshProgress','Application');
+ Debugger.log('current: ' + current,Debugger.CRITICAL,'refreshProgress','Application');
+ Debugger.log('version: ' + version,Debugger.CRITICAL,'refreshProgress','Application');
+ Debugger.log('_root lesson ID: ' + _root.lessonID + ' passed in lesson ID: ' + lessonID,Debugger.CRITICAL,'refreshProgress','Application');
+ //Debugger.log('_root unique ID: ' + _root.uniqueID + ' passed in unique ID: ' + uniqueID,Debugger.CRITICAL,'refreshProgress','Application');
+
+ if(_root.lessonID == lessonID){
+ var attemptedArray:Array = attempted.split("_");
+ var completedArray:Array = completed.split("_");
+ if(_lesson.model.learningDesignModel != null) {
+ if(version != null && version != _lesson.model.learningDesignModel.designVersion) {
+ // TODO apply progress data arrays after design is reloaded instead of re-getting the flash progress data
+ _lesson.reloadLearningDesign();
+ } else {
+ _lesson.updateProgressData(attemptedArray, completedArray, Number(current));
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Returns the tooltip conatiner mc
+ *
+ * @usage Import monioring package and then use
+ *
+ */
+ static function get tooltip():MovieClip {
+ trace("tooltip called")
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._tooltipContainer_mc != undefined) {
+ return _instance._tooltipContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+
+ // onKey*** methods - TODO
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.authoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get root():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._appRoot_mc != undefined) {
+ return _instance._appRoot_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if _appRoot hasn't been created
+
+ }
+ }
+
+ public function getLesson():Lesson{
+ return _lesson;
+ }
+
+ public function getHeader():Header{
+ return Header(_header_mc);
+ }
+
+ public function getScratchpad():Scratchpad{
+ return Scratchpad(_scratchpad_mc);
+ }
+
+ public function showDebugger():Void{
+ _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
+ }
+
+ public function hideDebugger():Void{
+ _debugDialog.deletePopUp();
+ }
+
+ /**
+ * Handles KEY presses for Application
+ */
+ private function onKeyDown(){
+
+ //var mouseListener:Object = new Object();
+ //Debugger.log('Key.isDown(Key.CONTROL): ' + Key.isDown(Key.CONTROL),Debugger.GEN,'onKeyDown','Application');
+ //Debugger.log('Key: ' + Key.getCode(),Debugger.GEN,'onKeyDown','Application');
+ //the debug window:
+ if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
+ if (!_debugDialog.content){
+ showDebugger();
+ }else {
+ hideDebugger();
+ }
+ }
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Header.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Header.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Header.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,205 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import mx.controls.*
+import mx.utils.*
+import mx.managers.*
+import mx.events.*
+
+import org.lamsfoundation.lams.learner.*
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.ToolTip;
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.common.Config;
+
+class Header extends MovieClip {
+
+ private var _header_mc:MovieClip;
+ private var _container:MovieClip; // Holding Container
+ private var logo:MovieClip; // LAMS/RAMS logo
+
+ public static var LOGO_WIDTH:Number = 67;
+ public static var LOGO_HEIGHT:Number = 25;
+ public static var LOGO_X:Number = 7;
+ public static var LOGO_Y:Number = 4;
+ public static var LOGO_PATH:String = "www/images/learner.logo.swf";
+
+ private var resume_btn:MovieClip; //Resume and Exit buttons
+ private var exit_btn:MovieClip;
+ private var lessonHead_pnl:MovieClip;
+ private var resume_lbl:TextField;
+ private var exit_lbl:TextField;
+ private var _tip:ToolTip;
+ private var export_btn:Button;
+ private var export_lbl:TextField;
+
+ private var _lessonName:Label;
+
+ private var panel:MovieClip; //The underlaying panel base
+
+ private var _tm:ThemeManager;
+ private var _dictionary:Dictionary;
+
+ //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ /**
+ * constructor
+ */
+ public function Header() {
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('init',Proxy.create(this,setLabels));
+
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+
+ }
+
+ /**
+ * Called a frame after movie attached to allow components to initialise
+ */
+ public function init(){
+ trace('initialing header..');
+
+ //Delete the enterframe dispatcher
+ delete this.onEnterFrame;
+
+ _header_mc = this;
+
+ loadLogo();
+
+ setLabels();
+ resize(Stage.width);
+
+
+ //Add event listeners for resume and exit buttons
+
+ resume_btn.onRelease = function(){
+ trace('on releasing resuming button..');
+ var app:Application = Application.getInstance();
+ app.getLesson().resumeLesson();
+ }
+
+ exit_btn.onRelease = function(){
+ trace('on releasing exit button..');
+ var app:Application = Application.getInstance();
+ app.getLesson().exitLesson();
+ }
+
+ export_btn.onRelease = function(){
+ var app:Application = Application.getInstance();
+ app.getLesson().exportLesson();
+ }
+
+ resume_btn.onRollOver = Proxy.create(this,this['showToolTip'], resume_btn, "hd_resume_tooltip");
+ resume_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ exit_btn.onRollOver = Proxy.create(this,this['showToolTip'], exit_btn, "hd_exit_tooltip");
+ exit_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ export_btn.onRollOver = Proxy.create(this,this['showToolTip'], export_btn, "ln_export_tooltip");
+ export_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ export_btn._visible = false;
+ export_lbl._visible = false;
+ this.onEnterFrame = setLabels;
+
+ }
+
+ private function loadLogo():Void{
+ logo = this.createEmptyMovieClip("logo", this.getNextHighestDepth());
+ var ml = new MovieLoader(Config.getInstance().serverUrl+Header.LOGO_PATH,setUpLogo,this,logo);
+ }
+
+ private function setUpLogo(logo):Void{
+ logo._x = Header.LOGO_X;
+ logo._y = Header.LOGO_Y;
+ }
+
+ public function showToolTip(btnObj, btnTT:String):Void{
+
+ var Xpos = Application.HEADER_X+ 5;
+ var Ypos = Application.HEADER_Y+( btnObj._y+btnObj._height)+2;
+ var ttHolder = Application.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+ var ttWidth = 150
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, undefined, ttWidth);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ private function setStyles(){
+ var styleObj = _tm.getStyleObject('smallLabel');
+ _lessonName.setStyle('styleName', styleObj);
+
+ styleObj = _tm.getStyleObject('BGPanel');
+ lessonHead_pnl.setStyle('styleName', styleObj);
+
+ }
+
+ private function setLabels(){
+ //Set the text for buttons
+ resume_lbl.text = Dictionary.getValue('hd_resume_lbl');
+ exit_lbl.text = Dictionary.getValue('hd_exit_lbl');
+ export_lbl.text = Dictionary.getValue('ln_export_btn');
+
+ setStyles();
+
+ delete this.onEnterFrame;
+
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ public function showExportButton(v:Boolean) {
+ Debugger.log("Show/Hide Export Button: " + v, Debugger.GEN, "showExportButton", "Header");
+ export_btn._visible = v;
+ export_lbl._visible = v;
+ }
+
+ public function setLessonName(lessonName:String){
+ _lessonName.text = lessonName;
+ }
+
+ public function resize(width:Number){
+ panel._width = width;
+
+ }
+
+ function get className():String {
+ return 'Header';
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Scratchpad.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Scratchpad.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Scratchpad.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,267 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+import org.lamsfoundation.lams.learner.*;
+import org.lamsfoundation.lams.learner.ls.*;
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.ToolTip;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.style.*;
+import mx.controls.*
+import mx.utils.*
+import mx.managers.*
+import mx.events.*
+
+
+class Scratchpad extends MovieClip {
+
+ //Height Properties
+ private var spadHeightHide:Number = 20;
+ private var spadHeightFull:Number = 217;
+
+ //Open Close Identifier
+ private var _spadIsExpended:Boolean;
+
+ //Component properties
+ private var _scratchpad_mc:MovieClip;
+ private var spadHead_pnl:MovieClip;
+ private var spadTitle_lbl:Label;
+ private var _container:MovieClip; // Holding Container
+ private var minIcon:MovieClip;
+ private var maxIcon:MovieClip;
+ private var clickTarget_mc:MovieClip;
+ private var view_btn:MovieClip; // buttons
+ private var save_btn:MovieClip;
+ private var view_lbl:TextField;
+ private var save_lbl:TextField;
+ private var _tip:ToolTip;
+
+ public static var SCRATCHPAD_ID:Number = 1;
+
+ // notebook data entry fields
+ private var _title:Label;
+ private var title_txi:TextInput;
+ private var entry_txa:TextArea;
+
+ private var panel:MovieClip; //The underlaying panel base
+ private var _lessonModel:LessonModel;
+ private var _lessonController:LessonController;
+ private var _tm:ThemeManager;
+ private var _dictionary:Dictionary;
+
+ //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ /**
+ * constructor
+ */
+ public function Scratchpad() {
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('init',Proxy.create(this,setLabels));
+
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+
+ }
+
+ /**
+ * Called a frame after movie attached to allow components to initialise
+ */
+ public function init(){
+ trace('initialing header..');
+
+ //Delete the enterframe dispatcher
+ delete this.onEnterFrame;
+ _lessonModel = _lessonModel;
+ _lessonController = _lessonController;
+ _scratchpad_mc = this;
+ _spadIsExpended = true;
+ maxIcon._visible = true;
+ minIcon._visible = false;
+ _lessonModel.setSpadHeight(spadHeightFull);
+ setLabels();
+ resize(Stage.width);
+
+
+ //Add event listeners for resume and exit buttons
+
+ view_btn.onRelease = function(){
+ trace('on releasing view all button..');
+ Application.getInstance().getScratchpad().viewNotebookEntries();
+ }
+
+ save_btn.onRelease = function(){
+ trace('on releasing save button..');
+
+ Application.getInstance().getScratchpad().saveEntry();
+ }
+
+ view_btn.onRollOver = Proxy.create(this,this['showToolTip'], view_btn, "sp_view_tooltip");
+ view_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ save_btn.onRollOver = Proxy.create(this,this['showToolTip'], save_btn, "sp_save_tooltip");
+ save_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+ clickTarget_mc.onRelease = Proxy.create (this, localOnRelease);
+ clickTarget_mc.onReleaseOutside = Proxy.create (this, localOnReleaseOutside);
+ this.onEnterFrame = setLabels;
+
+ }
+
+ public function localOnRelease():Void{
+
+ if (_spadIsExpended){
+ trace("P Pressed in 'localOnRelease' and _spadIsExpended is: "+_spadIsExpended)
+ _spadIsExpended = false
+ minIcon._visible = true;
+ maxIcon._visible = false;
+ _lessonModel.setSpadHeight(spadHeightHide);
+
+ }else {
+ trace("P Pressed in 'localOnRelease' and _spadIsExpended is: "+_spadIsExpended)
+ _spadIsExpended = true
+ minIcon._visible = false;
+ maxIcon._visible = true;
+ _lessonModel.setSpadHeight(spadHeightFull);
+ //Application.getInstance().onResize();
+ }
+ }
+
+ public function isSpadExpanded():Boolean{
+ return _spadIsExpended;
+ }
+
+ public function spadFullHeight():Number{
+ return spadHeightFull;
+ }
+
+
+ public function localOnReleaseOutside():Void{
+ Debugger.log('Release outside so no event has been fired, current state is: ' + _spadIsExpended,Debugger.GEN,'localOnReleaseOutside','Scratch Pad');
+
+ }
+ public function showToolTip(btnObj, btnTT:String):Void{
+
+ var Xpos = Application.HEADER_X+ 5;
+ var Ypos = Application.HEADER_Y+( btnObj._y+btnObj._height)+2;
+ var ttHolder = Application.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+ var ttWidth = 150
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, undefined, ttWidth);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ private function setStyles(){
+ var styleObj = _tm.getStyleObject('smallLabel');
+ _title.setStyle('styleName', styleObj);
+
+ styleObj = _tm.getStyleObject('textarea');
+ title_txi.setStyle('styleName', styleObj);
+ entry_txa.setStyle('styleName', styleObj);
+ spadTitle_lbl.setStyle('styleName', styleObj);
+
+ //For Panels
+ styleObj = _tm.getStyleObject('BGPanel');
+ spadHead_pnl.setStyle('styleName',styleObj);
+ }
+
+ private function setLabels(){
+ //Set the text for buttons
+ view_lbl.text = Dictionary.getValue('sp_view_lbl');
+ save_lbl.text = Dictionary.getValue('sp_save_lbl');
+
+ //Set text for Scratch pad labels
+ spadTitle_lbl.text = Dictionary.getValue('sp_panel_lbl');
+ _title.text = Dictionary.getValue('sp_title_lbl');
+
+
+ setStyles();
+
+ delete this.onEnterFrame;
+
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ public function saveEntry(){
+ // TODO: validate entry fields
+
+ var dto:Object = getDataForSaving();
+
+ var callback:Function = Proxy.create(this,onStoreEntryResponse);
+
+ Application.getInstance().getComms().sendAndReceive(dto,"servlet/notebook/storeNotebookEntry",callback,false);
+
+ }
+
+ public function getDataForSaving():Object {
+ var dto:Object = new Object();
+ dto.externalID = Number(_root.lessonID);
+ dto.externalIDType = SCRATCHPAD_ID;
+ dto.externalSignature = "SCRATCHPAD";
+ dto.userID = Number(_root.userID);
+ dto.title = title_txi.text;
+ dto.entry = entry_txa.text;
+
+ return dto;
+ }
+
+ public function onStoreEntryResponse(r):Void {
+ if(r instanceof LFError){
+ r.showErrorAlert();
+ }else{
+ // TODO: SUCCESS MESSAGE/CLEAR FIELDS
+ title_txi.text = "";
+ entry_txa.text = "";
+ }
+ }
+
+ public function viewNotebookEntries(){
+ // TODO: Pop-up for Notebook Entries
+
+ var notebook_url:String = _root.serverURL + 'learning/notebook.do?method=viewAll&lessonID=' + _root.lessonID;
+
+ JsPopup.getInstance().launchPopupWindow(notebook_url, 'Notebook', 570, 796, true, true, false, false, false);
+
+ }
+
+ public function resize(width:Number){
+ panel._width = width;
+
+ }
+
+ function get className():String {
+ return 'Scratchpad';
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/Library.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/Library.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/Library.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,289 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.learner.Application;
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.Progress;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.learner.lb.*;
+import org.lamsfoundation.lams.common.util.*;
+import mx.managers.*;
+/**
+* Library - LAMS Application
+* @author Mitchell Seaton
+*/
+class Library {
+ // Model
+ private var libraryModel:LibraryModel;
+ // View
+ private var libraryView:LibraryView;
+ private var libraryView_mc:MovieClip;
+
+ private var _className:String = "Library";
+
+ public static var LESSON_X:Number = 0;
+ public static var LESSON_Y:Number = 0;
+ public static var LESSON_H:Number = 22;
+ public static var LESSON_W:Number = 123;
+
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ /*
+ * Library Constructor
+ *
+ * @param target_mc Target clip for attaching view
+ */
+ function Library(target_mc:MovieClip,x:Number,y:Number){
+ trace('[new Library]');
+
+ mx.events.EventDispatcher.initialize(this);
+
+ //Create the model
+ libraryModel = new LibraryModel(this);
+
+ //Create the view
+ libraryView_mc = target_mc.createChildAtDepth("libraryView",DepthManager.kTop);
+ trace(libraryView_mc);
+
+ libraryView = LibraryView(libraryView_mc);
+ libraryView.init(libraryModel,undefined);
+ trace(libraryView);
+ libraryView_mc.addEventListener('load',Proxy.create(this,viewLoaded));
+
+ //Register view with model to receive update events
+ libraryModel.addObserver(libraryView);
+
+ //Set the position by setting the model which will call update on the view
+ libraryModel.setPosition(x,y);
+ libraryModel.setSize(null,Stage.height-y);
+
+
+ }
+
+ /**
+ * event broadcast when a new library is loaded
+ */
+ public function broadcastInit(){
+ dispatchEvent({type:'init',target:this});
+ }
+
+
+ private function viewLoaded(evt:Object){
+ Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Library');
+
+ if(evt.type=='load') {
+ getActiveSequences();
+ }else {
+ //Raise error for unrecognized event
+ }
+ }
+
+ public function getActiveSequences():Void {
+ trace('getting active sequences...');
+
+ var callback:Function = Proxy.create(this,setActiveSequences);
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=getActiveLessons&userId='+_root.userID, callback, false);
+
+
+ }
+
+ private function setActiveSequences(seqs:Array):Void {
+ trace('received active lesson/seq data back...');
+ // get data and create Sequence obj's
+
+ Debugger.log('Received active sequences (lessons) array length:'+seqs.length,4,'setActiveLessons','Library');
+
+ var lns = new Array();
+
+ // go through list of DTO's and make Lesson objects to add to hash map
+ for(var i=0; i< seqs.length; i++){
+ var s:Object = seqs[i];
+
+
+ //var sp_mc:MovieClip = libraryView.getScrollPane();
+ //sp_mc.contentPath = "empty_mc";
+ //trace(sp_mc);
+ //trace(sp_mc.content);
+ //var lesson:Lesson = new Lesson(sp_mc.content, LESSON_X, LESSON_Y+(LESSON_H*i), libraryView);
+
+ var seq:Sequence = new Sequence();
+ seq.populateFromDTO(s);
+ trace('pushing seq with id: ' + seq.getSequenceID());
+ lns.push(seq);
+ }
+
+ //sets these in the toolkit model in a hashtable by lib id
+ libraryModel.setLearningSequences(lns);
+
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ /**
+ * Used by application to set the size
+ * @param width The desired width
+ * @param height the desired height
+ */
+ public function setSize(width:Number, height:Number):Void{
+ libraryModel.setSize(width, height);
+ }
+
+ public function setPosition(x:Number,y:Number){
+ //Set the position within limits
+ //TODO DI 24/05/05 write validation on limits
+ libraryModel.setPosition(x,y);
+ }
+
+ public function getSequence(seqId:Number):Sequence {
+ return libraryModel.getSequence(seqId);
+ }
+
+ public function getSelectedSequence():Sequence {
+ return libraryModel.getSelectedSequence();
+ }
+
+ public function select(seq:Sequence):Void {
+ var libraryController = libraryView.getController();
+ libraryController.selectSequence(seq);
+ }
+
+ public function joinSequence(seq:Object):Boolean {
+
+ var callback:Function = Proxy.create(this,startSequence);
+
+ // call action
+ var seqId:Number = seq.getSequenceID();
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=joinLesson&userId='+_root.userID+'&lessonId='+String(seqId), callback, false);
+
+ // get Learning Design for lesson
+ openLearningDesign(seq);
+ getProgressData(seq);
+
+ return true;
+ }
+
+ public function exitSequence(seq:Object):Boolean {
+ var callback:Function = Proxy.create(this,closeSequence);
+
+ // call action
+ var seqId:Number = seq.getSequenceID();
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=exitLesson&lessonId='+String(seqId), callback, false);
+
+ return true;
+ }
+
+ private function startSequence(pkt:Object){
+ trace('received message back from server aftering joining lesson...');
+
+ // check was successful join
+
+ // start the selected sequence
+ var seq:Sequence = Sequence(libraryModel.getSelectedSequence());
+ trace(seq);
+ trace('pktobject value: '+String(pkt));
+ getURL('http://localhost:8080/lams/learning'+String(pkt)+'?progressId='+seq.getSequenceID(),'contentFrame');
+
+ }
+
+ private function closeSequence(pkt:Object){
+ trace('receiving message back from server after exiting lesson...');
+ trace('loading exit page... ' + String(pkt));
+ getURL('http://localhost:8080/lams/learning' + String(pkt), 'contentFrame');
+
+ // stop current sequence
+
+ // deactivate Progress movie
+
+ }
+
+ private function openLearningDesign(seq:Object){
+ trace('opening learning design...');
+ var designId:Number = seq.getLearningDesignID();
+
+ var callback:Function = Proxy.create(this,saveDataDesignModel);
+
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designId,callback, false);
+
+ }
+
+ private function getProgressData(seq:Object){
+ trace('getting progress data...');
+ var progessId:Number = seq.getSequenceID();
+
+ var callback:Function = Proxy.create(this, saveProgressData);
+ Application .getInstance().getComms().getRequest('learning/learner.do?method=getFlashProgressData&progressId=' + progessId, callback, false);
+ }
+
+ private function saveDataDesignModel(learningDesignDTO:Object){
+ trace('returning learning design...');
+ trace('saving model data...');
+ var seq:Sequence = Sequence(libraryModel.getSelectedSequence());
+ var model:DesignDataModel = new DesignDataModel();
+
+ model.setDesign(learningDesignDTO);
+ seq.setLearningDesignModel(model);
+
+ // activite Progress movie
+
+ }
+
+ private function saveProgressData(progressDTO:Object){
+ trace('returning progress data...');
+ var progress:Progress = new Progress();
+ progress.populateFromDTO(progressDTO);
+ var seq:Sequence = Sequence(libraryModel.getSelectedSequence());
+ seq.setProgress(progress);
+
+ trace('progress data saved...');
+ }
+
+ //Dimension accessor methods
+ public function get width():Number{
+ return libraryModel.width;
+ }
+
+ public function get height():Number{
+ return libraryModel.height;
+ }
+
+ public function get x():Number{
+ return libraryModel.x;
+ }
+
+ public function get y():Number{
+ return libraryModel.y;
+ }
+
+ function get className():String {
+ return 'Library';
+ }
+
+}
+
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/LibraryController.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/LibraryController.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/LibraryController.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.learner.*
+import org.lamsfoundation.lams.learner.lb.*;
+
+/**
+* Controller for the sequence library
+*/
+class LibraryController extends AbstractController {
+ private var _libraryModel:LibraryModel;
+
+ /**
+ * Constructor
+ *
+ * @param cm The model to modify.
+ */
+ public function LibraryController (cm:Observable) {
+ super (cm);
+ _libraryModel = LibraryModel(model);
+ }
+
+ // control methods
+
+ /**
+ *Called by Lesson when one in clicked
+ * @param seq - the lesson/sequence that was clicked (selected)
+ */
+ public function selectSequence(seq:Sequence):Void{
+ _libraryModel = LibraryModel(model);
+ _libraryModel.setSelectedSequence(seq);
+ }
+
+ public function getActiveSequences():Void {
+ _libraryModel = LibraryModel(model);
+ _libraryModel.getLibrary().getActiveSequences();
+ }
+
+ public function cellPress(evt):Void{
+ trace(String(evt.target));
+ trace("Item index: " + evt.itemIndex);
+ trace('onClick event: joining lesson...');
+ var seqID:Number = evt.target.getItemAt(evt.itemIndex).ID;
+ selectSequence(_libraryModel.getSequence(seqID));
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/LibraryModel.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/LibraryModel.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/lb/LibraryModel.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,325 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.learner.lb.*;
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.util.Observable;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.learner.Application;
+
+
+/*
+* Model for the Library
+*/
+class LibraryModel extends Observable {
+ private var _className:String = "LibraryModel";
+
+ private var __width:Number;
+ private var __height:Number;
+ private var __x:Number;
+ private var __y:Number;
+ private var _isDirty:Boolean;
+ private var infoObj:Object;
+
+ private var _library:Library;
+
+ /**
+ * View state data
+ */
+ private var _currentlySelectedSequence:Sequence;
+ private var _lastSelectedSequence:Sequence;
+
+ /**
+ * Sequence (Sequence) Library container
+ *
+ */
+ private var _learningSequences:Hashtable;
+
+ /**
+ * constants
+ */
+ public static var CREATE_STATE_ID:Number = 1;
+ public static var NEW_STATE_ID:Number = 2;
+ public static var STARTED_STATE_ID:Number = 3;
+ public static var SUSPENDED_STATE_ID:Number = 4;
+ public static var FINISHED_STATE_ID:Number = 5;
+ public static var ARCHIVED_STATE_ID:Number = 6;
+ public static var REMOVED_STATE_ID:Number = 7;
+
+ /**
+ * Constructor.
+ */
+ public function LibraryModel (library:Library){
+ trace('new lib model created...');
+ _library = library;
+ _learningSequences = new Hashtable();
+ }
+
+ public function setLearningSequences(lsc:Array):Boolean {
+ trace('add learning seqs to map...');
+ //clear the old lot
+ _learningSequences.clear();
+
+ for(var i=0; i= LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('Reached timeout waiting for data to load.',Debugger.CRITICAL,'getFlashProgress','Lesson');
+ clearInterval(_loadCheckIntervalID);
+ var msg:String = Dictionary.getValue('al_timeout');
+ LFMessage.showMessageAlert(msg);
+
+ // clear count and restart polling check
+ _loadCheckCount = 0;
+ getFlashProgress();
+ }
+ }
+ } else {
+ callFlashProgress();
+ clearInterval(_loadCheckIntervalID);
+ }
+
+ }
+
+ private function callFlashProgress():Void {
+ var callback:Function = Proxy.create(this,saveProgressData);
+ var lessonId:Number = lessonModel.ID;
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=getFlashProgressData&lessonID='+String(lessonId), callback, false);
+ }
+
+ private function saveProgressData(progressDTO:Object):Void{
+ if(progressDTO instanceof LFError) {
+ return;
+ }
+
+ var p:Progress = new Progress();
+ p.populateFromDTO(progressDTO);
+ lessonModel.setProgressData(p);
+
+ Debugger.log('progress data receieved for user..' + progressDTO,Debugger.CRITICAL,'saveProgressData','org.lamsfoundation.lams.Lesson');
+
+ lessonModel.broadcastViewUpdate("PROGRESS_UPDATE", null);
+ }
+
+ public function updateProgressData(attempted:Array, completed:Array, current:Number):Void{
+ if(!finishedDesign) {
+ getFlashProgress();
+ return;
+ }
+
+ var p:Progress = lessonModel.progressData;
+
+ if(p){
+ p.currentActivityId = current;
+ p.attemptedActivities = attempted;
+ p.completedActivities = completed;
+ } else {
+ p = new Progress();
+ p.currentActivityId = current;
+ p.attemptedActivities = attempted;
+ p.completedActivities = completed;
+ lessonModel.setProgressData(p);
+ }
+
+ lessonModel.broadcastViewUpdate("PROGRESS_UPDATE", null);
+ }
+
+ private function closeLesson(pkt:Object){
+ trace('receiving message back from server...');
+
+ // set lesson as inactive
+ //lessonModel.setInactive();
+
+ // deactivate Progress movie
+
+ // load exit jsp
+ getURL(_root.serverURL + 'learning'+String(pkt), 'contentFrame');
+ }
+
+ public function reloadLearningDesign() {
+ openLearningDesign();
+ }
+
+ private function openLearningDesign(){
+ trace('opening learning design...');
+ finishedDesign = false;
+
+ var designId:Number = lessonModel.learningDesignID;
+ var callback:Function = Proxy.create(this,saveDataDesignModel);
+
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designId,callback, false);
+
+ }
+
+ private function saveDataDesignModel(learningDesignDTO:Object){
+ trace('returning learning design...');
+ trace('saving model data...');
+ if(learningDesignDTO instanceof LFError) {
+ Cursor.showCursor(Application.C_DEFAULT);
+ learningDesignDTO.showErrorAlert();
+ } else {
+ var model:DesignDataModel = new DesignDataModel();
+ model.setDesign(learningDesignDTO);
+ lessonModel.setLearningDesignModel(model);
+
+ // set lesson as active
+ lessonModel.setActive();
+
+ // get flash progress data
+ getFlashProgress();
+
+ }
+
+ }
+
+ public function getLessonID():Number {
+ return lessonModel.ID;
+ }
+
+ public function checkState(stateID:Number):Boolean {
+ if(lessonModel.getLessonStateID()==stateID){
+ return true
+ } else {
+ return false;
+ }
+ }
+
+ /** Loads the Activity page in frame or popup-window depending on the status of the Acvtivity. */
+ public function getActivityURL(request:String, popup:Boolean){
+
+ if(popup){
+ popupActivity(_root.serverURL + request);
+ } else {
+ loadActivity(_root.serverURL + request);
+ }
+
+ }
+
+ private function loadActivity(url:String){
+ Debugger.log('loading activity path using forward: ' + url,Debugger.CRITICAL,'loadActivity','org.lamsfoundation.lams.Lesson');
+
+ getURL(url,"contentFrame");
+ }
+
+ private function popupActivity(url:String){
+ Debugger.log('loading activity (popup window) path using forward: ' + url,Debugger.CRITICAL,'loadActivity','org.lamsfoundation.lams.Lesson');
+
+ JsPopup.getInstance().launchPopupWindow(url, 'LearnerActivity', 600, 800, true, true, true, false, false);
+
+ }
+
+
+ //class accesssor methods
+ public function get model():LessonModel{
+ return lessonModel;
+ }
+
+ public function get view():LessonView{
+ return lessonView;
+ }
+ /**
+ * Used by application to set the size
+ * @param width The desired width
+ * @param height the desired height
+ */
+ public function setSize(width:Number, height:Number):Void{
+ lessonModel.setSize(width, height);
+ }
+
+ public function setPosition(x:Number,y:Number){
+ //Set the position within limits
+ //TODO DI 24/05/05 write validation on limits
+ lessonModel.setPosition(x,y);
+ }
+
+ //Dimension accessor methods
+ public function get width():Number{
+ return lessonModel.width;
+ }
+
+ public function get height():Number{
+ return lessonModel.height;
+ }
+
+ public function get x():Number{
+ return lessonModel.x;
+ }
+
+ public function get y():Number{
+ return lessonModel.y;
+ }
+
+ public function set finishedDesign(a:Boolean){
+ _finishedDesign = a;
+ }
+
+ public function get finishedDesign():Boolean{
+ return _finishedDesign;
+ }
+
+ function get className():String {
+ return 'Lesson';
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonController.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonController.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonController.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,160 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.learner.ls.*;
+import org.lamsfoundation.lams.common.LearnerComplexActivity;
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.comms.Communication;
+import org.lamsfoundation.lams.learner.*
+import org.lamsfoundation.lams.authoring.Activity;
+
+import mx.managers.*;
+import mx.controls.*;
+import mx.events.*
+
+/*
+* Make changes to Lesson's model data based on user input
+*/
+class LessonController extends AbstractController {
+
+ /**
+ * Constructor
+ *
+ * @param cm The model to modify.
+ */
+ private var _lessonModel:LessonModel;
+ private var _app:Application;
+ private var _comms:Communication;
+ private var _isBusy:Boolean;
+
+ //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+
+ public function LessonController (cm:Observable) {
+ super (cm);
+ _app = Application.getInstance();
+ _comms = _app.getComms();
+ _lessonModel = LessonModel(model);
+ _isBusy = false;
+
+ EventDispatcher.initialize(this);
+ }
+
+ /**
+ * Recieves the click events from the Lesson buttons. Based on the label
+ * the relevent method is called to action the user request
+ * @param evt
+ */
+ public function click(evt):Void{
+ trace(String(evt.target));
+
+ var tgt:String = new String(evt.target);
+ if(tgt.indexOf("export_btn") != -1){
+ _lessonModel.getLesson().exportLesson();
+ }
+
+ }
+
+ public function activityClick(ca:Object):Void{
+ //if (ca.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE){
+
+ Debugger.log('activityClick CanvasActivity:'+ca.activity.activityID,Debugger.GEN,'activityClick','LessonController');
+ //}
+ }
+
+ public function activityDoubleClick(ca:Object):Void{
+ setBusy()
+ Debugger.log('activityDoubleClick CanvasActivity:'+ca.activity.activityID + ' status: ' + ca.activityStatus + 'type id: ' + ca.activity.activityTypeID,Debugger.GEN,'activityDoubleClick','LessonController');
+
+ if(ca.activity.activityTypeID == Activity.TOOL_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isGroupActivity()){
+
+ if(ca.activityStatus != undefined){
+ var URLToSend:String = 'learning/learner.do?method=forwardToLearnerActivityURL&activityID='+ca.activity.activityID+'&userID='+_root.userID+'&lessonID='+_root.lessonID;
+
+ if(ca.activityStatus == 'completed_mc' && ca.activity.activityTypeID != Activity.OPTIONAL_ACTIVITY_TYPE){
+ _lessonModel.getLesson().getActivityURL(URLToSend, true);
+ } else if(ca.activityStatus == 'attempted_mc' && _root.mode == 'preview') {
+ _lessonModel.getLesson().moveToActivity(_lessonModel.progressData.getCurrentActivityId(), ca.activity.activityID);
+ } else {
+ _lessonModel.getLesson().getActivityURL(URLToSend, false);
+ }
+ } else if(_root.mode == 'preview') {
+ /* if child Activity is double-clicked then load the parent Activity */
+ if(ca.activity.parentActivityID != null || ca.activity.parentActivityID != undefined){
+ _lessonModel.getLesson().moveToActivity(_lessonModel.progressData.getCurrentActivityId(), ca.activity.parentActivityID);
+ } else {
+ _lessonModel.getLesson().moveToActivity(_lessonModel.progressData.getCurrentActivityId(), ca.activity.activityID);
+ }
+ } else {
+ var alertMSG:String = Dictionary.getValue('al_doubleclick_todoactivity')
+ getURL("javascript:alert('"+alertMSG+"');");
+
+ }
+ }
+
+ clearBusy();
+ }
+
+ public function activityRelease(ca:Object):Void{
+ Debugger.log('activityRelease LearnerActivity:'+ca.activity.activityID,Debugger.GEN,'activityRelease','LessonController');
+
+ }
+
+ public function activityReleaseOutside(ca:Object):Void{
+ Debugger.log('activityReleaseOutside CanvasActivity:'+ca.activity.activityID,Debugger.GEN,'activityReleaseOutside','LessonController');
+ }
+
+ public function complexActivityRelease(ca:Object, dbClick:Boolean):Void{
+ if(!dbClick){
+ if(ca.locked){
+ Debugger.log('***1*** CA dbclick: ' + dbClick + 'CA lock: '+ca.locked,Debugger.GEN,'complexActivityRelease','LessonController');
+ _lessonModel.setCurrentActivityOpen(ca);
+ } else {
+ Debugger.log('***2*** CA dbclick: ' + dbClick + 'CA lock: '+ca.locked,Debugger.GEN,'complexActivityRelease','LessonController');
+ _lessonModel.setCurrentActivityOpen(null);
+ }
+ } else {
+ Debugger.log('***3*** CA dbclick: ' + dbClick + 'CA lock: '+ca.locked,Debugger.GEN,'complexActivityRelease','LessonController');
+ }
+ }
+
+ public function setBusy(){
+ _isBusy = true;
+ }
+
+ public function clearBusy(){
+ _isBusy = false;
+ }
+
+ public function get appData():Object{
+ trace("called monitor application")
+ var myObj:Object = new Object();
+ myObj.compX = Application.LESSON_X
+ myObj.compY = Application.LESSON_Y
+ myObj.ttHolder = Application.tooltip;
+ return myObj;
+
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonModel.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonModel.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonModel.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,549 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.Observable;
+import org.lamsfoundation.lams.learner.*;
+import org.lamsfoundation.lams.learner.ls.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.Progress;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.Transition;
+
+
+/*
+* Model for the Lesson
+*/
+class LessonModel extends Observable {
+ private var _className:String = "LessonModel";
+
+ private var __width:Number;
+ private var __height:Number;
+ private var __x:Number;
+ private var __y:Number;
+ private var _spadHeight:Number;
+ private var _isDirty:Boolean;
+ private var infoObj:Object;
+
+ private var _lesson:Lesson;
+
+ // unique Lesson identifier
+ private var _lessonID:Number;
+
+ private var ddmActivity_keys:Array;
+ private var ddmTransition_keys:Array;
+ private var _activitiesDisplayed:Hashtable;
+ /**
+ * View state data
+ */
+ private var _lessonName:String;
+ private var _lessonDescription:String;
+ private var _lessonStateID:Number;
+ private var _learningDesignID:Number;
+ private var _learnerExportAvailable:Boolean;
+
+ /* the learningDesignModel gets set when you join a lesson */
+ private var _learningDesignModel:DesignDataModel;
+
+ private var _progressData:Progress;
+ private var _currentActivityOpen:Object;
+ private var _active:Boolean;
+
+
+ /**
+ * Constructor.
+ */
+ public function LessonModel (lesson:Lesson){
+ _lesson = lesson;
+ _active = false;
+ _learningDesignModel = null;
+ _progressData = null;
+ _currentActivityOpen = null;
+
+ ddmActivity_keys = new Array();
+ ddmTransition_keys = new Array();
+ _activitiesDisplayed = new Hashtable("_activitiesDisplayed");
+ }
+
+ public function populateFromDTO(dto:Object){
+ trace('populating lesson object for lesson:' + dto.lessonName);
+ _lessonID = dto.lessonID;
+ _lessonName = dto.lessonName;
+ _lessonDescription = dto.lessonDescription;
+ _lessonStateID = dto.lessonStateID;
+ _learningDesignID = dto.learningDesignID;
+ _learnerExportAvailable = dto.learnerExportAvailable;
+
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "LESSON";
+ notifyObservers(infoObj);
+ }
+
+
+ public function setSpadHeight(h:Number){
+ trace ("height is set to: "+h)
+ _spadHeight = h
+ Application.getInstance().onResize();
+ }
+
+ public function getSpadHeight(){
+ trace ("returning pi height: "+_spadHeight)
+ return _spadHeight;
+ }
+
+ /**
+ * Set Lesson's unique ID
+ *
+ * @param lessonID
+ */
+
+ public function setLessonID(lessonID:Number){
+ _lessonID = lessonID;
+ }
+
+ /**
+ * Get Lesson's unique ID
+ *
+ * @return Lesson ID
+ */
+
+ public function getLessonID():Number {
+ return _lessonID;
+ }
+
+ public function get ID():Number{
+ return _lessonID;
+ }
+
+ /**
+ * Set the lesson's name
+ *
+ * @param lessonName
+ */
+
+ public function setLessonName(lessonName:String){
+ _lessonName = lessonName;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "NAME";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Get the lesson's name
+ *
+ * @return Lesson Name
+ */
+
+ public function getLessonName():String {
+ return _lessonName;
+ }
+
+ public function get name():String{
+ return _lessonName;
+ }
+
+ /**
+ * Set the lesson's description
+ *
+ * @param lessonDescription
+ */
+
+ public function setLessonDescription(lessonDescription:String){
+ _lessonDescription = lessonDescription;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "DESCRIPTION";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Get the lesson's description
+ *
+ * @return lesson description
+ */
+ public function getLessonDescription():String {
+ return _lessonDescription;
+ }
+
+ public function get description():String{
+ return _lessonDescription;
+ }
+
+ public function setLessonStateID(lessonStateID:Number) {
+ _lessonStateID = lessonStateID;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "STATE";
+ notifyObservers(infoObj);
+ }
+
+ public function getLessonStateID():Number {
+ return _lessonStateID;
+ }
+
+ public function get stateID():Number{
+ return _lessonStateID;
+ }
+
+ public function setLearningDesignID(learningDesignID:Number){
+ _learningDesignID = learningDesignID;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "DESIGN";
+ notifyObservers(infoObj);
+ }
+
+ public function getLearningDesignID():Number{
+ return _learningDesignID;
+ }
+
+ public function get learningDesignID():Number{
+ return _learningDesignID;
+ }
+
+ public function setLearningDesignModel(learningDesignModel:DesignDataModel){
+ _learningDesignModel = learningDesignModel;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "DESIGNMODEL";
+ notifyObservers(infoObj);
+ }
+
+ public function set learnerExportAvailable(b:Boolean) {
+ _learnerExportAvailable = b;
+ }
+
+ public function get learnerExportAvailable():Boolean {
+ return _learnerExportAvailable;
+ }
+
+ public function getLearningDesignModel():DesignDataModel{
+ return _learningDesignModel;
+ }
+
+ public function get learningDesignModel():DesignDataModel{
+ return _learningDesignModel;
+ }
+
+ public function setProgressData(progressData:Progress){
+ _progressData = progressData;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "PROGRESS";
+ notifyObservers(infoObj);
+ }
+
+ public function getProgressData():Progress{
+ return _progressData;
+ }
+
+ public function get progressData():Progress{
+ return _progressData;
+ }
+
+ public function setActive() {
+ _active = true;
+ trace('setting lesson active...');
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "STATUS";
+ notifyObservers(infoObj);
+ }
+
+ public function setInactive() {
+ _active = false;
+ trace('setting lesson inactive...');
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "STATUS";
+ notifyObservers(infoObj);
+ }
+
+ public function getStatus():Boolean {
+ return _active;
+ }
+
+ private function orderDesign(activity:Activity, order:Array):Void{
+ trace("==> "+activity.activityID);
+ order.push(activity);
+ trace("transition keys length: "+ddmTransition_keys.length);
+ for(var i=0;i "+learnerFirstActivity.title);
+ // recursive method to order design
+ orderDesign(learnerFirstActivity, orderedActivityArr);
+
+ for(var i=0; i "+orderedActivityArr[i].title);
+
+ }
+ return orderedActivityArr;
+ trace("New Ordered Activities has length: "+orderedActivityArr.length)
+
+ }
+
+ public function setCurrentActivityOpen(ca:Object){
+
+ if(_currentActivityOpen != null && ca != null){
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "CLOSE_COMPLEX_ACTIVITY";
+ infoObj.data = _currentActivityOpen;
+ notifyObservers(infoObj);
+ }
+
+ _currentActivityOpen = ca;
+
+ }
+
+ public function getCurrentActivityOpen():Object{
+ return _currentActivityOpen;
+ }
+
+ /**
+ * get the design in the DesignDataModel and update the Monitor Model accordingly.
+ * NOTE: Design elements are added to the DDM here.
+ *
+ * @usage
+ * @return
+ */
+ public function drawDesign(){
+ var indexArray:Array = setDesignOrder();
+
+ //go through the design and get the activities and transitions
+
+ var dataObj:Object;
+ ddmActivity_keys = learningDesignModel.activities.keys();
+
+ //indexArray = ddmActivity_keys;
+ trace("Length of Activities in DDM: "+indexArray.length)
+
+ //loop through
+ for(var i=0;i 0 || ddm_activity.parentUIID > 0){
+ trace("this is Child")
+ }else {
+ broadcastViewUpdate("DRAW_ACTIVITY",ddm_activity);
+ }
+ }
+
+ }
+
+ public function updateDesign(){
+ var indexArray:Array = setDesignOrder();
+
+ //go through the design and get the activities and transitions
+
+ var dataObj:Object;
+ ddmActivity_keys = learningDesignModel.activities.keys();
+
+ //indexArray = ddmActivity_keys;
+ trace("Length of Activities in DDM: "+indexArray.length)
+
+ //loop through
+ for(var i=0;i 0 || ddm_activity.parentUIID > 0){
+ trace("this is Child")
+ }else {
+ broadcastViewUpdate("UPDATE_ACTIVITY",ddm_activity);
+ }
+ }
+ }
+
+ public function broadcastViewUpdate(updateType, data){
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = updateType;
+ infoObj.data = data;
+ notifyObservers(infoObj);
+
+ }
+
+ /**
+ * set the size on the model, this in turn will set a changed flag and notify observers (views)
+ * @param width - Tookit width
+ * @param height - Toolkit height
+ */
+ public function setSize(width:Number,height:Number) {
+ __width = width;
+ __height = height;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "SIZE";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Used by View to get the size
+ * @returns Object containing width(w) & height(h). obj.w & obj.h
+ */
+ public function getSize():Object{
+ var s:Object = {};
+ s.w = __width;
+ s.h = __height;
+ return s;
+ }
+
+ /**
+ * sets the model x + y vars
+ */
+ public function setPosition(x:Number,y:Number):Void{
+ //Set state variables
+ __x = x;
+ __y = y;
+ //Set flag for notify observers
+ setChanged();
+
+ //build and send update object
+ infoObj = {};
+ infoObj.updateType = "POSITION";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Used by View to get the size
+ * @returns Object containing width(w) & height(h). obj.w & obj.h
+ */
+ public function getPosition():Object{
+ var p:Object = {};
+ p.x = x;
+ p.y = y;
+ return p;
+ }
+
+ public function get activitiesDisplayed():Hashtable{
+ return _activitiesDisplayed;
+ }
+
+ public function getActivityKeys():Array{
+ return ddmActivity_keys;
+ }
+
+ //Accessors for x + y coordinates
+ public function get x():Number{
+ return __x;
+ }
+
+ public function get y():Number{
+ return __y;
+ }
+
+ //Accessors for x + y coordinates
+ public function get width():Number{
+ return __width;
+ }
+
+ public function get height():Number{
+ return __height;
+ }
+ function get className():String{
+ return 'LessonModel';
+ }
+
+ /**
+ *
+ * @return the Lesson
+ */
+ public function getLesson():Lesson{
+ return _lesson;
+ }
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonView.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonView.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonView.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,435 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.learner.*;
+import org.lamsfoundation.lams.learner.ls.*;
+import org.lamsfoundation.lams.learner.lb.*;
+
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.dict.*;
+
+import org.lamsfoundation.lams.authoring.Activity;
+
+import mx.managers.*;
+import mx.controls.*;
+import mx.events.*
+
+/**
+* Learner view for the Lesson
+* @author Mitchell Seaton
+*/
+class LessonView extends AbstractView {
+
+ private static var ACTIVITY_OFFSET = 65;
+ private static var LESSON_NAME_LENGTH_LIMIT = 20;
+ private static var ACT_TITLE_LENGTH_LIMIT = 20;
+ private static var SCROLL_CHECK_INTERVAL:Number = 10;
+ private static var SCROLL_LOOP_FACTOR:Number = 2;
+ private static var STRING_CONT:String = "...";
+
+ private var ScrollCheckIntervalID:Number = null;
+
+ private var _className = "LessonView";
+ private var _depth:Number;
+
+ // Lesson clip
+ private var _lesson_mc:MovieClip;
+
+ private var bkg_pnl:MovieClip;
+ private var lessonHead_pnl:MovieClip;
+ private var progress_scp:MovieClip;
+ private var _activityList:Array;
+
+ private var _tm:ThemeManager;
+ private var _dictionary:Dictionary;
+
+ private var ACT_X:Number = -20;
+ private static var ACT_X_OFFSET:Number = 65;
+ private var ACT_Y:Number = 32.5;
+
+
+ //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ /**
+ * Constructor
+ */
+ public function LessonView(){
+ _activityList = new Array();
+
+ _tm = ThemeManager.getInstance();
+
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+ }
+
+ /**
+ * Initialisation - sets up the mvc relations ship Abstract view.
+ * Also creates a doLater handler for createToolkit
+ */
+ public function init(m:Observable, c:Controller){
+
+ //Invoke superconstructor, which sets up MVC relationships.
+ super (m, c);
+
+ this.onEnterFrame = createLesson;
+ }
+
+ /**
+ * Sets up the lesson (clip)
+ */
+ public function createLesson() {
+ //Delete the enterframe dispatcher
+ delete this.onEnterFrame;
+
+ trace('creating new Lesson ...');
+ setStyles();
+
+ _lesson_mc = this;
+ _depth = this.getNextHighestDepth();
+
+ //Now that view is setup dispatch loaded event
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ /*
+ * Updates state of the Lesson, called by Lesson Model
+ *
+ * @param o The model object that is broadcasting an update.
+ * @param infoObj object with details of changes to model
+ */
+ public function update (o:Observable,infoObj:Object):Void {
+ //Cast the generic observable object into the Toolbar model.
+ var lm:LessonModel = LessonModel(o);
+ trace('getting lesson update...');
+ //Update view from info object
+ switch (infoObj.updateType) {
+ case 'POSITION' :
+ setPosition(lm);
+ break;
+ case 'SIZE' :
+ setSize(lm);
+ break;
+ case 'STATUS' :
+ Debugger.log('status updated',Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonView');
+ removeAll(lm);
+ break;
+ case 'DRAW_ACTIVITY' :
+ drawActivity(infoObj.data, lm);
+ break;
+ case 'UPDATE_ACTIVITY' :
+ Debugger.log('updating activity: ' + infoObj.data.activityUIID,Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonView');
+ updateActivity(infoObj.data, lm);
+ break;
+ case 'REMOVE_ACTIVITY' :
+ removeActivity(infoObj.data, lm);
+ break;
+ case 'LESSON' :
+ trace('setting lesson name');
+ setLessonName(lm.name);
+ Application.getInstance().getHeader().showExportButton(lm.learnerExportAvailable);
+ break;
+ case 'DESIGNMODEL' :
+ trace('updating design model for lesson..');
+ lm.getLesson().finishedDesign = true;
+ break;
+ case 'PROGRESS' :
+ Debugger.log('progress data receieved for user..' + lm.progressData.getUserName(),Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonView');
+ break;
+ case 'PROGRESS_UPDATE' :
+ Debugger.log('progress data receieved for user..' + lm.progressData.getUserName(),Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonView');
+ //removeAll(lm);
+ lm.updateDesign();
+ break;
+ case 'CLOSE_COMPLEX_ACTIVITY' :
+ closeComplexActivity(infoObj.data, lm);
+ Debugger.log('closing complex activity' + infoObj.data.activity.activityUIID,Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonView');
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonView');
+ }
+ }
+
+ private function setLessonName(lessonName:String){
+ if (lessonName.length > LESSON_NAME_LENGTH_LIMIT){
+ lessonName = lessonName.substr(0, LESSON_NAME_LENGTH_LIMIT)+STRING_CONT;
+ }
+ Application.getInstance().getHeader().setLessonName(lessonName);
+ }
+
+ /**
+ * Remove the activityies from screen on selection of new lesson
+ *
+ * @usage
+ * @param activityUIID
+ * @return
+ */
+ private function removeActivity(a:Activity,lm:LessonModel){
+ //dispatch an event to show the design has changed
+ trace("in removeActivity")
+ var r = lm.activitiesDisplayed.remove(a.activityUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+
+ }
+
+ private function removeAll(lm:LessonModel){
+ var keys = lm.activitiesDisplayed.keys();
+ for(var i=0; i ACT_TITLE_LENGTH_LIMIT) {
+ activityTitle = activityTitle.substr(0,ACT_TITLE_LENGTH_LIMIT) + STRING_CONT;
+ }
+
+
+ //take action depending on act type
+ if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity() ){
+ newActivity_mc = _activityLayer_mc.attachMovie("LearnerActivity", "LearnerActivity" + a.activityID, _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:lc,_view:lv, _x:(progress_scp._width/2)-ACT_X_OFFSET, _y:ACT_Y, actLabel:activityTitle, learner:lm.progressData, _complex:false});
+ ACT_Y = newActivity_mc._y + ACTIVITY_OFFSET;
+ Debugger.log('The activity:'+a.title+','+a.activityTypeID+' is tool/gate/group activity',Debugger.CRITICAL,'drawActivity','LessonView');
+ } else if(a.isGateActivity()){
+ newActivity_mc = _activityLayer_mc.attachMovie("LearnerGateActivity", "LearnerGateActivity" + a.activityID, _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:lc,_view:lv, _x:(progress_scp._width/2)-ACT_X_OFFSET, _y:ACT_Y, actLabel:activityTitle, learner:lm.progressData, _complex:false});
+ ACT_Y = newActivity_mc._y + ACTIVITY_OFFSET;
+ } else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE){
+ //get the children
+ var children:Array = lm.learningDesignModel.getComplexActivityChildren(a.activityUIID);
+ Debugger.log('The activity:'+a.title+','+a.activityTypeID+' is is parellel (complex) activity',Debugger.CRITICAL,'drawActivity','LessonView');
+
+ newActivity_mc = _activityLayer_mc.attachMovie("LearnerComplexActivity", "LearnerComplexActivity" + a.activityID, _activityLayer_mc.getNextHighestDepth(),{_activity:a,_children:children,_controller:lc,_view:lv, _x:(progress_scp._width/2)-ACT_X_OFFSET, _y:ACT_Y, learner:lm.progressData});
+ ACT_Y = newActivity_mc._y + ACTIVITY_OFFSET;
+ }else if(a != null){
+ Debugger.log('The activity:'+a.title+','+a.activityUIID+' is of unknown type, drawing default icon',Debugger.CRITICAL,'drawActivity','LessonView');
+ newActivity_mc = _activityLayer_mc.attachMovie("LearnerActivity", "LearnerActivity" + a.activityID, _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:lc,_view:lv, _x:(progress_scp._width/2)-ACT_X_OFFSET, _y:ACT_Y, actLabel:activityTitle, learner:lm.progressData, _complex:false});
+ ACT_Y = newActivity_mc._y + ACTIVITY_OFFSET;
+ }
+
+ _activityList.push(newActivity_mc);
+
+ var actItems:Number = lm.activitiesDisplayed.size()
+ if (actItems < lm.getActivityKeys().length){
+ lm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
+ }
+
+ progress_scp.redraw(true);
+ getAndScrollToTargetPos(a, newActivity_mc, lm.progressData, true);
+
+ return true;
+ }
+
+
+ /**
+ * Updates existing activity on learner progress bar.
+ * @usage
+ * @param a - Activity to be drawn
+ * @param lm - Refernce to the model
+ * @return Boolean - successfullit
+ */
+ private function updateActivity(a:Activity,lm:LessonModel):Boolean{
+
+
+ if(lm.activitiesDisplayed.containsKey(a.activityUIID)){
+ var activityMC:Object = lm.activitiesDisplayed.get(a.activityUIID);
+ activityMC.refresh();
+
+ Debugger.log('progess data:'+lm.progressData.getCurrentActivityId()+' a.activityID:'+a.activityID,Debugger.CRITICAL,'updateActivity','LessonView');
+
+ getAndScrollToTargetPos(a, activityMC, lm.progressData, false);
+
+ } else {
+ drawActivity(a, lm);
+ }
+
+
+
+
+ return true;
+ }
+
+ private function getAndScrollToTargetPos(a:Activity, activityMC:Object, data:Progress, override:Boolean):Void {
+ var targetPos;
+
+ if(data.getCurrentActivityId() == a.activityID){
+ //progress_scp.vPosition = activityMC._x;
+ var scrollBarPosition = activityMC._y - (ACTIVITY_OFFSET*1.5);
+ Debugger.log('|| sb pos: ' + scrollBarPosition + ' || max pos: ' + progress_scp.vScroller.maxPos+ ' || activity Y:'+activityMC._y+' || progress_scp.content._height:'+progress_scp.content._height,Debugger.CRITICAL,'getAndScrollToTargetPos','LessonView');
+
+ if((scrollBarPosition >= 0) && (scrollBarPosition <= progress_scp.vScroller.maxPos)){
+ targetPos = scrollBarPosition;
+ } else if(scrollBarPosition >= progress_scp.vScroller.maxPos){
+ targetPos = progress_scp.vScroller.maxPos;
+ } else {
+ targetPos = progress_scp.vScroller.minPos;
+ }
+
+ if(progress_scp.vScroller._visible) {
+ Debugger.log('adjusting scrollbar position to target: ' + targetPos,Debugger.CRITICAL,'getAndScrollToTargetPos','LessonView');
+ if(ScrollCheckIntervalID == null && !override) {
+ ScrollCheckIntervalID = setInterval(Proxy.create(this,adjustScrollBar,targetPos),SCROLL_CHECK_INTERVAL);
+ } else {
+ progress_scp.vPosition = Math.round(targetPos);
+ }
+ }
+ }
+ }
+
+ private function adjustScrollBar(targetVal:Number) {
+
+ var offset:Number;
+ var count:Number = 0;
+
+ while(count < SCROLL_LOOP_FACTOR) {
+ var currentVal:Number = Number(progress_scp.vPosition);
+ count++;
+
+ if(Math.round(currentVal) == Math.round(targetVal)) {
+ if(ScrollCheckIntervalID) {
+ Debugger.log('clearing Scroll Check Interval: ' + targetVal,Debugger.CRITICAL,'adjustScrollBar','LessonView');
+ clearInterval(ScrollCheckIntervalID);
+ ScrollCheckIntervalID = null;
+ }
+
+ return;
+ } else {
+
+ if(Math.round(currentVal) < Math.round(targetVal)) {
+ offset = 1;
+ } else {
+ offset = -1;
+ }
+
+ progress_scp.vPosition = currentVal + offset;
+ Debugger.log('adjusting scroll position - offset: ' + offset+ ' - currentVal: ' + currentVal + ' - targetVal: ' + targetVal,Debugger.CRITICAL,'adjustScrollBar','LessonView');
+
+ }
+ }
+ }
+
+ /**
+ * Sets the size of the Lesson on stage, called from update
+ */
+ private function setSize(lm:LessonModel):Void{
+
+ var s:Object = lm.getSize();
+
+ //Size panel
+ trace('lesson view setting width to '+s.w);
+ bkg_pnl.setSize(s.w,s.h);
+ progress_scp.setSize(s.w, s.h-progress_scp._y)
+ }
+
+ /**
+ * Sets the position of the Lesson on stage, called from update
+ * @param lm Lesson model object
+ */
+ private function setPosition(lm:LessonModel):Void{
+ var p:Object = lm.getPosition();
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ /**
+ * Set the styles for the Lesson
+ */
+ private function setStyles() {
+ var styleObj = _tm.getStyleObject('WZPanel');
+ bkg_pnl.setStyle('styleName', styleObj);
+
+ styleObj = _tm.getStyleObject('scrollpane');
+ progress_scp.setStyle('styleName', styleObj);
+ }
+
+ /**
+ * Gets the LessonModel
+ *
+ * @returns model
+ */
+ public function getModel():LessonModel{
+ return LessonModel(model);
+ }
+ /**
+ * Overrides method in abstract view to ensure cortect type of controller is returned
+ * @usage
+ * @return LessonController
+ */
+ public function getController():LessonController{
+ var c:Controller = super.getController();
+ return LessonController(c);
+ }
+ /*
+ * Returns the default controller for this view.
+ */
+ public function defaultController (model:Observable):Controller {
+ return new LessonController(model);
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/Application.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/Application.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/Application.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,697 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+//import org.lamsfoundation.lams.monitoring.*
+import org.lamsfoundation.lams.monitoring.ls.* //Lessons
+import org.lamsfoundation.lams.authoring.cv.CanvasActivity //Canvas Activity Used in Monitor Tab View
+import org.lamsfoundation.lams.authoring.DesignDataModel
+import org.lamsfoundation.lams.monitoring.mv.* //Monitor
+import org.lamsfoundation.lams.monitoring.layout.DefaultLayoutManager //Monitor Layouts
+import org.lamsfoundation.lams.common.ws.* //Workspace
+import org.lamsfoundation.lams.common.comms.* //communications
+import org.lamsfoundation.lams.common.util.* //Utils
+import org.lamsfoundation.lams.common.dict.* //Dictionary
+import org.lamsfoundation.lams.common.ui.* //User interface
+import org.lamsfoundation.lams.common.style.* //Themes/Styles
+import org.lamsfoundation.lams.common.layout.* // Layouts
+import org.lamsfoundation.lams.common.*
+import mx.managers.*
+import mx.utils.*
+
+/**
+* Application - LAMS Application
+* @author DI
+*/
+class org.lamsfoundation.lams.monitoring.Application extends ApplicationParent {
+
+
+ private static var SHOW_DEBUGGER:Boolean = false;
+ private static var MODULE:String = "monitoring";
+ /*
+ private static var TOOLBAR_X:Number = 10;
+ private static var TOOLBAR_Y:Number = 35;
+*/
+ private static var _controlKeyPressed:String;
+ public static var TOOLBAR_X:Number = 0;
+ public static var TOOLBAR_Y:Number = 21;
+
+ //private static var LESSONS_X:Number = 0;
+ //private static var LESSONS_Y:Number = 21;
+
+ public static var MONITOR_X:Number = 0;
+ public static var MONITOR_Y:Number = 55;
+ public static var MONITOR_W:Number = 550;
+ public static var MONITOR_H:Number = 550;
+
+ public static var WORKSPACE_X:Number = 200;
+ public static var WORKSPACE_Y:Number = 200;
+ public static var WORKSPACE_W:Number = 300;
+ public static var WORKSPACE_H:Number = 200;
+
+ public static var APP_ROOT_DEPTH:Number = 10; //depth of the application root
+ public static var DIALOGUE_DEPTH:Number = 20; //depth of the cursors
+ public static var TOOLTIP_DEPTH:Number = 60; //depth of the cursors
+ public static var CURSOR_DEPTH:Number = 40; //depth of the cursors
+ public static var MENU_DEPTH:Number = 25; //depth of the menu
+ public static var CCURSOR_DEPTH:Number = 101;
+
+ public static var UI_LOAD_CHECK_INTERVAL:Number = 50;
+ public static var UI_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+ public static var DATA_LOAD_CHECK_INTERVAL:Number = 50;
+ public static var DATA_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+
+ private static var QUESTION_MARK_KEY:Number = 191;
+ private static var X_KEY:Number = 88;
+ private static var C_KEY:Number = 67;
+ private static var D_KEY:Number = 68;
+ //private static var T_KEY:Number = 84;
+ private static var V_KEY:Number = 86;
+ private static var Z_KEY:Number = 90;
+ private static var Y_KEY:Number = 89;
+
+ private static var COMPONENT_NO = 5;
+
+ private var _uiLoadCheckCount = 0; // instance counter for number of times we have checked to see if theme and dict are loaded
+ private var _dataLoadCheckCount = 0;
+
+ //private var _ddm:DesignDataModel;
+ //private var _toolbar:Toolbar;
+ private var _lessons:Lesson;
+ private var _monitor:Monitor;
+ private var _workspace:Workspace;
+ private var _comms:Communication;
+ private var _themeManager:ThemeManager;
+ private var _dictionary:Dictionary;
+ private var _ccm:CustomContextMenu;
+ private var _config:Config;
+ private var _debugDialog:MovieClip; //Reference to the debug dialog
+
+
+ private var _dialogueContainer_mc:MovieClip; //Dialog container
+ private var _tooltipContainer_mc:MovieClip; //Tooltip container
+ private var _cursorContainer_mc:MovieClip; //Cursor container
+ private var _menu_mc:MovieClip; //Menu bar clip
+ private var _container_mc:MovieClip; //Main container
+
+ //Data flags
+ private var _dictionaryLoaded:Boolean; //Dictionary loaded flag
+ private var _dictionaryEventDispatched:Boolean //Event status flag
+ private var _themeLoaded:Boolean; //Theme loaded flag
+ private var _themeEventDispatched:Boolean //Dictionary loaded flag
+ private var _UILoadCheckIntervalID:Number; //Interval ID for periodic check on UILoad status
+ private var _UILoaded:Boolean; //UI Loading status
+
+ private var _DataLoadCheckIntervalID:Number;
+
+ // Data Elements
+ private var _sequenceLoaded:Boolean; //Sequence(+Design) loaded flag
+
+ //UI Elements
+ private var _monitorLoaded:Boolean;
+ private var _lessonsLoaded:Boolean;
+ private var _menuLoaded:Boolean;
+ private var _showCMItem:Boolean;
+
+ // Layout Manager
+ private var _layout:LFLayout;
+
+ //clipboard
+ private var _clipboardData:Object;
+
+ private var _sequence:Sequence;
+
+ //Application instance is stored as a static in the application class
+ private static var _instance:Application = null;
+ private var dispatchEvent:Function;
+
+ /**
+ * Application - Constructor
+ */
+ private function Application(){
+ super(this);
+ _sequence = null;
+ _sequenceLoaded = false;
+ _menuLoaded = false;
+ _lessonsLoaded = false;
+ _monitorLoaded = false;
+ _module = Application.MODULE;
+ _ccm = CustomContextMenu.getInstance();
+
+ mx.events.EventDispatcher.initialize(this);
+
+ }
+
+ /**
+ * Retrieves an instance of the Application singleton
+ */
+ public static function getInstance():Application{
+ if(Application._instance == null){
+ Application._instance = new Application();
+ }
+ return Application._instance;
+ }
+
+ /**
+ * Main entry point to the application
+ */
+ public function main(container_mc:MovieClip){
+ _container_mc = container_mc;
+ _UILoaded = false;
+
+ loader.start(DefaultLayoutManager.COMPONENT_NO);
+
+ _customCursor_mc = _container_mc.createEmptyMovieClip('_customCursor_mc', CCURSOR_DEPTH);
+
+ //add the cursors:
+ Cursor.addCursor(C_HOURGLASS);
+ Cursor.addCursor(C_LICON);
+
+ //Comms object - do this before any objects are created that require it for server communication
+ _comms = new Communication();
+
+ //Get the instance of config class
+ _config = Config.getInstance();
+
+ //Assign the config load event to
+ _config.addEventListener('load',Delegate.create(this,configLoaded));
+
+ //Set up Key handler
+ //TODO take out after testing and uncomment same key handler in ready();
+ Key.addListener(this);
+ }
+
+ /**
+ * Called when the config class has loaded
+ */
+ private function configLoaded(){
+ //Now that the config class is ready setup the UI and data, call to setupData() first in
+ //case UI element constructors use objects instantiated with setupData()
+ loader.complete();
+ setupData();
+ checkDataLoaded();
+
+ }
+
+ /**
+ * Loads and sets up event listeners for Theme, Dictionary etc.
+ */
+ private function setupData() {
+
+ //Get the language, create+load dictionary and setup load handler.
+ var language:String = String(_config.getItem('language'));
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('load',Delegate.create(this,onDictionaryLoad));
+ _dictionary.load(language);
+
+
+
+ //Set reference to StyleManager and load Themes and setup load handler.
+ var theme:String = String(_config.getItem('theme'));
+ _themeManager = ThemeManager.getInstance();
+ _themeManager.addEventListener('load',Delegate.create(this,onThemeLoad));
+ _themeManager.loadTheme(theme);
+ Debugger.getInstance().crashDumpSeverityLevel = Number(_config.getItem('crashDumpSeverityLevelLog'));
+ Debugger.getInstance().severityLevel = Number(_config.getItem('severityLevelLog'));
+
+ // Load lesson sequence
+ requestSequence(_root.lessonID);
+ }
+
+ public function reloadSequence(seqID:Number, target:Function){
+ requestSequence(seqID, target);
+ }
+
+ private function requestSequence(seqID:Number, target:Function){
+ var callback:Function = (target == null) ? Proxy.create(this, saveSequence) : target;
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getLessonDetails&lessonID=' + String(seqID) + '&userID=' + _root.userID,callback, false);
+ }
+
+ private function saveSequence(seqDTO:Object){
+ // create new Sequence from DTO
+ _sequence = new Sequence(seqDTO);
+ _sequence.addEventListener('load',Delegate.create(this,onSequenceLoad));
+
+ // load Sequence design
+ openLearningDesign(_sequence);
+
+ }
+
+ public function reloadLearningDesign(seq:Sequence, target:Function) {
+ openLearningDesign(seq, target);
+ }
+
+ /**
+ * server call for Learning Deign and sent it to the save it in DataDesignModel
+ *
+ * @usage
+ * @param seq type Sequence;
+ * @return Void
+ */
+ private function openLearningDesign(seq:Sequence, target:Function){
+ var designID:Number = seq.learningDesignID;
+ var callback:Function = (target == null) ? Proxy.create(this,saveDataDesignModel) : target;
+
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designID,callback, false);
+
+ }
+
+ private function saveDataDesignModel(learningDesignDTO:Object){
+ var _ddm:DesignDataModel = new DesignDataModel();
+ _ddm.setDesign(learningDesignDTO);
+
+ _sequence.setLearningDesignModel(_ddm);
+
+ }
+
+ /**
+ * Called when the current selected theme has been loaded
+ * @param evt:Object the event object
+ */
+ private function onSequenceLoad(evt:Object) {
+ if(evt.type=='load'){
+ _sequenceLoaded = true;
+ Debugger.log('!Sequence (+Design) loaded :',Debugger.CRITICAL,'onSequenceLoad','Application');
+ } else {
+ Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onSequenceLoad','Application');
+ }
+
+ }
+
+ /**
+ * Periodically checks if data has been loaded
+ */
+ private function checkDataLoaded() {
+ // first time through set interval for method polling
+ if(!_DataLoadCheckIntervalID) {
+ _DataLoadCheckIntervalID = setInterval(Proxy.create(this, checkDataLoaded), DATA_LOAD_CHECK_INTERVAL);
+ } else {
+ _dataLoadCheckCount++;
+ // if dictionary and theme data loaded setup UI
+ if(_dictionaryLoaded && _themeLoaded && _sequenceLoaded) {
+ clearInterval(_DataLoadCheckIntervalID);
+
+ setupUI();
+ checkUILoaded();
+
+
+ } else if(_dataLoadCheckCount >= DATA_LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('reached timeout waiting for data to load.',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UILoadCheckIntervalID);
+
+
+ }
+ }
+ }
+
+ /**
+ * Runs periodically and dispatches events as they are ready
+ */
+ private function checkUILoaded() {
+ //If it's the first time through then set up the interval to keep polling this method
+ if(!_UILoadCheckIntervalID) {
+ _UILoadCheckIntervalID = setInterval(Proxy.create(this,checkUILoaded),UI_LOAD_CHECK_INTERVAL);
+ } else {
+ _uiLoadCheckCount++;
+ //If all events dispatched clear interval and call start()
+ if(_UILoaded && _dictionaryEventDispatched && _themeEventDispatched){
+ //Debugger.log('Clearing Interval and calling start :',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UILoadCheckIntervalID);
+ start();
+ }else {
+ //If UI loaded check which events can be broadcast
+ if(_UILoaded){
+ //Debugger.log('ALL UI LOADED, waiting for all true to dispatch init events: _dictionaryLoaded:'+_dictionaryLoaded+'_themeLoaded:'+_themeLoaded ,Debugger.GEN,'checkUILoaded','Application');
+
+ //If dictionary is loaded and event hasn't been dispatched - dispatch it
+ if(_dictionaryLoaded && !_dictionaryEventDispatched){
+ _dictionaryEventDispatched = true;
+ _dictionary.broadcastInit();
+ }
+ //If theme is loaded and theme event hasn't been dispatched - dispatch it
+ if(_themeLoaded && !_themeEventDispatched){
+ _themeEventDispatched = true;
+ _themeManager.broadcastThemeChanged();
+ }
+
+ if(_uiLoadCheckCount >= UI_LOAD_CHECK_TIMEOUT_COUNT){
+ //if we havent loaded the dict or theme by the timeout count then give up
+ Debugger.log('raeached time out waiting to load dict and themes, giving up.',Debugger.CRITICAL,'checkUILoaded','Application');
+ var msg:String = "";
+ if(!_themeEventDispatched){
+ msg+=Dictionary.getValue("app_chk_themeload");
+ }
+ if(!_dictionaryEventDispatched){
+ msg+="The lanaguage data has not been loaded.";
+ }
+ msg+=Dictionary.getValue("app_fail_continue");
+ var e:LFError = new LFError(msg,"Canvas.setDroppedTemplateActivity",this,'_themeEventDispatched:'+_themeEventDispatched+' _dictionaryEventDispatched:'+_dictionaryEventDispatched);
+ e.showErrorAlert();
+ //todo: give the user a message
+ clearInterval(_UILoadCheckIntervalID);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is called by each UI element as it loads to notify Application that it's loaded
+ * When all UIElements are loaded the Application can set UILoaded flag true allowing events to be dispatched
+ * and methods called on the UI Elements
+ *
+ * @param UIElementID:String - Identifier for the Element that was loaded
+ */
+ public function UIElementLoaded(evt:Object) {
+ //Debugger.log('UIElementLoaded: ' + evt.target.className,Debugger.GEN,'UIElementLoaded','Application');
+ if(evt.type=='load'){
+ //Which item has loaded
+ /**switch (evt.target.className) {
+ case 'LFMenuBar' :
+ _menuLoaded = true;
+ break;
+ case 'Monitor' :
+ _monitorLoaded = true;
+ break;
+ default:
+ }*/
+
+ _layout.manager.addLayoutItem(new LFLayoutItem(evt.target.className, evt.target));
+
+ loader.complete();
+
+ //If all of them are loaded set UILoad accordingly
+ if(_layout.manager.completedLayout){
+ _UILoaded=true;
+ } else {
+ _UILoaded = false;
+ }
+
+ }
+ }
+
+ /**
+ * Create all UI Elements
+ */
+ private function setupUI(){
+ _ccm.showCustomCM(_ccm.loadMenu("application", "monitoring"))
+ //Create the application root
+ _appRoot_mc = _container_mc.createEmptyMovieClip('appRoot_mc',APP_ROOT_DEPTH);
+ //Create screen elements
+ _dialogueContainer_mc = _container_mc.createEmptyMovieClip('_dialogueContainer_mc',DIALOGUE_DEPTH);
+
+ _cursorContainer_mc = _container_mc.createEmptyMovieClip('_cursorContainer_mc',CURSOR_DEPTH);
+
+ _tooltipContainer_mc = _container_mc.createEmptyMovieClip('_tooltipContainer_mc',TOOLTIP_DEPTH);
+
+ var manager = ILayoutManager(new DefaultLayoutManager('default'));
+ _layout = new LFLayout(this, manager);
+ _layout.init();
+
+ }
+
+
+ public function help():Void{
+ Debugger.log("called help page for activity ",Debugger.CRITICAL,'getHelp','Monitor');
+ var ca = _monitor.getMM().selectedItem
+ if (CanvasActivity(ca) != null){
+ _monitor.getHelp(ca);
+ }
+ }
+
+
+ public function MonitorActivityContent():Void{
+ trace("testing MonitorActivityContent");
+ var ca = _monitor.getMM().selectedItem
+ if (CanvasActivity(ca) != null){
+ _monitor.getMV().getController().activityDoubleClick(ca, "MonitorTabView");
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('al_activity_openContent_invalid'));
+ }
+ }
+
+
+ /**
+ * Runs when application setup has completed. At this point the init/loading screen can be removed and the user can
+ * work with the application
+ */
+ private function start(){
+
+ //Fire off a resize to set up sizes
+ onResize();
+
+ // Remove the loading screen
+ loader.stop();
+
+ if(SHOW_DEBUGGER){
+ showDebugger();
+ }
+ }
+
+ /**
+ * Receives events from the Stage resizing
+ */
+ public function onResize(){
+ //Debugger.log('onResize',Debugger.GEN,'main','org.lamsfoundation.lams.Application');
+
+ //Get the stage width and height and call onResize for stage based objects
+ var w:Number = Stage.width;
+ var h:Number = Stage.height;
+
+ _layout.manager.resize(w, h);
+
+ var someListener:Object = new Object();
+ someListener.onMouseUp = function () {
+
+ _layout.manager.resize(w, h);
+
+ }
+
+ }
+
+ /**
+ * Handles KEY Releases for Application
+ */
+
+ public function transition_keyPressed(){
+ _controlKeyPressed = "transition";
+
+ }
+ public function showDebugger():Void{
+ _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
+ }
+
+ public function hideDebugger():Void{
+ _debugDialog.deletePopUp();
+ }
+
+ /**
+ * stores a reference to the object
+ * @usage
+ * @param obj
+ * @return
+ */
+ public function setClipboardData(obj:Object):Void{
+ _clipboardData = obj;
+ }
+
+ /**
+ * returns a reference to the object on the clipboard.
+ * Note it must be cloned to be used. this should be taken care of by the destination class
+ * @usage
+ * @return
+ */
+ public function getClipboardData():Object{
+ return _clipboardData;
+ }
+
+
+ public function cut():Void{
+ //setClipboardData(_canvas.model.selectedItem);
+ }
+
+ public function copy():Void{
+ //setClipboardData(_canvas.model.selectedItem);
+ }
+
+ public function paste():Void{
+ //_canvas.setPastedItem(getClipboardData());
+ }
+
+ /**
+ * returns the the canvas instance
+ */
+ public function getMonitor():Monitor{
+ return _monitor;
+ }
+ public function get controlKeyPressed():String{
+ return _controlKeyPressed;
+ }
+
+
+ /**
+ * returns the lesson instance
+ */
+ public function getLesson():Lesson{
+ return _lessons;
+ }
+
+ public function set menubar(a:MovieClip) {
+ _menu_mc = a;
+ }
+
+ public function get menubar():MovieClip {
+ return _menu_mc;
+ }
+
+ public function set monitor(a:Monitor) {
+ _monitor = a;
+ }
+
+ public function get monitor():Monitor {
+ return _monitor;
+ }
+
+ public function get layout():LFLayout {
+ return _layout;
+ }
+
+ public function set workspace(a:Workspace) {
+ _workspace = a;
+ }
+
+ public function get workspace():Workspace {
+ return _workspace;
+ }
+
+ public function get sequence():Sequence {
+ return _sequence;
+ }
+
+ public function set sequence(s:Sequence) {
+ _sequence = s;
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.authoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ /**
+ * Returns the Dialogue conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get dialogue():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._dialogueContainer_mc != undefined) {
+ return _instance._dialogueContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the tooltip conatiner mc
+ *
+ * @usage Import monioring package and then use
+ *
+ */
+ static function get tooltip():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._tooltipContainer_mc != undefined) {
+ return _instance._tooltipContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Cursor conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get cursor():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._cursorContainer_mc != undefined) {
+ return _instance._cursorContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.monitoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get root():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._appRoot_mc != undefined) {
+ return _instance._appRoot_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if _appRoot hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.authoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get containermc():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._container_mc != undefined) {
+ return _instance._container_mc;
+ } else {
+
+ }
+ }
+
+ /**
+ * Handles KEY presses for Application
+ */
+ private function onKeyDown(){
+ if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
+ if (!_debugDialog.content){
+ showDebugger();
+ }else {
+ hideDebugger();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/ContributeActivity.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/ContributeActivity.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/ContributeActivity.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,140 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.monitoring.*;
+import org.lamsfoundation.lams.authoring.Activity;
+
+/*
+* Contribute Activity - singleton class representing a contributing activity
+*/
+class ContributeActivity extends Activity {
+
+ /* Contribution Types - defined in org.lamsfoundation.lams.learningdesign.ContributionTypes */
+ public static var MODERATION:Number = 1;
+ public static var DEFINE_LATER:Number = 2;
+ public static var PERMISSION_GATE:Number = 3;
+ public static var SYNC_GATE:Number = 4;
+ public static var SCHEDULE_GATE:Number = 5;
+ public static var CHOSEN_GROUPING:Number = 6;
+ public static var CONTRIBUTION:Number = 7;
+
+ private var _childActivities:Array;
+ private var _contributeEntries:Array;
+ private var _contributionType:Number;
+ private var _taskURL:String;
+ private var _isRequired:Boolean;
+
+ private static var _instance:ContributeActivity = null;
+
+ /**
+ * Constructor.
+ */
+ public function ContributeActivity (){
+ super(null);
+ _childActivities = new Array();
+ _contributeEntries = new Array();
+ }
+
+ /**
+ *
+ * @return the ContributeActivity
+ */
+ public static function getInstance():ContributeActivity{
+ if(ContributeActivity._instance == null){
+ ContributeActivity._instance = new ContributeActivity();
+ }
+ return ContributeActivity._instance;
+ }
+
+
+ public function populateFromDTO(dto:Object, id:String){
+ trace('populating from dto...');
+ _activityID = dto.activityID;
+ _parentActivityID = dto.parentActivityID;
+ _activityTypeID = dto.activityTypeID;
+
+ if(dto.childActivities != null){
+ // create children
+ for(var i=0; i:"
+ ok_btn.label = "Create" //Dictionary.getValue('ws_dlg_ok_button');
+ cancel_btn.label = Dictionary.getValue('ws_dlg_cancel_button');
+
+ //TODO: Dictionary calls for all the rest of the buttons
+
+ //TODO: Make setStyles more efficient
+ setStyles();
+
+ //get focus manager + set focus to OK button, focus manager is available to all components through getFocusManager
+ fm = _container.getFocusManager();
+ fm.enabled = true;
+ ok_btn.setFocus();
+ //fm.defaultPushButton = ok_btn;
+
+ Debugger.log('ok_btn.tabIndex: '+ok_btn.tabIndex,Debugger.GEN,'init','org.lamsfoundation.lams.WorkspaceDialog');
+
+
+ //Tie parent click event (generated on clicking close button) to this instance
+ _container.addEventListener('click',this);
+ //Register for LFWindow size events
+ _container.addEventListener('size',this);
+
+ //panel.setStyle('backgroundColor',0xFFFFFF);
+
+ //Debugger.log('setting offsets',Debugger.GEN,'init','org.lamsfoundation.lams.common.ws.WorkspaceDialog');
+
+ //work out offsets from bottom RHS of panel
+ xOkOffset = panel._width - ok_btn._x;
+ yOkOffset = panel._height - ok_btn._y;
+ xCancelOffset = panel._width - cancel_btn._x;
+ yCancelOffset = panel._height - cancel_btn._y;
+
+ //Register as listener with StyleManager and set Styles
+ themeManager.addEventListener('themeChanged',this);
+ location_dnd.dragRules = TreeDnd.DENYALL;
+ treeview = location_dnd.getTree();
+ //Fire contentLoaded event, this is required by all dialogs so that creator of LFWindow can know content loaded
+
+ _container.contentLoaded();
+ }
+
+ /**
+ * Called by the worspaceView after the content has loaded
+ * @usage
+ * @return
+ */
+ public function setUpContent():Void{
+
+ //register to recive updates form the model
+ WorkspaceModel(_workspaceView.getModel()).addEventListener('viewUpdate',this);
+
+ Debugger.log('_workspaceView:'+_workspaceView,Debugger.GEN,'setUpContent','org.lamsfoundation.lams.common.ws.WorkspaceDialog');
+ //get a ref to the controller and kkep it here to listen for events:
+ _workspaceController = _workspaceView.getController();
+ Debugger.log('_workspaceController:'+_workspaceController,Debugger.GEN,'setUpContent','org.lamsfoundation.lams.common.ws.WorkspaceDialog');
+
+
+ //Add event listeners for ok, cancel and close buttons
+ ok_btn.addEventListener('click',Delegate.create(this, ok));
+ cancel_btn.addEventListener('click',Delegate.create(this, cancel));
+ //think this is failing....
+ //Set up the treeview
+ setUpTreeview();
+
+ itemSelected(treeview.selectedNode);
+ }
+
+ /**
+ * Recieved update events from the WorkspaceModel. Dispatches to relevent handler depending on update.Type
+ * @usage
+ * @param event
+ */
+ public function viewUpdate(event:Object):Void{
+ Debugger.log('Recived an Event dispather UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','org.lamsfoundation.lams.ws.WorkspaceDialog');
+ //Update view from info object
+ //Debugger.log('Recived an UPDATE!, updateType:'+infoObj.updateType,4,'update','CanvasView');
+ var wm:WorkspaceModel = event.target;
+ //set a permenent ref to the model for ease (sorry mvc guru)
+ _workspaceModel = wm;
+
+ switch (event.updateType){
+ case 'POPULATE_LICENSE_DETAILS' :
+ //populateAvailableLicenses(event.data, wm);
+ case 'REFRESH_TREE' :
+ refreshTree(wm);
+ break;
+ case 'UPDATE_CHILD_FOLDER' :
+ updateChildFolderBranches(event.data,wm);
+ case 'ITEM_SELECTED' :
+ itemSelected(event.data,wm);
+ break;
+ case 'OPEN_FOLDER' :
+ openFolder(event.data, wm);
+ break;
+ case 'CLOSE_FOLDER' :
+ closeFolder(event.data, wm);
+ break;
+ case 'REFRESH_FOLDER' :
+ refreshFolder(event.data, wm);
+ break;
+ case 'SHOW_DATA' :
+ showData(wm);
+ break;
+ case 'SET_UP_BRANCHES_INIT' :
+ setUpBranchesInit();
+ break;
+
+ default :
+ Debugger.log('unknown update type :' + event.updateType,Debugger.GEN,'viewUpdate','org.lamsfoundation.lams.ws.WorkspaceDialog');
+ }
+
+ }
+
+
+
+ /**
+ * called witht he result when a child folder is opened..
+ * updates the tree branch satus, then refreshes.
+ * @usage
+ * @param changedNode
+ * @param wm
+ * @return
+ */
+ private function updateChildFolderBranches(changedNode:XMLNode,wm:WorkspaceModel){
+ Debugger.log('updateChildFolder....:' ,Debugger.GEN,'updateChildFolder','org.lamsfoundation.lams.ws.WorkspaceDialog');
+ //we have to set the new nodes to be branches, if they are branches
+ if(changedNode.attributes.isBranch){
+ treeview.setIsBranch(changedNode,true);
+ //do its kids
+ for(var i=0; i
+ * _resultDTO.selectedResourceID //The ID of the resource that was selected when the dialogue closed
+ * _resultDTO.resourceName //The contents of the Name text field
+ * _resultDTO.resourceDescription //The contents of the description field on the propertirs tab
+ * _resultDTO.resourceLicenseText //The contents of the license text field
+ * _resultDTO.resourceLicenseID //The ID of the selected license from the drop down.
+ *
+ */
+ private function ok(){
+ trace('OK');
+ _global.breakpoint();
+
+ //TODO: Rmeove this code as its been here only for deflopment
+ //set the selectedDesignId
+ /**/
+ if(StringUtils.isNull(input_txt.text)){
+ //get the selected value off the tree
+ var snode = treeview.selectedNode;
+ input_txt.text = snode.attributes.data.resourceID;
+
+ }
+ _selectedDesignId = Number(input_txt.text);
+
+
+ //TODO: Validate you are allowed to use the name etc... Are you overwriting - NOTE Same names are nto allowed in this version
+
+ var snode = treeview.selectedNode;
+ Debugger.log('_workspaceModel.currentMode: ' + _workspaceModel.currentMode,Debugger.GEN,'ok','org.lamsfoundation.lams.WorkspaceDialog');
+ if(_workspaceModel.currentMode=="SAVE" || _workspaceModel.currentMode=="SAVEAS"){
+ //var rid:Number = Number(snode.attributes.data.resourceID);
+ if(snode.attributes.data.resourceType==_workspaceModel.RT_LD){
+ //run a confirm dialogue as user is about to overwrite a design!
+ LFMessage.showMessageConfirm(Dictionary.getValue('ws_chk_overwrite_resource'), Proxy.create(this,doWorkspaceDispatch,true), Proxy.create(this,closeThisDialogue));
+
+ }else if (snode.attributes.data.resourceType==_workspaceModel.RT_FOLDER){
+ doWorkspaceDispatch(false);
+ }else{
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_click_folder_file'),null);
+ }
+ }else{
+ doWorkspaceDispatch(true);
+ }
+
+ }
+
+
+
+ /**
+ * Dispatches an event - picked up by the canvas in authoring
+ * sends paramter containing:
+ * _resultDTO.selectedResourceID
+ * _resultDTO.targetWorkspaceFolderID
+ * _resultDTO.resourceName
+ _resultDTO.resourceDescription
+ _resultDTO.resourceLicenseText
+ _resultDTO.resourceLicenseID
+ * @usage
+ * @param useResourceID //if its true then we will send the resorceID of teh item selected in the tree - usually this means we are overwriting something
+ * @return
+ */
+ public function doWorkspaceDispatch(useResourceID:Boolean){
+ //ObjectUtils.printObject();
+ var snode = treeview.selectedNode;
+
+ if(useResourceID){
+ //its an LD
+ _resultDTO.selectedResourceID = Number(snode.attributes.data.resourceID);
+ _resultDTO.targetWorkspaceFolderID = Number(snode.attributes.data.workspaceFolderID);
+ }else{
+ //its a folder
+ _resultDTO.selectedResourceID = null;
+ _resultDTO.targetWorkspaceFolderID = Number(snode.attributes.data.resourceID);
+
+ }
+
+ _resultDTO.resourceName = resourceTitle_txi.text;
+ _resultDTO.resourceDescription = resourceDesc_txa.text;
+ //_resultDTO.resourceLicenseText = license_txa.text;
+ //_resultDTO.resourceLicenseID = licenseID_cmb.value.licenseID;
+
+
+ dispatchEvent({type:'okClicked',target:this});
+
+ closeThisDialogue();
+
+ }
+
+ public function closeThisDialogue(){
+ _container.deletePopUp();
+ }
+
+
+ /**
+ * Event dispatched by parent container when close button clicked
+ */
+ private function click(e:Object){
+ trace('WorkspaceDialog.click');
+ e.target.deletePopUp();
+ }
+
+
+ /**
+ * Recursive function to set any folder with children to be a branch
+ * TODO: Might / will have to change this behaviour once designs are being returned into the mix
+ * @usage
+ * @param node
+ * @return
+ */
+ private function setBranches(node:XMLNode){
+ if(node.hasChildNodes() || node.attributes.isBranch){
+ treeview.setIsBranch(node, true);
+ for (var i = 0; i= USERS_LOAD_CHECK_TIMEOUT_COUNT){
+ //if we havent loaded the dict or theme by the timeout count then give up
+ Debugger.log('raeached time out waiting to load dict and themes, giving up.',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UsersLoadCheckIntervalID);
+ }
+ }
+ }
+ }
+
+ public function getOrganisations(courseID:Number, classID:Number):Void{
+ // TODO check if already set
+
+ var callback:Function = Proxy.create(this,showOrgTree);
+
+ if(classID != undefined){
+ Application.getInstance().getComms().getRequest('workspace.do?method=getUserOrganisation&userID='+_root.userID+'&organisationID='+classID+'&roles=MONITOR,COURSE MANAGER',callback, false);
+ }else if(courseID != undefined){
+ trace('course defined: doing request');
+ Application.getInstance().getComms().getRequest('workspace.do?method=getUserOrganisation&userID='+_root.userID+'&organisationID='+courseID+'&roles=MONITOR,COURSE MANAGER',callback, false);
+ }else{
+ // TODO no course or class defined
+ }
+ }
+
+ private function showOrgTree(dto:Object):Void{
+ trace('organisations tree returned...');
+ trace('creating root node...');
+ // create root (dummy) node
+
+ var odto = getDataObject(dto);
+
+ _monitorModel.initOrganisationTree();
+ var rootNode:XMLNode = _monitorModel.treeDP.addTreeNode(odto.name, odto);
+ //rootNode.attributes.isBranch = true;
+ _monitorModel.setOrganisationResource(RT_ORG+'_'+odto.organisationID,rootNode);
+
+ // create tree xml branches
+ createXMLNodes(rootNode, dto.nodes);
+
+ // set up the tree
+ setUpTreeview();
+
+ }
+
+ private function createXMLNodes(root:XMLNode, nodes:Array) {
+ for(var i=0; i0){
+ childNode.attributes.isBranch = true;
+ createXMLNodes(childNode, nodes[i].nodes);
+ } else {
+ childNode.attributes.isBranch = false;
+ }
+
+ _monitorModel.setOrganisationResource(RT_ORG+'_'+odto.organisationID,childNode);
+
+ }
+
+ }
+
+ private function getDataObject(dto:Object):Object{
+ var odto= {};
+ odto.organisationID = dto.organisationID;
+ odto.organisationTypeId = dto.organisationTypeId;
+ odto.description = dto.description;
+ odto.name = dto.name;
+ odto.parentID = dto.parentID;
+
+ return odto;
+ }
+
+
+ /*
+ * Clear Method to clear movies from scrollpane
+ *
+ */
+ public static function clearScp(array:Array):Array{
+ if(array != null){
+ for (var i=0; i about dialog
+ */
+ public function openAboutLams() {
+
+ var controller:MonitorController = monitorView.getController();
+
+ var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('about_popup_title_lbl', [Dictionary.getValue('stream_reference_lbl')]),closeButton:true,scrollContentPath:'AboutLams'});
+ dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openAboutDialogLoaded));
+
+ }
+
+
+ /**
+ * Called when Users loaded for role type
+ * @param evt:Object the event object
+ */
+ private function onUserLoad(evt:Object){
+ if(evt.type=='staffLoad'){
+ monitorModel.staffLoaded = true;
+ Debugger.log('Staff loaded :',Debugger.CRITICAL,'onUserLoad','Monitor');
+ } else if(evt.type=='learnersLoad'){
+ monitorModel.learnersLoaded = true;
+ Debugger.log('Learners loaded :',Debugger.CRITICAL,'onUserLoad','Monitor');
+ } else {
+ Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onUserLoad','Monitor');
+ }
+ }
+
+
+ /**
+ * Opens a design using workspace and user to select design ID
+ * passes the callback function to recieve selected ID
+ */
+ public function openDesignBySelection(){
+ //Work space opens dialog and user will select view
+ var callback:Function = Proxy.create(this, openDesignById);
+ var ws = Application.getInstance().getWorkspace();
+ ws.userSelectDesign(callback);
+ }
+
+ /**
+ * Request design from server using supplied ID.
+ * @usage
+ * @param designId
+ * @return
+ */
+ private function openDesignById(workspaceResultDTO:Object){
+
+ ObjectUtils.toString(workspaceResultDTO);
+ var designId:Number = workspaceResultDTO.selectedResourceID;
+ var lessonName:String = workspaceResultDTO.resourceName;
+ var lessonDesc:String = workspaceResultDTO.resourceDescription;
+ var callback:Function = Proxy.create(this,setLesson);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=initializeLesson&learningDesignID='+designId+'&userID='+_root.userID+'&lessonName='+lessonName+'&lessonDescription='+lessonDesc,callback, false);
+
+ }
+
+ private function loadLessonToMonitor(lessonID:Number){
+ var callback:Function = Proxy.create(monitorModel,monitorModel.loadSequence);
+ if(_sequence != null) {
+ monitorModel.setSequence(_sequence);
+ } else {
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getLessonDetails&lessonID=' + String(lessonID) + '&userID=' + _root.userID,callback, false);
+ }
+ }
+
+ public function closeAndRefresh() {
+ ApplicationParent.extCall("closeWindowRefresh", null);
+ }
+
+ public function reloadLessonToMonitor(){
+ _sequence = null;
+ loadLessonToMonitor(_root.lessonID);
+ }
+
+ public function startLesson(isScheduled:Boolean, lessonID:Number, datetime:String){
+ Debugger.log('populating seq object for start date:'+datetime,Debugger.CRITICAL,'startLesson','Monitor');
+ var callback:Function = Proxy.create(this, onStartLesson);
+
+ if(isScheduled){
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=startOnScheduleLesson&lessonStartDate=' + datetime + '&lessonID=' + lessonID + '&userID=' + _root.userID, callback);
+ } else {
+ //getMV.
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=startLesson&lessonID=' + lessonID + '&userID=' + _root.userID, callback);
+ }
+ }
+
+ private function onStartLesson(b:Boolean){
+ trace('receive back after lesson started..');
+ if(b){
+ trace('lesson started');
+ loadLessonToMonitor(_root.lessonID);
+
+ } else {
+ // error occured
+ trace('error occurred starting lesson');
+ }
+ }
+
+ /**
+ * Create LessonClass using wizard data and CreateLessonClass servlet
+ *
+ */
+
+ public function createLessonClass():Void{
+ trace('creating lesson class...');
+ var dto:Object = monitorModel.getLessonClassData();
+ var callback:Function = Proxy.create(this,onCreateLessonClass);
+
+ Application.getInstance().getComms().sendAndReceive(dto,"monitoring/createLessonClass?userID=" + _root.userID,callback,false);
+
+ }
+
+ public function onCreateLessonClass(r):Void{
+ if(r instanceof LFError) {
+ r.showErrorAlert();
+ } else if(r) {
+ // lesson class created
+ trace('lesson class created');
+ monitorModel.broadcastViewUpdate("SAVED_LC", null);
+ loadLessonToMonitor(_root.lessonID);
+ } else {
+ // failed creating lesson class
+ trace('failed creating lesson class');
+ }
+ }
+
+ /**
+ * Set new Lesson in Monitoring
+ * @usage
+ * @param lesson ID
+ * @return
+ */
+ private function setLesson(lessonID:Number){
+ // refresh Lesson Library
+ Application.getInstance().getLesson().addNew(lessonID);
+
+ }
+
+ public function requestUsers(role:String, orgID:Number, callback:Function){
+ Application.getInstance().getComms().getRequest('workspace.do?method=getUsersFromOrganisationByRole&organisationID='+orgID+'&role='+role,callback, false);
+
+ }
+
+ /**
+ * server call for learning Dseign and sent it to the save it in DataDesignModel
+ *
+ * @usage
+ * @param seq type Sequence;
+ * @return Void
+ */
+ public function openLearningDesign(seq:Sequence){
+ trace('opening learning design...'+ seq.learningDesignID);
+ var designID:Number = seq.learningDesignID;
+ var callback:Function = Proxy.create(this,saveDataDesignModel);
+
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designID,callback, false);
+
+ }
+
+ private function saveDataDesignModel(learningDesignDTO:Object){
+ trace('returning learning design...');
+ trace('saving model data...');
+ var seq:Sequence = Sequence(monitorModel.getSequence());
+ _ddm = new DesignDataModel();
+
+ // clear canvas
+ clearCanvas(true);
+
+ if(learningDesignDTO != null) { _ddm.setDesign(learningDesignDTO); seq.setLearningDesignModel(_ddm); }
+ else if(seq.getLearningDesignModel() != null){ _ddm = seq.getLearningDesignModel(); }
+ else { openLearningDesign(seq); }
+
+ monitorModel.setSequence(seq);
+ monitorModel.broadcastViewUpdate('PROGRESS', null, monitorModel.getSelectedTab());
+
+ }
+
+ public function getContributeActivities(seqID:Number):Void{
+ trace('getting all contribute activities for sequence: ' + seqID);
+ var callback:Function = Proxy.create(monitorModel,monitorModel.setToDos);
+
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getAllContributeActivities&lessonID='+seqID,callback, false);
+
+ }
+
+ public function getProgressData(seq:Object){
+ var seqId:Number = seq.getSequenceID();
+ trace('getting progress data for Sequence: '+seqId);
+
+ var callback:Function = Proxy.create(this, saveProgressData);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getAllLearnersProgress&lessonID=' + seqId, callback, false);
+ }
+
+ private function saveProgressData(progressDTO:Object){
+ trace('returning progress data...'+progressDTO.length);
+ var allLearners = new Array();
+ for(var i=0; i< progressDTO.length; i++){
+
+ var prog:Object = progressDTO[i];
+ var lessonProgress:Progress = new Progress();
+ lessonProgress.populateFromDTO(prog);
+ //trace('pushing lesson with id: ' + lessonModel.getLessonID());
+ allLearners.push(lessonProgress);
+ }
+
+ //sets these in the monitor model in a hashtable by learnerID
+ monitorModel.setLessonProgressData(allLearners);
+ dispatchEvent({type:'load',target:this});
+ trace('progress data saved...');
+ }
+
+ public function getCELiteral(taskType:Number):String{
+ trace("Type passed: "+taskType)
+ var seqStat:String;
+ switch(String(taskType)){
+ case '1' :
+ seqStat = "Moderation"
+ break;
+ case '2' :
+ seqStat = "Define Later"
+ break;
+ case '3' :
+ seqStat = "Permission Gate"
+ break;
+ case '4' :
+ seqStat = "Syncronise Gate"
+ break;
+ case '5' :
+ seqStat = "Schedule Gate"
+ break;
+ case '6' :
+ seqStat = "Choose Grouping"
+ break;
+ case '7' :
+ seqStat = "Contribution"
+ break;
+ default:
+ seqStat = "Not yet set"
+ }
+ return seqStat;
+ }
+
+ /**
+ * Clears the design in the canvas.but leaves other state variables (undo etc..)
+ * @usage
+ * @param noWarn
+ * @return
+ */
+ public function clearCanvas(noWarn:Boolean):Boolean{
+ //_global.breakpoint();
+ var s = false;
+ var ref = this;
+ Debugger.log('noWarn:'+noWarn,4,'clearCanvas','Monitor');
+ if(noWarn){
+
+ _ddm = new DesignDataModel();
+ //as its a new instance of the ddm,need to add the listener again
+ //_ddm.addEventListener('ddmUpdate',Proxy.create(this,onDDMUpdated));
+ Debugger.log('noWarn2:'+noWarn,4,'clearCanvas','Monitor');//_ddm.addEventListener('ddmBeforeUpdate',Proxy.create(this,onDDMBeforeUpdate));
+ //checkValidDesign();
+ monitorModel.setDirty();
+ return true;
+ }else{
+ //var fn:Function = Proxy.create(ref,confirmedClearDesign, ref);
+ //LFMessage.showMessageConfirm(Dictionary.getValue('new_confirm_msg'), fn,null);
+ Debugger.log('Set design failed as old design could not be cleared',Debugger.CRITICAL,"setDesign",'Canvas');
+ }
+ }
+
+ /**
+ * Open the Help page for the selected Tool (Canvas) Activity
+ *
+ * @param ca CanvasActivity
+ * @return
+ */
+
+ public function getHelp(ca:CanvasActivity) {
+
+ if(ca.activity.helpURL != undefined || ca.activity.helpURL != null) {
+ Debugger.log("Opening help page with locale " + _root.lang + _root.country + ": " + ca.activity.helpURL,Debugger.GEN,'getHelp','Monitor');
+
+ var locale:String = _root.lang + _root.country;
+ getURL(ca.activity.helpURL + app.module + "#" + ca.activity.toolSignature + app.module + "-" + locale, '_blank');
+ } else {
+ if (ca.activity.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE){
+ var callback:Function = Proxy.create(this, openGroupHelp);
+ app.getHelpURL(callback)
+ }else if (ca.activity.activityTypeID == Activity.SYNCH_GATE_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.SCHEDULE_GATE_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.PERMISSION_GATE_ACTIVITY_TYPE){
+ var callback:Function = Proxy.create(this, openGateHelp);
+ app.getHelpURL(callback)
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_helpURL_undefined', [ca.activity.toolDisplayName]));
+ }
+ }
+ }
+
+ private function openGroupHelp(url:String){
+ var actToolSignature:String = Application.FLASH_TOOLSIGNATURE_GROUP
+ var locale:String = _root.lang + _root.country;
+ var target:String = actToolSignature + app.module + '#' + actToolSignature + app.module + '-' + locale;
+ getURL(url + target, '_blank');
+ }
+
+ private function openGateHelp(url:String){
+ var actToolSignature:String = Application.FLASH_TOOLSIGNATURE_GATE
+ var locale:String = _root.lang + _root.country;
+ var target:String = actToolSignature + app.module + '#' + actToolSignature + app.module + '-' + locale;
+ getURL(url + target, '_blank');
+ }
+
+ public function setupEditOnFly(learningDesignID:Number) {
+ Debugger.log("Checking for permission to edit and setting up design with ID: " + learningDesignID,Debugger.GEN,'setupEditOnFly','Monitor');
+
+ var callback:Function = Proxy.create(this,readyEditOnFly, true);
+
+ Application.getInstance().getComms().getRequest('eof/authoring/editLearningDesign?learningDesignID=' + learningDesignID + '&userID=' + _root.userID + '&p=' + Math.random() ,callback, false);
+
+ }
+
+ public function readyEditOnFly(r:Object) {
+ if(r instanceof LFError) {
+ r.showErrorAlert();
+ return;
+ } else if(!Boolean(r)) {
+ ApplicationParent.extCall("reloadWindow", null);
+ return;
+ }
+
+ Debugger.log("Check OK. Proceed with opening design.",Debugger.GEN,'setupEditOnFly','Monitor');
+
+ //var loader_url = Config.getInstance().serverUrl + "lams_preloader.swf?loadFile=lams_authoring.swf&loadLibrary=lams_authoring_library.swf&serverURL=" + Config.getInstance().serverUrl + "&userID=" + _root.userID + "&build=" + _root.build + "&lang=" + _root.lang + "&country=" + _root.country + "&langDate=" + _root.langDate + "&theme=" + _root.theme + "&uniqueID=undefined" + "&layout=" + ApplicationParent.EDIT_MODE + "&learningDesignID=" + monitorModel.getSequence().learningDesignID;
+ //Debugger.log("url: " + loader_url, Debugger.CRITICAL, 'openEditOnFly', 'MonitorView');
+
+ //JsPopup.getInstance().launchPopupWindow(loader_url , 'AuthoringWindow', 570, 796, true, true, false, false, false);
+
+ var designID:Number = monitorModel.getSequence().learningDesignID;
+ if(designID != null)
+ ApplicationParent.extCall("openAuthorForEditOnFly", String(designID));
+ else
+ ApplicationParent.extCall("openAuthorForEditOnFly", String(App.sequence.learningDesignID));
+
+ }
+
+ /**
+ *
+ * @usage
+ * @param newonOKCallback
+ * @return
+ */
+ public function set onOKCallback (newonOKCallback:Function):Void {
+ _onOKCallBack = newonOKCallback;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get onOKCallback ():Function {
+ return _onOKCallBack;
+ }
+
+ /**
+ * Used by application to set the size
+ * @param width The desired width
+ * @param height the desired height
+ */
+ public function setSize(width:Number, height:Number):Void{
+ monitorModel.setSize(width, height);
+ }
+
+ public function setPosition(x:Number,y:Number){
+ //Set the position within limits
+ //TODO DI 24/05/05 write validation on limits
+ monitorModel.setPosition(x,y);
+ }
+
+ //Dimension accessor methods
+ public function get width():Number{
+ return monitorModel.width;
+ }
+
+ public function get height():Number{
+ return monitorModel.height;
+ }
+
+ public function get x():Number{
+ return monitorModel.x;
+ }
+
+ public function get y():Number{
+ return monitorModel.y;
+ }
+
+ function get className():String {
+ return _className;
+ }
+ public function getMM():MonitorModel{
+ return monitorModel;
+ }
+ public function getMV():MonitorView{
+ trace("Called getMV")
+ return monitorView;
+ }
+
+ public function get ddm():DesignDataModel{
+ return _ddm;
+ }
+
+ public function get root():MovieClip{
+ return _root_mc;
+ }
+
+ public function get App():Application{
+ return Application.getInstance();
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorController.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorController.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorController.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,561 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.monitoring.*;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.cv.ICanvasActivity;
+import org.lamsfoundation.lams.authoring.cv.CanvasParallelActivity;
+
+import mx.utils.*
+import mx.controls.*
+import mx.behaviors.*
+import mx.core.*
+import mx.events.*
+import mx.effects.*
+
+/**
+* Controller for the sequence library
+*/
+class MonitorController extends AbstractController {
+
+ private var _monitorModel:MonitorModel;
+ private var _monitorController:MonitorController;
+ private var _app:Application;
+ private var _isBusy:Boolean;
+
+ /**
+ * Constructor
+ *
+ * @param cm The model to modify.
+ */
+ public function MonitorController (mm:Observable) {
+ super (mm);
+ _monitorModel = MonitorModel(model);
+ _monitorController = this;
+ _app = Application.getInstance();
+ _isBusy = false;
+
+ }
+
+ public function activityClick(act:Object, forObj:String):Void{
+ if (forObj == "LearnerIcon"){
+ _monitorModel.isDragging = true;
+ act.startDrag(false);
+
+ Debugger.log('activityClick CanvasActivity:'+act.Learner.getUserName(),Debugger.GEN,'activityClick','MonitorController');
+ }else {
+ _monitorModel.selectedItem = act;
+ }
+ }
+
+ /**
+ * Returns the parent that is an member activity of the canvas (ICanvasActivity)
+ *
+ * @usage
+ * @param path dropTarget path
+ * @return path to activity movieclip
+ */
+
+ private function findParentActivity(path:Object):Object {
+ if(path instanceof ICanvasActivity)
+ return path;
+ else if(path == ApplicationParent.root)
+ return null;
+ else
+ return findParentActivity(path._parent);
+ }
+
+ /**
+ * Returns the child of a complex activity that matches with the dropTarget
+ *
+ * @usage
+ * @param children array of children movieclips
+ * @param target dropTarget path
+ * @return the matching activity object or null if not found
+ */
+ private function matchChildActivity(children:Array, target:Object):Object {
+ for(var i=0; i 0 || ddm_activity.parentUIID > 0) && !isDesignDrawn){
+ broadcastViewUpdate("DRAW_ACTIVITY", ddm_activity, tabID, drawLearner);
+ } else {
+ broadcastViewUpdate("CLONE_ACTIVITY", ddm_activity, tabID, drawLearner);
+ }
+ }
+
+ //now check the transitions:
+ ddmTransition_keys = _activeSeq.getLearningDesignModel().transitions.keys();
+
+ //chose which array we are going to loop over
+ var trIndexArray:Array;
+ trIndexArray = ddmTransition_keys;
+
+ //loop through
+ for(var i=0;i= USER_LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('reached timeout waiting for data to load.',Debugger.CRITICAL,'checkUsersLoaded','MonitorModel');
+ clearInterval(_UserLoadCheckIntervalID);
+ }
+ }
+ }
+
+ private function resetUserFlags():Void{
+ staffLoaded = false;
+ learnersLoaded = false;
+ _userLoadCheckCount = 0;
+ _UserLoadCheckIntervalID = null;
+ }
+
+ public function requestLearners(data:Object, callback:Function){
+
+ _monitor.requestUsers(LEARNER_ROLE, data.organisationID, callback);
+ }
+
+
+ public function requestStaff(data:Object, callback:Function){
+
+ _monitor.requestUsers(MONITOR_ROLE, data.organisationID, callback);
+ }
+
+ public function saveLearners(users:Array){
+ saveUsers(users, LEARNER_ROLE);
+
+ broadcastViewUpdate("LEARNERS_LOADED", null, null);
+ }
+
+ public function saveStaff(users:Array){
+ saveUsers(users, MONITOR_ROLE);
+
+ broadcastViewUpdate("STAFF_LOADED", null, null);
+ }
+
+
+ private function saveUsers(users:Array, role:String):Void{
+
+ for(var i=0; i< users.length; i++){
+ var u:Object = users[i];
+
+ var user:User = User(organisation.getUser(u.userID));
+ if(user != null){
+ trace('adding role to existing user: ' + user.getFirstName() + ' ' + user.getLastName());
+ user.addRole(role);
+ } else {
+ user = new User();
+ user.populateFromDTO(u);
+ user.addRole(role);
+
+ trace('adding user: ' + user.getFirstName() + ' ' + user.getLastName() + ' ' + user.getUserId());
+ organisation.addUser(user);
+ }
+ }
+ }
+
+ public function getLessonClassData():Object{
+ var classData:Object = new Object();
+ var r:Object = resultDTO;
+ var staff:Object = new Object();
+ var learners:Object = new Object();
+ if(r){
+ trace('getting lesson class data...');
+ trace('org resource id: ' + r.organisationID);
+ if(_root.lessonID){classData.lessonID = _root.lessonID;}
+ if(r.organisationID){classData.organisationID = r.organisationID;}
+ classData.staff = staff;
+ classData.learners = learners;
+ if(r.staffGroupName){classData.staff.groupName = r.staffGroupName;}
+ if(r.selectedStaff){staff.users = r.selectedStaff;}
+ if(r.learnersGroupName){classData.learners.groupName = r.learnersGroupName;}
+ if(r.selectedLearners){classData.learners.users = r.selectedLearners;}
+ return classData;
+ } else {
+ return null;
+ }
+ }
+
+
+ /////////////////////// OPEN ACTIVITY /////////////////////////////
+ /**
+ * Called on double clicking an activity
+ * @usage
+ * @return
+ */
+ public function openToolActivityContent(ca:Activity):Void{
+ Debugger.log('ta:'+ca.title+'toolContentID:'+ca.activityUIID,Debugger.GEN,'openToolActivityContent','MonitorModel');
+
+ //if we have a good toolID lets open it
+ var cfg = Config.getInstance();
+ var URLToSend:String = cfg.serverUrl+_root.monitoringURL+'getLearnerActivityURL&activityID='+ca.activityID+'&userID='+_root.userID+'&lessonID='+_root.lessonID;
+
+ Debugger.log('Opening url:'+URLToSend,Debugger.GEN,'openToolActivityContent','CanvasModel');
+ getURL(URLToSend,"_blank");
+ }
+
+
+ public function setDirty(){
+ _isDirty = true;
+ clearDesign();
+ }
+
+ public function setSize(width:Number,height:Number) {
+ __width = width;
+ __height = height;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "SIZE";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Used by View to get the size
+ * @returns Object containing width(w) & height(h). obj.w & obj.h
+ */
+ public function getSize():Object{
+ var s:Object = {};
+ s.w = __width;
+ s.h = __height;
+ return s;
+ }
+
+ /**
+ * sets the model x + y vars
+ */
+ public function setPosition(x:Number,y:Number):Void{
+ //Set state variables
+ __x = x;
+ __y = y;
+ //Set flag for notify observers
+ setChanged();
+
+ //build and send update object
+ infoObj = {};
+ infoObj.updateType = "POSITION";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Used by View to get the size
+ * @returns Object containing width(w) & height(h). obj.w & obj.h
+ */
+ public function getPosition():Object{
+ var p:Object = {};
+ p.x = __x;
+ p.y = __y;
+ return p;
+ }
+
+ /**
+ * Sets up the tree for the 1st time
+ *
+ * @usage
+ * @return
+ */
+ public function initOrganisationTree(){
+ _treeDP = new XML();
+ _orgResources = new Array();
+ }
+
+ /**
+ *
+ * @usage
+ * @param neworgResources
+ * @return
+ */
+ public function setOrganisationResource(key:String,neworgResources:XMLNode):Void {
+ Debugger.log(key+'='+neworgResources,Debugger.GEN,'setOrganisationResource','org.lamsfoundation.lams.monitoring.mv.MonitorModel');
+ _orgResources[key] = neworgResources;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getOrganisationResource(key:String):XMLNode{
+ Debugger.log(key+' is returning '+_orgResources[key],Debugger.GEN,'getOrganisationResource','org.lamsfoundation.lams.monitoring.mv.MonitorModel');
+ return _orgResources[key];
+
+ }
+
+
+ public function get treeDP():XML{
+ return _treeDP;
+ }
+
+ public function get organisation():Organisation{
+ return _org;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newselectedTreeNode
+ * @return
+
+ public function setSelectedTreeNode (newselectedTreeNode:XMLNode):Void {
+ _selectedTreeNode = newselectedTreeNode;
+ trace('branch: ' + _selectedTreeNode.attributes.isBranch);
+ if(!_selectedTreeNode.attributes.isBranch){
+ // get the organisations (node) users by role
+ //var roles:Array = new Array(LEARNER_ROLE, MONITOR_ROLE, TEACHER_ROLE);
+ setOrganisation(new Organisation(_selectedTreeNode.attributes.data));
+ resetUserFlags();
+ // polling method - waiting for all users to load before displaying users in UI
+ checkUsersLoaded();
+
+ // load users
+ requestLearners(_selectedTreeNode.attributes.data);
+ requestStaff(_selectedTreeNode.attributes.data);
+
+ trace(staffLoaded);
+ trace(learnersLoaded);
+ }
+
+ //dispatch an update to the view
+ //broadcastViewUpdate('ITEM_SELECTED',_selectedTreeNode);
+ }
+ */
+
+ /**
+ *
+ * @usage
+ * @return
+
+
+ public function getSelectedTreeNode ():XMLNode {
+ return _selectedTreeNode;
+ }
+ */
+
+ private function setSelectedItem(newselectItem:Object){
+ prevSelectedItem = _selectedItem;
+ _selectedItem = newselectItem;
+ broadcastViewUpdate("SELECTED_ITEM");
+ }
+
+ /**
+ *
+ * @usage
+ * @param newselectItem
+ * @return
+ */
+ public function set selectedItem (newselectItem:Object):Void {
+ setSelectedItem(newselectItem);
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get selectedItem ():Object {
+ return _selectedItem;
+ }
+
+ public function setSelectedTab(tabID:Number){
+ selectedTab = tabID;
+ }
+ public function getSelectedTab():Number{
+ return selectedTab;
+ }
+
+ public function set prevSelectedItem (oldselectItem:Object):Void {
+ _prevSelectedItem = oldselectItem;
+ }
+
+ public function get prevSelectedItem():Object {
+ return _prevSelectedItem;
+ }
+
+ public function get learnersLoaded():Boolean{
+ return _learnersLoaded;
+ }
+
+ public function set learnersLoaded(a:Boolean):Void{
+ _learnersLoaded = a;
+ }
+
+ public function get staffLoaded():Boolean{
+ return _staffLoaded;
+ }
+
+ public function set staffLoaded(a:Boolean):Void{
+ _staffLoaded = a;
+ }
+
+ //Accessors for x + y coordinates
+ public function get x():Number{
+ return __x;
+ }
+
+ public function get y():Number{
+ return __y;
+ }
+
+ //Accessors for x + y coordinates
+ public function get width():Number{
+ return __width;
+ }
+
+ public function get height():Number{
+ return __height;
+ }
+
+ public function get className():String{
+ return 'MonitorModel';
+ }
+
+ public function get resultDTO():Object{
+ return _resultDTO;
+ }
+
+ public function set resultDTO(a:Object){
+ _resultDTO = a;
+ }
+
+ public function set endGate(a:MovieClip){
+ _endGate = a;
+ }
+
+ public function get endGate():MovieClip{
+ return _endGate;
+ }
+
+ public function set locked(a:Boolean){
+ _isLocked = a;
+ }
+
+ public function get locked():Boolean{
+ return _isLocked;
+ }
+
+ public function set isDesignDrawn(a:Boolean){
+ _isDesignDrawn = a;
+ }
+
+ public function get isDesignDrawn():Boolean{
+ return _isDesignDrawn;
+ }
+
+ /**
+ * Returns a reference to the Activity Movieclip for the UIID passed in. Gets from _activitiesDisplayed Hashable
+ * @usage
+ * @param UIID
+ * @return Activity Movie clip
+ */
+ public function getActivityMCByUIID(UIID:Number):MovieClip{
+
+ var a_mc:MovieClip = _activitiesDisplayed.get(UIID);
+ //Debugger.log('UIID:'+UIID+'='+a_mc,Debugger.GEN,'getActivityMCByUIID','CanvasModel');
+ return a_mc;
+ }
+
+ public function get activitiesDisplayed():Hashtable{
+ return _activitiesDisplayed;
+ }
+
+ public function get transitionsDisplayed():Hashtable{
+ return _transitionsDisplayed;
+ }
+
+ public function get allLearnersProgress():Array{
+ return learnerTabActArr;
+ }
+
+ public function getActivityKeys():Array{
+ trace("ddmActivity_keys length: "+ ddmActivity_keys.length)
+ return ddmActivity_keys;
+ }
+
+ public function getTransitionKeys():Array{
+ return ddmTransition_keys;
+ }
+
+ public function getMonitor():Monitor{
+ return _monitor;
+ }
+
+ public function getTTData():Object{
+ var myObj:Object = new Object();
+ myObj.monitorX = monitor_x;
+ myObj.monitorY = monitor_y;
+ myObj.ttHolderMC = ttHolder;
+
+ return myObj;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get isDragging ():Boolean {
+ return _isDragging;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function set isDragging (newisDragging:Boolean):Void{
+ _isDragging = newisDragging;
+ }
+
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorTransition.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorTransition.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorTransition.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,143 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.monitoring.Application;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.Transition;
+import org.lamsfoundation.lams.authoring.cv.*;
+
+
+/**
+* -+ -
+*/
+class org.lamsfoundation.lams.monitoring.mv.MonitorTransition extends MovieClip{
+ //set by passing initObj to mc.createClass()
+ //private var _MonitorController:CanvasController;
+ //private var _monitorTabView:MonitorTabView;
+ private var _transition:Transition;
+
+ private var _drawnLineStyle:Number;
+
+ private var arrow_mc:MovieClip;
+ private var stopArrow_mc:MovieClip;
+ private var stopSign_mc:MovieClip;
+
+
+ private var _startPoint:Point;
+ private var _midPoint:Point;
+ private var _endPoint:Point;
+
+
+
+ private var _dcStartTime:Number = 0;
+ private var _doubleClicking:Boolean;
+
+
+
+ function MonitorTransition(){
+
+ arrow_mc._visible = false;
+ stopArrow_mc._visible = false;
+ stopSign_mc._visible = false;
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+ //init();
+ }
+
+ public function init():Void{
+ //Debugger.log('Running,',4,'init','CanvasTransition');
+ //todo: all a get style for this
+ _drawnLineStyle = 0x777E9D;
+ draw();
+ }
+
+ public function get transition():Transition{
+ return _transition;
+ }
+
+ public function set transition(t:Transition){
+ _transition = t;
+ }
+
+ public function get midPoint():Point{
+ return _midPoint;
+ }
+
+
+
+ /**
+ * Renders the transition to stage
+ * @usage
+ * @return
+ */
+ private function draw():Void{
+ //Debugger.log('',4,'draw','CanvasTransition');
+
+ var monitor:Monitor = Application.getInstance().getMonitor();
+
+ var fromAct_mc = monitor.getMM().getActivityMCByUIID(_transition.fromUIID);
+ var toAct_mc = monitor.getMM().getActivityMCByUIID(_transition.toUIID);
+
+ //TODO: check if its a gate transition and if so render a shorty
+ var isGateTransition = toAct_mc.activity.isGateActivity();
+
+
+ var offsetToCentre_x = fromAct_mc.getVisibleWidth() / 2;
+ var offsetToCentre_y = fromAct_mc.getVisibleHeight() / 2;
+
+ _startPoint = new Point(fromAct_mc.getActivity().xCoord+offsetToCentre_x,fromAct_mc.getActivity().yCoord+offsetToCentre_y);
+
+ var toOTC_x:Number = toAct_mc.getVisibleWidth() /2;
+ var toOTC_y:Number = toAct_mc.getVisibleHeight() /2;
+
+ _endPoint = new Point(toAct_mc.getActivity().xCoord+toOTC_x,toAct_mc.getActivity().yCoord+toOTC_y);
+
+
+ this.lineStyle(2, _drawnLineStyle);
+ this.moveTo(_startPoint.x, _startPoint.y);
+
+ //this.dashTo(startX, startY, endX, endY, 8, 4);
+ this.lineTo(_endPoint.x, _endPoint.y);
+
+ // calculate the position and angle for the arrow_mc
+ arrow_mc._x = (_startPoint.x + _endPoint.x)/2;
+ arrow_mc._y = (_startPoint.y + _endPoint.y)/2;
+
+ _midPoint = new Point(arrow_mc._x,arrow_mc._y);
+
+
+
+ // gradient
+ var angle:Number = Math.atan2((_endPoint.y- _startPoint.y),(_endPoint.x- _startPoint.x));
+ var degs:Number = Math.round(angle*180/Math.PI);
+ arrow_mc._rotation = degs;
+ arrow_mc._visible = true;
+
+ }
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorView.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorView.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorView.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,435 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.monitoring.mv.*
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*
+import org.lamsfoundation.lams.monitoring.*;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.Config;
+import org.lamsfoundation.lams.common.ToolTip;
+import org.lamsfoundation.lams.common.ApplicationParent;
+import mx.managers.*
+import mx.containers.*
+import mx.events.*
+import mx.utils.*
+import mx.controls.*
+
+
+/**
+*Monitoring view for the Monitor
+* Relects changes in the MonitorModel
+*/
+
+class org.lamsfoundation.lams.monitoring.mv.MonitorView extends AbstractView{
+
+ private var _className = "MonitorView";
+
+ //constants:
+ private var GRID_HEIGHT:Number;
+ private var GRID_WIDTH:Number;
+ private var H_GAP:Number;
+ private var V_GAP:Number;
+ private var Offset_Y_TabLayer_mc:Number;
+ private var _tm:ThemeManager;
+ private var _tip:ToolTip;
+
+ private var _monitorView_mc:MovieClip;
+
+ //Canvas clip
+
+ private var _monitorLesson_mc:MovieClip;
+ private var monitorLesson_scp:MovieClip;
+ private var _monitorSequence_mc:MovieClip;
+ private var monitorSequence_scp:MovieClip;
+ private var _monitorLearner_mc:MovieClip
+ private var monitorLearner_scp:MovieClip;
+ private var monitorTabs_tb:MovieClip;
+ private var learnerMenuBar:MovieClip;
+ private var bkg_pnl:MovieClip;
+ private var bkgHeader_pnl:MovieClip;
+
+ private var _gridLayer_mc:MovieClip;
+ private var _lessonTabLayer_mc:MovieClip;
+ private var _monitorTabLayer_mc:MovieClip;
+ private var _learnerTabLayer_mc:MovieClip;
+ private var _todoTabLayer_mc:MovieClip;
+ private var _editOnFlyLayer_mc:MovieClip;
+ private var refresh_btn:Button;
+ private var help_btn:Button;
+ private var exportPortfolio_btn:Button;
+ private var viewJournals_btn:Button;
+ private var editFly_btn:Button;
+ //private var _activityLayerComplex_mc:MovieClip;
+ //private var _activityLayer_mc:MovieClip;
+
+ //private var _transitionPropertiesOK:Function;
+ private var _monitorView:MonitorView;
+ private var _monitorModel:MonitorModel;
+ //Tab Views Initialisers
+
+ //LessonTabView
+ private var lessonTabView:LessonTabView;
+ private var lessonTabView_mc:MovieClip;
+ //MonitorTabView
+ private var monitorTabView:MonitorTabView;
+ private var monitorTabView_mc:MovieClip;
+ //TodoTabView
+ private var todoTabView:TodoTabView;
+ private var todoTabView_mc:MovieClip;
+ //LearnerTabView
+ private var learnerTabView:LearnerTabView;
+ private var learnerTabView_mc:MovieClip;
+
+ private var _monitorController:MonitorController;
+
+ private var lessonTabLoaded;
+ private var monitorTabLoaded;
+ private var learnerTabLoaded;
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+
+ /**
+ * Constructor
+ */
+ function MonitorView(){
+ _monitorView = this;
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+
+ lessonTabLoaded = false;
+ monitorTabLoaded = false;
+ learnerTabLoaded = false;
+
+ //Init for event delegation
+ mx.events.EventDispatcher.initialize(this);
+ }
+
+ /**
+ * Called to initialise Canvas . CAlled by the Canvas container
+ */
+ public function init(m:Observable,c:Controller,x:Number,y:Number,w:Number,h:Number){
+
+ super (m, c);
+ //Set up parameters for the grid
+ H_GAP = 10;
+ V_GAP = 10;
+ //_monitorModel = getModel();
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
+ }
+
+ private function tabLoaded(evt:Object){
+ Debugger.log('tabLoaded called: ' + evt.target,Debugger.GEN,'tabLoaded','MonitorView');
+
+ if(evt.type=='load') {
+ var tgt:String = new String(evt.target);
+ if(tgt.indexOf('lessonTabView_mc') != -1) { lessonTabLoaded = true; }
+ else if(tgt.indexOf('monitorTabView_mc') != -1) { monitorTabLoaded = true; }
+ else if(tgt.indexOf('learnerTabView_mc') != -1) { learnerTabLoaded = true; }
+ else Debugger.log('not recognised instance ' + evt.target,Debugger.GEN,'tabLoaded','MonitorView');
+
+ if(lessonTabLoaded && monitorTabLoaded && learnerTabLoaded) { dispatchEvent({type:'tload',target:this}); }
+
+ }else {
+ //Raise error for unrecognized event
+ }
+ }
+
+ /**
+ * Recieved update events from the CanvasModel. Dispatches to relevent handler depending on update.Type
+ * @usage
+ * @param event
+ */
+ public function update (o:Observable,infoObj:Object):Void{
+
+ var mm:MonitorModel = MonitorModel(o);
+ _monitorController = getController();
+
+ switch (infoObj.updateType){
+ case 'POSITION' :
+ setPosition(mm);
+ break;
+ case 'SIZE' :
+ setSize(mm);
+ break;
+ case 'TABCHANGE' :
+ showData(mm);
+ break;
+ case 'EXPORTSHOWHIDE' :
+ exportShowHide(infoObj.data);
+ break;
+ case 'JOURNALSSHOWHIDE' :
+ journalsShowHide(infoObj.data);
+ break;
+ case 'EDITFLYSHOWHIDE' :
+ editFlyShowHide(infoObj.data);
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorView');
+ }
+
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function showData(mm:MonitorModel):Void{
+ var s:Object = mm.getSequence();
+ trace("Item Description is : "+s._learningDesignID);
+
+ }
+
+ private function exportShowHide(v:Boolean):Void{
+ exportPortfolio_btn.visible = v;
+ }
+
+ private function journalsShowHide(v:Boolean):Void{
+ viewJournals_btn.visible = v;
+ }
+
+ private function editFlyShowHide(v:Boolean):Void{
+ Debugger.log("test root val: " + _root.editOnFly, Debugger.CRITICAL, "editFlyShowHide", "MonitorView");
+
+ editFly_btn.visible = (v && _root.editOnFly == 'true') ? true : false;
+
+ Debugger.log("visible: " + editFly_btn.visible, Debugger.CRITICAL, "editFlyShowHide", "MonitorView");
+ }
+
+ /**
+ * layout visual elements on the canvas on initialisation
+ */
+ private function draw(){
+ trace("Height of learnerMenuBar: "+learnerMenuBar._height)
+ var mcontroller = getController();
+
+ //get the content path for Tabs
+ _monitorLesson_mc = monitorLesson_scp.content;
+ _monitorSequence_mc = monitorSequence_scp.content;
+ _monitorLearner_mc = monitorLearner_scp.content;
+
+ _lessonTabLayer_mc = _monitorLesson_mc.createEmptyMovieClip("_lessonTabLayer_mc", _monitorLesson_mc.getNextHighestDepth());
+
+
+ _monitorTabLayer_mc = _monitorSequence_mc.createEmptyMovieClip("_monitorTabLayer_mc", _monitorSequence_mc.getNextHighestDepth());
+
+
+ _learnerTabLayer_mc = _monitorLearner_mc.createEmptyMovieClip("_learnerTabLayer_mc", _monitorLearner_mc.getNextHighestDepth());
+
+ //_todoTabLayer_mc = _monitor_mc.createEmptyMovieClip("_todoTabLayer_mc", _monitor_mc.getNextHighestDepth());
+
+
+ var tab_arr:Array = [{label:Dictionary.getValue('mtab_lesson'), data:"lesson"}, {label:Dictionary.getValue('mtab_seq'), data:"monitor"}, {label:Dictionary.getValue('mtab_learners'), data:"learners"}];
+
+ monitorTabs_tb.dataProvider = tab_arr;
+ monitorTabs_tb.selectedIndex = 0;
+
+ refresh_btn.addEventListener("click",mcontroller);
+ help_btn.addEventListener("click",mcontroller);
+ exportPortfolio_btn.addEventListener("click", mcontroller);
+ viewJournals_btn.addEventListener("click", mcontroller);
+ editFly_btn.addEventListener("click", mcontroller);
+
+ refresh_btn.onRollOver = Proxy.create(this,this['showToolTip'], refresh_btn, "refresh_btn_tooltip");
+ refresh_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ help_btn.onRollOver = Proxy.create(this,this['showToolTip'], help_btn, "help_btn_tooltip");
+ help_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ exportPortfolio_btn.onRollOver = Proxy.create(this,this['showToolTip'], exportPortfolio_btn, "class_exportPortfolio_btn_tooltip");
+ exportPortfolio_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ viewJournals_btn.onRollOver = Proxy.create(this,this['showToolTip'], viewJournals_btn, "learner_viewJournals_btn_tooltip");
+ viewJournals_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ editFly_btn.onRollOver = Proxy.create(this,this['showToolTip'], editFly_btn, "ls_sequence_live_edit_btn_tooltip");
+ editFly_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ monitorTabs_tb.addEventListener("change",mcontroller);
+
+ setLabels();
+ setStyles();
+ setupTabInit();
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ private function setupTabInit(){
+
+ var mm:Observable = getModel();
+
+ // Inititialsation for Lesson Tab View
+ lessonTabView_mc = _lessonTabLayer_mc.attachMovie("LessonTabView", "lessonTabView_mc",DepthManager.kTop)
+ lessonTabView = LessonTabView(lessonTabView_mc);
+ lessonTabView.init(mm, undefined);
+ lessonTabView.addEventListener('load',Proxy.create(this,tabLoaded));
+
+ // Inititialsation for Monitor Tab View
+ monitorTabView_mc = _monitorTabLayer_mc.attachMovie("MonitorTabView", "monitorTabView_mc",DepthManager.kTop)
+ monitorTabView = MonitorTabView(monitorTabView_mc);
+ monitorTabView.init(mm, undefined);
+ monitorTabView.addEventListener('load',Proxy.create(this,tabLoaded));
+
+ // Inititialsation for Learner Tab View
+ learnerTabView_mc = _learnerTabLayer_mc.attachMovie("LearnerTabView", "learnerTabView_mc",DepthManager.kTop)
+ learnerTabView = LearnerTabView(learnerTabView_mc);
+ learnerTabView.init(mm, undefined);
+ learnerTabView.addEventListener('load',Proxy.create(this,tabLoaded));
+
+ mm.addObserver(lessonTabView);
+ mm.addObserver(monitorTabView);
+ mm.addObserver(learnerTabView);
+
+ }
+
+ public function showToolTip(btnObj, btnTT:String):Void{
+ var btnLabel = btnObj.label;
+ var xpos:Number;
+ if (btnLabel == "Help"){
+ xpos = bkgHeader_pnl.width - 165 //btnObj._x - 105
+ }else if (btnLabel == "Refresh"){
+ xpos = bkgHeader_pnl.width - 165 //btnObj._x - 40
+ }else{
+ xpos = btnObj._x
+ }
+ var Xpos = Application.MONITOR_X+ xpos;
+ var Ypos = (Application.MONITOR_Y+ btnObj._y+btnObj.height)+5;
+ var ttHolder = Application.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('BGPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('MHPanel');
+ bkgHeader_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('scrollpane');
+ monitorLesson_scp.setStyle('styleName',styleObj);
+ monitorSequence_scp.setStyle('styleName',styleObj);
+ monitorLearner_scp.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('button');
+ monitorTabs_tb.setStyle('styleName', styleObj);
+ refresh_btn.setStyle('styleName',styleObj);
+ exportPortfolio_btn.setStyle('styleName',styleObj);
+ help_btn.setStyle('styleName',styleObj);
+ viewJournals_btn.setStyle('styleName', styleObj);
+ editFly_btn.setStyle('styleName', styleObj);
+
+ }
+
+ private function setLabels():Void{
+ refresh_btn.label = Dictionary.getValue('refresh_btn');
+ help_btn.label = Dictionary.getValue('help_btn');
+ exportPortfolio_btn.label = Dictionary.getValue('learner_exportPortfolio_btn');
+ viewJournals_btn.label = Dictionary.getValue('learner_viewJournals_btn');
+ editFly_btn.label = Dictionary.getValue('ls_sequence_live_edit_btn');
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(mm:MonitorModel):Void{
+ var s:Object = mm.getSize();
+ trace("Monitor Tab Widtht: "+s.w+" Monitor Tab Height: "+s.h);
+ bkg_pnl.setSize(s.w,s.h);
+ bkgHeader_pnl.setSize(s.w, bkgHeader_pnl._height)
+ trace("Monitor View Stage Width "+s.w+" and Monitor View Stage height "+s.h)
+ trace("Monitor View bg panel Width "+bkg_pnl.width+" and Monitor View bg panel height "+bkg_pnl.height)
+ monitorLesson_scp.setSize(s.w-monitorLesson_scp._x,s.h-monitorLesson_scp._y);
+ monitorSequence_scp.setSize(s.w-monitorSequence_scp._x,s.h-monitorSequence_scp._y);
+ monitorLearner_scp.setSize(s.w-monitorLearner_scp._x,s.h-monitorLearner_scp._y);
+ viewJournals_btn._x = s.w - 260;
+ exportPortfolio_btn._x = s.w - 260;
+ editFly_btn._x = s.w - 360;
+ refresh_btn._x = s.w - 160
+ help_btn._x = s.w - 80
+
+ }
+
+ /**
+ * Sets the position of the canvas on stage, called from update
+ * @param cm Canvas model object
+ */
+ private function setPosition(mm:MonitorModel):Void{
+ var p:Object = mm.getPosition();
+ trace("X pos set in Model is: "+p.x+" and Y pos set in Model is "+p.y)
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ public function getLessonTabView():LessonTabView{
+ return lessonTabView;
+ }
+
+ /**
+ * Overrides method in abstract view to ensure cortect type of controller is returned
+ * @usage
+ * @return CanvasController
+ */
+ public function getController():MonitorController{
+ var c:Controller = super.getController();
+ return MonitorController(c);
+ }
+
+ public function getMonitorTab():MovieClip{
+ return monitorTabs_tb;
+ }
+
+ public function getMonitorLessonScp():MovieClip{
+ trace("Called getMonitorScp")
+ return monitorLesson_scp;
+ }
+ public function getMonitorSequenceScp():MovieClip{
+ trace("Called getMonitorScp")
+ return monitorSequence_scp;
+ }
+ public function getMonitorLearnerScp():MovieClip{
+ trace("Called getMonitorScp")
+ return monitorLearner_scp;
+ }
+
+ /*
+ * Returns the default controller for this view.
+ */
+ public function defaultController (model:Observable):Controller {
+ return new MonitorController(model);
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerTabView.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerTabView.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerTabView.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,556 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+import org.lamsfoundation.lams.monitoring.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.ApplicationParent;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.ComplexActivity;
+import org.lamsfoundation.lams.authoring.cv.CanvasActivity;
+import org.lamsfoundation.lams.common.ToolTip;
+import org.lamsfoundation.lams.authoring.Transition;
+
+import mx.managers.*;
+import mx.containers.*;
+import mx.events.*;
+import mx.utils.*;
+import mx.controls.*;
+
+
+/**
+*Monitoring Tab view for the Monitor
+* Reflects changes in the MonitorModel
+*/
+
+class org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView extends AbstractView{
+
+ public static var _tabID:Number = 2;
+ private var _className = "LearnerTabView";
+
+ //constants:
+ private var GRID_HEIGHT:Number;
+ private var GRID_WIDTH:Number;
+ private var H_GAP:Number;
+ private var V_GAP:Number;
+ private var ACT_X:Number = 0;
+ private var ACT_Y:Number = 40;
+ private var xOffSet:Number = 10;
+ private var actWidth:Number = 120;
+ private var actLenght:Number = 0;
+ private var count:Number = 0;
+ private var activeLearner:Number;
+ private var prevLearner:Number;
+ private var learnersDrawn:Number;
+ private var learnerListArr:Array = new Array();
+
+ private var _tm:ThemeManager;
+ private var _tip:ToolTip;
+
+ private var mm:MonitorModel;
+ private var _learnerTabView:LearnerTabView;
+ private var _learnerTabViewContainer_mc:MovieClip;
+ private var learnerMenuBar:MovieClip;
+
+ private var _activityLayer_mc:MovieClip;
+ private var _activityLayer_mc_clones:Array;
+ private var _nameLayer_mc:MovieClip;
+
+ private var bkg_pnl:MovieClip;
+ private var completed_mc:MovieClip;
+
+ private var refresh_btn:Button;
+ private var help_btn:Button;
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ /**
+ * Constructor
+ */
+ function LearnerTabView(){
+ _learnerTabView = this;
+ _learnerTabViewContainer_mc = this;
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+
+ //Init for event delegation
+ mx.events.EventDispatcher.initialize(this);
+ }
+
+ /**
+ * Called to initialise Canvas . CAlled by the Canvas container
+ */
+ public function init(m:Observable,c:Controller){
+ //Invoke superconstructor, which sets up MVC relationships.
+ super (m, c);
+ mm = MonitorModel(model)
+
+ //Set up parameters for the grid
+ H_GAP = 10;
+ V_GAP = 10;
+
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+ mm.getMonitor().getMV().getMonitorLearnerScp()._visible = false;
+ }
+
+ /**
+ * Recieved update events from the CanvasModel. Dispatches to relevent handler depending on update.Type
+ * @usage
+ * @param event
+ */
+ public function update (o:Observable,infoObj:Object):Void{
+
+ var mm:MonitorModel = MonitorModel(o);
+
+ switch (infoObj.updateType){
+ case 'POSITION' :
+ setPosition(mm);
+ break;
+ case 'SIZE' :
+ setSize(mm);
+ break;
+ case 'TABCHANGE' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ hideMainExp(mm);
+ mm.broadcastViewUpdate("JOURNALSSHOWHIDE", true);
+
+ if (mm.activitiesDisplayed.isEmpty()){
+ mm.getMonitor().openLearningDesign(mm.getSequence());
+ } else if(mm.getIsProgressChangedLearner()) {
+ reloadProgress(false);
+ } else if(learnersDrawn != mm.allLearnersProgress.length){
+ reloadProgress(true);
+ }
+
+ mm.getMonitor().getMV().getMonitorLearnerScp()._visible = true;
+ LFMenuBar.getInstance().setDefaults();
+
+ } else {
+ mm.getMonitor().getMV().getMonitorLearnerScp()._visible = false;
+ }
+ break;
+ case 'PROGRESS' :
+ if (infoObj.tabID == _tabID){
+ if(!mm.locked){
+ mm.getMonitor().getProgressData(mm.getSequence());
+ } else {
+ ApplicationParent.extCall("reloadWindow", null);
+ }
+ }
+ break;
+
+ case 'RELOADPROGRESS' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ reloadProgress(true);
+ }
+ break;
+ case 'DRAW_ACTIVITY' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ drawActivity(infoObj.data, mm, infoObj.learner);
+ }
+ break;
+ case 'CLONE_ACTIVITY' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ cloneActivity(infoObj.data, mm, infoObj.learner);
+ }
+ break;
+ case 'REMOVE_ACTIVITY' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ removeActivity(infoObj.data, mm);
+ }
+ break;
+ case 'DRAW_DESIGN' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ drawAllLearnersDesign(mm, infoObj.tabID);
+ }
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorTabView');
+ }
+
+ }
+
+ /**
+ * layout visual elements on the MonitorTabView on initialisation
+ */
+ private function draw(){
+ //set up the Movie Clips to load relevant
+
+ this._nameLayer_mc = this.createEmptyMovieClip("_nameLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
+ this._activityLayer_mc = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
+
+ setStyles();
+
+ dispatchEvent({type:'load',target:this});
+ }
+
+ private function hideMainExp(mm:MonitorModel):Void{
+ mm.broadcastViewUpdate("EXPORTSHOWHIDE", false);
+ mm.broadcastViewUpdate("EDITFLYSHOWHIDE", false);
+ }
+
+ /**
+ * Sets last selected Sequence
+ */
+ private function setPrevLearner(learner:Number):Void{
+ prevLearner = learner;
+ }
+
+ /**
+ * Gets last selected Sequence
+ */
+ private function getPrevLearner():Number{
+ return prevLearner;
+ }
+
+ /*
+ * Clear Method to clear movies from scrollpane
+ *
+ */
+ private function clearLearnersData(array:Array):Array{
+ if(array != null){
+ for (var i=0; i ";
+ LSDescription_lbl.text = String(s.description).substr(0, limit);
+
+ if(s.description.length > limit) { LSDescription_lbl.text += "..."; }
+
+ sessionStatus_txt.text = showStatus(s.state);
+ numLearners_txt.text = String(s.noStartedLearners) + " " + Dictionary.getValue('ls_of_text')+" "+String(s.noPossibleLearners);
+ trace("current logged in learners are: "+mm.allLearnersProgress.length)
+ learnerURL_txt.text = _root.serverURL+"launchlearner.do?lessonID="+_root.lessonID;
+
+ //numLearners_txt.text = mm.allLearnersProgress.length + " " + Dictionary.getValue('ls_of_text')+" "+String(s.noPossibleLearners);
+ class_txt.text = s.organisationName;
+ learner_expp_cb.selected = s.learnerExportAvailable;
+ }
+
+ private function populateStatusList(stateID:Number):Void{
+ changeStatus_cmb.removeAll();
+
+ switch(stateID){
+ case Sequence.SUSPENDED_STATE_ID :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_enable'), LessonTabView.ACTIVE_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_archive'), LessonTabView.ARCHIVE_CBI);
+ break;
+ case Sequence.ARCHIVED_STATE_ID :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_activate'), LessonTabView.UNARCHIVE_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_CBI);
+ break;
+ case Sequence.ACTIVE_STATE_ID :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_archive'), LessonTabView.ARCHIVE_CBI);
+ break;
+ case Sequence.NOTSTARTED_STATE_ID :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_archive'), LessonTabView.ARCHIVE_CBI);
+ break;
+ case Sequence.REMOVED_STATE_ID :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ break;
+ default :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_disable'), LessonTabView.DISABLE_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_archive'), LessonTabView.ARCHIVE_CBI);
+
+ }
+
+ }
+
+ private function enableEditClass(stateID:Number):Void{
+
+ switch(stateID){
+ case Sequence.ACTIVE_STATE_ID :
+ showStartFields(true, true);
+ editClass_btn.enabled = true;
+ break;
+ case Sequence.NOTSTARTED_STATE_ID :
+ showStartFields(true, false);
+ editClass_btn.enabled = true;
+ break;
+ case Sequence.STARTED_STATE_ID :
+ showStartFields(false, false);
+ editClass_btn.enabled = true;
+ break;
+ default :
+ showStartFields(false, false);
+ editClass_btn.enabled = false;
+
+ }
+ }
+
+ private function showStartFields(a:Boolean, b:Boolean){
+ var s:Object = mm.getSequence();
+
+ // is started?
+ if(s.isStarted){
+ schedule_date_lbl.visible = false;
+ start_date_lbl.text = s.getStartDateTime();
+ start_date_lbl.visible = true;
+
+ } else {
+ // is scheduled to start?
+ start_date_lbl.visible = false;
+ if(s.isScheduled){
+ schedule_date_lbl.visible = true;
+ schedule_date_lbl.text = s.getScheduleDateTime();
+
+ } else {
+ schedule_date_lbl.visible = false;
+ }
+
+ }
+
+ start_btn.visible = a;
+
+
+
+
+
+ scheduleTime._visible = b;
+ scheduleDate_dt.visible = b;
+ schedule_btn.visible = b;
+ manageDate_lbl.visible = b;
+ manageTime_lbl.visible = b;
+
+ /**
+ if(seq.isStarted()){
+ startMsg_txt.text = "Currently Started."
+ } else {
+ startMsg_txt.text = "Scheduled to start at "
+ }
+
+ startMsg_txt.visible = true;
+ */
+ }
+
+ private function showStatus(seqStatus:Number):String{
+ var seqStat:String;
+ var s:Object = mm.getSequence();
+
+ switch(seqStatus){
+ case LessonTabView.ARCHIVED_STATUS :
+ seqStat = Dictionary.getValue('ls_status_archived_lbl');
+ break;
+ case LessonTabView.REMOVED_STATUS :
+ seqStat = Dictionary.getValue('ls_status_removed_lbl');
+ break;
+ case LessonTabView.STARTED_STATUS :
+ seqStat = Dictionary.getValue('ls_status_started_lbl');
+ break;
+ case LessonTabView.SUSPENDED_STATUS :
+ seqStat = Dictionary.getValue('ls_status_disabled_lbl');
+ break;
+ case LessonTabView.NOT_STARTED_STATUS:
+ if(s.isScheduled){ seqStat = Dictionary.getValue('ls_status_scheduled_lbl'); }
+ else {
+ seqStat = Dictionary.getValue('ls_status_active_lbl');
+ }
+ break;
+ default:
+ seqStat = Dictionary.getValue('ls_status_active_lbl');
+ }
+
+ return seqStat;
+ }
+
+ /**
+ * Apply status change
+ *
+ *
+ * @param evt Apply onclick event
+ */
+ private function changeStatus(evt:Object):Void{
+ dispatchEvent({type:"apply", target: this});
+ }
+
+ public function scheduleLessonStart(evt:Object):Void{
+ Debugger.log('setting Schedule Date :' + scheduleDate_dt.selectedDate,Debugger.CRITICAL,'scheduleLessonStart','org.lamsfoundation.lams.LessonTabView');
+ if (scheduleDate_dt.selectedDate == null || scheduleDate_dt.selectedDate == undefined){
+ LFMessage.showMessageAlert(Dictionary.getValue('al_validation_schstart'), null, null);
+ }else {
+ //var datetime:String = getScheduleDateTime(scheduleDate_dt.selectedDate, scheduleTime.f_returnTime());
+ var schDT = getScheduleDateTime(scheduleDate_dt.selectedDate, scheduleTime.f_returnTime());
+ if (!schDT.validTime){
+ LFMessage.showMessageAlert(Dictionary.getValue('al_validation_schtime'), null, null);
+ return;
+ }else {
+ //trace(resultDTO.scheduleDateTime);
+ mm.getMonitor().startLesson(true, _root.lessonID, schDT.dateTime);
+ }
+
+ }
+
+ }
+
+ private function populateContributeActivities():Void{
+ if (requiredTaskList.length == 0){
+ var todos:Array = mm.getToDos();
+ // show isRequired activities in scrollpane
+ for (var i=0; i 0){
+ var obj:Object = {}
+ obj.entries = tmp;
+ obj.child= ca.childActivities[i];
+ array.push(obj);
+ }
+ }
+ for (var j=0; j 0){
+ // write ca title / details to screen with x position
+ requiredTaskList[listCount] = _monitorReqTask_mc.attachMovie("contributeActivityRow", "contributeActivityRow"+listCount, this._monitorReqTask_mc.getNextHighestDepth(), {_x:x, _y:19*listCount})
+ reqTasks_scp.redraw(true);
+ requiredTaskList[listCount].contributeActivity.background = true;
+ requiredTaskList[listCount].contributeActivity._width=reqTasks_scp._width-20
+
+ if (ca._parentActivityID == null){
+ requiredTaskList[listCount].contributeActivity.text = " "+ca.title
+ requiredTaskList[listCount].contributeActivity.backgroundColor = 0xD5E6FF;
+ }else {
+ requiredTaskList[listCount].contributeActivity.text = "\t"+ca.title
+ requiredTaskList[listCount].contributeActivity.backgroundColor = 0xF9F2DD;
+ }
+
+ listCount++
+ }
+
+ for(var i=0; i 0){
+ trace('now drawing child');
+ // write child ca title (indented - x + 10 position)
+ drawIsRequiredTasks(o.child, o.entries, x);
+ }
+
+ }
+ }
+
+ reqTasks_scp.redraw(true)
+ }
+
+ /**
+ * Opens the lesson manager dialog
+ */
+ public function showLessonManagerDialog(mm:MonitorModel) {
+ trace('doing Lesson Manager popup...');
+ trace('app root: ' + mm.getMonitor().root);
+ trace('lfwindow: ' + LFWindow);
+ var dialog:MovieClip = PopUpManager.createPopUp(mm.getMonitor().root, LFWindow, true,{title:Dictionary.getValue('ls_win_editclass_title'),closeButton:true,scrollContentPath:'selectClass'});
+ dialog.addEventListener('contentLoaded',Delegate.create(_monitorController,_monitorController.openDialogLoaded));
+
+ }
+
+ /**
+ * Opens the lesson manager dialog
+ */
+ public function showLearnersDialog(mm:MonitorModel) {
+ trace('doing Learners popup...');
+ trace('app root: ' + mm.getMonitor().root);
+ trace('lfwindow: ' + LFWindow);
+ var opendialog:MovieClip = PopUpManager.createPopUp(mm.getMonitor().root, LFWindow, true,{title:Dictionary.getValue('ls_win_learners_title'),closeButton:true,scrollContentPath:'learnersDialog'});
+ opendialog.addEventListener('contentLoaded',Delegate.create(_monitorController,_monitorController.openDialogLoaded));
+
+ }
+
+ /**
+ *
+ * @usage
+ * @param newworkspaceDialog
+ * @return
+ */
+ public function set dialog (dialog:MovieClip):Void {
+ _dialog = dialog;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get dialog ():MovieClip {
+ return _dialog;
+ }
+
+ public function showToolTip(btnObj, btnTT:String, goBtnYpos:Number, goBtnXpos:Number):Void{
+ var ttData = mm.getTTData();
+ trace("Monitor_X: " + ttData.monitorX);
+ trace("Monitor_Y: " + ttData.monitorY);
+ trace("ttHolder : " + ttData.ttHolderMC);
+
+
+ if(goBtnYpos != null && goBtnXpos != null){
+ var xpos:Number = mm.getMonitor().getMV().getMonitorLessonScp().width - 150;
+ var ypos:Number = ttData.monitorY + (goBtnYpos +5);
+ }else {
+ var xpos:Number = ttData.monitorX + btnObj._x;
+ var ypos:Number = ttData.monitorY + (btnObj._y+btnObj.height)+5;
+ }
+
+ var ttMessage = Dictionary.getValue(btnTT);
+ _tip.DisplayToolTip(ttData.ttHolderMC, ttMessage, xpos, ypos);
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+ public function setupLabels(){
+
+ //max_lbl.text = Dictionary.getValue('pi_max_act');
+
+ //populate the synch type combo:
+ status_lbl.text = ""+Dictionary.getValue('ls_status_lbl')+"";
+ learner_lbl.text = ""+Dictionary.getValue('ls_learners_lbl')+"";
+ learnerURL_lbl.text = ""+Dictionary.getValue('ls_learnerURL_lbl')+"";
+ class_lbl.text = ""+Dictionary.getValue('ls_class_lbl')+"";
+ elapsed_lbl.text = ""+Dictionary.getValue('ls_duration_lbl')+"";
+ manageClass_lbl.text = ""+Dictionary.getValue('ls_manage_class_lbl')+"";
+ manageStatus_lbl.text = ""+Dictionary.getValue('ls_manage_status_lbl')+"";
+ manageStart_lbl.text = ""+Dictionary.getValue('ls_manage_start_lbl')+"";
+ manageDate_lbl.text = Dictionary.getValue('ls_manage_date_lbl');
+ manageTime_lbl.text = Dictionary.getValue('ls_manage_time_lbl');
+ learner_expp_cb_lbl.text = Dictionary.getValue('ls_manage_learnerExpp_lbl');
+
+ //Button
+ viewLearners_btn.label = Dictionary.getValue('ls_manage_learners_btn');
+ editClass_btn.label = Dictionary.getValue('ls_manage_editclass_btn');
+ statusApply_btn.label = Dictionary.getValue('ls_manage_apply_btn');
+ schedule_btn.label = Dictionary.getValue('ls_manage_schedule_btn');
+ start_btn.label = Dictionary.getValue('ls_manage_start_btn');
+
+ //_lessonStateArr = ["CREATED", "NOT_STARTED", "STARTED", "SUSPENDED", "FINISHED", "ARCHIVED", "DISABLED"];
+
+ taskManager.border = true
+ taskManager.borderColor = 0x003366;
+ taskManager_lbl.text = Dictionary.getValue('ls_tasks_txt');
+ taskManager_lbl._x = taskManager._x + 2;
+ taskManager_lbl._y = taskManager._y;
+
+ lessonManager.border = true
+ lessonManager.borderColor = 0x003366;
+ lessonManager_lbl.text = Dictionary.getValue('ls_manage_txt');
+ lessonManager_lbl._x = lessonManager._x + 2;
+ lessonManager_lbl._y = lessonManager._y;
+
+ taskManager.background = true
+ taskManager.backgroundColor = 0xEAEAEA;
+ lessonManager.background = true
+ lessonManager.backgroundColor = 0xEAEAEA;
+
+ delete this.onEnterFrame;
+
+ //Call to apply style to all the labels and input fields
+ setStyles();
+
+ }
+
+
+ private function toogleExpPortfolio(evt:Object) {
+ Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView");
+ var target:CheckBox = CheckBox(evt.target);
+ //var wm:WizardModel = WizardModel(getModel());
+ //resultDTO.learnerExpPortfolio = target.selected;
+ var callback:Function = Proxy.create(this,confirmOutput);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=learnerExportPortfolioAvailable&lessonID='+_root.lessonID+'&learnerExportPortfolio='+target.selected, callback, false);
+ }
+
+
+ public function confirmOutput(r):Void{
+ if(r instanceof LFError) {
+ r.showErrorAlert();
+ } else {
+ if (learner_expp_cb.selected){
+ var msg:String = Dictionary.getValue('ls_confirm_expp_enabled') ;
+ LFMessage.showMessageAlert(msg);
+
+ }else {
+ var msg:String = Dictionary.getValue('ls_confirm_expp_disabled') ;
+ LFMessage.showMessageAlert(msg);
+ }
+
+ }
+ }
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles() {
+
+ //LABELS
+ var styleObj = _tm.getStyleObject('label');
+ status_lbl.setStyle('styleName',styleObj);
+ learner_lbl.setStyle('styleName',styleObj);
+ learnerURL_lbl.setStyle('styleName',styleObj);
+ class_lbl.setStyle('styleName',styleObj);
+ manageClass_lbl.setStyle('styleName',styleObj);
+ manageStatus_lbl.setStyle('styleName',styleObj);
+ manageStart_lbl.setStyle('styleName',styleObj);
+ //learner_expp_cb.setStyle('styleName',styleObj);
+
+ schedule_date_lbl.setStyle('styleName', styleObj);
+ sessionStatus_txt.setStyle('styleName', styleObj);
+ numLearners_txt.setStyle('styleName', styleObj);
+ class_txt.setStyle('styleName', styleObj);
+ lessonManager_lbl.setStyle('styleName', styleObj);
+ taskManager_lbl.setStyle('styleName', styleObj);
+
+ // Check box label
+ learner_expp_cb_lbl.setStyle('styleName', styleObj);
+
+
+ //SMALL LABELS
+ styleObj = _tm.getStyleObject('PIlabel');
+ manageDate_lbl.setStyle('styleName',styleObj);
+ manageTime_lbl.setStyle('styleName',styleObj);
+
+
+ //BUTTONS
+ styleObj = _tm.getStyleObject('button');
+ viewLearners_btn.setStyle('styleName',styleObj);
+ editClass_btn.setStyle('styleName',styleObj);
+ schedule_btn.setStyle('styleName',styleObj);
+ start_btn.setStyle('styleName',styleObj);
+ statusApply_btn.setStyle('styleName',styleObj);
+
+ //COMBO
+ styleObj = _tm.getStyleObject('combo');
+ changeStatus_cmb.setStyle('styleName',styleObj);
+ scheduleDate_dt.setStyle('styleName',styleObj);
+
+ //BG PANEL
+ styleObj = _tm.getStyleObject('BGPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+
+ //STEPPER
+ //styleObj = _tm.getStyleObject('numericstepper');
+ //startHour_stp.setStyle('styleName',styleObj);
+ //startMin_stp.setStyle('styleName',styleObj);
+
+ //SCROLLPANE
+ styleObj = _tm.getStyleObject('scrollpane');
+ reqTasks_scp.setStyle('styleName', styleObj);
+ reqTasks_scp.border_mc.setStyle('_visible',false);
+
+ }
+
+ private function setMenu(b:Boolean):Void{
+ var fm:Menu = LFMenuBar.getInstance().fileMenu;
+ fm.setMenuItemEnabled(fm.getMenuItemAt(1), editClass_btn.enabled);
+ fm.setMenuItemEnabled(fm.getMenuItemAt(2), start_btn.visible);
+ fm.setMenuItemEnabled(fm.getMenuItemAt(3), schedule_btn.visible);
+
+ var vm:Menu = LFMenuBar.getInstance().viewMenu;
+ vm.setMenuItemEnabled(vm.getMenuItemAt(0), true);
+ }
+
+ public function getScheduleDateTime(date:Date, timeStr:String):Object{
+ var bs:String = "%2F"; // backslash char
+ var dayStr:String;
+ var monthStr:String;
+ var mydate = new Date();
+ var dtObj = new Object();
+ trace('output time: ' + timeStr);
+ var day = date.getDate();
+ if(day<10){
+ dayStr=String(0)+day;
+ } else {
+ dayStr=day.toString();
+ }
+
+ var month = date.getMonth()+1;
+ if(month<10){
+ monthStr=String(0)+month;
+ } else {
+ monthStr = month.toString();
+ }
+
+ var dateStr = dayStr + bs + monthStr + bs + date.getFullYear();
+ trace('selected date: ' + dateStr);
+
+ if (day == mydate.getDate() && month == mydate.getMonth()+1 && date.getFullYear() == mydate.getFullYear()){
+ dtObj.validTime = validateTime()
+ }else {
+ dtObj.validTime = true
+ }
+ dtObj.dateTime = dateStr + '+' + timeStr;
+ return dtObj;
+ //return dateStr + '+' + timeStr;
+ }
+
+ private function validateTime():Boolean{
+ var mydate = new Date();
+ var checkHours:Number;
+ var hours = mydate.getHours();
+ var minutes = mydate.getMinutes();
+ var selectedHours = Number(scheduleTime.tHour.text);
+ var selectedMinutes = Number(scheduleTime.tMinute.text);
+ if (scheduleTime.tMeridian.selectedItem.data == "AM"){
+ checkHours = 0
+ }
+
+ if (scheduleTime.tMeridian.selectedItem.data == "PM"){
+ if (Number (selectedHours) == 12){
+ checkHours = 0
+ }else {
+ checkHours = 12
+ }
+ }
+
+
+ if (hours > (Number(selectedHours+checkHours))){
+ return false;
+ }else if (hours == Number(selectedHours+checkHours)){
+ if (minutes > selectedMinutes){
+ return false;
+ }else {
+ return true;
+ }
+ }else {
+ return true;
+ }
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(mm:MonitorModel):Void{
+ var s:Object = mm.getSize();
+ trace("Monitor Tab Widtht: "+s.w+" Monitor Tab Height: "+s.h);
+ //bkg_pnl.setSize(s.w-20,s.h);
+ lessonManager.setSize(s.w-20,lessonManager._height);
+ taskManager.setSize(s.w-20,lessonManager._height);
+ //qTasks_scp.setSize(s.w._width,reqTasks_scp._height);
+ var scpHeight:Number = mm.getMonitor().getMV().getMonitorLessonScp()._height
+ trace("scpHeight in lesson tab:"+scpHeight)
+ reqTasks_scp.setSize(s.w-30,(scpHeight-reqTasks_scp._y)-20);
+ for (var i=0; i "+finishedLearners+" of "+ totalLearners;
+ //setSize(mm);
+ }
+
+ public function showToolTip(btnTT:String):Void{
+ var Xpos = Application.MONITOR_X+ 5;
+ var Ypos = Application.MONITOR_Y+ endGate_mc._y;
+ var ttHolder = Application.tooltip;
+ //var ttMessage = btnObj.label;
+ var ttMessage = Dictionary.getValue(btnTT);
+
+ //param "true" is to specify that tooltip needs to be shown above the component
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, true);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ private function hideMainExp(mm:MonitorModel):Void{
+ //var mcontroller = getController();
+ mm.broadcastViewUpdate("EXPORTSHOWHIDE", true);
+ mm.broadcastViewUpdate("EDITFLYSHOWHIDE", true);
+ }
+
+ /**
+ * Reloads the learner Progress and
+ * @Param isChanged Boolean Value to pass it to setIsProgressChanged in monitor model so that it sets it to true if refresh button is clicked and sets it to fasle as soon as latest data is loaded and design is redrawn.
+ * @usage
+ * @return nothing
+ */
+ private function reloadProgress(isChanged:Boolean){
+ var s:Object = mm.getSize();
+ drawDesignCalled = undefined;
+
+ //Remove all the movies drawn on the transition and activity movieclip holder
+
+ this._learnerContainer_mc.removeMovieClip();
+ this._transitionLayer_mc.removeMovieClip();
+ this._activityLayer_mc.removeMovieClip();
+ this.endGate_mc.removeMovieClip();
+
+ //Recreate both Transition holder and Activity holder Movieclips
+ _transitionLayer_mc = this.createEmptyMovieClip("_transitionLayer_mc", this.getNextHighestDepth());
+ _activityLayer_mc = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
+ _learnerContainer_mc = this.createEmptyMovieClip("_learnerContainer_mc", this.getNextHighestDepth());
+ endGate_mc = _activityLayer_mc.createChildAtDepth("endGate",DepthManager.kTop, {_x:0, _y:s.h-endGateOffset});
+
+ if (isChanged == false){
+ mm.setIsProgressChangedSequence(false);
+
+ } else {
+ mm.setIsProgressChangedLesson(true);
+ mm.setIsProgressChangedLearner(true);
+ }
+
+ mm.transitionsDisplayed.clear();
+ mm.activitiesDisplayed.clear();
+
+ mm.getMonitor().getProgressData(mm.getSequence());
+ }
+
+ /**
+ * Remove the activityies from screen on selection of new lesson
+ *
+ * @usage
+ * @param activityUIID
+ * @return
+ */
+ private function removeActivity(a:Activity,mm:MonitorModel){
+ //dispatch an event to show the design has changed
+ var r = mm.activitiesDisplayed.remove(a.activityUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+
+ }
+
+ /**
+ * Remove the transitions from screen on selection of new lesson
+ *
+ * @usage
+ * @param activityUIID
+ * @return
+ */
+ private function removeTransition(t:Transition,mm:MonitorModel){
+ //Debugger.log('t.uiID:'+t.transitionUIID,Debugger.CRITICAL,'removeTransition','CanvasView');
+ var r = mm.transitionsDisplayed.remove(t.transitionUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+ return s;
+ }
+
+
+ /**
+ * Draws new activity to monitor tab view stage.
+ * @usage
+ * @param a - Activity to be drawn
+ * @param cm - Refernce to the model
+ * @return Boolean - successfullit
+ */
+ private function drawActivity(a:Activity,mm:MonitorModel):Boolean{
+
+ var mtv = MonitorTabView(this);
+ var mc = getController();
+ var newActivity_mc = null;
+
+ Debugger.log("activityTypeID: " + a.activityTypeID,Debugger.CRITICAL,'drawActivity','MonitorTabView');
+
+ //take action depending on act type
+ if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity() ){
+ newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasActivity",DepthManager.kBottom,{_activity:a,_monitorController:mc,_monitorTabView:mtv, _module:"monitoring", learnerContainer:_learnerContainer_mc});
+ } else if (a.isGateActivity()){
+ newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasGateActivity",DepthManager.kBottom,{_activity:a,_monitorController:mc,_monitorTabView:mtv, _module:"monitoring"});
+ } else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE){
+ var children:Array = mm.getMonitor().ddm.getComplexActivityChildren(a.activityUIID);
+ newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasParallelActivity",DepthManager.kBottom,{_activity:a,_children:children,_monitorController:mc,_monitorTabView:mtv,fromModuleTab:"monitorMonitorTab",learnerContainer:_learnerContainer_mc});
+ } else if(a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE){
+ var children:Array = mm.getMonitor().ddm.getComplexActivityChildren(a.activityUIID);
+ newActivity_mc = _activityLayer_mc.createChildAtDepth("CanvasOptionalActivity",DepthManager.kBottom,{_activity:a,_children:children,_monitorController:mc,_monitorTabView:mtv,fromModuleTab:"monitorMonitorTab",learnerContainer:_learnerContainer_mc});
+ } else{
+ Debugger.log('The activity:'+a.title+','+a.activityUIID+' is of unknown type, it cannot be drawn',Debugger.CRITICAL,'drawActivity','MonitorTabView');
+ }
+
+ var actItems:Number = mm.activitiesDisplayed.size()
+
+ if (actItems < mm.getActivityKeys().length && newActivity_mc != null){
+ mm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
+ }
+
+ if (actItems == mm.getActivityKeys().length){
+ //setSize(mm);
+ }
+
+ mm.getMonitor().getMV().getMonitorSequenceScp().redraw(true);
+
+ return true;
+ }
+
+ /**
+ * Add to canvas stage but keep hidden from view.
+ *
+ * @usage
+ * @param a
+ * @param cm
+ * @return true if successful
+ */
+
+ private function hideActivity(a:Activity, mm:MonitorModel):Boolean {
+ if (a.isSystemGateActivity()){
+ var newActivityObj = new Object();
+ newActivityObj.activity = a;
+
+ mm.activitiesDisplayed.put(a.activityUIID,newActivityObj);
+
+ Debugger.log('Gate activity a.title:'+a.title+','+a.activityUIID+' added (hidden) to the cm.activitiesDisplayed hashtable:'+newActivityObj,4,'hideActivity','CanvasView');
+ }
+
+ return true;
+ }
+
+ /**
+ * Draws a transition on the Monitor Tab View.
+ * @usage
+ * @param t The transition to draw
+ * @param mm the Monitor Model.
+ * @return
+ */
+ private function drawTransition(t:Transition,mm:MonitorModel):Boolean{
+ var mtv = MonitorTabView(this);
+ var mc = getController();
+
+ var newTransition_mc:MovieClip = _transitionLayer_mc.createChildAtDepth("MonitorTransition",DepthManager.kTop,{_transition:t,_monitorController:mc,_monitorTabView:mtv});
+
+ var trnsItems:Number = mm.transitionsDisplayed.size()
+ if (trnsItems < mm.getTransitionKeys().length){
+ mm.transitionsDisplayed.put(t.transitionUIID,newTransition_mc);
+ }
+
+ Debugger.log('drawn a transition:'+t.transitionUIID+','+newTransition_mc,Debugger.GEN,'drawTransition','MonitorTabView');
+ return true;
+
+ }
+
+ /**
+ * Hides a transition on the canvas.
+ *
+ * @usage
+ * @param t The transition to hide
+ * @param cm The canvas model
+ * @return true if successful
+ */
+
+ private function hideTransition(t:Transition, mm:MonitorModel):Boolean{
+ var mtv = MonitorTabView(this);
+ var mc = getController();
+
+ var newTransition_mc:MovieClip = _transitionLayer_mc.createChildAtDepth("CanvasTransition",DepthManager.kTop,{_transition:t,_monitorController:mc,_monitorTabView:mtv, _visible:false});
+
+ mm.transitionsDisplayed.put(t.transitionUIID,newTransition_mc);
+ Debugger.log('drawn (hidden) a transition:'+t.transitionUIID+','+newTransition_mc,Debugger.GEN,'hideTransition','CanvasView');
+
+ return true;
+ }
+
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('CanvasPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('MHPanel');
+ endGate_mc.bg_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('BGPanel');
+ endGate_mc.bar_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('EndGatelabel');
+ endGate_mc.lessonEnd_lbl.setStyle('styleName',styleObj);
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(mm:MonitorModel):Void{
+ var s:Object = mm.getSize();
+ trace("Monitor Tab Grid Width: "+s.w+" Monitor Tab Grid Height: "+s.h);
+ //monitor_scp.setSize(s.w,s.h);
+ bkg_pnl.setSize(s.w,s.h);
+ endGate_mc._y = s.h-endGateOffset;
+ endGate_mc.bg_pnl.setSize(s.w,endGate_mc.bg_pnl.height);
+ endGate_mc.bar_pnl.setSize(s.w-20,endGate_mc.bar_pnl.height);
+ endGate_mc.tt_btn.setSize(s.w,endGate_mc.bg_pnl.height);
+ for (var i=0; i" + Dictionary.getValue('td_desc_text');
+ genralInfo_txt.htmlText = desc;
+
+
+ }
+
+ private function populateContributeActivities():Void{
+ var todos = LessonManagerDialog.clearScp(todos)
+ todos = mm.getToDos();
+ todoTaskList = LessonManagerDialog.clearScp(todoTaskList)
+ // show isRequired activities in scrollpane
+ for (var i=0; i 0){
+ var obj:Object = {}
+ obj.entries = tmp;
+ obj.child= ca.childActivities[i];
+ array.push(obj);
+ }
+
+ //var tmp:Array = getEntries(ca.childActivities[i]);
+ //drawIsRequiredChildTasks(ca, ca.childActivities[i], tmp);
+ //return null;
+ }
+ for (var j=0; j 0){
+ // write ca title / details to screen with x position
+ todoTaskList[listCount] = _monitorTodoTask_mc.attachMovie("contributeActivityRow", "contributeActivityRow"+listCount, _monitorTodoTask_mc.getNextHighestDepth(), {_x:x, _y:YPOS+(19*listCount)})
+ todoTaskList[listCount].contributeActivity.background = true;
+ todoTaskList[listCount].contributeActivity._width=_monitorTodoTask_mc._width-20
+
+ if (ca._parentActivityID == null){
+ todoTaskList[listCount].contributeActivity.text = " "+ca.title
+ todoTaskList[listCount].contributeActivity.backgroundColor = 0xD5E6FF;
+ }else {
+ todoTaskList[listCount].contributeActivity.text = "\t"+ca.title
+ todoTaskList[listCount].contributeActivity.backgroundColor = 0xF9F2DD;
+ }
+
+ listCount++
+ }
+
+ for(var i=0; i 0){
+ trace('now drawing child');
+ // write child ca title (indented - x + 10 position)
+ drawTodoTasks(o.child, o.entries, x);
+ }
+
+ }
+ }
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('BGPanel');
+ bkg_pnl.setStyle('styleName',styleObj);
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(mm:MonitorModel):Void{
+ var s:Object = mm.getSize();
+ bkg_pnl.setSize(s.w,s.h);
+ genralInfo_txt._width = s.w-20
+ for (var i=0; i= DATA_LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('reached timeout waiting for data to load.',Debugger.CRITICAL,'checkDataLoaded','Application');
+ clearInterval(_DataLoadCheckIntervalID);
+
+
+ }
+ }
+ }
+
+ /**
+ * Runs periodically and dispatches events as they are ready
+ */
+ private function checkUILoaded() {
+ //If it's the first time through then set up the interval to keep polling this method
+ if(!_UILoadCheckIntervalID) {
+ _UILoadCheckIntervalID = setInterval(Proxy.create(this,checkUILoaded),UI_LOAD_CHECK_INTERVAL);
+ } else {
+ _uiLoadCheckCount++;
+ //If all events dispatched clear interval and call start()
+ if(_dictionaryEventDispatched && _themeEventDispatched){
+ //Debugger.log('Clearing Interval and calling start :',Debugger.CRITICAL,'checkUILoaded','Application');
+ clearInterval(_UILoadCheckIntervalID);
+ start();
+ }else {
+ //If UI loaded check which events can be broadcast
+ if(_UILoaded){
+ //Debugger.log('ALL UI LOADED, waiting for all true to dispatch init events: _dictionaryLoaded:'+_dictionaryLoaded+'_themeLoaded:'+_themeLoaded ,Debugger.GEN,'checkUILoaded','Application');
+
+ //If dictionary is loaded and event hasn't been dispatched - dispatch it
+ if(_dictionaryLoaded && !_dictionaryEventDispatched){
+ _dictionaryEventDispatched = true;
+ _dictionary.broadcastInit();
+ }
+ //If theme is loaded and theme event hasn't been dispatched - dispatch it
+ if(_themeLoaded && !_themeEventDispatched){
+ _themeEventDispatched = true;
+ _themeManager.broadcastThemeChanged();
+ }
+
+ if(_uiLoadCheckCount >= UI_LOAD_CHECK_TIMEOUT_COUNT){
+ //if we havent loaded the dict or theme by the timeout count then give up
+ Debugger.log('raeached time out waiting to load dict and themes, giving up.',Debugger.CRITICAL,'checkUILoaded','Application');
+ var msg:String = "";
+ if(!_themeEventDispatched){
+ msg+=Dictionary.getValue("app_chk_themeload");
+ }
+ if(!_dictionaryEventDispatched){
+ msg+="The lanaguage data has not been loaded.";
+ }
+ msg+=Dictionary.getValue("app_fail_continue");
+ var e:LFError = new LFError(msg,"Canvas.setDroppedTemplateActivity",this,'_themeEventDispatched:'+_themeEventDispatched+' _dictionaryEventDispatched:'+_dictionaryEventDispatched);
+ e.showErrorAlert();
+ //todo: give the user a message
+ clearInterval(_UILoadCheckIntervalID);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is called by each UI element as it loads to notify Application that it's loaded
+ * When all UIElements are loaded the Application can set UILoaded flag true allowing events to be dispatched
+ * and methods called on the UI Elements
+ *
+ * @param UIElementID:String - Identifier for the Element that was loaded
+ */
+ public function UIElementLoaded(evt:Object) {
+ if(evt.type=='load'){
+ //Which item has loaded
+ switch (evt.target.className) {
+ case 'Wizard' :
+ _wizardLoaded = true;
+ break;
+ default:
+ }
+
+ loader.complete();
+
+ //If all of them are loaded set UILoad accordingly
+ if(_wizardLoaded){
+ _UILoaded=true;
+ }
+
+ }
+ }
+
+ /**
+ * Create all UI Elements
+ */
+ private function setupUI(){
+ //Create the application root
+ _appRoot_mc = _container_mc.createEmptyMovieClip('appRoot_mc',APP_ROOT_DEPTH);
+ //Create screen elements
+ _dialogueContainer_mc = _container_mc.createEmptyMovieClip('_dialogueContainer_mc',DIALOGUE_DEPTH);
+ _tooltipContainer_mc = _container_mc.createEmptyMovieClip('_tooltipContainer_mc',TOOLTIP_DEPTH);
+ _cursorContainer_mc = _container_mc.createEmptyMovieClip('_cursorContainer_mc',CURSOR_DEPTH);
+
+ var depth:Number = _appRoot_mc.getNextHighestDepth();
+
+ // WIZARD
+ _wizard = new Wizard(_appRoot_mc,WIZARD_X, WIZARD_Y, WIZARD_W, WIZARD_H);
+ _wizard.addEventListener('load',Proxy.create(this,UIElementLoaded));
+ //WORKSPACE
+ _workspace = new Workspace();
+
+ }
+
+ /**
+ * Runs when application setup has completed. At this point the init/loading screen can be removed and the user can
+ * work with the application
+ */
+ private function start(){
+
+ //Fire off a resize to set up sizes
+ onResize();
+
+ //Remove the loading screen
+ loader.stop();
+
+ if(SHOW_DEBUGGER){
+ showDebugger();
+ }
+ }
+
+ /**
+ * Opens the preferences dialog
+
+ public function showPrefsDialog() {
+ PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue("prefs_dlg_title"),closeButton:true,scrollContentPath:'preferencesDialog'});
+ }
+ */
+
+ /**
+ * Opens the lesson manager dialog
+ */
+ //public function showLessonManagerDialog() {
+ // PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue("lesson_dlg_title"),closeButton:true,scrollContentPath:'selectClass'});
+ //}
+
+ /**
+ * Receives events from the Stage resizing
+ */
+ public function onResize(){
+ //Debugger.log('onResize',Debugger.GEN,'main','org.lamsfoundation.lams.Application');
+
+ //Get the stage width and height and call onResize for stage based objects
+ // var w:Number = Stage.width;
+ // var h:Number = Stage.height;
+ //var someListener:Object = new Object();
+ //someListener.onMouseUp = function () {
+ // _wizard.setSize(w,h);
+ //}
+ //_wizard.setSize(w,h);
+ }
+
+ /**
+ * Handles KEY Releases for Application
+ */
+
+ public function transition_keyPressed(){
+ _controlKeyPressed = "transition";
+
+ }
+ public function showDebugger():Void{
+ _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
+ }
+
+ public function hideDebugger():Void{
+ _debugDialog.deletePopUp();
+ }
+
+ /**
+ * stores a reference to the object
+ * @usage
+ * @param obj
+ * @return
+ */
+ public function setClipboardData(obj:Object):Void{
+ _clipboardData = obj;
+ trace("clipBoard data id"+_clipboardData);
+ }
+
+ /**
+ * returns a reference to the object on the clipboard.
+ * Note it must be cloned to be used. this should be taken care of by the destination class
+ * @usage
+ * @return
+ */
+ public function getClipboardData():Object{
+ return _clipboardData;
+ }
+
+
+ public function cut():Void{
+ //setClipboardData(_canvas.model.selectedItem);
+ }
+
+ public function copy():Void{
+ trace("testing copy");
+ //setClipboardData(_canvas.model.selectedItem);
+ }
+
+ public function paste():Void{
+ trace("testing paste");
+ //_canvas.setPastedItem(getClipboardData());
+ }
+
+ public function get controlKeyPressed():String{
+ return _controlKeyPressed;
+ }
+
+ public function getWizard():Wizard{
+ return _wizard;
+ }
+
+ /**
+ * Returns the Dialogue conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get dialogue():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._dialogueContainer_mc != undefined) {
+ return _instance._dialogueContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the tooltip conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get tooltip():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._tooltipContainer_mc != undefined) {
+ return _instance._tooltipContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Cursor conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get cursor():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._cursorContainer_mc != undefined) {
+ return _instance._cursorContainer_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+
+ }
+ }
+
+ /**
+ * Returns the Application root, use as _root would be used
+ *
+ * @usage Import authoring package and then use as root e.g.
+ *
+ * import org.lamsfoundation.lams.monitoring;
+ * Application.root.attachMovie('myLinkageId','myInstanceName',depth);
+ */
+ static function get root():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._appRoot_mc != undefined) {
+ return _instance._appRoot_mc;
+ } else {
+ //TODO DI 11/05/05 Raise error if _appRoot hasn't been created
+
+ }
+ }
+
+ /**
+ * Handles KEY presses for Application
+ */
+ private function onKeyDown(){
+
+ //var mouseListener:Object = new Object();
+ //Debugger.log('Key.isDown(Key.CONTROL): ' + Key.isDown(Key.CONTROL),Debugger.GEN,'onKeyDown','Application');
+ //Debugger.log('Key: ' + Key.getCode(),Debugger.GEN,'onKeyDown','Application');
+ //the debug window:
+ if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
+ if (!_debugDialog.content){
+ showDebugger();
+ }else {
+ hideDebugger();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/Wizard.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/Wizard.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/Wizard.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,397 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+import org.lamsfoundation.lams.wizard.Application;
+import org.lamsfoundation.lams.monitoring.Organisation;
+import org.lamsfoundation.lams.monitoring.User;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.wizard.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.ws.*;
+import org.lamsfoundation.lams.common.* ;
+
+import mx.utils.*;
+import mx.managers.*;
+import mx.events.*;
+
+class Wizard {
+ //Constants
+ public static var USE_PROPERTY_INSPECTOR = true;
+ public var RT_ORG:String = "Organisation";
+ private var _className:String = "Wizard";
+
+ // Root movieclip
+ private var _root_mc:MovieClip;
+
+ // Model
+ private var wizardModel:WizardModel;
+ // View
+ private var wizardView:WizardView;
+ private var wizardView_mc:MovieClip;
+
+ private var app:Application;
+ private var _dictionary:Dictionary;
+
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ private var _onOKCallBack:Function;
+
+
+
+ /**
+ * Wizard Constructor Function
+ *
+ * @usage
+ * @return target_mc //Target clip for attaching view
+ */
+ public function Wizard(target_mc:MovieClip,x:Number,y:Number,w:Number,h:Number){
+ mx.events.EventDispatcher.initialize(this);
+
+ // Set root movieclip
+ _root_mc = target_mc;
+
+ //Create the model
+ wizardModel = new WizardModel(this);
+ _dictionary = Dictionary.getInstance();
+
+ //Create the view
+ wizardView_mc = target_mc.createChildAtDepth("wizardView",DepthManager.kTop);
+
+ trace(wizardView_mc);
+
+ wizardView = WizardView(wizardView_mc);
+ wizardView.init(wizardModel,undefined);
+ wizardView.addEventListener('load',Proxy.create(this,viewLoaded));
+
+ //Register view with model to receive update events
+ wizardModel.addObserver(wizardView);
+ wizardModel.addEventListener('learnersLoad',Proxy.create(this,onUserLoad));
+ wizardModel.addEventListener('staffLoad',Proxy.create(this,onUserLoad));
+
+ //Set the position by setting the model which will call update on the view
+ wizardModel.setPosition(x,y);
+ wizardModel.setSize(Stage.width,Stage.height);
+ //wizardModel.initOrganisationTree();
+
+ }
+
+ /**
+ * event broadcast when Wizard is loaded
+ */
+ public function broadcastInit(){
+ dispatchEvent({type:'init',target:this});
+ }
+
+
+ private function viewLoaded(evt:Object){
+ Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Wizard');
+
+ if(evt.type=='load') {
+ openDesignByWizard();
+ dispatchEvent({type:'load',target:this});
+ }else {
+ //Raise error for unrecognized event
+ }
+ }
+
+ /**
+ * Called when Users loaded for role type
+ * @param evt:Object the event object
+ */
+ private function onUserLoad(evt:Object){
+ if(evt.type=='staffLoad'){
+ wizardModel.staffLoaded = true;
+ Debugger.log('Staff loaded :',Debugger.CRITICAL,'onUserLoad','Wizard');
+ } else if(evt.type=='learnersLoad'){
+ wizardModel.learnersLoaded = true;
+ Debugger.log('Learners loaded :',Debugger.CRITICAL,'onUserLoad','Wizard');
+ } else {
+ Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onUserLoad','Wizard');
+ }
+ }
+
+ public function initWorkspace(){
+ wizardView.setUpContent();
+ }
+
+ public function getOrganisations(courseID:Number, classID:Number):Void{
+ // TODO check if already set
+
+ var callback:Function = Proxy.create(this,showOrgTree);
+
+ if(classID != undefined && courseID != undefined){
+ Application.getInstance().getComms().getRequest('workspace.do?method=getOrganisationsByUserRole&userID='+_root.userID+'&courseID='+courseID+'&classID='+classID+'&roles=MONITOR,COURSE MANAGER',callback, false);
+ }else if(courseID != undefined){
+ trace('course defined: doing request');
+ Application.getInstance().getComms().getRequest('workspace.do?method=getOrganisationsByUserRole&userID='+_root.userID+'&courseID='+courseID+'&roles=MONITOR,COURSE MANAGER',callback, false);
+ }else{
+ // TODO no course or class defined
+ }
+ }
+
+ private function showOrgTree(dto:Object):Void{
+ trace('organisations tree returned...');
+ trace('creating root node...');
+ // create root (dummy) node
+
+ var odto = getDataObject(dto);
+
+ wizardModel.initOrganisationTree();
+ var rootNode:XMLNode = wizardModel.treeDP.addTreeNode(odto.name, odto);
+ //rootNode.attributes.isBranch = true;
+ wizardModel.setOrganisationResource(RT_ORG+'_'+odto.organisationID,rootNode);
+ if(_root.classID != undefined){
+ // create tree xml branches
+ createXMLNodes(rootNode, dto.nodes);
+
+
+ wizardView.setUpOrgTree(true);
+ }else{
+ // create tree xml branches
+ createXMLNodes(rootNode, dto.nodes);
+
+ // set up the org tree
+ wizardView.setUpOrgTree(false);
+ }
+ }
+
+
+ private function createXMLNodes(root:XMLNode, nodes:Array) {
+ for(var i=0; i0){
+ childNode.attributes.isBranch = true;
+ createXMLNodes(childNode, nodes[i].nodes);
+ } else {
+ childNode.attributes.isBranch = false;
+ }
+
+ wizardModel.setOrganisationResource(RT_ORG+'_'+odto.organisationID,childNode);
+
+ }
+
+ }
+
+ private function getDataObject(dto:Object):Object{
+ var odto= {};
+ odto.organisationID = dto.organisationID;
+ odto.organisationTypeId = dto.organisationTypeId;
+ odto.description = dto.description;
+ odto.name = dto.name;
+ odto.parentID = dto.parentID;
+
+ return odto;
+ }
+
+
+ /**
+ * Opens a design using workspace and user to select design ID
+ * passes the callback function to recieve selected ID
+ */
+ public function openDesignByWizard(){
+ //Work space opens dialog and user will select view
+ var callback:Function = Proxy.create(this, openDesignById);
+ var ws = Application.getInstance().getWorkspace();
+ ws.wizardSelectDesign(callback);
+ }
+
+ /**
+ * Request design from server using supplied ID.
+ * @usage
+ * @param designId
+ * @return
+ */
+ private function openDesignById(workspaceResultDTO:Object){
+ trace('step 1 completed');
+ ObjectUtils.toString(workspaceResultDTO);
+ wizardModel.workspaceResultDTO = workspaceResultDTO;
+ //var designId:Number = workspaceResultDTO.selectedResourceID;
+ //var lessonName:String = workspaceResultDTO.resourceName;
+ //var lessonDesc:String = workspaceResultDTO.resourceDescription;
+ //var callback:Function = Proxy.create(this,setLesson);
+
+ //Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=initializeLesson&learningDesignID='+designId+'&userID='+_root.userID+'&lessonName='+lessonName+'&lessonDescription='+lessonDesc,callback, false);
+
+
+ }
+
+ public function requestUsers(role:String, orgID:Number, callback:Function){
+ Application.getInstance().getComms().getRequest('workspace.do?method=getUsersFromOrganisationByRole&organisationID='+orgID+'&role='+role,callback, false);
+
+ }
+
+ /**
+ * Initialize lesson for normal session
+ *
+ * @usage
+ * @param resultDTO
+ * @param callback
+ */
+
+ public function initializeLesson(resultDTO:Object, callback:Function){
+
+ var designId:Number = resultDTO.selectedResourceID;
+ var lessonName:String = resultDTO.resourceTitle;
+ var lessonDesc:String = resultDTO.resourceDescription;
+ var orgId:Number = resultDTO.organisationID;
+ var learnerExpPortfolio:Boolean = resultDTO.learnerExpPortfolio;
+
+ // get data object to send to servlet
+ var data = DesignDataModel.getDataForInitializing(lessonName, lessonDesc, designId, orgId, learnerExpPortfolio);
+
+ // servlet call
+ Application.getInstance().getComms().sendAndReceive(data, 'monitoring/initializeLesson', callback, false);
+
+ }
+
+ public function startLesson(isScheduled:Boolean, lessonID:Number, datetime:String){
+ trace('starting lesson...');
+ var callback:Function = Proxy.create(this, onStartLesson);
+
+ if(isScheduled){
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=startOnScheduleLesson&lessonStartDate=' + datetime + '&lessonID=' + lessonID + '&userID=' + _root.userID, callback);
+ } else {
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=startLesson&lessonID=' + lessonID + '&userID=' + _root.userID, callback);
+ }
+ }
+
+ private function onStartLesson(b:Boolean){
+ trace('receive back after lesson started..');
+ if(b){
+ trace('lesson started');
+ wizardModel.broadcastViewUpdate("LESSON_STARTED", WizardView.FINISH_MODE);
+ } else {
+ // error occured
+ trace('error occurred starting lesson');
+ }
+ }
+
+ /**
+ * Create LessonClass using wizard data and CreateLessonClass servlet
+ *
+ */
+
+ public function createLessonClass():Void{
+ trace('creating lesson class...');
+ var dto:Object = wizardModel.getLessonClassData();
+ var callback:Function = Proxy.create(this,onCreateLessonClass);
+
+ Application.getInstance().getComms().sendAndReceive(dto,"monitoring/createLessonClass?userID=" + _root.userID,callback,false);
+
+ }
+
+ public function onCreateLessonClass(r):Void{
+ if(r instanceof LFError) {
+ r.showErrorAlert();
+ } else if(r) {
+ // lesson class created
+ trace('lesson class created');
+ trace('mode: ' + wizardModel.resultDTO.mode);
+ wizardModel.broadcastViewUpdate("SAVED_LC", wizardModel.resultDTO.mode);
+ } else {
+ // failed creating lesson class
+ trace('failed creating lesson class');
+ }
+ }
+
+ /**
+ *
+ * @usage
+ * @param newonOKCallback
+ * @return
+ */
+ public function set onOKCallback (newonOKCallback:Function):Void {
+ _onOKCallBack = newonOKCallback;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get onOKCallback ():Function {
+ return _onOKCallBack;
+ }
+
+ /**
+ * Used by application to set the size
+ * @param width The desired width
+ * @param height the desired height
+ */
+ public function setSize(width:Number, height:Number):Void{
+ wizardModel.setSize(width, height);
+ }
+
+ public function setPosition(x:Number,y:Number){
+ //Set the position within limits
+ //TODO DI 24/05/05 write validation on limits
+ wizardModel.setPosition(x,y);
+ }
+
+ //Dimension accessor methods
+ public function get width():Number{
+ return wizardModel.width;
+ }
+
+ public function get height():Number{
+ return wizardModel.height;
+ }
+
+ public function get x():Number{
+ return wizardModel.x;
+ }
+
+ public function get y():Number{
+ return wizardModel.y;
+ }
+
+ function get className():String {
+ return _className;
+ }
+ public function getWM():WizardModel{
+ return wizardModel;
+ }
+ public function getWV():WizardView{
+ return wizardView;
+ }
+
+ public function set workspaceView(a:WorkspaceView){
+ wizardView.workspaceView = a;
+ }
+
+ public function get workspaceView():WorkspaceView{
+ return wizardView.workspaceView;
+ }
+
+ public function get root():MovieClip{
+ return _root_mc;
+ }
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,226 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.wizard.*;
+import org.lamsfoundation.lams.common.ws.*;
+import mx.utils.*
+
+/**
+* Controller for the sequence library
+*/
+class WizardController extends AbstractController {
+ private var _wizardModel:WizardModel;
+ private var _wizardController:WizardController;
+ private var _wizardView:WizardView;
+ private var _resultDTO:Object;
+ private var _isBusy:Boolean;
+ /**
+ * Constructor
+ *
+ * @param wm The model to modify.
+ */
+ public function WizardController (wm:Observable) {
+ super (wm);
+ _wizardModel = WizardModel(getModel());
+ _wizardController = this;
+ _wizardView = WizardView(getView());
+ _isBusy = false;
+ }
+
+ // add control methods
+
+
+ public function click(evt):Void{
+ Debugger.log('click evt.target.label:'+evt.target.label,Debugger.CRITICAL,'click','WizardController');
+ var tgt:String = new String(evt.target);
+ // button click event handler - next, prev, finish, cancel
+
+ if(tgt.indexOf("next_btn") != -1){
+ gonext();
+
+ }else if(tgt.indexOf("prev_btn") != -1){
+ goprev();
+ }else if(tgt.indexOf("finish_btn") != -1){
+ gofinish();
+ }else if(tgt.indexOf("start_btn") != -1){
+ gostart();
+ }else if(tgt.indexOf("close_btn") != -1){
+ goclose();
+ }else if(tgt.indexOf("cancel_btn") != -1){
+ gocancel();
+ }
+
+ }
+
+ private function gonext(evt:Object){
+ Debugger.log('I am in goNext:',Debugger.CRITICAL,'click','gonext');
+ _global.breakpoint();
+ var wizView:WizardView = getView();
+ if(wizView.validateStep(_wizardModel)){
+ _wizardModel.stepID++;
+ trace('new step ID: ' + _wizardModel.stepID);
+ }
+ }
+
+ private function gocancel(evt:Object){
+ // close window
+ trace('CANCEL CLICKED');
+ getURL('javascript:window.close()');
+ }
+
+ private function goclose(evt:Object){
+ trace('CLOSE WINDOW');
+ getURL('javascript:closeWizard()');
+ }
+
+ private function goprev(evt:Object){
+ trace('PREV CLICKED');
+ //var wm:WizardModel = WizardModel(getModel());
+ _wizardModel.stepID--;
+ trace('new step ID: ' +_wizardModel.stepID);
+ }
+
+ private function gofinish(evt:Object){
+ trace('FINISH CLICKED');
+ //var wm:WizardModel = WizardModel(getModel());
+ var wizView:WizardView = getView();
+ if(wizView.validateStep(_wizardModel)){
+ wizView.resultDTO.mode = WizardView.FINISH_MODE;
+ wizView.disableButtons();
+ initializeLesson(wizView.resultDTO);
+ }
+ }
+
+ private function gostart(evt:Object){
+ trace('START CLICKED');
+ //var wm:WizardModel = WizardModel(getModel());
+ var wizView:WizardView = getView();
+ if(wizView.validateStep(_wizardModel)){
+ wizView.resultDTO.mode = WizardView.START_MODE;
+ wizView.disableButtons();
+ initializeLesson(wizView.resultDTO);
+ }
+ }
+
+ /**
+ * Workspace dialog OK button clicked handler
+ */
+ private function okClicked(evt:Object) {
+
+ if(evt.type == 'okClicked'){
+ //invalidate the cache of folders
+ //getView().workspaceView.getModel().clearWorkspaceCache(evt.target.resultDTO.targetWorkspaceFolderID);
+
+ //pass the resultant DTO back to the class that called us.
+ Application.getInstance().getWorkspace().onOKCallback(evt.target.resultDTO);
+
+ }
+ }
+
+ /**
+ * Invoked when the node is opened. it must be a folder
+ */
+ public function onTreeNodeOpen (evt:Object){
+ var treeview = evt.target;
+ var nodeToOpen:XMLNode = evt.node;
+ Debugger.log('nodeToOpen organisationID:'+nodeToOpen.attributes.data.organisationID,Debugger.GEN,'onTreeNodeOpen','org.lamsfoundation.lams.MonitorController');
+ Debugger.log('nodeToOpen org name:'+nodeToOpen.attributes.data.name,Debugger.GEN,'onTreeNodeOpen','org.lamsfoundation.lams.MonitorController');
+ //if this ndoe has children then the
+ //data has already been got, nothing to do
+
+ }
+
+ /**
+ * Treeview data changed event handler
+ */
+ public function onTreeNodeClose (evt:Object){
+ Debugger.log('type::'+evt.type,Debugger.GEN,'onTreeNodeClose','org.lamsfoundation.lams.MonitorController');
+ var treeview = evt.target;
+ }
+
+ public function onTreeNodeChange (evt:Object){
+ Debugger.log('type::'+evt.type,Debugger.GEN,'onTreeNodeChange','org.lamsfoundation.lams.MonitorController');
+ var treeview = evt.target;
+ if(!_isBusy){
+ setBusy();
+ _wizardModel.setSelectedTreeNode(treeview.selectedNode);
+ } else {
+ treeview.selectedNode = _wizardModel.getSelectedTreeNode();
+ }
+ }
+
+ public function selectTreeNode(node:XMLNode){
+ if(node!=null){
+ if(!_isBusy){
+ setBusy();
+ _wizardModel.setSelectedTreeNode(node);
+ }
+ }
+ }
+
+ /**
+ * Initialize lesson returning new LessonID
+ *
+ * @param resultDTO Wizard data
+ *
+ */
+
+ public function initializeLesson(resultDTO:Object){
+ _wizardModel.resultDTO = resultDTO;
+ var callback:Function = Proxy.create(this,saveLessonClass);
+ _wizardModel.getWizard().initializeLesson(resultDTO, callback);
+ }
+
+ /**
+ * Save Lesson Class after Lesson is initialized
+ *
+ * @param lessonID
+ * @return
+ */
+
+ public function saveLessonClass(r){
+ if(r instanceof LFError) {
+ r.showMessageConfirm();
+ } else {
+ _wizardModel.lessonID = r;
+ _wizardModel.getWizard().createLessonClass();
+ }
+ }
+
+ private function getView():WizardView{
+ return WizardView(super.getView());
+ }
+
+ public function setBusy(){
+ _isBusy = true;
+ getView().disableButtons();
+ }
+
+ public function clearBusy(){
+ _isBusy = false;
+ getView().enableButtons();
+ }
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,469 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.monitoring.*;
+import org.lamsfoundation.lams.wizard.*;
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.util.Observable;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ws.*;
+import mx.managers.*
+import mx.utils.*
+import mx.events.*;
+
+/*
+* Model for the Monitoring Tabs
+*/
+class WizardModel extends Observable{
+ private var _className:String = "WizardModel";
+
+ public var RT_FOLDER:String = "Folder";
+ public var RT_ORG:String = "Organisation";
+ public var RT_LD:String = "LearningDesign";
+
+ // constants
+ private static var LEARNER_ROLE:String = "LEARNER";
+ private static var MONITOR_ROLE:String = "MONITOR";
+ private static var COURSE_MANAGER_ROLE:String = "COURSE MANAGER";
+
+ private static var USER_LOAD_CHECK_INTERVAL:Number = 50;
+ private static var USER_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+
+ private var __width:Number;
+ private var __height:Number;
+ private var __x:Number;
+ private var __y:Number;
+ private var _isDirty:Boolean;
+ private var infoObj:Object;
+
+ // wizard main
+ private var _wizard:Wizard;
+
+
+ private var _org:Organisation;
+ private var _lessonID:Number;
+
+ // state data
+ private var _staffLoaded:Boolean;
+ private var _learnersLoaded:Boolean;
+ private var _UserLoadCheckIntervalID:Number; //Interval ID for periodic check on User Load status
+ private var _userLoadCheckCount = 0; // instance counter for number of times we have checked to see if users are loaded
+
+ //this is the dataprovider for the org tree
+ private var _treeDP:XML;
+ private var _orgResources:Array;
+ private var _orgs:Array;
+ private var _selectedOrgTreeNode:XMLNode;
+ private var _selectedLocTreeNode:XMLNode;
+
+ private var _workspaceResultDTO:Object;
+ private var _resultDTO:Object;
+ private var _stepID:Number;
+
+
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ /**
+ * Constructor.
+ */
+ public function WizardModel (wizard:Wizard){
+ _wizard = wizard;
+
+ _orgResources = new Array();
+ _staffLoaded = false;
+ _learnersLoaded = false;
+
+ _workspaceResultDTO = new Object();
+ _resultDTO = new Object();
+ _stepID = 1;
+
+ mx.events.EventDispatcher.initialize(this);
+ }
+
+ // add get/set methods
+
+ public function setOrganisation(org:Organisation){
+ _org = org;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "ORGANISATION_UPDATED";
+ notifyObservers(infoObj);
+ }
+
+ public function getOrganisation():Organisation{
+ return _org;
+ }
+
+ public function saveOrgs(orgs:Array){
+ _orgs = orgs;
+ }
+
+ public function getOrgs():Array{
+ return _orgs;
+ }
+
+
+ public function broadcastViewUpdate(updateType, data){
+ //getMonitor().getMV().clearView();
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = updateType;
+ infoObj.data = data;
+ notifyObservers(infoObj);
+
+ }
+
+
+ /**
+ * Periodically checks if users have been loaded
+ */
+ private function checkUsersLoaded() {
+ // first time through set interval for method polling
+ if(!_UserLoadCheckIntervalID) {
+ _UserLoadCheckIntervalID = setInterval(Proxy.create(this, checkUsersLoaded), USER_LOAD_CHECK_INTERVAL);
+ } else {
+ _userLoadCheckCount++;
+ // if dictionary and theme data loaded setup UI
+ if(_staffLoaded && _learnersLoaded) {
+ clearInterval(_UserLoadCheckIntervalID);
+
+ trace('ALL USERS LOADED -CONTINUE');
+ // populate learner/staff scrollpanes
+ broadcastViewUpdate("USERS_LOADED", null, null);
+
+
+ } else if(_userLoadCheckCount >= USER_LOAD_CHECK_TIMEOUT_COUNT) {
+ Debugger.log('reached timeout waiting for data to load.',Debugger.CRITICAL,'checkUsersLoaded','MonitorModel');
+ clearInterval(_UserLoadCheckIntervalID);
+ }
+ }
+ }
+
+ private function resetUserFlags():Void{
+ staffLoaded = false;
+ learnersLoaded = false;
+ _userLoadCheckCount = 0;
+ _UserLoadCheckIntervalID = null;
+ }
+
+ private function requestLearners(data:Object){
+
+ trace('requesting learners...');
+ var callback:Function = Proxy.create(this,saveLearners);
+ _wizard.requestUsers(LEARNER_ROLE, data.organisationID, callback);
+ }
+
+
+ private function requestStaff(data:Object){
+
+ trace('requesting staff members...');
+ var callback:Function = Proxy.create(this,saveStaff);
+
+ _wizard.requestUsers(MONITOR_ROLE, data.organisationID, callback);
+ }
+
+ public function saveLearners(users:Array){
+ trace('retrieving back users for org by role: ' + LEARNER_ROLE);
+
+ saveUsers(users, LEARNER_ROLE);
+
+ dispatchEvent({type:'learnersLoad',target:this});
+ }
+
+ public function saveStaff(users:Array){
+ trace('retrieving back users for org by role: ' + MONITOR_ROLE);
+
+ saveUsers(users, MONITOR_ROLE);
+
+ dispatchEvent({type:'staffLoad',target:this});
+ }
+
+ private function saveUsers(users:Array, role:String):Void{
+
+ for(var i=0; i< users.length; i++){
+ var u:Object = users[i];
+
+ var user:User = User(organisation.getUser(u.userID));
+ if(user != null){
+ trace('adding role to existing user: ' + user.getFirstName() + ' ' + user.getLastName());
+ user.addRole(role);
+ } else {
+ user = new User();
+ user.populateFromDTO(u);
+ user.addRole(role);
+
+ trace('adding user: ' + user.getFirstName() + ' ' + user.getLastName() + ' ' + user.getUserId());
+ organisation.addUser(user);
+ }
+ }
+ }
+
+ public function setDirty(){
+ _isDirty = true;
+ }
+
+ public function setSize(width:Number,height:Number) {
+ __width = width;
+ __height = height;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "SIZE";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Used by View to get the size
+ * @returns Object containing width(w) & height(h). obj.w & obj.h
+ */
+ public function getSize():Object{
+ var s:Object = {};
+ s.w = __width;
+ s.h = __height;
+ return s;
+ }
+
+ /**
+ * sets the model x + y vars
+ */
+ public function setPosition(x:Number,y:Number):Void{
+ //Set state variables
+ __x = x;
+ __y = y;
+ //Set flag for notify observers
+ setChanged();
+
+ //build and send update object
+ infoObj = {};
+ infoObj.updateType = "POSITION";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Used by View to get the size
+ * @returns Object containing width(w) & height(h). obj.w & obj.h
+ */
+ public function getPosition():Object{
+ var p:Object = {};
+ p.x = __x;
+ p.y = __y;
+ return p;
+ }
+
+ /**
+ * Sets up the tree for the 1st time
+ *
+ * @usage
+ * @return
+ */
+ public function initOrganisationTree(){
+ _treeDP = new XML();
+ _orgResources = new Array();
+ }
+
+ /**
+ *
+ * @usage
+ * @param neworgResources
+ * @return
+ */
+ public function setOrganisationResource(key:String,neworgResources:XMLNode):Void {
+ Debugger.log(key+'='+neworgResources,Debugger.GEN,'setOrganisationResource','org.lamsfoundation.lams.monitoring.mv.MonitorModel');
+ _orgResources[key] = neworgResources;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getOrganisationResource(key:String):XMLNode{
+ Debugger.log(key+' is returning '+_orgResources[key],Debugger.GEN,'getOrganisationResource','org.lamsfoundation.lams.monitoring.mv.MonitorModel');
+ return _orgResources[key];
+
+ }
+
+
+ public function get treeDP():XML{
+ return _treeDP;
+ }
+
+ public function get organisation():Organisation{
+ return _org;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newselectedTreeNode
+ * @return
+ */
+ public function setSelectedTreeNode (newselectedTreeNode:XMLNode):Void {
+ _selectedOrgTreeNode = newselectedTreeNode;
+ trace('branch: ' + _selectedOrgTreeNode.attributes.isBranch);
+ //if(!_selectedOrgTreeNode.attributes.isBranch){
+ // get the organisations (node) users by role
+ //var roles:Array = new Array(LEARNER_ROLE, MONITOR_ROLE, COURSE_MANAGER_ROLE);
+ setOrganisation(new Organisation(_selectedOrgTreeNode.attributes.data));
+ resetUserFlags();
+ // polling method - waiting for all users to load before displaying users in UI
+ checkUsersLoaded();
+
+ // load users
+ requestLearners(_selectedOrgTreeNode.attributes.data);
+ requestStaff(_selectedOrgTreeNode.attributes.data);
+
+ trace(staffLoaded);
+ trace(learnersLoaded);
+ //}
+
+ }
+
+ public function getLessonClassData():Object{
+ var classData:Object = new Object();
+ var r:Object = resultDTO;
+ var staff:Object = new Object();
+ var learners:Object = new Object();
+ if(r){
+ trace('getting lesson class data...');
+ trace('org resource id: ' + r.organisationID);
+ if(lessonID){classData.lessonID = lessonID;}
+ if(r.organisationID){classData.organisationID = r.organisationID;}
+ classData.staff = staff;
+ classData.learners = learners;
+ if(r.staffGroupName){classData.staff.groupName = r.staffGroupName;}
+ if(r.selectedStaff){staff.users = r.selectedStaff;}
+ if(r.learnersGroupName){classData.learners.groupName = r.learnersGroupName;}
+ if(r.selectedLearners){classData.learners.users = r.selectedLearners;}
+ return classData;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getSelectedTreeNode ():XMLNode {
+ return _selectedOrgTreeNode;
+ }
+
+ public function get learnersLoaded():Boolean{
+ return _learnersLoaded;
+ }
+
+ public function set learnersLoaded(a:Boolean):Void{
+ _learnersLoaded = a;
+ }
+
+ public function get staffLoaded():Boolean{
+ return _staffLoaded;
+ }
+
+ public function set staffLoaded(a:Boolean):Void{
+ _staffLoaded = a;
+ }
+
+ public function get workspaceResultDTO():Object{
+ return _workspaceResultDTO;
+ }
+
+ public function set workspaceResultDTO(a:Object):Void{
+ _workspaceResultDTO = a;
+ }
+
+ public function get resultDTO():Object{
+ return _resultDTO;
+ }
+
+ public function set resultDTO(a:Object):Void{
+ _resultDTO = a;
+ }
+
+ public function get stepID():Number{
+ return _stepID;
+ }
+
+ public function set stepID(a:Number):Void{
+
+ var obj = new Object();
+ obj.lastStep = stepID;
+ obj.currentStep = a;
+
+ _stepID = obj.currentStep;
+
+ //Set flag for notify observers
+ setChanged();
+
+ //build and send update object
+ infoObj = {};
+ infoObj.data = obj;
+ infoObj.updateType = "STEP_CHANGED";
+ notifyObservers(infoObj);
+ }
+
+ public function get lessonID():Number{
+ return _lessonID;
+ }
+
+ public function set lessonID(a:Number){
+ _lessonID = a;
+ }
+
+ //Accessors for x + y coordinates
+ public function get x():Number{
+ return __x;
+ }
+
+ public function get y():Number{
+ return __y;
+ }
+
+ //Accessors for x + y coordinates
+ public function get width():Number{
+ return __width;
+ }
+
+ public function get height():Number{
+ return __height;
+ }
+
+ public function get className():String{
+ return 'WizardModel';
+ }
+
+ public function getWizard():Wizard{
+ return _wizard;
+ }
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardSummery.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardSummery.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardSummery.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,130 @@
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
+
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.wizard.*;
+
+import mx.managers.*
+import mx.events.*
+import mx.utils.*
+import mx.controls.*
+
+/**
+*
+*/
+class WizardSummery extends MovieClip {
+//class org.lamsfoundation.lams.authoring.cv.CanvasActivity extends MovieClip{
+
+ //this is set by the init object
+ private var _wizardController:WizardController;
+ private var _wizardView:WizardView;
+ private var _tm:ThemeManager;
+
+ private var app:Application;
+
+ //local components - labels
+ private var design_lbl:Label;
+ private var title_lbl:Label;
+ private var desc_lbl:Label;
+ private var course_lbl:Label;
+ private var class_lbl:Label;
+ private var staff_lbl:Label;
+ private var learners_lbl:Label;
+
+ //local components - textfields
+ private var design_txt:TextField;
+ private var title_txt:TextField;
+ private var desc_txt:TextField;
+ private var coursename_txt:TextField;
+ private var classname_txt:TextField;
+ private var staff_txt:TextField;
+ private var learners_txt:TextField;
+
+ function WizardSummery(){
+ _tm = ThemeManager.getInstance();
+ app = Application.getInstance();
+
+ init();
+ }
+
+ public function init(initObj):Void{
+
+ if(initObj){
+ _wizardView = initObj._wizardView;
+ _wizardController = initObj._wizardController;
+ }
+
+ _visible = false;
+
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
+ }
+
+
+ /**
+ * Does the work of laying out the screen assets.
+ * Depending on type of Activity different bits will be shown
+ * @usage
+ * @return
+ */
+ private function draw(){
+
+ setupLabels();
+ setupStyles();
+ _visible = true;
+ }
+
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and applies them
+ * directly to the instanced
+ * @usage
+ * @return
+ */
+ private function setupStyles() {
+ var styleObj = _tm.getStyleObject('label');
+ design_lbl.setStyle('styleName',styleObj);
+ title_lbl.setStyle('styleName',styleObj);
+ desc_lbl.setStyle('styleName',styleObj);
+ course_lbl.setStyle('styleName',styleObj);
+ class_lbl.setStyle('styleName',styleObj);
+ staff_lbl.setStyle('styleName',styleObj);
+ learners_lbl.setStyle('styleName',styleObj);
+ }
+
+ private function setupLabels() {
+ design_lbl.text = Dictionary.getValue('summery_design_lbl');
+ title_lbl.text = Dictionary.getValue('summery_title_lbl');
+ desc_lbl.text = Dictionary.getValue('summery_desc_lbl');
+ course_lbl.text = Dictionary.getValue('summery_course_lbl');
+ class_lbl.text = Dictionary.getValue('summery_class_lbl');
+ staff_lbl.text = Dictionary.getValue('summery_staff_lbl');
+ learners_lbl.text = Dictionary.getValue('summery_learners_lbl');
+ }
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as
===================================================================
diff -u
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as (revision 0)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,1456 @@
+
+import mx.controls.*
+import mx.utils.*
+import mx.managers.*
+import mx.events.*
+
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.wizard.*
+import org.lamsfoundation.lams.monitoring.User;
+import org.lamsfoundation.lams.monitoring.Orgnanisation;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.ws.*
+import org.lamsfoundation.lams.common.Config
+
+import it.sephiroth.TreeDnd
+
+
+/**
+* Wizard view
+* Relects changes in the WizardModel
+*/
+
+class WizardView extends AbstractView {
+
+ private var _className = "WizardView";
+
+ //constants
+ public var RT_ORG:String = "Organisation";
+ public var STRING_NULL:String = "string_null_value"
+ public static var USERS_X:Number = 10;
+ public static var USER_OFFSET:Number = 20;
+ public static var SUMMERY_X:Number = 11;
+ public static var SUMMERY_Y:Number = 140;
+ public static var SUMMERY_W:Number = 500;
+ public static var SUMMERY_H:Number = 20;
+ public static var SUMMERY_OFFSET:Number = 2;
+
+ // submission modes
+ public static var FINISH_MODE:Number = 0;
+ public static var START_MODE:Number = 1;
+ public static var START_SCH_MODE:Number = 2;
+
+ private static var X_BUTTON_OFFSET:Number = 10;
+ private static var Y_BUTTON_OFFSET:Number = 15;
+
+ public static var LOGO_PATH:String = "www/images/monitor.logo.swf";
+
+ private var _wizardView:WizardView;
+ private var _tm:ThemeManager;
+ private var _dictionary:Dictionary;
+ //private var _workspace:Workspace;
+
+ private var _wizardView_mc:MovieClip;
+ private var logo:MovieClip;
+
+ private var org_treeview:Tree; //Treeview for navigation through workspace folder structure
+
+ // step 1 UI elements
+ private var location_treeview:Tree;
+
+ // step 2 UI elements
+ private var title_lbl:Label;
+ private var resourceTitle_txi:TextInput;
+ private var desc_lbl:Label;
+ private var resourceDesc_txa:TextArea;
+
+ // step 3 UI elements
+ private var _staffList:Array;
+ private var _learnerList:Array;
+ private var _learner_mc:MovieClip;
+ private var _staff_mc:MovieClip;
+ private var staff_scp:MovieClip; // staff/teachers container
+ private var staff_lbl:Label;
+ private var learner_scp:MovieClip; // learners container
+ private var learner_lbl:Label;
+ private var staff_selAll_cb:CheckBox;
+ private var learner_selAll_cb:CheckBox;
+
+ // step 4 UI elements
+ private var schedule_cb:CheckBox;
+ private var learner_expp_cb:CheckBox;
+ private var start_btn:Button;
+ private var schedule_btn:Button;
+ private var schedule_time:MovieClip;
+ private var summery_lbl:Label;
+ private var date_lbl:Label;
+ private var time_lbl:Label;
+ private var summery_scp:MovieClip;
+ private var _summery_mc:MovieClip;
+ private var _summeryList:Array;
+ private var scheduleDate_dt:DateField;
+ private var summery_lbl_arr:Array;
+
+ // conclusion UI elements
+ private var confirmMsg_txt:TextField;
+
+ //Dimensions for resizing
+ private var xNextOffset:Number;
+ private var yNextOffset:Number;
+ private var xPrevOffset:Number;
+ private var yPrevOffset:Number;
+ private var xCancelOffset:Number;
+ private var yCancelOffset:Number;
+ private var xLogoOffset:Number;
+
+ private var lastStageHeight:Number;
+ private var header_pnl:MovieClip; // top panel base
+ private var footer_pnl:MovieClip;
+
+ private var panel:MovieClip; //The underlaying panel base
+
+ // common elements
+ private var wizTitle_lbl:Label;
+ private var wizDesc_txt:TextField;
+ private var finish_btn:Button;
+ private var cancel_btn:Button;
+ private var next_btn:Button;
+ private var prev_btn:Button;
+ private var close_btn:Button;
+
+ private var desc_txa:TextArea;
+ private var desc_scr:MovieClip;
+
+ private var _resultDTO:Object;
+
+ private var _wizardController:WizardController;
+
+ private var _workspaceModel:WorkspaceModel;
+ private var _workspaceView:WorkspaceView;
+ private var _workspaceController:WorkspaceController;
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+ //public var menu:ContextMenu;
+
+
+ /**
+ * Constructor
+ */
+ function WizardView(){
+ _wizardView = this;
+ _wizardView_mc = this;
+ mx.events.EventDispatcher.initialize(this);
+
+ _tm = ThemeManager.getInstance();
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('init',Proxy.create(this,setUpLabels));
+
+ _resultDTO = new Object();
+ }
+
+ /**
+ * Called to initialise Canvas . CAlled by the Canvas container
+ */
+ public function init(m:Observable,c:Controller){
+ super (m, c);
+
+ loadLogo();
+
+ xNextOffset = panel._width - next_btn._x;
+ yNextOffset = panel._height - next_btn._y;
+ xPrevOffset = panel._width - prev_btn._x;
+ yPrevOffset = panel._height - prev_btn._y;
+ xCancelOffset = panel._width - cancel_btn._x;
+ yCancelOffset = panel._height - cancel_btn._y;
+ xLogoOffset = header_pnl._width - logo._x;
+
+ lastStageHeight = Stage.height;
+
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
+ }
+
+ private function loadLogo():Void{
+ logo = this.createEmptyMovieClip("logo", this.getNextHighestDepth());
+ var ml = new MovieLoader(Config.getInstance().serverUrl+WizardView.LOGO_PATH,null,this,logo);
+ }
+
+
+ /**
+ * Recieved update events from the WizardModel. Dispatches to relevent handler depending on update.Type
+ * @usage
+ * @param event
+ */
+ public function update (o:Observable,infoObj:Object):Void{
+
+ var wm:WizardModel = WizardModel(o);
+
+ _wizardController = getController();
+
+ switch (infoObj.updateType){
+ case 'STEP_CHANGED' :
+ updateScreen(infoObj.data.lastStep, infoObj.data.currentStep);
+ break;
+ case 'USERS_LOADED' :
+ loadLearners(wm.organisation.getLearners(), true);
+ loadStaff(wm.organisation.getMonitors(), true);
+ _wizardController.clearBusy();
+ break;
+ case 'STAFF_RELOAD' :
+ loadStaff(wm.organisation.getMonitors(), true);
+ break;
+ case 'LEARNER_RELOAD' :
+ loadLearners(wm.organisation.getLearners(), true);
+ break;
+ case 'SAVED_LC' :
+ conclusionStep(infoObj.data, wm);
+ break;
+ case 'LESSON_STARTED' :
+ conclusionStep(infoObj.data, wm);
+ break;
+ case 'POSITION' :
+ setPosition(wm);
+ break;
+ case 'SIZE' :
+ setSize(wm);
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.WizardView');
+ }
+
+ }
+
+ /**
+ * Recieved update events from the WorkspaceModel. Dispatches to relevent handler depending on update.Type
+ * @usage
+ * @param event
+ */
+ public function viewUpdate(event:Object):Void{
+ trace('receiving view update event...');
+ var wm:WorkspaceModel = event.target;
+ //set a permenent ref to the model for ease (sorry mvc guru)
+
+
+ switch (event.updateType){
+ case 'REFRESH_TREE' :
+ refreshTree(wm);
+ break;
+ case 'UPDATE_CHILD_FOLDER' :
+ updateChildFolderBranches(event.data,wm);
+ openFolder(event.data, wm);
+ case 'UPDATE_CHILD_FOLDER_NOOPEN' :
+ updateChildFolderBranches(event.data,wm);
+ break;
+ case 'ITEM_SELECTED' :
+ itemSelected(event.data,wm);
+ break;
+ case 'OPEN_FOLDER' :
+ openFolder(event.data, wm);
+ break;
+ case 'CLOSE_FOLDER' :
+ closeFolder(event.data, wm);
+ break;
+ case 'REFRESH_FOLDER' :
+ refreshFolder(event.data, wm);
+ break;
+ case 'SET_UP_BRANCHES_INIT' :
+ setUpBranchesInit();
+ break;
+ default :
+ Debugger.log('unknown update type :' + event.updateType,Debugger.GEN,'viewUpdate','org.lamsfoundation.lams.ws.WorkspaceDialog');
+
+ }
+ }
+
+ /**
+ * layout visual elements on the canvas on initialisation
+ */
+ private function draw(){
+ setStyles();
+ setScheduleDateRange();
+ showStep1();
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ /**
+ * Called by the wizardController after the workspace has loaded
+ */
+ public function setUpContent():Void{
+ trace('setting up content');
+ //register to recive updates form the model
+ WorkspaceModel(workspaceView.getModel()).addEventListener('viewUpdate',this);
+ var controller = getController();
+ this.addEventListener('okClicked',Delegate.create(controller,controller.okClicked));
+ next_btn.addEventListener("click",controller);
+ prev_btn.addEventListener("click",controller);
+ finish_btn.addEventListener("click",controller);
+ cancel_btn.addEventListener("click",controller);
+ close_btn.addEventListener("click",controller);
+ start_btn.addEventListener("click",controller);
+ schedule_btn.addEventListener('click', Delegate.create(this, scheduleNow));
+ schedule_cb.addEventListener("click", Delegate.create(this, scheduleChange));
+ staff_selAll_cb.addEventListener("click", Delegate.create(this, toogleStaffSelection));
+ learner_expp_cb.addEventListener("click", Delegate.create(this, toogleExpPortfolio));
+ learner_selAll_cb.addEventListener("click", Delegate.create(this, toogleLearnerSelection));
+
+ //Set up the treeview
+ setUpTreeview();
+ //itemSelected(location_treeview.selectedNode, WorkspaceModel(workspaceView.getModel()));
+
+ }
+
+ /**
+ * Sets i8n labels for UI elements
+ *
+ */
+ public function setUpLabels():Void{
+ //buttons
+ next_btn.label = Dictionary.getValue('next_btn');
+ prev_btn.label = Dictionary.getValue('prev_btn');
+ cancel_btn.label = Dictionary.getValue('cancel_btn');
+ finish_btn.label = Dictionary.getValue('finish_btn');
+ close_btn.label = Dictionary.getValue('close_btn');
+ start_btn.label = Dictionary.getValue('start_btn');
+ schedule_btn.label = Dictionary.getValue('schedule_cb_lbl');
+
+ //labels
+ setTitle(Dictionary.getValue('wizardTitle_1_lbl'));
+ setDescription(Dictionary.getValue('wizardDesc_1_lbl'));
+ title_lbl.text = Dictionary.getValue('title_lbl');
+ desc_lbl.text = Dictionary.getValue('desc_lbl');
+ staff_lbl.text = Dictionary.getValue('staff_lbl');
+ learner_lbl.text = Dictionary.getValue('learner_lbl');
+ summery_lbl.text = Dictionary.getValue('summery_lbl');
+
+ schedule_cb.label = Dictionary.getValue('schedule_cb_lbl');
+ date_lbl.text = Dictionary.getValue('date_lbl');
+ time_lbl.text = Dictionary.getValue('time_lbl');
+
+ // checkboxes
+ staff_selAll_cb.label = Dictionary.getValue('wizard_selAll_cb_lbl');
+ learner_selAll_cb.label = Dictionary.getValue('wizard_selAll_cb_lbl');
+ learner_expp_cb.label = Dictionary.getValue('wizard_learner_expp_cb_lbl');
+ resizeButtons([cancel_btn, prev_btn, next_btn, close_btn, finish_btn, start_btn, schedule_btn]);
+ positionButtons();
+ }
+
+ /** Resize the buttons according to the label length */
+ private function resizeButtons(btns:Array) {
+ this.createTextField("dummylabel", this.getNextHighestDepth(), -1000, -1000, 0, 0);
+ Debugger.log('//////////////////// Resizing Buttons ////////////////////',Debugger.CRITICAL,'resizeButtons','org.lamsfoundation.lams.WizardView');
+
+ for(var i=0; i 0) {
+ for(var i=0; i 0) {
+ for(var i=0; i (Number(selectedHours+checkHours))){
+ return false;
+ }else if (hours == Number(selectedHours+checkHours)){
+ if (minutes > selectedMinutes){
+ return false;
+ }else {
+ return true;
+ }
+ }else {
+ return true;
+ }
+ }
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(wm:WizardModel):Void{
+ var s:Object = wm.getSize();
+
+ header_pnl.setSize(s.w, header_pnl._height);
+ panel.setSize(s.w, s.h-header_pnl._height);
+
+ // move buttons
+ next_btn.move(panel._width-xNextOffset,panel._height-yNextOffset);
+ prev_btn.move(panel._width-xPrevOffset,panel._height-yPrevOffset);
+ finish_btn.move(panel._width-xNextOffset,panel._height-yNextOffset);
+ close_btn.move(panel._width-xCancelOffset,panel._height-yCancelOffset);
+ cancel_btn.move(panel._width-xCancelOffset,panel._height-yCancelOffset);
+
+ // move logo
+ logo._x = header_pnl._width-xLogoOffset;
+
+ // calculate height change
+ var dHeight:Number = Stage.height - lastStageHeight;
+
+ trace('last stage height' + lastStageHeight);
+
+ lastStageHeight = Stage.height;
+ trace('new height change: ' + dHeight);
+
+ org_treeview.setSize(org_treeview.width, Number(org_treeview.height + dHeight));
+ location_treeview.setSize(location_treeview.width, Number(location_treeview.height + dHeight));
+
+ resourceDesc_txa.setSize(resourceDesc_txa.width, Number(resourceDesc_txa.height + dHeight));
+
+ //staff_scp.setSize(staff_scp._width, staff_scp._height + dHeight);
+ learner_scp.setSize(learner_scp._width, learner_scp._height + dHeight);
+
+
+ }
+
+ /**
+ * Sets the position of the canvas on stage, called from update
+ * @param cm Canvas model object
+ */
+ private function setPosition(wm:WizardModel):Void{
+ var p:Object = wm.getPosition();
+ trace("X pos set in Model is: "+p.x+" and Y pos set in Model is "+p.y)
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ public function get workspaceView():WorkspaceView{
+ return _workspaceView;
+ }
+
+ public function set workspaceView(a:WorkspaceView){
+ _workspaceView = a;
+ }
+
+ public function get resultDTO():Object{
+ return _resultDTO;
+ }
+
+ public function get learnerList():Array{
+ return _learnerList;
+ }
+
+ public function get staffList():Array{
+ return _staffList;
+ }
+
+ public function setTitle(title:String){
+ wizTitle_lbl.text = "" + title + "";
+ }
+
+ public function setDescription(desc:String){
+ wizDesc_txt.text = desc;
+ }
+
+ public function showConfirmMessage(mode:Number){
+ var msg:String = "";
+ var lessonName:String = "" + resultDTO.resourceTitle +"";
+ switch(mode){
+ case FINISH_MODE :
+ msg = Dictionary.getValue('confirmMsg_3_txt', [lessonName]);
+ break;
+ case START_MODE :
+ msg = Dictionary.getValue('confirmMsg_1_txt', [lessonName]);
+ break;
+ case START_SCH_MODE :
+ msg = Dictionary.getValue('confirmMsg_2_txt', [lessonName, unescape(resultDTO.scheduleDateTime)]);
+ break;
+ default:
+ trace('unknown mode');
+ }
+ confirmMsg_txt.html = true;
+ confirmMsg_txt.htmlText = msg;
+ confirmMsg_txt._width = confirmMsg_txt.textWidth + 5;
+ confirmMsg_txt._x = panel._x + (panel._width/2) - (confirmMsg_txt._width/2);
+ confirmMsg_txt._y = panel._y + (panel._height/4);
+
+ confirmMsg_txt.visible = true;
+
+ }
+
+ private function toogleStaffSelection(evt:Object) {
+ Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView");
+ var target:CheckBox = CheckBox(evt.target);
+ var wm:WizardModel = WizardModel(getModel());
+ loadStaff(wm.organisation.getMonitors(), target.selected);
+ }
+
+ private function toogleExpPortfolio(evt:Object) {
+ Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView");
+ var target:CheckBox = CheckBox(evt.target);
+ //var wm:WizardModel = WizardModel(getModel());
+ resultDTO.learnerExpPortfolio = target.selected;
+ }
+
+ private function toogleLearnerSelection(evt:Object) {
+ Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView");
+ var target:CheckBox = CheckBox(evt.target);
+ var wm:WizardModel = WizardModel(getModel());
+
+ loadLearners(wm.organisation.getLearners(), target.selected);
+ }
+
+ /**
+ * Overrides method in abstract view to ensure cortect type of controller is returned
+ * @usage
+ * @return CanvasController
+ */
+ public function getController():WizardController{
+ var c:Controller = super.getController();
+ return WizardController(c);
+ }
+
+ /*
+ * Returns the default controller for this view.
+ */
+ public function defaultController (model:Observable):Controller {
+ return new WizardController(model);
+ }
+
+
+}
\ No newline at end of file
Index: lams_flash/src/central/flash/preloader.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/central/flash/preloader_wizard.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/LFWindow.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/LFWindow.swc
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/Panel.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/Panel.swc
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/Panel.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/DragAndDropTree.zip
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/MX180932_wddx.mxp
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/MX365880_FUIComponentsSet2.mxp
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/Re Drag and Drop tree - license.txt
===================================================================
diff -u
--- lams_flash/src/common/flash/assets/3rd party components/Re Drag and Drop tree - license.txt (revision 0)
+++ lams_flash/src/common/flash/assets/3rd party components/Re Drag and Drop tree - license.txt (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,64 @@
+From: Alessandro Crugnola [info@sephiroth.it]
+Sent: 26 January 2006 07:59
+To: Dave Caygill
+Subject: Re: Drag and Drop tree - license?
+
+Yes, don't worry about the license.. you can use it wherever you want. :) alex
+
+Dave Caygill wrote:
+> Actually � if you are not bothered about the LGPL license etc.. then
+> are you just happy that I use if for my own purposes to incorporate
+> into an application?
+>
+>
+>
+> Thanks,
+>
+>
+>
+> Dave
+>
+>
+>
+> ----------------------------------------------------------------------
+> --
+>
+> *From:* Dave Caygill
+> *Sent:* 25 January 2006 16:35
+> *To:* 'info@sephiroth.it'
+> *Subject:* Drag and Drop tree - license?
+>
+>
+>
+> Hi,
+>
+>
+>
+> I�ve just seen your tree component � looks great and does exactly what
+> I need it to. I�m working on an OpenSource application and would like
+> to use your tree component, can you please advise if this is possible
+> � is it released under LGPL or similar?
+>
+>
+>
+> Thanks,
+>
+>
+>
+> Dave Caygill
+>
+
+
+
+
+--
+Alessandro Crugnola
+Flash | PHP | Python Developer
+
+http://www.blumerstudio.com
+http://www.sephiroth.it
+
++39 3939402645
++39 0236522445
+--
+
Index: lams_flash/src/common/flash/assets/3rd party components/TabBar.swc
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/actionstep_alpha_1.zip
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/tooltip_as2.zip
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/3rd party components/tree dnd source.zip
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/aqua.clr
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/bin.txt
===================================================================
diff -u
--- lams_flash/src/common/flash/assets/bin.txt (revision 0)
+++ lams_flash/src/common/flash/assets/bin.txt (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1 @@
+http://img.alibaba.com/photo/50317275/Waste_Paper_Basket.jpg
\ No newline at end of file
Index: lams_flash/src/common/flash/assets/icons/Waste_Paper_Basket.jpg
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_chat.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_chat.jpg
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_chat.png
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_chat.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_chatgroupreporting.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_chatgroupreporting.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_doublereflectivequestion.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_forum.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_group.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_group.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_groupreporting.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_groupreporting.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_htmlnb.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_imagegallery.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_imageranking.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_journal.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_journal.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_mcq.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_messageboard.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_messageboard.html
===================================================================
diff -u
--- lams_flash/src/common/flash/assets/icons/icon_messageboard.html (revision 0)
+++ lams_flash/src/common/flash/assets/icons/icon_messageboard.html (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,18 @@
+
+
+
+
+icon_messageboard
+
+
+
+
+
+
+
Index: lams_flash/src/common/flash/assets/icons/icon_messageboard.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_missing.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_noticeboard.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_noticeboard.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_questionanswer.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_questionanswer.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_ranking.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_ranking.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reflectivequestion.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reflectivequestion.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reflectiveranking.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reflectiveranking.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reportsubmission.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reportsubmission.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_reportsubmission_for marking(not used).swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_simpleassessment.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_simpleassessment.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_singleresource.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_singleresource.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_survey.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_survey.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_testactivity.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_urlcontent.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_urlcontent.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_urlcontentmessageboard.fla
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/icon_urlcontentmessageboard.swf
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/lock closed.png
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/lock open.png
===================================================================
diff -u
Binary files differ
Index: lams_flash/src/common/flash/assets/icons/locks.ai
===================================================================
diff -u
--- lams_flash/src/common/flash/assets/icons/locks.ai (revision 0)
+++ lams_flash/src/common/flash/assets/icons/locks.ai (revision d7823922f404944822957e6c051bc0f1335a76de)
@@ -0,0 +1,3531 @@
+%PDF-1.4
+%����
+1 0 obj<>
+endobj
+2 0 obj<>
+endobj
+3 0 obj<>
+endobj
+5 0 obj null
+endobj
+6 0 obj<>/Properties<>/MC1<>/ProcSet[/PDF/ImageC]/ExtGState<>>>/AIType/HiddenLayer>>/MC2<>>>>>/PieceInfo<>/LastModified(D:20051208102653+01'00')>>
+endobj
+7 0 obj<>
+endobj
+8 0 obj<>
+endobj
+75 0 obj null
+endobj
+142 0 obj null
+endobj
+143 0 obj<>stream
+%!PS-Adobe-3.0
+%%Creator: Adobe Illustrator(R) 11.0
+%%AI8_CreatorVersion: 11.0.0
+%%For: (. . .) (.)
+%%Title: (locks.ai)
+%%CreationDate: 12/8/2005 10:26 AM
+%%BoundingBox: 559 192 637 480
+%%HiResBoundingBox: 559.918 192 636.709 479.5
+%%DocumentProcessColors: Cyan Magenta Yellow Black
+%AI5_FileFormat 7.0
+%AI3_ColorUsage: Color
+%AI7_ImageSettings: 0
+%%RGBProcessColor: 0 0 0 (Global Black)
+%%+ 0.6627 0.4667 0.3647 (Global Cafe)
+%%+ 0.451 0.7451 0.1176 (Global Green)
+%%+ 0.8 0.8 1 (Global Lilac)
+%%+ 0.3569 0.2431 0.1098 (Global Mocha)
+%%+ 1 0.6 0 (Global Orange)
+%%+ 0.502 0.5529 1 (Global Periwinkle)
+%%+ 0.9843 0.6824 1 (Global Pink)
+%%+ 0.7294 0 0 (Global Rust)
+%%+ 0 0.6275 0.7765 (Global Sea)
+%%+ 0.5412 0.8588 1 (Global Sky)
+%%+ 1 1 0.2431 (Global Yellow)
+%%+ 0 0 0 ([Registration])
+%AI3_TemplateBox: 595.5 420.3896 595.5 420.3896
+%AI3_TileBox: 12.0313 12.0897 1178.5513 829.8896
+%AI3_DocumentPreview: None
+%AI5_ArtSize: 1190.5511 841.8898
+%AI5_RulerUnits: 4
+%AI9_ColorModel: 1
+%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0
+%AI5_TargetResolution: 800
+%AI5_NumLayers: 2
+%AI9_OpenToView: 506.25 473.6396 8 1574 1068 18 1 0 15 68 1 0 1 1 1 0 1
+%AI5_OpenViewLayers: 72
+%%PageOrigin:0 0
+%AI7_GridSettings: 72 8 72 8 1 0 0.8 0.8 0.8 0.9 0.9 0.9
+%AI9_Flatten: 0
+%%EndComments
+
+endstream
+endobj
+144 0 obj<>stream
+%%BoundingBox: 559 192 637 480
+%%HiResBoundingBox: 559.918 192 636.709 479.5
+%AI7_Thumbnail: 36 128 8
+%%BeginData: 5236 Hex Bytes
+%0000330000660000990000CC0033000033330033660033990033CC0033FF
+%0066000066330066660066990066CC0066FF009900009933009966009999
+%0099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF3300FF66
+%00FF9900FFCC3300003300333300663300993300CC3300FF333300333333
+%3333663333993333CC3333FF3366003366333366663366993366CC3366FF
+%3399003399333399663399993399CC3399FF33CC0033CC3333CC6633CC99
+%33CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF660000660033
+%6600666600996600CC6600FF6633006633336633666633996633CC6633FF
+%6666006666336666666666996666CC6666FF669900669933669966669999
+%6699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066FF33
+%66FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF
+%9933009933339933669933999933CC9933FF996600996633996666996699
+%9966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC33
+%99CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFF
+%CC0000CC0033CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399
+%CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933
+%CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF
+%CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0033FF0066FF0099FF00CC
+%FF3300FF3333FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699
+%FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33
+%FFCC66FFCC99FFCCCCFFCCFFFFFF33FFFF66FFFF99FFFFCC110000001100
+%000011111111220000002200000022222222440000004400000044444444
+%550000005500000055555555770000007700000077777777880000008800
+%000088888888AA000000AA000000AAAAAAAABB000000BB000000BBBBBBBB
+%DD000000DD000000DDDDDDDDEE000000EE000000EEEEEEEE0000000000FF
+%00FF0000FFFFFF0000FF00FFFFFF00FFFFFF
+%524C45FD0AFFAF848B6085608B6085608B848BAFFD14FF606184AFAFFD07
+%FFAFFF848560AFFD10FFAF60AFFD10FF6085FD0EFFAF5AFD13FF8461FD0D
+%FF60FD09FFAFAFA9FD09FF8585FD0BFF60AFFD06FF846060858485608560
+%AFFD06FF60AFFD09FF848BFD06FF608BAFFD06FFAF608BFD05FFAF84FD09
+%FF8584FD05FF8485FD0AFF60AFFD04FFA985A9FD08FF60FD05FFAF85FD0C
+%FF60FD05FF84AFFD07FFAF85FD05FFAF84FD0CFF85A8FD04FF85A8FD08FF
+%60FD05FF84AFFD0CFF84AFFD04FF84AFFD07FFA885FD05FFAF84FD0CFF85
+%A8FD04FF8584FD08FF60FD05FF85AFFD0CFF84FD05FF84AFFD07FFA985FD
+%05FFAF84FD0CFF85A9FD04FF85A8FD08FF60FD05FF85AFFD0CFF84FD05FF
+%84AFFD07FFAF84FD05FFAF84FD0CFF85A8FD04FF85A8FD08FF60FD05FFA9
+%AFFD0CFF84FD05FF84AFFD07FFAF85FD05FFAF84FD0CFF85A8FD04FF85A9
+%FD08FF60FD05FF84AFFD0CFF84FD05FF84AFFD07FFA885FD05FFAF84FD0C
+%FF85A8FD04FF8584FD08FF84FD05FFA9AFFD0CFF84FD05FF84AFFD05FFAF
+%8560608485848584605AAF8485848B8485848B8485846160858485846060
+%8BA9FFFFFF6185AF84AF85AF84AF85AFA9AFA9AFA9AFA9AFA9AFA9AFA8AF
+%85AF84AF85AF8485A9FFFF60FD1FFF8485FFFF85FD20FF85FFFF60FD1FFF
+%A885FFFF85FD1FFFAF84FFFF60FD1FFFA885FFFF85FD1FFFAF84FFFF60FD
+%0DFFA87D527DA8FD0DFFA885FFFF85FD0CFFA827F8F8F8277DFD0CFFAF84
+%FFFF60FD0CFF27FD05F827A8FD0BFF8485FFFF85FD0BFFA8FD07F8A8FD0B
+%FFAF84FFFF60FD0BFFA8FD07F87DFD0BFFA885FFFF85FD0CFF27FD06F8FD
+%0CFFAF84FFFF60FD0CFFA8FD05F8A8FD0CFFA885FFFF85FD0EFFF8F8F8A8
+%FD0DFFAF84FFFF60FD0DFFA8F8F8F87DFD0DFFA885FFFF85FD0DFFA8F8F8
+%F87DFD0DFFAF84FFFF60FD0DFF7DF8F8F852FD0DFFA885FFFF85FD0DFF7D
+%F8F8F852FD0DFFAF84FFFF60AFFD0CFF52F8F8F827FD0DFF84AFFFFFAF84
+%FD0CFF7DF8F8F827FD0DFF85AFFFFFAF60A8FD0BFF27FD04F8FD0CFFAF60
+%FD04FF848BFD0BFF27FD04F8A8FD0BFF60FD06FF60AFFD0AFF7D7D527D52
+%FD0BFF6085FD07FF3CFD19FFA961FD08FFAF36FD17FFA860AFFD0AFF60AF
+%FD14FF8561FD0DFF6085FD12FF6060AFFD0EFF846184FD0EFFAF608BFD11
+%FFAF855A8584FFAFFD05FFA9AF606184FD16FFA98B608B848B848B848584
+%AFFD1BFFA9FFA9AFA8FDFCFFFDFCFFFDB2FFAFAF848B848584AFFD1AFFAF
+%608584AFA9FFA9AF606184FD17FFAF60AFFD08FFAF8B60AFFD14FF605AFD
+%0DFF6085FD12FF8560FD0FFF848BFD10FF6160FD11FF8485FD0EFF6184FD
+%07FFAF8B848584AFFD06FF8485FD0BFFA86084FD07FF846084FFA9AF6085
+%AFFD05FF6085FD0AFF6185FD07FF8485FD06FF8561AFFD05FF60AFFD07FF
+%AF6084FD07FF6085FD08FFA960A9FD05FF60FD06FFAF61A9FD07FF6085FD
+%0AFFA961FD05FF8B85FD05FF3C84FD07FF6085FD0CFF8485FD04FFA861FD
+%05FF848BFD06FF60AFFD0EFF60FD05FF60FD06FF8461FD04FF6085FD0FFF
+%85A8FD04FF8BFD07FF8461FFFF60AFFD10FF60FD05FF85FD08FF846060AF
+%FD10FF8485FD05FF85FD09FFAFAFFD10FF8585FD06FF60FD1AFF8460FD06
+%FFAF60FD19FF8461FD07FF8B85FD18FF8460FD07FFAF5AFD18FF8585FD07
+%FFAF60FD18FF8485FD07FFAF60FD18FF8461FD07FFAF60FD18FF8485FD07
+%FFAF60FD06FF858B84AF858B84AF858B84AF858B84AF85AF606185AF84AF
+%858B848B368B84FD04FF5AAFA9AF84AFA8AF84AFA8AF84AFA8AF84AFA8AF
+%A8AFA8AF84AFA8AF84AFA9AF5AAFFFFF85FD1FFFAF60FFFF60FD1FFFA885
+%FFFF85FD1FFFAF84FFFF60FD1FFFA885FFFF85FD1FFFAF84FFFF60FD1FFF
+%8485FFFF85FD0EFF7D7D7DFD0EFFAF84FFFF60FD0CFFA827FD04F8A8FD0C
+%FFA885FFFF85FD0CFF27FD06F8FD0CFFAF84FFFF60FD0BFFA8FD07F87DFD
+%0BFFA885FFFF85FD0BFFA8FD07F8A8FD0BFFAF84FFFF60FD0CFF27FD05F8
+%27A8FD0BFFA885FFFF85FD0CFFA827F8F8F8277DFD0CFFAF84FFFF60FD0D
+%FFA8F8F8F87DFD0DFF8485FFFF85FD0EFFF8F8F8A8FD0DFFAF84FFFF60FD
+%0DFFA8F8F8F87DFD0DFFA885FFFF85FD0DFFA8F8F8F87DFD0DFFAF84FFFF
+%60FD0DFF7DF8F8F827FD0DFF8485FFFF85A9FD0CFF7DF8F8F852FD0DFF8B
+%85FFFF8485FD0CFF52F8F8F827FD0DFF60FD04FF60FD0CFF52F8F8F827A8
+%FD0BFF848BFD04FF8560FD0BFF27FD04F8A8FD0BFF60A8FD05FF61A9FD0A
+%FF7D527D527DA8FD0AFF8B84FD06FFAF60A8FD18FFAF60FD08FFAF61AFFD
+%16FFAF60FD0AFFA86084FD14FFAF36AFFD0BFFAF6184FD12FF8B60FD0FFF
+%8B6085FD0EFF846084FD12FF848584AFFD08FFAF85608BAFFD14FFAFA960
+%85606060856060608584FD0CFFFF
+%%EndData
+
+endstream
+endobj
+145 0 obj 17007
+endobj
+146 0 obj<>stream
+H��Wkoܸ�>���C�EfE�A�(
+��5��ag�(��؊#D����_�s/II�u��V�fH���8<|W���}m�`�z��f?���}��G*zyy� �Uv��]�_�q�
+�S���5}�r 'x�P��n߷(퇛ϻMӝL���٣Nȟ�O2�@��2
+�7�&��n{��=
+���� �Tk����7��]�t�B��lj^7��v����v�+�~w�A��o�;�4��۾�y��|�7�yr]w}�e�7�@�"���?�e�����ru}~���v�nj�7O��,_�R�˳~���v,��߃p��R��)��4VSâ��N��D��K�N��ƶ�N�4�b�}�a��6JR���#�&4zj�f��Ը�T�.��nl�w�\�P�3�f1�E;v_���~ngtQOZ�ˆh45Q�ď�s�����T 5Si25�j�y*����D/}��۴���+���1h��.ۻ��!�������C�x��f�M�F�&=��?@�pc!7a$"~k��0J�`(��l����헮�z����l�_u�S�C�"б���kqy���m�G��\fl��n��=�}���ӵxߌw��5�=�}������[K�#� �����W�q� S�h�F��(8��9Ӕ�@��e�����-־߷[��������;&x~�|�;W;��:�yxp��k��b�4������g�px8�~֫��W/��'$}��݁"m���OP����A�'���ﶶ�����~��5pU�0���s�?5 *���ﻻ�y���<����@���9�^ݰa��q�4����8d�����\�};�h���+���