Index: lams_flash/src/central/flash/LoadQue.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/LoadQue.as (.../LoadQue.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/central/flash/LoadQue.as (.../LoadQue.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,239 +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();
- }
-
+
+/**
+******************************************
+
+ @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/main.as
===================================================================
diff -u -r470bd43cd17fa6128a767fec948850a5815c1c55 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/main.as (.../main.as) (revision 470bd43cd17fa6128a767fec948850a5815c1c55)
+++ lams_flash/src/central/flash/main.as (.../main.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,104 +1,104 @@
-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://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 default:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
-}
-
-if(StringUtils.isEmpty(direction)){
- _root.direction = "LTR";
- Debugger.log('Direction is not defined, using default:'+_root.direction,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;
-}
-
-if(StringUtils.isEmpty(extlmsid)) {
- _root.extlmsid = null;
-}
-
-if(StringUtils.isEmpty(customCSV)) {
- _root.customCSV = null;
-}
-
-//Set stage alignment to top left and prevent 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);
+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://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 default:'+_root.mode,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(direction)){
+ _root.direction = "LTR";
+ Debugger.log('Direction is not defined, using default:'+_root.direction,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;
+}
+
+if(StringUtils.isEmpty(extlmsid)) {
+ _root.extlmsid = null;
+}
+
+if(StringUtils.isEmpty(customCSV)) {
+ _root.customCSV = null;
+}
+
+//Set stage alignment to top left and prevent 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 -rdeab1a0aef578ae38f893dd99735fd61cbb85936 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/main2.as (.../main2.as) (revision deab1a0aef578ae38f893dd99735fd61cbb85936)
+++ lams_flash/src/central/flash/main2.as (.../main2.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,98 +1,98 @@
-import org.lamsfoundation.lams.learner.Application;
-import org.lamsfoundation.lams.common.util.StringUtils;
-import com.macromedia.javascript.JavaScriptProxy;
-import org.lamsfoundation.lams.common.util.Debugger;
-
-// Temp values to be removed / repplaced at deployment
-_global.myRoot = this;
-
-if(StringUtils.isEmpty(lcId)){
- Debugger.log('lcId is not defined, actionscript will not be able to communicate with javascript',Debugger.CRITICAL,'main','ROOT');
-}
-
-if(StringUtils.isEmpty(presenceServerUrl)){
- _root.presenceServerUrl = "192.168.1.1";
- Debugger.log('presenceServerUrl is not defined, using defualt:'+_root.presenceServerUrl ,Debugger.CRITICAL,'main','ROOT');
-}
-
-if(StringUtils.isEmpty(serverURL)){
- _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(firstName)){
- _root.firstName = "firstName";
- Debugger.log('firstName is not defined, using defualt:'+_root.firstName ,Debugger.CRITICAL,'main','ROOT');
-}
-
-if(StringUtils.isEmpty(lastName)){
- _root.lastName = "lastName";
- Debugger.log('lastName is not defined, using defualt:'+_root.lastName ,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";
-}
-
-Debugger.log("PRESENCE: connection info from controlFrame - " + userID + " " + firstName + " " + lastName + " " + presenceServerUrl, Debugger.MED,'main','ROOT');
-
-//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(), Debugger.CRITICAL, 'learnerProgress_lc.setProgressData', 'ROOT');
- app.refreshProgress(attempted, completed, current, lessonID, version);
- myRoot.refresh = refresh;
-};
-
-var success = receive_lc.connect("learnerProgress_lc_" + uniqueID);
-
-//Declaration of proxy object for javascript integration kit
-var proxy:JavaScriptProxy = new JavaScriptProxy(_root.lcId, this);
-_root.proxy = proxy;
-
-function sendMessageToFlash(msg:String){
- Debugger.log("PRESENCE: from javascript - " + msg, Debugger.MED, 'sendMessageToFlash', 'ROOT');
-}
-
-function attemptRegistration(){
- Debugger.log("PRESENCE: registration caught in main", Debugger.MED, 'sendMessageToFlash', 'ROOT');
- app.getPresence().attemptRegistration();
-}
-
-function sendUsersToFlash(users:Array){
- Debugger.log('PRESENCE: ' + users, Debugger.MED, 'sendUsersToFlash', 'ROOT');
- app.getPresence().setupDataGrid(users);
-}
-
-//Make app listener for stage resize events
-Stage.addListener(app);
+import org.lamsfoundation.lams.learner.Application;
+import org.lamsfoundation.lams.common.util.StringUtils;
+import com.macromedia.javascript.JavaScriptProxy;
+import org.lamsfoundation.lams.common.util.Debugger;
+
+// Temp values to be removed / repplaced at deployment
+_global.myRoot = this;
+
+if(StringUtils.isEmpty(lcId)){
+ Debugger.log('lcId is not defined, actionscript will not be able to communicate with javascript',Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(presenceServerUrl)){
+ _root.presenceServerUrl = "192.168.1.1";
+ Debugger.log('presenceServerUrl is not defined, using defualt:'+_root.presenceServerUrl ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(serverURL)){
+ _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(firstName)){
+ _root.firstName = "firstName";
+ Debugger.log('firstName is not defined, using defualt:'+_root.firstName ,Debugger.CRITICAL,'main','ROOT');
+}
+
+if(StringUtils.isEmpty(lastName)){
+ _root.lastName = "lastName";
+ Debugger.log('lastName is not defined, using defualt:'+_root.lastName ,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";
+}
+
+Debugger.log("PRESENCE: connection info from controlFrame - " + userID + " " + firstName + " " + lastName + " " + presenceServerUrl, Debugger.MED,'main','ROOT');
+
+//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(), Debugger.CRITICAL, 'learnerProgress_lc.setProgressData', 'ROOT');
+ app.refreshProgress(attempted, completed, current, lessonID, version);
+ myRoot.refresh = refresh;
+};
+
+var success = receive_lc.connect("learnerProgress_lc_" + uniqueID);
+
+//Declaration of proxy object for javascript integration kit
+var proxy:JavaScriptProxy = new JavaScriptProxy(_root.lcId, this);
+_root.proxy = proxy;
+
+function sendMessageToFlash(msg:String){
+ Debugger.log("PRESENCE: from javascript - " + msg, Debugger.MED, 'sendMessageToFlash', 'ROOT');
+}
+
+function attemptRegistration(){
+ Debugger.log("PRESENCE: registration caught in main", Debugger.MED, 'sendMessageToFlash', 'ROOT');
+ app.getPresence().attemptRegistration();
+}
+
+function sendUsersToFlash(users:Array){
+ Debugger.log('PRESENCE: ' + users, Debugger.MED, 'sendUsersToFlash', 'ROOT');
+ app.getPresence().setupDataGrid(users);
+}
+
+//Make app listener for stage resize events
+Stage.addListener(app);
Index: lams_flash/src/central/flash/main_addseq.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/main_addseq.as (.../main_addseq.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/central/flash/main_addseq.as (.../main_addseq.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,57 +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);
-
-
-
-
+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 -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/main_monitoring.as (.../main_monitoring.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/central/flash/main_monitoring.as (.../main_monitoring.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,65 +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);
-
-
-
-
+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 -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Activity.as (.../Activity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Activity.as (.../Activity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,805 +1,805 @@
-/***************************************************************************
- * 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.br.CanvasBranchView;
-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
- * 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;
- public static var CHOSEN_BRANCHING_ACTIVITY_TYPE:Number = 10;
- public static var GROUP_BRANCHING_ACTIVITY_TYPE:Number = 11;
- public static var TOOL_BRANCHING_ACTIVITY_TYPE:Number = 12;
- public static var OPTIONS_WITH_SEQUENCES_TYPE:Number = 13;
-
- /******************************************************************
-
- /**
- * 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 2.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;
- public static var CHOSEN_BRANCHING_ACTIVITY_TYPE:Number = 10;
- public static var GROUP_BRANCHING_ACTIVITY_TYPE:Number = 11;
- public static var TOOL_BRANCHING_ACTIVITY_TYPE:Number = 12;
- public static var OPTIONS_WITH_SEQUENCES_TYPE:Number = 13;
-
- /******************************************************************/
-
- /**
- * 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; //*
-
- 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;
- private var _defineLater:Boolean;
- private var _createDateTime:Date;
-
- private var _groupingSupportType:Number; //*
-
- private var _stopAfterActivity:Boolean;
- private var _readOnly:Boolean;
-
- private var _viewID:Boolean;
-
- private var _branchView:CanvasBranchView;
-
- /**
- * Constructor
- *
- * Creates an activity with the minimum of fields.
- *
- * @param activityUIID
- */
- function Activity(activityUIID:Number){
- Debugger.log('activityUIID:'+activityUIID,Debugger.GEN,'constructor','Activity');
- _activityUIID = activityUIID;
-
- //defaults
- _objectType = "Activity";
- _applyGrouping = false;
- _stopAfterActivity = false;
- _runOffline = false;
- _defineLater = false;
- _readOnly = false;
- _createDateTime = new Date();
- _branchView = null;
-
- }
-
- //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('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;
- }
-
- /**
- * Created an array of activity types to be can be used as a dataprovider
- * @usage
- * @return
- */
- public static function getBranchingActivityTypes():Array{
- var types:Array = [];
- types.addItem({label: Dictionary.getValue('chosen_branch_act_lbl'), data: CHOSEN_BRANCHING_ACTIVITY_TYPE});
- types.addItem({label: Dictionary.getValue('group_branch_act_lbl'), data: GROUP_BRANCHING_ACTIVITY_TYPE});
- types.addItem({label: Dictionary.getValue('tool_branch_act_lbl'), data: TOOL_BRANCHING_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{
- return (_activityTypeID == GROUPING_ACTIVITY_TYPE);
- }
-
- public function isOptionalActivity():Boolean{
- return (_activityTypeID == OPTIONAL_ACTIVITY_TYPE);
- }
-
- public function isOptionsWithSequencesActivity():Boolean {
- return (_activityTypeID == OPTIONS_WITH_SEQUENCES_TYPE);
- }
-
- public function isOptionalSequenceActivity(parent:Activity):Boolean {
- return (this.isSequenceActivity() && parent.isOptionsWithSequencesActivity());
- }
-
- public function isParallelActivity():Boolean{
- return (_activityTypeID == PARALLEL_ACTIVITY_TYPE);
- }
-
- public function isBranchingActivity():Boolean{
- return (_activityTypeID == CHOSEN_BRANCHING_ACTIVITY_TYPE ||
- _activityTypeID == GROUP_BRANCHING_ACTIVITY_TYPE ||
- _activityTypeID == TOOL_BRANCHING_ACTIVITY_TYPE);
- }
-
- public function isSequenceActivity():Boolean{
- return _activityTypeID == SEQUENCE_ACTIVITY_TYPE;
- }
-
- /**
- * 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...
- *
-
- //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;
- _readOnly = dto.readOnly;
- _stopAfterActivity = dto.stopAfterActivity;
-
- *
- *
- * @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) ? dto.applyGrouping : false;
- _runOffline = (dto.runOffline) ? dto.runOffline : false;
- _defineLater = (dto.defineLater) ? dto.defineLater : false;
- _createDateTime = dto.createDateTime;
- _groupingSupportType = dto.groupingSupportType;
- _readOnly = (dto.readOnly) ? dto.readOnly : false;
- _stopAfterActivity = (dto.stopAfterActivity) ? dto.stopAfterActivity : false;
-
- }
-
- public function toData(){
- var dto:Object = new Object();
-
- //DC - Changed mode of toData to be omiting 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(_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;
-
- //bools need to be included - so do as follows:
- dto.applyGrouping = (_applyGrouping==null) ? false : _applyGrouping;
- dto.runOffline = (_runOffline==null) ? false : _runOffline;
-
- if(isBranchingActivity())
- if(_activityTypeID == GROUP_BRANCHING_ACTIVITY_TYPE)
- dto.defineLater = (_defineLater==null) ? false : _defineLater;
- else
- dto.defineLater = false;
- else
- dto.defineLater = (_defineLater==null) ? false : _defineLater;
-
- if(_createDateTime){ dto.createDateTime = _createDateTime; }
- if(_groupingSupportType){ dto.groupingSupportType = _groupingSupportType; }
- if(_readOnly){ dto.readOnly = _readOnly; }
- if(_stopAfterActivity != null){ dto.stopAfterActivity = _stopAfterActivity }
-
- return dto;
- }
-
- public function clone(a:Activity):Activity{
- var dto:Object = toData();
-
- var n = (a != null) ? a : 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;
+/***************************************************************************
+ * 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.br.CanvasBranchView;
+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
+ * 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;
+ public static var CHOSEN_BRANCHING_ACTIVITY_TYPE:Number = 10;
+ public static var GROUP_BRANCHING_ACTIVITY_TYPE:Number = 11;
+ public static var TOOL_BRANCHING_ACTIVITY_TYPE:Number = 12;
+ public static var OPTIONS_WITH_SEQUENCES_TYPE:Number = 13;
+
+ /******************************************************************
+
+ /**
+ * 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 2.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;
+ public static var CHOSEN_BRANCHING_ACTIVITY_TYPE:Number = 10;
+ public static var GROUP_BRANCHING_ACTIVITY_TYPE:Number = 11;
+ public static var TOOL_BRANCHING_ACTIVITY_TYPE:Number = 12;
+ public static var OPTIONS_WITH_SEQUENCES_TYPE:Number = 13;
+
+ /******************************************************************/
+
+ /**
+ * 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; //*
+
+ 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;
+ private var _defineLater:Boolean;
+ private var _createDateTime:Date;
+
+ private var _groupingSupportType:Number; //*
+
+ private var _stopAfterActivity:Boolean;
+ private var _readOnly:Boolean;
+
+ private var _viewID:Boolean;
+
+ private var _branchView:CanvasBranchView;
+
+ /**
+ * Constructor
+ *
+ * Creates an activity with the minimum of fields.
+ *
+ * @param activityUIID
+ */
+ function Activity(activityUIID:Number){
+ Debugger.log('activityUIID:'+activityUIID,Debugger.GEN,'constructor','Activity');
+ _activityUIID = activityUIID;
+
+ //defaults
+ _objectType = "Activity";
+ _applyGrouping = false;
+ _stopAfterActivity = false;
+ _runOffline = false;
+ _defineLater = false;
+ _readOnly = false;
+ _createDateTime = new Date();
+ _branchView = null;
+
+ }
+
+ //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('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;
+ }
+
+ /**
+ * Created an array of activity types to be can be used as a dataprovider
+ * @usage
+ * @return
+ */
+ public static function getBranchingActivityTypes():Array{
+ var types:Array = [];
+ types.addItem({label: Dictionary.getValue('chosen_branch_act_lbl'), data: CHOSEN_BRANCHING_ACTIVITY_TYPE});
+ types.addItem({label: Dictionary.getValue('group_branch_act_lbl'), data: GROUP_BRANCHING_ACTIVITY_TYPE});
+ types.addItem({label: Dictionary.getValue('tool_branch_act_lbl'), data: TOOL_BRANCHING_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{
+ return (_activityTypeID == GROUPING_ACTIVITY_TYPE);
+ }
+
+ public function isOptionalActivity():Boolean{
+ return (_activityTypeID == OPTIONAL_ACTIVITY_TYPE);
+ }
+
+ public function isOptionsWithSequencesActivity():Boolean {
+ return (_activityTypeID == OPTIONS_WITH_SEQUENCES_TYPE);
+ }
+
+ public function isOptionalSequenceActivity(parent:Activity):Boolean {
+ return (this.isSequenceActivity() && parent.isOptionsWithSequencesActivity());
+ }
+
+ public function isParallelActivity():Boolean{
+ return (_activityTypeID == PARALLEL_ACTIVITY_TYPE);
+ }
+
+ public function isBranchingActivity():Boolean{
+ return (_activityTypeID == CHOSEN_BRANCHING_ACTIVITY_TYPE ||
+ _activityTypeID == GROUP_BRANCHING_ACTIVITY_TYPE ||
+ _activityTypeID == TOOL_BRANCHING_ACTIVITY_TYPE);
+ }
+
+ public function isSequenceActivity():Boolean{
+ return _activityTypeID == SEQUENCE_ACTIVITY_TYPE;
+ }
+
+ /**
+ * 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...
+ *
+
+ //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;
+ _readOnly = dto.readOnly;
+ _stopAfterActivity = dto.stopAfterActivity;
+
+ *
+ *
+ * @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) ? dto.applyGrouping : false;
+ _runOffline = (dto.runOffline) ? dto.runOffline : false;
+ _defineLater = (dto.defineLater) ? dto.defineLater : false;
+ _createDateTime = dto.createDateTime;
+ _groupingSupportType = dto.groupingSupportType;
+ _readOnly = (dto.readOnly) ? dto.readOnly : false;
+ _stopAfterActivity = (dto.stopAfterActivity) ? dto.stopAfterActivity : false;
+
+ }
+
+ public function toData(){
+ var dto:Object = new Object();
+
+ //DC - Changed mode of toData to be omiting 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(_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;
+
+ //bools need to be included - so do as follows:
+ dto.applyGrouping = (_applyGrouping==null) ? false : _applyGrouping;
+ dto.runOffline = (_runOffline==null) ? false : _runOffline;
+
+ if(isBranchingActivity())
+ if(_activityTypeID == GROUP_BRANCHING_ACTIVITY_TYPE)
+ dto.defineLater = (_defineLater==null) ? false : _defineLater;
+ else
+ dto.defineLater = false;
+ else
+ dto.defineLater = (_defineLater==null) ? false : _defineLater;
+
+ if(_createDateTime){ dto.createDateTime = _createDateTime; }
+ if(_groupingSupportType){ dto.groupingSupportType = _groupingSupportType; }
+ if(_readOnly){ dto.readOnly = _readOnly; }
+ if(_stopAfterActivity != null){ dto.stopAfterActivity = _stopAfterActivity }
+
+ return dto;
+ }
+
+ public function clone(a:Activity):Activity{
+ var dto:Object = toData();
+
+ var n = (a != null) ? a : 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 {
- return _groupingUIID;
- }
-
- /**
- *
- * @usage
- * @param selected CA
- * @return
- */
- public function set selectActivity (stat:String):Void {
- _isActivitySelected = stat;
- }
- /**
- *
- * @usage
- * @return
- */
- public function get selectActivity ():String {
- 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;
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function get stopAfterActivity():Boolean {
- return _stopAfterActivity;
- }
-
- public function set stopAfterActivity(a:Boolean):Void {
- _stopAfterActivity = a;
- }
-
- public function getDictionaryLabel():String {
- if(isParallelActivity())
- return "pi_parallel_title";
- else if(isOptionalActivity())
- return "opt_activity_title";
- else if(isBranchingActivity() || isSequenceActivity())
- return "pi_activity_type_branching";
- else if(isGroupActivity())
- return "pi_activity_type_grouping";
- else
- return null;
- }
-
- public function get branchView():MovieClip {
- return (_branchView instanceof CanvasBranchView) ? _branchView : null;
- }
-
- public function set branchView(a:MovieClip):Void {
- _branchView = (a != null) ? CanvasBranchView(a) : null;
- }
-
+ 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 {
+ return _groupingUIID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param selected CA
+ * @return
+ */
+ public function set selectActivity (stat:String):Void {
+ _isActivitySelected = stat;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get selectActivity ():String {
+ 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;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get stopAfterActivity():Boolean {
+ return _stopAfterActivity;
+ }
+
+ public function set stopAfterActivity(a:Boolean):Void {
+ _stopAfterActivity = a;
+ }
+
+ public function getDictionaryLabel():String {
+ if(isParallelActivity())
+ return "pi_parallel_title";
+ else if(isOptionalActivity())
+ return "opt_activity_title";
+ else if(isBranchingActivity() || isSequenceActivity())
+ return "pi_activity_type_branching";
+ else if(isGroupActivity())
+ return "pi_activity_type_grouping";
+ else
+ return null;
+ }
+
+ public function get branchView():MovieClip {
+ return (_branchView instanceof CanvasBranchView) ? _branchView : null;
+ }
+
+ public function set branchView(a:MovieClip):Void {
+ _branchView = (a != null) ? CanvasBranchView(a) : null;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Application.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Application.as (.../Application.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Application.as (.../Application.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,805 +1,805 @@
-/***************************************************************************
- * 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 stuff
-import org.lamsfoundation.lams.authoring.br.CanvasBranchView
-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";
-
- 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 = 55; //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;
- public static var TOOLBAR_DEPTH:Number = 50;
- 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 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:PropertyInspector;
-
- private var _workspace:Workspace;
- private var _ccm:CustomContextMenu;
- private var _debugDialog:MovieClip; //Reference to the debug dialog
-
- 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;
-
- // 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 PropertyInspector();
- _ccm = CustomContextMenu.getInstance();
- _root_layout = (_root.layout != undefined || _root.layout != null) ? _root.layout : null;
- }
-
- /**
- * 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;
-
- _root.preloader.setStartValue(50);
- _root.preloader.setEndValue(100);
-
- _root.preloader.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
- 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()
- _root.preloader.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){
- //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 'PropertyInspector' :
- _piLoaded = true;
- break;
- default:
- }
-
- _layout.manager.addLayoutItem(new LFLayoutItem(evt.target.className, evt.target));
-
- _root.preloader.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 = _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;
- _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
- _root.preloader.stop();
- _root._visible = true;
-
- 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() {
- dialog = 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(){
-
- //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")
- PropertyInspector(_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;
-
- }
-
- /**
- * 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{
- 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'));
- }
- }
-
- public function copy():Void{
- var ca = _canvas.model.selectedItem;
- if (ca != null){
- if (ca.activity.parentUIID == null || ca.activity.parentUIID == undefined){
- setClipboardData(ca, COPY_TYPE);
- } else if(_canvas.model.activeView instanceof CanvasBranchView && canvas.ddm.getActivityByUIID(ca.activity.parentUIID).parentUIID == canvas.model.activeView.activity.activityUIID) {
- setClipboardData(ca, COPY_TYPE);
- } else {
- LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_copy_invalid'));
- }
- }else{
- LFMessage.showMessageAlert(Dictionary.getValue('al_activity_copy_invalid'));
- }
- }
-
- public function openEditActivityContent():Void{
- 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{
- _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 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() {
- dialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:"About - LAMS Author",closeButton:true,scrollContentPath:'helpaboutDialog'});
- }
-
- /**
- * 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 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 {
-
- }
- }
+/***************************************************************************
+ * 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 stuff
+import org.lamsfoundation.lams.authoring.br.CanvasBranchView
+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";
+
+ 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 = 55; //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;
+ public static var TOOLBAR_DEPTH:Number = 50;
+ 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 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:PropertyInspector;
+
+ private var _workspace:Workspace;
+ private var _ccm:CustomContextMenu;
+ private var _debugDialog:MovieClip; //Reference to the debug dialog
+
+ 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;
+
+ // 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 PropertyInspector();
+ _ccm = CustomContextMenu.getInstance();
+ _root_layout = (_root.layout != undefined || _root.layout != null) ? _root.layout : null;
+ }
+
+ /**
+ * 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;
+
+ _root.preloader.setStartValue(50);
+ _root.preloader.setEndValue(100);
+
+ _root.preloader.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
+ 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()
+ _root.preloader.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){
+ //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 'PropertyInspector' :
+ _piLoaded = true;
+ break;
+ default:
+ }
+
+ _layout.manager.addLayoutItem(new LFLayoutItem(evt.target.className, evt.target));
+
+ _root.preloader.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 = _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;
+ _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
+ _root.preloader.stop();
+ _root._visible = true;
+
+ 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() {
+ dialog = 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(){
+
+ //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")
+ PropertyInspector(_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;
+
+ }
+
+ /**
+ * 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{
+ 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'));
+ }
+ }
+
+ public function copy():Void{
+ var ca = _canvas.model.selectedItem;
+ if (ca != null){
+ if (ca.activity.parentUIID == null || ca.activity.parentUIID == undefined){
+ setClipboardData(ca, COPY_TYPE);
+ } else if(_canvas.model.activeView instanceof CanvasBranchView && canvas.ddm.getActivityByUIID(ca.activity.parentUIID).parentUIID == canvas.model.activeView.activity.activityUIID) {
+ setClipboardData(ca, COPY_TYPE);
+ } else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_copy_invalid'));
+ }
+ }else{
+ LFMessage.showMessageAlert(Dictionary.getValue('al_activity_copy_invalid'));
+ }
+ }
+
+ public function openEditActivityContent():Void{
+ 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{
+ _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 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() {
+ dialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:"About - LAMS Author",closeButton:true,scrollContentPath:'helpaboutDialog'});
+ }
+
+ /**
+ * 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 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/Branch.as
===================================================================
diff -u -r745cc845b7776b062471723072abb234db21f292 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Branch.as (.../Branch.as) (revision 745cc845b7776b062471723072abb234db21f292)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/Branch.as (.../Branch.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,105 +1,105 @@
-/***************************************************************************
- * 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.br.BranchConnector;
-import org.lamsfoundation.lams.common.*;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.dict.*;
-
-
-class Branch extends Transition {
-
- private var UIID:Number;
- private var _sequenceActivity:SequenceActivity;
- private var _direction:Number;
- private var _targetUIID:Number;
- private var _hubUIID:Number;
-
-
- // TODO: add learningDesignID
-
- public function Branch(activityUIID:Number, _dir:Number, targetUIID:Number, hubUIID:Number, sequenceActivity:SequenceActivity, learningDesignID:Number){
- if(_dir == BranchConnector.DIR_FROM_START)
- super(null, hubUIID, targetUIID, learningDesignID);
- else if(_dir == BranchConnector.DIR_SINGLE)
- super(null, targetUIID, targetUIID, learningDesignID);
- else
- super(null, targetUIID, hubUIID, learningDesignID);
-
- UIID = activityUIID;
- _direction = _dir;
- _targetUIID = targetUIID;
- _hubUIID = hubUIID;
- _sequenceActivity = sequenceActivity;
- }
-
- public function toData():Object{
- var dto:Object = super.toData();
- dto.branchUIID = branchUIID;
- dto.sequenceActivity = sequenceActivity;
- return dto;
- }
-
- public function get branchUIID():Number {
- return UIID;
- }
-
- public function get sequenceActivity():SequenceActivity {
- return _sequenceActivity;
- }
-
- public function setDefaultSequenceName():Void {
- var title = Dictionary.getValue('branch_mapping_dlg_branch_col_lbl');
- _sequenceActivity.title = Dictionary.getValue('sequence_act_title_new', [title, _sequenceActivity.orderID]);
- }
-
- public function get sequenceName():String {
- return _sequenceActivity.title;
- }
-
- public function get direction():Number {
- return _direction;
- }
-
- public function get targetUIID():Number {
- return _targetUIID;
- }
-
- public function get hubUIID():Number {
- return _hubUIID;
- }
-
- public function get isStart():Boolean {
- return (_direction == BranchConnector.DIR_FROM_START);
- }
-
- public function get isEnd():Boolean {
- return (_direction == BranchConnector.DIR_TO_END);
- }
-
- public function get isActivityless():Boolean {
- return (_direction == BranchConnector.DIR_SINGLE);
- }
-}
-
+/***************************************************************************
+ * 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.br.BranchConnector;
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*;
+
+
+class Branch extends Transition {
+
+ private var UIID:Number;
+ private var _sequenceActivity:SequenceActivity;
+ private var _direction:Number;
+ private var _targetUIID:Number;
+ private var _hubUIID:Number;
+
+
+ // TODO: add learningDesignID
+
+ public function Branch(activityUIID:Number, _dir:Number, targetUIID:Number, hubUIID:Number, sequenceActivity:SequenceActivity, learningDesignID:Number){
+ if(_dir == BranchConnector.DIR_FROM_START)
+ super(null, hubUIID, targetUIID, learningDesignID);
+ else if(_dir == BranchConnector.DIR_SINGLE)
+ super(null, targetUIID, targetUIID, learningDesignID);
+ else
+ super(null, targetUIID, hubUIID, learningDesignID);
+
+ UIID = activityUIID;
+ _direction = _dir;
+ _targetUIID = targetUIID;
+ _hubUIID = hubUIID;
+ _sequenceActivity = sequenceActivity;
+ }
+
+ public function toData():Object{
+ var dto:Object = super.toData();
+ dto.branchUIID = branchUIID;
+ dto.sequenceActivity = sequenceActivity;
+ return dto;
+ }
+
+ public function get branchUIID():Number {
+ return UIID;
+ }
+
+ public function get sequenceActivity():SequenceActivity {
+ return _sequenceActivity;
+ }
+
+ public function setDefaultSequenceName():Void {
+ var title = Dictionary.getValue('branch_mapping_dlg_branch_col_lbl');
+ _sequenceActivity.title = Dictionary.getValue('sequence_act_title_new', [title, _sequenceActivity.orderID]);
+ }
+
+ public function get sequenceName():String {
+ return _sequenceActivity.title;
+ }
+
+ public function get direction():Number {
+ return _direction;
+ }
+
+ public function get targetUIID():Number {
+ return _targetUIID;
+ }
+
+ public function get hubUIID():Number {
+ return _hubUIID;
+ }
+
+ public function get isStart():Boolean {
+ return (_direction == BranchConnector.DIR_FROM_START);
+ }
+
+ public function get isEnd():Boolean {
+ return (_direction == BranchConnector.DIR_TO_END);
+ }
+
+ public function get isActivityless():Boolean {
+ return (_direction == BranchConnector.DIR_SINGLE);
+ }
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/BranchingActivity.as
===================================================================
diff -u -r34cb1725fa1d312652042fd3108aceaa65adf7ad -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/BranchingActivity.as (.../BranchingActivity.as) (revision 34cb1725fa1d312652042fd3108aceaa65adf7ad)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/BranchingActivity.as (.../BranchingActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,174 +1,174 @@
-/***************************************************************************
- * 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.Debugger;
-/*
-*
-* @author Mitchell Seaton
-* @version 2.1
-* @comments Branching Activity Data storage class.
-* @see Activity
-*/
-class BranchingActivity extends ComplexActivity {
-
- private static var DEFAULT_STARTX:Number = 0;
- private static var DEFAULT_STARTY:Number = 0;
- private static var DEFAULT_ENDX:Number = 0;
- private static var DEFAULT_ENDY:Number = 0;
-
- private var _startXCoord:Number;
- private var _startYCoord:Number;
- private var _endXCoord:Number;
- private var _endYCoord:Number;
-
- private var _toolActivityUIID:Number;
- private var _defaultBranch:Branch;
-
- private var _clear:Boolean;
-
- function BranchingActivity(activityUIID:Number, activityTypeID:Number){
- super(activityUIID);
- _activityTypeID = activityTypeID;
-
- _toolActivityUIID == null;
- _defaultBranch = null;
-
- _clear = false;
-
- }
-
- /**
- * Creates from a dto... which is nice
- * @usage
- * @param dto
- * @return
- */
- public function populateFromDTO(dto:Object){
- super.populateFromDTO(dto);
-
- _startXCoord = dto.startXCoord;
- _startYCoord = dto.startYCoord;
- _endXCoord = dto.endXCoord;
- _endYCoord = dto.endYCoord;
- _toolActivityUIID = dto.toolActivityUIID;
- }
-
- /**
- * Creates an object containing all the props
- * 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(_startXCoord) dto.startXCoord = _startXCoord;
- if(_startYCoord) dto.startYCoord = _startYCoord;
- if(_endXCoord) dto.endXCoord = _endXCoord;
- if(_endYCoord) dto.endYCoord = _endYCoord;
- if(_toolActivityUIID) dto.toolActivityUIID = _toolActivityUIID;
-
- return dto;
- }
-
- /**
- * Creates an exact copy of this ComplexActivity
- * @usage
- * @return the copy
- */
- public function clone():BranchingActivity{
- var dto:Object = toData();
- var ba = new BranchingActivity();
- ba.populateFromDTO(dto);
- return ba;
- }
-
-
- public function set type(a:Number):Void{
- _activityTypeID = a;
- }
-
- public function get type():Number {
- return _activityTypeID;
- }
-
- public function set startXCoord(a:Number):Void{
- Debugger.log("setting x coord: " + a, Debugger.CRITICAL, "startXCoord", "BranchingActivity");
- _startXCoord = Math.round(a);
- }
-
- public function get startXCoord():Number{
- return _startXCoord;
- }
-
- public function set startYCoord(a:Number):Void{
- _startYCoord = Math.round(a);
- }
-
- public function get startYCoord():Number{
- return _startYCoord;
- }
-
- public function set endXCoord(a:Number):Void{
- _endXCoord = Math.round(a);
- }
-
- public function get endXCoord():Number{
- return _endXCoord;
- }
-
- public function set endYCoord(a:Number):Void{
- _endYCoord = Math.round(a);
- }
-
- public function get endYCoord():Number{
- return _endYCoord;
- }
-
- public function set toolActivityUIID(a:Number) {
- _toolActivityUIID = a;
- }
-
- public function get toolActivityUIID():Number {
- return _toolActivityUIID;
- }
-
- public function set defaultBranch(a:Branch) {
- _defaultBranch = a;
- _firstActivityUIID = (a != null) ? SequenceActivity(a.sequenceActivity).activityUIID : null;
- }
-
- public function get defaultBranch():Branch {
- return _defaultBranch;
- }
-
- public function get clear():Boolean {
- return _clear;
- }
-
- public function set clear(a:Boolean):Void {
- _clear = a;
- }
-}
-
+/***************************************************************************
+ * 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.Debugger;
+/*
+*
+* @author Mitchell Seaton
+* @version 2.1
+* @comments Branching Activity Data storage class.
+* @see Activity
+*/
+class BranchingActivity extends ComplexActivity {
+
+ private static var DEFAULT_STARTX:Number = 0;
+ private static var DEFAULT_STARTY:Number = 0;
+ private static var DEFAULT_ENDX:Number = 0;
+ private static var DEFAULT_ENDY:Number = 0;
+
+ private var _startXCoord:Number;
+ private var _startYCoord:Number;
+ private var _endXCoord:Number;
+ private var _endYCoord:Number;
+
+ private var _toolActivityUIID:Number;
+ private var _defaultBranch:Branch;
+
+ private var _clear:Boolean;
+
+ function BranchingActivity(activityUIID:Number, activityTypeID:Number){
+ super(activityUIID);
+ _activityTypeID = activityTypeID;
+
+ _toolActivityUIID == null;
+ _defaultBranch = null;
+
+ _clear = false;
+
+ }
+
+ /**
+ * Creates from a dto... which is nice
+ * @usage
+ * @param dto
+ * @return
+ */
+ public function populateFromDTO(dto:Object){
+ super.populateFromDTO(dto);
+
+ _startXCoord = dto.startXCoord;
+ _startYCoord = dto.startYCoord;
+ _endXCoord = dto.endXCoord;
+ _endYCoord = dto.endYCoord;
+ _toolActivityUIID = dto.toolActivityUIID;
+ }
+
+ /**
+ * Creates an object containing all the props
+ * 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(_startXCoord) dto.startXCoord = _startXCoord;
+ if(_startYCoord) dto.startYCoord = _startYCoord;
+ if(_endXCoord) dto.endXCoord = _endXCoord;
+ if(_endYCoord) dto.endYCoord = _endYCoord;
+ if(_toolActivityUIID) dto.toolActivityUIID = _toolActivityUIID;
+
+ return dto;
+ }
+
+ /**
+ * Creates an exact copy of this ComplexActivity
+ * @usage
+ * @return the copy
+ */
+ public function clone():BranchingActivity{
+ var dto:Object = toData();
+ var ba = new BranchingActivity();
+ ba.populateFromDTO(dto);
+ return ba;
+ }
+
+
+ public function set type(a:Number):Void{
+ _activityTypeID = a;
+ }
+
+ public function get type():Number {
+ return _activityTypeID;
+ }
+
+ public function set startXCoord(a:Number):Void{
+ Debugger.log("setting x coord: " + a, Debugger.CRITICAL, "startXCoord", "BranchingActivity");
+ _startXCoord = Math.round(a);
+ }
+
+ public function get startXCoord():Number{
+ return _startXCoord;
+ }
+
+ public function set startYCoord(a:Number):Void{
+ _startYCoord = Math.round(a);
+ }
+
+ public function get startYCoord():Number{
+ return _startYCoord;
+ }
+
+ public function set endXCoord(a:Number):Void{
+ _endXCoord = Math.round(a);
+ }
+
+ public function get endXCoord():Number{
+ return _endXCoord;
+ }
+
+ public function set endYCoord(a:Number):Void{
+ _endYCoord = Math.round(a);
+ }
+
+ public function get endYCoord():Number{
+ return _endYCoord;
+ }
+
+ public function set toolActivityUIID(a:Number) {
+ _toolActivityUIID = a;
+ }
+
+ public function get toolActivityUIID():Number {
+ return _toolActivityUIID;
+ }
+
+ public function set defaultBranch(a:Branch) {
+ _defaultBranch = a;
+ _firstActivityUIID = (a != null) ? SequenceActivity(a.sequenceActivity).activityUIID : null;
+ }
+
+ public function get defaultBranch():Branch {
+ return _defaultBranch;
+ }
+
+ public function get clear():Boolean {
+ return _clear;
+ }
+
+ public function set clear(a:Boolean):Void {
+ _clear = a;
+ }
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ComplexActivity.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ComplexActivity.as (.../ComplexActivity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ComplexActivity.as (.../ComplexActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,185 +1,184 @@
-/***************************************************************************
- * 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.Config;
-import org.lamsfoundation.lams.common.util.Debugger;
-import org.lamsfoundation.lams.common.util.StringUtils;
-
-/*
-* 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;
-
- private var _firstActivityUIID:Number;
-
- private var _noSequences:Number;
-
- function ComplexActivity(activityUIID:Number){
- super(activityUIID);
- _firstActivityUIID = null;
+/***************************************************************************
+ * 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.Config;
+import org.lamsfoundation.lams.common.util.Debugger;
+import org.lamsfoundation.lams.common.util.StringUtils;
+
+/*
+* 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;
+
+ private var _firstActivityUIID:Number;
+
+ private var _noSequences:Number;
+
+ function ComplexActivity(activityUIID:Number){
+ super(activityUIID);
+ _firstActivityUIID = null;
+ }
+
+ /**
+ * 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 || _activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE){
+ _maxOptions = dto.maxOptions;
+ _minOptions = dto.minOptions;
+ //TODO: This is missing in the Library packet - tell mai.
+ _optionsInstructions = dto.optionsInstructions;
+ }
+
+ if(StringUtils.isWDDXNull(dto.defaultActivityUIID)) _firstActivityUIID = null;
+ else _firstActivityUIID = dto.defaultActivityUIID;
+ }
+
+ /**
+ * 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 || _activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE){
+ if(_maxOptions){ dto.maxOptions = _maxOptions; }
+ if(_minOptions){ dto.minOptions = _minOptions; }
+ if(_optionsInstructions){ dto.optionsInstructions = _optionsInstructions; }
+ }
+
+ dto.defaultActivityUIID = (_firstActivityUIID == null) ? Config.NUMERIC_NULL_VALUE : _firstActivityUIID;
+
+ 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;
}
-
- /**
- * 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 || _activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE){
- _maxOptions = dto.maxOptions;
- _minOptions = dto.minOptions;
- //TODO: This is missing in the Library packet - tell mai.
- _optionsInstructions = dto.optionsInstructions;
- }
-
- if(StringUtils.isWDDXNull(dto.defaultActivityUIID)) _firstActivityUIID = null;
- else _firstActivityUIID = dto.defaultActivityUIID;
- }
-
- /**
- * 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 || _activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE){
- if(_maxOptions){ dto.maxOptions = _maxOptions; }
- if(_minOptions){ dto.minOptions = _minOptions; }
- if(_optionsInstructions){ dto.optionsInstructions = _optionsInstructions; }
- }
-
- dto.defaultActivityUIID = (_firstActivityUIID == null) ? Config.NUMERIC_NULL_VALUE : _firstActivityUIID;
-
- 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;
- }
-
- public function get firstActivityUIID():Number{
- return _firstActivityUIID;
- }
-
- public function set firstActivityUIID(a:Number):Void{
- _firstActivityUIID = a;
- }
-
- public function get isSequenceBased():Boolean{
- return (_activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE);
- }
-
- public function get noSequences():Number{
- return _noSequences;
- }
-
- public function set noSequences(a:Number):Void{
- _noSequences = a;
- }
-}
-
+
+ /**
+ * 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;
+ }
+
+ public function get firstActivityUIID():Number{
+ return _firstActivityUIID;
+ }
+
+ public function set firstActivityUIID(a:Number):Void{
+ _firstActivityUIID = a;
+ }
+
+ public function get isSequenceBased():Boolean{
+ return (_activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE);
+ }
+
+ public function get noSequences():Number{
+ return _noSequences;
+ }
+
+ public function set noSequences(a:Number):Void{
+ _noSequences = a;
+ }
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as
===================================================================
diff -u -r3f521ad22e97838d8d2c5d81c00d38acd1bfc678 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision 3f521ad22e97838d8d2c5d81c00d38acd1bfc678)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,1670 +1,1670 @@
-/***************************************************************************
- * 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.ui.Cursor;
-import org.lamsfoundation.lams.authoring.br.BranchConnector;
-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;
+/***************************************************************************
+ * 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.ui.Cursor;
+import org.lamsfoundation.lams.authoring.br.BranchConnector;
+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 _branches:Hashtable;
- private var _branchMappings:Hashtable;
- private var _competences:Hashtable;
- private var _outputConditions: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");
- _branches = new Hashtable("_branches");
- _branchMappings = new Hashtable("_branchMappings");
- _competences = new Hashtable("_competences");
- _outputConditions = new Hashtable("_outputConditions");
-
- //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});
-
- }
-
- /**
- * Validates the design data model
- * @usage
- * @return
- */
- public function validate():Boolean{
- var success:Boolean= false;
- Debugger.log("******* FUNCTION NOT IMPLEMENTED",Debugger.CRITICAL,'validate','DesignDataModel');
- return success;
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //////////////////////// UPDATE METHODS ///////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- /**
- * Adds a template activity to the model.
- *
- */
- public function addActivity(activity:Activity):Object{
- var success = false;
-
- //create an Activity from the template actvity.
- Debugger.log('activity:'+activity.title+', UIID:'+activity.activityUIID,4,'addActivity','DesignDataModel');
-
- //validate the activity ?
- //validate if we can do it?
-
- //dispatch an event before the design has changed
- dispatchEvent({type:'ddmBeforeUpdate',target:this});
- _activities.put(activity.activityUIID, activity);
-
- //pull it out to check it
- var tmp:Activity = _activities.get(activity.activityUIID)
-
- if(tmp){
- Debugger.log('Succesfully added:'+tmp.title+':'+tmp.activityUIID,4,'addActivity','DesignDataModel');
- }else{
- return new LFError("Adding activity failed","addActivity",this,'activityUIID:'+activity.activityUIID);
- }
-
- //dispatch an event now the design has changed
- dispatchEvent({type:'ddmUpdate',target:this});
-
-
-
- }
-
- /**
- * Removes the activity from the DDM
- * @usage
- * @param activityUIID
- * @return
- */
- public function removeActivity(activityUIID:Number):Object{
- //dispatch an event to show the design has changed
- dispatchEvent({type:'ddmBeforeUpdate',target:this});
-
- var r:Object = _activities.remove(activityUIID);
- if(r==null){
- return new LFError("Removing activity failed:"+activityUIID,"removeActivity",this,null);
- } else {
- if(r.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE) {
- var rg:Object = _groupings.remove(r.createGroupingUIID);
- if(rg==null) {
- return new LFError("Removing associated grouping failed:"+r.createGroupingUIID, "removeActivity", this, null);
- } else {
- Debugger.log('Removed grouping:'+rg.groupingUIID, Debugger.GEN,'removeActivity','DesignDataModel');
- }
- }
-
- Debugger.log('Removed:'+r.activityUIID,Debugger.GEN,'removeActivity','DesignDataModel');
- dispatchEvent({type:'ddmUpdate',target:this});
-
- return r;
-
- }
- }
-
- /**
- * Removes the complex activity (and children) from only DDM (no canvas items)
- * @usage
- * @param activityUIID
- * @return
- */
- public function removeComplexActivity(activityUIID:Number, _children:Array, removeTrans:Boolean):Void{
-
- for(var i=0; i<_children.length; i++) {
- var _nChildren:Array = getComplexActivityChildren(_children[i].activityUIID);
- if(_nChildren.length > 0) {
- removeComplexActivity(_children[i].activityUIID, _nChildren, removeTrans);
- } else {
- removeActivity(_children[i].activityUIID);
- if(removeTrans) removeTransitionByConnection(_children[i].activityUIID);
- }
-
- }
-
- removeActivity(activityUIID);
- if(removeTrans) removeTransitionByConnection(_children[i].activityUIID);
-
- }
-
- /**
- * Adds a transition to the DDM
- * @usage
- * @param transition
- * @return
- */
- public function addTransition(transition:Transition):Boolean{
- //dispatch an event to show the design has changed
- dispatchEvent({type:'ddmBeforeUpdate',target:this});
-
- Debugger.log('Transition from:'+transition.fromUIID+', to:'+transition.toUIID,4,'addTransition','DesignDataModel');
- _transitions.put(transition.transitionUIID,transition);
- dispatchEvent({type:'ddmUpdate',target:this});
-
- //TODO some validation would be nice
-
- return true;
- }
-
- /**
- * Removes the transition from the DDM
- * @usage
- * @param transitionUIID
- * @return
- */
- public function removeTransition(transitionUIID):Object{
- //dispatch an event to show the design has changed
- dispatchEvent({type:'ddmBeforeUpdate',target:this});
-
- var r:Object = _transitions.remove(transitionUIID);
- if(r==null){
- return new LFError("Removing transition failed:"+transitionUIID,"removeTransition",this,null);
- }else{
- Debugger.log('Removed:'+r.transitionUIID,Debugger.GEN,'removeTransition','DesignDataModel');
- dispatchEvent({type:'ddmUpdate',target:this});
- }
- }
-
- /**
- * Removes the transitions from the DDM which are connected to the Activity
- *
- * @param connectUIID connected Activity UIID
- */
-
- public function removeTransitionByConnection(connectUIID):Void{
- var keyArray:Array = _transitions.keys();
- 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;
-
- 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 0) {
- for (var i=0; i 0)
- for(var i=0; i 0)
- mappingsToRemove.push(Array(mappings.toolBased));
-
- if(mappings.choosenBased.length > 0)
- mappingsToRemove.push(Array(mappings.choosenBased));
-
- for(var j=0; j 0)
- mappingsToRemove.push(Array(mappings.groupBased));
-
- if(mappings.choosenBased.length > 0)
- mappingsToRemove.push(Array(mappings.choosenBased));
-
- for(var j=0; j 0)
- v = false;
-
- if(remove && !v)
- removeEntries(mappingsToRemove);
-
- return !v;
-
- }
-
- public function removeEntries(e:Array) {
- for(var i=0; i 0) {
+ removeComplexActivity(_children[i].activityUIID, _nChildren, removeTrans);
+ } else {
+ removeActivity(_children[i].activityUIID);
+ if(removeTrans) removeTransitionByConnection(_children[i].activityUIID);
+ }
+
+ }
+
+ removeActivity(activityUIID);
+ if(removeTrans) removeTransitionByConnection(_children[i].activityUIID);
+
+ }
+
+ /**
+ * Adds a transition to the DDM
+ * @usage
+ * @param transition
+ * @return
+ */
+ public function addTransition(transition:Transition):Boolean{
+ //dispatch an event to show the design has changed
+ dispatchEvent({type:'ddmBeforeUpdate',target:this});
+
+ Debugger.log('Transition from:'+transition.fromUIID+', to:'+transition.toUIID,4,'addTransition','DesignDataModel');
+ _transitions.put(transition.transitionUIID,transition);
+ dispatchEvent({type:'ddmUpdate',target:this});
+
+ //TODO some validation would be nice
+
+ return true;
+ }
+
+ /**
+ * Removes the transition from the DDM
+ * @usage
+ * @param transitionUIID
+ * @return
+ */
+ public function removeTransition(transitionUIID):Object{
+ //dispatch an event to show the design has changed
+ dispatchEvent({type:'ddmBeforeUpdate',target:this});
+
+ var r:Object = _transitions.remove(transitionUIID);
+ if(r==null){
+ return new LFError("Removing transition failed:"+transitionUIID,"removeTransition",this,null);
+ }else{
+ Debugger.log('Removed:'+r.transitionUIID,Debugger.GEN,'removeTransition','DesignDataModel');
+ dispatchEvent({type:'ddmUpdate',target:this});
+ }
+ }
+
+ /**
+ * Removes the transitions from the DDM which are connected to the Activity
+ *
+ * @param connectUIID connected Activity UIID
+ */
+
+ public function removeTransitionByConnection(connectUIID):Void{
+ var keyArray:Array = _transitions.keys();
+ 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;
+
+ 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 0) {
+ for (var i=0; i 0)
+ for(var i=0; i 0)
+ mappingsToRemove.push(Array(mappings.toolBased));
+
+ if(mappings.choosenBased.length > 0)
+ mappingsToRemove.push(Array(mappings.choosenBased));
+
+ for(var j=0; j 0)
+ mappingsToRemove.push(Array(mappings.groupBased));
+
+ if(mappings.choosenBased.length > 0)
+ mappingsToRemove.push(Array(mappings.choosenBased));
+
+ for(var j=0; j 0)
+ v = false;
+
+ if(remove && !v)
+ removeEntries(mappingsToRemove);
+
+ return !v;
+
+ }
+
+ public function removeEntries(e:Array) {
+ for(var i=0; i 0)
- return _children[0].orderID+1;
- else
- return 1;
- }
-
- public function getValidTransitionsKeys():Array {
- var keys:Array = transitions.keys();
- var keysToSend:Array = new Array();
-
- for(var i=0; i 0)
+ return _children[0].orderID+1;
+ else
+ return 1;
+ }
+
+ public function getValidTransitionsKeys():Array {
+ var keys:Array = transitions.keys();
+ var keysToSend:Array = new Array();
+
+ for(var i=0; i 0) ? _numberOfGroups : Config.NUMERIC_NULL_VALUE;
- dto.maxNumberOfGroups = (_maxNumberOfGroups > 0) ? _maxNumberOfGroups : Config.NUMERIC_NULL_VALUE;
- dto.equalNumberOfLearnersPerGroup = (_equalGroupSizes != null && _equalGroupSizes != undefined) ? equalGroupSizes : Config.BOOLEAN_NULL_VALUE;
- dto.learnersPerGroup = (_learnersPerGroups > 0) ? _learnersPerGroups : Config.NUMERIC_NULL_VALUE;
-
- dto.groups = new Array();
-
- var groupTotal = (groupingTypeID == RANDOM_GROUPING || groupingTypeID == LEARNER_CHOICE_GROUPING) ? numberOfGroups : maxNumberOfGroups;
- if(groupTotal == 0) _groups.clear();
-
- var groups:Array = getGroups(_ddm);
-
- if(groups.length > 0){
- for(var i=0; i 0)
- return groups;
-
- if(groupDiff >= 0) {
- for(var i=0; i 0) ? new Group(this.groupingUIID, null, _ddm.newUIID(), "Group " + Number(groups.length + i + 1), Number(groups.length+i))
- : new Group(this.groupingUIID, null, _ddm.newUIID(), "Group " + Number(i+1), i);
- addGroup(group);
- }
- } else {
- for(var i=-1; i>=groupDiff; i--) {
- _ddm.removeBranchMappingsByGroupUIID(groups[groups.length+i].groupUIID);
- _groups.remove(groups[groups.length+i].groupUIID);
- }
- }
-
- return _groups.values();
-
- }
-
- public function updateGroups(groups:Array):Void {
- for(var i=0; i 0) ? _numberOfGroups : Config.NUMERIC_NULL_VALUE;
+ dto.maxNumberOfGroups = (_maxNumberOfGroups > 0) ? _maxNumberOfGroups : Config.NUMERIC_NULL_VALUE;
+ dto.equalNumberOfLearnersPerGroup = (_equalGroupSizes != null && _equalGroupSizes != undefined) ? equalGroupSizes : Config.BOOLEAN_NULL_VALUE;
+ dto.learnersPerGroup = (_learnersPerGroups > 0) ? _learnersPerGroups : Config.NUMERIC_NULL_VALUE;
+
+ dto.groups = new Array();
+
+ var groupTotal = (groupingTypeID == RANDOM_GROUPING || groupingTypeID == LEARNER_CHOICE_GROUPING) ? numberOfGroups : maxNumberOfGroups;
+ if(groupTotal == 0) _groups.clear();
+
+ var groups:Array = getGroups(_ddm);
+
+ if(groups.length > 0){
+ for(var i=0; i 0)
+ return groups;
+
+ if(groupDiff >= 0) {
+ for(var i=0; i 0) ? new Group(this.groupingUIID, null, _ddm.newUIID(), "Group " + Number(groups.length + i + 1), Number(groups.length+i))
+ : new Group(this.groupingUIID, null, _ddm.newUIID(), "Group " + Number(i+1), i);
+ addGroup(group);
+ }
+ } else {
+ for(var i=-1; i>=groupDiff; i--) {
+ _ddm.removeBranchMappingsByGroupUIID(groups[groups.length+i].groupUIID);
+ _groups.remove(groups[groups.length+i].groupUIID);
+ }
+ }
+
+ return _groups.values();
+
+ }
+
+ public function updateGroups(groups:Array):Void {
+ for(var i=0; i
-* public static var SEQUENCE_ACTIVITY_TYPE:Number = 8;
-*
-* @author Mitchell Seaton
-* @version 2.1
-* @see Activity
-*/
-class SequenceActivity extends ComplexActivity {
-
- private var _empty:Boolean;
- private var _default:Boolean;
-
- function SequenceActivity(activityUIID:Number){
- super(activityUIID);
- _activityTypeID = SEQUENCE_ACTIVITY_TYPE;
- _empty = true;
- _default = false;
- }
-
- /**
- * Creates a complex activity from a dto... which is nice
- * @usage
- * @param dto
- * @return
- */
- public function populateFromDTO(dto:Object){
- super.populateFromDTO(dto);
- }
-
- /**
- * 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{
- if(_empty && _default)
- return null;
-
- var dto:Object = super.toData();
-
- return dto;
- }
-
- /**
- * Creates an exact copy of this SequenceActivity
- * @usage
- * @return the copy
- */
- public function clone():SequenceActivity{
- var dto:Object = toData();
- if(dto != null) {
- var sa = new SequenceActivity();
- sa.populateFromDTO(dto);
-
- return sa;
- }
-
- return null;
- }
-
- public function set firstActivityUIID(a:Number):Void {
- _firstActivityUIID = a;
-
- if(a != null)
- _empty = false;
- else
- _empty = true;
-
- }
-
- public function set empty(b:Boolean):Void{
- _empty = b;
- }
-
- public function get empty():Boolean{
- return _empty;
- }
-
- public function set isDefault(b:Boolean):Void {
- _default = b;
- }
-
- public function get isDefault():Boolean {
- return _default;
- }
-
-}
-
+/***************************************************************************
+ * 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.Debugger;
+
+/*
+* This class represents the sequence activity.
+* For reference these are the activity types
+*
+* public static var SEQUENCE_ACTIVITY_TYPE:Number = 8;
+*
+* @author Mitchell Seaton
+* @version 2.1
+* @see Activity
+*/
+class SequenceActivity extends ComplexActivity {
+
+ private var _empty:Boolean;
+ private var _default:Boolean;
+
+ function SequenceActivity(activityUIID:Number){
+ super(activityUIID);
+ _activityTypeID = SEQUENCE_ACTIVITY_TYPE;
+ _empty = true;
+ _default = false;
+ }
+
+ /**
+ * Creates a complex activity from a dto... which is nice
+ * @usage
+ * @param dto
+ * @return
+ */
+ public function populateFromDTO(dto:Object){
+ super.populateFromDTO(dto);
+ }
+
+ /**
+ * 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{
+ if(_empty && _default)
+ return null;
+
+ var dto:Object = super.toData();
+
+ return dto;
+ }
+
+ /**
+ * Creates an exact copy of this SequenceActivity
+ * @usage
+ * @return the copy
+ */
+ public function clone():SequenceActivity{
+ var dto:Object = toData();
+ if(dto != null) {
+ var sa = new SequenceActivity();
+ sa.populateFromDTO(dto);
+
+ return sa;
+ }
+
+ return null;
+ }
+
+ public function set firstActivityUIID(a:Number):Void {
+ _firstActivityUIID = a;
+
+ if(a != null)
+ _empty = false;
+ else
+ _empty = true;
+
+ }
+
+ public function set empty(b:Boolean):Void{
+ _empty = b;
+ }
+
+ public function get empty():Boolean{
+ return _empty;
+ }
+
+ public function set isDefault(b:Boolean):Void {
+ _default = b;
+ }
+
+ public function get isDefault():Boolean {
+ return _default;
+ }
+
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolActivity.as
===================================================================
diff -u -r6071623eaaab7f58e5c1befe499b0fc1c76850dc -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolActivity.as (.../ToolActivity.as) (revision 6071623eaaab7f58e5c1befe499b0fc1c76850dc)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolActivity.as (.../ToolActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,515 +1,515 @@
-/***************************************************************************
- * 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.*
-/*
-*
-* @author DC
-* @version 0.1
-* @comments Tool Activity Data storage class.
-* @see Activity
-*/
-class ToolActivity extends Activity{
-
- private var _authoringURL:String;
- private var _monitoringURL:String;
- private var _contributeURL:String;
- private var _helpURL:String;
-
- private var _toolDisplayName:String;
- private var _toolSignature:String;
-
- //generated by the LAMS server, has to do a round trip to populate them
- private var _toolContentID:Number;
- private var _toolID:Number;
-
- private var _extLmsId:String; //external LMS id for tool adapter tools
-
- //flags to tell UI which to disable
- private var _supportsContribute:Boolean;
- private var _supportsDefineLater:Boolean;
- private var _supportsModeration:Boolean;
- private var _supportsRunOffline:Boolean;
- private var _supportsOutputs:Boolean;
-
- private var _competenceMappings:Array; // competences to which this activity is mapped
-
- private var _toolOutputDefinitions:Hashtable;
-
- function ToolActivity(activityUIID:Number){
- super(activityUIID);
-
- _objectType = "ToolActivity";
-
- _activityTypeID = TOOL_ACTIVITY_TYPE;
- _toolOutputDefinitions = new Hashtable("_toolOutputDefinitions");
-
- _competenceMappings = new Array();
- }
-
- //TODO: ADD A VALIDATE() FUNCTION
-
- /**
- * Pass an object with all the fields of a ToolActivity into this function to populate:
- *
- * //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{
-
- //first do the super method for activity props
- super.populateFromDTO(dto);
-
- //Tool Activity 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; }
-
- if(StringUtils.isWDDXNull(dto.extLmsId)) { _extLmsId = null }
- else { _extLmsId = dto.extLmsId; }
-
- _competenceMappings = new Array();
- if(!StringUtils.isWDDXNull(dto.competenceMappingTitles)) {
- for (var i=0; i 0) {
- for (var i=0; i<_competenceMappings.length; i++) {
- dto.competenceMappings.push(_competenceMappings[i]);
- }
- }
-
- /* 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;
- 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;
- n.supportsOutputs = _supportsOutputs;
- n.extLmsId = _extLmsId;
-
- return n;
-
-
- }
-
- public function addDefinition(dto:Object):Void {
- _toolOutputDefinitions.put(dto.name, dto);
- }
-
- public function removeDefinition(key:String):Void {
- _toolOutputDefinitions.remove(key);
- }
-
- public function get definitions():Array {
- return _toolOutputDefinitions.values();
- }
-
- public function get competenceMappings():Array {
- return _competenceMappings
- }
-
- //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 newsupportsRunOffline
- * @return
- */
- public function set supportsOutputs (newsupportsOutputs:Boolean):Void {
- _supportsOutputs = newsupportsOutputs;
- }
- /**
- *
- * @usage
- * @return
- */
- public function get supportsOutputs ():Boolean {
- return _supportsOutputs;
- }
-
- /**
- *
- * @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;
- }
-
- /**
- *
- * @usage
- * @param str
- * @return
- */
- public function set extLmsId (str:String):Void {
- _extLmsId = str;
- }
- /**
- *
- * @usage
- * @return
- */
- public function get extLmsId ():String {
- return _extLmsId;
- }
-}
-
+/***************************************************************************
+ * 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.*
+/*
+*
+* @author DC
+* @version 0.1
+* @comments Tool Activity Data storage class.
+* @see Activity
+*/
+class ToolActivity extends Activity{
+
+ private var _authoringURL:String;
+ private var _monitoringURL:String;
+ private var _contributeURL:String;
+ private var _helpURL:String;
+
+ private var _toolDisplayName:String;
+ private var _toolSignature:String;
+
+ //generated by the LAMS server, has to do a round trip to populate them
+ private var _toolContentID:Number;
+ private var _toolID:Number;
+
+ private var _extLmsId:String; //external LMS id for tool adapter tools
+
+ //flags to tell UI which to disable
+ private var _supportsContribute:Boolean;
+ private var _supportsDefineLater:Boolean;
+ private var _supportsModeration:Boolean;
+ private var _supportsRunOffline:Boolean;
+ private var _supportsOutputs:Boolean;
+
+ private var _competenceMappings:Array; // competences to which this activity is mapped
+
+ private var _toolOutputDefinitions:Hashtable;
+
+ function ToolActivity(activityUIID:Number){
+ super(activityUIID);
+
+ _objectType = "ToolActivity";
+
+ _activityTypeID = TOOL_ACTIVITY_TYPE;
+ _toolOutputDefinitions = new Hashtable("_toolOutputDefinitions");
+
+ _competenceMappings = new Array();
+ }
+
+ //TODO: ADD A VALIDATE() FUNCTION
+
+ /**
+ * Pass an object with all the fields of a ToolActivity into this function to populate:
+ *
+ * //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{
+
+ //first do the super method for activity props
+ super.populateFromDTO(dto);
+
+ //Tool Activity 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; }
+
+ if(StringUtils.isWDDXNull(dto.extLmsId)) { _extLmsId = null }
+ else { _extLmsId = dto.extLmsId; }
+
+ _competenceMappings = new Array();
+ if(!StringUtils.isWDDXNull(dto.competenceMappingTitles)) {
+ for (var i=0; i 0) {
+ for (var i=0; i<_competenceMappings.length; i++) {
+ dto.competenceMappings.push(_competenceMappings[i]);
+ }
+ }
+
+ /* 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;
+ 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;
+ n.supportsOutputs = _supportsOutputs;
+ n.extLmsId = _extLmsId;
+
+ return n;
+
+
+ }
+
+ public function addDefinition(dto:Object):Void {
+ _toolOutputDefinitions.put(dto.name, dto);
+ }
+
+ public function removeDefinition(key:String):Void {
+ _toolOutputDefinitions.remove(key);
+ }
+
+ public function get definitions():Array {
+ return _toolOutputDefinitions.values();
+ }
+
+ public function get competenceMappings():Array {
+ return _competenceMappings
+ }
+
+ //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 newsupportsRunOffline
+ * @return
+ */
+ public function set supportsOutputs (newsupportsOutputs:Boolean):Void {
+ _supportsOutputs = newsupportsOutputs;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get supportsOutputs ():Boolean {
+ return _supportsOutputs;
+ }
+
+ /**
+ *
+ * @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;
+ }
+
+ /**
+ *
+ * @usage
+ * @param str
+ * @return
+ */
+ public function set extLmsId (str:String):Void {
+ _extLmsId = str;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get extLmsId ():String {
+ return _extLmsId;
+ }
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputBranchActivityEntry.as
===================================================================
diff -u -rda1644d8e66121854689bf4c74caa46457502601 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputBranchActivityEntry.as (.../ToolOutputBranchActivityEntry.as) (revision da1644d8e66121854689bf4c74caa46457502601)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputBranchActivityEntry.as (.../ToolOutputBranchActivityEntry.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -29,16 +29,16 @@
* @version 2.1
**/
class ToolOutputBranchActivityEntry extends BranchActivityEntry {
-
+
private var _condition:ToolOutputCondition;
function ToolOutputBranchActivityEntry(entryID:Number, entryUIID:Number, condition:ToolOutputCondition, sequenceActivity:SequenceActivity, branchingActivity:BranchingActivity){
- this.entryID = entryID;
- this.entryUIID = entryUIID;
- this.sequenceActivity = sequenceActivity;
- this.branchingActivity = branchingActivity;
-
- this.condition = condition;
+ this.entryID = entryID;
+ this.entryUIID = entryUIID;
+ this.sequenceActivity = sequenceActivity;
+ this.branchingActivity = branchingActivity;
+
+ this.condition = condition;
this.condition.branchingActivity = branchingActivity;
}
@@ -49,22 +49,22 @@
if(this.entryUIID) dto.entryUIID = this.entryUIID;
if(this.sequenceActivity) dto.sequenceActivityUIID = this.sequenceActivity.activityUIID;
if(this.branchingActivity) dto.branchingActivityUIID = this.branchingActivity.activityUIID;
-
+
if(this.condition) dto.condition = _condition.toData(dto);
return dto;
}
- public function get condition():ToolOutputCondition {
- return _condition;
- }
-
- public function set condition(a:ToolOutputCondition):Void {
- _condition = a;
- }
-
- public function get displayName():String {
- return _condition.displayName;
- }
+ public function get condition():ToolOutputCondition {
+ return _condition;
+ }
+ public function set condition(a:ToolOutputCondition):Void {
+ _condition = a;
+ }
+
+ public function get displayName():String {
+ return _condition.displayName;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputCondition.as
===================================================================
diff -u -r502e88647db22fac6375117685082590023dd682 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputCondition.as (.../ToolOutputCondition.as) (revision 502e88647db22fac6375117685082590023dd682)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputCondition.as (.../ToolOutputCondition.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -21,8 +21,8 @@
* ************************************************************************
*/
-import org.lamsfoundation.lams.authoring.*;
-import org.lamsfoundation.lams.common.Config;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.Config;
import org.lamsfoundation.lams.common.util.Debugger;
/**
@@ -36,121 +36,121 @@
private var _conditionUIID:Number;
private var _orderID:Number;
- private var _name:String;
+ private var _name:String;
private var _display_name:String;
private var _type:String;
private var _startValue:Object;
private var _endValue:Object;
private var _exactMatchValue:Object;
-
- private var _branchingActivity:BranchingActivity;
- private var _toolActivity:ToolActivity;
-
- private var _isDefault:Boolean;
+ private var _branchingActivity:BranchingActivity;
+ private var _toolActivity:ToolActivity;
+
+ private var _isDefault:Boolean;
+
function ToolOutputCondition(conditionID:Number, conditionUIID:Number, name:String, type:String, startValue:Object, endValue:Object, exactMatchValue:Object, displayName:String){
_conditionID = conditionID;
_conditionUIID = conditionUIID;
- _orderID = 1;
+ _orderID = 1;
_type = type;
_name = name;
_startValue = startValue;
_endValue = endValue;
- _exactMatchValue = exactMatchValue;
-
- _display_name = displayName;
-
+ _exactMatchValue = exactMatchValue;
+
+ _display_name = displayName;
+
_isDefault = false;
- }
-
- public static function createBoolCondition(UIID:Number, definition:ToolOutputDefinition, toolActivity:ToolActivity, branchingActivity:BranchingActivity, value:Boolean):ToolOutputCondition {
- var condition:ToolOutputCondition = new ToolOutputCondition();
- condition.conditionUIID = UIID;
-
- if(definition.type == ToolOutputDefinition.BOOL) {
- condition.type = definition.type;
- condition.name = definition.name;
- condition.displayName = definition.type + " (" + String(value) + ") ";
- condition.exactMatchValue = value;
- condition.toolActivity = toolActivity;
- condition.branchingActivity = branchingActivity;
- }
-
- return condition;
- }
-
- public static function createLongCondition(UIID:Number, displayName:String, definition:ToolOutputDefinition, toolActivity:ToolActivity, branchingActivity:BranchingActivity, startValue:Number, endValue:Number):ToolOutputCondition {
- var condition:ToolOutputCondition = new ToolOutputCondition();
- condition.conditionUIID = UIID;
-
- if(definition.type == ToolOutputDefinition.LONG) {
- condition.name = definition.name;
- condition.type = definition.type;
- condition.displayName = displayName;
-
- if(startValue == endValue) {
- condition.exactMatchValue = startValue;
- } else {
- condition.startValue = startValue;
- condition.endValue = endValue;
- }
-
- condition.toolActivity = toolActivity;
- condition.branchingActivity = branchingActivity;
- }
-
- return condition;
}
-
- public function populateFromDTO(dto:Object):Void {
- _conditionID = dto.conditionId;
- _conditionUIID = dto.conditionUIID;
-
- _orderID = dto.orderID;
- _name = dto.name;
- _display_name = dto.displayName;
- _type = dto.type;
- _startValue = dto.startValue;
- _endValue = dto.endValue;
- _exactMatchValue = dto.exactMatchValue;
- }
- public function toData():Object {
- var dto:Object = new Object();
-
- if(_conditionID) dto.conditionId = conditionID;
- if(_conditionUIID) dto.conditionUIID = _conditionUIID;
+ public static function createBoolCondition(UIID:Number, definition:ToolOutputDefinition, toolActivity:ToolActivity, branchingActivity:BranchingActivity, value:Boolean):ToolOutputCondition {
+ var condition:ToolOutputCondition = new ToolOutputCondition();
+ condition.conditionUIID = UIID;
+ if(definition.type == ToolOutputDefinition.BOOL) {
+ condition.type = definition.type;
+ condition.name = definition.name;
+ condition.displayName = definition.type + " (" + String(value) + ") ";
+ condition.exactMatchValue = value;
+ condition.toolActivity = toolActivity;
+ condition.branchingActivity = branchingActivity;
+ }
+
+ return condition;
+ }
+
+ public static function createLongCondition(UIID:Number, displayName:String, definition:ToolOutputDefinition, toolActivity:ToolActivity, branchingActivity:BranchingActivity, startValue:Number, endValue:Number):ToolOutputCondition {
+ var condition:ToolOutputCondition = new ToolOutputCondition();
+ condition.conditionUIID = UIID;
+
+ if(definition.type == ToolOutputDefinition.LONG) {
+ condition.name = definition.name;
+ condition.type = definition.type;
+ condition.displayName = displayName;
+
+ if(startValue == endValue) {
+ condition.exactMatchValue = startValue;
+ } else {
+ condition.startValue = startValue;
+ condition.endValue = endValue;
+ }
+
+ condition.toolActivity = toolActivity;
+ condition.branchingActivity = branchingActivity;
+ }
+
+ return condition;
+ }
+
+ public function populateFromDTO(dto:Object):Void {
+ _conditionID = dto.conditionId;
+ _conditionUIID = dto.conditionUIID;
+
+ _orderID = dto.orderID;
+ _name = dto.name;
+ _display_name = dto.displayName;
+ _type = dto.type;
+ _startValue = dto.startValue;
+ _endValue = dto.endValue;
+ _exactMatchValue = dto.exactMatchValue;
+ }
+
+ public function toData():Object {
+ var dto:Object = new Object();
+
+ if(_conditionID) dto.conditionId = conditionID;
+ if(_conditionUIID) dto.conditionUIID = _conditionUIID;
+
if(_orderID) dto.orderID = _orderID;
- if(_name) dto.name = _name;
+ if(_name) dto.name = _name;
if(_display_name) dto.displayName = _display_name;
if(_type) dto.type = _type;
-
- Debugger.log("start value: " + _startValue, Debugger.CRITICAL, "toData", "ToolOutputCondition");
- Debugger.log("end value: " + _endValue, Debugger.CRITICAL, "toData", "ToolOutputCondition");
- Debugger.log("exact value: " + _exactMatchValue, Debugger.CRITICAL, "toData", "ToolOutputCondition");
-
+
+ Debugger.log("start value: " + _startValue, Debugger.CRITICAL, "toData", "ToolOutputCondition");
+ Debugger.log("end value: " + _endValue, Debugger.CRITICAL, "toData", "ToolOutputCondition");
+ Debugger.log("exact value: " + _exactMatchValue, Debugger.CRITICAL, "toData", "ToolOutputCondition");
+
dto.startValue = (_startValue != null || _startValue instanceof Number) ? _startValue : Config.STRING_NULL_VALUE;
- dto.endValue = (_endValue != null || _startValue instanceof Number) ? _endValue : Config.STRING_NULL_VALUE;
+ dto.endValue = (_endValue != null || _startValue instanceof Number) ? _endValue : Config.STRING_NULL_VALUE;
dto.exactMatchValue = (_exactMatchValue != null || _startValue instanceof Number) ? _exactMatchValue : Config.STRING_NULL_VALUE;
return dto;
}
public function set conditionID(a:Number) {
- _conditionID = a;
+ _conditionID = a;
}
public function get conditionID():Number {
- return _conditionID;
+ return _conditionID;
}
public function set conditionUIID(a:Number) {
- _conditionUIID = a;
+ _conditionUIID = a;
}
public function get conditionUIID():Number {
- return _conditionUIID;
+ return _conditionUIID;
}
public function set name(a:String) {
@@ -159,16 +159,16 @@
public function get name():String {
return _name;
- }
-
- public function set displayName(a:String) {
- _display_name = a;
- }
-
- public function get displayName():String {
- return _display_name;
}
+ public function set displayName(a:String) {
+ _display_name = a;
+ }
+
+ public function get displayName():String {
+ return _display_name;
+ }
+
public function set type(a:String) {
_type = a;
}
@@ -207,30 +207,30 @@
public function get orderID():Number {
return _orderID;
- }
-
- public function set toolActivity(a:ToolActivity) {
- _toolActivity = a;
- }
-
- public function get toolActivity():ToolActivity {
- return _toolActivity;
- }
-
- public function set branchingActivity(a:BranchingActivity) {
- _branchingActivity = a;
- }
-
- public function get branchingActivity():BranchingActivity {
- return _branchingActivity;
}
-
- public function set isDefault(a:Boolean) {
- _isDefault = a;
- }
-
- public function get isDefault():Boolean {
- return _isDefault;
+
+ public function set toolActivity(a:ToolActivity) {
+ _toolActivity = a;
}
+
+ public function get toolActivity():ToolActivity {
+ return _toolActivity;
+ }
+
+ public function set branchingActivity(a:BranchingActivity) {
+ _branchingActivity = a;
+ }
+
+ public function get branchingActivity():BranchingActivity {
+ return _branchingActivity;
+ }
+ public function set isDefault(a:Boolean) {
+ _isDefault = a;
+ }
+
+ public function get isDefault():Boolean {
+ return _isDefault;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputDefinition.as
===================================================================
diff -u -r502e88647db22fac6375117685082590023dd682 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputDefinition.as (.../ToolOutputDefinition.as) (revision 502e88647db22fac6375117685082590023dd682)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolOutputDefinition.as (.../ToolOutputDefinition.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -28,49 +28,49 @@
* @author Mitchell Seaton
* @version 2.1
**/
-class ToolOutputDefinition {
-
- public static var LONG:String = "OUTPUT_LONG";
- public static var BOOL:String = "OUTPUT_BOOLEAN";
- public static var USER_DEFINED:String = "OUTPUT_SET_BOOLEAN";
- public static var COMPLEX:String = "OUTPUT_COMPLEX";
+class ToolOutputDefinition {
- private var _name:String;
+ public static var LONG:String = "OUTPUT_LONG";
+ public static var BOOL:String = "OUTPUT_BOOLEAN";
+ public static var USER_DEFINED:String = "OUTPUT_SET_BOOLEAN";
+ public static var COMPLEX:String = "OUTPUT_COMPLEX";
+
+ private var _name:String;
private var _description:String;
private var _type:String;
private var _startValue:Object;
- private var _endValue:Object;
- private var _complexDefinition:Object;
- private var _defaultConditions:Array;
+ private var _endValue:Object;
+ private var _complexDefinition:Object;
+ private var _defaultConditions:Array;
private var _showConditionNameOnly:Boolean;
- function ToolOutputDefinition(){
+ function ToolOutputDefinition(){
_defaultConditions = new Array();
- }
-
- public function populateFromDTO(dto:Object):Void {
- _name = dto.name;
- _description = dto.description;
- _type = dto.type;
- _startValue = dto.startValue;
- _endValue = dto.endValue;
- if(dto.defaultConditions) {
- for(var i=0; i 0) {
- registerEndPoints();
- line_mc.lineStyle(0, lineColor, 100, true, "normal", "square", "miter", 1);
-
- // draw activityless
- for(var i=0; i < _branchingDetails.length; i++) {
- if(_branchingDetails[i].firstActivityUIID == null) {
- activitylessToBeDrawn = true;
- }
- }
-
- for(var i=0; (i < _branchingDetails.length && i < BRANCH_LIMIT); i++) {
- if(_branchingDetails[i].firstActivityUIID != null) {
- setPointAction(true, false, false);
-
- var count:Number = (activitylessDrawn && i==1) ? i-1 : i;
- count = (activitylessToBeDrawn && !activitylessDrawn && i>=1) ? count+1 : count;
-
- var j = 1;
-
- var nextActivity:Activity = _ddm.getActivityByUIID(_branchingDetails[i].firstActivityUIID);
-
- while(j <= ACTIVITY_LIMIT && nextActivity != null) {
- line_mc.lineTo(MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count));
-
- var assocColorObj:Object = getAssociatedStyle(nextActivity);
-
- if(j == ACTIVITY_LIMIT && _branchingDetails[i].noActivities > ACTIVITY_LIMIT) {
- drawActivity(container, MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count), ACT_SIZE, true, false, assocColorObj);
- line_mc.moveTo(MARGIN_X+(j*SPACING) + (ACT_SIZE*4) + 1, MARGIN_Y+(SPACING*count));
- } else if((j == ACTIVITY_LIMIT || j == _branchingDetails[i].noActivities) && !_branchingDetails[i].hasEndBranch) {
- drawActivity(container, MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count), ACT_SIZE, false, true, assocColorObj);
- } else {
- drawActivity(container, MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count), ACT_SIZE, false, false, assocColorObj);
- }
-
- nextActivity = getNextActivity(nextActivity.activityUIID);
-
- j++;
- }
-
- if(_branchingDetails[i].hasEndBranch) setPointAction(false, true, true); // end point
-
- } else {
- setPointAction(true, false, false);
- setPointAction(false, true, true);
-
- activitylessDrawn = true;
- }
- }
- }
-
- setPosition();
- }
-
- private function getNextActivity(activityUIID:Number):Activity {
- var transitionObj:Object = _ddm.getTransitionsForActivityUIID(activityUIID);
- return _ddm.getActivityByUIID(transitionObj.out.toUIID);
- }
-
- private function setPointAction(_moveTo:Boolean, _lineTo:Boolean, _isEnd:Boolean):Object {
- var p:Object = new Object();
- p.x = (_isEnd) ? MARGIN_X+((ACTIVITY_LIMIT+1)*SPACING) : MARGIN_X;
- p.y = (BRANCH_LIMIT%2 != 0) ? MARGIN_Y+(SPACING*(BRANCH_LIMIT%2)) : MARGIN_Y+(SPACING*((BRANCH_LIMIT/2)-1));
-
- if(_moveTo)
- line_mc.moveTo(p.x, p.y);
-
- if(_lineTo)
- line_mc.lineTo(p.x, p.y);
-
- return p;
- }
-
- private function getDetails():Void {
- _branchingDetails = new Array();
- Debugger.log("activity: " + _branchingActivity.activityUIID, Debugger.CRITICAL, "getDetails", "CanvasBranchingDiagram");
-
- var sequences:Array = _ddm.getComplexActivityChildren(_branchingActivity.activityUIID);
-
- if(sequences.length > 0) {
- _empty = false;
-
- for(var i=0; i 0) {
+ registerEndPoints();
+ line_mc.lineStyle(0, lineColor, 100, true, "normal", "square", "miter", 1);
+
+ // draw activityless
+ for(var i=0; i < _branchingDetails.length; i++) {
+ if(_branchingDetails[i].firstActivityUIID == null) {
+ activitylessToBeDrawn = true;
+ }
+ }
+
+ for(var i=0; (i < _branchingDetails.length && i < BRANCH_LIMIT); i++) {
+ if(_branchingDetails[i].firstActivityUIID != null) {
+ setPointAction(true, false, false);
+
+ var count:Number = (activitylessDrawn && i==1) ? i-1 : i;
+ count = (activitylessToBeDrawn && !activitylessDrawn && i>=1) ? count+1 : count;
+
+ var j = 1;
+
+ var nextActivity:Activity = _ddm.getActivityByUIID(_branchingDetails[i].firstActivityUIID);
+
+ while(j <= ACTIVITY_LIMIT && nextActivity != null) {
+ line_mc.lineTo(MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count));
+
+ var assocColorObj:Object = getAssociatedStyle(nextActivity);
+
+ if(j == ACTIVITY_LIMIT && _branchingDetails[i].noActivities > ACTIVITY_LIMIT) {
+ drawActivity(container, MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count), ACT_SIZE, true, false, assocColorObj);
+ line_mc.moveTo(MARGIN_X+(j*SPACING) + (ACT_SIZE*4) + 1, MARGIN_Y+(SPACING*count));
+ } else if((j == ACTIVITY_LIMIT || j == _branchingDetails[i].noActivities) && !_branchingDetails[i].hasEndBranch) {
+ drawActivity(container, MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count), ACT_SIZE, false, true, assocColorObj);
+ } else {
+ drawActivity(container, MARGIN_X+(j*SPACING), MARGIN_Y+(SPACING*count), ACT_SIZE, false, false, assocColorObj);
+ }
+
+ nextActivity = getNextActivity(nextActivity.activityUIID);
+
+ j++;
+ }
+
+ if(_branchingDetails[i].hasEndBranch) setPointAction(false, true, true); // end point
+
+ } else {
+ setPointAction(true, false, false);
+ setPointAction(false, true, true);
+
+ activitylessDrawn = true;
+ }
+ }
+ }
+
+ setPosition();
+ }
+
+ private function getNextActivity(activityUIID:Number):Activity {
+ var transitionObj:Object = _ddm.getTransitionsForActivityUIID(activityUIID);
+ return _ddm.getActivityByUIID(transitionObj.out.toUIID);
+ }
+
+ private function setPointAction(_moveTo:Boolean, _lineTo:Boolean, _isEnd:Boolean):Object {
+ var p:Object = new Object();
+ p.x = (_isEnd) ? MARGIN_X+((ACTIVITY_LIMIT+1)*SPACING) : MARGIN_X;
+ p.y = (BRANCH_LIMIT%2 != 0) ? MARGIN_Y+(SPACING*(BRANCH_LIMIT%2)) : MARGIN_Y+(SPACING*((BRANCH_LIMIT/2)-1));
+
+ if(_moveTo)
+ line_mc.moveTo(p.x, p.y);
+
+ if(_lineTo)
+ line_mc.lineTo(p.x, p.y);
+ return p;
+ }
+
+ private function getDetails():Void {
+ _branchingDetails = new Array();
+ Debugger.log("activity: " + _branchingActivity.activityUIID, Debugger.CRITICAL, "getDetails", "CanvasBranchingDiagram");
+
+ var sequences:Array = _ddm.getComplexActivityChildren(_branchingActivity.activityUIID);
+
+ if(sequences.length > 0) {
+ _empty = false;
+
+ for(var i=0; i 0) {
- LFMessage.showMessageAlert(Dictionary.getValue("branch_mapping_auto_condition_msg"), Proxy.create(this, cleanupUnmappedConditions));
- } else {
- _container.deletePopUp();
- }
-
-
- }
-
- private function cleanupUnmappedConditions(){
- Debugger.log("clearing all unmapped conditions: " + conditions_lst.length, Debugger.CRITICAL, "cleanupUnmappedConditions", "ConditionMatchingDialog");
-
- for(var i=0; i < conditions_lst.length; i++) {
- if(_branchingActivity.defaultBranch != null)
- setupMatch(conditions_lst.getItemAt(i), _branchingActivity.defaultBranch);
- else if(_branchingActivity.firstActivityUIID != null)
- setupMatch(conditions_lst.getItemAt(i), app.getCanvas().ddm.getActivityByUIID(_branchingActivity.firstActivityUIID));
- else
- Debugger.log("no default branch to map conditions too.", Debugger.CRITICAL, "cleanupUnmappedConditions", "ConditionMatchingDialog");
- }
-
- conditions_lst.removeAll();
- app.getCanvas().ddm.conditions.clear();
-
- close();
- }
-
- /**
- * Event dispatched by parent container when close button clicked
- */
- public function click(e:Object):Void{
- close();
- }
-
-
- private function addMatch():Void {
- var selectedConditions:Array = new Array();
-
- // get selected items and put together in match
- if(conditions_lst.selectedItems.length > 0) {
-
- for(var i=0; i 0) {
+ LFMessage.showMessageAlert(Dictionary.getValue("branch_mapping_auto_condition_msg"), Proxy.create(this, cleanupUnmappedConditions));
+ } else {
+ _container.deletePopUp();
+ }
+
+
+ }
+
+ private function cleanupUnmappedConditions(){
+ Debugger.log("clearing all unmapped conditions: " + conditions_lst.length, Debugger.CRITICAL, "cleanupUnmappedConditions", "ConditionMatchingDialog");
+
+ for(var i=0; i < conditions_lst.length; i++) {
+ if(_branchingActivity.defaultBranch != null)
+ setupMatch(conditions_lst.getItemAt(i), _branchingActivity.defaultBranch);
+ else if(_branchingActivity.firstActivityUIID != null)
+ setupMatch(conditions_lst.getItemAt(i), app.getCanvas().ddm.getActivityByUIID(_branchingActivity.firstActivityUIID));
+ else
+ Debugger.log("no default branch to map conditions too.", Debugger.CRITICAL, "cleanupUnmappedConditions", "ConditionMatchingDialog");
+ }
+
+ conditions_lst.removeAll();
+ app.getCanvas().ddm.conditions.clear();
+
+ close();
+ }
+
+ /**
+ * Event dispatched by parent container when close button clicked
+ */
+ public function click(e:Object):Void{
+ close();
+ }
+
+
+ private function addMatch():Void {
+ var selectedConditions:Array = new Array();
+
+ // get selected items and put together in match
+ if(conditions_lst.selectedItems.length > 0) {
+
+ for(var i=0; i 0) {
-
- for(var i=0; i 0) {
+
+ for(var i=0; i 1) {
- if (showMessages) {
- LFMessage.showMessageAlert(Dictionary.getValue("al_group_name_invalid_existing"), null);
- }
- return false;
- }
- }
- }
- }
-
- return true;
- }
-
- public function itemSelected(evt:Object):Void {
- // TODO: Highlight the text to be changed
- var item = _group_naming_dgd.getItemAt(evt.itemIndex);
- selectedGroup = new Group(item.parentID, item.groupID, item.groupUIID, item.groupName, item.orderID); // backup selected grouping object
- Debugger.log("current selection: " + Selection.getFocus(), Debugger.CRITICAL, "itemSelected", "GroupNamingDialog");
- }
-
- public function setupGrid():Void {
- var column_name:DataGridColumn = new DataGridColumn("groupName");
- column_name.headerText = Dictionary.getValue("groupnaming_dialog_col_groupName_lbl");
- column_name.editable = true;
-
- _group_naming_dgd.editable = true;
- _group_naming_dgd.addColumn(column_name);
-
- for(var i=0; i < _groups.length; i++) {
- _group_naming_dgd.addItem(_groups[i]);
- }
+ }
+
+ /**
+ * Event fired by DataGrid class when an item has been edited i.e. its value changes
+ *
+ * @usage
+ * @param evt
+ * @return
+ */
+
+ public function itemEdited(evt:Object):Void {
+ var group = _group_naming_dgd.getItemAt(evt.itemIndex);
+
+ var nameIsValid:Boolean = false;
+
+ if (group.groupName != selectedGroup.groupName) {
+ nameIsValid = areGroupNamesValid(true);
+ }
+
+ if (nameIsValid) {
+ _changedGroups.put(group.groupUIID, group);
+ } else {
+ _group_naming_dgd.replaceItemAt(evt.itemIndex, selectedGroup);
+ _changedGroups.put(selectedGroup.groupUIID, selectedGroup); //restore value
+ }
}
+
+ public function areGroupNamesValid(showMessages:Boolean):Boolean {
+
+ for (var i=0; i<_group_naming_dgd.length; i++) {
+ var numGroupsWithThatName:Number = 0;
+
+ // remove spaces from groupName and return it as a new String leaving groupName unchanged
+ var tmpString:String = StringUtils.replace(_group_naming_dgd.getItemAt(i).groupName, " ", "");
+
+ if (tmpString == "" || tmpString == null || tmpString == undefined) {
+ if (showMessages) {
+ LFMessage.showMessageAlert(Dictionary.getValue("al_group_name_invalid_blank"), null);
+ }
+ return false;
+ }
+
+ for (var j=0; j<_group_naming_dgd.length; j++) {
+
+ if (_group_naming_dgd.getItemAt(j).groupName == _group_naming_dgd.getItemAt(i).groupName) {
+
+ numGroupsWithThatName++;
+ if (numGroupsWithThatName > 1) {
+ if (showMessages) {
+ LFMessage.showMessageAlert(Dictionary.getValue("al_group_name_invalid_existing"), null);
+ }
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public function itemSelected(evt:Object):Void {
+ // TODO: Highlight the text to be changed
+ var item = _group_naming_dgd.getItemAt(evt.itemIndex);
+ selectedGroup = new Group(item.parentID, item.groupID, item.groupUIID, item.groupName, item.orderID); // backup selected grouping object
+ Debugger.log("current selection: " + Selection.getFocus(), Debugger.CRITICAL, "itemSelected", "GroupNamingDialog");
+ }
+
+ public function setupGrid():Void {
+ var column_name:DataGridColumn = new DataGridColumn("groupName");
+ column_name.headerText = Dictionary.getValue("groupnaming_dialog_col_groupName_lbl");
+ column_name.editable = true;
+
+ _group_naming_dgd.editable = true;
+ _group_naming_dgd.addColumn(column_name);
+
+ for(var i=0; i < _groups.length; i++) {
+ _group_naming_dgd.addItem(_groups[i]);
+ }
+ }
/**
* Called on initialisation and themeChanged event handler
@@ -230,43 +230,43 @@
//Get the button style from the style manager and apply to both buttons
styleObj = themeManager.getStyleObject('button');
close_btn.setStyle('styleName', styleObj);
-
- styleObj = themeManager.getStyleObject('CanvasPanel');
+
+ styleObj = themeManager.getStyleObject('CanvasPanel');
_bgpanel.setStyle('styleName', styleObj);
//Apply label style
styleObj = themeManager.getStyleObject('label');
instructions_lbl.setStyle('styleName', styleObj);
- }
+ }
/**
* Called by the OK button
*/
- private function close(){
-
- if (areGroupNamesValid(false)) {
- _grouping.updateGroups(_changedGroups.values());
- _container.deletePopUp();
- }
- }
+ private function close(){
+
+ if (areGroupNamesValid(false)) {
+ _grouping.updateGroups(_changedGroups.values());
+ _container.deletePopUp();
+ }
+ }
/**
* Event dispatched by parent container when close button clicked
*/
- public function click(e:Object):Void{
+ public function click(e:Object):Void{
_grouping.updateGroups(_changedGroups.values());
e.target.deletePopUp();
}
/**
* Main resize method, called by scrollpane container/parent
*/
- public function setSize(w:Number,h:Number):Void{
+ public function setSize(w:Number,h:Number):Void{
//Size the panel
_bgpanel.setSize(w,h);
//Buttons
- close_btn.move(w-xOkOffset,h-yOkOffset);
+ close_btn.move(w-xOkOffset,h-yOkOffset);
}
@@ -276,14 +276,14 @@
*/
function set container(value:MovieClip){
_container = value;
- }
-
- public function set groups(a:Array){
- _groups = a;
- }
-
- public function set grouping(a:Grouping) {
- _grouping = a;
- }
+ }
+
+ public function set groups(a:Array){
+ _groups = a;
+ }
+ public function set grouping(a:Grouping) {
+ _grouping = a;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/ToolOutputConditionsDialog.as
===================================================================
diff -u -r502e88647db22fac6375117685082590023dd682 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/ToolOutputConditionsDialog.as (.../ToolOutputConditionsDialog.as) (revision 502e88647db22fac6375117685082590023dd682)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/ToolOutputConditionsDialog.as (.../ToolOutputConditionsDialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -21,19 +21,19 @@
* ************************************************************************
*/
-import org.lamsfoundation.lams.authoring.br.*;
-import org.lamsfoundation.lams.authoring.Application;
-import org.lamsfoundation.lams.authoring.BranchingActivity;
-import org.lamsfoundation.lams.authoring.ToolActivity;
-import org.lamsfoundation.lams.authoring.ToolOutputDefinition;
+import org.lamsfoundation.lams.authoring.br.*;
+import org.lamsfoundation.lams.authoring.Application;
+import org.lamsfoundation.lams.authoring.BranchingActivity;
+import org.lamsfoundation.lams.authoring.ToolActivity;
+import org.lamsfoundation.lams.authoring.ToolOutputDefinition;
import org.lamsfoundation.lams.authoring.ToolOutputCondition;
-
-import org.lamsfoundation.lams.common.Dialog;
-import org.lamsfoundation.lams.common.style.*;
-import org.lamsfoundation.lams.common.dict.*;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.ui.LFMessage;
+import org.lamsfoundation.lams.common.Dialog;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.LFMessage;
+
import mx.controls.*
import mx.controls.gridclasses.DataGridColumn;
import mx.utils.*
@@ -46,80 +46,80 @@
* @version 2.1
**/
class ToolOutputConditionsDialog extends MovieClip implements Dialog {
- private static var STP_MAX:Number = 9999;
- private static var STP_MIN:Number = 0;
-
- private static var OPTION_GTE:Number = 0;
- private static var OPTION_LTE:Number = 1;
- private static var OPTION_RANGE:Number = 2;
-
- private static var TOOL_OUTPUTS_URL_POSTFIX:String = "outputs";
- private static var HELP_BTN_LBL:String = "?";
- private static var DEFINITION_DELIMITER:String = "#";
-
+ private static var STP_MAX:Number = 9999;
+ private static var STP_MIN:Number = 0;
+
+ private static var OPTION_GTE:Number = 0;
+ private static var OPTION_LTE:Number = 1;
+ private static var OPTION_RANGE:Number = 2;
+
+ private static var TOOL_OUTPUTS_URL_POSTFIX:String = "outputs";
+ private static var HELP_BTN_LBL:String = "?";
+ private static var DEFINITION_DELIMITER:String = "#";
+
//References to components + clips
private var _container:MovieClip; //The container window that holds the dialog
-
+
private var _definitions:Array;
private var _conditions:Array;
-
- private var _selectedDefinition:ToolOutputDefinition;
- private var _selectedIndex:Number;
-
- private var _selectedOption:Object;
- private var _selectedOptionIndex:Number;
-
- private var _toolContentID:Number;
- private var _toolOutputDefin_cmb:ComboBox;
+ private var _selectedDefinition:ToolOutputDefinition;
+ private var _selectedIndex:Number;
+
+ private var _selectedOption:Object;
+ private var _selectedOptionIndex:Number;
+
+ private var _toolContentID:Number;
+
+ private var _toolOutputDefin_cmb:ComboBox;
private var _toolOutputLongOptions_cmb:ComboBox;
-
+
private var _condition_item_dgd:DataGrid;
private var _start_value_stp:NumericStepper;
- private var _end_value_stp:NumericStepper;
+ private var _end_value_stp:NumericStepper;
private var add_btn:Button;
- private var close_btn:Button;
- private var cancel_btn:Button;
- private var remove_item_btn:Button;
- private var clear_all_btn:Button;
- private var help_btn:Button;
+ private var close_btn:Button;
+ private var cancel_btn:Button;
+ private var remove_item_btn:Button;
+ private var clear_all_btn:Button;
+ private var help_btn:Button;
private var refresh_btn:Button;
-
- private var _condition_from_lbl:Label;
+
+ private var _condition_from_lbl:Label;
private var _condition_to_lbl:Label;
private var _bgpanel:MovieClip; //The underlaying panel base
- private var app:Application;
+ private var app:Application;
private var fm:FocusManager; //Reference to focus manager
private var themeManager:ThemeManager; //Theme manager
//Dimensions for resizing
private var xOkOffset:Number;
private var yOkOffset:Number;
private var xCancelOffset:Number;
- private var yCancelOffset:Number;
-
- private var _itemCount:Number;
-
- private var _branchingActivity:BranchingActivity;
+ private var yCancelOffset:Number;
+
+ private var _itemCount:Number;
+
+ private var _branchingActivity:BranchingActivity;
private var _toolActivity:ToolActivity;
//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;
-
- function ToolOutputConditionsDialog(){
-
-
- _itemCount = 0;
- this._visible = false;
-
- app = Application.getInstance();
+
+ function ToolOutputConditionsDialog(){
+
+
+ _itemCount = 0;
+ this._visible = false;
+ app = Application.getInstance();
+
//Set up this class to use the Flash event delegation model
EventDispatcher.initialize(this);
@@ -140,32 +140,32 @@
//EVENTS
//Add event listeners for buttons
close_btn.addEventListener('click', Delegate.create(this, close));
- cancel_btn.addEventListener('click', Delegate.create(this, cancel));
-
- add_btn.addEventListener('click',Delegate.create(this, addButton_onPress));
+ cancel_btn.addEventListener('click', Delegate.create(this, cancel));
+
+ add_btn.addEventListener('click',Delegate.create(this, addButton_onPress));
help_btn.addEventListener('click',Delegate.create(this, helpButton_onPress));
- remove_item_btn.addEventListener('click', Delegate.create(this, removeItemButton_onPress));
- clear_all_btn.addEventListener('click', Delegate.create(this, clearAllButton_onPress));
- refresh_btn.addEventListener('click', Delegate.create(this, refreshButton_onPress));
-
- _toolOutputDefin_cmb.addEventListener('change', Delegate.create(this, itemChanged));
- _toolOutputLongOptions_cmb.addEventListener('change', Delegate.create(this, optionChanged));
-
- _condition_item_dgd.addEventListener('cellEdit', Delegate.create(this, itemEdited));
- _condition_item_dgd.addEventListener('cellFocusIn', Delegate.create(this, itemSelected));
+ remove_item_btn.addEventListener('click', Delegate.create(this, removeItemButton_onPress));
+ clear_all_btn.addEventListener('click', Delegate.create(this, clearAllButton_onPress));
+ refresh_btn.addEventListener('click', Delegate.create(this, refreshButton_onPress));
+ _toolOutputDefin_cmb.addEventListener('change', Delegate.create(this, itemChanged));
+ _toolOutputLongOptions_cmb.addEventListener('change', Delegate.create(this, optionChanged));
+
+ _condition_item_dgd.addEventListener('cellEdit', Delegate.create(this, itemEdited));
+ _condition_item_dgd.addEventListener('cellFocusIn', Delegate.create(this, itemSelected));
+
//Assign Click (close button) and resize handlers
_container.addEventListener('click',this);
_container.addEventListener('size',this);
//work out offsets from bottom RHS of panel
xOkOffset = _bgpanel._width - close_btn._x;
yOkOffset = _bgpanel._height - close_btn._y;
-
- _condition_item_dgd.selectable = false;
+ _condition_item_dgd.selectable = false;
+
//Register as listener with StyleManager and set Styles
- themeManager.addEventListener('themeChanged',this);
+ themeManager.addEventListener('themeChanged',this);
setLabels();
setStyles();
@@ -188,18 +188,18 @@
}
private function setLabels(){
- _condition_from_lbl.text = Dictionary.getValue("to_conditions_dlg_from_lbl");
+ _condition_from_lbl.text = Dictionary.getValue("to_conditions_dlg_from_lbl");
_condition_to_lbl.text = Dictionary.getValue("to_conditions_dlg_to_lbl");
-
- add_btn.label = Dictionary.getValue("to_conditions_dlg_add_btn_lbl");
- help_btn.label = HELP_BTN_LBL;
- clear_all_btn.label = Dictionary.getValue("to_conditions_dlg_clear_all_btn_lbl");
- remove_item_btn.label = Dictionary.getValue("to_conditions_dlg_remove_item_btn_lbl");
- refresh_btn.label = Dictionary.getValue("refresh_btn");
-
- //Set the text for buttons
- close_btn.label = Dictionary.getValue('al_done');
- cancel_btn.label = Dictionary.getValue('al_cancel');
+
+ add_btn.label = Dictionary.getValue("to_conditions_dlg_add_btn_lbl");
+ help_btn.label = HELP_BTN_LBL;
+ clear_all_btn.label = Dictionary.getValue("to_conditions_dlg_clear_all_btn_lbl");
+ remove_item_btn.label = Dictionary.getValue("to_conditions_dlg_remove_item_btn_lbl");
+ refresh_btn.label = Dictionary.getValue("refresh_btn");
+
+ //Set the text for buttons
+ close_btn.label = Dictionary.getValue('al_done');
+ cancel_btn.label = Dictionary.getValue('al_cancel');
}
/**
@@ -212,573 +212,573 @@
//Get the button style from the style manager and apply to both buttons
styleObj = themeManager.getStyleObject('button');
- close_btn.setStyle('styleName', styleObj);
- cancel_btn.setStyle('styleName', styleObj);
-
- add_btn.setStyle('styleName', styleObj);
- help_btn.setStyle('styleName', styleObj);
- remove_item_btn.setStyle('styleName', styleObj);
- clear_all_btn.setStyle('styleName', styleObj);
+ close_btn.setStyle('styleName', styleObj);
+ cancel_btn.setStyle('styleName', styleObj);
+
+ add_btn.setStyle('styleName', styleObj);
+ help_btn.setStyle('styleName', styleObj);
+ remove_item_btn.setStyle('styleName', styleObj);
+ clear_all_btn.setStyle('styleName', styleObj);
refresh_btn.setStyle('styleName', styleObj);
styleObj = themeManager.getStyleObject('CanvasPanel');
_bgpanel.setStyle('styleName', styleObj);
//Apply label style
- styleObj = themeManager.getStyleObject('label');
- _condition_from_lbl.setStyle('styleName', styleObj);
- _condition_to_lbl.setStyle('styleName', styleObj);
-
- styleObj = themeManager.getStyleObject('picombo');
- _toolOutputDefin_cmb.setStyle('styleName', styleObj);
- _toolOutputLongOptions_cmb.setStyle('styleName', styleObj);
-
- styleObj = themeManager.getStyleObject('numericstepper');
- _start_value_stp.setStyle('styleName', styleObj);
+ styleObj = themeManager.getStyleObject('label');
+ _condition_from_lbl.setStyle('styleName', styleObj);
+ _condition_to_lbl.setStyle('styleName', styleObj);
+
+ styleObj = themeManager.getStyleObject('picombo');
+ _toolOutputDefin_cmb.setStyle('styleName', styleObj);
+ _toolOutputLongOptions_cmb.setStyle('styleName', styleObj);
+
+ styleObj = themeManager.getStyleObject('numericstepper');
+ _start_value_stp.setStyle('styleName', styleObj);
_end_value_stp.setStyle('styleName', styleObj);
- }
-
- private function showElements(b:Boolean):Void {
- _toolOutputLongOptions_cmb.visible = b;
-
- _condition_item_dgd.visible = b;
-
- _start_value_stp.visible = b;
- _end_value_stp.visible = b;
-
- add_btn.visible = b;
- remove_item_btn.visible = b;
- clear_all_btn.visible = b;
- refresh_btn.visible = b;
-
- _condition_from_lbl.visible = b;
- _condition_to_lbl.visible = b;
- }
-
- public function setupContent():Void {
- _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_options_item_header_lbl"), data: null});
- _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_gte_lbl"), data: OPTION_GTE});
- _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_lte_lbl"), data: OPTION_LTE});
- _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_range_lbl"), data: OPTION_RANGE});
-
- addConditionItemColumns(false);
-
- showElements(false);
-
- // wait second frame for steppers to be setup
- this.onEnterFrame = initSetup;
-
- }
-
- private function addConditionItemColumns(hideValueColumn:Boolean):Void {
- _condition_item_dgd.removeAllColumns();
-
- var column_name:DataGridColumn = new DataGridColumn("conditionName");
- column_name.headerText = Dictionary.getValue("to_conditions_dlg_condition_items_name_col_lbl");
- column_name.editable = !(_selectedDefinition.defaultConditions.length > 0);
-
- column_name.width = (hideValueColumn) ? _condition_item_dgd.width : _condition_item_dgd.width*0.4;
-
- _condition_item_dgd.addColumn(column_name);
-
- if(!hideValueColumn) {
- var column_value:DataGridColumn = new DataGridColumn("conditionValue");
- column_value.headerText = Dictionary.getValue("to_conditions_dlg_condition_items_value_col_lbl");
- column_value.editable = false;
- column_value.width = _condition_item_dgd.width*0.6;
-
- _condition_item_dgd.addColumn(column_value);
- }
-
- }
-
- private function initSetup():Void {
- delete this.onEnterFrame;
-
- var branches:Array = app.getCanvas().ddm.getBranchMappingsByActivityUIIDAndType(_branchingActivity.activityUIID).toolBased;
- Debugger.log("branches length: " + branches.length, Debugger.CRITICAL, "initSetup", "ToolOutputConditionsDialog");
-
- for(var i=0; i 0) {
- LFMessage.showMessageConfirm(Dictionary.getValue("to_conditions_dlg_condition_items_update_defaultConditions"), Proxy.create(this, updateWithDefaultConditions), null, Dictionary.getValue("al_continue"), null, "");
- } else if(_selectedDefinition.type == ToolOutputDefinition.USER_DEFINED) {
- // show alert message - 0 default conditions all mappings will be removed
- LFMessage.showMessageAlert(Dictionary.getValue("branch_mapping_dlg_condtion_items_update_defaultConditions_zero"), null);
- }
- }
- }
+ public function setupContent():Void {
+ _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_options_item_header_lbl"), data: null});
+ _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_gte_lbl"), data: OPTION_GTE});
+ _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_lte_lbl"), data: OPTION_LTE});
+ _toolOutputLongOptions_cmb.addItem({label: Dictionary.getValue("to_conditions_dlg_range_lbl"), data: OPTION_RANGE});
+
+ addConditionItemColumns(false);
+
+ showElements(false);
+
+ // wait second frame for steppers to be setup
+ this.onEnterFrame = initSetup;
+
+ }
+
+ private function addConditionItemColumns(hideValueColumn:Boolean):Void {
+ _condition_item_dgd.removeAllColumns();
+
+ var column_name:DataGridColumn = new DataGridColumn("conditionName");
+ column_name.headerText = Dictionary.getValue("to_conditions_dlg_condition_items_name_col_lbl");
+ column_name.editable = !(_selectedDefinition.defaultConditions.length > 0);
+
+ column_name.width = (hideValueColumn) ? _condition_item_dgd.width : _condition_item_dgd.width*0.4;
+
+ _condition_item_dgd.addColumn(column_name);
+
+ if(!hideValueColumn) {
+ var column_value:DataGridColumn = new DataGridColumn("conditionValue");
+ column_value.headerText = Dictionary.getValue("to_conditions_dlg_condition_items_value_col_lbl");
+ column_value.editable = false;
+ column_value.width = _condition_item_dgd.width*0.6;
+
+ _condition_item_dgd.addColumn(column_value);
+ }
+
+ }
+
+ private function initSetup():Void {
+ delete this.onEnterFrame;
+
+ var branches:Array = app.getCanvas().ddm.getBranchMappingsByActivityUIIDAndType(_branchingActivity.activityUIID).toolBased;
+ Debugger.log("branches length: " + branches.length, Debugger.CRITICAL, "initSetup", "ToolOutputConditionsDialog");
+
+ for(var i=0; i 0) {
+ LFMessage.showMessageConfirm(Dictionary.getValue("to_conditions_dlg_condition_items_update_defaultConditions"), Proxy.create(this, updateWithDefaultConditions), null, Dictionary.getValue("al_continue"), null, "");
+ } else if(_selectedDefinition.type == ToolOutputDefinition.USER_DEFINED) {
+ // show alert message - 0 default conditions all mappings will be removed
+ LFMessage.showMessageAlert(Dictionary.getValue("branch_mapping_dlg_condtion_items_update_defaultConditions_zero"), null);
+ }
+ }
+ }
+
/**
* Called by ADD button
*
* @usage
* @return
*/
private function addCondition(condition:ToolOutputCondition):Void {
-
- switch(condition.type) {
- case ToolOutputDefinition.LONG :
- if(condition.startValue != null && condition.endValue != null)
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value", [String(condition.startValue), String(condition.endValue)]), data: condition, orderID: condition.orderID});
- else if(condition.startValue != null && condition.endValue == null)
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value_max", [String(condition.startValue)]), data: condition, orderID: condition.orderID});
- else if(condition.startValue == null && condition.endValue != null)
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value_min", [String(condition.endValue)]), data: condition, orderID: condition.orderID});
- else
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value_exact", [String(condition.exactMatchValue)]), data: condition, orderID: condition.orderID});
- break;
-
- case ToolOutputDefinition.BOOL:
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: String(condition.exactMatchValue), data: condition, orderID: condition.orderID});
- break;
- case ToolOutputDefinition.COMPLEX:
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: String(condition.exactMatchValue), data: condition, orderID: condition.orderID});
- break;
- case ToolOutputDefinition.USER_DEFINED:
- _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: String(condition.exactMatchValue), data: condition, orderID: condition.orderID});
- break;
- default:
- Debugger.log("No type found", Debugger.GEN, "addCondition", "ToolOutputConditionsDialog");
- }
-
- app.getCanvas().ddm.addOutputCondition(condition);
-
- }
-
- private function updateWithDefaultConditions():Void {
- if(_selectedDefinition != null) {
- removeAllItems(false);
- addDefaultConditions(_selectedDefinition.defaultConditions);
- }
- }
-
- private function removeCondition(conditionUIID:Number, index:Number):Void {
- app.getCanvas().ddm.removeOutputCondition(conditionUIID);
- _condition_item_dgd.removeItemAt(index);
- }
-
- private function removeAllItems(c:Boolean):Void {
- var _item:ToolOutputDefinition = _toolOutputDefin_cmb.dataProvider[_toolOutputDefin_cmb.selectedIndex];
-
- if(_item.type == null) {
- returnDefinitionState();
- return;
- }
-
- clearAllButton_onPress(null, true);
- if(c) selectDefinition(true);
-
- }
-
- private function validateCondition(selectedDefinition:ToolOutputDefinition):Boolean {
-
- switch(selectedDefinition.type) {
- case ToolOutputDefinition.LONG:
- if(_toolOutputLongOptions_cmb.selectedItem.data == OPTION_GTE) {
- return validateLongCondition(_start_value_stp.value, null);
- } else if(_toolOutputLongOptions_cmb.selectedItem.data == OPTION_LTE) {
- return validateLongCondition(null, _start_value_stp.value);
- } else {
- return validateLongCondition(_start_value_stp.value, _end_value_stp.value);
- }
- break;
- case ToolOutputDefinition.BOOL:
- return true;
- case ToolOutputDefinition.COMPLEX:
- return true;
- case ToolOutputDefinition.USER_DEFINED:
- return true;
- default:
- return false;
- }
-
- }
-
- private function validateLongCondition(start_value:Number, end_value:Number) {
- Debugger.log("validating Long Condition", Debugger.CRITICAL, "validateLongCondition", "ToolOutputconditiosDialog")
-
- if(start_value > end_value) {
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_direction", [Dictionary.getValue("to_condition_start_value"), Dictionary.getValue("to_condition_end_value")]), null);
- return false;
- }
-
- // TODO: Update error messages to be more meaningful
- for(var i=0; i<_condition_item_dgd.dataProvider.length; i++) {
- var condition:ToolOutputCondition = ToolOutputCondition(_condition_item_dgd.dataProvider[i].data);
-
- if(condition.exactMatchValue != null) {
- if(start_value == condition.exactMatchValue) {
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_start_value")]), null);
- return false;
- } else if(end_value == condition.exactMatchValue) {
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
- return false;
- } else if(start_value < condition.exactMatchValue && end_value == null) {
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
- return false;
- } else if(end_value > condition.exactMatchValue && start_value == null) {
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
- return false;
- }
- } else {
- if(start_value >= condition.startValue && start_value <= condition.endValue && start_value != null) {
- Debugger.log("1", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
-
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_start_value")]), null);
- return false;
- } else if(end_value >= condition.startValue && end_value <= condition.endValue && end_value != null) {
- Debugger.log("2", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
-
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
- return false;
- } else if(end_value >= condition.endValue && start_value == null && condition.endValue != null) {
- Debugger.log("3", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
-
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_start_value")]), null);
- return false;
- } else if(start_value <= condition.startValue && end_value == null && condition.startValue != null) {
- Debugger.log("4", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
-
- LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
- return false;
- }
- }
- }
-
- return true;
- }
-
- private function itemChanged(evt:Object):Void {
- if(_selectedIndex == _toolOutputDefin_cmb.selectedIndex)
- return;
-
- _toolOutputLongOptions_cmb.selectedIndex = 0;
-
- if(app.getCanvas().ddm.hasBranchMappingsForConditionSet(_condition_item_dgd.dataProvider) && evt != null && _toolOutputDefin_cmb.selectedIndex != 0) {
- LFMessage.showMessageConfirm(Dictionary.getValue("branch_mapping_dlg_condition_linked_msg", [Dictionary.getValue("branch_mapping_dlg_condition_linked_all")]), Proxy.create(this, removeAllItems, true), Proxy.create(this, returnDefinitionState), Dictionary.getValue("al_continue"), null);
+
+ switch(condition.type) {
+ case ToolOutputDefinition.LONG :
+ if(condition.startValue != null && condition.endValue != null)
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value", [String(condition.startValue), String(condition.endValue)]), data: condition, orderID: condition.orderID});
+ else if(condition.startValue != null && condition.endValue == null)
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value_max", [String(condition.startValue)]), data: condition, orderID: condition.orderID});
+ else if(condition.startValue == null && condition.endValue != null)
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value_min", [String(condition.endValue)]), data: condition, orderID: condition.orderID});
+ else
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: Dictionary.getValue("branch_mapping_dlg_condition_col_value_exact", [String(condition.exactMatchValue)]), data: condition, orderID: condition.orderID});
+ break;
+
+ case ToolOutputDefinition.BOOL:
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: String(condition.exactMatchValue), data: condition, orderID: condition.orderID});
+ break;
+ case ToolOutputDefinition.COMPLEX:
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: String(condition.exactMatchValue), data: condition, orderID: condition.orderID});
+ break;
+ case ToolOutputDefinition.USER_DEFINED:
+ _condition_item_dgd.addItem({conditionName: condition.displayName, conditionValue: String(condition.exactMatchValue), data: condition, orderID: condition.orderID});
+ break;
+ default:
+ Debugger.log("No type found", Debugger.GEN, "addCondition", "ToolOutputConditionsDialog");
+ }
+
+ app.getCanvas().ddm.addOutputCondition(condition);
+
+ }
+
+ private function updateWithDefaultConditions():Void {
+ if(_selectedDefinition != null) {
+ removeAllItems(false);
+ addDefaultConditions(_selectedDefinition.defaultConditions);
+ }
+ }
+
+ private function removeCondition(conditionUIID:Number, index:Number):Void {
+ app.getCanvas().ddm.removeOutputCondition(conditionUIID);
+ _condition_item_dgd.removeItemAt(index);
+ }
+
+ private function removeAllItems(c:Boolean):Void {
+ var _item:ToolOutputDefinition = _toolOutputDefin_cmb.dataProvider[_toolOutputDefin_cmb.selectedIndex];
+
+ if(_item.type == null) {
+ returnDefinitionState();
+ return;
+ }
+
+ clearAllButton_onPress(null, true);
+ if(c) selectDefinition(true);
+
+ }
+
+ private function validateCondition(selectedDefinition:ToolOutputDefinition):Boolean {
+
+ switch(selectedDefinition.type) {
+ case ToolOutputDefinition.LONG:
+ if(_toolOutputLongOptions_cmb.selectedItem.data == OPTION_GTE) {
+ return validateLongCondition(_start_value_stp.value, null);
+ } else if(_toolOutputLongOptions_cmb.selectedItem.data == OPTION_LTE) {
+ return validateLongCondition(null, _start_value_stp.value);
+ } else {
+ return validateLongCondition(_start_value_stp.value, _end_value_stp.value);
+ }
+ break;
+ case ToolOutputDefinition.BOOL:
+ return true;
+ case ToolOutputDefinition.COMPLEX:
+ return true;
+ case ToolOutputDefinition.USER_DEFINED:
+ return true;
+ default:
+ return false;
+ }
+
+ }
+
+ private function validateLongCondition(start_value:Number, end_value:Number) {
+ Debugger.log("validating Long Condition", Debugger.CRITICAL, "validateLongCondition", "ToolOutputconditiosDialog")
+
+ if(start_value > end_value) {
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_direction", [Dictionary.getValue("to_condition_start_value"), Dictionary.getValue("to_condition_end_value")]), null);
+ return false;
+ }
+
+ // TODO: Update error messages to be more meaningful
+ for(var i=0; i<_condition_item_dgd.dataProvider.length; i++) {
+ var condition:ToolOutputCondition = ToolOutputCondition(_condition_item_dgd.dataProvider[i].data);
+
+ if(condition.exactMatchValue != null) {
+ if(start_value == condition.exactMatchValue) {
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_start_value")]), null);
+ return false;
+ } else if(end_value == condition.exactMatchValue) {
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
+ return false;
+ } else if(start_value < condition.exactMatchValue && end_value == null) {
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
+ return false;
+ } else if(end_value > condition.exactMatchValue && start_value == null) {
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
+ return false;
+ }
+ } else {
+ if(start_value >= condition.startValue && start_value <= condition.endValue && start_value != null) {
+ Debugger.log("1", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
+
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_start_value")]), null);
+ return false;
+ } else if(end_value >= condition.startValue && end_value <= condition.endValue && end_value != null) {
+ Debugger.log("2", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
+
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
+ return false;
+ } else if(end_value >= condition.endValue && start_value == null && condition.endValue != null) {
+ Debugger.log("3", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
+
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_start_value")]), null);
+ return false;
+ } else if(start_value <= condition.startValue && end_value == null && condition.startValue != null) {
+ Debugger.log("4", Debugger.CRITICAL, "validateLongCondition", "ToolOutputConditionsDialog");
+
+ LFMessage.showMessageAlert(Dictionary.getValue("to_condition_invalid_value_range", [Dictionary.getValue("to_condition_end_value")]), null);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private function itemChanged(evt:Object):Void {
+ if(_selectedIndex == _toolOutputDefin_cmb.selectedIndex)
+ return;
+
+ _toolOutputLongOptions_cmb.selectedIndex = 0;
+
+ if(app.getCanvas().ddm.hasBranchMappingsForConditionSet(_condition_item_dgd.dataProvider) && evt != null && _toolOutputDefin_cmb.selectedIndex != 0) {
+ LFMessage.showMessageConfirm(Dictionary.getValue("branch_mapping_dlg_condition_linked_msg", [Dictionary.getValue("branch_mapping_dlg_condition_linked_all")]), Proxy.create(this, removeAllItems, true), Proxy.create(this, returnDefinitionState), Dictionary.getValue("al_continue"), null);
} else if(evt != null) removeAllItems(true);
else selectDefinition();
-
- }
-
-
- private function optionChanged(evt:Object):Void {
- if(_selectedOptionIndex == _toolOutputLongOptions_cmb.selectedIndex && _selectedOptionIndex != null)
- return;
-
- selectOption();
- }
-
- private function selectOption():Void {
- _selectedOption = _toolOutputLongOptions_cmb.dataProvider[_toolOutputLongOptions_cmb.selectedIndex];
-
- add_btn.enabled = true;
-
- if(_selectedOption.data == OPTION_GTE) {
- showSteppers(true, false);
- } else if(_selectedOption.data == OPTION_LTE) {
- showSteppers(true, false);
- } else if(_selectedOption.data == OPTION_RANGE) {
- showSteppers(true, true);
- } else {
- showSteppers(false, false);
- add_btn.enabled = false;
- }
-
- _selectedOptionIndex = _toolOutputLongOptions_cmb.selectedIndex;
- }
-
- private function selectDefinition():Void {
-
- _selectedDefinition = _toolOutputDefin_cmb.dataProvider[_toolOutputDefin_cmb.selectedIndex];
- Debugger.log("select definition: " + _selectedDefinition.description, Debugger.CRITICAL, "selectDefinition", "ToolOutputConditionsDialog");
-
- if(_selectedDefinition.showConditionNameOnly)
- addConditionItemColumns(true);
- else if(_condition_item_dgd.getColumnAt(1) == null)
- addConditionItemColumns(false);
-
-
- switch(_selectedDefinition.type) {
- case ToolOutputDefinition.LONG:
- _condition_item_dgd.visible = true;
-
- if(_selectedDefinition.defaultConditions.length > 0) {
- add_btn.visible = false;
- remove_item_btn.visible = false;
- clear_all_btn.visible = false;
-
- refresh_btn.visible = true;
-
- _toolOutputLongOptions_cmb.visible = false;
-
- showSteppers(false, false);
- addDefaultConditions(_selectedDefinition.defaultConditions);
-
- } else {
- add_btn.visible = true;
- remove_item_btn.visible = true;
- clear_all_btn.visible = true;
-
- refresh_btn.visible = false;
-
- _toolOutputLongOptions_cmb.visible = true;
-
- optionChanged();
-
- _start_value_stp.minimum = (_selectedDefinition.startValue != null) ? Number(_selectedDefinition.startValue) : STP_MIN;
- _end_value_stp.minimum = (_selectedDefinition.startValue != null) ? Number(_selectedDefinition.startValue) : STP_MIN;
- _start_value_stp.maximum = (_selectedDefinition.endValue != null) ? Number(_selectedDefinition.endValue) : STP_MAX;
- _end_value_stp.maximum = (_selectedDefinition.endValue != null) ? Number(_selectedDefinition.endValue) : STP_MAX;
-
- _start_value_stp.value = (_selectedDefinition.startValue != null) ? Number(_selectedDefinition.startValue) : STP_MIN;
- _end_value_stp.value = (_selectedDefinition.endValue != null) ? Number(_selectedDefinition.endValue) : STP_MIN;
- }
-
- break;
-
- case ToolOutputDefinition.BOOL:
- _condition_item_dgd.visible = true;
- _toolOutputLongOptions_cmb.visible = false;
-
- add_btn.visible = false;
- remove_item_btn.visible = false;
- clear_all_btn.visible = false;
-
- refresh_btn.visible = false;
-
- showSteppers(false, false);
-
- addDefaultConditions(_selectedDefinition.defaultConditions);
-
- break;
- case ToolOutputDefinition.COMPLEX:
- _condition_item_dgd.visible = true;
- _toolOutputLongOptions_cmb.visible = false;
- add_btn.visible = false;
- remove_item_btn.visible = false;
- clear_all_btn.visible = false;
-
- refresh_btn.visible = true;
-
- showSteppers(false, false);
-
- addDefaultConditions(_selectedDefinition.defaultConditions); // _selectedDefinition object the same when working/not working
- break;
- case ToolOutputDefinition.USER_DEFINED:
- _condition_item_dgd.visible = true;
- _toolOutputLongOptions_cmb.visible = false;
-
- add_btn.visible = false;
- remove_item_btn.visible = false;
- clear_all_btn.visible = false;
-
- refresh_btn.visible = true;
-
- showSteppers(false, false);
-
- addDefaultConditions(_selectedDefinition.defaultConditions);
-
- break;
- default:
- showElements(false);
- _toolOutputLongOptions_cmb.selectedIndex = 0;
- Debugger.log("type not found", Debugger.GEN, "itemChanged", "ToolOutputConditionsDialog");
-
- }
-
- _selectedIndex = _toolOutputDefin_cmb.selectedIndex;
-
- }
-
- private function addDefaultConditions(defaultConditions:Array):Void {
- var ddm = app.getCanvas().ddm;
-
- defaultConditions.sortOn("orderID", Array.NUMERIC);
-
- if(_condition_item_dgd.dataProvider.length <= 0) {
- for(var i=0; i 0) {
+ add_btn.visible = false;
+ remove_item_btn.visible = false;
+ clear_all_btn.visible = false;
+
+ refresh_btn.visible = true;
+
+ _toolOutputLongOptions_cmb.visible = false;
+
+ showSteppers(false, false);
+ addDefaultConditions(_selectedDefinition.defaultConditions);
+
+ } else {
+ add_btn.visible = true;
+ remove_item_btn.visible = true;
+ clear_all_btn.visible = true;
+
+ refresh_btn.visible = false;
+
+ _toolOutputLongOptions_cmb.visible = true;
+
+ optionChanged();
+
+ _start_value_stp.minimum = (_selectedDefinition.startValue != null) ? Number(_selectedDefinition.startValue) : STP_MIN;
+ _end_value_stp.minimum = (_selectedDefinition.startValue != null) ? Number(_selectedDefinition.startValue) : STP_MIN;
+ _start_value_stp.maximum = (_selectedDefinition.endValue != null) ? Number(_selectedDefinition.endValue) : STP_MAX;
+ _end_value_stp.maximum = (_selectedDefinition.endValue != null) ? Number(_selectedDefinition.endValue) : STP_MAX;
+
+ _start_value_stp.value = (_selectedDefinition.startValue != null) ? Number(_selectedDefinition.startValue) : STP_MIN;
+ _end_value_stp.value = (_selectedDefinition.endValue != null) ? Number(_selectedDefinition.endValue) : STP_MIN;
+ }
+
+ break;
+
+ case ToolOutputDefinition.BOOL:
+ _condition_item_dgd.visible = true;
+ _toolOutputLongOptions_cmb.visible = false;
+
+ add_btn.visible = false;
+ remove_item_btn.visible = false;
+ clear_all_btn.visible = false;
+
+ refresh_btn.visible = false;
+
+ showSteppers(false, false);
+
+ addDefaultConditions(_selectedDefinition.defaultConditions);
+
+ break;
+ case ToolOutputDefinition.COMPLEX:
+ _condition_item_dgd.visible = true;
+ _toolOutputLongOptions_cmb.visible = false;
+ add_btn.visible = false;
+ remove_item_btn.visible = false;
+ clear_all_btn.visible = false;
+
+ refresh_btn.visible = true;
+
+ showSteppers(false, false);
+
+ addDefaultConditions(_selectedDefinition.defaultConditions); // _selectedDefinition object the same when working/not working
+ break;
+ case ToolOutputDefinition.USER_DEFINED:
+ _condition_item_dgd.visible = true;
+ _toolOutputLongOptions_cmb.visible = false;
+
+ add_btn.visible = false;
+ remove_item_btn.visible = false;
+ clear_all_btn.visible = false;
+
+ refresh_btn.visible = true;
+
+ showSteppers(false, false);
+
+ addDefaultConditions(_selectedDefinition.defaultConditions);
+
+ break;
+ default:
+ showElements(false);
+ _toolOutputLongOptions_cmb.selectedIndex = 0;
+ Debugger.log("type not found", Debugger.GEN, "itemChanged", "ToolOutputConditionsDialog");
+
+ }
+
+ _selectedIndex = _toolOutputDefin_cmb.selectedIndex;
+
+ }
+
+ private function addDefaultConditions(defaultConditions:Array):Void {
+ var ddm = app.getCanvas().ddm;
+
+ defaultConditions.sortOn("orderID", Array.NUMERIC);
+
+ if(_condition_item_dgd.dataProvider.length <= 0) {
+ for(var i=0; i 0) {
- var errorPacket = new Object();
- errorPacket.messages = errors;
-
- var msg:String = Dictionary.getValue('cv_invalid_design_on_apply_changes');
- 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, callback:Function):Boolean{
- _global.breakpoint();
-
- if (canvasModel.activitiesDisplayed.size() < 1){
- Cursor.showCursor(Application.C_DEFAULT);
- var msg:String = Dictionary.getValue('al_empty_design');
- LFMessage.showMessageAlert(msg);
- return;
- }
-
- 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');
-
- if(_ddm.hasRedundantBranchMappings(false)) {
- Cursor.showCursor(Application.C_DEFAULT);
- LFMessage.showMessageConfirm(Dictionary.getValue("redundant_branch_mappings_msg"), Proxy.create(_ddm, _ddm.removeRedundantBranchMappings, Proxy.create(this, saveDesignToServer, workspaceResultDTO)), null, Dictionary.getValue("al_continue"), null);
- } else {
- var dto:Object = _ddm.getDesignForSaving();
- var groupingUIID:Number = null;
-
- if((groupingUIID = validateGroupings()) != null) {
- Cursor.showCursor(Application.C_DEFAULT);
- LFMessage.showMessageAlert(Dictionary.getValue('grouping_invalid_with_common_names_msg', [_ddm.getGroupingActivityByGroupingUIID(groupingUIID).title]), null);
- return false;
- } else {
- var callback:Function = Proxy.create(this,onStoreDesignResponse, callback);
-
- Application.getInstance().getComms().sendAndReceive(dto,"servlet/authoring/storeLearningDesignDetails",callback,false);
- }
- }
-
- return true;
- }
-
- /**
- * 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, callback:Function):Void{
- 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{
- 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);
- LFMenuBar.getInstance().enableInsertDesign(true);
-
- Debugger.log('_ddm.learningDesignID:'+_ddm.learningDesignID,Debugger.GEN,'onStoreDesignResponse','Canvas');
-
-
- if(_ddm.validDesign){
- 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});
-
- } 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');
- var okHandler = Proxy.create(this,showDesignValidationIssues,r);
- LFMessage.showMessageConfirm(msg,okHandler,null,Dictionary.getValue('cv_show_validation'));
- }
-
- checkValidDesign();
- checkReadOnlyDesign();
- Cursor.showCursor(Application.C_DEFAULT);
-
- if(callback) callback();
- }
- }
-
- private function validateGroupings():Number {
- var keys:Array = _ddm.groupings.keys();
- var currentGrouping:Grouping = null;
-
- for(var i=0; i 1) canvasModel.createSequenceTransition(sequence.lastActivity, actToAdd);
- else ComplexActivity(sequenceAct).firstActivityUIID = actToAdd.activityUIID;
-
- if(!(canvasModel.activeView instanceof CanvasComplexView)) {
- canvasModel.removeActivity(sequenceAct.parentUIID);
- }
- }
-
- actToAdd.parentUIID = taParent;
-
- if(!(canvasModel.activeView instanceof CanvasComplexView)) {
- canvasModel.removeActivity(taParent);
- canvasModel.removeActivity(actToAdd.activityUIID);
- } else {
- canvasModel.activeView.updateActivity();
- }
-
- canvasModel.setDirty();
- }
-
- canvasModel.haltRefresh(false);
-
- //refresh the design
- canvasModel.setDirty();
- canvasModel.selectedItem = (canvasModel.activitiesDisplayed.get(actToAdd.activityUIID));
-
-
- }
-
- /**
- * Revert canvas back to last saved design
- *
- * @usage
- * @return
- */
-
- public function revertCanvas():Boolean {
- // can only revert canvas if design is saved
- if(_ddm.learningDesignID != null) {
-
- openDesignForEditOnFly(_ddm.learningDesignID);
-
- } else {
- // throw error alert
- return false;
- }
- }
-
-
- /**
- * Returns canvas to init state, ready for new design
- * @usage
- * @param noWarn
- * @return
- */
- public function resetCanvas(noWarn:Boolean):Boolean{
- _undoStack = new Array();
- _redoStack = new Array();
-
- var r = clearCanvas(noWarn);
-
- return r;
-
- }
-
- /**
- * Opens a design using workspace and user to select design ID
- * passes the callback function to recieve selected ID
- */
- public function openDesignBySelection(mode:String, confirm:Boolean){
- //Work space opens dialog and user will select view
- if(mode == Workspace.MODE_INSERT && !confirm) {
- LFMessage.showMessageConfirm(Dictionary.getValue("cv_design_insert_warning"), Proxy.create(this, openDesignBySelection, mode, true), null, null, null, Dictionary.getValue('cv_autosave_rec_title'));
- return;
- }
-
- if(_ddm.modified || (mode == Workspace.MODE_INSERT && _ddm.modified && (_ddm.learningDesignID != null))) {
- if(_ddm.editOverrideLock) LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved_live_edit'), Proxy.create(this, doOpenDesignBySelection, mode, true), null);
- else LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doOpenDesignBySelection, mode), null);
- } else {
- doOpenDesignBySelection(mode);
- }
- }
-
- public function doOpenDesignBySelection(mode:String, autoSave:Boolean):Void{
- var callback:Function = Proxy.create(this, openDesignById, autoSave);
-
- var ws = Application.getInstance().getWorkspace();
- ws.userSelectItem(callback, mode);
- }
-
- /**
- * Request design from server using supplied ID.
- * @usage
- * @param designId
- * @return
- */
- public function openDesignById(workspaceResultDTO:Object, autoSave:Boolean){
- if(autoSave) {
- saveDesignToServer(null, Proxy.create(this, openDesignById, workspaceResultDTO, false));
- return;
- }
-
- Application.getInstance().getWorkspace().getWV().clearDialog();
- ObjectUtils.toString(workspaceResultDTO);
-
- var designId:Number = workspaceResultDTO.selectedResourceID;
- var mode:String = Application.getInstance().getWorkspace().getWorkspaceModel().currentMode;
-
- if(mode != Workspace.MODE_INSERT) {
- var callback:Function = Proxy.create(this,setDesign);
- Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designId,callback, false);
- } else {
- var dataToSend:Object = getInsertPacket(workspaceResultDTO, false); // for now only using Case 1 Insert Learning Design Servlet See Authoring Flash To Java Communications
- var callback:Function = Proxy.create(this, onInsertDesignResponse);
-
- if (_root.customCSV != null) {
- dataToSend.customCSV = _root.customCSV;
- }
-
- Application.getInstance().getComms().sendAndReceive(dataToSend,"servlet/authoring/insertLearningDesign", callback, false);
- }
- }
-
- private function getInsertPacket(workspaceResultDTO:Object, createNewDesign:Boolean):Object {
- var packet = new Object();
- packet.learningDesignID = _ddm.learningDesignID;
- packet.learningDesignIDToImport = workspaceResultDTO.selectedResourceID;
- packet.createNewLearningDesign = createNewDesign;
-
- if(createNewDesign) {
- packet.workspaceFolderID = workspaceResultDTO.targetWorkspaceFolderID;
- packet.title = workspaceResultDTO.resourceName;
- }
-
- return packet;
- }
-
- public function onInsertDesignResponse(r):Void {
-
- if(r instanceof LFError){
- Cursor.showCursor(Application.C_DEFAULT);
- r.showErrorAlert();
- } else {
- openDesignByImport(r);
- }
- }
-
- /**
- * 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);
-
- }
-
- public function getToolOutputDefinitions(ta:ToolActivity) {
- var callback:Function;
-
- if(ta.toolContentID) {
- callback = Proxy.create(this, setToolOutputDefinitions, ta);
- Application.getInstance().getComms().getRequest('authoring/author.do?method=getToolOutputDefinitions&toolContentID='+ta.toolContentID, callback, false);
- } else {
- callback = Proxy.create(this, setToolContentForDefinitions, ta);
- canvasModel.getNewToolContentID(ta, callback);
- }
-
- }
-
- public function setToolContentForDefinitions(toolContentID:Number, ta:ToolActivity):Void {
- ta.toolContentID = toolContentID;
-
- getToolOutputDefinitions(ta);
- }
-
- public function setToolOutputDefinitions(r:Object, toolActivity:ToolActivity) {
- if(r instanceof LFError){
- Cursor.showCursor(Application.C_DEFAULT);
- r.showErrorAlert();
- }
-
- if(r.length > 0) {
- for(var i=0; i < r.length; i++) {
- Debugger.log("adding def: " + r[i].name + " desc: " + r[i].description, Debugger.CRITICAL, "setToolOutputDefinitions", "Canvas");
- toolActivity.addDefinition(r[i]);
- }
- }
-
- canvasModel.broadcastViewUpdate("OPEN_CONDITIONS_DIALOG", toolActivity);
- Debugger.log("total def: " + toolActivity.definitions.length, Debugger.CRITICAL, "setToolOutputDefinitions", "Canvas");
-
- }
-
- /**
- * Called from the toolbar usually - starts or stops the gate tool
- * @usage
- * @return
- */
- public function toggleGroupTool():Void{
- var c:String = Cursor.getCurrentCursor();
- if(c==ApplicationParent.C_GROUP){
- stopGroupTool();
- }else{
- startGroupTool();
- }
- }
-
- public function toggleBranchTool():Void{
- var c:String = Cursor.getCurrentCursor();
- if(c==ApplicationParent.C_BRANCH){
- stopBranchTool();
- }else{
- startBranchTool();
- }
- }
-
- public function toggleGateTool():Void{
- var c:String = Cursor.getCurrentCursor();
- if(c==ApplicationParent.C_GATE){
- stopGateTool();
- }else{
- startGateTool();
- }
- }
-
- public function toggleOptionalActivity():Void{
- var c:String = Cursor.getCurrentCursor();
- if(c==ApplicationParent.C_OPTIONAL){
- stopOptionalActivity();
- }else{
- startOptionalActivity(false);
- }
- }
-
- public function toggleOptionalSequenceActivity():Void{
- var c:String = Cursor.getCurrentCursor();
- if(c==ApplicationParent.C_OPTIONAL){
- stopOptionalActivity();
- }else{
- startOptionalActivity(true);
- }
- }
-
- public function toggleTransitionTool():Void{
- Debugger.log('Switch on Transition Tool', Debugger.GEN,'toogleTransitionTool','Canvas');
- var c:String = Cursor.getCurrentCursor();
- Debugger.log('Current Cursor: ' + c, Debugger.GEN, 'toogleTransitionTool', 'Canvas');
-
- if(c==ApplicationParent.C_TRANSITION) {
- stopTransitionTool();
- } else {
- startTransitionTool();
- }
-
- }
-
- public function stopActiveTool(){
- Debugger.log('Stopping Active Tool: ' + canvasModel.activeTool, Debugger.GEN,'stopActiveTool','Canvas');
- switch(canvasModel.activeTool){
- case CanvasModel.GATE_TOOL :
- stopGateTool();
- break;
- case CanvasModel.OPTIONAL_TOOL :
- stopOptionalActivity();
- break;
- case CanvasModel.GROUP_TOOL :
- stopGroupTool();
- break;
- case CanvasModel.TRANSITION_TOOL :
- stopTransitionTool();
- break;
- case CanvasModel.BRANCH_TOOL :
- stopBranchTool();
- break;
- default :
- Debugger.log('No tool active. Setting Default.', Debugger.GEN,'stopActiveTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- canvasModel.activeTool = "none";
-
- }
- }
-
- public function startGateTool(){
- Debugger.log('Starting gate tool',Debugger.GEN,'startGateTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_GATE);
- canvasModel.activeTool = CanvasModel.GATE_TOOL;
- }
-
- public function stopGateTool(){
- Debugger.log('Stopping gate tool',Debugger.GEN,'stopGateTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- canvasModel.activeTool = "none";
- }
-
-
- public function startOptionalActivity(isSequence:Boolean){
- Debugger.log('Starting Optioanl Activity',Debugger.GEN,'startOptionalActivity','Canvas');
- Cursor.showCursor(ApplicationParent.C_OPTIONAL);
-
- canvasModel.activeTool = (isSequence) ? CanvasModel.OPTIONAL_SEQ_TOOL : CanvasModel.OPTIONAL_TOOL;
- }
-
- public function stopOptionalActivity(){
- Debugger.log('Stopping Optioanl Activity',Debugger.GEN,'stopOptionalActivity','Canvas');
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- canvasModel.activeTool = "none";
- }
- public function startGroupTool(){
- Debugger.log('Starting group tool',Debugger.GEN,'startGateTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_GROUP);
- canvasModel.activeTool = CanvasModel.GROUP_TOOL;
- }
-
- public function stopGroupTool(){
- Debugger.log('Stopping group tool',Debugger.GEN,'startGateTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- canvasModel.activeTool = "none";
- }
-
- public function startBranchTool(){
- Debugger.log('Starting branch tool',Debugger.GEN,'startGateTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_BRANCH);
- canvasModel.activeTool = CanvasModel.BRANCH_TOOL;
- }
-
- public function stopBranchTool(){
- Debugger.log('Stopping branch tool',Debugger.GEN,'startBranchTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- canvasModel.activeTool = "none";
- }
-
- /**
- * Called by the top menu bar and the tool bar to start the transition tool, switches cursor.
- * @usage
- * @return
- */
- public function startTransitionTool():Void{
- Debugger.log('Starting transition tool',Debugger.GEN,'startTransitionTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_TRANSITION);
- canvasModel.lockAllComplexActivities();
- canvasModel.startTransitionTool();
-
- }
-
- /**
- * Called by the top menu bar and the tool bar to stop the transition tool, switches cursor.
- * @usage
- * @return
- */
- public function stopTransitionTool():Void{
- Debugger.log('Stopping transition tool',Debugger.GEN,'stopTransitionTool','Canvas');
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- canvasModel.unlockAllComplexActivities();
- canvasModel.stopTransitionTool();
- }
-
- /**
- * Method to open Preview popup window.
- */
- public function launchPreviewWindow():Void{
- if(_ddm.validDesign){
- Debugger.log('Launching Preview Window (initialising)',Debugger.GEN,'launchPreviewWindow','Canvas');
- var callback:Function = Proxy.create(this,onInitPreviewResponse);
- Application.getInstance().getComms().sendAndReceive(_ddm.getDataForPreview(Dictionary.getValue('preview_btn'), null), "monitoring/initializeLesson", callback, false)
- }
- }
-
- public function onInitPreviewResponse(r):Void{
- if(r instanceof LFError) {
- r.showMessageConfirm();
- } else {
- Debugger.log('Launching Preview Window (starting lesson ' + r + ')',Debugger.GEN,'onInitPreviewResponse','Canvas');
- var callback:Function = Proxy.create(this,onLaunchPreviewResponse);
- Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=startPreviewLesson&lessonID='+r,callback, false);
- }
- }
-
- /**
- * now contains a Lession ID response from wddx packet
- * Returns the lessionID to send it to popup method in JsPopup .
- * @usage http://localhost:8080/lams/learning/learner.do?method=joinLesson&userId=4&lessonId=12
- * @param r //the validation response
- * @return
- */
- public function onLaunchPreviewResponse(r):Void{
- if(r instanceof LFError){
- r.showMessageConfirm();
- }else{
- var uID = Config.getInstance().userID;
- var serverUrl = Config.getInstance().serverUrl;
-
- // open preview in new window
- ApplicationParent.extCall("openPreview", r);
- Debugger.log('Recieved Lesson ID: '+r ,Debugger.GEN,'onLaunchPreviewResponse','Canvas');
- }
- }
-
- /**
- * Method to open Import popup window
- */
- public function launchImportWindow():Void{
- Debugger.log('Launching Import Window',Debugger.GEN,'launchImportWindow','Canvas');
- if(_ddm.modified){
- LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doImportLaunch), null);
- } else {
- doImportLaunch();
- }
- }
-
- public function doImportLaunch():Void{
- var serverUrl = Config.getInstance().serverUrl;
- var importActionUrl:String = appendCustomCSVIfExists(serverUrl+'authoring/importToolContent.do?method=import');
- JsPopup.getInstance().launchPopupWindow(importActionUrl, 'Import', 298, 800, true, true, false, false, false);
- }
-
- /**
- * Method to open Export popup window
- */
- public function launchExportWindow():Void{
- Debugger.log('Launching Export Window',Debugger.GEN,'launchExportWindow','Canvas');
-
- if(_ddm.learningDesignID == null) {
- LFMessage.showMessageAlert(Dictionary.getValue('cv_design_export_unsaved'), null);
- }else if(_ddm.modified){
- LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doExportLaunch), null);
- } else {
- doExportLaunch();
- }
-
- }
-
- public function doExportLaunch():Void{
- var serverUrl = Config.getInstance().serverUrl;
- var learningDesignID = _ddm.learningDesignID;
- JsPopup.getInstance().launchPopupWindow(serverUrl+'authoring/exportToolContent.do?learningDesignID=' + learningDesignID, 'Export', 298, 712, true, true, false, false, false);
- }
-
- /**
- * 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{
- canvasModel.setSize(width, height);
- }
-
- public function addBin(target:MovieClip) {
- if(_bin != null) hideBin();
-
- var cc:CanvasController = canvasView.getController();
- _bin = target.attachMovie("Bin", "Bin", target.getNextHighestDepth(), {_canvasController:cc, _targetView:target});
- }
-
- public function hideBin():Void{
- _bin.removeMovieClip();
- }
-
- /**
- * Undo the last change to the DDM.
- * TODO: Does not handle moving activities on the canvas, only when actual change to activities or transitions.
- * Need to generate update event when re-position activities
- * @usage
- * @return
- */
- public function undo():Void{
-
- if(_undoStack.length>0){
- //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 + ": " + ca.activity.helpURL, Debugger.GEN, 'getHelp', 'Canvas');
-
- ApplicationParent.extCall("openURL", ca.activity.helpURL + app.module);
-
- } else {
- if (ca.activity.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE){
- var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GROUP);
- 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, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GATE);
- app.getHelpURL(callback);
- } else if(ca.activity.isBranchingActivity()) {
- var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_BRANCHING);
- app.getHelpURL(callback);
- }else {
- LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_helpURL_undefined', [ca.activity.toolDisplayName]));
- }
- }
- }
-
- private function openSystemToolHelp(url:String, toolSignature:String){
- var target:String = toolSignature + app.module;
- var newURL:String = ApplicationParent.addLocaleToURL(url);
-
- ApplicationParent.extCall("openURL", newURL + 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 taWidth():Number{
- return toolActWidth
- }
-
- public function get taHeight():Number{
- return toolActHeight
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function get bin ():MovieClip {
- return _bin;
- }
-
- public function get className():String{
- return 'Canvas';
- }
-}
+/***************************************************************************
+ * 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.br.*
+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.style.*
+import org.lamsfoundation.lams.common.ws.Workspace
+import org.lamsfoundation.lams.common.ApplicationParent
+import org.lamsfoundation.lams.common.*
+
+import mx.managers.*
+import mx.utils.*
+import mx.transitions.Tween;
+import mx.transitions.easing.*;
+
+/**
+ * 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 Canvas extends CanvasHelper {
+
+ //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){
+ super();
+ mx.events.EventDispatcher.initialize(this);
+
+ _target_mc = target_mc;
+
+ //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);
+
+ }
+
+ 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');
+ 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, callback:Function):Boolean{
+ _global.breakpoint();
+
+ if (canvasModel.activitiesDisplayed.size() < 1){
+ Cursor.showCursor(Application.C_DEFAULT);
+ var msg:String = Dictionary.getValue('al_empty_design');
+ LFMessage.showMessageAlert(msg);
+ return;
+ }
+
+ 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');
+
+ if(_ddm.hasRedundantBranchMappings(false)) {
+ Cursor.showCursor(Application.C_DEFAULT);
+ LFMessage.showMessageConfirm(Dictionary.getValue("redundant_branch_mappings_msg"), Proxy.create(_ddm, _ddm.removeRedundantBranchMappings, Proxy.create(this, saveDesignToServer, workspaceResultDTO)), null, Dictionary.getValue("al_continue"), null);
+ } else {
+ var dto:Object = _ddm.getDesignForSaving();
+ var groupingUIID:Number = null;
+
+ if((groupingUIID = validateGroupings()) != null) {
+ Cursor.showCursor(Application.C_DEFAULT);
+ LFMessage.showMessageAlert(Dictionary.getValue('grouping_invalid_with_common_names_msg', [_ddm.getGroupingActivityByGroupingUIID(groupingUIID).title]), null);
+ return false;
+ } else {
+ var callback:Function = Proxy.create(this,onStoreDesignResponse, callback);
+
+ Application.getInstance().getComms().sendAndReceive(dto,"servlet/authoring/storeLearningDesignDetails",callback,false);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * 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, callback:Function):Void{
+ 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{
+ 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);
+ LFMenuBar.getInstance().enableInsertDesign(true);
+
+ Debugger.log('_ddm.learningDesignID:'+_ddm.learningDesignID,Debugger.GEN,'onStoreDesignResponse','Canvas');
+
+
+ if(_ddm.validDesign){
+ 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});
+
+ } 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');
+ var okHandler = Proxy.create(this,showDesignValidationIssues,r);
+ LFMessage.showMessageConfirm(msg,okHandler,null,Dictionary.getValue('cv_show_validation'));
+ }
+
+ checkValidDesign();
+ checkReadOnlyDesign();
+ Cursor.showCursor(Application.C_DEFAULT);
+
+ if(callback) callback();
+ }
+ }
+
+ private function validateGroupings():Number {
+ var keys:Array = _ddm.groupings.keys();
+ var currentGrouping:Grouping = null;
+
+ for(var i=0; i 1) canvasModel.createSequenceTransition(sequence.lastActivity, actToAdd);
+ else ComplexActivity(sequenceAct).firstActivityUIID = actToAdd.activityUIID;
+
+ if(!(canvasModel.activeView instanceof CanvasComplexView)) {
+ canvasModel.removeActivity(sequenceAct.parentUIID);
+ }
+ }
+
+ actToAdd.parentUIID = taParent;
+
+ if(!(canvasModel.activeView instanceof CanvasComplexView)) {
+ canvasModel.removeActivity(taParent);
+ canvasModel.removeActivity(actToAdd.activityUIID);
+ } else {
+ canvasModel.activeView.updateActivity();
+ }
+
+ canvasModel.setDirty();
+ }
+
+ canvasModel.haltRefresh(false);
+
+ //refresh the design
+ canvasModel.setDirty();
+ canvasModel.selectedItem = (canvasModel.activitiesDisplayed.get(actToAdd.activityUIID));
+
+
+ }
+
+ /**
+ * Revert canvas back to last saved design
+ *
+ * @usage
+ * @return
+ */
+
+ public function revertCanvas():Boolean {
+ // can only revert canvas if design is saved
+ if(_ddm.learningDesignID != null) {
+
+ openDesignForEditOnFly(_ddm.learningDesignID);
+
+ } else {
+ // throw error alert
+ return false;
+ }
+ }
+
+
+ /**
+ * Returns canvas to init state, ready for new design
+ * @usage
+ * @param noWarn
+ * @return
+ */
+ public function resetCanvas(noWarn:Boolean):Boolean{
+ _undoStack = new Array();
+ _redoStack = new Array();
+
+ var r = clearCanvas(noWarn);
+
+ return r;
+
+ }
+
+ /**
+ * Opens a design using workspace and user to select design ID
+ * passes the callback function to recieve selected ID
+ */
+ public function openDesignBySelection(mode:String, confirm:Boolean){
+ //Work space opens dialog and user will select view
+ if(mode == Workspace.MODE_INSERT && !confirm) {
+ LFMessage.showMessageConfirm(Dictionary.getValue("cv_design_insert_warning"), Proxy.create(this, openDesignBySelection, mode, true), null, null, null, Dictionary.getValue('cv_autosave_rec_title'));
+ return;
+ }
+
+ if(_ddm.modified || (mode == Workspace.MODE_INSERT && _ddm.modified && (_ddm.learningDesignID != null))) {
+ if(_ddm.editOverrideLock) LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved_live_edit'), Proxy.create(this, doOpenDesignBySelection, mode, true), null);
+ else LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doOpenDesignBySelection, mode), null);
+ } else {
+ doOpenDesignBySelection(mode);
+ }
+ }
+
+ public function doOpenDesignBySelection(mode:String, autoSave:Boolean):Void{
+ var callback:Function = Proxy.create(this, openDesignById, autoSave);
+
+ var ws = Application.getInstance().getWorkspace();
+ ws.userSelectItem(callback, mode);
+ }
+
+ /**
+ * Request design from server using supplied ID.
+ * @usage
+ * @param designId
+ * @return
+ */
+ public function openDesignById(workspaceResultDTO:Object, autoSave:Boolean){
+ if(autoSave) {
+ saveDesignToServer(null, Proxy.create(this, openDesignById, workspaceResultDTO, false));
+ return;
+ }
+
+ Application.getInstance().getWorkspace().getWV().clearDialog();
+ ObjectUtils.toString(workspaceResultDTO);
+
+ var designId:Number = workspaceResultDTO.selectedResourceID;
+ var mode:String = Application.getInstance().getWorkspace().getWorkspaceModel().currentMode;
+
+ if(mode != Workspace.MODE_INSERT) {
+ var callback:Function = Proxy.create(this,setDesign);
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designId,callback, false);
+ } else {
+ var dataToSend:Object = getInsertPacket(workspaceResultDTO, false); // for now only using Case 1 Insert Learning Design Servlet See Authoring Flash To Java Communications
+ var callback:Function = Proxy.create(this, onInsertDesignResponse);
+
+ if (_root.customCSV != null) {
+ dataToSend.customCSV = _root.customCSV;
+ }
+
+ Application.getInstance().getComms().sendAndReceive(dataToSend,"servlet/authoring/insertLearningDesign", callback, false);
+ }
+ }
+
+ private function getInsertPacket(workspaceResultDTO:Object, createNewDesign:Boolean):Object {
+ var packet = new Object();
+ packet.learningDesignID = _ddm.learningDesignID;
+ packet.learningDesignIDToImport = workspaceResultDTO.selectedResourceID;
+ packet.createNewLearningDesign = createNewDesign;
+
+ if(createNewDesign) {
+ packet.workspaceFolderID = workspaceResultDTO.targetWorkspaceFolderID;
+ packet.title = workspaceResultDTO.resourceName;
+ }
+
+ return packet;
+ }
+
+ public function onInsertDesignResponse(r):Void {
+
+ if(r instanceof LFError){
+ Cursor.showCursor(Application.C_DEFAULT);
+ r.showErrorAlert();
+ } else {
+ openDesignByImport(r);
+ }
+ }
+
+ /**
+ * 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);
+
+ }
+
+ public function getToolOutputDefinitions(ta:ToolActivity) {
+ var callback:Function;
+
+ if(ta.toolContentID) {
+ callback = Proxy.create(this, setToolOutputDefinitions, ta);
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getToolOutputDefinitions&toolContentID='+ta.toolContentID, callback, false);
+ } else {
+ callback = Proxy.create(this, setToolContentForDefinitions, ta);
+ canvasModel.getNewToolContentID(ta, callback);
+ }
+
+ }
+
+ public function setToolContentForDefinitions(toolContentID:Number, ta:ToolActivity):Void {
+ ta.toolContentID = toolContentID;
+
+ getToolOutputDefinitions(ta);
+ }
+
+ public function setToolOutputDefinitions(r:Object, toolActivity:ToolActivity) {
+ if(r instanceof LFError){
+ Cursor.showCursor(Application.C_DEFAULT);
+ r.showErrorAlert();
+ }
+
+ if(r.length > 0) {
+ for(var i=0; i < r.length; i++) {
+ Debugger.log("adding def: " + r[i].name + " desc: " + r[i].description, Debugger.CRITICAL, "setToolOutputDefinitions", "Canvas");
+ toolActivity.addDefinition(r[i]);
+ }
+ }
+
+ canvasModel.broadcastViewUpdate("OPEN_CONDITIONS_DIALOG", toolActivity);
+ Debugger.log("total def: " + toolActivity.definitions.length, Debugger.CRITICAL, "setToolOutputDefinitions", "Canvas");
+
+ }
+
+ /**
+ * Called from the toolbar usually - starts or stops the gate tool
+ * @usage
+ * @return
+ */
+ public function toggleGroupTool():Void{
+ var c:String = Cursor.getCurrentCursor();
+ if(c==ApplicationParent.C_GROUP){
+ stopGroupTool();
+ }else{
+ startGroupTool();
+ }
+ }
+
+ public function toggleBranchTool():Void{
+ var c:String = Cursor.getCurrentCursor();
+ if(c==ApplicationParent.C_BRANCH){
+ stopBranchTool();
+ }else{
+ startBranchTool();
+ }
+ }
+
+ public function toggleGateTool():Void{
+ var c:String = Cursor.getCurrentCursor();
+ if(c==ApplicationParent.C_GATE){
+ stopGateTool();
+ }else{
+ startGateTool();
+ }
+ }
+
+ public function toggleOptionalActivity():Void{
+ var c:String = Cursor.getCurrentCursor();
+ if(c==ApplicationParent.C_OPTIONAL){
+ stopOptionalActivity();
+ }else{
+ startOptionalActivity(false);
+ }
+ }
+
+ public function toggleOptionalSequenceActivity():Void{
+ var c:String = Cursor.getCurrentCursor();
+ if(c==ApplicationParent.C_OPTIONAL){
+ stopOptionalActivity();
+ }else{
+ startOptionalActivity(true);
+ }
+ }
+
+ public function toggleTransitionTool():Void{
+ Debugger.log('Switch on Transition Tool', Debugger.GEN,'toogleTransitionTool','Canvas');
+ var c:String = Cursor.getCurrentCursor();
+ Debugger.log('Current Cursor: ' + c, Debugger.GEN, 'toogleTransitionTool', 'Canvas');
+
+ if(c==ApplicationParent.C_TRANSITION) {
+ stopTransitionTool();
+ } else {
+ startTransitionTool();
+ }
+
+ }
+
+ public function stopActiveTool(){
+ Debugger.log('Stopping Active Tool: ' + canvasModel.activeTool, Debugger.GEN,'stopActiveTool','Canvas');
+ switch(canvasModel.activeTool){
+ case CanvasModel.GATE_TOOL :
+ stopGateTool();
+ break;
+ case CanvasModel.OPTIONAL_TOOL :
+ stopOptionalActivity();
+ break;
+ case CanvasModel.GROUP_TOOL :
+ stopGroupTool();
+ break;
+ case CanvasModel.TRANSITION_TOOL :
+ stopTransitionTool();
+ break;
+ case CanvasModel.BRANCH_TOOL :
+ stopBranchTool();
+ break;
+ default :
+ Debugger.log('No tool active. Setting Default.', Debugger.GEN,'stopActiveTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ canvasModel.activeTool = "none";
+
+ }
+ }
+
+ public function startGateTool(){
+ Debugger.log('Starting gate tool',Debugger.GEN,'startGateTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_GATE);
+ canvasModel.activeTool = CanvasModel.GATE_TOOL;
+ }
+
+ public function stopGateTool(){
+ Debugger.log('Stopping gate tool',Debugger.GEN,'stopGateTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ canvasModel.activeTool = "none";
+ }
+
+
+ public function startOptionalActivity(isSequence:Boolean){
+ Debugger.log('Starting Optioanl Activity',Debugger.GEN,'startOptionalActivity','Canvas');
+ Cursor.showCursor(ApplicationParent.C_OPTIONAL);
+
+ canvasModel.activeTool = (isSequence) ? CanvasModel.OPTIONAL_SEQ_TOOL : CanvasModel.OPTIONAL_TOOL;
+ }
+
+ public function stopOptionalActivity(){
+ Debugger.log('Stopping Optioanl Activity',Debugger.GEN,'stopOptionalActivity','Canvas');
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ canvasModel.activeTool = "none";
+ }
+ public function startGroupTool(){
+ Debugger.log('Starting group tool',Debugger.GEN,'startGateTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_GROUP);
+ canvasModel.activeTool = CanvasModel.GROUP_TOOL;
+ }
+
+ public function stopGroupTool(){
+ Debugger.log('Stopping group tool',Debugger.GEN,'startGateTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ canvasModel.activeTool = "none";
+ }
+
+ public function startBranchTool(){
+ Debugger.log('Starting branch tool',Debugger.GEN,'startGateTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_BRANCH);
+ canvasModel.activeTool = CanvasModel.BRANCH_TOOL;
+ }
+
+ public function stopBranchTool(){
+ Debugger.log('Stopping branch tool',Debugger.GEN,'startBranchTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ canvasModel.activeTool = "none";
+ }
+
+ /**
+ * Called by the top menu bar and the tool bar to start the transition tool, switches cursor.
+ * @usage
+ * @return
+ */
+ public function startTransitionTool():Void{
+ Debugger.log('Starting transition tool',Debugger.GEN,'startTransitionTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_TRANSITION);
+ canvasModel.lockAllComplexActivities();
+ canvasModel.startTransitionTool();
+
+ }
+
+ /**
+ * Called by the top menu bar and the tool bar to stop the transition tool, switches cursor.
+ * @usage
+ * @return
+ */
+ public function stopTransitionTool():Void{
+ Debugger.log('Stopping transition tool',Debugger.GEN,'stopTransitionTool','Canvas');
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ canvasModel.unlockAllComplexActivities();
+ canvasModel.stopTransitionTool();
+ }
+
+ /**
+ * Method to open Preview popup window.
+ */
+ public function launchPreviewWindow():Void{
+ if(_ddm.validDesign){
+ Debugger.log('Launching Preview Window (initialising)',Debugger.GEN,'launchPreviewWindow','Canvas');
+ var callback:Function = Proxy.create(this,onInitPreviewResponse);
+ Application.getInstance().getComms().sendAndReceive(_ddm.getDataForPreview(Dictionary.getValue('preview_btn'), null), "monitoring/initializeLesson", callback, false)
+ }
+ }
+
+ public function onInitPreviewResponse(r):Void{
+ if(r instanceof LFError) {
+ r.showMessageConfirm();
+ } else {
+ Debugger.log('Launching Preview Window (starting lesson ' + r + ')',Debugger.GEN,'onInitPreviewResponse','Canvas');
+ var callback:Function = Proxy.create(this,onLaunchPreviewResponse);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=startPreviewLesson&lessonID='+r,callback, false);
+ }
+ }
+
+ /**
+ * now contains a Lession ID response from wddx packet
+ * Returns the lessionID to send it to popup method in JsPopup .
+ * @usage http://localhost:8080/lams/learning/learner.do?method=joinLesson&userId=4&lessonId=12
+ * @param r //the validation response
+ * @return
+ */
+ public function onLaunchPreviewResponse(r):Void{
+ if(r instanceof LFError){
+ r.showMessageConfirm();
+ }else{
+ var uID = Config.getInstance().userID;
+ var serverUrl = Config.getInstance().serverUrl;
+
+ // open preview in new window
+ ApplicationParent.extCall("openPreview", r);
+ Debugger.log('Recieved Lesson ID: '+r ,Debugger.GEN,'onLaunchPreviewResponse','Canvas');
+ }
+ }
+
+ /**
+ * Method to open Import popup window
+ */
+ public function launchImportWindow():Void{
+ Debugger.log('Launching Import Window',Debugger.GEN,'launchImportWindow','Canvas');
+ if(_ddm.modified){
+ LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doImportLaunch), null);
+ } else {
+ doImportLaunch();
+ }
+ }
+
+ public function doImportLaunch():Void{
+ var serverUrl = Config.getInstance().serverUrl;
+ var importActionUrl:String = appendCustomCSVIfExists(serverUrl+'authoring/importToolContent.do?method=import');
+ JsPopup.getInstance().launchPopupWindow(importActionUrl, 'Import', 298, 800, true, true, false, false, false);
+ }
+
+ /**
+ * Method to open Export popup window
+ */
+ public function launchExportWindow():Void{
+ Debugger.log('Launching Export Window',Debugger.GEN,'launchExportWindow','Canvas');
+
+ if(_ddm.learningDesignID == null) {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_design_export_unsaved'), null);
+ }else if(_ddm.modified){
+ LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doExportLaunch), null);
+ } else {
+ doExportLaunch();
+ }
+
+ }
+
+ public function doExportLaunch():Void{
+ var serverUrl = Config.getInstance().serverUrl;
+ var learningDesignID = _ddm.learningDesignID;
+ JsPopup.getInstance().launchPopupWindow(serverUrl+'authoring/exportToolContent.do?learningDesignID=' + learningDesignID, 'Export', 298, 712, true, true, false, false, false);
+ }
+
+ /**
+ * 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{
+ canvasModel.setSize(width, height);
+ }
+
+ public function addBin(target:MovieClip) {
+ if(_bin != null) hideBin();
+
+ var cc:CanvasController = canvasView.getController();
+ _bin = target.attachMovie("Bin", "Bin", target.getNextHighestDepth(), {_canvasController:cc, _targetView:target});
+ }
+
+ public function hideBin():Void{
+ _bin.removeMovieClip();
+ }
+
+ /**
+ * Undo the last change to the DDM.
+ * TODO: Does not handle moving activities on the canvas, only when actual change to activities or transitions.
+ * Need to generate update event when re-position activities
+ * @usage
+ * @return
+ */
+ public function undo():Void{
+
+ if(_undoStack.length>0){
+ //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 + ": " + ca.activity.helpURL, Debugger.GEN, 'getHelp', 'Canvas');
+
+ ApplicationParent.extCall("openURL", ca.activity.helpURL + app.module);
+
+ } else {
+ if (ca.activity.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE){
+ var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GROUP);
+ 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, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GATE);
+ app.getHelpURL(callback);
+ } else if(ca.activity.isBranchingActivity()) {
+ var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_BRANCHING);
+ app.getHelpURL(callback);
+ }else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_helpURL_undefined', [ca.activity.toolDisplayName]));
+ }
+ }
+ }
+
+ private function openSystemToolHelp(url:String, toolSignature:String){
+ var target:String = toolSignature + app.module;
+ var newURL:String = ApplicationParent.addLocaleToURL(url);
+
+ ApplicationParent.extCall("openURL", newURL + 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 taWidth():Number{
+ return toolActWidth
+ }
+
+ public function get taHeight():Number{
+ return toolActHeight
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get bin ():MovieClip {
+ return _bin;
+ }
+
+ public function get className():String{
+ return 'Canvas';
+ }
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasActivity.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasActivity.as (.../CanvasActivity.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasActivity.as (.../CanvasActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,870 +1,870 @@
-/***************************************************************************
- * 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.authoring.br.*;
-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{
-
- public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
- public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
-
- public static var TOOL_BRANCHING_WIDTH:Number = 166.0;
- public static var TOOL_BRANCHING_HEIGHT:Number = 101.0;
-
- public static var TOOL_MIN_ACTIVITY_WIDTH:Number = 65;
- public static var TOOL_MIN_ACTIVITY_HEIGHT:Number = 44;
-
- public static var GATE_ACTIVITY_HEIGHT:Number =28;
- public static var GATE_ACTIVITY_WIDTH:Number = 28;
-
- public static var BRANCH_ICON_HEIGHT:Number = 30;
- public static var BRANCH_ICON_WIDTH:Number = 30;
-
- public static var ICON_WIDTH:Number = 25;
- public static var ICON_HEIGHT:Number = 25;
-
- public static var HUB_CONNECTOR_MARGIN:Number = 25;
-
- public static var PLUS_MARGIN_X:Number = 15;
- public static var PLUS_MARGIN_Y:Number = 10;
-
- //this is set by the init object
- private var _canvasController:CanvasController;
- private var _canvasView:CanvasView;
- private var _canvasBranchView:CanvasBranchView;
- private var _canvasComplexView:CanvasComplexView;
-
- private var _monitorController:MonitorController;
- private var _monitorView;
-
- private var _controller;
-
- 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:ApplicationParent;
-
- //locals
- private var learnerOffset_X:Number = 4;
- private var learnerOffset_Y:Number = 3;
- private var learnerContainer:MovieClip;
-
- private var _module:String;
- private var _branchConnector:Boolean;
-
- private var icon_mc:MovieClip;
- private var icon_mcl:MovieClipLoader;
-
- private var diagram_mc:CanvasBranchingDiagram;
- private var showDiagram:Boolean;
-
- private var bkg_pnl:MovieClip;
- private var act_pnl:MovieClip;
- private var title_lbl:MovieClip;
-
- private var groupIcon_mc:MovieClip;
- private var branchIcon_mc:MovieClip;
- private var optionalIcon_mc:MovieClip;
- private var stopSign_mc:MovieClip;
- private var branchSign_mc:MovieClip;
-
- private var start_branch_icon_mc:MovieClip;
- private var finish_branch_icon_mc:MovieClip;
- private var start_branch_icon_mc_rtl:MovieClip;
- private var finish_branch_icon_mc_rtl: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;
-
- private var _setupBranchView:Boolean;
-
- private var _sequenceChild:Boolean;
- private var _depthHistory:Number;
-
- private var _ddm:DesignDataModel;
-
- function CanvasActivity(_connector){
- _visible = false;
- _tm = ThemeManager.getInstance();
- _ccm = CustomContextMenu.getInstance();
-
- //Get reference to application and design data model
- app = ApplicationParent.getInstance();
-
- //let it wait one frame to set up the components.
- //this has to be set b4 the do later :)
- if((_activity.isGateActivity()) && !_sequenceChild){
- _visibleHeight = CanvasActivity.GATE_ACTIVITY_HEIGHT;
- _visibleWidth = CanvasActivity.GATE_ACTIVITY_WIDTH;
- } else if(_branchConnector) {
- _visibleHeight = CanvasActivity.BRANCH_ICON_HEIGHT;
- _visibleWidth = CanvasActivity.BRANCH_ICON_WIDTH;
- } else if(_activity.isGroupActivity()){
- _visibleHeight = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT : CanvasActivity.TOOL_ACTIVITY_HEIGHT;
- _visibleWidth = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH : CanvasActivity.TOOL_ACTIVITY_WIDTH;
- } else if(_activity.isBranchingActivity() && showDiagram) {
- _visibleHeight = CanvasActivity.TOOL_BRANCHING_HEIGHT;
- _visibleWidth = CanvasActivity.TOOL_BRANCHING_WIDTH;
- }else{
- _visibleHeight = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT : CanvasActivity.TOOL_ACTIVITY_HEIGHT;
- _visibleWidth = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH : 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{
- Debugger.log("init called.", Debugger.CRITICAL, "init", "CanvasActivity");
-
- 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());
- mm = MonitorModel(_monitorController.getModel());
-
- Debugger.log("mm: " + mm, Debugger.CRITICAL, "init", "CanvasActivity");
- Debugger.log("_activity: " + _activity.activityUIID, Debugger.CRITICAL, "init", "CanvasActivity");
-
- showAssets(false);
-
- if (_activity.selectActivity == "false"){
- _isSelected = false;
- refresh();
- }
-
- if(!_activity.isGateActivity() && !_activity.isGroupActivity() && !_activity.isBranchingActivity() || _branchConnector){
- loadIcon();
- } else if(_activity.isBranchingActivity() && showDiagram) {
- loadDiagram();
- }
-
- setStyles();
-
- MovieClipUtils.doLater(Proxy.create(this, draw));
- }
-
- private function showAssets(isVisible:Boolean){
- groupIcon_mc._visible = isVisible;
- branchIcon_mc._visible = isVisible;
- optionalIcon_mc._visible = isVisible;
- start_branch_icon_mc._visible = isVisible;
- finish_branch_icon_mc._visible = isVisible;
- start_branch_icon_mc_rtl._visible = isVisible;
- finish_branch_icon_mc_rtl._visible = isVisible;
- title_lbl._visible = isVisible;
- icon_mc._visible = isVisible;
- stopSign_mc._visible = isVisible;
- branchSign_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);
- setStyles();
-
- setupBranchView = false;
-
- if(diagram_mc != null)
- diagram_mc.refresh();
-
- 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() && !_sequenceChild)
- tgt_mc = stopSign_mc;
- else if(_activity.groupingUIID > 0 && !_activity.isBranchingActivity())
- tgt_mc = canvasActivityGrouped_mc;
- else if(_activity.groupingUIID > 0 && _activity.activityTypeID == Activity.GROUP_BRANCHING_ACTIVITY_TYPE)
- 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 {
- if(depthHistory != null)
- this.swapDepths(this.depthHistory);
-
- //hide the selected border
- _selected_mc.removeMovieClip();
- }
-
- }
-
- private function loadDiagram():Void {
- diagram_mc = CanvasBranchingDiagram(this.attachMovie("CanvasBranchingDiagram", "diagram_mc", this.getNextHighestDepth(), {_ddm: getDDM(), _branchingActivity: activity, _visible: false}));
-
- // swap depths if transparent layer visible
- if(fade_mc._visible) {
- diagram_mc.swapDepths(fade_mc);
- }
- }
-
- 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 = (_visibleWidth / 2) - (icon_mc._width / 2);
- icon_mc._y = (_visibleHeight / 2) - (icon_mc._height / 2);
- icon_mc._y -= (!_sequenceChild) ? 6 : 0;
- }
-
- 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;
- var yCoord;
-
- if (_activity.parentUIID != null) {
- var actX = _activity.xCoord;
- var parentX = (mm.activeView instanceof CanvasComplexView) ? mm.activeView.openActivity._x : parentAct.xCoord;
-
- xCoord = (parentAct.activityTypeID == Activity.SEQUENCE_ACTIVITY_TYPE) ? actX : parentX;
-
- if(parentAct.activityTypeID != Activity.PARALLEL_ACTIVITY_TYPE
- && parentAct.activityTypeID != Activity.SEQUENCE_ACTIVITY_TYPE) {
-
- xCoord = parentX + actX;
-
- learner_X = (learner_X != null) ? learner_X + parentX : null;
- learner_Y = (mm.activeView instanceof CanvasComplexView) ? learner_Y + mm.activeView.openActivity._y : learner_Y + parentAct.yCoord;
-
-
- } else {
- xCoord = parentX;
- yCoord = (mm.activeView instanceof CanvasComplexView) ? mm.activeView.openActivity._y : parentAct.yCoord;
-
- var gparentAct:Activity = mm.getMonitor().ddm.getActivityByUIID(parentAct.parentUIID);
-
- if(gparentAct.isOptionsWithSequencesActivity()) {
- xCoord = (mm.activeView instanceof CanvasComplexView) ? xCoord + parentAct.xCoord : gparentAct.xCoord + xCoord;
-
- learner_X = (learner_X != null) ? learner_X + xCoord : null;
- learner_Y = (mm.activeView instanceof CanvasComplexView) ? learner_Y + parentAct.yCoord + yCoord : learner_Y + gparentAct.yCoord + yCoord;
-
- }
-
- }
-
- }
-
- // get the length of learners from the Monitor Model and run a for loop.
- for (var j=0; j (xCoord + getVisibleWidth() - 30)) {
- learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName()+activity.activityUIID, learnerContainer.getNextHighestDepth(), {_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:true, _clone:false });
- learnerContainer.attachMovie("plusIcon", "plusIcon", learnerContainer.getNextHighestDepth(), {_activity:_activity, _monitorController:_monitorController, _x:learner_X+PLUS_MARGIN_X, _y:learner_Y+PLUS_MARGIN_Y});
- return;
- }
-
- // attach icon
- learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName()+activity.activityUIID, learnerContainer.getNextHighestDepth(), {_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:false, _clone:false });
-
- // space icons
- learner_X += 10;
- }
- }
- }
-
- /**
- * 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;
-
- if(_activity.isReadOnly() && getDDM().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;
-
- if(_sequenceChild) {
- theIcon_mc = stopSign_mc;
- setUpActIcon(theIcon_mc);
-
- theIcon_mc._visible = true;
- canvasActivity_mc._visible = true;
-
- clickTarget_mc._width = CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH;
- clickTarget_mc._height = CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT;
- }
-
- } else if(_branchConnector) {
- start_branch_icon_mc._visible = (!ApplicationParent.isRTL());
- start_branch_icon_mc._x = 1;
- start_branch_icon_mc._y = 1;
-
- start_branch_icon_mc_rtl._visible = (ApplicationParent.isRTL());
- start_branch_icon_mc_rtl._x = 31;
- start_branch_icon_mc_rtl._y = 1;
-
- finish_branch_icon_mc._visible = (!ApplicationParent.isRTL());
- finish_branch_icon_mc._x = 1;
- finish_branch_icon_mc._y = 1;
-
- finish_branch_icon_mc_rtl._visible = (ApplicationParent.isRTL());
- finish_branch_icon_mc_rtl._x = 31;
- finish_branch_icon_mc_rtl._y = 1;
-
- } else {
-
- //chose the icon:
- if(_activity.isGroupActivity()){
- groupIcon_mc._visible = true;
- optionalIcon_mc.visible = false;
- icon_mc._visible = false;
- theIcon_mc = groupIcon_mc;
- } else if(_activity.isBranchingActivity()){
- Debugger.log("empty: " + diagram_mc.empty, Debugger.CRITICAL, "draw", "CanvasActivity");
-
- branchIcon_mc._visible = (diagram_mc.empty != null) ? diagram_mc.empty : true;
- groupIcon_mc._visible = false;
- optionalIcon_mc.visible = false;
- icon_mc._visible = false;
-
- if(!branchIcon_mc._visible)
- diagram_mc._visible = true;
- else
- theIcon_mc = branchIcon_mc;
-
- } else if(_activity.isOptionalActivity()){
- branchIcon_mc._visible = false;
- groupIcon_mc._visible = false;
- optionalIcon_mc.visible = true;
- icon_mc._visible = false;
- theIcon_mc = optionalIcon_mc;
- } else if(_activity.isOptionsWithSequencesActivity()){
- branchIcon_mc._visible = false;
- groupIcon_mc._visible = false;
- optionalIcon_mc.visible = true;
- icon_mc._visible = false;
- theIcon_mc = optionalIcon_mc;
- } else {
- groupIcon_mc._visible = false;
- branchIcon_mc._visible = false;
- optionalIcon_mc.visible = false;
- icon_mc._visible = true;
- theIcon_mc = icon_mc;
- }
-
- setUpActIcon(theIcon_mc);
- theIcon_mc._visible = true;
-
- //chose the background mc
- if(_activity.groupingUIID != null && _activity.groupingUIID > 0) {
-
- if(_activity.isBranchingActivity() && _activity.activityTypeID == Activity.GROUP_BRANCHING_ACTIVITY_TYPE) {
- canvasActivityGrouped_mc._visible = true;
- canvasActivity_mc._visible = false;
-
- if(_sequenceChild) {
- fade_mc._height = 37;
- act_pnl._height = 37.5;
- }
-
- } else if(!_activity.isBranchingActivity()) {
- canvasActivityGrouped_mc._visible = true;
- canvasActivity_mc._visible = false;
-
- if(_sequenceChild) {
- fade_mc._height = 37;
- act_pnl._height = 37.5;
- }
-
- } else {
- canvasActivity_mc._visible = true;
- canvasActivityGrouped_mc._visible = false;
- }
-
- } else {
- if(_sequenceChild) {
- fade_mc._height = 40;
- act_pnl._height = 40.5;
- }
-
- canvasActivity_mc._visible = true;
- canvasActivityGrouped_mc._visible = false;
- }
-
- title_lbl.visible = true;
- stopSign_mc._visible = false;
- branchSign_mc._visible = false;
-
- //write text
- title_lbl.text = _activity.title;
-
- clickTarget_mc._width = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH : TOOL_ACTIVITY_WIDTH;
- clickTarget_mc._height = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT : TOOL_ACTIVITY_HEIGHT;
-
- if(activity.isBranchingActivity() && !_sequenceChild && showDiagram) {
- clickTarget_mc._width = TOOL_BRANCHING_WIDTH;
- clickTarget_mc._height = TOOL_BRANCHING_HEIGHT;
- }
- }
-
- //position
- Debugger.log('setting position:',Debugger.CRITICAL,'draw','CanvasActivity');
-
- if(!_branchConnector) {
- _x = _activity.xCoord;
- _y = _activity.yCoord;
- } else {
- var _canvasSize:Object;
- if(_module == "monitoring")
- _canvasSize = mm.getSize();
- else
- _canvasSize = _canvasModel.getSize();
-
- if(_canvasBranchView.isStart(this)) {
- _x = (_canvasBranchView.activity.startXCoord != null) ? _canvasBranchView.activity.startXCoord : _x;
- _y = (_canvasBranchView.activity.startYCoord != null) ? _canvasBranchView.activity.startYCoord : _y;
- } else if(_canvasBranchView.isEnd(this)) {
- _x = (_canvasBranchView.activity.endXCoord != null) ? _canvasBranchView.activity.endXCoord : _x;
- _y = (_canvasBranchView.activity.endYCoord != null) ? _canvasBranchView.activity.endYCoord : _y;
- }
- }
-
- _visible = true;
-
- if (_activity.runOffline){
- bgNegative = "true"
- setStyles();
- }
-
- if(setupBranchView)
- if(_module == "monitoring")
- mm.openBranchActivityContent(this, false);
- else
- _canvasModel.openBranchActivityContent(this, false);
-
- }
-
-
- private function onRollOver():Void{
- loadCustomContextMenu("activity");
- }
-
- private function onRollOut():Void{
- loadCustomContextMenu("canvas");
- }
-
- private function loadCustomContextMenu(type:String):Void {
- if (_module == "monitoring"){
- _ccm.showCustomCM(_ccm.loadMenu(type, "monitoring"))
- }else {
- _ccm.showCustomCM(_ccm.loadMenu(type, "authoring"))
- }
- }
-
- private function onPress():Void{
- // check double-click
- var now:Number = new Date().getTime();
- Debugger.log('_module:'+_module,Debugger.GEN,'onPress','CanvasActivity');
- Debugger.log('_controller:'+_monitorController,Debugger.GEN,'onPress','CanvasActivity');
-
- if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY && !branchConnector){
- 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;
-
- if (_module == "monitoring"){
- Debugger.log('SingleClicking1:+'+this,Debugger.GEN,'onPress','CanvasActivity for monitoring');
- _monitorController.activityClick(this);
- }else {
- Debugger.log('SingleClicking2:+'+this,Debugger.GEN,'onPress','CanvasActivity');
- _canvasController.activityClick(this);
- }
-
- }
-
- _dcStartTime = now;
-
- }
-
- private function onRelease():Void{
- loadCustomContextMenu("activity");
-
- if(!_doubleClicking){
- Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','CanvasActivity');
- Debugger.log('_module:'+_module,Debugger.GEN,'onRelease','CanvasActivity');
-
- 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 setPosition(x:Number, y:Number):Void {
- _x = x;
- _y = y;
-
- if(activity.branchView != null) {
- activity.branchView._x = _x + getVisibleWidth()/2;
- activity.branchView._y = _y + getVisibleHeight()/2;
- }
-
- }
-
- public function set isSetSelected(v:Boolean):Void{
- _isSelected = v;
- }
-
- public function get isSequenceChild():Boolean{
- return _sequenceChild;
- }
-
- 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;
- }
-
- public function get branchConnector():Boolean {
- if(_branchConnector != null) return _branchConnector;
- else return false;
- }
-
- public function set branchConnector(a:Boolean):Void {
- _branchConnector = a;
- }
-
- private function getAssociatedStyle():Object{
- 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 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};
-
- var 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)
- }
-
- styleObj = getAssociatedStyle();
- act_pnl.setStyle('styleName',styleObj);
-
- } else {
- styleObj = getAssociatedStyle();
- act_pnl.setStyle('styleName',styleObj);
- }
-
- }
-
- }
-
- private function destroy() {
- activity.branchView.removeMovieClip();
- }
-
- public function get setupBranchView():Boolean {
- return _setupBranchView;
- }
-
- public function set setupBranchView(a:Boolean):Void {
- _setupBranchView = a;
- }
-
- public function get depthHistory():Number {
- return _depthHistory;
- }
-
- public function set depthHistory(a:Number):Void {
- _depthHistory = a;
- }
-
- public function get actChildren():Array {
- return getDDM().getComplexActivityChildren(activity.activityUIID)
- }
-
- private function getDDM():DesignDataModel {
- if(_module == "monitoring") {
- return _monitorView.ddm;
- } else if(_canvasBranchView != null){
- return _canvasBranchView.ddm;
- } else {
- return _canvasView.ddm;
- }
- }
-
- public function hit():Void {
- onPress();
- onRelease();
- }
-
+/***************************************************************************
+ * 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.authoring.br.*;
+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{
+
+ public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
+ public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
+
+ public static var TOOL_BRANCHING_WIDTH:Number = 166.0;
+ public static var TOOL_BRANCHING_HEIGHT:Number = 101.0;
+
+ public static var TOOL_MIN_ACTIVITY_WIDTH:Number = 65;
+ public static var TOOL_MIN_ACTIVITY_HEIGHT:Number = 44;
+
+ public static var GATE_ACTIVITY_HEIGHT:Number =28;
+ public static var GATE_ACTIVITY_WIDTH:Number = 28;
+
+ public static var BRANCH_ICON_HEIGHT:Number = 30;
+ public static var BRANCH_ICON_WIDTH:Number = 30;
+
+ public static var ICON_WIDTH:Number = 25;
+ public static var ICON_HEIGHT:Number = 25;
+
+ public static var HUB_CONNECTOR_MARGIN:Number = 25;
+
+ public static var PLUS_MARGIN_X:Number = 15;
+ public static var PLUS_MARGIN_Y:Number = 10;
+
+ //this is set by the init object
+ private var _canvasController:CanvasController;
+ private var _canvasView:CanvasView;
+ private var _canvasBranchView:CanvasBranchView;
+ private var _canvasComplexView:CanvasComplexView;
+
+ private var _monitorController:MonitorController;
+ private var _monitorView;
+
+ private var _controller;
+
+ 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:ApplicationParent;
+
+ //locals
+ private var learnerOffset_X:Number = 4;
+ private var learnerOffset_Y:Number = 3;
+ private var learnerContainer:MovieClip;
+
+ private var _module:String;
+ private var _branchConnector:Boolean;
+
+ private var icon_mc:MovieClip;
+ private var icon_mcl:MovieClipLoader;
+
+ private var diagram_mc:CanvasBranchingDiagram;
+ private var showDiagram:Boolean;
+
+ private var bkg_pnl:MovieClip;
+ private var act_pnl:MovieClip;
+ private var title_lbl:MovieClip;
+
+ private var groupIcon_mc:MovieClip;
+ private var branchIcon_mc:MovieClip;
+ private var optionalIcon_mc:MovieClip;
+ private var stopSign_mc:MovieClip;
+ private var branchSign_mc:MovieClip;
+
+ private var start_branch_icon_mc:MovieClip;
+ private var finish_branch_icon_mc:MovieClip;
+ private var start_branch_icon_mc_rtl:MovieClip;
+ private var finish_branch_icon_mc_rtl: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;
+
+ private var _setupBranchView:Boolean;
+
+ private var _sequenceChild:Boolean;
+ private var _depthHistory:Number;
+
+ private var _ddm:DesignDataModel;
+
+ function CanvasActivity(_connector){
+ _visible = false;
+ _tm = ThemeManager.getInstance();
+ _ccm = CustomContextMenu.getInstance();
+
+ //Get reference to application and design data model
+ app = ApplicationParent.getInstance();
+
+ //let it wait one frame to set up the components.
+ //this has to be set b4 the do later :)
+ if((_activity.isGateActivity()) && !_sequenceChild){
+ _visibleHeight = CanvasActivity.GATE_ACTIVITY_HEIGHT;
+ _visibleWidth = CanvasActivity.GATE_ACTIVITY_WIDTH;
+ } else if(_branchConnector) {
+ _visibleHeight = CanvasActivity.BRANCH_ICON_HEIGHT;
+ _visibleWidth = CanvasActivity.BRANCH_ICON_WIDTH;
+ } else if(_activity.isGroupActivity()){
+ _visibleHeight = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT : CanvasActivity.TOOL_ACTIVITY_HEIGHT;
+ _visibleWidth = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH : CanvasActivity.TOOL_ACTIVITY_WIDTH;
+ } else if(_activity.isBranchingActivity() && showDiagram) {
+ _visibleHeight = CanvasActivity.TOOL_BRANCHING_HEIGHT;
+ _visibleWidth = CanvasActivity.TOOL_BRANCHING_WIDTH;
+ }else{
+ _visibleHeight = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT : CanvasActivity.TOOL_ACTIVITY_HEIGHT;
+ _visibleWidth = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH : 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{
+ Debugger.log("init called.", Debugger.CRITICAL, "init", "CanvasActivity");
+
+ 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());
+ mm = MonitorModel(_monitorController.getModel());
+
+ Debugger.log("mm: " + mm, Debugger.CRITICAL, "init", "CanvasActivity");
+ Debugger.log("_activity: " + _activity.activityUIID, Debugger.CRITICAL, "init", "CanvasActivity");
+
+ showAssets(false);
+
+ if (_activity.selectActivity == "false"){
+ _isSelected = false;
+ refresh();
+ }
+
+ if(!_activity.isGateActivity() && !_activity.isGroupActivity() && !_activity.isBranchingActivity() || _branchConnector){
+ loadIcon();
+ } else if(_activity.isBranchingActivity() && showDiagram) {
+ loadDiagram();
+ }
+
+ setStyles();
+
+ MovieClipUtils.doLater(Proxy.create(this, draw));
+ }
+
+ private function showAssets(isVisible:Boolean){
+ groupIcon_mc._visible = isVisible;
+ branchIcon_mc._visible = isVisible;
+ optionalIcon_mc._visible = isVisible;
+ start_branch_icon_mc._visible = isVisible;
+ finish_branch_icon_mc._visible = isVisible;
+ start_branch_icon_mc_rtl._visible = isVisible;
+ finish_branch_icon_mc_rtl._visible = isVisible;
+ title_lbl._visible = isVisible;
+ icon_mc._visible = isVisible;
+ stopSign_mc._visible = isVisible;
+ branchSign_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);
+ setStyles();
+
+ setupBranchView = false;
+
+ if(diagram_mc != null)
+ diagram_mc.refresh();
+
+ 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() && !_sequenceChild)
+ tgt_mc = stopSign_mc;
+ else if(_activity.groupingUIID > 0 && !_activity.isBranchingActivity())
+ tgt_mc = canvasActivityGrouped_mc;
+ else if(_activity.groupingUIID > 0 && _activity.activityTypeID == Activity.GROUP_BRANCHING_ACTIVITY_TYPE)
+ 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 {
+ if(depthHistory != null)
+ this.swapDepths(this.depthHistory);
+
+ //hide the selected border
+ _selected_mc.removeMovieClip();
+ }
+
+ }
+
+ private function loadDiagram():Void {
+ diagram_mc = CanvasBranchingDiagram(this.attachMovie("CanvasBranchingDiagram", "diagram_mc", this.getNextHighestDepth(), {_ddm: getDDM(), _branchingActivity: activity, _visible: false}));
+
+ // swap depths if transparent layer visible
+ if(fade_mc._visible) {
+ diagram_mc.swapDepths(fade_mc);
+ }
+ }
+
+ 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 = (_visibleWidth / 2) - (icon_mc._width / 2);
+ icon_mc._y = (_visibleHeight / 2) - (icon_mc._height / 2);
+ icon_mc._y -= (!_sequenceChild) ? 6 : 0;
+ }
+
+ 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;
+ var yCoord;
+
+ if (_activity.parentUIID != null) {
+ var actX = _activity.xCoord;
+ var parentX = (mm.activeView instanceof CanvasComplexView) ? mm.activeView.openActivity._x : parentAct.xCoord;
+
+ xCoord = (parentAct.activityTypeID == Activity.SEQUENCE_ACTIVITY_TYPE) ? actX : parentX;
+
+ if(parentAct.activityTypeID != Activity.PARALLEL_ACTIVITY_TYPE
+ && parentAct.activityTypeID != Activity.SEQUENCE_ACTIVITY_TYPE) {
+
+ xCoord = parentX + actX;
+
+ learner_X = (learner_X != null) ? learner_X + parentX : null;
+ learner_Y = (mm.activeView instanceof CanvasComplexView) ? learner_Y + mm.activeView.openActivity._y : learner_Y + parentAct.yCoord;
+
+
+ } else {
+ xCoord = parentX;
+ yCoord = (mm.activeView instanceof CanvasComplexView) ? mm.activeView.openActivity._y : parentAct.yCoord;
+
+ var gparentAct:Activity = mm.getMonitor().ddm.getActivityByUIID(parentAct.parentUIID);
+
+ if(gparentAct.isOptionsWithSequencesActivity()) {
+ xCoord = (mm.activeView instanceof CanvasComplexView) ? xCoord + parentAct.xCoord : gparentAct.xCoord + xCoord;
+
+ learner_X = (learner_X != null) ? learner_X + xCoord : null;
+ learner_Y = (mm.activeView instanceof CanvasComplexView) ? learner_Y + parentAct.yCoord + yCoord : learner_Y + gparentAct.yCoord + yCoord;
+
+ }
+
+ }
+
+ }
+
+ // get the length of learners from the Monitor Model and run a for loop.
+ for (var j=0; j (xCoord + getVisibleWidth() - 30)) {
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName()+activity.activityUIID, learnerContainer.getNextHighestDepth(), {_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:true, _clone:false });
+ learnerContainer.attachMovie("plusIcon", "plusIcon", learnerContainer.getNextHighestDepth(), {_activity:_activity, _monitorController:_monitorController, _x:learner_X+PLUS_MARGIN_X, _y:learner_Y+PLUS_MARGIN_Y});
+ return;
+ }
+
+ // attach icon
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName()+activity.activityUIID, learnerContainer.getNextHighestDepth(), {_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:false, _clone:false });
+
+ // space icons
+ learner_X += 10;
+ }
+ }
+ }
+
+ /**
+ * 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;
+
+ if(_activity.isReadOnly() && getDDM().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;
+
+ if(_sequenceChild) {
+ theIcon_mc = stopSign_mc;
+ setUpActIcon(theIcon_mc);
+
+ theIcon_mc._visible = true;
+ canvasActivity_mc._visible = true;
+
+ clickTarget_mc._width = CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH;
+ clickTarget_mc._height = CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT;
+ }
+
+ } else if(_branchConnector) {
+ start_branch_icon_mc._visible = (!ApplicationParent.isRTL());
+ start_branch_icon_mc._x = 1;
+ start_branch_icon_mc._y = 1;
+
+ start_branch_icon_mc_rtl._visible = (ApplicationParent.isRTL());
+ start_branch_icon_mc_rtl._x = 31;
+ start_branch_icon_mc_rtl._y = 1;
+
+ finish_branch_icon_mc._visible = (!ApplicationParent.isRTL());
+ finish_branch_icon_mc._x = 1;
+ finish_branch_icon_mc._y = 1;
+
+ finish_branch_icon_mc_rtl._visible = (ApplicationParent.isRTL());
+ finish_branch_icon_mc_rtl._x = 31;
+ finish_branch_icon_mc_rtl._y = 1;
+
+ } else {
+
+ //chose the icon:
+ if(_activity.isGroupActivity()){
+ groupIcon_mc._visible = true;
+ optionalIcon_mc.visible = false;
+ icon_mc._visible = false;
+ theIcon_mc = groupIcon_mc;
+ } else if(_activity.isBranchingActivity()){
+ Debugger.log("empty: " + diagram_mc.empty, Debugger.CRITICAL, "draw", "CanvasActivity");
+
+ branchIcon_mc._visible = (diagram_mc.empty != null) ? diagram_mc.empty : true;
+ groupIcon_mc._visible = false;
+ optionalIcon_mc.visible = false;
+ icon_mc._visible = false;
+
+ if(!branchIcon_mc._visible)
+ diagram_mc._visible = true;
+ else
+ theIcon_mc = branchIcon_mc;
+
+ } else if(_activity.isOptionalActivity()){
+ branchIcon_mc._visible = false;
+ groupIcon_mc._visible = false;
+ optionalIcon_mc.visible = true;
+ icon_mc._visible = false;
+ theIcon_mc = optionalIcon_mc;
+ } else if(_activity.isOptionsWithSequencesActivity()){
+ branchIcon_mc._visible = false;
+ groupIcon_mc._visible = false;
+ optionalIcon_mc.visible = true;
+ icon_mc._visible = false;
+ theIcon_mc = optionalIcon_mc;
+ } else {
+ groupIcon_mc._visible = false;
+ branchIcon_mc._visible = false;
+ optionalIcon_mc.visible = false;
+ icon_mc._visible = true;
+ theIcon_mc = icon_mc;
+ }
+
+ setUpActIcon(theIcon_mc);
+ theIcon_mc._visible = true;
+
+ //chose the background mc
+ if(_activity.groupingUIID != null && _activity.groupingUIID > 0) {
+
+ if(_activity.isBranchingActivity() && _activity.activityTypeID == Activity.GROUP_BRANCHING_ACTIVITY_TYPE) {
+ canvasActivityGrouped_mc._visible = true;
+ canvasActivity_mc._visible = false;
+
+ if(_sequenceChild) {
+ fade_mc._height = 37;
+ act_pnl._height = 37.5;
+ }
+
+ } else if(!_activity.isBranchingActivity()) {
+ canvasActivityGrouped_mc._visible = true;
+ canvasActivity_mc._visible = false;
+
+ if(_sequenceChild) {
+ fade_mc._height = 37;
+ act_pnl._height = 37.5;
+ }
+
+ } else {
+ canvasActivity_mc._visible = true;
+ canvasActivityGrouped_mc._visible = false;
+ }
+
+ } else {
+ if(_sequenceChild) {
+ fade_mc._height = 40;
+ act_pnl._height = 40.5;
+ }
+
+ canvasActivity_mc._visible = true;
+ canvasActivityGrouped_mc._visible = false;
+ }
+
+ title_lbl.visible = true;
+ stopSign_mc._visible = false;
+ branchSign_mc._visible = false;
+
+ //write text
+ title_lbl.text = _activity.title;
+
+ clickTarget_mc._width = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_WIDTH : TOOL_ACTIVITY_WIDTH;
+ clickTarget_mc._height = (_sequenceChild) ? CanvasActivity.TOOL_MIN_ACTIVITY_HEIGHT : TOOL_ACTIVITY_HEIGHT;
+
+ if(activity.isBranchingActivity() && !_sequenceChild && showDiagram) {
+ clickTarget_mc._width = TOOL_BRANCHING_WIDTH;
+ clickTarget_mc._height = TOOL_BRANCHING_HEIGHT;
+ }
+ }
+
+ //position
+ Debugger.log('setting position:',Debugger.CRITICAL,'draw','CanvasActivity');
+
+ if(!_branchConnector) {
+ _x = _activity.xCoord;
+ _y = _activity.yCoord;
+ } else {
+ var _canvasSize:Object;
+ if(_module == "monitoring")
+ _canvasSize = mm.getSize();
+ else
+ _canvasSize = _canvasModel.getSize();
+
+ if(_canvasBranchView.isStart(this)) {
+ _x = (_canvasBranchView.activity.startXCoord != null) ? _canvasBranchView.activity.startXCoord : _x;
+ _y = (_canvasBranchView.activity.startYCoord != null) ? _canvasBranchView.activity.startYCoord : _y;
+ } else if(_canvasBranchView.isEnd(this)) {
+ _x = (_canvasBranchView.activity.endXCoord != null) ? _canvasBranchView.activity.endXCoord : _x;
+ _y = (_canvasBranchView.activity.endYCoord != null) ? _canvasBranchView.activity.endYCoord : _y;
+ }
+ }
+
+ _visible = true;
+
+ if (_activity.runOffline){
+ bgNegative = "true"
+ setStyles();
+ }
+
+ if(setupBranchView)
+ if(_module == "monitoring")
+ mm.openBranchActivityContent(this, false);
+ else
+ _canvasModel.openBranchActivityContent(this, false);
+
+ }
+
+
+ private function onRollOver():Void{
+ loadCustomContextMenu("activity");
+ }
+
+ private function onRollOut():Void{
+ loadCustomContextMenu("canvas");
+ }
+
+ private function loadCustomContextMenu(type:String):Void {
+ if (_module == "monitoring"){
+ _ccm.showCustomCM(_ccm.loadMenu(type, "monitoring"))
+ }else {
+ _ccm.showCustomCM(_ccm.loadMenu(type, "authoring"))
+ }
+ }
+
+ private function onPress():Void{
+ // check double-click
+ var now:Number = new Date().getTime();
+ Debugger.log('_module:'+_module,Debugger.GEN,'onPress','CanvasActivity');
+ Debugger.log('_controller:'+_monitorController,Debugger.GEN,'onPress','CanvasActivity');
+
+ if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY && !branchConnector){
+ 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;
+
+ if (_module == "monitoring"){
+ Debugger.log('SingleClicking1:+'+this,Debugger.GEN,'onPress','CanvasActivity for monitoring');
+ _monitorController.activityClick(this);
+ }else {
+ Debugger.log('SingleClicking2:+'+this,Debugger.GEN,'onPress','CanvasActivity');
+ _canvasController.activityClick(this);
+ }
+
+ }
+
+ _dcStartTime = now;
+
+ }
+
+ private function onRelease():Void{
+ loadCustomContextMenu("activity");
+
+ if(!_doubleClicking){
+ Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','CanvasActivity');
+ Debugger.log('_module:'+_module,Debugger.GEN,'onRelease','CanvasActivity');
+
+ 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 setPosition(x:Number, y:Number):Void {
+ _x = x;
+ _y = y;
+
+ if(activity.branchView != null) {
+ activity.branchView._x = _x + getVisibleWidth()/2;
+ activity.branchView._y = _y + getVisibleHeight()/2;
+ }
+
+ }
+
+ public function set isSetSelected(v:Boolean):Void{
+ _isSelected = v;
+ }
+
+ public function get isSequenceChild():Boolean{
+ return _sequenceChild;
+ }
+
+ 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;
+ }
+
+ public function get branchConnector():Boolean {
+ if(_branchConnector != null) return _branchConnector;
+ else return false;
+ }
+
+ public function set branchConnector(a:Boolean):Void {
+ _branchConnector = a;
+ }
+
+ private function getAssociatedStyle():Object{
+ 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 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};
+
+ var 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)
+ }
+
+ styleObj = getAssociatedStyle();
+ act_pnl.setStyle('styleName',styleObj);
+
+ } else {
+ styleObj = getAssociatedStyle();
+ act_pnl.setStyle('styleName',styleObj);
+ }
+
+ }
+
+ }
+
+ private function destroy() {
+ activity.branchView.removeMovieClip();
+ }
+
+ public function get setupBranchView():Boolean {
+ return _setupBranchView;
+ }
+
+ public function set setupBranchView(a:Boolean):Void {
+ _setupBranchView = a;
+ }
+
+ public function get depthHistory():Number {
+ return _depthHistory;
+ }
+
+ public function set depthHistory(a:Number):Void {
+ _depthHistory = a;
+ }
+
+ public function get actChildren():Array {
+ return getDDM().getComplexActivityChildren(activity.activityUIID)
+ }
+
+ private function getDDM():DesignDataModel {
+ if(_module == "monitoring") {
+ return _monitorView.ddm;
+ } else if(_canvasBranchView != null){
+ return _canvasBranchView.ddm;
+ } else {
+ return _canvasView.ddm;
+ }
+ }
+
+ public function hit():Void {
+ onPress();
+ onRelease();
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasComplexView.as
===================================================================
diff -u -r27d85ee30520b52c79e0b44ca00a475bf57a1de2 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasComplexView.as (.../CanvasComplexView.as) (revision 27d85ee30520b52c79e0b44ca00a475bf57a1de2)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasComplexView.as (.../CanvasComplexView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,369 +1,369 @@
-/***************************************************************************
- * 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.common.dict.*;
-import org.lamsfoundation.lams.common.mvc.*;
-import org.lamsfoundation.lams.common.CommonCanvasView;
-import org.lamsfoundation.lams.authoring.cv.*;
-import org.lamsfoundation.lams.authoring.br.*;
-import org.lamsfoundation.lams.authoring.*;
-import org.lamsfoundation.lams.monitoring.mv.MonitorModel;
-import org.lamsfoundation.lams.monitoring.mv.MonitorController;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.MonitorTabView;
-
-import mx.controls.*;
-import mx.containers.*;
-import mx.managers.*;
-import mx.utils.*;
-
-/**
-* Authoring view for the canvas
-* Relects changes in the CanvasModel
-*/
-
-class org.lamsfoundation.lams.authoring.cv.CanvasComplexView extends CommonCanvasView {
-
- private var _tm:ThemeManager;
-
- private var _cm:CanvasModel;
- private var _mm:MonitorModel;
-
- private var _canvasComplexView:CanvasComplexView;
- private var _learnerContainer_mc:MovieClip;
-
- private var _complexActivity:CanvasActivity;
- private var _tempActivity;
-
- private var _parentActivity:Object;
- private var _prevActiveView;
-
- private var lastScreenWidth:Number = 500;
- private var lastScreenHeight:Number = 300;
-
- private var activitiesDisplayed:Hashtable;
- private var _branchingToClear:Array;
-
- /**
- * Constructor
- */
- function CanvasComplexView(){
- _canvasComplexView = this;
- _tm = ThemeManager.getInstance();
- _branchingToClear = new Array();
-
- //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);
-
- _cm = (m instanceof CanvasModel) ? CanvasModel(m) : null;
- _mm = (m instanceof MonitorModel) ? MonitorModel(m) : null;
-
- //register to recive updates form the model
-
- if(_cm != null) _cm.addEventListener('viewUpdate', Proxy.create(this, viewUpdate));
- if(_mm != null) _mm.addEventListener('viewUpdate', Proxy.create(this, viewUpdate));
-
- MovieClipUtils.doLater(Proxy.create(this, draw));
- }
-
- /**
- * Recieved update events from the MonitorModel. Dispatches to relevent handler depending on update.Type
- * @usage
- * @param event
- */
- public function update (o:Observable, infoObj:Object):Void{
- var mm:MonitorModel = MonitorModel(o);
- infoObj.target = mm;
-
- viewUpdate(infoObj);
- }
-
- /**
- * 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');
- var _model = event.target;
-
- switch (event.updateType){
- case 'POSITION' :
- setPosition(_model);
- break;
- case 'SIZE' :
- setSize(_model);
- break;
- case 'DRAW_ACTIVITY':
- drawActivity(event.data, _model);
- break;
- case 'REMOVE_ACTIVITY':
- removeActivity(event.data, _model);
- break;
- case 'SELECTED_ITEM' :
- Debugger.log("selecting item: " + _model.selectedItem.activity.activityUIID, Debugger.CRITICAL, "viewUpdate", "CanvasComplexView");
- Debugger.log("test parent: " + _model.findParent(_model.selectedItem.activity, _complexActivity.activity), Debugger.CRITICAL, "viewUpdate", "CanvasComplexView");
-
- _tempActivity.refreshChildren();
-
- highlightActivity(_model);
-
- break;
- case 'SET_ACTIVE' :
- Debugger.log('setting active :' + event.updateType + " event.data: " + event.data + " condition: " + (event.data == this),Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView');
- _tempActivity.locked = !(event.data == this);
- _visible = true;
-
- break;
- default :
- Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasComplexView');
- }
-
- }
-
- /**
- * layout visual elements on the canvas on initialisation
- */
- private function draw(){
- //get the content path for the sp
- content = this;
-
- activityComplexLayer = content.createEmptyMovieClip("_activityComplexLayer_mc", content.getNextHighestDepth());
- activityLayer = content.createEmptyMovieClip("_activityLayer_mc", content.getNextHighestDepth());
-
- _learnerContainer_mc = content.createEmptyMovieClip("_learnerContainer_mc", content.getNextHighestDepth(), {_x: 0, _y: 0});
-
- complexViewer = content.createEmptyMovieClip("_complex_viewer_mc", content.getNextHighestDepth());
- branchContent = content.createEmptyMovieClip("_branch_content_mc", DepthManager.kTopmost);
-
- setStyles();
-
- //Dispatch load event
- dispatchEvent({type:'load',target:this});
- }
-
- public function updateActivity():Boolean {
- if(_tempActivity != null) {
- if(_tempActivity instanceof CanvasOptionalActivity) {
- CanvasOptionalActivity(_tempActivity).updateChildren(model.ddm.getComplexActivityChildren(_tempActivity.activity.activityUIID))
- }
-
- return true;
- }
-
- return false;
- }
-
- public function showActivity():Void {
- if(drawActivity(_complexActivity.activity, model)) {
- model.selectedItem = _tempActivity;
- setSize(model);
- }
-
- this._visible = true;
- }
-
- public function close():Void {
- removeActivity(_complexActivity.activity, model);
-
- Debugger.log("setting new activeview: " + _prevActiveView, Debugger.CRITICAL, "close", "CanvasComplexView");
-
- model.activeView = _prevActiveView;
- model.currentBranchingActivity = (_prevActiveView.activity.isBranchingActivity()) ? _prevActiveView.activity : null;
-
- model.removeObserver(this);
-
- for(var i=0; i= 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;
- }
-
- arrow_mc._rotation = degs;
- arrow_mc._visible = true;
-
- _midPoint = new Point(arrow_mc._x, arrow_mc._y);
-
- xPos = this._x;
-
- }
-
- 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;
- }
- }
-
- public function quadrant():String {
- return _quadrant;
- }
-
- 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;
- _quadrant = getQuadrant(d);
-
- switch(_quadrant) {
- 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));
- }
-
- public function getToOTC(toAct_mc):Object {
- var _toOTC = new Object();
- _toOTC.x = toAct_mc.getVisibleWidth()/2;
- _toOTC.y = toAct_mc.getVisibleHeight()/2;
- return _toOTC;
- }
-
- public function getFromOTC(fromAct_mc):Object {
- var _fromOTC = new Object();
- _fromOTC.x = fromAct_mc.getVisibleWidth()/2;
- _fromOTC.y = fromAct_mc.getVisibleHeight()/2;
- return _fromOTC;
- }
-
- public function set controller(a):Void {
- if(a instanceof CanvasController)
- _canvasController = a;
- else
- _monitorController = a;
- }
-
- public function get model() {
- if(_canvasController != null || _canvasController != undefined)
- return org.lamsfoundation.lams.authoring.Application.getInstance().getCanvas().model;
- else
- return org.lamsfoundation.lams.monitoring.Application.getInstance().getMonitor().getMM();
+ public function get toAct_edgePoint():Point{
+ return _toAct_edgePoint;
}
+
+ public function get fromAct_edgePoint():Point{
+ return _fromAct_edgePoint;
+ }
+
+ public function get xPosition():Number{
+ return xPos;
+ }
+
+ public function createConnection(fromAct_mc, toAct_mc, _startPoint:Point, _endPoint:Point, fromOTC:Object, toOTC:Object) {
+ this.lineStyle(2, _drawnLineStyle);
+ this.moveTo(_startPoint.x, _startPoint.y);
+ this.lineTo(_endPoint.x, _endPoint.y);
+
+ // calc activity root angles
+ var fromAct_Angle:Number = Math.atan2(fromOTC.y, fromOTC.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);
+
+ // gradient
+ var angle:Number = Math.atan2((_endPoint.y - _startPoint.y),(_endPoint.x - _startPoint.x));
+ var degs:Number = convertToDegrees(angle);
+
+ // get edgepoint for connected activities
+ _fromAct_edgePoint = calcEdgePoint(degs, fromOTC.x, fromOTC.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;
+ }
+
+ arrow_mc._rotation = degs;
+ arrow_mc._visible = true;
+
+ _midPoint = new Point(arrow_mc._x, arrow_mc._y);
+
+ xPos = this._x;
+
+ }
+
+ 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;
+ }
+ }
+
+ public function quadrant():String {
+ return _quadrant;
+ }
+
+ 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;
+ _quadrant = getQuadrant(d);
+
+ switch(_quadrant) {
+ 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));
+ }
+
+ public function getToOTC(toAct_mc):Object {
+ var _toOTC = new Object();
+ _toOTC.x = toAct_mc.getVisibleWidth()/2;
+ _toOTC.y = toAct_mc.getVisibleHeight()/2;
+ return _toOTC;
+ }
+
+ public function getFromOTC(fromAct_mc):Object {
+ var _fromOTC = new Object();
+ _fromOTC.x = fromAct_mc.getVisibleWidth()/2;
+ _fromOTC.y = fromAct_mc.getVisibleHeight()/2;
+ return _fromOTC;
+ }
+
+ public function set controller(a):Void {
+ if(a instanceof CanvasController)
+ _canvasController = a;
+ else
+ _monitorController = a;
+ }
+
+ public function get model() {
+ if(_canvasController != null || _canvasController != undefined)
+ return org.lamsfoundation.lams.authoring.Application.getInstance().getCanvas().model;
+ else
+ return org.lamsfoundation.lams.monitoring.Application.getInstance().getMonitor().getMM();
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasController.as
===================================================================
diff -u -r6071623eaaab7f58e5c1befe499b0fc1c76850dc -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasController.as (.../CanvasController.as) (revision 6071623eaaab7f58e5c1befe499b0fc1c76850dc)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasController.as (.../CanvasController.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,1028 +1,1028 @@
-/***************************************************************************
- * 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.authoring.br.*
-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.*;
-import mx.managers.*;
-
-
-/*
-* 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:PropertyInspector;
- private var app:Application;
- private var _isBusy:Boolean;
- private var _tempSelectedItem:Object;
- private var _binCheckIntervalID:Number;
- private var _binBlock:Boolean;
-
- private static var BIN_CHECK_INTERVAL:Number = 100;
-
- /**
- * 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 PropertyInspector();
- app = Application.getInstance();
- _isBusy = false;
- _tempSelectedItem = null;
- }
-
- public function activityClick(ca:Object):Void{
-
- _tempSelectedItem = _canvasModel.selectedItem;
- _canvasModel.selectedItem = null;
-
- app.toolbar.view.getController().hideOptionPanels();
-
- 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.activeView.fingerprint = transitionTarget;
- var td = _canvasModel.addActivityToConnection(transitionTarget);
- _canvasModel.activeView.initDrawTempTrans();
- }
- } else if(_canvasModel.activeView instanceof CanvasComplexView && ca != _canvasModel.activeView.openActivity && ca.locked) {
- _canvasModel.activeView.close();
- return;
- } else {
-
- var parentAct = _canvasModel.getCanvas().ddm.getActivityByUIID(ca.activity.parentUIID);
- var parentSelectedAct = _canvasModel.getCanvas().ddm.getActivityByUIID(_tempSelectedItem.activity.parentUIID);
- var optionalOnCanvas:Array = _canvasModel.findOptionalActivities();
-
- if(ca.activity.parentUIID != null &&
- (parentAct.isParallelActivity() || ca.activity.isOptionalSequenceActivity(parentAct))) {
- _canvasModel.isDragging = false;
- return;
- } else {
- if (ca.activity.isOptionalActivity() || ca.activity.isOptionsWithSequencesActivity()) {
- ca.depthHistory = ca.getDepth();
- ca.swapDepths(DepthManager.kTopmost);
- }
-
- _binBlock = _canvasModel.getCanvas().bin.initBlocked(ca);
- _binCheckIntervalID = setInterval(Proxy.create(_canvasModel.getCanvas().bin, _canvasModel.getCanvas().bin.isActivityOverBin, ca, false), BIN_CHECK_INTERVAL);
-
- ca.startDrag(false);
- _canvasModel.isDragging = true;
- }
-
- if(_tempSelectedItem != null) {
- // clear currently selected activity
- for (var i=0; i 142 ||
- ca._x < -129 ||
- ca._y < -55 ||
- ca._y > optionalOnCanvas[i].panelHeight) {
-
- //give it the new co-ords and 'drop' it
- ca.activity.xCoord = iconMouseX - (_canvasModel.getCanvas().taWidth/2);
- ca.activity.yCoord = iconMouseY - (_canvasModel.getCanvas().taHeight/2);
-
- _canvasModel.removeOptionalCA(ca, optionalOnCanvas[i].activity.activityUIID);
- } else {
- activitySnapBack(ca);
- }
-
- }
- }
- }
-
- } else if(ca.activity.parentUIID != null &&
- sequenceActivity.isOptionalSequenceActivity(_canvasModel.getCanvas().ddm.getActivityByUIID(sequenceActivity.parentUIID)) &&
- ca.activity.activityUIID != _canvasModel.currentBranchingActivity.activity.activityUIID) {
-
- for (var i=0; i optionalOnCanvas[i].getVisibleWidth() ||
- ca._x < -ca.getVisibleWidth() ||
- ca._y < -ca.getVisibleHeight() - sequenceActivity.yCoord ||
- ca._y > optionalOnCanvas[i].getVisibleHeight() - sequenceActivity.yCoord) {
-
- ca.activity.xCoord = iconMouseX - (_canvasModel.getCanvas().taWidth/2);
- ca.activity.yCoord = iconMouseY - (_canvasModel.getCanvas().taHeight/2);
-
- _canvasModel.removeOptionalSequenceCA(ca, optionalOnCanvas[i].activity.activityUIID);
- } else {
- if(!_canvasModel.moveOptionalSequenceCA(ca, sequenceActivity)) {
- for (var j=0; j= _children[j].activity.xCoord &&
- mouseX <= (_children[j].activity.xCoord + _children[j]._width) &&
- mouseY >= _children[j].activity.yCoord &&
- mouseY <= (_children[j].activity.yCoord + _children[j]._height))
- selectedSequence = _children[j];
- }
-
- if(selectedSequence != null) {
- ca.activity.orderID = _canvasModel.getCanvas().ddm.getNextSequenceOrderID(selectedSequence.activity.activityUIID);
-
- Debugger.log("ca orderID: " + ca.activity.orderID, Debugger.CRITICAL, "activityRelease", "CanvasController");
- _canvasModel.haltRefresh(true);
-
- if(ca.activity.orderID > 1) _canvasModel.createSequenceTransition(CanvasSequenceActivity(selectedSequence).lastActivity, ca.activity);
- else ComplexActivity(selectedSequence.activity).firstActivityUIID = ca.activity.activityUIID;
-
- _canvasModel.haltRefresh(false);
-
- _canvasModel.addParentToActivity(selectedSequence.activity.activityUIID, ca, false);
-
- CanvasSequenceActivity(selectedSequence).updateChildren();
- CanvasOptionalActivity(_canvasModel.activitiesDisplayed.get(selectedSequence.activity.parentUIID)).updateChildren();
-
- } else {
- activitySnapBack(ca);
- var msg:String = Dictionary.getValue('activityDrop_optSequence_error_msg');
- LFMessage.showMessageAlert(msg);
- }
-
- } else {
- _canvasModel.addParentToActivity(optionalOnCanvas[i].activity.activityUIID, ca, false);
- var newChildren:Array = _canvasModel.getCanvas().ddm.getComplexActivityChildren(optionalOnCanvas[i].activity.activityUIID);
- optionalOnCanvas[i].updateChildren(newChildren);
- }
- }
-
- }
-
- }
-
- }
- }
-
- }
-
- // if we are on the bin - trash it
- isActivityOnBin(ca);
- clearInterval(_binCheckIntervalID);
-
-
- //get a view if ther is not one
- if(!_canvasView)
- _canvasView = CanvasView(getView());
-
- // restricting (x, y) position to positive plane only
- Debugger.log("ca x: " + ca._x, Debugger.CRITICAL, "activityRelease", "CanvasController");
- Debugger.log("ca y: " + ca._y, Debugger.CRITICAL, "activityRelease", "CanvasController");
-
- if(!(_canvasModel.activeView instanceof CanvasComplexView)) {
- if(ca._x < 0) ca._x = 0;
- if(ca._y < 0) ca._y = 0;
- if(ca._x > _canvasView.gridLayer._width - ca.getVisibleWidth()) ca._x = _canvasView.gridLayer._width - ca.getVisibleWidth();
- if(ca._y > _canvasView.gridLayer._height - ca.getVisibleHeight()) ca._y = _canvasView.gridLayer._height - ca.getVisibleHeight();
-
- //give it the new co-ords and 'drop' it
-
- if(!ca.branchConnector || ca.branchConnector == undefined) {
- ca.activity.xCoord = ca._x;
- ca.activity.yCoord = ca._y;
-
- if(ca.activity.isBranchingActivity()) ca.setPosition(ca._x, ca._y);
-
- } else {
- if(_canvasModel.activeView.isStart(ca)) {
- BranchingActivity(ca.activity).startXCoord = ca._x;
- BranchingActivity(ca.activity).startYCoord = ca._y;
- } else if(_canvasModel.activeView.isEnd(ca)) {
- BranchingActivity(ca.activity).endXCoord = ca._x;
- BranchingActivity(ca.activity).endYCoord = ca._y;
- }
- }
- } else {
- if(ca instanceof CanvasOptionalActivity || ca instanceof CanvasParallelActivity) {
- ca._x = 0;
- ca._y = 0;
- } else {
-
- var sequenceActivity:Activity = _canvasModel.ddm.getActivityByUIID(ca.activity.parentUIID);
-
- if(sequenceActivity.isOptionalSequenceActivity(_canvasModel.ddm.getActivityByUIID(sequenceActivity.parentUIID))) {
- if (ca._x > optionalOnCanvas[i].getVisibleWidth() ||
- ca._x < -ca.getVisibleWidth() ||
- ca._y < -ca.getVisibleHeight() - sequenceActivity.yCoord ||
- ca._y > optionalOnCanvas[i].getVisibleHeight() - sequenceActivity.yCoord) {
- } else {
- _canvasModel.moveOptionalSequenceCA(ca, sequenceActivity);
- }
- }
-
- activitySnapBack(ca);
- }
- }
-
- //refresh the transitions
- //TODO: refresh the transitions as you drag...
- var myTransitions = _canvasModel.getCanvas().ddm.getTransitionsForActivityUIID(ca.activity.activityUIID);
- myTransitions = myTransitions.myTransitions;
-
- //run in a loop to support branches, maybe more then 2 transitions.
- for (var i=0; i _canvasView.gridLayer._width - ca.getVisibleWidth()) ca._x = _canvasView.gridLayer._width - ca.getVisibleWidth();
- if(ca._y > _canvasView.gridLayer._height - ca.getVisibleHeight()) ca._y = _canvasView.gridLayer._height - ca.getVisibleHeight();
-
- // give it the new co-ords and 'drop' it
- ca.activity.xCoord = ca._x;
- ca.activity.yCoord = ca._y;
- }
- } else {
- ca._x = 0;
- ca._y = 0;
- }
- }
-
- }
- }
-
- private function isActivityOnBin(ca:Object):Void{
- var r:Object = null;
- var parentUIID:Number = ca.activity.parentUIID;
-
- if(ca.hitTest(_canvasModel.getCanvas().bin) && !_canvasModel.getCanvas().bin.blocked) {
- if(_canvasModel.activeView instanceof CanvasComplexView) {
- var seqActivity:Activity = Activity(_canvasModel.ddm.getActivityByUIID(parentUIID));
- if(seqActivity.isOptionalSequenceActivity(_canvasModel.ddm.getActivityByUIID(seqActivity.parentUIID)))
- _canvasModel.removeOptionalSequenceCA(ca, seqActivity.parentUIID);
-
- if (ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isBranchingActivity()){
- _canvasModel.removeComplexActivityChildren(ca.actChildren);
- r = _canvasModel.ddm.removeActivity(ca.activity.activityUIID);
-
- } else {
- r = _canvasModel.ddm.removeActivity(ca.activity.activityUIID);
- }
-
- var parent = _canvasModel.activitiesDisplayed.get(parentUIID);
- var gparent = _canvasModel.activitiesDisplayed.get( _canvasModel.ddm.getActivityByUIID(parentUIID).parentUIID);
-
- // close current complex activity + refresh parent
- if(ca == _canvasModel.activeView.openActivity)
- _canvasModel.activeView.close();
-
- // refresh current complex activity
- if(_canvasModel.activeView instanceof CanvasComplexView)
- _canvasModel.activeView.updateActivity();
- else
- if(parent != null)
- parent.updateChildren(_canvasModel.ddm.getComplexActivityChildren(parent.activity.activityUIID));
- else if(gparent != null)
- gparent.updateChildren(_canvasModel.ddm.getComplexActivityChildren(gparent.activity.activityUIID));
- else
- return;
-
- } else {
-
- if(!isActivityReadOnly(ca, Dictionary.getValue("cv_element_readOnly_action_del")) && !ca.branchConnector && !isActivityProtected(ca)) {
- if (ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isBranchingActivity()){
- Debugger.log("removing complex act that hit bin" , Debugger.CRITICAL, "isActivityOnBin", "CanvasController");
- if(ca.activity.isBranchingActivity())
- _canvasModel.getCanvas().ddm.removeEntries(_canvasModel.getCanvas().ddm.getBranchMappingsByActivityUIIDAndType(ca.activity.activityUIID).all);
-
- _canvasModel.removeComplexActivity(ca);
- } else {
- _canvasModel.removeActivityOnBin(ca.activity.activityUIID);
- }
- } else {
- activitySnapBack(ca);
- }
- }
-
- _canvasModel.getCanvas().bin.setOff();
- }
- }
-
- public function transitionClick(ct:CanvasTransition):Void{
- Debugger.log('transitionClick Transition:'+ct.transition.uiID,Debugger.GEN,'transitionClick','CanvasController');
- _canvasModel.getCanvas().stopActiveTool();
-
- _canvasModel.selectedItem = ct;
- _canvasModel.isDragging = true;
- ct.startDrag(false);
-
- }
-
- public function branchClick(bc:BranchConnector):Void{
- Debugger.log('branchClick Transition:'+bc.branch.branchUIID,Debugger.GEN,'branchClick','CanvasController');
- _canvasModel.getCanvas().stopActiveTool();
-
- _canvasModel.selectedItem = bc;
- _canvasModel.isDragging = true;
-
- bc.startDrag(false);
- bc.branchLabel._visible = false;
-
- }
-
- public function transitionDoubleClick(ct:CanvasTransition):Void{
- Debugger.log('transitionDoubleClick CanvasTransition:'+ct.transition.transitionUIID,Debugger.GEN,'transitionDoubleClick','CanvasController');
-
- _canvasModel.getCanvas().stopActiveTool();
-
- //TODO: fix this, its null
- _canvasView = CanvasView(getView());
-
- if(!isTransitionTargetReadOnly(ct, Dictionary.getValue("cv_element_readOnly_action_mod"))) _canvasModel.activeView.createTransitionPropertiesDialog("centre",Delegate.create(this, transitionPropertiesOK));
-
- _canvasModel.selectedItem = ct;
- }
-
- public function branchDoubleClick(bc:BranchConnector):Void{
- Debugger.log('branchDoubleClick CanvasConnection:' + bc.branch.branchUIID,Debugger.GEN,'branchDoubleClick','CanvasController');
-
- _canvasModel.getCanvas().stopActiveTool();
-
- //TODO: fix this, its null
- _canvasView = CanvasView(getView());
- _canvasModel.selectedItem = bc;
- }
-
- public function transitionRelease(ct:CanvasTransition):Void{
- Debugger.log("transitionRelease Transition:" + ct.transition.uiID, Debugger.GEN, "transitionRelease", "CanvasController");
- if(_canvasModel.isDragging){
- ct.stopDrag();
-
- if(ct.hitTest(_canvasModel.getCanvas().bin) && !isTransitionTargetReadOnly(ct, Dictionary.getValue("cv_element_readOnly_action_del"))){
- _canvasModel.getCanvas().removeTransition(ct.transition.transitionUIID);
- } else {
- if (ct._x != ct.xPosition){
- var t = _canvasModel.transitionsDisplayed.remove(ct.transition.transitionUIID);
- t.removeMovieClip();
- _canvasModel.setDirty();
- }
- }
- }
-
- }
-
- public function branchRelease(bc:BranchConnector):Void{
- Debugger.log("branchRelease Transition:" + bc.branch.branchUIID, Debugger.GEN, "branchRelease", "CanvasController");
-
- if(_canvasModel.isDragging){
- bc.stopDrag();
- bc.branchLabel._visible = true;
-
- if(bc.hitTest(_canvasModel.getCanvas().bin) && !isBranchTargetReadOnly(bc, Dictionary.getValue("cv_element_readOnly_action_del"))){
- var branchesToDelete:Array;
- Debugger.log("branchRelease hittest:" + bc.branch.branchUIID, Debugger.GEN, "branchRelease", "CanvasController");
-
- if(bc.branch.direction == BranchConnector.DIR_FROM_START) {
- if(_canvasModel.activeView.activity.firstActivityUIID == bc.branch.sequenceActivity.activityUIID)
- _canvasModel.activeView.activity.defaultBranch = _canvasModel.getCanvas().ddm.findNewDefaultBranch(_canvasModel.activeView.activity, bc.branch);
-
- branchesToDelete = _canvasModel.getCanvas().ddm.getBranchesForActivityUIID(bc.branch.sequenceActivity.activityUIID);
- for(var i=0; i 142 ||
+ ca._x < -129 ||
+ ca._y < -55 ||
+ ca._y > optionalOnCanvas[i].panelHeight) {
+
+ //give it the new co-ords and 'drop' it
+ ca.activity.xCoord = iconMouseX - (_canvasModel.getCanvas().taWidth/2);
+ ca.activity.yCoord = iconMouseY - (_canvasModel.getCanvas().taHeight/2);
+
+ _canvasModel.removeOptionalCA(ca, optionalOnCanvas[i].activity.activityUIID);
+ } else {
+ activitySnapBack(ca);
+ }
+
+ }
+ }
+ }
+
+ } else if(ca.activity.parentUIID != null &&
+ sequenceActivity.isOptionalSequenceActivity(_canvasModel.getCanvas().ddm.getActivityByUIID(sequenceActivity.parentUIID)) &&
+ ca.activity.activityUIID != _canvasModel.currentBranchingActivity.activity.activityUIID) {
+
+ for (var i=0; i optionalOnCanvas[i].getVisibleWidth() ||
+ ca._x < -ca.getVisibleWidth() ||
+ ca._y < -ca.getVisibleHeight() - sequenceActivity.yCoord ||
+ ca._y > optionalOnCanvas[i].getVisibleHeight() - sequenceActivity.yCoord) {
+
+ ca.activity.xCoord = iconMouseX - (_canvasModel.getCanvas().taWidth/2);
+ ca.activity.yCoord = iconMouseY - (_canvasModel.getCanvas().taHeight/2);
+
+ _canvasModel.removeOptionalSequenceCA(ca, optionalOnCanvas[i].activity.activityUIID);
+ } else {
+ if(!_canvasModel.moveOptionalSequenceCA(ca, sequenceActivity)) {
+ for (var j=0; j= _children[j].activity.xCoord &&
+ mouseX <= (_children[j].activity.xCoord + _children[j]._width) &&
+ mouseY >= _children[j].activity.yCoord &&
+ mouseY <= (_children[j].activity.yCoord + _children[j]._height))
+ selectedSequence = _children[j];
+ }
+
+ if(selectedSequence != null) {
+ ca.activity.orderID = _canvasModel.getCanvas().ddm.getNextSequenceOrderID(selectedSequence.activity.activityUIID);
+
+ Debugger.log("ca orderID: " + ca.activity.orderID, Debugger.CRITICAL, "activityRelease", "CanvasController");
+ _canvasModel.haltRefresh(true);
+
+ if(ca.activity.orderID > 1) _canvasModel.createSequenceTransition(CanvasSequenceActivity(selectedSequence).lastActivity, ca.activity);
+ else ComplexActivity(selectedSequence.activity).firstActivityUIID = ca.activity.activityUIID;
+
+ _canvasModel.haltRefresh(false);
+
+ _canvasModel.addParentToActivity(selectedSequence.activity.activityUIID, ca, false);
+
+ CanvasSequenceActivity(selectedSequence).updateChildren();
+ CanvasOptionalActivity(_canvasModel.activitiesDisplayed.get(selectedSequence.activity.parentUIID)).updateChildren();
+
+ } else {
+ activitySnapBack(ca);
+ var msg:String = Dictionary.getValue('activityDrop_optSequence_error_msg');
+ LFMessage.showMessageAlert(msg);
+ }
+
+ } else {
+ _canvasModel.addParentToActivity(optionalOnCanvas[i].activity.activityUIID, ca, false);
+ var newChildren:Array = _canvasModel.getCanvas().ddm.getComplexActivityChildren(optionalOnCanvas[i].activity.activityUIID);
+ optionalOnCanvas[i].updateChildren(newChildren);
+ }
+ }
+
+ }
+
+ }
+
+ }
+ }
+
+ }
+
+ // if we are on the bin - trash it
+ isActivityOnBin(ca);
+ clearInterval(_binCheckIntervalID);
+
+
+ //get a view if ther is not one
+ if(!_canvasView)
+ _canvasView = CanvasView(getView());
+
+ // restricting (x, y) position to positive plane only
+ Debugger.log("ca x: " + ca._x, Debugger.CRITICAL, "activityRelease", "CanvasController");
+ Debugger.log("ca y: " + ca._y, Debugger.CRITICAL, "activityRelease", "CanvasController");
+
+ if(!(_canvasModel.activeView instanceof CanvasComplexView)) {
+ if(ca._x < 0) ca._x = 0;
+ if(ca._y < 0) ca._y = 0;
+ if(ca._x > _canvasView.gridLayer._width - ca.getVisibleWidth()) ca._x = _canvasView.gridLayer._width - ca.getVisibleWidth();
+ if(ca._y > _canvasView.gridLayer._height - ca.getVisibleHeight()) ca._y = _canvasView.gridLayer._height - ca.getVisibleHeight();
+
+ //give it the new co-ords and 'drop' it
+
+ if(!ca.branchConnector || ca.branchConnector == undefined) {
+ ca.activity.xCoord = ca._x;
+ ca.activity.yCoord = ca._y;
+
+ if(ca.activity.isBranchingActivity()) ca.setPosition(ca._x, ca._y);
+
+ } else {
+ if(_canvasModel.activeView.isStart(ca)) {
+ BranchingActivity(ca.activity).startXCoord = ca._x;
+ BranchingActivity(ca.activity).startYCoord = ca._y;
+ } else if(_canvasModel.activeView.isEnd(ca)) {
+ BranchingActivity(ca.activity).endXCoord = ca._x;
+ BranchingActivity(ca.activity).endYCoord = ca._y;
+ }
+ }
+ } else {
+ if(ca instanceof CanvasOptionalActivity || ca instanceof CanvasParallelActivity) {
+ ca._x = 0;
+ ca._y = 0;
+ } else {
+
+ var sequenceActivity:Activity = _canvasModel.ddm.getActivityByUIID(ca.activity.parentUIID);
+
+ if(sequenceActivity.isOptionalSequenceActivity(_canvasModel.ddm.getActivityByUIID(sequenceActivity.parentUIID))) {
+ if (ca._x > optionalOnCanvas[i].getVisibleWidth() ||
+ ca._x < -ca.getVisibleWidth() ||
+ ca._y < -ca.getVisibleHeight() - sequenceActivity.yCoord ||
+ ca._y > optionalOnCanvas[i].getVisibleHeight() - sequenceActivity.yCoord) {
+ } else {
+ _canvasModel.moveOptionalSequenceCA(ca, sequenceActivity);
+ }
+ }
+
+ activitySnapBack(ca);
+ }
+ }
+
+ //refresh the transitions
+ //TODO: refresh the transitions as you drag...
+ var myTransitions = _canvasModel.getCanvas().ddm.getTransitionsForActivityUIID(ca.activity.activityUIID);
+ myTransitions = myTransitions.myTransitions;
+
+ //run in a loop to support branches, maybe more then 2 transitions.
+ for (var i=0; i _canvasView.gridLayer._width - ca.getVisibleWidth()) ca._x = _canvasView.gridLayer._width - ca.getVisibleWidth();
+ if(ca._y > _canvasView.gridLayer._height - ca.getVisibleHeight()) ca._y = _canvasView.gridLayer._height - ca.getVisibleHeight();
+
+ // give it the new co-ords and 'drop' it
+ ca.activity.xCoord = ca._x;
+ ca.activity.yCoord = ca._y;
+ }
+ } else {
+ ca._x = 0;
+ ca._y = 0;
+ }
+ }
+
+ }
+ }
+
+ private function isActivityOnBin(ca:Object):Void{
+ var r:Object = null;
+ var parentUIID:Number = ca.activity.parentUIID;
+
+ if(ca.hitTest(_canvasModel.getCanvas().bin) && !_canvasModel.getCanvas().bin.blocked) {
+ if(_canvasModel.activeView instanceof CanvasComplexView) {
+ var seqActivity:Activity = Activity(_canvasModel.ddm.getActivityByUIID(parentUIID));
+ if(seqActivity.isOptionalSequenceActivity(_canvasModel.ddm.getActivityByUIID(seqActivity.parentUIID)))
+ _canvasModel.removeOptionalSequenceCA(ca, seqActivity.parentUIID);
+
+ if (ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isBranchingActivity()){
+ _canvasModel.removeComplexActivityChildren(ca.actChildren);
+ r = _canvasModel.ddm.removeActivity(ca.activity.activityUIID);
+
+ } else {
+ r = _canvasModel.ddm.removeActivity(ca.activity.activityUIID);
+ }
+
+ var parent = _canvasModel.activitiesDisplayed.get(parentUIID);
+ var gparent = _canvasModel.activitiesDisplayed.get( _canvasModel.ddm.getActivityByUIID(parentUIID).parentUIID);
+
+ // close current complex activity + refresh parent
+ if(ca == _canvasModel.activeView.openActivity)
+ _canvasModel.activeView.close();
+
+ // refresh current complex activity
+ if(_canvasModel.activeView instanceof CanvasComplexView)
+ _canvasModel.activeView.updateActivity();
+ else
+ if(parent != null)
+ parent.updateChildren(_canvasModel.ddm.getComplexActivityChildren(parent.activity.activityUIID));
+ else if(gparent != null)
+ gparent.updateChildren(_canvasModel.ddm.getComplexActivityChildren(gparent.activity.activityUIID));
+ else
+ return;
+
+ } else {
+
+ if(!isActivityReadOnly(ca, Dictionary.getValue("cv_element_readOnly_action_del")) && !ca.branchConnector && !isActivityProtected(ca)) {
+ if (ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || ca.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isBranchingActivity()){
+ Debugger.log("removing complex act that hit bin" , Debugger.CRITICAL, "isActivityOnBin", "CanvasController");
+ if(ca.activity.isBranchingActivity())
+ _canvasModel.getCanvas().ddm.removeEntries(_canvasModel.getCanvas().ddm.getBranchMappingsByActivityUIIDAndType(ca.activity.activityUIID).all);
+
+ _canvasModel.removeComplexActivity(ca);
+ } else {
+ _canvasModel.removeActivityOnBin(ca.activity.activityUIID);
+ }
+ } else {
+ activitySnapBack(ca);
+ }
+ }
+
+ _canvasModel.getCanvas().bin.setOff();
+ }
+ }
+
+ public function transitionClick(ct:CanvasTransition):Void{
+ Debugger.log('transitionClick Transition:'+ct.transition.uiID,Debugger.GEN,'transitionClick','CanvasController');
+ _canvasModel.getCanvas().stopActiveTool();
+
+ _canvasModel.selectedItem = ct;
+ _canvasModel.isDragging = true;
+ ct.startDrag(false);
+
+ }
+
+ public function branchClick(bc:BranchConnector):Void{
+ Debugger.log('branchClick Transition:'+bc.branch.branchUIID,Debugger.GEN,'branchClick','CanvasController');
+ _canvasModel.getCanvas().stopActiveTool();
+
+ _canvasModel.selectedItem = bc;
+ _canvasModel.isDragging = true;
+
+ bc.startDrag(false);
+ bc.branchLabel._visible = false;
+
+ }
+
+ public function transitionDoubleClick(ct:CanvasTransition):Void{
+ Debugger.log('transitionDoubleClick CanvasTransition:'+ct.transition.transitionUIID,Debugger.GEN,'transitionDoubleClick','CanvasController');
+
+ _canvasModel.getCanvas().stopActiveTool();
+
+ //TODO: fix this, its null
+ _canvasView = CanvasView(getView());
+
+ if(!isTransitionTargetReadOnly(ct, Dictionary.getValue("cv_element_readOnly_action_mod"))) _canvasModel.activeView.createTransitionPropertiesDialog("centre",Delegate.create(this, transitionPropertiesOK));
+
+ _canvasModel.selectedItem = ct;
+ }
+
+ public function branchDoubleClick(bc:BranchConnector):Void{
+ Debugger.log('branchDoubleClick CanvasConnection:' + bc.branch.branchUIID,Debugger.GEN,'branchDoubleClick','CanvasController');
+
+ _canvasModel.getCanvas().stopActiveTool();
+
+ //TODO: fix this, its null
+ _canvasView = CanvasView(getView());
+ _canvasModel.selectedItem = bc;
+ }
+
+ public function transitionRelease(ct:CanvasTransition):Void{
+ Debugger.log("transitionRelease Transition:" + ct.transition.uiID, Debugger.GEN, "transitionRelease", "CanvasController");
+ if(_canvasModel.isDragging){
+ ct.stopDrag();
+
+ if(ct.hitTest(_canvasModel.getCanvas().bin) && !isTransitionTargetReadOnly(ct, Dictionary.getValue("cv_element_readOnly_action_del"))){
+ _canvasModel.getCanvas().removeTransition(ct.transition.transitionUIID);
+ } else {
+ if (ct._x != ct.xPosition){
+ var t = _canvasModel.transitionsDisplayed.remove(ct.transition.transitionUIID);
+ t.removeMovieClip();
+ _canvasModel.setDirty();
+ }
+ }
+ }
+
+ }
+
+ public function branchRelease(bc:BranchConnector):Void{
+ Debugger.log("branchRelease Transition:" + bc.branch.branchUIID, Debugger.GEN, "branchRelease", "CanvasController");
+
+ if(_canvasModel.isDragging){
+ bc.stopDrag();
+ bc.branchLabel._visible = true;
+
+ if(bc.hitTest(_canvasModel.getCanvas().bin) && !isBranchTargetReadOnly(bc, Dictionary.getValue("cv_element_readOnly_action_del"))){
+ var branchesToDelete:Array;
+ Debugger.log("branchRelease hittest:" + bc.branch.branchUIID, Debugger.GEN, "branchRelease", "CanvasController");
+
+ if(bc.branch.direction == BranchConnector.DIR_FROM_START) {
+ if(_canvasModel.activeView.activity.firstActivityUIID == bc.branch.sequenceActivity.activityUIID)
+ _canvasModel.activeView.activity.defaultBranch = _canvasModel.getCanvas().ddm.findNewDefaultBranch(_canvasModel.activeView.activity, bc.branch);
+
+ branchesToDelete = _canvasModel.getCanvas().ddm.getBranchesForActivityUIID(bc.branch.sequenceActivity.activityUIID);
+ for(var i=0; i 0) {
if(CookieMonster.cookieExists(AUTOSAVE_TAG + _root.userID)) {
canvasModel.autoSaveWait = true;
@@ -144,33 +144,33 @@
if(clearCanvas(true)){
_ddm.setDesign(designData);
- if(_ddm.editOverrideLock && !_ddm.validDesign) Application.getInstance().getToolbar().setButtonState("cancel_btn", false, true);
+ if(_ddm.editOverrideLock && !_ddm.validDesign) Application.getInstance().getToolbar().setButtonState("cancel_btn", false, true);
if(canvasModel.importing){
Application.getInstance().getWorkspace().getWorkspaceModel().clearWorkspaceCache(_ddm.workspaceFolderID);
-
- _undoStack = new Array();
- _redoStack = new Array();
-
- canvasModel.importing = false;
- } else if(canvasModel.editing){
+
+ _undoStack = new Array();
+ _redoStack = new Array();
+
+ canvasModel.importing = false;
+ } else if(canvasModel.editing){
// TODO: stuff to do before design is displayed
// do we need editing flag in CanvasModel?
}
checkValidDesign();
checkReadOnlyDesign();
- canvasModel.setDesignTitle();
+ canvasModel.setDesignTitle();
canvasModel.lastBranchActionType = CanvasModel.OPEN_FROM_FILE;
- canvasModel.setDirty();
+ canvasModel.setDirty();
- LFMenuBar.getInstance().enableExport(!canvasModel.autoSaveWait);
- LFMenuBar.getInstance().enableInsertDesign(!canvasModel.autoSaveWait);
+ LFMenuBar.getInstance().enableExport(!canvasModel.autoSaveWait);
+ LFMenuBar.getInstance().enableInsertDesign(!canvasModel.autoSaveWait);
}else{
Debugger.log('Set design failed as old design could not be cleared',Debugger.CRITICAL,"setDesign",'Canvas');
}
- }
+ }
/**
* Clears the design in the canvas.but leaves other state variables (undo etc..)
@@ -188,28 +188,28 @@
//as its a new instance of the ddm,need to add the listener again
_ddm.addEventListener('ddmUpdate',Proxy.create(this,onDDMUpdated));
_ddm.addEventListener('ddmBeforeUpdate',Proxy.create(this,onDDMBeforeUpdate));
-
+
checkValidDesign();
- checkReadOnlyDesign();
-
+ checkReadOnlyDesign();
+
if(canvasModel.activeView != null) {
- canvasModel.closeAllComplexViews();
-
- for(var i=0; i 0)) {
if(!ddm.readOnly) {
var tag:String = AUTOSAVE_TAG + _root.userID;
@@ -243,8 +243,8 @@
}
// auto-save existing ddm
- Debugger.log("auto-saving...", Debugger.CRITICAL, "autoSave", "CanvasHelper");
-
+ Debugger.log("auto-saving...", Debugger.CRITICAL, "autoSave", "CanvasHelper");
+
var res = CookieMonster.save(dto,tag,true);
if(!res){
@@ -257,12 +257,12 @@
discardAutoSaveDesign();
}
- }
-
- public function openSystemSettings(tabID:Number):Void {
- System.showSettings(tabID);
}
+ public function openSystemSettings(tabID:Number):Void {
+ System.showSettings(tabID);
+ }
+
/**
* Removes an activity from Design Data Model using its activityUIID.
* Called by the bin
@@ -274,15 +274,15 @@
Debugger.log('activityUIID:'+activityUIID,4,'removeActivity','Canvas');
// remove transitions and/or branches connected to this activity being removed
- _ddm.removeTransitionByConnection(activityUIID);
-
- canvasModel.clearGroupedActivities(activityUIID);
-
- if(canvasModel.activeView instanceof CanvasBranchView)
+ _ddm.removeTransitionByConnection(activityUIID);
+
+ canvasModel.clearGroupedActivities(activityUIID);
+
+ if(canvasModel.activeView instanceof CanvasBranchView)
_ddm.removeBranchByConnection(activityUIID, CanvasBranchView(canvasModel.activeView).activity);
-
+
_ddm.removeActivity(activityUIID);
-
+
canvasModel.setDirty();
canvasModel.selectedItem = null;
}
@@ -450,13 +450,13 @@
public function checkValidDesign(){
if(_ddm.validDesign){
- Application.getInstance().getToolbar().setButtonState('preview_btn', true);
+ Application.getInstance().getToolbar().setButtonState('preview_btn', true);
Application.getInstance().getToolbar().setButtonState('preview_btn_click_target', true, false);
LFMenuBar.getInstance().enableExport(true);
}else{
- Application.getInstance().getToolbar().setButtonState('preview_btn', false);
+ Application.getInstance().getToolbar().setButtonState('preview_btn', false);
Application.getInstance().getToolbar().setButtonState('preview_btn_click_target', true, true);
- LFMenuBar.getInstance().enableExport(false);
+ LFMenuBar.getInstance().enableExport(false);
}
}
@@ -502,7 +502,7 @@
LFMessage.showMessageAlert(Dictionary.getValue('al_activity_paste_invalid'));
Debugger.log('Cant paste this item!',Debugger.GEN,'setPastedItem','Canvas');
}
- }
+ }
/**
* Appends the customCSV parameter passed from the external machine if it was passed
@@ -523,50 +523,50 @@
}
return tempURL;
}
-
- /**
- * Array of tool content IDs within the complex activity.
- *
- * @param ca Canvas object
- * @return array of tool content IDs
- */
-
- private function getToolContentArray(ca):Object {
- var o = new Object();
-
- o.toolContentIDs = getAllToolContentIDs(ca.activity.activityUIID);
- Debugger.log('toolContentIDs: ' + o.toolContentIDs,Debugger.CRITICAL,'getToolContentArray','CanvasHelper');
+
+ /**
+ * Array of tool content IDs within the complex activity.
+ *
+ * @param ca Canvas object
+ * @return array of tool content IDs
+ */
+
+ private function getToolContentArray(ca):Object {
+ var o = new Object();
+ o.toolContentIDs = getAllToolContentIDs(ca.activity.activityUIID);
+ Debugger.log('toolContentIDs: ' + o.toolContentIDs,Debugger.CRITICAL,'getToolContentArray','CanvasHelper');
+
if (_root.customCSV != null) {
o.customCSV = _root.customCSV;
}
-
- return o;
- }
-
- private function getAllToolContentIDs(activityUIID:Number, appendStr:String):String {
- var idString:String = new String();
- if(appendStr != null) idString.concat(appendStr);
-
- var _children:Array = _ddm.getComplexActivityChildren(activityUIID);
- Debugger.log('children length: ' + _children.length, Debugger.CRITICAL,'getAllToolContentIDs','CanvasHelper');
-
- for(var i=0; i<_children.length; i++) {
- Debugger.log('tool id: ' + ToolActivity(_children[i]).toolContentID, Debugger.CRITICAL,'getAllToolContentIDs','CanvasHelper');
-
- if(ToolActivity(_children[i]).toolContentID != null) {
- if(idString.length <= 0) idString = idString.concat(ToolActivity(_children[i]).toolContentID);
- else idString = idString.concat("," + ToolActivity(_children[i]).toolContentID);
- } else {
- idString = getAllToolContentIDs(_children[i].activityUIID, idString);
- }
-
- Debugger.log('id string: ' + idString, Debugger.CRITICAL,'getAllToolContentIDs','CanvasHelper');
- }
-
- return idString;
+
+ return o;
}
+ private function getAllToolContentIDs(activityUIID:Number, appendStr:String):String {
+ var idString:String = new String();
+ if(appendStr != null) idString.concat(appendStr);
+
+ var _children:Array = _ddm.getComplexActivityChildren(activityUIID);
+ Debugger.log('children length: ' + _children.length, Debugger.CRITICAL,'getAllToolContentIDs','CanvasHelper');
+
+ for(var i=0; i<_children.length; i++) {
+ Debugger.log('tool id: ' + ToolActivity(_children[i]).toolContentID, Debugger.CRITICAL,'getAllToolContentIDs','CanvasHelper');
+
+ if(ToolActivity(_children[i]).toolContentID != null) {
+ if(idString.length <= 0) idString = idString.concat(ToolActivity(_children[i]).toolContentID);
+ else idString = idString.concat("," + ToolActivity(_children[i]).toolContentID);
+ } else {
+ idString = getAllToolContentIDs(_children[i].activityUIID, idString);
+ }
+
+ Debugger.log('id string: ' + idString, Debugger.CRITICAL,'getAllToolContentIDs','CanvasHelper');
+ }
+
+ return idString;
+ }
+
private function setNewContentID(r, o){
if(r instanceof LFError){
r.showMessageConfirm();
@@ -578,231 +578,231 @@
return pasteToolItem(o.data, o, _newToolContentID);
}
}
- }
-
- private function setNewContents(r, o) {
- Debugger.log("setting new contents: " + r, Debugger.CRITICAL, "setNewContents", "CanvasHelper");
- var _newIDMap:Hashtable = new Hashtable("newIDMap");
-
- if(r instanceof LFError){
- r.showMessageConfirm();
- } else {
-
- var _newIDMapArray = String(r).split(",");
- for(var i=0; i<_newIDMapArray.length; i++) {
- var itemArray:Array = _newIDMapArray[i].split("=");
- _newIDMap.put(itemArray[0], itemArray[1]);
- }
-
- if (o.data instanceof CanvasOptionalActivity || o.data instanceof CanvasParallelActivity){
- return pasteComplexItem(o.data.activity, o, _newIDMap);
- } else if(o.data instanceof CanvasActivity && o.data.activity.isBranchingActivity()) {
- return pasteBranchingItem(o.data.activity, o, _newIDMap);
- } else if(o.data instanceof ComplexActivity){
- return pasteComplexItem(o.data, o, _newIDMap);
- }
- }
}
-
- private function pasteComplexItem(complexToCopy:ComplexActivity, o:Object, toolContentIDMap:Hashtable, parentAct:ComplexActivity):ComplexActivity {
- Debugger.log("pasting new cocomplex: " + complexToCopy.title, Debugger.CRITICAL, "pasteComplexItem", "CanvasHelper");
-
- var newComplexActivity:ComplexActivity = complexToCopy.clone();
- newComplexActivity.activityUIID = _ddm.newUIID();
-
- // TODO: improve for dropping into branching view
- if(parentAct == null) {
- newComplexActivity.xCoord = o.data.activity.xCoord + o.data.getVisibleWidth() + 10;
- newComplexActivity.yCoord = o.data.activity.yCoord + 10;
- } else {
- newComplexActivity.parentUIID = parentAct.activityUIID;
- newComplexActivity.parentActivityID = parentAct.activityID;
- }
-
- if(parentAct == null) canvasModel.haltRefresh(true);
-
- copyChildren(complexToCopy, newComplexActivity, o, toolContentIDMap);
-
- if(parentAct == null) canvasModel.haltRefresh(false);
-
- pasteActivityItem(newComplexActivity, o);
-
- return newComplexActivity;
- }
-
- private function pasteSequenceItem(sequenceToCopy:SequenceActivity, o:Object, toolContentIDMap:Hashtable, parentAct:ComplexActivity):SequenceActivity {
- Debugger.log("pasting new sequence: " + sequenceToCopy.title, Debugger.CRITICAL, "pasteSequenceItem", "CanvasHelper");
- if(sequenceToCopy.isDefault & sequenceToCopy.empty)
- return null;
-
- var newSequenceActivity:SequenceActivity = sequenceToCopy.clone();
- newSequenceActivity.activityUIID = _ddm.newUIID();
-
- newSequenceActivity.parentUIID = parentAct.activityUIID;
- newSequenceActivity.parentActivityID = parentAct.activityID;
-
- copySequence(sequenceToCopy, newSequenceActivity, o, toolContentIDMap);
-
- pasteActivityItem(newSequenceActivity, o);
-
- return newSequenceActivity;
- }
-
- private function pasteBranchingItem(branchingToCopy:BranchingActivity, o:Object, toolContentIDMap:Hashtable, parentAct:ComplexActivity):BranchingActivity {
- Debugger.log("pasting new branching: " + branchingToCopy.title, Debugger.CRITICAL, "pasteBranchingItem", "CanvasHelper");
-
- var newBranchingActivity:BranchingActivity = branchingToCopy.clone();
- newBranchingActivity.activityUIID = _ddm.newUIID();
-
- if(parentAct == null) {
- newBranchingActivity.xCoord = o.data.activity.xCoord + o.data.getVisibleWidth() + 10;
- newBranchingActivity.yCoord = o.data.activity.yCoord + 10;
- } else {
- newBranchingActivity.parentUIID = parentAct.activityUIID;
- newBranchingActivity.parentActivityID = parentAct.activityID;
- }
-
- copyChildren(branchingToCopy, newBranchingActivity, o, toolContentIDMap);
-
- pasteActivityItem(newBranchingActivity, o);
-
- return newBranchingActivity;
- }
-
- private function pasteToolItem(toolToCopy:ToolActivity, o:Object, newToolContentID:Number, parentAct:ComplexActivity):ToolActivity{
- //clone the activity
- var newToolActivity:ToolActivity = toolToCopy.clone();
- newToolActivity.activityUIID = _ddm.newUIID();
-
- if (newToolContentID != null || newToolContentID != undefined){
- newToolActivity.toolContentID = newToolContentID;
- }
-
- if(parentAct == null) {
- newToolActivity.xCoord = o.data.activity.xCoord + 10;
- newToolActivity.yCoord = o.data.activity.yCoord + 10;
- } else {
- newToolActivity.parentUIID = parentAct.activityUIID;
- newToolActivity.parentActivityID = parentAct.activityID;
- }
-
- pasteActivityItem(newToolActivity, o);
-
- return newToolActivity;
- }
-
- private function pasteActivityItem(activity:Activity, o:Object) {
- canvasModel.selectedItem = activity;
-
- if(canvasModel.activeView instanceof CanvasBranchView && activity.parentUIID == null)
- activity.parentUIID = CanvasBranchView(canvasModel.activeView).defaultSequenceActivity.activityUIID;
-
- if(o.type == Application.CUT_TYPE){
- Application.getInstance().setClipboardData(activity, Application.COPY_TYPE);
- removeActivity(o.data.activity.activityUIID);
- } else {
- // TODO: Fix for RTL
- if(o.count <= 1) { activity.title = Dictionary.getValue('prefix_copyof')+activity.title; }
- else { activity.title = Dictionary.getValue('prefix_copyof_count', [o.count])+activity.title; }
- }
-
- _ddm.addActivity(activity);
- canvasModel.setDirty();
- }
-
- private function copySequence(sequenceToCopy, parentAct:SequenceActivity, o:Object, toolContentIDMap:Hashtable) {
- Debugger.log("copy sequence: " + parentAct.activityUIID, Debugger.CRITICAL, "copySequence", "CanvasHelper");
-
- var activityMap:Hashtable = new Hashtable("activityMap");
- copyChildren(sequenceToCopy, parentAct, o, toolContentIDMap, activityMap);
-
- var activityMapKeys:Array = activityMap.keys();
- Debugger.log("activityMapKeys len: " + activityMapKeys.length, Debugger.CRITICAL, "copySequence", "CanvasHelper");
-
- for(var i=0; i 0) ? CanvasActivity(canvasModel.openBranchingActivities[canvasModel.openBranchingActivities.length-1]) : null;
-
- if(prevActiveView != null)
- canvasModel.activeView = prevActiveView;
- else
+ private function setNewContents(r, o) {
+ Debugger.log("setting new contents: " + r, Debugger.CRITICAL, "setNewContents", "CanvasHelper");
+ var _newIDMap:Hashtable = new Hashtable("newIDMap");
+
+ if(r instanceof LFError){
+ r.showMessageConfirm();
+ } else {
+
+ var _newIDMapArray = String(r).split(",");
+ for(var i=0; i<_newIDMapArray.length; i++) {
+ var itemArray:Array = _newIDMapArray[i].split("=");
+ _newIDMap.put(itemArray[0], itemArray[1]);
+ }
+
+ if (o.data instanceof CanvasOptionalActivity || o.data instanceof CanvasParallelActivity){
+ return pasteComplexItem(o.data.activity, o, _newIDMap);
+ } else if(o.data instanceof CanvasActivity && o.data.activity.isBranchingActivity()) {
+ return pasteBranchingItem(o.data.activity, o, _newIDMap);
+ } else if(o.data instanceof ComplexActivity){
+ return pasteComplexItem(o.data, o, _newIDMap);
+ }
+ }
+ }
+
+ private function pasteComplexItem(complexToCopy:ComplexActivity, o:Object, toolContentIDMap:Hashtable, parentAct:ComplexActivity):ComplexActivity {
+ Debugger.log("pasting new cocomplex: " + complexToCopy.title, Debugger.CRITICAL, "pasteComplexItem", "CanvasHelper");
+
+ var newComplexActivity:ComplexActivity = complexToCopy.clone();
+ newComplexActivity.activityUIID = _ddm.newUIID();
+
+ // TODO: improve for dropping into branching view
+ if(parentAct == null) {
+ newComplexActivity.xCoord = o.data.activity.xCoord + o.data.getVisibleWidth() + 10;
+ newComplexActivity.yCoord = o.data.activity.yCoord + 10;
+ } else {
+ newComplexActivity.parentUIID = parentAct.activityUIID;
+ newComplexActivity.parentActivityID = parentAct.activityID;
+ }
+
+ if(parentAct == null) canvasModel.haltRefresh(true);
+
+ copyChildren(complexToCopy, newComplexActivity, o, toolContentIDMap);
+
+ if(parentAct == null) canvasModel.haltRefresh(false);
+
+ pasteActivityItem(newComplexActivity, o);
+
+ return newComplexActivity;
+ }
+
+ private function pasteSequenceItem(sequenceToCopy:SequenceActivity, o:Object, toolContentIDMap:Hashtable, parentAct:ComplexActivity):SequenceActivity {
+ Debugger.log("pasting new sequence: " + sequenceToCopy.title, Debugger.CRITICAL, "pasteSequenceItem", "CanvasHelper");
+ if(sequenceToCopy.isDefault & sequenceToCopy.empty)
+ return null;
+
+ var newSequenceActivity:SequenceActivity = sequenceToCopy.clone();
+ newSequenceActivity.activityUIID = _ddm.newUIID();
+
+ newSequenceActivity.parentUIID = parentAct.activityUIID;
+ newSequenceActivity.parentActivityID = parentAct.activityID;
+
+ copySequence(sequenceToCopy, newSequenceActivity, o, toolContentIDMap);
+
+ pasteActivityItem(newSequenceActivity, o);
+
+ return newSequenceActivity;
+ }
+
+ private function pasteBranchingItem(branchingToCopy:BranchingActivity, o:Object, toolContentIDMap:Hashtable, parentAct:ComplexActivity):BranchingActivity {
+ Debugger.log("pasting new branching: " + branchingToCopy.title, Debugger.CRITICAL, "pasteBranchingItem", "CanvasHelper");
+
+ var newBranchingActivity:BranchingActivity = branchingToCopy.clone();
+ newBranchingActivity.activityUIID = _ddm.newUIID();
+
+ if(parentAct == null) {
+ newBranchingActivity.xCoord = o.data.activity.xCoord + o.data.getVisibleWidth() + 10;
+ newBranchingActivity.yCoord = o.data.activity.yCoord + 10;
+ } else {
+ newBranchingActivity.parentUIID = parentAct.activityUIID;
+ newBranchingActivity.parentActivityID = parentAct.activityID;
+ }
+
+ copyChildren(branchingToCopy, newBranchingActivity, o, toolContentIDMap);
+
+ pasteActivityItem(newBranchingActivity, o);
+
+ return newBranchingActivity;
+ }
+
+ private function pasteToolItem(toolToCopy:ToolActivity, o:Object, newToolContentID:Number, parentAct:ComplexActivity):ToolActivity{
+ //clone the activity
+ var newToolActivity:ToolActivity = toolToCopy.clone();
+ newToolActivity.activityUIID = _ddm.newUIID();
+
+ if (newToolContentID != null || newToolContentID != undefined){
+ newToolActivity.toolContentID = newToolContentID;
+ }
+
+ if(parentAct == null) {
+ newToolActivity.xCoord = o.data.activity.xCoord + 10;
+ newToolActivity.yCoord = o.data.activity.yCoord + 10;
+ } else {
+ newToolActivity.parentUIID = parentAct.activityUIID;
+ newToolActivity.parentActivityID = parentAct.activityID;
+ }
+
+ pasteActivityItem(newToolActivity, o);
+
+ return newToolActivity;
+ }
+
+ private function pasteActivityItem(activity:Activity, o:Object) {
+ canvasModel.selectedItem = activity;
+
+ if(canvasModel.activeView instanceof CanvasBranchView && activity.parentUIID == null)
+ activity.parentUIID = CanvasBranchView(canvasModel.activeView).defaultSequenceActivity.activityUIID;
+
+ if(o.type == Application.CUT_TYPE){
+ Application.getInstance().setClipboardData(activity, Application.COPY_TYPE);
+ removeActivity(o.data.activity.activityUIID);
+ } else {
+ // TODO: Fix for RTL
+ if(o.count <= 1) { activity.title = Dictionary.getValue('prefix_copyof')+activity.title; }
+ else { activity.title = Dictionary.getValue('prefix_copyof_count', [o.count])+activity.title; }
+ }
+
+ _ddm.addActivity(activity);
+ canvasModel.setDirty();
+ }
+
+ private function copySequence(sequenceToCopy, parentAct:SequenceActivity, o:Object, toolContentIDMap:Hashtable) {
+ Debugger.log("copy sequence: " + parentAct.activityUIID, Debugger.CRITICAL, "copySequence", "CanvasHelper");
+
+ var activityMap:Hashtable = new Hashtable("activityMap");
+ copyChildren(sequenceToCopy, parentAct, o, toolContentIDMap, activityMap);
+
+ var activityMapKeys:Array = activityMap.keys();
+ Debugger.log("activityMapKeys len: " + activityMapKeys.length, Debugger.CRITICAL, "copySequence", "CanvasHelper");
+
+ for(var i=0; i 0) ? CanvasActivity(canvasModel.openBranchingActivities[canvasModel.openBranchingActivities.length-1]) : null;
+
+ if(prevActiveView != null)
+ canvasModel.activeView = prevActiveView;
+ else
canvasModel.activeView = (parentBranching.activity.isBranchingActivity()) ? parentBranching.activity.branchView : canvasView;
-
- canvasModel.currentBranchingActivity = (parentBranching.activity.isBranchingActivity()) ? parentBranching : null;
-
- if(canvasModel.activeView instanceof CanvasComplexView)
- CanvasComplexView(canvasModel.activeView).branchingToClear.push(branchingAct);
-
- Debugger.log("activeView: " + canvasModel.activeView, Debugger.CRITICAL, "closeBranchView", "CanvasHelper");
- Debugger.log("currentBranchingActivity: " + canvasModel.currentBranchingActivity, Debugger.CRITICAL, "closeBranchView", "CanvasHelper");
+ canvasModel.currentBranchingActivity = (parentBranching.activity.isBranchingActivity()) ? parentBranching : null;
+
+ if(canvasModel.activeView instanceof CanvasComplexView)
+ CanvasComplexView(canvasModel.activeView).branchingToClear.push(branchingAct);
+
+ Debugger.log("activeView: " + canvasModel.activeView, Debugger.CRITICAL, "closeBranchView", "CanvasHelper");
+ Debugger.log("currentBranchingActivity: " + canvasModel.currentBranchingActivity, Debugger.CRITICAL, "closeBranchView", "CanvasHelper");
+
}
/**
@@ -815,41 +815,41 @@
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 the competence editor window
- */
+ }
+
+ /**
+ * Opens the competence editor window
+ */
public function openCompetenceEditorWindow() {
- var controller:CanvasController = canvasView.getController();
-
- app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('competence_editor_dlg'), closeButton:true, resize:false, scrollContentPath:'CompetenceEditorDialog'});
- app.dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
- }
-
- /**
- * Opens the competence definition dialog
- */
+ var controller:CanvasController = canvasView.getController();
+
+ app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('competence_editor_dlg'), closeButton:true, resize:false, scrollContentPath:'CompetenceEditorDialog'});
+ app.dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
+ }
+
+ /**
+ * Opens the competence definition dialog
+ */
public function openCompetenceDefinitionWindow():MovieClip {
- var controller:CanvasController = canvasView.getController();
- var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('competence_def_dlg'), closeButton:true, scrollContentPath:'CompetenceDefinitionDialog'});
+ var controller:CanvasController = canvasView.getController();
+ var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue('competence_def_dlg'), closeButton:true, scrollContentPath:'CompetenceDefinitionDialog'});
- dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
- return dialog;
- }
+ dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
+ return dialog;
+ }
public function openBranchView(ba, visible:Boolean){
var cx:Number = ba._x + ba.getVisibleWidth()/2;
var cy:Number = ba._y + ba.getVisibleHeight()/2;
- var isVisible:Boolean = (visible == null) ? true : visible;
-
- var target:MovieClip = canvasModel.activeView.branchContent; //(canvasModel.activeView instanceof CanvasBranchView) ? canvasModel.activeView.branchContent : _canvasView_mc.branchContent;
-
- Debugger.log("canvasModel.activeView: "+ canvasModel.activeView, Debugger.CRITICAL, "openBranchView", "CanvasHelper");
+ var isVisible:Boolean = (visible == null) ? true : visible;
+ var target:MovieClip = canvasModel.activeView.branchContent; //(canvasModel.activeView instanceof CanvasBranchView) ? canvasModel.activeView.branchContent : _canvasView_mc.branchContent;
+
+ Debugger.log("canvasModel.activeView: "+ canvasModel.activeView, Debugger.CRITICAL, "openBranchView", "CanvasHelper");
+
var _branchView_mc:MovieClip = target.createChildAtDepth("canvasBranchView", target.getNextHighestDepth(), {_x: cx, _y: cy, _canvasBranchingActivity:ba, _open:isVisible, _prevActiveView: canvasModel.activeView});
var branchView:CanvasBranchView = CanvasBranchView(_branchView_mc);
-
+
branchView.init(canvasModel, undefined);
//Add listener to view so that we know when it's loaded
@@ -858,61 +858,61 @@
canvasModel.addObserver(branchView);
ba.activity.branchView = branchView;
-
+
canvasModel.openBranchingActivities.push(ba);
- }
-
- public function openComplexView(ca:Object):Void {
-
- var target:MovieClip = canvasModel.activeView.complexViewer; // (canvasModel.activeView instanceof CanvasBranchView || canvasModel) ? canvasModel.activeView.complexViewer : _canvasView_mc.complexViewer;
-
- var cx:Number;
- var cy:Number;
-
- var parentAct:Activity = ddm.getActivityByUIID(ca.activity.parentUIID);
- var grandParentActivity:MovieClip = canvasModel.activitiesDisplayed.get(parentAct.parentUIID);
- var parentActivity:MovieClip = canvasModel.activitiesDisplayed.get(parentAct.activityUIID);
-
- if(canvasModel.activeView instanceof CanvasComplexView) {
- if(canvasModel.activeView.complexActivity == ca) {
- return;
- }
-
- target = canvasModel.activeView.complexViewer;
-
- Debugger.log("parentAct: " + parentAct.activityUIID, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
- Debugger.log("parentAct type: " + parentAct.activityTypeID, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
- Debugger.log("gpAct: " + grandParentActivity.activity.activityUIID, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
-
- if(parentAct.isSequenceActivity() && canvasModel.activeView.openActivity instanceof CanvasOptionalActivity) {
- cx = parentAct.xCoord + ca._x;
- cy = parentAct.yCoord + ca._y;
- } else {
- cx = ca._x;
- cy = ca._y;
- }
- } else {
-
- if(parentAct.isSequenceActivity() && grandParentActivity instanceof CanvasOptionalActivity) {
- cx = grandParentActivity._x + parentAct.xCoord + ca._x;
- cy = grandParentActivity._y + parentAct.yCoord + ca._y;
- } else {
- cx = parentActivity._x + ca._x;
- cy = parentActivity._y + ca._y;
- }
- }
-
- Debugger.log("co ord x: " + cx + " y: " + cy, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
-
- _canvasComplexView_mc = target.createChildAtDepth("canvasComplexView", DepthManager.kTop, {_x: cx, _y: cy, _complexActivity:ca, _parentActivity:parentActivity, _visible:false, _prevActiveView: canvasModel.activeView});
- canvasComplexView = CanvasComplexView(_canvasComplexView_mc);
-
- canvasComplexView.init(canvasModel, undefined);
- canvasComplexView.addEventListener('load', Proxy.create(this, viewLoaded));
-
- canvasModel.addObserver(canvasComplexView);
- }
+ }
+ public function openComplexView(ca:Object):Void {
+
+ var target:MovieClip = canvasModel.activeView.complexViewer; // (canvasModel.activeView instanceof CanvasBranchView || canvasModel) ? canvasModel.activeView.complexViewer : _canvasView_mc.complexViewer;
+
+ var cx:Number;
+ var cy:Number;
+
+ var parentAct:Activity = ddm.getActivityByUIID(ca.activity.parentUIID);
+ var grandParentActivity:MovieClip = canvasModel.activitiesDisplayed.get(parentAct.parentUIID);
+ var parentActivity:MovieClip = canvasModel.activitiesDisplayed.get(parentAct.activityUIID);
+
+ if(canvasModel.activeView instanceof CanvasComplexView) {
+ if(canvasModel.activeView.complexActivity == ca) {
+ return;
+ }
+
+ target = canvasModel.activeView.complexViewer;
+
+ Debugger.log("parentAct: " + parentAct.activityUIID, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
+ Debugger.log("parentAct type: " + parentAct.activityTypeID, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
+ Debugger.log("gpAct: " + grandParentActivity.activity.activityUIID, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
+
+ if(parentAct.isSequenceActivity() && canvasModel.activeView.openActivity instanceof CanvasOptionalActivity) {
+ cx = parentAct.xCoord + ca._x;
+ cy = parentAct.yCoord + ca._y;
+ } else {
+ cx = ca._x;
+ cy = ca._y;
+ }
+ } else {
+
+ if(parentAct.isSequenceActivity() && grandParentActivity instanceof CanvasOptionalActivity) {
+ cx = grandParentActivity._x + parentAct.xCoord + ca._x;
+ cy = grandParentActivity._y + parentAct.yCoord + ca._y;
+ } else {
+ cx = parentActivity._x + ca._x;
+ cy = parentActivity._y + ca._y;
+ }
+ }
+
+ Debugger.log("co ord x: " + cx + " y: " + cy, Debugger.CRITICAL, "openComplexView", "CanvasHelper");
+
+ _canvasComplexView_mc = target.createChildAtDepth("canvasComplexView", DepthManager.kTop, {_x: cx, _y: cy, _complexActivity:ca, _parentActivity:parentActivity, _visible:false, _prevActiveView: canvasModel.activeView});
+ canvasComplexView = CanvasComplexView(_canvasComplexView_mc);
+
+ canvasComplexView.init(canvasModel, undefined);
+ canvasComplexView.addEventListener('load', Proxy.create(this, viewLoaded));
+
+ canvasModel.addObserver(canvasComplexView);
+ }
+
/**
* recieves event fired after update to the DDM
* @usage
@@ -951,7 +951,7 @@
public function get ddm():DesignDataModel{
return _ddm;
- }
+ }
private function createContentFolder():Void{
var callback:Function = Proxy.create(this,setNewContentFolderID);
@@ -977,6 +977,6 @@
public function confirmedClearDesign(ref):Void{
var fn:Function = Proxy.create(ref,clearCanvas,true);
fn.apply();
- }
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasModel.as
===================================================================
diff -u -r470bd43cd17fa6128a767fec948850a5815c1c55 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasModel.as (.../CanvasModel.as) (revision 470bd43cd17fa6128a767fec948850a5815c1c55)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasModel.as (.../CanvasModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,1103 +1,1103 @@
-/****************************************************************************
- * 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.authoring.*;
-import org.lamsfoundation.lams.authoring.cv.*;
-import org.lamsfoundation.lams.authoring.br.BranchConnector;
-import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.ui.*;
-import org.lamsfoundation.lams.common.dict.*;
-import mx.events.*;
-
-/*
-* Model for the Canvas
-*/
-class org.lamsfoundation.lams.authoring.cv.CanvasModel extends org.lamsfoundation.lams.authoring.cv.CanvasSuperModel {
-
- public static var TRANSITION_TOOL:String = "TRANSITION";
- public static var OPTIONAL_TOOL:String = "OPTIONAL";
- public static var OPTIONAL_SEQ_TOOL:String = "OPTIONAL_SEQ";
- public static var GATE_TOOL:String = "GATE";
- public static var GROUP_TOOL:String = "GROUP";
- public static var BRANCH_TOOL:String = "BRANCH";
-
- public static var OPEN_FROM_FILE:Number = 0;
- public static var ADD_FROM_TEMPLATE:Number = 1;
-
- //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 CanvasModel(cv:Canvas){
- super(cv);
-
- //Set up this class to use the Flash event delegation model
- EventDispatcher.initialize(this);
-
- }
-
- /**
- * Craetes a [trans][gate act][trans] combo from an existing transition.
- * NOT used anymore as we dont want to allow users to think they can click transitions
- * BUT IF/When the request this - just use this function
- * @usage
- * @param transitionUIID
- * @param gateTypeID
- * @return
- */
- public function createGateTransition(transitionUIID,gateTypeID, parent){
- Debugger.log('transitionUIID:'+transitionUIID,Debugger.GEN,'createGateTransition','CanvasModel');
- Debugger.log('gateTypeID:'+gateTypeID,Debugger.GEN,'createGateTransition','CanvasModel');
-
- var editedTrans = _cv.ddm.getTransitionByUIID(transitionUIID);
- var editedCanvasTrans = _transitionsDisplayed.get(transitionUIID);
- var fromAct = _cv.ddm.getActivityByUIID(editedTrans.fromUIID);
- var toAct = _cv.ddm.getActivityByUIID(editedTrans.toUIID);
-
- //create a gate activity
- var gateAct = new GateActivity(_cv.ddm.newUIID(),gateTypeID);
- gateAct.learningDesignID = _cv.ddm.learningDesignID;
- gateAct.title = Dictionary.getValue('gate_btn');
- gateAct.yCoord = editedCanvasTrans.midPoint.y - (CanvasActivity.GATE_ACTIVITY_WIDTH / 2);
- gateAct.xCoord = editedCanvasTrans.midPoint.x - (CanvasActivity.GATE_ACTIVITY_HEIGHT / 2);
-
- Debugger.log('gateAct.yCoord:'+gateAct.yCoord,Debugger.GEN,'createGateTransition','CanvasModel');
- Debugger.log('gateAct.xCoord:'+gateAct.xCoord,Debugger.GEN,'createGateTransition','CanvasModel');
-
- if(parent != null) {
- gateAct.parentActivityID = parent.activityID;
- gateAct.parentUIID = parent.activityUIID;
- }
-
- _cv.ddm.addActivity(gateAct);
- _cv.ddm.removeTransition(transitionUIID);
-
- //create the from trans
- addActivityToTransition(fromAct);
- addActivityToTransition(gateAct);
- resetTransitionTool();
-
- //create the to trans
- addActivityToTransition(gateAct);
- addActivityToTransition(toAct);
- resetTransitionTool();
-
- //flag the model as dirty and trigger a refresh
- setDirty();
-
- //select the new thing
- setSelectedItem(_activitiesDisplayed.get(gateAct.activityUIID));
-
- }
-
- /**
- * Create a transition between two activities in a Sequence Activity (in Optional).
- *
- * @usage
- * @param sequence
- * @param toActivity
- * @return
- */
- public function createSequenceTransition(fromActivity:Activity, toActivity:Activity):Void {
- addActivityToTransition(fromActivity);
- addActivityToTransition(toActivity);
- resetTransitionTool();
-
- setDirty();
- }
-
- /**
- * Creates a new gate activity at the specified location
- * @usage
- * @param gateTypeID
- * @param pos
- * @return
- */
- public function createNewGate(gateTypeID, pos:Point, parent){
- var gateAct = new GateActivity(_cv.ddm.newUIID(), gateTypeID);
- gateAct.learningDesignID = _cv.ddm.learningDesignID;
-
- gateAct.title = Dictionary.getValue('gate_btn');
- gateAct.yCoord = pos.y;
- gateAct.xCoord = pos.x;
-
- if(parent != null) {
- gateAct.parentActivityID = parent.activityID;
- gateAct.parentUIID = parent.activityUIID;
- }
-
- _cv.ddm.addActivity(gateAct);
-
- setDirty();
-
- //select the new thing
- setSelectedItem(_activitiesDisplayed.get(gateAct.activityUIID));
-
- }
-
- /**
- * Creates a new branch activity at the specified location
- * @usage
- * @param pos
- * @return
- */
- public function createNewBranchActivity(branchTypeID, pos:Point, parent){
- var branchingActivity = new BranchingActivity(_cv.ddm.newUIID(), branchTypeID);
- branchingActivity.title = Dictionary.getValue('branching_act_title');
- branchingActivity.learningDesignID = _cv.ddm.learningDesignID;
- branchingActivity.activityCategoryID = Activity.CATEGORY_SYSTEM;
- branchingActivity.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
-
- branchingActivity.yCoord = pos.y;
- branchingActivity.xCoord = pos.x;
-
- Debugger.log('branchingActivity.yCoord:'+branchingActivity.yCoord,Debugger.GEN,'createNewBranchActivity','CanvasModel');
- Debugger.log('branchingActivity.xCoord:'+branchingActivity.xCoord,Debugger.GEN,'createNewBranchActivity','CanvasModel');
-
- if(parent != null) {
- branchingActivity.parentActivityID = parent.activityID;
- branchingActivity.parentUIID = parent.activityUIID;
- }
-
- _cv.ddm.addActivity(branchingActivity);
-
- //tell the canvas to go refresh
- setDirty();
-
- //select the new thing
- setSelectedItem(_activitiesDisplayed.get(branchingActivity.activityUIID));
- }
-
- public function createNewSequenceActivity(parent, orderID, stopAfterActivity:Boolean, isBranch:Boolean){
- Debugger.log('Running...',Debugger.GEN,'createNewSequenceActivity','CanvasModel');
-
- var seqAct = new SequenceActivity(_cv.ddm.newUIID());
- var title = (isBranch) ? Dictionary.getValue('branch_mapping_dlg_branch_col_lbl') : Dictionary.getValue('sequence_act_title');
- seqAct.title = Dictionary.getValue('sequence_act_title_new', [title, orderID]);
- seqAct.learningDesignID = _cv.ddm.learningDesignID;
- seqAct.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
- seqAct.activityCategoryID = Activity.CATEGORY_SYSTEM;
- seqAct.orderID = (orderID != null || orderID != undefined) ? orderID : 1;
- seqAct.stopAfterActivity = (stopAfterActivity != null) ? stopAfterActivity : true;
-
- if(parent != null) {
- seqAct.parentActivityID = parent.activityID;
- seqAct.parentUIID = parent.activityUIID;
- }
-
- _cv.ddm.addActivity(seqAct);
-
- setDirty();
- }
-
- /**
- * Creates a new group activity at the specified location
- * @usage
- * @param pos
- * @return
- */
- public function createNewGroupActivity(pos:Point, parent){
- Debugger.log('Running...',Debugger.GEN,'createNewGroupActivity','CanvasModel');
-
- //first create the grouping object
- var newGrouping = new Grouping(_cv.ddm.newUIID());
- newGrouping.groupingTypeID = _defaultGroupingTypeID;
-
- _cv.ddm.addGrouping(newGrouping);
-
- var groupingActivity = new GroupingActivity(_cv.ddm.newUIID());
- groupingActivity.title = Dictionary.getValue('grouping_act_title');
- groupingActivity.learningDesignID = _cv.ddm.learningDesignID;
- groupingActivity.createGroupingUIID = newGrouping.groupingUIID;
-
- groupingActivity.yCoord = pos.y;
- groupingActivity.xCoord = pos.x;
-
- Debugger.log('groupingActivity.createGroupingUIID :'+groupingActivity.createGroupingUIID ,Debugger.GEN,'createNewGroupActivity','CanvasModel');
- Debugger.log('groupingActivity.yCoord:'+groupingActivity.yCoord,Debugger.GEN,'createNewGroupActivity','CanvasModel');
- Debugger.log('groupingActivity.xCoord:'+groupingActivity.xCoord,Debugger.GEN,'createNewGroupActivity','CanvasModel');
-
- if(parent != null) {
- groupingActivity.parentActivityID = parent.activityID;
- groupingActivity.parentUIID = parent.activityUIID;
- }
-
- _cv.ddm.addActivity(groupingActivity);
-
- //tell the canvas to go refresh
- setDirty();
-
- //select the new thing
- setSelectedItem(_activitiesDisplayed.get(groupingActivity.activityUIID));
- }
-
- /**
- * Creates a new gate activity at the specified location
- * @usage
- * @param gateTypeID
- * @param pos
- * @return
- */
- public function createNewOptionalActivity(ActivityTypeID, pos:Point, parent, isSequence:Boolean){
- var optAct = new ComplexActivity(_cv.ddm.newUIID());
-
- optAct.learningDesignID = _cv.ddm.learningDesignID;
- optAct.activityTypeID = (!isSequence) ? Activity.OPTIONAL_ACTIVITY_TYPE : Activity.OPTIONS_WITH_SEQUENCES_TYPE;
- optAct.title = (!isSequence) ? Dictionary.getValue('opt_activity_title') : Dictionary.getValue('opt_activity_seq_title');
- optAct.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
- optAct.activityCategoryID = Activity.CATEGORY_SYSTEM;
- optAct.yCoord = pos.y;
- optAct.xCoord = pos.x;
-
- Debugger.log('Optional Activitys Y Coord is :'+optAct.yCoord,Debugger.GEN,'createNewOptionalActivity','CanvasModel');
-
- if(parent != null) {
- optAct.parentActivityID = parent.activityID;
- optAct.parentUIID = parent.activityUIID;
- }
-
- if(isSequence) {
- createNewSequenceActivity(optAct, 1, false);
- createNewSequenceActivity(optAct, 2, false);
- optAct.noSequences = 2;
- }
-
- _cv.ddm.addActivity(optAct);
-
- setDirty();
- setSelectedItem(_activitiesDisplayed.get(optAct.activityUIID));
-
- }
-
- public function removeOptionalSequenceCA(ca:Object, parentID){
- haltRefresh(true);
-
- unhookOptionalSequenceCA(ca);
-
- ca.activity.parentUIID = (activeView instanceof CanvasBranchView) ? activeView.defaultSequenceActivity.activityUIID : null;
- ca.activity.orderID = null;
- ca.activity.parentActivityID = (activeView instanceof CanvasBranchView) ? activeView.defaultSequenceActivity.activityID : null;
-
- tagBranchingActivitiesForClearing(ca);
-
- if(!(activeView instanceof CanvasComplexView)) removeActivity(parentID);
-
- haltRefresh(false);
- setDirty();
- }
-
- private function unhookOptionalSequenceCA(ca:Object) {
- var transitionObj:Object = _cv.ddm.getTransitionsForActivityUIID(ca.activity.activityUIID);
- var sequence:Activity = _cv.ddm.getActivityByUIID(ca.activity.parentUIID);
-
- var toActivity:Activity = null;
- var fromActivity:Activity = null;
- var parentAct:SequenceActivity = SequenceActivity(sequence);
-
- if(transitionObj.into != null && transitionObj.out != null) {
- toActivity = _cv.ddm.getActivityByUIID(transitionObj.out.toUIID);
- fromActivity = _cv.ddm.getActivityByUIID(transitionObj.into.fromUIID);
- } else if(transitionObj.out != null) {
- parentAct.firstActivityUIID = transitionObj.out.toUIID;
- } else if(transitionObj.out == null && transitionObj.into == null){
- parentAct.firstActivityUIID = null;
- }
-
- _cv.ddm.removeTransitionByConnection(ca.activity.activityUIID);
- if(toActivity != null && fromActivity != null) createSequenceTransition(fromActivity, toActivity);
-
- }
-
- public function moveOptionalSequenceCA(ca:Object, parent:Activity):Boolean {
- var minDiff:Number = null;
- var selectedIndex:Number = null;
-
- Debugger.log("ca y: " + ca._y, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
- Debugger.log("parent y: " + parent.yCoord, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
-
- if(ca._y > ca._parent._parent.getVisibleHeight() || ca._y < -ca.getVisibleHeight())
- return false;
-
- var oChildren:Array = _cv.ddm.getComplexActivityChildren(parent.activityUIID);
- oChildren.sortOn('orderID', Array.NUMERIC);
-
- for(var i=0; i 0 && ca.activity.xCoord > ca._x) {
- minDiff = diff;
- selectedIndex = i;
- } else if((minDiff == null || diff > minDiff) && diff < 0 && ca.activity.xCoord < ca._x) {
- minDiff = diff;
- selectedIndex = i;
- }
- }
-
- Debugger.log("selectedIndex: " + selectedIndex, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
- if(selectedIndex != null) {
- if(oChildren[selectedIndex] != ca.activity) {
- // remove ca from sequence
- Debugger.log("selectedIndex order: " + Activity(oChildren[selectedIndex]).orderID, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
- Debugger.log("ca order: " + ca.activity.orderID, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
-
- var _dir:Number = (ca.activity.xCoord > ca._x) ? 0 : 1;
-
- unhookOptionalSequenceCA(ca);
- addOptionalSequenceCA(ca, oChildren[selectedIndex], _dir);
-
- return true;
- }
- }
-
- return false;
- }
-
- private function addOptionalSequenceCA(ca:Object, nextOrPrevActivity:Activity, _dir:Number):Void {
- haltRefresh(true);
-
- var sequence:Activity = _cv.ddm.getActivityByUIID(nextOrPrevActivity.parentUIID);
- var transitionObj:Object = _cv.ddm.getTransitionsForActivityUIID(nextOrPrevActivity.activityUIID);
-
- var targetActivity:Activity = null;
-
- var transition:Transition = (_dir == 0) ? transitionObj.into : transitionObj.out;
-
- if(transition != null) {
- targetActivity = (_dir == 0) ? _cv.ddm.getActivityByUIID(transition.fromUIID) : _cv.ddm.getActivityByUIID(transition.toUIID);
- } else {
- if(_dir == 0) ComplexActivity(sequence).firstActivityUIID = ca.activity.activityUIID;
- }
-
- if(targetActivity != null) {
- var fromActivity:Activity = (_dir == 0) ? targetActivity : nextOrPrevActivity;
- var toActivity:Activity = (_dir == 0) ? nextOrPrevActivity : targetActivity;
-
- _cv.ddm.removeTransition(transition.transitionUIID);
-
- createSequenceTransition(fromActivity, ca.activity);
- createSequenceTransition(ca.activity, toActivity);
-
- } else {
- var fromActivity:Activity = (_dir == 0) ? ca.activity : nextOrPrevActivity;
- var toActivity:Activity = (_dir == 0) ? nextOrPrevActivity : ca.activity;
-
- createSequenceTransition(fromActivity, toActivity);
- }
-
- if(activeView instanceof CanvasComplexView && activeView.openActivity.activity.activityUIID == sequence.parentUIID) {
- activeView.updateActivity();
- } else {
- removeActivity(sequence.parentUIID);
- }
-
- haltRefresh(false);
-
- setDirty();
-
- }
-
- /**
- *Called by the controller when a complex activity is dropped on bin.
- */
- public function removeComplexActivity(ca){
- Debugger.log('Removing Complex Activity: ' + ca.activity.activityUIID,Debugger.GEN,'removeComplexActivity','CanvasModel');
- haltRefresh(true);
-
- // recursively remove all children
- removeComplexActivityChildren(ca.actChildren);
- removeActivityOnBin(ca.activity.activityUIID);
-
- haltRefresh(false);
- setDirty();
- }
-
- public function removeComplexActivityChildren(children){
- for (var k=0; k 0) {
-
- if(_connectionActivities[0].activityUIID == activeView.startHub.activity.activityUIID ||
- activity.activityUIID == activeView.endHub.activity.activityUIID) {
- return addActivityToBranch(activity);
- } else {
- return addActivityToTransition(activity);
- }
-
- }
-
- _connectionActivities.push(activity);
-
- return true;
- }
-
- private function addActivityToBranch(activity:Activity):Object{
-
- if(_connectionActivities.length >= 2){
- //TODO: show an error
- return new LFError("Too many activities in the Branch","addActivityToBranch",this);
- }
-
- Debugger.log('Adding Activity.UIID:'+activity.activityUIID,Debugger.GEN,'addActivityToBranch','CanvasModel');
- _connectionActivities.push(activity);
-
- var fromAct = _connectionActivities[0].activityUIID;
- var toAct = _connectionActivities[1].activityUIID;
-
- //check we have 2 valid acts to create the transition.
- if(fromAct == toAct){
- // create activityless branch
- var b:Object = (activeView.fingerprint == activeView.endHub) ? createActivitylessBranch() : new LFError("Trying to create branch in wrong direction.");
-
- if(b instanceof LFError) {
- return b;
- } else if(b != null){
- var success:Object = _cv.ddm.addBranch(Branch(b));
- }
-
- //flag the model as dirty and trigger a refresh
- _cv.stopTransitionTool();
-
- setDirty();
-
- return true;
-
- }
-
- if(_connectionActivities.length == 2){
- /*********************************************
- * TODO: REQUIRE NORMAL BRANCH CLIENT_SIDE VALIDATION
- *********************************************/
- if(!_cv.ddm.activities.containsKey(toAct)){
- return new LFError(Dictionary.getValue('cv_trans_target_act_missing'),"addActivityToBranch",this);
- }
-
- //check there is not already a branch to or from this activity:
- var branchesArray:Array = _cv.ddm.branches.values();
-
- for(var i=0;i= 2){
- /* unlikely to be reached */
- return new LFError("Too many activities in the Transition", "addActivityToTransition",this);
- }
-
- Debugger.log('Adding Activity.UIID:'+activity.activityUIID,Debugger.GEN,'addActivityToTransition','CanvasModel');
-
- _connectionActivities.push(activity);
-
- var fromAct = _connectionActivities[0].activityUIID
- var toAct = _connectionActivities[1].activityUIID
-
- if(_connectionActivities.length == 2){
-
- var t:Transition;
-
- /*********************************************
- * BELOW: NORMAL TRANSITION CLIENT_SIDE VALIDATION
- *********************************************/
-
- //check we have 2 valid acts to create the transition.
- if(fromAct == toAct){
- /* unlikely to be reached in most use cases */
- return new LFError("You cannot create a Transition between the same Activities","addActivityToTransition",this);
- }
-
- if(!_cv.ddm.activities.containsKey(fromAct)){
- /* unlikely to be reached in most use cases */
- return new LFError("First activity of the Transition is missing, UIID:" + _connectionActivities[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 && isLoopingLD(toAct.activityUIID, sequence.firstActivityUIID)) {
- return new LFError("Cannot create start-branch connection to Activity in a already connected Sequence.", "createBranchStartConnector", this);
- } else {
-
- var b = new Branch(_cv.ddm.newUIID(), BranchConnector.DIR_FROM_START, toAct.activityUIID, activeView.startHub.activity.activityUIID, activeView.defaultSequenceActivity, _cv.ddm.learningDesignID);
- b.sequenceActivity.isDefault = false;
-
- var sequences:Array = _cv.ddm.getComplexActivityChildren(sequence.parentUIID);
- sequences.sortOn("orderID", Array.NUMERIC);
-
- var orderID:Number = (sequences.length > 0) ? getHighestBranchNumber(b.sequenceActivity.parentUIID) : 0;
- createNewSequenceActivity(activeView.activity, orderID+1, null, true);
-
- return b;
- }
- }
-
- /**
- * @usage gets the highest branch number for the current branching activities
- * @param
- * @return
- */
- public function getHighestBranchNumber(branchParentUIID:Number):Number {
-
- var sequences:Array = _cv.ddm.getComplexActivityChildren(branchParentUIID);
- var highestNum:Number = 0;
-
- for (var i=0; i highestNum) {
- highestNum = branchNum;
- }
- }
-
- return highestNum;
- }
-
-
- /**
- * @usage
- * @param transitionActs An array of transition activities. Must only contain 2
- * @return
- */
- private function createBranchEndConnector(branchActivities:Array):Object{
- var fromAct:Activity = branchActivities[0];
- var toAct:Activity = branchActivities[1];
-
- var sequence:SequenceActivity = SequenceActivity(_cv.ddm.getActivityByUIID(fromAct.parentUIID));
-
- /** Basic validation for Branch(s)/Branch Connector(s) */
- if(fromAct.activityUIID == activeView.endHub.activity.activityUIID) {
- return new LFError("Cannot create branch from end-point.");
- } else if(_cv.ddm.getTransitionsForActivityUIID(fromAct.activityUIID).out != null) {
- return new LFError("Cannot create end-branch connection to Activity with outward Transition", "createBranchEndConnector", this);
- } else if(_cv.ddm.getBranchesForActivityUIID(sequence.activityUIID).myBranches.length <= 0) {
- return new LFError("Cannot create end-branch connection to an unconnected Sequence.", "createBranchStartConnector", this);
- } else {
- var condition:Boolean = (sequence.firstActivityUIID != null && isLoopingLD(fromAct.activityUIID, sequence.firstActivityUIID));
-
- if(condition || sequence.firstActivityUIID == fromAct.activityUIID)
- return new Branch(_cv.ddm.newUIID(), BranchConnector.DIR_TO_END, fromAct.activityUIID, activeView.endHub.activity.activityUIID, sequence, _cv.ddm.learningDesignID);
- else
- return new LFError("Cannot create end-branch connection to an unconnected Sequence.", "createBranchStartConnector", this);
- }
- }
-
- private function createActivitylessBranch():Object{
- if(_cv.ddm.getBranchesForActivityUIID(activeView.startHub.activity.activityUIID).activityless != null)
- return new LFError("Cannot add more than one Activityless branch.", null);
-
- var b:Branch = new Branch(_cv.ddm.newUIID(), BranchConnector.DIR_SINGLE, activeView.startHub.activity.activityUIID, null, activeView.defaultSequenceActivity, _cv.ddm.learningDesignID);
- var sequences:Array = _cv.ddm.getComplexActivityChildren(b.sequenceActivity.parentUIID);
-
- SequenceActivity(b.sequenceActivity).isDefault = false;
-
- sequences.sortOn("orderID", Array.NUMERIC);
- var orderID:Number = (sequences.length > 0) ? getHighestBranchNumber(b.sequenceActivity.parentUIID) : 0;
-
- createNewSequenceActivity(activeView.activity, orderID+1, null, true);
-
- return b;
- }
-
- public function migrateActivitiesToSequence(sequenceToMigrate:SequenceActivity, targetSequence:SequenceActivity):Boolean {
- var activitiesToMigrate:Array = _cv.ddm.getComplexActivityChildren(sequenceToMigrate.activityUIID);
-
- 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{
- //check if we have a toolContentID
- var defaultContentID:Number = Application.getInstance().getToolkit().getDefaultContentID(ta.learningLibraryID, ta.toolID);
-
- 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){
- url = cfg.serverUrl+ta.authoringURL + '&toolContentID='+ta.toolContentID+'&contentFolderID='+ddm.contentFolderID;
- }else{
- url = cfg.serverUrl+ta.authoringURL + '?toolContentID='+ta.toolContentID+'&contentFolderID='+ddm.contentFolderID;
- }
-
- // append customCSV if this is a tooladapter tool
- if (ta.extLmsId != null && ta.extLmsId != undefined && _root.customCSV != null && _root.customCSV != undefined)
- {
- url = url + "&customCSV=" + escape(_root.customCSV);
- }
-
- // TODO: Maybe add learningDesignID and serverURL to window title to handle multiple LAMS(s) running in same browser session.
- JsPopup.getInstance().launchPopupWindow(url, 'ToolActivityContent_' + ta.toolContentID, 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{
- 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;
-
- openToolActivityContent(ta);
- }
-
- public function setDefaultToolContentID(ta:ToolActivity):Void{
- ta.toolContentID = Application.getInstance().getToolkit().getDefaultContentID(ta.toolContentID,ta.toolID);
- }
-
- public function openBranchActivityContent(ba, visible:Boolean):Void {
- currentBranchingActivity = ba;
-
- if(visible == null) visible = true;
-
- if(BranchingActivity(ba.activity).clear)
- clearBranchingActivity(ba);
-
- if(ba.activity.branchView != null) {
- ba.activity.branchView.prevActiveView = activeView;
- activeView = (visible) ? ba.activity.branchView : activeView;
- ba.activity.branchView.setOpen(visible);
- ba.activity.branchView.open();
-
- openBranchingActivities.push(ba);
- } else {
- _cv.openBranchView(currentBranchingActivity, visible);
- }
-
- _lastBranchActionType = null;
- }
-
-}
+/****************************************************************************
+ * 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.authoring.*;
+import org.lamsfoundation.lams.authoring.cv.*;
+import org.lamsfoundation.lams.authoring.br.BranchConnector;
+import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.dict.*;
+import mx.events.*;
+
+/*
+* Model for the Canvas
+*/
+class org.lamsfoundation.lams.authoring.cv.CanvasModel extends org.lamsfoundation.lams.authoring.cv.CanvasSuperModel {
+
+ public static var TRANSITION_TOOL:String = "TRANSITION";
+ public static var OPTIONAL_TOOL:String = "OPTIONAL";
+ public static var OPTIONAL_SEQ_TOOL:String = "OPTIONAL_SEQ";
+ public static var GATE_TOOL:String = "GATE";
+ public static var GROUP_TOOL:String = "GROUP";
+ public static var BRANCH_TOOL:String = "BRANCH";
+
+ public static var OPEN_FROM_FILE:Number = 0;
+ public static var ADD_FROM_TEMPLATE:Number = 1;
+
+ //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 CanvasModel(cv:Canvas){
+ super(cv);
+
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+
+ }
+
+ /**
+ * Craetes a [trans][gate act][trans] combo from an existing transition.
+ * NOT used anymore as we dont want to allow users to think they can click transitions
+ * BUT IF/When the request this - just use this function
+ * @usage
+ * @param transitionUIID
+ * @param gateTypeID
+ * @return
+ */
+ public function createGateTransition(transitionUIID,gateTypeID, parent){
+ Debugger.log('transitionUIID:'+transitionUIID,Debugger.GEN,'createGateTransition','CanvasModel');
+ Debugger.log('gateTypeID:'+gateTypeID,Debugger.GEN,'createGateTransition','CanvasModel');
+
+ var editedTrans = _cv.ddm.getTransitionByUIID(transitionUIID);
+ var editedCanvasTrans = _transitionsDisplayed.get(transitionUIID);
+ var fromAct = _cv.ddm.getActivityByUIID(editedTrans.fromUIID);
+ var toAct = _cv.ddm.getActivityByUIID(editedTrans.toUIID);
+
+ //create a gate activity
+ var gateAct = new GateActivity(_cv.ddm.newUIID(),gateTypeID);
+ gateAct.learningDesignID = _cv.ddm.learningDesignID;
+ gateAct.title = Dictionary.getValue('gate_btn');
+ gateAct.yCoord = editedCanvasTrans.midPoint.y - (CanvasActivity.GATE_ACTIVITY_WIDTH / 2);
+ gateAct.xCoord = editedCanvasTrans.midPoint.x - (CanvasActivity.GATE_ACTIVITY_HEIGHT / 2);
+
+ Debugger.log('gateAct.yCoord:'+gateAct.yCoord,Debugger.GEN,'createGateTransition','CanvasModel');
+ Debugger.log('gateAct.xCoord:'+gateAct.xCoord,Debugger.GEN,'createGateTransition','CanvasModel');
+
+ if(parent != null) {
+ gateAct.parentActivityID = parent.activityID;
+ gateAct.parentUIID = parent.activityUIID;
+ }
+
+ _cv.ddm.addActivity(gateAct);
+ _cv.ddm.removeTransition(transitionUIID);
+
+ //create the from trans
+ addActivityToTransition(fromAct);
+ addActivityToTransition(gateAct);
+ resetTransitionTool();
+
+ //create the to trans
+ addActivityToTransition(gateAct);
+ addActivityToTransition(toAct);
+ resetTransitionTool();
+
+ //flag the model as dirty and trigger a refresh
+ setDirty();
+
+ //select the new thing
+ setSelectedItem(_activitiesDisplayed.get(gateAct.activityUIID));
+
+ }
+
+ /**
+ * Create a transition between two activities in a Sequence Activity (in Optional).
+ *
+ * @usage
+ * @param sequence
+ * @param toActivity
+ * @return
+ */
+ public function createSequenceTransition(fromActivity:Activity, toActivity:Activity):Void {
+ addActivityToTransition(fromActivity);
+ addActivityToTransition(toActivity);
+ resetTransitionTool();
+
+ setDirty();
+ }
+
+ /**
+ * Creates a new gate activity at the specified location
+ * @usage
+ * @param gateTypeID
+ * @param pos
+ * @return
+ */
+ public function createNewGate(gateTypeID, pos:Point, parent){
+ var gateAct = new GateActivity(_cv.ddm.newUIID(), gateTypeID);
+ gateAct.learningDesignID = _cv.ddm.learningDesignID;
+
+ gateAct.title = Dictionary.getValue('gate_btn');
+ gateAct.yCoord = pos.y;
+ gateAct.xCoord = pos.x;
+
+ if(parent != null) {
+ gateAct.parentActivityID = parent.activityID;
+ gateAct.parentUIID = parent.activityUIID;
+ }
+
+ _cv.ddm.addActivity(gateAct);
+
+ setDirty();
+
+ //select the new thing
+ setSelectedItem(_activitiesDisplayed.get(gateAct.activityUIID));
+
+ }
+
+ /**
+ * Creates a new branch activity at the specified location
+ * @usage
+ * @param pos
+ * @return
+ */
+ public function createNewBranchActivity(branchTypeID, pos:Point, parent){
+ var branchingActivity = new BranchingActivity(_cv.ddm.newUIID(), branchTypeID);
+ branchingActivity.title = Dictionary.getValue('branching_act_title');
+ branchingActivity.learningDesignID = _cv.ddm.learningDesignID;
+ branchingActivity.activityCategoryID = Activity.CATEGORY_SYSTEM;
+ branchingActivity.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
+
+ branchingActivity.yCoord = pos.y;
+ branchingActivity.xCoord = pos.x;
+
+ Debugger.log('branchingActivity.yCoord:'+branchingActivity.yCoord,Debugger.GEN,'createNewBranchActivity','CanvasModel');
+ Debugger.log('branchingActivity.xCoord:'+branchingActivity.xCoord,Debugger.GEN,'createNewBranchActivity','CanvasModel');
+
+ if(parent != null) {
+ branchingActivity.parentActivityID = parent.activityID;
+ branchingActivity.parentUIID = parent.activityUIID;
+ }
+
+ _cv.ddm.addActivity(branchingActivity);
+
+ //tell the canvas to go refresh
+ setDirty();
+
+ //select the new thing
+ setSelectedItem(_activitiesDisplayed.get(branchingActivity.activityUIID));
+ }
+
+ public function createNewSequenceActivity(parent, orderID, stopAfterActivity:Boolean, isBranch:Boolean){
+ Debugger.log('Running...',Debugger.GEN,'createNewSequenceActivity','CanvasModel');
+
+ var seqAct = new SequenceActivity(_cv.ddm.newUIID());
+ var title = (isBranch) ? Dictionary.getValue('branch_mapping_dlg_branch_col_lbl') : Dictionary.getValue('sequence_act_title');
+ seqAct.title = Dictionary.getValue('sequence_act_title_new', [title, orderID]);
+ seqAct.learningDesignID = _cv.ddm.learningDesignID;
+ seqAct.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
+ seqAct.activityCategoryID = Activity.CATEGORY_SYSTEM;
+ seqAct.orderID = (orderID != null || orderID != undefined) ? orderID : 1;
+ seqAct.stopAfterActivity = (stopAfterActivity != null) ? stopAfterActivity : true;
+
+ if(parent != null) {
+ seqAct.parentActivityID = parent.activityID;
+ seqAct.parentUIID = parent.activityUIID;
+ }
+
+ _cv.ddm.addActivity(seqAct);
+
+ setDirty();
+ }
+
+ /**
+ * Creates a new group activity at the specified location
+ * @usage
+ * @param pos
+ * @return
+ */
+ public function createNewGroupActivity(pos:Point, parent){
+ Debugger.log('Running...',Debugger.GEN,'createNewGroupActivity','CanvasModel');
+
+ //first create the grouping object
+ var newGrouping = new Grouping(_cv.ddm.newUIID());
+ newGrouping.groupingTypeID = _defaultGroupingTypeID;
+
+ _cv.ddm.addGrouping(newGrouping);
+
+ var groupingActivity = new GroupingActivity(_cv.ddm.newUIID());
+ groupingActivity.title = Dictionary.getValue('grouping_act_title');
+ groupingActivity.learningDesignID = _cv.ddm.learningDesignID;
+ groupingActivity.createGroupingUIID = newGrouping.groupingUIID;
+
+ groupingActivity.yCoord = pos.y;
+ groupingActivity.xCoord = pos.x;
+
+ Debugger.log('groupingActivity.createGroupingUIID :'+groupingActivity.createGroupingUIID ,Debugger.GEN,'createNewGroupActivity','CanvasModel');
+ Debugger.log('groupingActivity.yCoord:'+groupingActivity.yCoord,Debugger.GEN,'createNewGroupActivity','CanvasModel');
+ Debugger.log('groupingActivity.xCoord:'+groupingActivity.xCoord,Debugger.GEN,'createNewGroupActivity','CanvasModel');
+
+ if(parent != null) {
+ groupingActivity.parentActivityID = parent.activityID;
+ groupingActivity.parentUIID = parent.activityUIID;
+ }
+
+ _cv.ddm.addActivity(groupingActivity);
+
+ //tell the canvas to go refresh
+ setDirty();
+
+ //select the new thing
+ setSelectedItem(_activitiesDisplayed.get(groupingActivity.activityUIID));
+ }
+
+ /**
+ * Creates a new gate activity at the specified location
+ * @usage
+ * @param gateTypeID
+ * @param pos
+ * @return
+ */
+ public function createNewOptionalActivity(ActivityTypeID, pos:Point, parent, isSequence:Boolean){
+ var optAct = new ComplexActivity(_cv.ddm.newUIID());
+
+ optAct.learningDesignID = _cv.ddm.learningDesignID;
+ optAct.activityTypeID = (!isSequence) ? Activity.OPTIONAL_ACTIVITY_TYPE : Activity.OPTIONS_WITH_SEQUENCES_TYPE;
+ optAct.title = (!isSequence) ? Dictionary.getValue('opt_activity_title') : Dictionary.getValue('opt_activity_seq_title');
+ optAct.groupingSupportType = Activity.GROUPING_SUPPORT_OPTIONAL;
+ optAct.activityCategoryID = Activity.CATEGORY_SYSTEM;
+ optAct.yCoord = pos.y;
+ optAct.xCoord = pos.x;
+
+ Debugger.log('Optional Activitys Y Coord is :'+optAct.yCoord,Debugger.GEN,'createNewOptionalActivity','CanvasModel');
+
+ if(parent != null) {
+ optAct.parentActivityID = parent.activityID;
+ optAct.parentUIID = parent.activityUIID;
+ }
+
+ if(isSequence) {
+ createNewSequenceActivity(optAct, 1, false);
+ createNewSequenceActivity(optAct, 2, false);
+ optAct.noSequences = 2;
+ }
+
+ _cv.ddm.addActivity(optAct);
+
+ setDirty();
+ setSelectedItem(_activitiesDisplayed.get(optAct.activityUIID));
+
+ }
+
+ public function removeOptionalSequenceCA(ca:Object, parentID){
+ haltRefresh(true);
+
+ unhookOptionalSequenceCA(ca);
+
+ ca.activity.parentUIID = (activeView instanceof CanvasBranchView) ? activeView.defaultSequenceActivity.activityUIID : null;
+ ca.activity.orderID = null;
+ ca.activity.parentActivityID = (activeView instanceof CanvasBranchView) ? activeView.defaultSequenceActivity.activityID : null;
+
+ tagBranchingActivitiesForClearing(ca);
+
+ if(!(activeView instanceof CanvasComplexView)) removeActivity(parentID);
+
+ haltRefresh(false);
+ setDirty();
+ }
+
+ private function unhookOptionalSequenceCA(ca:Object) {
+ var transitionObj:Object = _cv.ddm.getTransitionsForActivityUIID(ca.activity.activityUIID);
+ var sequence:Activity = _cv.ddm.getActivityByUIID(ca.activity.parentUIID);
+
+ var toActivity:Activity = null;
+ var fromActivity:Activity = null;
+ var parentAct:SequenceActivity = SequenceActivity(sequence);
+
+ if(transitionObj.into != null && transitionObj.out != null) {
+ toActivity = _cv.ddm.getActivityByUIID(transitionObj.out.toUIID);
+ fromActivity = _cv.ddm.getActivityByUIID(transitionObj.into.fromUIID);
+ } else if(transitionObj.out != null) {
+ parentAct.firstActivityUIID = transitionObj.out.toUIID;
+ } else if(transitionObj.out == null && transitionObj.into == null){
+ parentAct.firstActivityUIID = null;
+ }
+
+ _cv.ddm.removeTransitionByConnection(ca.activity.activityUIID);
+ if(toActivity != null && fromActivity != null) createSequenceTransition(fromActivity, toActivity);
+
+ }
+
+ public function moveOptionalSequenceCA(ca:Object, parent:Activity):Boolean {
+ var minDiff:Number = null;
+ var selectedIndex:Number = null;
+
+ Debugger.log("ca y: " + ca._y, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
+ Debugger.log("parent y: " + parent.yCoord, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
+
+ if(ca._y > ca._parent._parent.getVisibleHeight() || ca._y < -ca.getVisibleHeight())
+ return false;
+
+ var oChildren:Array = _cv.ddm.getComplexActivityChildren(parent.activityUIID);
+ oChildren.sortOn('orderID', Array.NUMERIC);
+
+ for(var i=0; i 0 && ca.activity.xCoord > ca._x) {
+ minDiff = diff;
+ selectedIndex = i;
+ } else if((minDiff == null || diff > minDiff) && diff < 0 && ca.activity.xCoord < ca._x) {
+ minDiff = diff;
+ selectedIndex = i;
+ }
+ }
+
+ Debugger.log("selectedIndex: " + selectedIndex, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
+ if(selectedIndex != null) {
+ if(oChildren[selectedIndex] != ca.activity) {
+ // remove ca from sequence
+ Debugger.log("selectedIndex order: " + Activity(oChildren[selectedIndex]).orderID, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
+ Debugger.log("ca order: " + ca.activity.orderID, Debugger.CRITICAL, "moveOptionalSequenceCA", "CanvasModel");
+
+ var _dir:Number = (ca.activity.xCoord > ca._x) ? 0 : 1;
+
+ unhookOptionalSequenceCA(ca);
+ addOptionalSequenceCA(ca, oChildren[selectedIndex], _dir);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private function addOptionalSequenceCA(ca:Object, nextOrPrevActivity:Activity, _dir:Number):Void {
+ haltRefresh(true);
+
+ var sequence:Activity = _cv.ddm.getActivityByUIID(nextOrPrevActivity.parentUIID);
+ var transitionObj:Object = _cv.ddm.getTransitionsForActivityUIID(nextOrPrevActivity.activityUIID);
+
+ var targetActivity:Activity = null;
+
+ var transition:Transition = (_dir == 0) ? transitionObj.into : transitionObj.out;
+
+ if(transition != null) {
+ targetActivity = (_dir == 0) ? _cv.ddm.getActivityByUIID(transition.fromUIID) : _cv.ddm.getActivityByUIID(transition.toUIID);
+ } else {
+ if(_dir == 0) ComplexActivity(sequence).firstActivityUIID = ca.activity.activityUIID;
+ }
+
+ if(targetActivity != null) {
+ var fromActivity:Activity = (_dir == 0) ? targetActivity : nextOrPrevActivity;
+ var toActivity:Activity = (_dir == 0) ? nextOrPrevActivity : targetActivity;
+
+ _cv.ddm.removeTransition(transition.transitionUIID);
+
+ createSequenceTransition(fromActivity, ca.activity);
+ createSequenceTransition(ca.activity, toActivity);
+
+ } else {
+ var fromActivity:Activity = (_dir == 0) ? ca.activity : nextOrPrevActivity;
+ var toActivity:Activity = (_dir == 0) ? nextOrPrevActivity : ca.activity;
+
+ createSequenceTransition(fromActivity, toActivity);
+ }
+
+ if(activeView instanceof CanvasComplexView && activeView.openActivity.activity.activityUIID == sequence.parentUIID) {
+ activeView.updateActivity();
+ } else {
+ removeActivity(sequence.parentUIID);
+ }
+
+ haltRefresh(false);
+
+ setDirty();
+
+ }
+
+ /**
+ *Called by the controller when a complex activity is dropped on bin.
+ */
+ public function removeComplexActivity(ca){
+ Debugger.log('Removing Complex Activity: ' + ca.activity.activityUIID,Debugger.GEN,'removeComplexActivity','CanvasModel');
+ haltRefresh(true);
+
+ // recursively remove all children
+ removeComplexActivityChildren(ca.actChildren);
+ removeActivityOnBin(ca.activity.activityUIID);
+
+ haltRefresh(false);
+ setDirty();
+ }
+
+ public function removeComplexActivityChildren(children){
+ for (var k=0; k 0) {
+
+ if(_connectionActivities[0].activityUIID == activeView.startHub.activity.activityUIID ||
+ activity.activityUIID == activeView.endHub.activity.activityUIID) {
+ return addActivityToBranch(activity);
+ } else {
+ return addActivityToTransition(activity);
+ }
+
+ }
+
+ _connectionActivities.push(activity);
+
+ return true;
+ }
+
+ private function addActivityToBranch(activity:Activity):Object{
+
+ if(_connectionActivities.length >= 2){
+ //TODO: show an error
+ return new LFError("Too many activities in the Branch","addActivityToBranch",this);
+ }
+
+ Debugger.log('Adding Activity.UIID:'+activity.activityUIID,Debugger.GEN,'addActivityToBranch','CanvasModel');
+ _connectionActivities.push(activity);
+
+ var fromAct = _connectionActivities[0].activityUIID;
+ var toAct = _connectionActivities[1].activityUIID;
+
+ //check we have 2 valid acts to create the transition.
+ if(fromAct == toAct){
+ // create activityless branch
+ var b:Object = (activeView.fingerprint == activeView.endHub) ? createActivitylessBranch() : new LFError("Trying to create branch in wrong direction.");
+
+ if(b instanceof LFError) {
+ return b;
+ } else if(b != null){
+ var success:Object = _cv.ddm.addBranch(Branch(b));
+ }
+
+ //flag the model as dirty and trigger a refresh
+ _cv.stopTransitionTool();
+
+ setDirty();
+
+ return true;
+
+ }
+
+ if(_connectionActivities.length == 2){
+ /*********************************************
+ * TODO: REQUIRE NORMAL BRANCH CLIENT_SIDE VALIDATION
+ *********************************************/
+ if(!_cv.ddm.activities.containsKey(toAct)){
+ return new LFError(Dictionary.getValue('cv_trans_target_act_missing'),"addActivityToBranch",this);
+ }
+
+ //check there is not already a branch to or from this activity:
+ var branchesArray:Array = _cv.ddm.branches.values();
+
+ for(var i=0;i= 2){
+ /* unlikely to be reached */
+ return new LFError("Too many activities in the Transition", "addActivityToTransition",this);
+ }
+
+ Debugger.log('Adding Activity.UIID:'+activity.activityUIID,Debugger.GEN,'addActivityToTransition','CanvasModel');
+
+ _connectionActivities.push(activity);
+
+ var fromAct = _connectionActivities[0].activityUIID
+ var toAct = _connectionActivities[1].activityUIID
+
+ if(_connectionActivities.length == 2){
+
+ var t:Transition;
+
+ /*********************************************
+ * BELOW: NORMAL TRANSITION CLIENT_SIDE VALIDATION
+ *********************************************/
+
+ //check we have 2 valid acts to create the transition.
+ if(fromAct == toAct){
+ /* unlikely to be reached in most use cases */
+ return new LFError("You cannot create a Transition between the same Activities","addActivityToTransition",this);
+ }
+
+ if(!_cv.ddm.activities.containsKey(fromAct)){
+ /* unlikely to be reached in most use cases */
+ return new LFError("First activity of the Transition is missing, UIID:" + _connectionActivities[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 && isLoopingLD(toAct.activityUIID, sequence.firstActivityUIID)) {
+ return new LFError("Cannot create start-branch connection to Activity in a already connected Sequence.", "createBranchStartConnector", this);
+ } else {
+
+ var b = new Branch(_cv.ddm.newUIID(), BranchConnector.DIR_FROM_START, toAct.activityUIID, activeView.startHub.activity.activityUIID, activeView.defaultSequenceActivity, _cv.ddm.learningDesignID);
+ b.sequenceActivity.isDefault = false;
+
+ var sequences:Array = _cv.ddm.getComplexActivityChildren(sequence.parentUIID);
+ sequences.sortOn("orderID", Array.NUMERIC);
+
+ var orderID:Number = (sequences.length > 0) ? getHighestBranchNumber(b.sequenceActivity.parentUIID) : 0;
+ createNewSequenceActivity(activeView.activity, orderID+1, null, true);
+
+ return b;
+ }
+ }
+
+ /**
+ * @usage gets the highest branch number for the current branching activities
+ * @param
+ * @return
+ */
+ public function getHighestBranchNumber(branchParentUIID:Number):Number {
+
+ var sequences:Array = _cv.ddm.getComplexActivityChildren(branchParentUIID);
+ var highestNum:Number = 0;
+
+ for (var i=0; i highestNum) {
+ highestNum = branchNum;
+ }
+ }
+
+ return highestNum;
+ }
+
+
+ /**
+ * @usage
+ * @param transitionActs An array of transition activities. Must only contain 2
+ * @return
+ */
+ private function createBranchEndConnector(branchActivities:Array):Object{
+ var fromAct:Activity = branchActivities[0];
+ var toAct:Activity = branchActivities[1];
+
+ var sequence:SequenceActivity = SequenceActivity(_cv.ddm.getActivityByUIID(fromAct.parentUIID));
+
+ /** Basic validation for Branch(s)/Branch Connector(s) */
+ if(fromAct.activityUIID == activeView.endHub.activity.activityUIID) {
+ return new LFError("Cannot create branch from end-point.");
+ } else if(_cv.ddm.getTransitionsForActivityUIID(fromAct.activityUIID).out != null) {
+ return new LFError("Cannot create end-branch connection to Activity with outward Transition", "createBranchEndConnector", this);
+ } else if(_cv.ddm.getBranchesForActivityUIID(sequence.activityUIID).myBranches.length <= 0) {
+ return new LFError("Cannot create end-branch connection to an unconnected Sequence.", "createBranchStartConnector", this);
+ } else {
+ var condition:Boolean = (sequence.firstActivityUIID != null && isLoopingLD(fromAct.activityUIID, sequence.firstActivityUIID));
+
+ if(condition || sequence.firstActivityUIID == fromAct.activityUIID)
+ return new Branch(_cv.ddm.newUIID(), BranchConnector.DIR_TO_END, fromAct.activityUIID, activeView.endHub.activity.activityUIID, sequence, _cv.ddm.learningDesignID);
+ else
+ return new LFError("Cannot create end-branch connection to an unconnected Sequence.", "createBranchStartConnector", this);
+ }
+ }
+
+ private function createActivitylessBranch():Object{
+ if(_cv.ddm.getBranchesForActivityUIID(activeView.startHub.activity.activityUIID).activityless != null)
+ return new LFError("Cannot add more than one Activityless branch.", null);
+
+ var b:Branch = new Branch(_cv.ddm.newUIID(), BranchConnector.DIR_SINGLE, activeView.startHub.activity.activityUIID, null, activeView.defaultSequenceActivity, _cv.ddm.learningDesignID);
+ var sequences:Array = _cv.ddm.getComplexActivityChildren(b.sequenceActivity.parentUIID);
+
+ SequenceActivity(b.sequenceActivity).isDefault = false;
+
+ sequences.sortOn("orderID", Array.NUMERIC);
+ var orderID:Number = (sequences.length > 0) ? getHighestBranchNumber(b.sequenceActivity.parentUIID) : 0;
+
+ createNewSequenceActivity(activeView.activity, orderID+1, null, true);
+
+ return b;
+ }
+
+ public function migrateActivitiesToSequence(sequenceToMigrate:SequenceActivity, targetSequence:SequenceActivity):Boolean {
+ var activitiesToMigrate:Array = _cv.ddm.getComplexActivityChildren(sequenceToMigrate.activityUIID);
+
+ 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{
+ //check if we have a toolContentID
+ var defaultContentID:Number = Application.getInstance().getToolkit().getDefaultContentID(ta.learningLibraryID, ta.toolID);
+
+ 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){
+ url = cfg.serverUrl+ta.authoringURL + '&toolContentID='+ta.toolContentID+'&contentFolderID='+ddm.contentFolderID;
+ }else{
+ url = cfg.serverUrl+ta.authoringURL + '?toolContentID='+ta.toolContentID+'&contentFolderID='+ddm.contentFolderID;
+ }
+
+ // append customCSV if this is a tooladapter tool
+ if (ta.extLmsId != null && ta.extLmsId != undefined && _root.customCSV != null && _root.customCSV != undefined)
+ {
+ url = url + "&customCSV=" + escape(_root.customCSV);
+ }
+
+ // TODO: Maybe add learningDesignID and serverURL to window title to handle multiple LAMS(s) running in same browser session.
+ JsPopup.getInstance().launchPopupWindow(url, 'ToolActivityContent_' + ta.toolContentID, 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{
+ 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;
+
+ openToolActivityContent(ta);
+ }
+
+ public function setDefaultToolContentID(ta:ToolActivity):Void{
+ ta.toolContentID = Application.getInstance().getToolkit().getDefaultContentID(ta.toolContentID,ta.toolID);
+ }
+
+ public function openBranchActivityContent(ba, visible:Boolean):Void {
+ currentBranchingActivity = ba;
+
+ if(visible == null) visible = true;
+
+ if(BranchingActivity(ba.activity).clear)
+ clearBranchingActivity(ba);
+
+ if(ba.activity.branchView != null) {
+ ba.activity.branchView.prevActiveView = activeView;
+ activeView = (visible) ? ba.activity.branchView : activeView;
+ ba.activity.branchView.setOpen(visible);
+ ba.activity.branchView.open();
+
+ openBranchingActivities.push(ba);
+ } else {
+ _cv.openBranchView(currentBranchingActivity, visible);
+ }
+
+ _lastBranchActionType = null;
+ }
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasOptionalActivity.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasOptionalActivity.as (.../CanvasOptionalActivity.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasOptionalActivity.as (.../CanvasOptionalActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -25,78 +25,78 @@
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.authoring.cv. *;
import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
import org.lamsfoundation.lams.monitoring.mv. *;
import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
-import org.lamsfoundation.lams.common.style. *;
+import org.lamsfoundation.lams.common.style. *;
import mx.controls. *;
-import mx.managers. *;
+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{
-
- public static var ACT_TYPE:Number = 0;
- public static var SEQ_TYPE:Number = 1;
+ public static var ACT_TYPE:Number = 0;
+ public static var SEQ_TYPE:Number = 1;
+
private var CHILD_OFFSET_X:Number = 8;
- private var CHILD_OFFSET_Y:Number = 57;
- private var CHILD_INCRE:Number = 60;
- private var MAX_LEARNER_ICONS:Number = 10;
-
- private var PANEL_OFFSET_X:Number = null;
-
- private var CONTAINER_PANEL_W:Number = 142.8;
-
- public static var PLUS_MARGIN_X:Number = 15;
- public static var PLUS_MARGIN_Y:Number = 10;
+ private var CHILD_OFFSET_Y:Number = 57;
+ private var CHILD_INCRE:Number = 60;
+ private var MAX_LEARNER_ICONS:Number = 10;
+ private var PANEL_OFFSET_X:Number = null;
+
+ private var CONTAINER_PANEL_W:Number = 142.8;
+
+ public static var PLUS_MARGIN_X:Number = 15;
+ public static var PLUS_MARGIN_Y:Number = 10;
+
private var newContainerXCoord:Number;
- private var newContainerYCoord:Number;
+ private var newContainerYCoord:Number;
private var learnerOffset_X:Number = 4;
- private var learnerOffset_Y:Number = 3;
- private var learnerContainer:MovieClip;
+ 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 _canvasBranchView:CanvasBranchView;
+ private var _canvasView:CanvasView;
+ private var _canvasBranchView:CanvasBranchView;
private var _canvasComplexView:CanvasComplexView;
private var _monitorController:MonitorController;
private var _monitorTabView:MonitorTabView;
- private var _ca = ComplexActivity;
+ 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;
- private var noSeqActivities:Number;
+ private var actMaxOptions:Number;
+ private var noSeqActivities:Number;
//refs to screen items:
private var container_pnl:Panel;
private var header_pnl:Panel;
- private var act_pnl:Panel;
+ private var act_pnl:Panel;
private var title_lbl:Label;
- private var actCount_lbl:Label;
-
- // type
- private var _type:Number;
+ private var actCount_lbl:Label;
+ // type
+ private var _type:Number;
+
//locals
private var childActivities_mc:MovieClip;
private var optionalActivity_mc:MovieClip;
private var clickTarget_mc:MovieClip;
private var _dcStartTime:Number = 0;
- private var _doubleClicking:Boolean;
+ private var _doubleClicking:Boolean;
// Only for Monitor Optional Container children
private var fromModuleTab:String;
@@ -117,191 +117,191 @@
optionalActivity_mc = this;
_visible = false;
-
+
_tm = ThemeManager.getInstance ();
- _dictionary = Dictionary.getInstance();
+ _dictionary = Dictionary.getInstance();
_visibleHeight = container_pnl._height;
_visibleWidth = container_pnl._width;
-
+
_ca = new ComplexActivity(_activity.activityUIID)
- _activity.activityCategoryID = Activity.CATEGORY_SYSTEM;
-
- _type = (ComplexActivity(_activity).isSequenceBased) ? SEQ_TYPE : ACT_TYPE;
+ _activity.activityCategoryID = Activity.CATEGORY_SYSTEM;
+ _type = (ComplexActivity(_activity).isSequenceBased) ? SEQ_TYPE : ACT_TYPE;
+
MovieClipUtils.doLater(Proxy.create(this, init));
}
- public function init():Void {
+ public function init():Void {
Debugger.log("type: " + _type, Debugger.CRITICAL, "init", "CanvasOptionalActivity");
- switch(_type) {
- case ACT_TYPE:
- initActivityType();
- break;
- case SEQ_TYPE:
- initSequenceType();
- break;
- default:
- Debugger.log("No valid type.", Debugger.CRITICAL, "init", "CanvasOptionalActivity");
+ switch(_type) {
+ case ACT_TYPE:
+ initActivityType();
+ break;
+ case SEQ_TYPE:
+ initSequenceType();
+ break;
+ default:
+ Debugger.log("No valid type.", Debugger.CRITICAL, "init", "CanvasOptionalActivity");
}
- }
-
- public function initActivityType():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;
-
- showStatus(false);
-
- removeAllChildren();
-
- for (var i=0; i < _children.length; i++) {
- if(fromModuleTab == "monitorMonitorTab"){
- if(_canvasBranchView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer});
- } else if(_canvasComplexView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer});
- } else {
- children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
- }
- } else {
- if(_canvasBranchView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _canvasController:_canvasController, _canvasBranchView:_canvasBranchView})
- } else if(_canvasComplexView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _canvasController:_canvasController, _canvasComplexView:_canvasComplexView});
- } else {
- children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _canvasController:_canvasController, _canvasView:_canvasView});
- }
- }
-
- //set the positioning co-ords
- children_mc[i].activity.xCoord = CHILD_OFFSET_X;
- children_mc[i].activity.yCoord = CHILD_OFFSET_Y + (i * CHILD_INCRE);
-
- children_mc[i]._visible = true;
-
- }
-
- MovieClipUtils.doLater(Proxy.create(this, draw));
-
- }
-
- public function initSequenceType():Void {
- clickTarget_mc.onPress = Proxy.create(this, localOnPress);
- clickTarget_mc.onRelease = Proxy.create(this, localOnRelease);
- clickTarget_mc.onReleaseOutside = Proxy.create(this, localOnReleaseOutside);
-
- showStatus(false);
-
- CHILD_OFFSET_X = 4;
- CHILD_OFFSET_Y = 48;
- PANEL_OFFSET_X = CHILD_OFFSET_X;
-
- CHILD_INCRE = 57;
-
- removeAllChildren();
-
- var _newVisibleWidth:Number = null;
-
- for(var i=0; i < _children.length; i++) {
- Debugger.log("opt child act: " + _children[i].activityUIID, Debugger.CRITICAL, "initSequenceType", "CanvasOptionalActivity");
-
- if(_children[i].isSequenceActivity()) {
- if(fromModuleTab == "monitorMonitorTab") {
- if(_canvasBranchView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer})
- } else if(_canvasComplexView) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer})
- } else {
- children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
+ }
+
+ public function initActivityType():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;
+
+ showStatus(false);
+
+ removeAllChildren();
+
+ for (var i=0; i < _children.length; i++) {
+ if(fromModuleTab == "monitorMonitorTab"){
+ if(_canvasBranchView != null) {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer});
+ } else if(_canvasComplexView != null) {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer});
+ } else {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
+ }
+ } else {
+ if(_canvasBranchView != null) {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _canvasController:_canvasController, _canvasBranchView:_canvasBranchView})
+ } else if(_canvasComplexView != null) {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _canvasController:_canvasController, _canvasComplexView:_canvasComplexView});
+ } else {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasActivity", "CanvasActivity"+i, childActivities_mc.getNextHighestDepth (), {_activity:_children[i] , _canvasController:_canvasController, _canvasView:_canvasView});
+ }
+ }
+
+ //set the positioning co-ords
+ children_mc[i].activity.xCoord = CHILD_OFFSET_X;
+ children_mc[i].activity.yCoord = CHILD_OFFSET_Y + (i * CHILD_INCRE);
+
+ children_mc[i]._visible = true;
+
+ }
+
+ MovieClipUtils.doLater(Proxy.create(this, draw));
+
+ }
+
+ public function initSequenceType():Void {
+ clickTarget_mc.onPress = Proxy.create(this, localOnPress);
+ clickTarget_mc.onRelease = Proxy.create(this, localOnRelease);
+ clickTarget_mc.onReleaseOutside = Proxy.create(this, localOnReleaseOutside);
+
+ showStatus(false);
+
+ CHILD_OFFSET_X = 4;
+ CHILD_OFFSET_Y = 48;
+ PANEL_OFFSET_X = CHILD_OFFSET_X;
+
+ CHILD_INCRE = 57;
+
+ removeAllChildren();
+
+ var _newVisibleWidth:Number = null;
+
+ for(var i=0; i < _children.length; i++) {
+ Debugger.log("opt child act: " + _children[i].activityUIID, Debugger.CRITICAL, "initSequenceType", "CanvasOptionalActivity");
+
+ if(_children[i].isSequenceActivity()) {
+ if(fromModuleTab == "monitorMonitorTab") {
+ if(_canvasBranchView != null) {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer})
+ } else if(_canvasComplexView) {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer})
+ } else {
+ children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
}
- } else {
- if(_canvasBranchView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _canvasController:_canvasController, _canvasBranchView:_canvasBranchView});
- } else if(_canvasComplexView != null) {
- children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _canvasController:_canvasController, _canvasComplexView:_canvasComplexView});
- } else {
- children_mc[i] = childActivities_mc.attachMovie("CanvasSequenceActivity", "CanvasSequenceActivity"+i, childActivities_mc.getNextHighestDepth(), {_activity:_children[i] , _canvasController:_canvasController, _canvasView:_canvasView});
- }
- }
- //set the positioning co-ords
- children_mc[i].activity.xCoord = CHILD_OFFSET_X;
- children_mc[i].activity.yCoord = CHILD_OFFSET_Y + (i * CHILD_INCRE);
-
- children_mc[i]._visible = true;
-
- if(_visibleWidth < children_mc[i].getVisibleWidth()) {
- _newVisibleWidth = children_mc[i].getVisibleWidth();
- PANEL_OFFSET_X = (CHILD_OFFSET_X*2);
- }
-
- if(_newVisibleWidth != null) _visibleWidth = _newVisibleWidth;
- }
- }
-
- // set width for children
- for(var i=0; i children_mc[i].getVisibleWidth()) children_mc[i].setSize(_visibleWidth, null);
-
- ComplexActivity(_activity).noSequences = _children.length;
-
- MovieClipUtils.doLater(Proxy.create(this, draw));
- }
-
- public function removeAllChildren(removeBranchView:Boolean):Void {
- for(var j=0; j children_mc[i].getVisibleWidth()) children_mc[i].setSize(_visibleWidth, null);
+
+ ComplexActivity(_activity).noSequences = _children.length;
+
+ MovieClipUtils.doLater(Proxy.create(this, draw));
}
-
- public function updateChildren(newChildren:Array):Void {
- _visible = false;
- _visibleWidth = CONTAINER_PANEL_W;
-
- if(newChildren != null) _children = newChildren;
-
- init();
- }
-
- public function refresh():Void {
- draw();
- }
+ public function removeAllChildren(removeBranchView:Boolean):Void {
+ for(var j=0; j0; j--)
- retArr.push(children_mc[children_mc.length - j]);
-
- return retArr;
+ }
}
+ public function getLastItems(i:Number):Array {
+ var retArr:Array = new Array();
+
+ for(var j=i; j>0; j--)
+ retArr.push(children_mc[children_mc.length - j]);
+
+ return retArr;
+ }
+
private function showStatus(isVisible:Boolean){
completed_mc._visible = isVisible;
current_mc._visible = isVisible;
todo_mc._visible = isVisible;
- }
-
+ }
+
public function setSelected(isSelected){}
public function get activity () : Activity {
@@ -319,74 +319,74 @@
public function setActivity (a : Activity) {
_activity = a;
}
-
- private function drawLearners():Void {
- var mm:MonitorModel = MonitorModel(_monitorController.getModel());
-
- var learner_X = (mm.activeView instanceof CanvasComplexView) ? this._x + learnerOffset_X : _activity.xCoord + learnerOffset_X;
- var learner_Y = (mm.activeView instanceof CanvasComplexView) ? this._y + learnerOffset_Y : _activity.yCoord + learnerOffset_Y;
-
- // get the length of learners from the Monitor Model and run a for loop.
- for (var j=0; j (actX + 92)){
- learner_X = actX + 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 });
- learnerContainer.attachMovie("plusIcon", "plusIcon", learnerContainer.getNextHighestDepth(), {_activity:_activity, _monitorController:_monitorController, _x:learner_X+PLUS_MARGIN_X, _y:learner_Y+PLUS_MARGIN_Y});
- 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 drawLearners():Void {
+ var mm:MonitorModel = MonitorModel(_monitorController.getModel());
+
+ var learner_X = (mm.activeView instanceof CanvasComplexView) ? this._x + learnerOffset_X : _activity.xCoord + learnerOffset_X;
+ var learner_Y = (mm.activeView instanceof CanvasComplexView) ? this._y + learnerOffset_Y : _activity.yCoord + learnerOffset_Y;
+
+ // get the length of learners from the Monitor Model and run a for loop.
+ for (var j=0; j (actX + 92)){
+ learner_X = actX + 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 });
+ learnerContainer.attachMovie("plusIcon", "plusIcon", learnerContainer.getNextHighestDepth(), {_activity:_activity, _monitorController:_monitorController, _x:learner_X+PLUS_MARGIN_X, _y:learner_Y+PLUS_MARGIN_Y});
+ 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 (){
var numOfChildren = _children.length;
- _panelHeight = CHILD_OFFSET_Y + (numOfChildren * CHILD_INCRE);
+ _panelHeight = CHILD_OFFSET_Y + (numOfChildren * CHILD_INCRE);
- setStyles();
+ setStyles();
//write text
- title_lbl.text = _activity.title;
+ title_lbl.text = _activity.title;
- actCount_lbl.text = (type == ACT_TYPE) ? Dictionary.getValue('lbl_num_activities', [children_mc.length]) : Dictionary.getValue('lbl_num_sequences', [children_mc.length]);
+ actCount_lbl.text = (type == ACT_TYPE) ? Dictionary.getValue('lbl_num_activities', [children_mc.length]) : Dictionary.getValue('lbl_num_sequences', [children_mc.length]);
//position the container (this)
if(numOfChildren > 1){
container_pnl._height = CHILD_OFFSET_Y + (numOfChildren * CHILD_INCRE);
- } else {
- container_pnl._height = CHILD_OFFSET_Y + CHILD_INCRE;
- }
-
- if(_type == SEQ_TYPE) {
- container_pnl._height += 3;
- container_pnl._width = _visibleWidth + PANEL_OFFSET_X;
- header_pnl._width = _visibleWidth - 6 + PANEL_OFFSET_X;
-
- clickTarget_mc._width = _visibleWidth + PANEL_OFFSET_X;
+ } else {
+ container_pnl._height = CHILD_OFFSET_Y + CHILD_INCRE;
}
-
- _visibleHeight = container_pnl._height;
- if(!_canvasComplexView) {
+ if(_type == SEQ_TYPE) {
+ container_pnl._height += 3;
+ container_pnl._width = _visibleWidth + PANEL_OFFSET_X;
+ header_pnl._width = _visibleWidth - 6 + PANEL_OFFSET_X;
+
+ clickTarget_mc._width = _visibleWidth + PANEL_OFFSET_X;
+ }
+
+ _visibleHeight = container_pnl._height;
+
+ if(!_canvasComplexView) {
_x = _activity.xCoord;
- _y = _activity.yCoord;
+ _y = _activity.yCoord;
}
//dimentions of container (this)
@@ -396,9 +396,9 @@
drawLearners();
Debugger.log ("I am in Draw :" + _activity.title + 'uiID:' + _activity.activityUIID + ' children:' + _children.length, Debugger.GEN, 'Draw', 'CanvasOptionalActivity');
-
- _visible = true;
+ _visible = true;
+
}
private function setLocking():Void{
@@ -430,9 +430,9 @@
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'));
+ if(_activity.isReadOnly() && (fromModuleTab == null || fromModuleTab == undefined)) {
+ /** TODO: Change label warning */
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_dbclick_readonly'));
}
_locked = true;
}
@@ -480,7 +480,7 @@
}
public function get children():Array {
- return children_mc;
+ return children_mc;
}
public function get panelHeight():Number {
@@ -523,20 +523,20 @@
styleObj = _tm.getStyleObject ('PIlabel');
actCount_lbl.setStyle ('styleName', styleObj);
styleObj = _tm.getStyleObject ('OptHeadPanel');
- header_pnl.setStyle ('styleName', styleObj);
+ header_pnl.setStyle ('styleName', styleObj);
styleObj = getAssociatedStyle();
container_pnl.setStyle ('styleName', styleObj);
- }
-
- public function set controller(a):Void {
- if(a instanceof CanvasController)
- _canvasController = a;
- else
- _monitorController = a;
- }
-
- public function get type():Number {
- return _type;
}
+
+ public function set controller(a):Void {
+ if(a instanceof CanvasController)
+ _canvasController = a;
+ else
+ _monitorController = a;
+ }
+
+ public function get type():Number {
+ return _type;
+ }
}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasParallelActivity.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasParallelActivity.as (.../CanvasParallelActivity.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasParallelActivity.as (.../CanvasParallelActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,417 +1,417 @@
-/***************************************************************************
- * 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.*;
+/***************************************************************************
+ * 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.authoring.br.CanvasBranchView;
-import org.lamsfoundation.lams.monitoring.mv.*;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
-import org.lamsfoundation.lams.common.style.*;
-import mx.controls.*;
+import org.lamsfoundation.lams.authoring.cv.*;
+import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
+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
+* 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;
- private var CHILD2_OFFSET_Y:Number = 108;
-
- public static var PLUS_MARGIN_X:Number = 15;
- public static var PLUS_MARGIN_Y:Number = 10;
-
- 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 _canvasBranchView:CanvasBranchView;
- private var _canvasComplexView:CanvasComplexView;
-
- 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 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;
-
+ private var CHILD_OFFSET_X:Number = 8;
+ private var CHILD1_OFFSET_Y:Number = 45;
+ private var CHILD2_OFFSET_Y:Number = 108;
+
+ public static var PLUS_MARGIN_X:Number = 15;
+ public static var PLUS_MARGIN_Y:Number = 10;
+
+ 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 _canvasBranchView:CanvasBranchView;
+ private var _canvasComplexView:CanvasComplexView;
+
+ 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 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;
-
+ _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);
-
- 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;
- child1.yCoord = CHILD1_OFFSET_Y;
- child2.xCoord = CHILD_OFFSET_X;
- child2.yCoord = CHILD2_OFFSET_Y;
-
- //so now it is placed on in the IDE and we just call init
- Debugger.log("fromModuleTab: " + fromModuleTab, Debugger.CRITICAL, "init", "CanvasParallelActivity");
-
- MovieClipUtils.doLater(Proxy.create(this, initChildren, child1, child2));
-
- //let it wait one frame to set up the components.
- MovieClipUtils.doLater(Proxy.create(this, draw));
-
- }
-
- private function initChildren(child1:Activity, child2:Activity):Void {
- if(fromModuleTab == "monitorMonitorTab"){
- Debugger.log("initialising for monitor: " + child1.activityUIID + " " + child2.activityUIID, Debugger.CRITICAL, "init", "CanvasParallelActivity");
- Debugger.log("controller for monitor: " + _monitorController, Debugger.CRITICAL, "init", "CanvasParallelActivity");
-
- if(_canvasBranchView != null) {
- CanvasActivity(child1_mc).init({activity:child1, _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer});
- CanvasActivity(child2_mc).init({activity:child2, _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer});
- } else if(_canvasComplexView != null) {
- CanvasActivity(child1_mc).init({activity:child1, _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer});
- CanvasActivity(child2_mc).init({activity:child2, _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer});
- } else {
- CanvasActivity(child1_mc).init({activity:child1, _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
- CanvasActivity(child2_mc).init({activity:child2, _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
- }
-
- Debugger.log("child_mc(s) " + child1_mc + " " + child2_mc, Debugger.CRITICAL, "init", "CanvasParallelActivity");
-
- } else {
-
- if(_canvasBranchView != null) {
- CanvasActivity(child1_mc).init({activity:child1,_canvasController:_canvasController,_canvasBranchView:_canvasBranchView});
- CanvasActivity(child2_mc).init({activity:child2,_canvasController:_canvasController,_canvasBranchView:_canvasBranchView});
- } else if(_canvasComplexView != null) {
- CanvasActivity(child1_mc).init({activity:child1,_canvasController:_canvasController,_canvasComplexView:_canvasComplexView});
- CanvasActivity(child2_mc).init({activity:child2,_canvasController:_canvasController,_canvasComplexView:_canvasComplexView});
- } else {
- CanvasActivity(child1_mc).init({activity:child1,_canvasController:_canvasController,_canvasView:_canvasView});
- CanvasActivity(child2_mc).init({activity:child2,_canvasController:_canvasController,_canvasView:_canvasView});
- }
-
- }
- }
-
- public function refreshChildren():Void {
- child1_mc.setSelected(false);
- child2_mc.setSelected(false);
- }
-
- public function setSelected(isSelected){}
-
- 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 = (mm.activeView instanceof CanvasComplexView) ? this._x + learnerOffset_X : _activity.xCoord + learnerOffset_X;
- var learner_Y = (mm.activeView instanceof CanvasComplexView) ? this._y + learnerOffset_Y : _activity.yCoord + learnerOffset_Y;
-
- // get the length of learners from the Monitor Model and run a for loop.
- for (var j=0; j (actX + 92)){
- learner_X = actX + learnerOffset_X
- learner_Y = 27
- hasPlus = true;
- learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), this._parent.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus });
- learnerContainer.attachMovie("plusIcon", "plusIcon", learnerContainer.getNextHighestDepth(), {_activity:_activity, _monitorController:_monitorController, _x:learner_X+PLUS_MARGIN_X, _y:learner_Y+PLUS_MARGIN_Y});
- return;
- }
-
- learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), this._parent.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus});
- learner_X = learner_X+10
- }
- }
- }
-
+ 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);
+
+ 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;
+ child1.yCoord = CHILD1_OFFSET_Y;
+ child2.xCoord = CHILD_OFFSET_X;
+ child2.yCoord = CHILD2_OFFSET_Y;
+
+ //so now it is placed on in the IDE and we just call init
+ Debugger.log("fromModuleTab: " + fromModuleTab, Debugger.CRITICAL, "init", "CanvasParallelActivity");
+
+ MovieClipUtils.doLater(Proxy.create(this, initChildren, child1, child2));
+
+ //let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this, draw));
+
+ }
+
+ private function initChildren(child1:Activity, child2:Activity):Void {
+ if(fromModuleTab == "monitorMonitorTab"){
+ Debugger.log("initialising for monitor: " + child1.activityUIID + " " + child2.activityUIID, Debugger.CRITICAL, "init", "CanvasParallelActivity");
+ Debugger.log("controller for monitor: " + _monitorController, Debugger.CRITICAL, "init", "CanvasParallelActivity");
+
+ if(_canvasBranchView != null) {
+ CanvasActivity(child1_mc).init({activity:child1, _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer});
+ CanvasActivity(child2_mc).init({activity:child2, _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer});
+ } else if(_canvasComplexView != null) {
+ CanvasActivity(child1_mc).init({activity:child1, _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer});
+ CanvasActivity(child2_mc).init({activity:child2, _monitorController:_monitorController, _monitorView:_canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer});
+ } else {
+ CanvasActivity(child1_mc).init({activity:child1, _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
+ CanvasActivity(child2_mc).init({activity:child2, _monitorController:_monitorController, _monitorView:_monitorTabView, _module:"monitoring", learnerContainer:learnerContainer});
+ }
+
+ Debugger.log("child_mc(s) " + child1_mc + " " + child2_mc, Debugger.CRITICAL, "init", "CanvasParallelActivity");
+
+ } else {
+
+ if(_canvasBranchView != null) {
+ CanvasActivity(child1_mc).init({activity:child1,_canvasController:_canvasController,_canvasBranchView:_canvasBranchView});
+ CanvasActivity(child2_mc).init({activity:child2,_canvasController:_canvasController,_canvasBranchView:_canvasBranchView});
+ } else if(_canvasComplexView != null) {
+ CanvasActivity(child1_mc).init({activity:child1,_canvasController:_canvasController,_canvasComplexView:_canvasComplexView});
+ CanvasActivity(child2_mc).init({activity:child2,_canvasController:_canvasController,_canvasComplexView:_canvasComplexView});
+ } else {
+ CanvasActivity(child1_mc).init({activity:child1,_canvasController:_canvasController,_canvasView:_canvasView});
+ CanvasActivity(child2_mc).init({activity:child2,_canvasController:_canvasController,_canvasView:_canvasView});
+ }
+
+ }
+ }
+
+ public function refreshChildren():Void {
+ child1_mc.setSelected(false);
+ child2_mc.setSelected(false);
+ }
+
+ public function setSelected(isSelected){}
+
+ 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 = (mm.activeView instanceof CanvasComplexView) ? this._x + learnerOffset_X : _activity.xCoord + learnerOffset_X;
+ var learner_Y = (mm.activeView instanceof CanvasComplexView) ? this._y + learnerOffset_Y : _activity.yCoord + learnerOffset_Y;
+
+ // get the length of learners from the Monitor Model and run a for loop.
+ for (var j=0; j (actX + 92)){
+ learner_X = actX + learnerOffset_X
+ learner_Y = 27
+ hasPlus = true;
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), this._parent.getNextHighestDepth(),{_activity:_activity, learner:learner, _monitorController:_monitorController, _x:learner_X, _y:learner_Y, _hasPlus:hasPlus });
+ learnerContainer.attachMovie("plusIcon", "plusIcon", learnerContainer.getNextHighestDepth(), {_activity:_activity, _monitorController:_monitorController, _x:learner_X+PLUS_MARGIN_X, _y:learner_Y+PLUS_MARGIN_Y});
+ return;
+ }
+
+ learnerContainer.attachMovie("learnerIcon", "learnerIcon"+learner.getUserName(), this._parent.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)
- if(!_canvasComplexView) {
- _x = _activity.xCoord;
- _y = _activity.yCoord;
- }
-
- setLocking();
- setStyles();
-
- _visible = true;
+ title_lbl.text = _activity.title;
+
+ if(fromModuleTab == "monitorMonitorTab")
+ drawLearners()
+
+ //position the container (this)
+ if(!_canvasComplexView) {
+ _x = _activity.xCoord;
+ _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);
- }
-
- private function setLocking():Void{
- if(_locked){
- clickTarget_mc._height = 173;
- }else{
- clickTarget_mc._height = 30;
- }
}
-
- public function set locked(setLock:Boolean):Void {
- _locked = setLock;
- setLocking();
-
- }
-
- public function get locked():Boolean {
- return _locked;
+
+ 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);
}
- 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;
- }
-
- public function get children():Array {
- return new Array(child1_mc, child2_mc);
- }
-
- public function set controller(a):Void {
- if(a instanceof CanvasController)
- _canvasController = a;
- else
- _monitorController = a;
- }
+ private function setLocking():Void{
+ if(_locked){
+ clickTarget_mc._height = 173;
+ }else{
+ 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;
+ }
+
+ public function get children():Array {
+ return new Array(child1_mc, child2_mc);
+ }
+
+ public function set controller(a):Void {
+ if(a instanceof CanvasController)
+ _canvasController = a;
+ else
+ _monitorController = a;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasSequenceActivity.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasSequenceActivity.as (.../CanvasSequenceActivity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasSequenceActivity.as (.../CanvasSequenceActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,477 +1,477 @@
-/***************************************************************************
- * 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.authoring.br.*;
-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.*;
-
-/**
-* CanvasSequenceActivity
-*/
-class org.lamsfoundation.lams.authoring.cv.CanvasSequenceActivity extends MovieClip implements ICanvasActivity{
-
- public static var TOOL_ACTIVITY_WIDTH:Number = 138;
- public static var TOOL_ACTIVITY_HEIGHT:Number = 55.5;
- public static var ICON_WIDTH:Number = 25;
- public static var ICON_HEIGHT:Number = 25;
-
- private var CHILD_OFFSET_X : Number = 5;
- private var CHILD_OFFSET_Y : Number = 5;
- private var CHILD_INCRE : Number = 59.5;
-
- //this is set by the init object
- private var _canvasController:CanvasController;
- private var _canvasView:CanvasView;
-
- private var _canvasBranchView:CanvasBranchView;
- private var _canvasComplexView:CanvasComplexView;
-
- private var _monitorController:MonitorController;
- private var _monitorView;
-
- private var _controller;
-
- 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 _children:Array;
- private var children_mc:Array;
-
- private var childActivities_mc:MovieClip;
- private var learnerContainer:MovieClip;
-
- private var _isSelected:Boolean;
- private var app:ApplicationParent;
-
- 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 emptyIcon_mc:MovieClip;
-
- private var clickTarget_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;
-
- private var _depthHistory:Number;
- private var _ddm:DesignDataModel;
-
- function CanvasSequenceActivity(){
- _visible = false;
- _tm = ThemeManager.getInstance();
- _ccm = CustomContextMenu.getInstance();
- _ddm = getDDM();
- _children = new Array();
-
- //Get reference to application and design data model
- app = ApplicationParent.getInstance();
-
- //let it wait one frame to set up the components.
- //this has to be set b4 the do later :)
-
- _visibleHeight = CanvasSequenceActivity.TOOL_ACTIVITY_HEIGHT;
- _visibleWidth = CanvasSequenceActivity.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.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;
- }else {
- _canvasView = initObj._canvasView;
- _canvasController = initObj._canvasController;
- }
-
- _activity = initObj.activity;
- }
-
- if(_canvasController != null)
- _canvasModel = CanvasModel(_canvasController.getModel());
- else if(_monitorController != null)
- mm = MonitorModel(_monitorController.getModel());
-
- Debugger.log("firstActivityUIID: " + ComplexActivity(_activity).firstActivityUIID, Debugger.CRITICAL, "init", "CanvasSequenceActivity");
-
- if(ComplexActivity(_activity).firstActivityUIID != null) {
- var firstActivity:Activity = _ddm.getActivityByUIID(ComplexActivity(_activity).firstActivityUIID);
- if(firstActivity != null) _children.push(firstActivity);
- else ComplexActivity(_activity).firstActivityUIID = null;
- }
-
- showAssets(false);
-
- if (_activity.selectActivity == "false"){
- _isSelected = false;
- refresh();
- }
-
- removeAllChildren();
-
- if(_children.length > 0) {
- SequenceActivity(_activity).empty = false;
- drawChildActivity(_children[_children.length-1]);
- }
-
- var _newVisibleWidth:Number = (_children.length*CHILD_INCRE) + (CHILD_OFFSET_X*2) + 6;
-
- if(_newVisibleWidth > CanvasSequenceActivity.TOOL_ACTIVITY_WIDTH)
- _visibleWidth = _newVisibleWidth;
-
- setStyles();
-
- MovieClipUtils.doLater(Proxy.create(this, draw));
- }
-
- private function drawChildActivity(a:Activity):Void {
- var childActivity:MovieClip;
-
- Debugger.log("activity: " + a.activityUIID, Debugger.CRITICAL, "drawChildActivity", "CanvasSequenceActivity");
-
- if(_module == "monitoring") {
- if(_canvasBranchView != null)
- childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer, _sequenceChild:true});
- else if(_canvasComplexView != null)
- childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _monitorController:_monitorController, __monitorView: _canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer, _sequenceChild:true});
- else
- childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _monitorController:_monitorController, _monitorView:_monitorView, _module:"monitoring", learnerContainer:learnerContainer, _sequenceChild:true});
- } else {
- if(_canvasBranchView != null)
- childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _canvasController:_canvasController, _canvasBranchView:_canvasBranchView, _sequenceChild:true});
- else if(_canvasComplexView != null)
- childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _canvasController:_canvasController, _canvasComplexView:_canvasComplexView, _sequenceChild:true});
- else
- childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _canvasController:_canvasController, _canvasView:_canvasView, _sequenceChild:true});
-
- }
- //set the positioning co-ords
- childActivity.activity.xCoord = CHILD_OFFSET_X + ((_children.length-1) * CHILD_INCRE);
- childActivity.activity.yCoord = CHILD_OFFSET_Y;
- childActivity._visible = true;
-
- if(childActivity.activity.activityUIID == getModel().selectedItem.activity.activityUIID)
- childActivity.setSelected(true);
-
- children_mc.push(childActivity);
- a.orderID = _children.length;
-
- Debugger.log("children length: " + _children.length, Debugger.CRITICAL, "drawChildActivity", "CanvasSequenceActivity");
-
- var transitionObj:Object = _ddm.getTransitionsForActivityUIID(childActivity.activity.activityUIID)
- if(transitionObj.hasTrans && transitionObj.out != null) {
- _children.push(_ddm.getActivityByUIID(transitionObj.out.toUIID))
- drawChildActivity(_children[_children.length-1]);
- }
- }
-
- public function updateChildren():Void {
- _visible = false;
- _visibleWidth = CanvasSequenceActivity.TOOL_ACTIVITY_HEIGHT;
- _children = new Array();
-
- init();
- }
-
- public function refreshChildren():Void {
- for(var i = 0; i < children_mc.length; i ++) {
- children_mc[i].setSelected(false);
- }
- }
-
- public function removeAllChildren(removeBranchView:Boolean):Void {
- for(var j=0; j 0) {
+ SequenceActivity(_activity).empty = false;
+ drawChildActivity(_children[_children.length-1]);
+ }
+
+ var _newVisibleWidth:Number = (_children.length*CHILD_INCRE) + (CHILD_OFFSET_X*2) + 6;
+
+ if(_newVisibleWidth > CanvasSequenceActivity.TOOL_ACTIVITY_WIDTH)
+ _visibleWidth = _newVisibleWidth;
+
+ setStyles();
+
+ MovieClipUtils.doLater(Proxy.create(this, draw));
+ }
+
+ private function drawChildActivity(a:Activity):Void {
+ var childActivity:MovieClip;
+
+ Debugger.log("activity: " + a.activityUIID, Debugger.CRITICAL, "drawChildActivity", "CanvasSequenceActivity");
+
+ if(_module == "monitoring") {
+ if(_canvasBranchView != null)
+ childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _monitorController:_monitorController, _monitorView:_canvasBranchView, _module:"monitoring", learnerContainer:learnerContainer, _sequenceChild:true});
+ else if(_canvasComplexView != null)
+ childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _monitorController:_monitorController, __monitorView: _canvasComplexView, _module:"monitoring", learnerContainer:learnerContainer, _sequenceChild:true});
+ else
+ childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _monitorController:_monitorController, _monitorView:_monitorView, _module:"monitoring", learnerContainer:learnerContainer, _sequenceChild:true});
+ } else {
+ if(_canvasBranchView != null)
+ childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _canvasController:_canvasController, _canvasBranchView:_canvasBranchView, _sequenceChild:true});
+ else if(_canvasComplexView != null)
+ childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _canvasController:_canvasController, _canvasComplexView:_canvasComplexView, _sequenceChild:true});
+ else
+ childActivity = childActivities_mc.attachMovie("CanvasActivityMin", "CanvasActivityMin"+a.activityUIID, childActivities_mc.getNextHighestDepth(), {_activity:a , _canvasController:_canvasController, _canvasView:_canvasView, _sequenceChild:true});
+
+ }
+ //set the positioning co-ords
+ childActivity.activity.xCoord = CHILD_OFFSET_X + ((_children.length-1) * CHILD_INCRE);
+ childActivity.activity.yCoord = CHILD_OFFSET_Y;
+ childActivity._visible = true;
+
+ if(childActivity.activity.activityUIID == getModel().selectedItem.activity.activityUIID)
+ childActivity.setSelected(true);
+
+ children_mc.push(childActivity);
+ a.orderID = _children.length;
+
+ Debugger.log("children length: " + _children.length, Debugger.CRITICAL, "drawChildActivity", "CanvasSequenceActivity");
+
+ var transitionObj:Object = _ddm.getTransitionsForActivityUIID(childActivity.activity.activityUIID)
+ if(transitionObj.hasTrans && transitionObj.out != null) {
+ _children.push(_ddm.getActivityByUIID(transitionObj.out.toUIID))
+ drawChildActivity(_children[_children.length-1]);
+ }
+ }
+
+ public function updateChildren():Void {
+ _visible = false;
+ _visibleWidth = CanvasSequenceActivity.TOOL_ACTIVITY_HEIGHT;
+ _children = new Array();
+
+ init();
+ }
+
+ public function refreshChildren():Void {
+ for(var i = 0; i < children_mc.length; i ++) {
+ children_mc[i].setSelected(false);
+ }
+ }
+
+ public function removeAllChildren(removeBranchView:Boolean):Void {
+ for(var j=0; j 0) {
- _branchingQueue.shift();
-
- if(_branchingQueue[0] instanceof CanvasBranchView) {
- CanvasBranchView(_branchingQueue[0]).init(this, undefined);
- setupBranchingObserver(CanvasBranchView(_branchingQueue[0]));
- } else {
- CanvasOptionalActivity(_branchingQueue[0]).init();
- }
- }
- }
-
- private function setupBranchingObserver(a:CanvasBranchView):Void {
- //Add listener to view so that we know when it's loaded
- a.addEventListener('load', Proxy.create(_cv, _cv.viewLoaded));
-
- this.addObserver(a);
- }
-
- public function lockAllComplexActivities():Void{
- Debugger.log("Locking all Complex Activities", Debugger.GEN, "lockAllComplexActivities", "CanvasModel");
- var k:Array = _activitiesDisplayed.values();
- for (var i=0; i 0) {
+ _branchingQueue.shift();
+
+ if(_branchingQueue[0] instanceof CanvasBranchView) {
+ CanvasBranchView(_branchingQueue[0]).init(this, undefined);
+ setupBranchingObserver(CanvasBranchView(_branchingQueue[0]));
+ } else {
+ CanvasOptionalActivity(_branchingQueue[0]).init();
+ }
+ }
+ }
+
+ private function setupBranchingObserver(a:CanvasBranchView):Void {
+ //Add listener to view so that we know when it's loaded
+ a.addEventListener('load', Proxy.create(_cv, _cv.viewLoaded));
+
+ this.addObserver(a);
+ }
+
+ public function lockAllComplexActivities():Void{
+ Debugger.log("Locking all Complex Activities", Debugger.GEN, "lockAllComplexActivities", "CanvasModel");
+ var k:Array = _activitiesDisplayed.values();
+ for (var i=0; i 0 || ddm_activity.parentUIID > 0){
- var parentAct;
- if((parentAct = _cv.ddm.activities.get(ddm_activity.parentUIID)) != null)
- if(parentAct.activityTypeID == Activity.SEQUENCE_ACTIVITY_TYPE && !parentAct.isOptionalSequenceActivity(_cv.ddm.activities.get(parentAct.parentUIID))) {
- SequenceActivity(parentAct).empty = false;
- return r = "NEW_SEQ_CHILD";
- }
-
- return r = "CHILD";
- }
-
- //check for a new act in the dmm
- if(cm_activity == null || cm_activity == undefined){
- return r = "NEW";
- }
- }
-
- /**
- * 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_transition:'+ddm_transition.title + '(' +ddm_transition.transitionUIID+') WITH cm_transition:' + cm_transition.title + '(' + cm_transition.transitionUIID +')' ,Debugger.GEN,'compareTransitions','CanvasModel');
- return compareConnections(ddm_transition, cm_transition);
- }
-
- private function compareBranches(ddm_branch:Branch, cm_branch:Branch):Object{
- Debugger.log('Comparing ddm_branch:'+ddm_branch.title + '(' +ddm_branch.branchUIID+') WITH cm_branch:' + cm_branch.title + '(' + cm_branch.branchUIID +')' ,Debugger.GEN,'compareBranches','CanvasModel');
- return compareConnections(ddm_branch, cm_branch);
- }
-
- private function compareConnections(ddm_connect, cm_connect):Object{
- var r:Object = new Object();
- if(ddm_connect === cm_connect){
- return r = "SAME";
- }
-
- //check for a new connection in the dmm
- if(cm_connect == null){
- return r = "NEW";
- }
-
- //check if connection has been removed from canvas
- if(ddm_connect == 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(){
-
- Debugger.log('Running',Debugger.GEN,'refreshDesign','CanvasModel');
- var evtsTable:Hashtable = new Hashtable("evtsTable");
-
- if(activeRefresh) {
- _refreshQueueCount++;
- return;
- }
-
- startRefresh();
-
- //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');
-
- var cmActivity_keys:Array = _activitiesDisplayed.keys();
- Debugger.log('cmActivity_keys.length:'+cmActivity_keys.length,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;
- var compArray:Array;
-
- if(ddmActivity_keys.length == longest){
- indexArray = ddmActivity_keys;
- compArray = cmActivity_keys;
- }else{
- indexArray = cmActivity_keys;
- compArray = ddmActivity_keys;
- }
-
- refreshActivities(evtsTable, indexArray);
- refreshActivities(evtsTable, compArray);
-
- //now check the transitions:
- var ddmTransition_keys:Array = _cv.ddm.getValidTransitionsKeys();
- var cmTransition_keys:Array = _transitionsDisplayed.keys();
-
- var trLongest = Math.max(ddmTransition_keys.length, cmTransition_keys.length);
-
- //chose which array we are going to loop over
- var trIndexArray:Array;
- var trCompArray:Array;
-
- if(ddmTransition_keys.length == trLongest){
- trIndexArray = ddmTransition_keys;
- trCompArray = cmTransition_keys;
- }else{
- trIndexArray = cmTransition_keys;
- trCompArray = ddmTransition_keys;
- }
-
- refreshTransitions(evtsTable, trIndexArray);
- refreshTransitions(evtsTable, trCompArray);
-
- //now check the transitions:
- var ddmBranch_keys:Array = _cv.ddm.branches.keys();
- var cmBranch_keys:Array = _branchesDisplayed.keys();
-
- var brLongest = Math.max(ddmBranch_keys.length, cmBranch_keys.length);
-
- //chose which array we are going to loop over
- var brIndexArray:Array;
- var brCompArray:Array;
-
- if(ddmBranch_keys.length == brLongest){
- brIndexArray = ddmBranch_keys;
- brCompArray = cmBranch_keys;
- }else{
- brIndexArray = cmBranch_keys;
- brCompArray = ddmBranch_keys;
- }
-
- refreshBranches(evtsTable, brIndexArray);
- refreshBranches(evtsTable, brCompArray);
-
- broadcastViewUpdate("DRAW_ALL", evtsTable.values());
- stopRefresh();
-
- if(_refreshQueueCount > 0) {
- _refreshQueueCount = 0;
- refreshDesign();
- }
-
- }
-
- private function refreshActivities(evtsTable:Hashtable, keys:Array):Void {
- //loop through and do comparison
- for(var i=0;i 0 || ddm_activity.parentUIID > 0){
+ var parentAct;
+ if((parentAct = _cv.ddm.activities.get(ddm_activity.parentUIID)) != null)
+ if(parentAct.activityTypeID == Activity.SEQUENCE_ACTIVITY_TYPE && !parentAct.isOptionalSequenceActivity(_cv.ddm.activities.get(parentAct.parentUIID))) {
+ SequenceActivity(parentAct).empty = false;
+ return r = "NEW_SEQ_CHILD";
+ }
+
+ return r = "CHILD";
+ }
+
+ //check for a new act in the dmm
+ if(cm_activity == null || cm_activity == undefined){
+ return r = "NEW";
+ }
+ }
+
+ /**
+ * 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_transition:'+ddm_transition.title + '(' +ddm_transition.transitionUIID+') WITH cm_transition:' + cm_transition.title + '(' + cm_transition.transitionUIID +')' ,Debugger.GEN,'compareTransitions','CanvasModel');
+ return compareConnections(ddm_transition, cm_transition);
+ }
+
+ private function compareBranches(ddm_branch:Branch, cm_branch:Branch):Object{
+ Debugger.log('Comparing ddm_branch:'+ddm_branch.title + '(' +ddm_branch.branchUIID+') WITH cm_branch:' + cm_branch.title + '(' + cm_branch.branchUIID +')' ,Debugger.GEN,'compareBranches','CanvasModel');
+ return compareConnections(ddm_branch, cm_branch);
+ }
+
+ private function compareConnections(ddm_connect, cm_connect):Object{
+ var r:Object = new Object();
+ if(ddm_connect === cm_connect){
+ return r = "SAME";
+ }
+
+ //check for a new connection in the dmm
+ if(cm_connect == null){
+ return r = "NEW";
+ }
+
+ //check if connection has been removed from canvas
+ if(ddm_connect == 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(){
+
+ Debugger.log('Running',Debugger.GEN,'refreshDesign','CanvasModel');
+ var evtsTable:Hashtable = new Hashtable("evtsTable");
+
+ if(activeRefresh) {
+ _refreshQueueCount++;
+ return;
+ }
+
+ startRefresh();
+
+ //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');
+
+ var cmActivity_keys:Array = _activitiesDisplayed.keys();
+ Debugger.log('cmActivity_keys.length:'+cmActivity_keys.length,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;
+ var compArray:Array;
+
+ if(ddmActivity_keys.length == longest){
+ indexArray = ddmActivity_keys;
+ compArray = cmActivity_keys;
+ }else{
+ indexArray = cmActivity_keys;
+ compArray = ddmActivity_keys;
+ }
+
+ refreshActivities(evtsTable, indexArray);
+ refreshActivities(evtsTable, compArray);
+
+ //now check the transitions:
+ var ddmTransition_keys:Array = _cv.ddm.getValidTransitionsKeys();
+ var cmTransition_keys:Array = _transitionsDisplayed.keys();
+
+ var trLongest = Math.max(ddmTransition_keys.length, cmTransition_keys.length);
+
+ //chose which array we are going to loop over
+ var trIndexArray:Array;
+ var trCompArray:Array;
+
+ if(ddmTransition_keys.length == trLongest){
+ trIndexArray = ddmTransition_keys;
+ trCompArray = cmTransition_keys;
+ }else{
+ trIndexArray = cmTransition_keys;
+ trCompArray = ddmTransition_keys;
+ }
+
+ refreshTransitions(evtsTable, trIndexArray);
+ refreshTransitions(evtsTable, trCompArray);
+
+ //now check the transitions:
+ var ddmBranch_keys:Array = _cv.ddm.branches.keys();
+ var cmBranch_keys:Array = _branchesDisplayed.keys();
+
+ var brLongest = Math.max(ddmBranch_keys.length, cmBranch_keys.length);
+
+ //chose which array we are going to loop over
+ var brIndexArray:Array;
+ var brCompArray:Array;
+
+ if(ddmBranch_keys.length == brLongest){
+ brIndexArray = ddmBranch_keys;
+ brCompArray = cmBranch_keys;
+ }else{
+ brIndexArray = cmBranch_keys;
+ brCompArray = ddmBranch_keys;
+ }
+
+ refreshBranches(evtsTable, brIndexArray);
+ refreshBranches(evtsTable, brCompArray);
+
+ broadcastViewUpdate("DRAW_ALL", evtsTable.values());
+ stopRefresh();
+
+ if(_refreshQueueCount > 0) {
+ _refreshQueueCount = 0;
+ refreshDesign();
+ }
+
+ }
+
+ private function refreshActivities(evtsTable:Hashtable, keys:Array):Void {
+ //loop through and do comparison
+ for(var i=0;i '+ca.activity.parentUIID,Debugger.GEN,'addParentToActivity','CanvasModel');
-
- tagBranchingActivitiesForClearing(ca);
-
- removeActivity(ca.activity.activityUIID);
- if(doRemoveParent) removeActivity(parentID);
-
- setDirty();
- }
-
- private function tagBranchingActivitiesForClearing(ca:Object):Void {
- if(ca.activity.isBranchingActivity()) {
- ca.activity.clear = true;
-
- var opts = findOptionalActivities(true);
- for(var i=0; i '+ca.activity.parentUIID,Debugger.GEN,'addParentToActivity','CanvasModel');
+
+ tagBranchingActivitiesForClearing(ca);
+
+ removeActivity(ca.activity.activityUIID);
+ if(doRemoveParent) removeActivity(parentID);
+
+ setDirty();
+ }
+
+ private function tagBranchingActivitiesForClearing(ca:Object):Void {
+ if(ca.activity.isBranchingActivity()) {
+ ca.activity.clear = true;
+
+ var opts = findOptionalActivities(true);
+ for(var i=0; i"+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);
-
- }
-
- /**
- * 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{
- if(!cm.isActiveView(this)) return false;
-
- var cvv = CanvasView(this);
- var cvc = getController();
-
- var setupBranchView:Boolean = (cm.lastBranchActionType == CanvasModel.OPEN_FROM_FILE) ? false /* true */ : false;
-
- Debugger.log('setupBranchView:' + setupBranchView, Debugger.CRITICAL, 'drawActivity','CanvasView');
-
- //take action depending on act type
- if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity()){
- var newActivity_mc = activityLayer.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');
- }
- else if (a.isGateActivity()){
- var newActivity_mc = activityLayer.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');
- }
- else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE){
- //get the children
- var children:Array = cm.getCanvas().ddm.getComplexActivityChildren(a.activityUIID);
- var newActivity_mc = activityLayer.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');
- }
- else if(a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONS_WITH_SEQUENCES_TYPE){
- var children:Array = cm.getCanvas().ddm.getComplexActivityChildren(a.activityUIID);
- var newActivity_mc = activityComplexLayer.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 if(a.isBranchingActivity()){
- var newActivity_mc = activityLayer.createChildAtDepth("CanvasBranchingActivity",DepthManager.kTop,{_activity:a,_canvasController:cvc,_canvasView:cvv, setupBranchView: setupBranchView, showDiagram: true});
- cm.activitiesDisplayed.put(a.activityUIID, newActivity_mc);
- Debugger.log('Branching 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');
- }
-
- 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, cm:CanvasModel):Boolean {
- if(!cm.isActiveView(this)) return false;
-
- 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{
- if(!cm.isActiveView(this)) return false;
-
- if(a.isBranchingActivity()) {
- Debugger.log("removing Branching Activity: " + a.title, Debugger.CRITICAL, "removeActivity", "CanvasView");
- cm.clearAllBranches(a);
- cm.activitiesDisplayed.get(a.activityUIID).branchView.removeMovieClip();
- }
-
- 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{
- Debugger.log("drawing transition..." , Debugger.CRITICAL, "drawTransition", "CanvasVieW");
- Debugger.log("not activity on layer 1: " + !isActivityOnLayer(cm.activitiesDisplayed.get(t.fromUIID), this.activityLayers) , Debugger.CRITICAL, "drawTransition", "CanvasVieW");
- Debugger.log("not activity on layer 2: " + !isActivityOnLayer(cm.activitiesDisplayed.get(t.toUIID), this.activityLayers) , Debugger.CRITICAL, "drawTransition", "CanvasVieW");
-
- if(!isActivityOnLayer(cm.activitiesDisplayed.get(t.fromUIID), this.activityLayers) && !isActivityOnLayer(cm.activitiesDisplayed.get(t.toUIID), this.activityLayers)) return false;
-
- var cvv = CanvasView(this);
- var cvc = getController();
- var newTransition_mc:MovieClip = transitionLayer.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 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, cm:CanvasModel):Boolean{
- if(!cm.isActiveView(this)) return false;
-
- var cvv = CanvasView(this);
- var cvc = getController();
- var newTransition_mc:MovieClip = transitionLayer.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){
- if(!cm.isActiveView(this)) return false;
-
- var r = cm.transitionsDisplayed.remove(t.transitionUIID);
- r.removeMovieClip();
- var s:Boolean = (r==null) ? false : true;
-
- return s;
- }
-
- /**
- * Sets the size of the canvas on stage, called from update
- */
- private function setSize(cm:CanvasModel):Void{
- 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);
- transparentCover.setSize(newWidth, newHeight);
-
- //Create the grid. The gris is re-drawn each time the canvas is resized.
- var grid_mc = Grid.drawGrid(gridLayer, Math.round(newWidth), Math.round(newHeight), V_GAP, H_GAP);
-
- //position bin in canvas.
- var bin = cm.getCanvas().bin;
- if(bin._parent == this) {
- 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);
- transparentCover.setStyle('styleName', styleObj);
- }
-
- /**
- * 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 showReadOnly(b:Boolean){
- isRread_only = b;
- }
-
- public function showEditOnFly(b:Boolean){
- isRedit_on_fly = b;
- }
-
- public function get ddm():DesignDataModel {
- return _cm.getCanvas().ddm;
- }
-
- public function get model():CanvasModel {
- return _cm;
- }
-
- /**
- * 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);
- }
-
- public function getScrollPaneVPosition():Number {
- return canvas_scp.vPosition;
- }
-
- public function getScrollPaneHPosition():Number {
- return canvas_scp.hPosition;
- }
-
- public function get scrollpane():MovieClip {
- return canvas_scp;
- }
+/***************************************************************************
+ * 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 mx.controls.*;
+import mx.containers.*;
+import mx.managers.*;
+import mx.utils.*;
+
+/**
+*Authoring view for the canvas
+* Relects changes in the CanvasModel
+*/
+
+class org.lamsfoundation.lams.authoring.cv.CanvasView extends CommonCanvasView {
+
+ private var _tm:ThemeManager;
+
+ private var _cm:CanvasModel;
+ private var _canvasView:CanvasView;
+
+ private var canvas_scp:ScrollPane;
+
+ 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 designName_lbl:Label;
+
+ private var startTransX:Number;
+ private var startTransY:Number;
+
+ private var lastScreenWidth:Number = 1024;
+ private var lastScreenHeight:Number = 768;
+
+ /**
+ * 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.
+ 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');
+ 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 'OPEN_CONDITIONS_DIALOG':
+ getController().openToolOutputConditionsDialog(event.data);
+ break;
+ case 'SET_ACTIVE' :
+ Debugger.log('setting activie :' + event.updateType + " event.data: " + event.data + " condition: " + (event.data == this),Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView');
+ transparentCover._visible = (event.data == this) ? false : true;
+ break;
+ case 'DRAW_ALL' :
+ drawAll(event.data, cm);
+ break;
+ default :
+ Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView');
+ }
+
+ }
+
+ /**
+ * layout visual elements on the canvas on initialisation
+ */
+ private function draw(){
+ //get the content path for the sp
+ content = canvas_scp.content;
+
+ bkg_pnl = content.createClassObject(Panel, "bkg_pnl", content.getNextHighestDepth());
+ gridLayer = content.createEmptyMovieClip("_gridLayer_mc", content.getNextHighestDepth());
+ transitionLayer = content.createEmptyMovieClip("_transitionLayer_mc", content.getNextHighestDepth());
+
+ activityComplexLayer = content.createEmptyMovieClip("_activityComplexLayer_mc", content.getNextHighestDepth());
+ activityLayer = content.createEmptyMovieClip("_activityLayer_mc", content.getNextHighestDepth());
+
+ transparentCover = content.createClassObject(Panel, "_transparentCover_mc", content.getNextHighestDepth(), {_visible: false, enabled: true, _alpha: 50});
+ transparentCover.onPress = Proxy.create(this, onTransparentCoverClick);
+
+ complexViewer = content.createEmptyMovieClip("_complex_viewer_mc", content.getNextHighestDepth());
+ branchContent = content.createEmptyMovieClip("_branch_content_mc", DepthManager.kTop);
+
+ titleBar = _canvasView.attachMovie("DesignTitleBar", "titleBar", _canvasView.getNextHighestDepth())
+
+ 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});
+
+ bkg_pnl.onRelease = function(){
+ Application.getInstance().getCanvas().getCanvasView().getController().canvasRelease(this);
+ }
+
+ bkg_pnl.useHandCursor = false;
+
+ setDesignTitle();
+ styleTitleBar();
+ setStyles();
+
+ //Dispatch load event
+ dispatchEvent({type:'load',target:this});
+ }
+
+ private function drawAll(objArr:Array, model:Observable){
+ Debugger.log("drawing all: " + objArr.length + " model: " + model, Debugger.CRITICAL, "drawAll", "CanvasView");
+
+ for (var i=0; i"+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);
+
+ }
+
+ /**
+ * 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{
+ if(!cm.isActiveView(this)) return false;
+
+ var cvv = CanvasView(this);
+ var cvc = getController();
+
+ var setupBranchView:Boolean = (cm.lastBranchActionType == CanvasModel.OPEN_FROM_FILE) ? false /* true */ : false;
+
+ Debugger.log('setupBranchView:' + setupBranchView, Debugger.CRITICAL, 'drawActivity','CanvasView');
+
+ //take action depending on act type
+ if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity()){
+ var newActivity_mc = activityLayer.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');
+ }
+ else if (a.isGateActivity()){
+ var newActivity_mc = activityLayer.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');
+ }
+ else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE){
+ //get the children
+ var children:Array = cm.getCanvas().ddm.getComplexActivityChildren(a.activityUIID);
+ var newActivity_mc = activityLayer.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');
+ }
+ else if(a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONS_WITH_SEQUENCES_TYPE){
+ var children:Array = cm.getCanvas().ddm.getComplexActivityChildren(a.activityUIID);
+ var newActivity_mc = activityComplexLayer.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 if(a.isBranchingActivity()){
+ var newActivity_mc = activityLayer.createChildAtDepth("CanvasBranchingActivity",DepthManager.kTop,{_activity:a,_canvasController:cvc,_canvasView:cvv, setupBranchView: setupBranchView, showDiagram: true});
+ cm.activitiesDisplayed.put(a.activityUIID, newActivity_mc);
+ Debugger.log('Branching 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');
+ }
+
+ 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, cm:CanvasModel):Boolean {
+ if(!cm.isActiveView(this)) return false;
+
+ 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{
+ if(!cm.isActiveView(this)) return false;
+
+ if(a.isBranchingActivity()) {
+ Debugger.log("removing Branching Activity: " + a.title, Debugger.CRITICAL, "removeActivity", "CanvasView");
+ cm.clearAllBranches(a);
+ cm.activitiesDisplayed.get(a.activityUIID).branchView.removeMovieClip();
+ }
+
+ 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{
+ Debugger.log("drawing transition..." , Debugger.CRITICAL, "drawTransition", "CanvasVieW");
+ Debugger.log("not activity on layer 1: " + !isActivityOnLayer(cm.activitiesDisplayed.get(t.fromUIID), this.activityLayers) , Debugger.CRITICAL, "drawTransition", "CanvasVieW");
+ Debugger.log("not activity on layer 2: " + !isActivityOnLayer(cm.activitiesDisplayed.get(t.toUIID), this.activityLayers) , Debugger.CRITICAL, "drawTransition", "CanvasVieW");
+
+ if(!isActivityOnLayer(cm.activitiesDisplayed.get(t.fromUIID), this.activityLayers) && !isActivityOnLayer(cm.activitiesDisplayed.get(t.toUIID), this.activityLayers)) return false;
+
+ var cvv = CanvasView(this);
+ var cvc = getController();
+ var newTransition_mc:MovieClip = transitionLayer.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 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, cm:CanvasModel):Boolean{
+ if(!cm.isActiveView(this)) return false;
+
+ var cvv = CanvasView(this);
+ var cvc = getController();
+ var newTransition_mc:MovieClip = transitionLayer.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){
+ if(!cm.isActiveView(this)) return false;
+
+ var r = cm.transitionsDisplayed.remove(t.transitionUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+
+ return s;
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(cm:CanvasModel):Void{
+ 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);
+ transparentCover.setSize(newWidth, newHeight);
+
+ //Create the grid. The gris is re-drawn each time the canvas is resized.
+ var grid_mc = Grid.drawGrid(gridLayer, Math.round(newWidth), Math.round(newHeight), V_GAP, H_GAP);
+
+ //position bin in canvas.
+ var bin = cm.getCanvas().bin;
+ if(bin._parent == this) {
+ 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);
+ transparentCover.setStyle('styleName', styleObj);
+ }
+
+ /**
+ * 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 showReadOnly(b:Boolean){
+ isRread_only = b;
+ }
+
+ public function showEditOnFly(b:Boolean){
+ isRedit_on_fly = b;
+ }
+
+ public function get ddm():DesignDataModel {
+ return _cm.getCanvas().ddm;
+ }
+
+ public function get model():CanvasModel {
+ return _cm;
+ }
+
+ /**
+ * 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);
+ }
+
+ public function getScrollPaneVPosition():Number {
+ return canvas_scp.vPosition;
+ }
+
+ public function getScrollPaneHPosition():Number {
+ return canvas_scp.hPosition;
+ }
+
+ public function get scrollpane():MovieClip {
+ return canvas_scp;
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ICanvasActivity.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ICanvasActivity.as (.../ICanvasActivity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ICanvasActivity.as (.../ICanvasActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,53 +1,53 @@
-/***************************************************************************
- * 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;
-
- public function setSelected(isSelected);
-
+/***************************************************************************
+ * 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;
+
+ public function setSelected(isSelected);
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/PropertyInspector.as
===================================================================
diff -u -r327655a8d92f9ed44f5662c92704ade48ec4c1ed -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/PropertyInspector.as (.../PropertyInspector.as) (revision 327655a8d92f9ed44f5662c92704ade48ec4c1ed)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/PropertyInspector.as (.../PropertyInspector.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -21,7 +21,7 @@
* ************************************************************************
*/
-import org.lamsfoundation.lams.authoring.cv.*;
+import org.lamsfoundation.lams.authoring.cv.*;
import org.lamsfoundation.lams.authoring.cmpt.*;
import org.lamsfoundation.lams.authoring.br.BranchConnector;
import org.lamsfoundation.lams.authoring.*;
@@ -49,7 +49,7 @@
private var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
-
+
private static var MAX_TITLE_CHARS:Number = 60;
/**
@@ -74,16 +74,16 @@
_canvasModel.selectedItem = null;
_canvasModel.setPIHeight(piHeightHide);
_canvasModel.addEventListener('viewUpdate',this);
-
- for(var i=1; i<=10; i++)
- noSeqAct_cmb.addItem(i);
+
+ for(var i=1; i<=10; i++)
+ noSeqAct_cmb.addItem(i);
clickTarget_mc.onRelease = Proxy.create (this, localOnRelease);
clickTarget_mc.onReleaseOutside = Proxy.create (this, localOnReleaseOutside);
-
- // set character limit on title field
- title_txt.maxChars = MAX_TITLE_CHARS;
+ // set character limit on title field
+ title_txt.maxChars = MAX_TITLE_CHARS;
+
//set up handlers
title_txt.addEventListener("focusOut",this);
desc_txt.addEventListener("focusOut",this);
@@ -95,141 +95,141 @@
groupType_cmb.addEventListener("change", Delegate.create(this, onGroupTypeChange));
gateType_cmb.addEventListener("change", Delegate.create(this, gateTypeChange));
branchType_cmb.addEventListener("change", Delegate.create(this, onBranchTypeChange));
-
- toolActs_cmb.addEventListener("change", Delegate.create(this, onBranchToolInputChange));
+
+ toolActs_cmb.addEventListener("change", Delegate.create(this, onBranchToolInputChange));
appliedGroupingActivity_cmb.addEventListener("change", Delegate.create(this, onAppliedGroupingChange));
-
+
minAct_stp.addEventListener("change", Delegate.create(this, updateOptionalData));
minAct_stp.addEventListener("focusOut", Delegate.create(this, updateOptionalData));
maxAct_stp.addEventListener("change", Delegate.create(this, updateOptionalData));
- maxAct_stp.addEventListener("focusOut", Delegate.create(this, updateOptionalData));
-
- noSeqAct_cmb.addEventListener("change", Delegate.create(this, updateOptionalSequenceData));
+ maxAct_stp.addEventListener("focusOut", Delegate.create(this, updateOptionalData));
+ noSeqAct_cmb.addEventListener("change", Delegate.create(this, updateOptionalSequenceData));
+
days_stp.addEventListener("change", Delegate.create(this, onScheduleOffsetChange));
hours_stp.addEventListener("change", Delegate.create(this, onScheduleOffsetChange));
mins_stp.addEventListener("change", Delegate.create(this, onScheduleOffsetChange));
-
- days_stp.addEventListener("focusOut", Delegate.create(this, onScheduleOffsetChange));
+
+ days_stp.addEventListener("focusOut", Delegate.create(this, onScheduleOffsetChange));
hours_stp.addEventListener("focusOut", Delegate.create(this, onScheduleOffsetChange));
- mins_stp.addEventListener("focusOut", Delegate.create(this, onScheduleOffsetChange));
+ mins_stp.addEventListener("focusOut", Delegate.create(this, onScheduleOffsetChange));
- endHours_stp.addEventListener("change", 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));
+ 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));
numRandomGroups_stp.addEventListener("change", Delegate.create(this, updateGroupingMethodData));
numRandomGroups_stp.addEventListener("focusOut", Delegate.create(this, updateGroupingMethodData));
-
- equalGroupSizes_chk.addEventListener("click", Delegate.create(this, updateGroupingMethodData));
+ equalGroupSizes_chk.addEventListener("click", Delegate.create(this, updateGroupingMethodData));
+
_group_match_btn.addEventListener("click", Delegate.create(this, onGroupMatchClick));
- _group_naming_btn.addEventListener("click", Delegate.create(this, onGroupNamingClick));
- _map_competence_btn.addEventListener("click", Delegate.create(this, onMapCompetenceClick));
- _tool_output_match_btn.addEventListener("click", Delegate.create(this, onConditionMatchClick));
- _conditions_setup_btn.addEventListener("click", Delegate.create(this, onConditionsSetupClick));
-
- _define_monitor_cb.addEventListener("click", Delegate.create(this, onDefineMonitorSelect));
-
+ _group_naming_btn.addEventListener("click", Delegate.create(this, onGroupNamingClick));
+ _map_competence_btn.addEventListener("click", Delegate.create(this, onMapCompetenceClick));
+ _tool_output_match_btn.addEventListener("click", Delegate.create(this, onConditionMatchClick));
+ _conditions_setup_btn.addEventListener("click", Delegate.create(this, onConditionsSetupClick));
+
+ _define_monitor_cb.addEventListener("click", Delegate.create(this, onDefineMonitorSelect));
+
_pi_defaultBranch_cb.addEventListener("click", Delegate.create(this, onDefaultBranchSelect));
this.onEnterFrame = setupLabels;
- this.tabChildren = true;
+ this.tabChildren = true;
- setTabIndex();
+ setTabIndex();
hideAllSteppers(false);
- }
-
- private function gateTypeChange(evt:Object):Void {
- onGateTypeChange(evt);
- showGateActivityProperties(GateActivity(_canvasModel.selectedItem.activity));
}
-
- public function setupLabels(){
- toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+""
-
- gateType_lbl.text = Dictionary.getValue('trans_dlg_gatetypecmb');
- branchType_lbl.text = Dictionary.getValue("pi_branch_type");
- branchToolActs_lbl.text = Dictionary.getValue("pi_branch_tool_acts_lbl");
-
- 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');
- equalGroupSizes_lbl.text = "Equal group sizes";
- //equalGroupSizes_lbl = Dictionary.getValue('pi_equal_group_sizes');
- 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');
-
- noSeqAct_lbl.text = Dictionary.getValue('pi_no_seq_act');
-
- _group_match_btn.label = Dictionary.getValue('pi_group_matching_btn_lbl');
- _group_naming_btn.label = Dictionary.getValue('pi_group_naming_btn_lbl');
- _tool_output_match_btn.label = Dictionary.getValue('pi_tool_output_matching_btn_lbl');
- _conditions_setup_btn.label = Dictionary.getValue('pi_condmatch_btn_lbl');
-
- _define_monitor_cb.label = Dictionary.getValue('pi_define_monitor_cb_lbl');
-
- //TODO Internationalise
- _map_competence_btn.label = Dictionary.getValue('map_comptence_btn');
-
- // Branch
- _pi_defaultBranch_cb.label = Dictionary.getValue("pi_defaultBranch_cb_lbl");
-
- //populate the synch type combo:
- gateType_cmb.dataProvider = Activity.getGateActivityTypes();
- branchType_cmb.dataProvider = Activity.getBranchingActivityTypes();
- groupType_cmb.dataProvider = Grouping.getGroupingTypesDataProvider();
-
- //Call to apply style to all the labels and input fields
- setStyles();
- setButtonSizes();
-
- //fire event to say we have loaded
- delete this.onEnterFrame;
-
- //hide all the controls at startup
- delimitLine._visible = false;
- _group_match_btn.visible = false;
-
- hideAllSteppers(false);
-
- showGroupingControls(false);
- showGeneralControls(false);
- showOptionalControls(false);
- showToolActivityControls(false);
- showGateControls(false);
- showBranchingControls(false);
- showAppliedGroupingControls(false);
- showGeneralInfo(true);
-
- dispatchEvent({type:'load',target:this});
- }
+ private function gateTypeChange(evt:Object):Void {
+ onGateTypeChange(evt);
+ showGateActivityProperties(GateActivity(_canvasModel.selectedItem.activity));
+ }
+
+ public function setupLabels(){
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+""
+
+ gateType_lbl.text = Dictionary.getValue('trans_dlg_gatetypecmb');
+ branchType_lbl.text = Dictionary.getValue("pi_branch_type");
+ branchToolActs_lbl.text = Dictionary.getValue("pi_branch_tool_acts_lbl");
+
+ 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');
+ equalGroupSizes_lbl.text = "Equal group sizes";
+ //equalGroupSizes_lbl = Dictionary.getValue('pi_equal_group_sizes');
+ 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');
+
+ noSeqAct_lbl.text = Dictionary.getValue('pi_no_seq_act');
+
+ _group_match_btn.label = Dictionary.getValue('pi_group_matching_btn_lbl');
+ _group_naming_btn.label = Dictionary.getValue('pi_group_naming_btn_lbl');
+ _tool_output_match_btn.label = Dictionary.getValue('pi_tool_output_matching_btn_lbl');
+ _conditions_setup_btn.label = Dictionary.getValue('pi_condmatch_btn_lbl');
+
+ _define_monitor_cb.label = Dictionary.getValue('pi_define_monitor_cb_lbl');
+
+ //TODO Internationalise
+ _map_competence_btn.label = Dictionary.getValue('map_comptence_btn');
+
+ // Branch
+ _pi_defaultBranch_cb.label = Dictionary.getValue("pi_defaultBranch_cb_lbl");
+
+ //populate the synch type combo:
+ gateType_cmb.dataProvider = Activity.getGateActivityTypes();
+ branchType_cmb.dataProvider = Activity.getBranchingActivityTypes();
+ groupType_cmb.dataProvider = Grouping.getGroupingTypesDataProvider();
+
+ //Call to apply style to all the labels and input fields
+ setStyles();
+ setButtonSizes();
+
+ //fire event to say we have loaded
+ delete this.onEnterFrame;
+
+ //hide all the controls at startup
+ delimitLine._visible = false;
+ _group_match_btn.visible = false;
+
+ hideAllSteppers(false);
+
+ showGroupingControls(false);
+ showGeneralControls(false);
+ showOptionalControls(false);
+ showToolActivityControls(false);
+ showGateControls(false);
+ showBranchingControls(false);
+ showAppliedGroupingControls(false);
+ showGeneralInfo(true);
+
+ dispatchEvent({type:'load',target:this});
+ }
+
public function localOnRelease():Void{
if (_piIsExpended){
@@ -342,7 +342,7 @@
showBranchingActivityProperties(ba);
showAppliedGroupingProperties(ba);
- } else if(a.isGroupActivity()) {
+ } else if(a.isGroupActivity()) {
showGroupingControls(true, !a.readOnly);
showGeneralControls(true, !a.readOnly);
@@ -366,14 +366,14 @@
showBranchingControls(false);
showGeneralInfo(false);
showAppliedGroupingControls(false);
- checkEnableOptionalControls(!a.readOnly);
+ checkEnableOptionalControls(!a.readOnly);
//populateGroupingProperties(GroupingActivity(caco));
showAppliedGroupingProperties(caco);
showOptionalActivityProperties(caco);
} else if(a.isParallelActivity()) {
- var co = (cm.selectedItem instanceof CanvasParallelActivity) ? CanvasParallelActivity(cm.selectedItem) : CanvasActivity(cm.selectedItem);
- var cca:ComplexActivity = ComplexActivity(co.activity);
+ var co = (cm.selectedItem instanceof CanvasParallelActivity) ? CanvasParallelActivity(cm.selectedItem) : CanvasActivity(cm.selectedItem);
+ var cca:ComplexActivity = ComplexActivity(co.activity);
showOptionalControls(false);
showGeneralControls(true, !a.readOnly);
@@ -404,25 +404,25 @@
title_txt.text = StringUtils.cleanNull(a.title);
desc_txt.text = StringUtils.cleanNull(a.description);
-
- showBranchControls(false);
+ showBranchControls(false);
+
} else if(CanvasOptionalActivity(cm.selectedItem) != null){
var co = CanvasOptionalActivity(cm.selectedItem);
var cca:ComplexActivity = ComplexActivity(co.activity);
cover_pnl.visible = false;
delimitLine._visible = true;
- showGeneralControls(true, !co.activity.readOnly);
+ showGeneralControls(true, !co.activity.readOnly);
showBranchControls(false);
showGroupingControls(false);
showBranchingControls(false);
showToolActivityControls(false);
showGateControls(false);
showGeneralInfo(false);
showAppliedGroupingControls(false);
- checkEnableOptionalControls(!co.activity.readOnly);
+ checkEnableOptionalControls(!co.activity.readOnly);
populateGroupingProperties(GroupingActivity(cca));
showAppliedGroupingProperties(cca);
showOptionalActivityProperties(cca);
@@ -438,7 +438,7 @@
delimitLine._visible = true;
showOptionalControls(false);
- showGeneralControls(true, !co.activity.readOnly);
+ showGeneralControls(true, !co.activity.readOnly);
showBranchControls(false);
showGeneralInfo(false);
showGroupingControls(false);
@@ -453,28 +453,28 @@
showParallelActivityProperties(cca);
title_txt.text = StringUtils.cleanNull(cca.title);
- desc_txt.text = StringUtils.cleanNull(cca.description);
+ desc_txt.text = StringUtils.cleanNull(cca.description);
} else if(CanvasSequenceActivity(cm.selectedItem) != null) {
- var cs = CanvasSequenceActivity(cm.selectedItem);
- var sequenceActivity = SequenceActivity(cs.activity);
-
- cover_pnl.visible = false;
- delimitLine._visible = false;
-
- showSequenceProperties(sequenceActivity);
-
- showGeneralControls(true, !sequenceActivity.readOnly);
- showBranchControls(false);
-
- showGeneralInfo(false);
- showOptionalControls(false);
- showGroupingControls(false);
- showBranchingControls(false);
- showToolActivityControls(false);
- showGateControls(false);
- showAppliedGroupingControls(false);
-
+ var cs = CanvasSequenceActivity(cm.selectedItem);
+ var sequenceActivity = SequenceActivity(cs.activity);
+
+ cover_pnl.visible = false;
+ delimitLine._visible = false;
+
+ showSequenceProperties(sequenceActivity);
+
+ showGeneralControls(true, !sequenceActivity.readOnly);
+ showBranchControls(false);
+
+ showGeneralInfo(false);
+ showOptionalControls(false);
+ showGroupingControls(false);
+ showBranchingControls(false);
+ showToolActivityControls(false);
+ showGateControls(false);
+ showAppliedGroupingControls(false);
+
} else if(CanvasTransition(cm.selectedItem) != null) {
var ct = CanvasTransition(cm.selectedItem);
var t:Transition = ct.transition;
@@ -484,7 +484,7 @@
showTransitionProperties(t);
- showGeneralInfo(false);
+ showGeneralInfo(false);
showBranchControls(false);
showGeneralControls(false);
showOptionalControls(false);
@@ -504,7 +504,7 @@
showBranchProperties(branch);
showGeneralControls(true, !branch.sequenceActivity.readOnly);
- showBranchControls((Activity(cm.getCanvas().ddm.getActivityByUIID(branch.sequenceActivity.parentUIID)).activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE));
+ showBranchControls((Activity(cm.getCanvas().ddm.getActivityByUIID(branch.sequenceActivity.parentUIID)).activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE));
showGeneralInfo(false);
showOptionalControls(false);
@@ -520,7 +520,7 @@
toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" ";
- showGeneralInfo(true);
+ showGeneralInfo(true);
showBranchControls(false);
showGroupingControls(false);
showBranchingControls(false);
@@ -547,12 +547,12 @@
}
- private function showOptionalActivityProperties(ca:ComplexActivity){
- if(ca.isOptionsWithSequencesActivity()) showOptionalSequenceActivityProperties(ca);
+ private function showOptionalActivityProperties(ca:ComplexActivity){
+ if(ca.isOptionsWithSequencesActivity()) showOptionalSequenceActivityProperties(ca);
toolDisplayName_lbl.text = (!ca.isOptionsWithSequencesActivity()) ? ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_optional_title')
- : toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('opt_activity_seq_title');
-
+ : toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('opt_activity_seq_title');
+
runOffline_chk.selected = ca.runOffline;
defineLater_chk.selected = ca.defineLater;
@@ -566,95 +566,95 @@
maxAct_stp.value = 0;
} else {
maxAct_stp.value = ca.maxOptions;
- }
+ }
currentGrouping_lbl.text = "GroupingUIID:"+StringUtils.cleanNull(ca.runOffline.groupingUIID);
}
-
- private function showOptionalSequenceActivityProperties(ca:ComplexActivity){
- if(ca.noSequences == undefined)
- noSeqAct_cmb.selectedIndex = 0;
- else
- noSeqAct_cmb.selectedIndex = (ca.noSequences > 0) ? ca.noSequences - 1 : 0;
- }
+ private function showOptionalSequenceActivityProperties(ca:ComplexActivity){
+ if(ca.noSequences == undefined)
+ noSeqAct_cmb.selectedIndex = 0;
+ else
+ noSeqAct_cmb.selectedIndex = (ca.noSequences > 0) ? ca.noSequences - 1 : 0;
+ }
+
private function updateOptionalData(){
var oa = _canvasModel.selectedItem.activity;
var o = ComplexActivity(oa);
-
- if(minAct_stp.value > CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length)
- minAct_stp.value = CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length;
-
- if(maxAct_stp.value > CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length)
- maxAct_stp.value = CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length;
-
- if(minAct_stp.value > maxAct_stp.value)
- maxAct_stp.value = minAct_stp.value;
+ if(minAct_stp.value > CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length)
+ minAct_stp.value = CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length;
+
+ if(maxAct_stp.value > CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length)
+ maxAct_stp.value = CanvasOptionalActivity(_canvasModel.selectedItem).actChildren.length;
+
+ if(minAct_stp.value > maxAct_stp.value)
+ maxAct_stp.value = minAct_stp.value;
+
o.minOptions = minAct_stp.value;
o.maxOptions = maxAct_stp.value;
-
- var newChildren = _canvasModel.getCanvas().ddm.getComplexActivityChildren(oa.activityUIID);
+
+ var newChildren = _canvasModel.getCanvas().ddm.getComplexActivityChildren(oa.activityUIID);
CanvasOptionalActivity(_canvasModel.selectedItem).updateChildren(newChildren);
setModified();
- }
-
- private function updateOptionalSequenceData(){
- var controller = _canvasModel.activeView.getController();
- if(!controller.isBusy) {
- controller.setBusy()
-
- var oa = _canvasModel.selectedItem.activity;
- var o = ComplexActivity(oa);
-
- if(o.noSequences < noSeqAct_cmb.value) {
- addSequenceItems(oa, Number(noSeqAct_cmb.value - o.noSequences));
- } else {
- var itemsToRemove:Array = CanvasOptionalActivity(_canvasModel.selectedItem).getLastItems((o.noSequences - noSeqAct_cmb.value));
- removeSequenceItems(itemsToRemove);
- }
-
- }
- }
-
- private function removeSequenceItems(itemsToRemove:Array, overwrite:Boolean):Void {
- for(var i=0; i 0 && !overwrite) {
- LFMessage.showMessageConfirm(Dictionary.getValue('pi_optSequence_remove_msg'), Proxy.create(this, removeSequenceItems, itemsToRemove, true), Proxy.create(this, onUpdateOptionalSequenceData), null, null, Dictionary.getValue('pi_optSequence_remove_msg_title'));
- return;
- } else {
- _canvasModel.getCanvas().ddm.removeComplexActivity(itemsToRemove[i].activity.activityUIID, itemsToRemove[i].actChildren, true);
- }
- }
-
- this.onEnterFrame = onUpdateOptionalSequenceData;
- }
-
- private function addSequenceItems(oa:Activity, count:Number):Void {
- var o = ComplexActivity(oa);
-
- for(var i=0; i 0) ? newChildren.length - 1 : 0;
-
- _canvasModel.activeView.getController().clearBusy();
- _canvasModel.setDirty();
-
}
+ private function updateOptionalSequenceData(){
+ var controller = _canvasModel.activeView.getController();
+ if(!controller.isBusy) {
+ controller.setBusy()
+
+ var oa = _canvasModel.selectedItem.activity;
+ var o = ComplexActivity(oa);
+
+ if(o.noSequences < noSeqAct_cmb.value) {
+ addSequenceItems(oa, Number(noSeqAct_cmb.value - o.noSequences));
+ } else {
+ var itemsToRemove:Array = CanvasOptionalActivity(_canvasModel.selectedItem).getLastItems((o.noSequences - noSeqAct_cmb.value));
+ removeSequenceItems(itemsToRemove);
+ }
+
+ }
+ }
+
+ private function removeSequenceItems(itemsToRemove:Array, overwrite:Boolean):Void {
+ for(var i=0; i 0 && !overwrite) {
+ LFMessage.showMessageConfirm(Dictionary.getValue('pi_optSequence_remove_msg'), Proxy.create(this, removeSequenceItems, itemsToRemove, true), Proxy.create(this, onUpdateOptionalSequenceData), null, null, Dictionary.getValue('pi_optSequence_remove_msg_title'));
+ return;
+ } else {
+ _canvasModel.getCanvas().ddm.removeComplexActivity(itemsToRemove[i].activity.activityUIID, itemsToRemove[i].actChildren, true);
+ }
+ }
+
+ this.onEnterFrame = onUpdateOptionalSequenceData;
+ }
+
+ private function addSequenceItems(oa:Activity, count:Number):Void {
+ var o = ComplexActivity(oa);
+
+ for(var i=0; i 0) ? newChildren.length - 1 : 0;
+
+ _canvasModel.activeView.getController().clearBusy();
+ _canvasModel.setDirty();
+
+ }
+
private function showParallelActivityProperties(ca:ComplexActivity){
toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_parallel_title');
runOffline_chk.selected = ca.runOffline;
@@ -671,28 +671,28 @@
if(_canvasModel.selectedItem.activity.activityTypeID == gateType_cmb.dataProvider[i].data){
gateType_cmb.selectedIndex=i;
}
- }
-
- if(_canvasModel.selectedItem.activity.activityTypeID == Activity.SCHEDULE_GATE_ACTIVITY_TYPE) {
- var offset:Number = GateActivity(_canvasModel.selectedItem.activity).gateStartTimeOffset;
-
- Debugger.log("offset: " + offset, Debugger.CRITICAL, "showGateActivityProperties", "PropertyInspector");
-
- if(offset > 0) {
- var rem_days = offset%1440;
- var rem_hours = rem_days%60;
- var rem_mins = rem_hours
-
- days_stp.value = Math.floor((offset-rem_days)/1440);
- hours_stp.value = Math.floor((rem_days-rem_hours)/60);
- mins_stp.value = rem_mins;
-
- } else {
- days_stp.value = 0;
- hours_stp.value = 0;
- mins_stp.value = 0;
- }
}
+
+ if(_canvasModel.selectedItem.activity.activityTypeID == Activity.SCHEDULE_GATE_ACTIVITY_TYPE) {
+ var offset:Number = GateActivity(_canvasModel.selectedItem.activity).gateStartTimeOffset;
+
+ Debugger.log("offset: " + offset, Debugger.CRITICAL, "showGateActivityProperties", "PropertyInspector");
+
+ if(offset > 0) {
+ var rem_days = offset%1440;
+ var rem_hours = rem_days%60;
+ var rem_mins = rem_hours
+
+ days_stp.value = Math.floor((offset-rem_days)/1440);
+ hours_stp.value = Math.floor((rem_days-rem_hours)/60);
+ mins_stp.value = rem_mins;
+
+ } else {
+ days_stp.value = 0;
+ hours_stp.value = 0;
+ mins_stp.value = 0;
+ }
+ }
}
@@ -704,50 +704,50 @@
if(_canvasModel.selectedItem.activity.activityTypeID == branchType_cmb.dataProvider[i].data){
branchType_cmb.selectedIndex=i;
}
- }
-
- if(_canvasModel.getCanvas().ddm.editOverrideLock && _canvasModel.selectedItem.activity.activityID != null) {
- branchType_cmb.enabled = false;
}
+ if(_canvasModel.getCanvas().ddm.editOverrideLock && _canvasModel.selectedItem.activity.activityID != null) {
+ branchType_cmb.enabled = false;
+ }
+
if(_canvasModel.selectedItem.activity.activityTypeID == Activity.GROUP_BRANCHING_ACTIVITY_TYPE) {
showAppliedGroupingControls(true, !ba.readOnly);
showGroupBasedBranchingControls(true, !ba.readOnly);
- } else if(_canvasModel.selectedItem.activity.activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE) {
- if(toolActs_cmb.selectedIndex == 0) {
- _canvasModel.selectedItem.activity.toolActivityUIID = null;
- branchToolInputChange(_canvasModel.selectedItem, toolActs_cmb.dataProvider[0].data);
- }
+ } else if(_canvasModel.selectedItem.activity.activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE) {
+ if(toolActs_cmb.selectedIndex == 0) {
+ _canvasModel.selectedItem.activity.toolActivityUIID = null;
+ branchToolInputChange(_canvasModel.selectedItem, toolActs_cmb.dataProvider[0].data);
+ }
}
}
- private function showTransitionProperties(t:Transition){}
-
- private function showBranchControls(v:Boolean):Void {
- _pi_defaultBranch_cb.visible = v;
+ private function showTransitionProperties(t:Transition){}
+
+ private function showBranchControls(v:Boolean):Void {
+ _pi_defaultBranch_cb.visible = v;
}
private function showBranchProperties(b:Branch){
- Debugger.log("branch sequence: " + b.sequenceActivity.activityUIID, Debugger.CRITICAL, "showBranchProperties", "PropertyInspector");
-
+ Debugger.log("branch sequence: " + b.sequenceActivity.activityUIID, Debugger.CRITICAL, "showBranchProperties", "PropertyInspector");
+
toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_activity_type_sequence', [Dictionary.getValue('branch_btn')]);
- title_txt.text = b.sequenceActivity.title;
+ title_txt.text = b.sequenceActivity.title;
- _pi_defaultBranch_cb.selected = (b.sequenceActivity.activityUIID == _canvasModel.activeView.activity.defaultBranch.sequenceActivity.activityUIID) ? true : false;
+ _pi_defaultBranch_cb.selected = (b.sequenceActivity.activityUIID == _canvasModel.activeView.activity.defaultBranch.sequenceActivity.activityUIID) ? true : false;
_pi_defaultBranch_cb.enabled = !_pi_defaultBranch_cb.selected;
- }
-
- private function showSequenceProperties(s:SequenceActivity) {
- toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_activity_type_sequence', [Dictionary.getValue('optional_btn')]);
- title_txt.text = s.title;
}
+ private function showSequenceProperties(s:SequenceActivity) {
+ toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_activity_type_sequence', [Dictionary.getValue('optional_btn')]);
+ title_txt.text = s.title;
+ }
+
/**
* Shows which grouping activity is applied to this activity,
* if you click the edit button, the the activity is selected,
* and therefore the Grouping obeject properties
- * are shown in the PropertyInspector.
+ * are shown in the PropertyInspector.
*
* @usage
* @param a The selected Activity
@@ -764,7 +764,7 @@
var dp = appliedGroupingActivity_cmb.dataProvider;
Debugger.log('dp:'+dp.toString(),Debugger.GEN,'showAppliedGroupingProperties','PropertyInspector');
appliedGroupingActivity_cmb.selectedIndex = 0;
-
+
for(var i=0; ig.groupingTypeID: "+g.groupingTypeID, Debugger.GEN, "showRelevantGroupOptions", "PIC*");
+ Debugger.log("showRelevantGroupOptions->g.groupingTypeID: "+g.groupingTypeID, Debugger.GEN, "showRelevantGroupOptions", "PIC*");
+
if(g.groupingTypeID == Grouping.CHOSEN_GROUPING){
numGroups_lbl.visible = true;
- numLearners_lbl.visible = false;
- equalGroupSizes_lbl.visible = false;
+ numLearners_lbl.visible = false;
+ equalGroupSizes_lbl.visible = false;
equalGroupSizes_chk.visible = false;
numGroups_stp.visible = true;
numRandomGroups_stp.visible = false;
@@ -531,42 +531,42 @@
if(e != null) {
numGroups_lbl.enabled = e;
- _group_naming_btn.enabled = e;
- }
- }
- else if(g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING){
- numGroups_lbl.visible = true;
- numLearners_lbl.visible = true;
- equalGroupSizes_lbl.visible = true;
- equalGroupSizes_chk.visible = true;
- numRandomGroups_stp.visible = false;
- numGroups_stp.visible = true;
- numLearners_stp.visible = true;
- numLearners_rdo.visible = true;
- numGroups_rdo.visible = true;
-
- _group_naming_btn.visible = true;
-
- if(e != null) {
- numGroups_lbl.enabled = e;
- numLearners_lbl.enabled = e;
- equalGroupSizes_lbl.enabled = e;
- //numGroups_stp.enabled = e;
- //numLearners_stp.enabled = e;
- numLearners_rdo.enabled = e;
- numGroups_rdo.enabled = e;
- equalGroupSizes_chk.enabled = e;
-
- _group_naming_btn.enabled = e;
- }
-
- checkGroupRadioOptions(e);
+ _group_naming_btn.enabled = e;
+ }
+ }
+ else if(g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING){
+ numGroups_lbl.visible = true;
+ numLearners_lbl.visible = true;
+ equalGroupSizes_lbl.visible = true;
+ equalGroupSizes_chk.visible = true;
+ numRandomGroups_stp.visible = false;
+ numGroups_stp.visible = true;
+ numLearners_stp.visible = true;
+ numLearners_rdo.visible = true;
+ numGroups_rdo.visible = true;
+
+ _group_naming_btn.visible = true;
+
+ if(e != null) {
+ numGroups_lbl.enabled = e;
+ numLearners_lbl.enabled = e;
+ equalGroupSizes_lbl.enabled = e;
+ //numGroups_stp.enabled = e;
+ //numLearners_stp.enabled = e;
+ numLearners_rdo.enabled = e;
+ numGroups_rdo.enabled = e;
+ equalGroupSizes_chk.enabled = e;
+
+ _group_naming_btn.enabled = e;
+ }
+
+ checkGroupRadioOptions(e);
checkEnableGroupsOptions(e);
- }
+ }
else if(g.groupingTypeID == Grouping.RANDOM_GROUPING) {
numGroups_lbl.visible = true;
- numLearners_lbl.visible = true;
- equalGroupSizes_lbl.visible = false;
+ numLearners_lbl.visible = true;
+ equalGroupSizes_lbl.visible = false;
equalGroupSizes_chk.visible = false;
numGroups_stp.visible = false;
numRandomGroups_stp.visible = true;
@@ -585,9 +585,9 @@
numLearners_rdo.enabled = e;
numGroups_rdo.enabled = e;
- _group_naming_btn.enabled = e;
+ _group_naming_btn.enabled = e;
}
-
+
checkGroupRadioOptions(e);
checkEnableGroupsOptions(e);
@@ -599,17 +599,17 @@
private function reDrawTroublesomeSteppers(e:Boolean){
numLearners_stp.visible = true;
-
- var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
-
- if (g.groupingTypeID == Grouping.RANDOM_GROUPING) {
- numRandomGroups_stp.visible = true;
- numGroups_stp.visible = false;
- }
- else if (g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING) {
- numRandomGroups_stp.visible = false;
- numGroups_stp.visible = true;
+
+ var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
+
+ if (g.groupingTypeID == Grouping.RANDOM_GROUPING) {
+ numRandomGroups_stp.visible = true;
+ numGroups_stp.visible = false;
}
+ else if (g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING) {
+ numRandomGroups_stp.visible = false;
+ numGroups_stp.visible = true;
+ }
}
private function checkEnableGateControls(e:Boolean){
@@ -625,7 +625,7 @@
hours_stp.enabled = true;
mins_stp.enabled = true;
endHours_stp.enabled = true;
- endMins_stp.enabled = true;
+ endMins_stp.enabled = true;
}
}
@@ -644,163 +644,163 @@
* @return
*/
private function checkEnableGroupsOptions(e:Boolean){
- var groupingBy = rndGroup_radio.selection.data;
+ var groupingBy = rndGroup_radio.selection.data;
Debugger.log('groupingBy:'+groupingBy,Debugger.GEN,'checkEnableGroupsOptions','PropertyInspector');
- var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
-
+ var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
+
if(groupingBy == 'num_learners'){
- numRandomGroups_stp.value = 0;
- numGroups_stp.value = 0;
- g.numberOfGroups = 0;
- g.equalGroupSizes = null;
- equalGroupSizes_chk.selected = false;
-
- numRandomGroups_stp.enabled = false;
- numGroups_stp.enabled = false;
+ numRandomGroups_stp.value = 0;
+ numGroups_stp.value = 0;
+ g.numberOfGroups = 0;
+ g.equalGroupSizes = null;
+ equalGroupSizes_chk.selected = false;
- numLearners_stp.enabled = (e != null) ? e : true;
-
- equalGroupSizes_lbl.visible = false;
+ numRandomGroups_stp.enabled = false;
+ numGroups_stp.enabled = false;
+
+ numLearners_stp.enabled = (e != null) ? e : true;
+
+ equalGroupSizes_lbl.visible = false;
equalGroupSizes_chk.visible = false;
- _group_naming_btn.visible = false;
+ _group_naming_btn.visible = false;
}else{
- numRandomGroups_stp.enabled = (e != null) ? e : true;
- numGroups_stp.enabled = (e != null) ? e : true;
+ numRandomGroups_stp.enabled = (e != null) ? e : true;
+ numGroups_stp.enabled = (e != null) ? e : true;
- numLearners_stp.value = 0;
- g.learnersPerGroups = 0;
+ numLearners_stp.value = 0;
+ g.learnersPerGroups = 0;
- numLearners_stp.enabled = false;
+ numLearners_stp.enabled = false;
- _group_naming_btn.enabled = (e != null) ? e : true;
- _group_naming_btn.visible = true;
-
- if (g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING) {
- equalGroupSizes_chk.enabled = (e != null) ? e : true;
- equalGroupSizes_lbl.visible = true;
- equalGroupSizes_chk.visible = true;
+ _group_naming_btn.enabled = (e != null) ? e : true;
+ _group_naming_btn.visible = true;
+
+ if (g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING) {
+ equalGroupSizes_chk.enabled = (e != null) ? e : true;
+ equalGroupSizes_lbl.visible = true;
+ equalGroupSizes_chk.visible = true;
}
}
//this is a crazy hack to stop the steppter dissapearing after its .enabled property is set.
//waits 2 frames to re-display the control ( 1 doensnt work!)
MovieClipUtils.doLater(Proxy.create(this,reDrawTroublesomeSteppersLater));
- }
-
- private function checkGroupRadioOptions(e:Boolean) {
- var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
-
- if(g.numberOfGroups > 0 && g.learnersPerGroups <= 0) {
- numGroups_rdo.selected = true;
- _group_naming_btn.visible = true;
- _group_naming_btn.enabled = (e != null) ? e : true;
-
- equalGroupSizes_lbl.visible = false;
+ }
+
+ private function checkGroupRadioOptions(e:Boolean) {
+ var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
+
+ if(g.numberOfGroups > 0 && g.learnersPerGroups <= 0) {
+ numGroups_rdo.selected = true;
+ _group_naming_btn.visible = true;
+ _group_naming_btn.enabled = (e != null) ? e : true;
+
+ equalGroupSizes_lbl.visible = false;
equalGroupSizes_chk.visible = false;
-
- } else if(g.learnersPerGroups > 0 && g.numberOfGroups <= 0) {
- numLearners_rdo.selected = true;
- _group_naming_btn.visible = false;
-
- if (g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING) {
- equalGroupSizes_lbl.visible = true;
- equalGroupSizes_chk.visible = true;
- }
- }
- else { // this is the case where both the steppers have 0 values
- Debugger.log("checkGroupRadioOptions else", Debugger.GEN, "checkGroupRadioOptions", "PIC*");
- numGroups_rdo.selected = true;
- _group_naming_btn.visible = false;
- }
- }
+
+ } else if(g.learnersPerGroups > 0 && g.numberOfGroups <= 0) {
+ numLearners_rdo.selected = true;
+ _group_naming_btn.visible = false;
+
+ if (g.groupingTypeID == Grouping.LEARNER_CHOICE_GROUPING) {
+ equalGroupSizes_lbl.visible = true;
+ equalGroupSizes_chk.visible = true;
+ }
+ }
+ else { // this is the case where both the steppers have 0 values
+ Debugger.log("checkGroupRadioOptions else", Debugger.GEN, "checkGroupRadioOptions", "PIC*");
+ numGroups_rdo.selected = true;
+ _group_naming_btn.visible = false;
+ }
+ }
public function reDrawTroublesomeSteppersLater(){
MovieClipUtils.doLater(Proxy.create(this,reDrawTroublesomeSteppers));
- }
-
- private function populateGroupingProperties(ga:GroupingActivity){
- Debugger.log("populating Grouping Properties createGroupingUIID: " + ga.createGroupingUIID, Debugger.CRITICAL, "populateGroupingProperties", "PropertyInspectorControls");
-
- var g:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(ga.createGroupingUIID);
- toolDisplayName_lbl.text = ""+Dictionary.getValue('pi_title')+" - "+Dictionary.getValue('pi_activity_type_grouping');
-
- Debugger.log('This is the grouping object:',Debugger.GEN,'populateGroupingProperties','PropertyInspectorControls');
- ObjectUtils.printObject(g);
-
- //loop through combo to fins SI of our gate activity type
- for (var i=0; i - "+Dictionary.getValue('pi_activity_type_grouping');
+
+ Debugger.log('This is the grouping object:',Debugger.GEN,'populateGroupingProperties','PropertyInspectorControls');
+ ObjectUtils.printObject(g);
+
+ //loop through combo to fins SI of our gate activity type
+ for (var i=0; i 0)
- _canvasModel.selectedItem.activity.defineLater = true;
-
- _define_monitor_cb.selected = _canvasModel.selectedItem.activity.defineLater;
-
- _group_match_btn.visible = ((grouping.numberOfGroups > 0 || grouping.maxNumberOfGroups > 0) && !_define_monitor_cb.selected) ? v : false;
- _define_monitor_cb.visible = (grouping.numberOfGroups > 0 || grouping.maxNumberOfGroups > 0 || grouping.learnersPerGroups > 0) ? v : false;
-
- if(e != null && !e) {
- _group_match_btn.enabled = e;
- _define_monitor_cb.enabled = (grouping.learnersPerGroups > 0) ? false : e;
- } else {
- _define_monitor_cb.enabled = (grouping.learnersPerGroups > 0) ? false : true;
- }
-
- }
+
+ if(e != null) {
+ toolActs_cmb.enabled = e;
+ _tool_output_match_btn.enabled = e;
+ _conditions_setup_btn.enabled = e;
+ }
}
+ private function showGroupBasedBranchingControls(v:Boolean, e:Boolean) {
+ if(!v) {
+ _group_match_btn.visible = false;
+ _define_monitor_cb.visible = false;
+
+ return;
+ }
+
+ var ca = _canvasModel.selectedItem;
+ var sequences:Array = _canvasModel.getCanvas().ddm.getComplexActivityChildren(ca.activity.activityUIID);
+
+ if(hasConnectedSequences(sequences) && ca.activity.groupingUIID != null) {
+ var grouping:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(ca.activity.groupingUIID);
+
+ if(grouping.learnersPerGroups > 0)
+ _canvasModel.selectedItem.activity.defineLater = true;
+
+ _define_monitor_cb.selected = _canvasModel.selectedItem.activity.defineLater;
+
+ _group_match_btn.visible = ((grouping.numberOfGroups > 0 || grouping.maxNumberOfGroups > 0) && !_define_monitor_cb.selected) ? v : false;
+ _define_monitor_cb.visible = (grouping.numberOfGroups > 0 || grouping.maxNumberOfGroups > 0 || grouping.learnersPerGroups > 0) ? v : false;
+
+ if(e != null && !e) {
+ _group_match_btn.enabled = e;
+ _define_monitor_cb.enabled = (grouping.learnersPerGroups > 0) ? false : e;
+ } else {
+ _define_monitor_cb.enabled = (grouping.learnersPerGroups > 0) ? false : true;
+ }
+
+ }
+ }
+
/**
* Handles click event from the grouping method radio buttons
* @usage
* @param evt
* @return
*/
private function onGroupingMethodChange(evt:Object){
- checkEnableGroupsOptions(!_canvasModel.selectedItem.activity.readOnly);
+ checkEnableGroupsOptions(!_canvasModel.selectedItem.activity.readOnly);
setModified();
}
@@ -1169,10 +1169,10 @@
var startOffsetMins:Number = (days_stp.value * 60 * 24) + (hours_stp.value * 60) + mins_stp.value;
GateActivity(_canvasModel.selectedItem.activity).gateStartTimeOffset = startOffsetMins;
-
+
var endOffsetMins:Number = (endHours_stp.value * 60) + endMins_stp.value;
GateActivity(_canvasModel.selectedItem.activity).gateEndTimeOffset = endOffsetMins;
-
+
Debugger.log('activity.gateStartTimeOffset :'+GateActivity(_canvasModel.selectedItem.activity).gateStartTimeOffset ,Debugger.GEN,'onScheduleOffsetChange','PropertyInspector');
Debugger.log('activity.gateEndTimeOffset :'+GateActivity(_canvasModel.selectedItem.activity).gateEndTimeOffset,Debugger.GEN,'onScheduleOffsetChange','PropertyInspector');
@@ -1186,135 +1186,135 @@
_app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:Dictionary.getValue('groupmatch_dlg_title_lbl'), closeButton:true, resize:false, scrollContentPath:'GroupMatchingDialog'});
_app.dialog.addEventListener('contentLoaded', Delegate.create(this, groupMatchDialogLoaded));
- setModified();
+ setModified();
}
private function onGroupNamingClick(evt:Object){
// open group to branch matching window
_app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:Dictionary.getValue('groupnaming_dlg_title_lbl'), closeButton:true, resize:false, scrollContentPath:'GroupNamingDialog'});
- _app.dialog.addEventListener('contentLoaded', Delegate.create(this, GroupNamingDialogLoaded));
+ _app.dialog.addEventListener('contentLoaded', Delegate.create(this, GroupNamingDialogLoaded));
setModified();
- }
-
- private function onMapCompetenceClick(evt:Object){
- // open group to competence mapping window
- _app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:Dictionary.getValue("competence_mappings_btn"), closeButton:true, resize:false, scrollContentPath:'CompetenceMappingDialog'});
- }
-
- public function openConditionMatchDialog():Void {
- onConditionMatchClick();
- }
-
- private function onConditionMatchClick(evt:Object){
- // open group to branch matching window
- _app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:Dictionary.getValue('condmatch_dlg_title_lbl'), closeButton:true, resize:false, scrollContentPath:'ConditionMatchingDialog'});
- _app.dialog.addEventListener('contentLoaded', Delegate.create(this, ConditionMatchDialogLoaded));
-
- setModified();
- }
-
- private function onConditionsSetupClick(evt:Object){
- // show tool outputs to branch mappings dialog
- var ta:ToolActivity = ToolActivity(_canvasModel.getCanvas().ddm.getActivityByUIID(_canvasModel.selectedItem.activity.toolActivityUIID));
- _canvasModel.getCanvas().getToolOutputDefinitions(ta);
-
- setModified();
- }
+ }
+ private function onMapCompetenceClick(evt:Object){
+ // open group to competence mapping window
+ _app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:Dictionary.getValue("competence_mappings_btn"), closeButton:true, resize:false, scrollContentPath:'CompetenceMappingDialog'});
+ }
+
+ public function openConditionMatchDialog():Void {
+ onConditionMatchClick();
+ }
+
+ private function onConditionMatchClick(evt:Object){
+ // open group to branch matching window
+ _app.dialog = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:Dictionary.getValue('condmatch_dlg_title_lbl'), closeButton:true, resize:false, scrollContentPath:'ConditionMatchingDialog'});
+ _app.dialog.addEventListener('contentLoaded', Delegate.create(this, ConditionMatchDialogLoaded));
+
+ setModified();
+ }
+
+ private function onConditionsSetupClick(evt:Object){
+ // show tool outputs to branch mappings dialog
+ var ta:ToolActivity = ToolActivity(_canvasModel.getCanvas().ddm.getActivityByUIID(_canvasModel.selectedItem.activity.toolActivityUIID));
+ _canvasModel.getCanvas().getToolOutputDefinitions(ta);
+
+ setModified();
+ }
+
private function groupMatchDialogLoaded(evt:Object) {
var grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.groupingUIID);
-
+
evt.target.scrollContent.branchingActivity = BranchingActivity(_canvasModel.selectedItem.activity);
- evt.target.scrollContent.groups = grouping.getGroups(_canvasModel.getCanvas().ddm);
+ evt.target.scrollContent.groups = grouping.getGroups(_canvasModel.getCanvas().ddm);
evt.target.scrollContent.sequences = getValidSequences(_canvasModel.getCanvas().ddm.getComplexActivityChildren(_canvasModel.selectedItem.activity.activityUIID));
evt.target.scrollContent.loadLists();
-
+
}
private function GroupNamingDialogLoaded(evt:Object) {
var grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.createGroupingUIID);
Debugger.log("grouping: " + grouping, Debugger.CRITICAL, "GroupNamingDialogLoaded", "PropertyInspectorControls");
-
+
evt.target.scrollContent.grouping = grouping;
evt.target.scrollContent.groups = grouping.getGroups(_canvasModel.getCanvas().ddm);
- evt.target.scrollContent.setupGrid();
- }
-
- private function ConditionMatchDialogLoaded(evt:Object) {
- var conditions:Array = _canvasModel.getCanvas().ddm.getAllConditionsForToolOutput(BranchingActivity(_canvasModel.selectedItem.activity));
-
- evt.target.scrollContent.branchingActivity = BranchingActivity(_canvasModel.selectedItem.activity);
- evt.target.scrollContent.conditions = conditions;
- evt.target.scrollContent.sequences = getValidSequences(_canvasModel.getCanvas().ddm.getComplexActivityChildren(_canvasModel.selectedItem.activity.activityUIID));
- evt.target.scrollContent.loadLists();
+ evt.target.scrollContent.setupGrid();
}
-
- /**
- * @depricated
- *
- * @usage
- * @param branches
- * @return
+
+ private function ConditionMatchDialogLoaded(evt:Object) {
+ var conditions:Array = _canvasModel.getCanvas().ddm.getAllConditionsForToolOutput(BranchingActivity(_canvasModel.selectedItem.activity));
+
+ evt.target.scrollContent.branchingActivity = BranchingActivity(_canvasModel.selectedItem.activity);
+ evt.target.scrollContent.conditions = conditions;
+ evt.target.scrollContent.sequences = getValidSequences(_canvasModel.getCanvas().ddm.getComplexActivityChildren(_canvasModel.selectedItem.activity.activityUIID));
+ evt.target.scrollContent.loadLists();
+ }
+
+ /**
+ * @depricated
+ *
+ * @usage
+ * @param branches
+ * @return
*
private function getValidBranches(branches:Array):Array {
- Debugger.log("validating br len: " + branches.length, Debugger.CRITICAL, "getvalidbranches", "PIC*");
-
- for(var i=0; i < branches.length; i++) {
+ Debugger.log("validating br len: " + branches.length, Debugger.CRITICAL, "getvalidbranches", "PIC*");
+
+ for(var i=0; i < branches.length; i++) {
Debugger.log("validating br: " + branches[i].sequenceActivity.title, Debugger.CRITICAL, "getvalidbranches", "PIC*");
- Debugger.log("validating br dir: " + branches[i].direction, Debugger.CRITICAL, "getvalidbranches", "PIC*");
-
+ Debugger.log("validating br dir: " + branches[i].direction, Debugger.CRITICAL, "getvalidbranches", "PIC*");
+
if(branches[i].direction != BranchConnector.DIR_FROM_START && branches[i].direction != BranchConnector.DIR_SINGLE) {
- branches.splice(i, 1);
- i=i-1;
- }
+ branches.splice(i, 1);
+ i=i-1;
+ }
}
- return branches;
- }
- */
-
- private function getValidSequences(seqs:Array):Array {
- for(var i=0; i < seqs.length; i++) {
- var sequence:SequenceActivity = SequenceActivity(seqs[i]);
-
- if(sequence.isDefault && sequence.empty) {
- seqs.splice(i, 1);
- i=i-1;
- } else if(!sequence.empty && sequence.firstActivityUIID == null) {
- seqs.splice(i, 1);
- i=i-1;
- }
- }
-
- return seqs;
- }
-
- public function onDefaultBranchSelect(evt:Object):Void {
- if(_pi_defaultBranch_cb.selected) {
- _canvasModel.activeView.activity.defaultBranch = BranchConnector(_canvasModel.selectedItem).branch;
- _pi_defaultBranch_cb.enabled = false;
- }
-
- setModified();
- }
-
- public function onDefineMonitorSelect(evt:Object):Void {
-
- _canvasModel.selectedItem.activity.defineLater = _define_monitor_cb.selected;
-
- var grouping:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.groupingUIID);
- _group_match_btn.visible = ((grouping.numberOfGroups > 0 || grouping.maxNumberOfGroups > 0) && !_define_monitor_cb.selected) ? true : false;
-
- if(_define_monitor_cb.selected) {
- _canvasModel.getCanvas().ddm.clearBranchMappingsByGroupingUIID(grouping.groupingUIID);
- }
-
- setModified();
+ return branches;
}
-
+ */
+
+ private function getValidSequences(seqs:Array):Array {
+ for(var i=0; i < seqs.length; i++) {
+ var sequence:SequenceActivity = SequenceActivity(seqs[i]);
+
+ if(sequence.isDefault && sequence.empty) {
+ seqs.splice(i, 1);
+ i=i-1;
+ } else if(!sequence.empty && sequence.firstActivityUIID == null) {
+ seqs.splice(i, 1);
+ i=i-1;
+ }
+ }
+
+ return seqs;
+ }
+
+ public function onDefaultBranchSelect(evt:Object):Void {
+ if(_pi_defaultBranch_cb.selected) {
+ _canvasModel.activeView.activity.defaultBranch = BranchConnector(_canvasModel.selectedItem).branch;
+ _pi_defaultBranch_cb.enabled = false;
+ }
+
+ setModified();
+ }
+
+ public function onDefineMonitorSelect(evt:Object):Void {
+
+ _canvasModel.selectedItem.activity.defineLater = _define_monitor_cb.selected;
+
+ var grouping:Grouping = _canvasModel.getCanvas().ddm.getGroupingByUIID(_canvasModel.selectedItem.activity.groupingUIID);
+ _group_match_btn.visible = ((grouping.numberOfGroups > 0 || grouping.maxNumberOfGroups > 0) && !_define_monitor_cb.selected) ? true : false;
+
+ if(_define_monitor_cb.selected) {
+ _canvasModel.getCanvas().ddm.clearBranchMappingsByGroupingUIID(grouping.groupingUIID);
+ }
+
+ setModified();
+ }
+
/**
* Recieves the click events from the canvas views (inc Property Inspector) buttons. Based on the target
* the relevent method is called to action the user request
@@ -1323,7 +1323,7 @@
/**/
public function click(e):Void{
var tgt:String = new String(e.target);
-
+
if(tgt.indexOf("defineLater_chk") != -1){
_canvasModel.selectedItem.activity.defineLater = defineLater_chk.selected;
@@ -1352,20 +1352,20 @@
} else if(tgt.indexOf("desc_txt") != -1){
_canvasModel.selectedItem.activity.description = desc_txt.text;
}
-
+
_canvasModel.selectedItem.refresh();
-
- if (_canvasModel.selectedItem.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE) {
- _canvasModel.selectedItem.init();
- } else if (_canvasModel.selectedItem.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || _canvasModel.selectedItem.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE) {
- //_canvasModel.selectedItem.updateChildren();
- } else if(_canvasModel.selectedItem instanceof BranchConnector) {
- if(_canvasModel.selectedItem.branch.isEnd)
- _canvasModel.branchesDisplayed.get(_canvasModel.getCanvas().ddm.getBranchesForActivityUIID(SequenceActivity(_canvasModel.selectedItem.branch.sequenceActivity).firstActivityUIID).target.branchUIID).updateBranchLabel();
- else
- _canvasModel.selectedItem.updateBranchLabel();
- }
+ if (_canvasModel.selectedItem.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE) {
+ _canvasModel.selectedItem.init();
+ } else if (_canvasModel.selectedItem.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE || _canvasModel.selectedItem.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE) {
+ //_canvasModel.selectedItem.updateChildren();
+ } else if(_canvasModel.selectedItem instanceof BranchConnector) {
+ if(_canvasModel.selectedItem.branch.isEnd)
+ _canvasModel.branchesDisplayed.get(_canvasModel.getCanvas().ddm.getBranchesForActivityUIID(SequenceActivity(_canvasModel.selectedItem.branch.sequenceActivity).firstActivityUIID).target.branchUIID).updateBranchLabel();
+ else
+ _canvasModel.selectedItem.updateBranchLabel();
+ }
+
setModified();
}
@@ -1379,7 +1379,7 @@
_canvasModel.getCanvas().ddm.validDesign = false;
_canvasModel.getCanvas().checkValidDesign();
- ApplicationParent.extCall("setSaved", "false");
+ ApplicationParent.extCall("setSaved", "false");
}
private function moveItem(item:Object, xDiff:Number, yDiff:Number) {
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/SaveConfirmDialog.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/SaveConfirmDialog.as (.../SaveConfirmDialog.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/SaveConfirmDialog.as (.../SaveConfirmDialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -42,15 +42,15 @@
*/
class org.lamsfoundation.lams.authoring.cv.SaveConfirmDialog extends MovieClip {
- private static var MARGIN:Number = 5;
+ private static var MARGIN:Number = 5;
private static var SPACING:Number = 30;
private var _canvasModel:CanvasModel;
private var _canvasController:CanvasController;
private var _msg:String;
- private var _requestSrc:String;
-
- private var btnOffset_X:Number = 10;
- private var btnOffset_Y:Number = 5;
+ private var _requestSrc:String;
+
+ private var btnOffset_X:Number = 10;
+ private var btnOffset_Y:Number = 5;
private var _btnArray:Array;
//References to components + clips
@@ -102,56 +102,56 @@
//set up handlers
okBtn.addEventListener("click",this);
retBtn.addEventListener("click",this);
-
- msgBox.text = _msg;
-
- stpButtons();
- okBtn.setFocus();
-
- _container._parent.hScrollPolicy = "no";
- _container.resize = false;
-
- setSize(this._width, this._height);
+
+ msgBox.text = _msg;
+
+ stpButtons();
+ okBtn.setFocus();
+
+ _container._parent.hScrollPolicy = "no";
+ _container.resize = false;
+
+ setSize(this._width, this._height);
//fire event to say we have loaded
_container.contentLoaded();
}
- public function stpButtons():Void {
- okBtn.label = Dictionary.getValue('al_ok');
- retBtn.label = Dictionary.getValue('cv_close_return_to_ext_src', [_requestSrc]);
-
- this.createTextField("okBtnTxt", this.getNextHighestDepth(), btnOffset_X, -100, 10, 18);
- var okBtnTxt = this["okBtnTxt"];
- var okBtnWidth = getButtonWidth(okBtnTxt, okBtn.label);
-
- this.createTextField("retBtnTxt", this.getNextHighestDepth(), btnOffset_X, -100, 10, 18);
- var retBtnTxt = this["retBtnTxt"];
- var retBtnWidth = getButtonWidth(retBtnTxt, retBtn.label);
-
- okBtn.setSize(okBtnWidth, okBtn._height);
- retBtn.setSize(retBtnWidth, retBtn._height);
-
- okBtnTxt.removeTextField();
- retBtnTxt.removeTextField();
- }
-
- private function getButtonWidth(btnText:TextField, btnValue:String):Number {
- btnText.autoSize = "true";
- btnText.html = true;
- btnText.htmlText = btnValue;
- return btnText.textWidth + SPACING;
+ public function stpButtons():Void {
+ okBtn.label = Dictionary.getValue('al_ok');
+ retBtn.label = Dictionary.getValue('cv_close_return_to_ext_src', [_requestSrc]);
+
+ this.createTextField("okBtnTxt", this.getNextHighestDepth(), btnOffset_X, -100, 10, 18);
+ var okBtnTxt = this["okBtnTxt"];
+ var okBtnWidth = getButtonWidth(okBtnTxt, okBtn.label);
+
+ this.createTextField("retBtnTxt", this.getNextHighestDepth(), btnOffset_X, -100, 10, 18);
+ var retBtnTxt = this["retBtnTxt"];
+ var retBtnWidth = getButtonWidth(retBtnTxt, retBtn.label);
+
+ okBtn.setSize(okBtnWidth, okBtn._height);
+ retBtn.setSize(retBtnWidth, retBtn._height);
+
+ okBtnTxt.removeTextField();
+ retBtnTxt.removeTextField();
}
+
+ private function getButtonWidth(btnText:TextField, btnValue:String):Number {
+ btnText.autoSize = "true";
+ btnText.html = true;
+ btnText.htmlText = btnValue;
+ return btnText.textWidth + SPACING;
+ }
/**
* Main resize method, called by scrollpane container/parent
*/
public function setSize(w:Number,h:Number){
- var wid:Number = okBtn._width + retBtn._width + (2*MARGIN);
-
+ var wid:Number = okBtn._width + retBtn._width + (2*MARGIN);
+
okBtn._x = (w/2) - (wid/2);
- okBtn._y = h - okBtn._height - MARGIN;
- retBtn._x = (w/2) - (wid/2) + okBtn._width + (2*MARGIN);
+ okBtn._y = h - okBtn._height - MARGIN;
+ retBtn._x = (w/2) - (wid/2) + okBtn._width + (2*MARGIN);
retBtn._y = h - retBtn._height - MARGIN;
}
@@ -188,11 +188,11 @@
if(tgt.indexOf('okBtn') != -1) {
_container.deletePopUp();
- } else if(tgt.indexOf('retBtn') != -1) {
+ } else if(tgt.indexOf('retBtn') != -1) {
ApplicationParent.extCall('closeWindow', null);
- _container.deletePopUp();
+ _container.deletePopUp();
} else {
- _container.deletePopUp();
+ _container.deletePopUp();
}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ValidationIssue.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ValidationIssue.as (.../ValidationIssue.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ValidationIssue.as (.../ValidationIssue.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,26 +1,26 @@
-/***************************************************************************
- * Copyright (C) 2008 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * Copyright (C) 2008 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
+ * ************************************************************************
+ */
+
class org.lamsfoundation.lams.authoring.cv.ValidationIssue {
private var _code:String;
@@ -38,25 +38,25 @@
public static var TRANSITION_ERROR_CODE:String = "T";
public static var ACTIVITY_TRANSITION_ERROR_CODE:String = "AT";
public static var INPUT_TRANSITION_ERROR_CODE:String = "IT";
- public static var OUTPUT_TRANSITION_ERROR_CODE:String = "OT1";
-
- public static var GROUPING_ACTIVITY_MISSING_GROUPING_ERROR_CODE:String = "GM";
+ public static var OUTPUT_TRANSITION_ERROR_CODE:String = "OT1";
+
+ public static var GROUPING_ACTIVITY_MISSING_GROUPING_ERROR_CODE:String = "GM";
public static var GROUPING_ACTIVITY_GROUP_COUNT_MISMATCH_ERROR_CODE:String = "GC";
function ValidationIssue(code:String, message:String, UIID:Number) {
_code = code;
_message = message;
- _UIID = UIID;
+ _UIID = UIID;
}
function get message():String {
- return _message;
+ return _message;
}
function get UIID():Number {
- return _UIID;
+ return _UIID;
}
-
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ValidationIssuesDialog.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ValidationIssuesDialog.as (.../ValidationIssuesDialog.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/ValidationIssuesDialog.as (.../ValidationIssuesDialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,207 +1,207 @@
-/***************************************************************************
- * Copyright (C) 2008 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.controls.gridclasses.DataGridColumn;
-import mx.utils.*
-import mx.managers.*
-import mx.events.*
-
-/*
-*
-* @author DC
-* @version 0.1
-* @comments Shows validation issues in a datagrid
-*
-*/
-class org.lamsfoundation.lams.authoring.cv.ValidationIssuesDialog extends MovieClip{
-
- private var MARGIN = 5;
- private var _canvasModel:CanvasModel;
- private var _canvasController:CanvasController;
- private var _validationIssues:Object;
-
- //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 validationIssues_dgd:DataGrid;
- private var done_btn:Button;
-
- private var fm:FocusManager;
- private var _tm:ThemeManager;
- private var toolDisplayName_lbl: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 ValidationIssuesDialog(){
- Debugger.log('Constructor',Debugger.GEN,'ValidationIssuesDialog','ValidationIssuesDialog');
- _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));
-
- }
-
- public function init():Void {
- //Delete the enterframe dispatcher
- delete this.onEnterFrame;
-
- _canvasModel = _container.canvasModel;
- _canvasController = _container.canvasController;
- _validationIssues = _container.validationIssues;
-
- _canvasModel.addEventListener('viewUpdate',this);
- validationIssues_dgd.addEventListener("change",this);
-
- done_btn.label = Dictionary.getValue('ld_val_done');
- done_btn.addEventListener("click",this);
-
- //Assign Click (close button) and resize handlers
- _container.addEventListener('click',this);
- _container.addEventListener('size',this);
-
- // Should be called by canvasController?
- setupContent();
- }
-
- public function getRowHeight(column_value:DataGridColumn):Number {
- var maxStrWidth:Number = 0;
- for (var i = 0; i < _validationIssues.length; i++) {
- maxStrWidth = Math.max(StringUtils.getButtonWidthForStr(_validationIssues[i].Issue), maxStrWidth);
- }
-
- var numRows:Number = Math.ceil(maxStrWidth/(column_value.width-2*MARGIN));
- var lineHeight:Number;
- if (numRows == 1)
- lineHeight = 25;
- else
- lineHeight = 20;
-
- var _rowHeight:Number = numRows * lineHeight;
- return _rowHeight;
- }
-
- public function setupContent():Void {
- var column_name:DataGridColumn = new DataGridColumn("Activity");
- column_name.headerText = Dictionary.getValue("ld_val_activity_column");
- column_name.editable = false;
- column_name.width = Math.ceil((validationIssues_dgd.width - 15)*0.3);
- column_name.cellRenderer = "MultiLineCell";
-
- var column_value:DataGridColumn = new DataGridColumn("Issue");
- column_value.headerText = Dictionary.getValue("ld_val_issue_column");
- column_value.editable = false;
- column_value.width = Math.ceil((validationIssues_dgd.width - 15)*0.7);
- column_value.cellRenderer = "MultiLineCell";
-
- validationIssues_dgd.rowHeight = getRowHeight(column_value);
-
- validationIssues_dgd.addColumn(column_name);
- validationIssues_dgd.addColumn(column_value);
-
- // wait second frame for steppers to be setup
- validationIssues_dgd.dataProvider = _validationIssues;
-
- _container.contentLoaded();
-
- this.onEnterFrame = initSetup;
-
- setSize(_width, _height);
- }
-
- private function initSetup():Void {
- delete this.onEnterFrame;
-
- this._visible = true;
-
- }
-
- /**
- * Main resize method, called by scrollpane container/parent
- */
- public function setSize(w:Number,h:Number){
-
- validationIssues_dgd.setSize(w,h - (done_btn._height + MARGIN*2));
- done_btn._x = (w - done_btn._width) - MARGIN;
- done_btn._y = h - (done_btn._height + MARGIN);
-
- }
-
- /**
- * Get the CSSStyleDeclaration objects for each component and applies them
- * directly to the instanced
- * @usage
- * @return
- */
- private function setStyles() {
-
- var styleObj = _tm.getStyleObject('button');
- done_btn.setStyle('styleName',styleObj);
- styleObj = _tm.getStyleObject('datagrid');
- validationIssues_dgd.setStyle(styleObj);
- }
-
- //Gets+Sets
- /**
- * set the container refernce to the window holding the dialog
- */
- public function set container(value:MovieClip){
- _container = value;
- }
-
- /**
- * Recieves the click events from the canvas views (inc Property Inspector) buttons. Based on the target
- * the relevent method is called to action the user request
- * @param evt
- */
- /**/
- public function click(e):Void{
- var tgt:String = new String(e.target);
- Debugger.log('click tgt:'+tgt,Debugger.GEN,'click','ValidationIssuesDialog');
- _container.deletePopUp();
- }
-
- public function change(e):Void{
- Debugger.log('e.target.selectedItem.data.uiid:'+e.target.selectedItem.uiid,Debugger.GEN,'change','ValidationIssuesDialog');
- _canvasModel.setSelectedItemByUIID(e.target.selectedItem.uiid);
- }
-
-
-}
-
+/***************************************************************************
+ * Copyright (C) 2008 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.controls.gridclasses.DataGridColumn;
+import mx.utils.*
+import mx.managers.*
+import mx.events.*
+
+/*
+*
+* @author DC
+* @version 0.1
+* @comments Shows validation issues in a datagrid
+*
+*/
+class org.lamsfoundation.lams.authoring.cv.ValidationIssuesDialog extends MovieClip{
+
+ private var MARGIN = 5;
+ private var _canvasModel:CanvasModel;
+ private var _canvasController:CanvasController;
+ private var _validationIssues:Object;
+
+ //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 validationIssues_dgd:DataGrid;
+ private var done_btn:Button;
+
+ private var fm:FocusManager;
+ private var _tm:ThemeManager;
+ private var toolDisplayName_lbl: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 ValidationIssuesDialog(){
+ Debugger.log('Constructor',Debugger.GEN,'ValidationIssuesDialog','ValidationIssuesDialog');
+ _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));
+
+ }
+
+ public function init():Void {
+ //Delete the enterframe dispatcher
+ delete this.onEnterFrame;
+
+ _canvasModel = _container.canvasModel;
+ _canvasController = _container.canvasController;
+ _validationIssues = _container.validationIssues;
+
+ _canvasModel.addEventListener('viewUpdate',this);
+ validationIssues_dgd.addEventListener("change",this);
+
+ done_btn.label = Dictionary.getValue('ld_val_done');
+ done_btn.addEventListener("click",this);
+
+ //Assign Click (close button) and resize handlers
+ _container.addEventListener('click',this);
+ _container.addEventListener('size',this);
+
+ // Should be called by canvasController?
+ setupContent();
+ }
+
+ public function getRowHeight(column_value:DataGridColumn):Number {
+ var maxStrWidth:Number = 0;
+ for (var i = 0; i < _validationIssues.length; i++) {
+ maxStrWidth = Math.max(StringUtils.getButtonWidthForStr(_validationIssues[i].Issue), maxStrWidth);
+ }
+
+ var numRows:Number = Math.ceil(maxStrWidth/(column_value.width-2*MARGIN));
+ var lineHeight:Number;
+ if (numRows == 1)
+ lineHeight = 25;
+ else
+ lineHeight = 20;
+
+ var _rowHeight:Number = numRows * lineHeight;
+ return _rowHeight;
+ }
+
+ public function setupContent():Void {
+ var column_name:DataGridColumn = new DataGridColumn("Activity");
+ column_name.headerText = Dictionary.getValue("ld_val_activity_column");
+ column_name.editable = false;
+ column_name.width = Math.ceil((validationIssues_dgd.width - 15)*0.3);
+ column_name.cellRenderer = "MultiLineCell";
+
+ var column_value:DataGridColumn = new DataGridColumn("Issue");
+ column_value.headerText = Dictionary.getValue("ld_val_issue_column");
+ column_value.editable = false;
+ column_value.width = Math.ceil((validationIssues_dgd.width - 15)*0.7);
+ column_value.cellRenderer = "MultiLineCell";
+
+ validationIssues_dgd.rowHeight = getRowHeight(column_value);
+
+ validationIssues_dgd.addColumn(column_name);
+ validationIssues_dgd.addColumn(column_value);
+
+ // wait second frame for steppers to be setup
+ validationIssues_dgd.dataProvider = _validationIssues;
+
+ _container.contentLoaded();
+
+ this.onEnterFrame = initSetup;
+
+ setSize(_width, _height);
+ }
+
+ private function initSetup():Void {
+ delete this.onEnterFrame;
+
+ this._visible = true;
+
+ }
+
+ /**
+ * Main resize method, called by scrollpane container/parent
+ */
+ public function setSize(w:Number,h:Number){
+
+ validationIssues_dgd.setSize(w,h - (done_btn._height + MARGIN*2));
+ done_btn._x = (w - done_btn._width) - MARGIN;
+ done_btn._y = h - (done_btn._height + MARGIN);
+
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and applies them
+ * directly to the instanced
+ * @usage
+ * @return
+ */
+ private function setStyles() {
+
+ var styleObj = _tm.getStyleObject('button');
+ done_btn.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('datagrid');
+ validationIssues_dgd.setStyle(styleObj);
+ }
+
+ //Gets+Sets
+ /**
+ * set the container refernce to the window holding the dialog
+ */
+ public function set container(value:MovieClip){
+ _container = value;
+ }
+
+ /**
+ * Recieves the click events from the canvas views (inc Property Inspector) buttons. Based on the target
+ * the relevent method is called to action the user request
+ * @param evt
+ */
+ /**/
+ public function click(e):Void{
+ var tgt:String = new String(e.target);
+ Debugger.log('click tgt:'+tgt,Debugger.GEN,'click','ValidationIssuesDialog');
+ _container.deletePopUp();
+ }
+
+ public function change(e):Void{
+ Debugger.log('e.target.selectedItem.data.uiid:'+e.target.selectedItem.uiid,Debugger.GEN,'change','ValidationIssuesDialog');
+ _canvasModel.setSelectedItemByUIID(e.target.selectedItem.uiid);
+ }
+
+
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/layout/DefaultLayoutManager.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/layout/DefaultLayoutManager.as (.../DefaultLayoutManager.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/layout/DefaultLayoutManager.as (.../DefaultLayoutManager.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,118 +1,118 @@
-/***************************************************************************
- * 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.containers.*
-import mx.managers.*
-import mx.utils.*
-
-import org.lamsfoundation.lams.authoring.Application
-import org.lamsfoundation.lams.authoring.cv.Canvas
-import org.lamsfoundation.lams.authoring.tk.Toolkit
-import org.lamsfoundation.lams.authoring.tb.Toolbar
-import org.lamsfoundation.lams.authoring.layout.*
-import org.lamsfoundation.lams.common.ApplicationParent
-import org.lamsfoundation.lams.common.util.Proxy
-import org.lamsfoundation.lams.common.layout.ILayoutManager
-import org.lamsfoundation.lams.common.layout.LFLayoutManager
-import org.lamsfoundation.lams.common.layout.LFLayoutItem
-
-/**
-* DefaultLayoutManager - Default Layout manager for an Application
-* @author Mitchell Seaton
-*
+/***************************************************************************
+ * 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.containers.*
+import mx.managers.*
+import mx.utils.*
+
+import org.lamsfoundation.lams.authoring.Application
+import org.lamsfoundation.lams.authoring.cv.Canvas
+import org.lamsfoundation.lams.authoring.tk.Toolkit
+import org.lamsfoundation.lams.authoring.tb.Toolbar
+import org.lamsfoundation.lams.authoring.layout.*
+import org.lamsfoundation.lams.common.ApplicationParent
+import org.lamsfoundation.lams.common.util.Proxy
+import org.lamsfoundation.lams.common.layout.ILayoutManager
+import org.lamsfoundation.lams.common.layout.LFLayoutManager
+import org.lamsfoundation.lams.common.layout.LFLayoutItem
+
+/**
+* DefaultLayoutManager - Default Layout manager for an Application
+* @author Mitchell Seaton
+*
*/
-class DefaultLayoutManager extends LFLayoutManager {
-
- public static var COMPONENT_NO:Number = 5;
- private var app:Application = null;
-
- //Constructor
- function DefaultLayoutManager(name:String) {
- super(name);
- app = Application.getInstance();
- }
-
- public function setup(target:ApplicationParent) {
- super.setup(target);
-
- setupUI();
- }
-
- private function setItem(obj) {
- setEmptyLayoutItem(new LFLayoutItem(obj.classname, obj));
- }
-
- private function setupUI() {
-
- // Menu Bar
- app.menubar = Application.root.attachMovie('LFMenuBar','_menu_mc', Application.MENU_DEPTH, {_x:0,_y:0});
- app.menubar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.menubar);
-
- var depth:Number = Application.root.getNextHighestDepth();
-
- // Toolbar
- app.toolbar = new Toolbar(Application.toolbarContainer,Application.toolbarContainer.getNextHighestDepth(), Application.TOOLBAR_X, Application.TOOLBAR_Y, Toolbar.NORMAL_MODE);
- app.toolbar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.toolbar);
-
- // Canvas
- app.canvas = new Canvas(Application.root,depth++, Application.CANVAS_X, Application.CANVAS_Y, Application.CANVAS_W, 495);
- app.canvas.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.canvas);
-
- // Toolkit
- app.toolkit = new Toolkit(Application.root,depth++, Application.TOOLKIT_X, Application.TOOLKIT_Y);
- app.toolkit.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.toolkit);
-
- // Property Inspector
- app.pi = Application.root.attachMovie('PropertyInspector','_pi_mc', Application.PI_DEPTH, {_x:Application.PI_X,_y:Application.PI_Y, _canvasModel:app.canvas.model, _canvasController:app.canvas.view.getController()});
- app.pi.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.pi);
- }
-
- public function resize(w:Number, h:Number) {
- //Menu - only need to worry about width
- app.menubar.setSize(w,app.menubar._height);
-
- //Canvas
- app.toolkit.setSize(app.toolkit.width, h-Application.TOOLKIT_Y);
- app.canvas.setSize(w-app.toolkit.width, h-(Application.CANVAS_Y + app.canvas.model.getPIHeight()));
-
- //Toolbar
- app.toolbar.setSize(w, Application.TOOLBAR_HEIGHT);
-
- //Property Inspector
- app.pi.setSize(w-app.toolkit.width, app.pi._height)
- app.pi._y = h - app.canvas.model.getPIHeight();
-
- var piHeight:Number = app.canvas.model.getPIHeight();
- app.pi.showExpand(false)
-
- if (piHeight != app.pi.piFullHeight()){
- app.pi.showExpand(true);
- }
- }
-
+class DefaultLayoutManager extends LFLayoutManager {
+
+ public static var COMPONENT_NO:Number = 5;
+ private var app:Application = null;
+
+ //Constructor
+ function DefaultLayoutManager(name:String) {
+ super(name);
+ app = Application.getInstance();
+ }
+
+ public function setup(target:ApplicationParent) {
+ super.setup(target);
+
+ setupUI();
+ }
+
+ private function setItem(obj) {
+ setEmptyLayoutItem(new LFLayoutItem(obj.classname, obj));
+ }
+
+ private function setupUI() {
+
+ // Menu Bar
+ app.menubar = Application.root.attachMovie('LFMenuBar','_menu_mc', Application.MENU_DEPTH, {_x:0,_y:0});
+ app.menubar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.menubar);
+
+ var depth:Number = Application.root.getNextHighestDepth();
+
+ // Toolbar
+ app.toolbar = new Toolbar(Application.toolbarContainer,Application.toolbarContainer.getNextHighestDepth(), Application.TOOLBAR_X, Application.TOOLBAR_Y, Toolbar.NORMAL_MODE);
+ app.toolbar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.toolbar);
+
+ // Canvas
+ app.canvas = new Canvas(Application.root,depth++, Application.CANVAS_X, Application.CANVAS_Y, Application.CANVAS_W, 495);
+ app.canvas.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.canvas);
+
+ // Toolkit
+ app.toolkit = new Toolkit(Application.root,depth++, Application.TOOLKIT_X, Application.TOOLKIT_Y);
+ app.toolkit.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.toolkit);
+
+ // Property Inspector
+ app.pi = Application.root.attachMovie('PropertyInspector','_pi_mc', Application.PI_DEPTH, {_x:Application.PI_X,_y:Application.PI_Y, _canvasModel:app.canvas.model, _canvasController:app.canvas.view.getController()});
+ app.pi.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.pi);
+ }
+
+ public function resize(w:Number, h:Number) {
+ //Menu - only need to worry about width
+ app.menubar.setSize(w,app.menubar._height);
+
+ //Canvas
+ app.toolkit.setSize(app.toolkit.width, h-Application.TOOLKIT_Y);
+ app.canvas.setSize(w-app.toolkit.width, h-(Application.CANVAS_Y + app.canvas.model.getPIHeight()));
+
+ //Toolbar
+ app.toolbar.setSize(w, Application.TOOLBAR_HEIGHT);
+
+ //Property Inspector
+ app.pi.setSize(w-app.toolkit.width, app.pi._height)
+ app.pi._y = h - app.canvas.model.getPIHeight();
+
+ var piHeight:Number = app.canvas.model.getPIHeight();
+ app.pi.showExpand(false)
+
+ if (piHeight != app.pi.piFullHeight()){
+ app.pi.showExpand(true);
+ }
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/layout/EditOnFlyLayoutManager.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/layout/EditOnFlyLayoutManager.as (.../EditOnFlyLayoutManager.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/layout/EditOnFlyLayoutManager.as (.../EditOnFlyLayoutManager.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,136 +1,136 @@
-/***************************************************************************
- * 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.containers.*
-import mx.managers.*
-import mx.utils.*
-
-import org.lamsfoundation.lams.authoring.Application
-import org.lamsfoundation.lams.authoring.cv.Canvas
-import org.lamsfoundation.lams.authoring.tk.Toolkit
-import org.lamsfoundation.lams.authoring.tb.Toolbar
-import org.lamsfoundation.lams.authoring.layout.*
-import org.lamsfoundation.lams.common.ApplicationParent
-import org.lamsfoundation.lams.common.util.Proxy
-import org.lamsfoundation.lams.common.layout.ILayoutManager
-import org.lamsfoundation.lams.common.layout.LFLayoutManager
-import org.lamsfoundation.lams.common.layout.LFLayoutItem
-
-/**
-* EditOnFlyLayoutManager - Custom Layout manager for Edit-On-The-Fly mode of Authoring
-* @author Mitchell Seaton
-*
+/***************************************************************************
+ * 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.containers.*
+import mx.managers.*
+import mx.utils.*
+
+import org.lamsfoundation.lams.authoring.Application
+import org.lamsfoundation.lams.authoring.cv.Canvas
+import org.lamsfoundation.lams.authoring.tk.Toolkit
+import org.lamsfoundation.lams.authoring.tb.Toolbar
+import org.lamsfoundation.lams.authoring.layout.*
+import org.lamsfoundation.lams.common.ApplicationParent
+import org.lamsfoundation.lams.common.util.Proxy
+import org.lamsfoundation.lams.common.layout.ILayoutManager
+import org.lamsfoundation.lams.common.layout.LFLayoutManager
+import org.lamsfoundation.lams.common.layout.LFLayoutItem
+
+/**
+* EditOnFlyLayoutManager - Custom Layout manager for Edit-On-The-Fly mode of Authoring
+* @author Mitchell Seaton
+*
*/
-class EditOnFlyLayoutManager extends LFLayoutManager {
-
- private static var TOOLBAR_X:Number = 0;
- private static var TOOLBAR_Y:Number = 0;
- private static var TOOLBAR_HEIGHT:Number = 35;
-
- private static var TOOLKIT_X:Number = 0;
- private static var TOOLKIT_Y:Number = 34;
-
- private static var CANVAS_X:Number = 180;
- private static var CANVAS_Y:Number = 34;
- private static var CANVAS_W:Number = 1000;
- private static var CANVAS_H:Number = 200;
-
- private static var PI_X:Number = 180;
- private static var PI_Y:Number = 530;
- private static var PI_W:Number = 616;
-
- private var app:Application = null;
-
- public static var COMPONENT_NO:Number = 4;
-
- //Constructor
- function EditOnFlyLayoutManager(name:String) {
- super(name);
- app = Application.getInstance();
- }
-
- public function setup(target:ApplicationParent) {
- super.setup(target);
-
- setupUI();
- }
-
- private function setItem(obj) {
- setEmptyLayoutItem(new LFLayoutItem(obj.classname, obj));
- }
-
- public function setupUI() {
- // Menu Bar
-
- app.menubar = Application.root.attachMovie('LFMenuBar','_menu_mc', Application.MENU_DEPTH, {_x:0,_y:0,layout:_root.layout});
- app.menubar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.menubar);
-
- var depth:Number = Application.root.getNextHighestDepth();
-
- // Toolbar
- app.toolbar = new Toolbar(Application.toolbarContainer,Application.toolbarContainer.getNextHighestDepth(), Application.TOOLBAR_X, Application.TOOLBAR_Y, Toolbar.EDIT_MODE);
- app.toolbar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.toolbar);
-
- // Canvas
- app.canvas = new Canvas(Application.root,depth++, Application.CANVAS_X, Application.CANVAS_Y, Application.CANVAS_W, 495);
- app.canvas.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.canvas);
-
- // Toolkit
- app.toolkit = new Toolkit(Application.root,depth++, Application.TOOLKIT_X, Application.TOOLKIT_Y);
- app.toolkit.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.toolkit);
-
- // Property Inspector
- app.pi = Application.root.attachMovie('PropertyInspector','_pi_mc', Application.PI_DEPTH, {_x:Application.PI_X,_y:Application.PI_Y, _canvasModel:app.canvas.model, _canvasController:app.canvas.view.getController()});
- app.pi.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
- setItem(app.pi);
- }
-
- public function resize(w:Number, h:Number) {
- //Menu - only need to worry about width
- app.menubar.setSize(w,app.menubar._height);
- app.menubar.setSize(w,app.menubar._height);
-
- //Canvas
- app.toolkit.setSize(app.toolkit.width, h-Application.TOOLKIT_Y);
- app.canvas.setSize(w-app.toolkit.width, h-(Application.CANVAS_Y + app.canvas.model.getPIHeight()));
-
- //Toolbar
- app.toolbar.setSize(w, Application.TOOLBAR_HEIGHT);
-
- //Property Inspector
- app.pi.setSize(w-app.toolkit.width, app.pi._height)
- app.pi._y = h - app.canvas.model.getPIHeight();
-
- var piHeight:Number = app.canvas.model.getPIHeight();
- app.pi.showExpand(false)
-
- if (piHeight != app.pi.piFullHeight()){
- app.pi.showExpand(true);
- }
- }
-
+class EditOnFlyLayoutManager extends LFLayoutManager {
+
+ private static var TOOLBAR_X:Number = 0;
+ private static var TOOLBAR_Y:Number = 0;
+ private static var TOOLBAR_HEIGHT:Number = 35;
+
+ private static var TOOLKIT_X:Number = 0;
+ private static var TOOLKIT_Y:Number = 34;
+
+ private static var CANVAS_X:Number = 180;
+ private static var CANVAS_Y:Number = 34;
+ private static var CANVAS_W:Number = 1000;
+ private static var CANVAS_H:Number = 200;
+
+ private static var PI_X:Number = 180;
+ private static var PI_Y:Number = 530;
+ private static var PI_W:Number = 616;
+
+ private var app:Application = null;
+
+ public static var COMPONENT_NO:Number = 4;
+
+ //Constructor
+ function EditOnFlyLayoutManager(name:String) {
+ super(name);
+ app = Application.getInstance();
+ }
+
+ public function setup(target:ApplicationParent) {
+ super.setup(target);
+
+ setupUI();
+ }
+
+ private function setItem(obj) {
+ setEmptyLayoutItem(new LFLayoutItem(obj.classname, obj));
+ }
+
+ public function setupUI() {
+ // Menu Bar
+
+ app.menubar = Application.root.attachMovie('LFMenuBar','_menu_mc', Application.MENU_DEPTH, {_x:0,_y:0,layout:_root.layout});
+ app.menubar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.menubar);
+
+ var depth:Number = Application.root.getNextHighestDepth();
+
+ // Toolbar
+ app.toolbar = new Toolbar(Application.toolbarContainer,Application.toolbarContainer.getNextHighestDepth(), Application.TOOLBAR_X, Application.TOOLBAR_Y, Toolbar.EDIT_MODE);
+ app.toolbar.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.toolbar);
+
+ // Canvas
+ app.canvas = new Canvas(Application.root,depth++, Application.CANVAS_X, Application.CANVAS_Y, Application.CANVAS_W, 495);
+ app.canvas.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.canvas);
+
+ // Toolkit
+ app.toolkit = new Toolkit(Application.root,depth++, Application.TOOLKIT_X, Application.TOOLKIT_Y);
+ app.toolkit.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.toolkit);
+
+ // Property Inspector
+ app.pi = Application.root.attachMovie('PropertyInspector','_pi_mc', Application.PI_DEPTH, {_x:Application.PI_X,_y:Application.PI_Y, _canvasModel:app.canvas.model, _canvasController:app.canvas.view.getController()});
+ app.pi.addEventListener('load',Proxy.create(app,app.UIElementLoaded));
+ setItem(app.pi);
+ }
+
+ public function resize(w:Number, h:Number) {
+ //Menu - only need to worry about width
+ app.menubar.setSize(w,app.menubar._height);
+ app.menubar.setSize(w,app.menubar._height);
+
+ //Canvas
+ app.toolkit.setSize(app.toolkit.width, h-Application.TOOLKIT_Y);
+ app.canvas.setSize(w-app.toolkit.width, h-(Application.CANVAS_Y + app.canvas.model.getPIHeight()));
+
+ //Toolbar
+ app.toolbar.setSize(w, Application.TOOLBAR_HEIGHT);
+
+ //Property Inspector
+ app.pi.setSize(w-app.toolkit.width, app.pi._height)
+ app.pi._y = h - app.canvas.model.getPIHeight();
+
+ var piHeight:Number = app.canvas.model.getPIHeight();
+ app.pi.showExpand(false)
+
+ if (piHeight != app.pi.piFullHeight()){
+ app.pi.showExpand(true);
+ }
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/Toolbar.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/Toolbar.as (.../Toolbar.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/Toolbar.as (.../Toolbar.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,162 +1,162 @@
-/***************************************************************************
- * 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.Application
-import org.lamsfoundation.lams.authoring.tb.*
-import org.lamsfoundation.lams.common.util.*
-import mx.managers.*;
-
-/*
-* The canvas is the main screen area of the LAMS application where activies are added and sequenced
-*/
-class Toolbar {
-
- // Model
- private var toolbarModel:ToolbarModel;
-
- // View
- private var toolbarView:ToolbarView;
- private var toolbarView_mc:MovieClip;
-
- private var _prevButtonState:Array;
-
- public static var NORMAL_MODE:Number = 0;
- public static var EDIT_MODE:Number = 1;
-
- //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;
-
- /*
- * Canvas Constructor
- *
- * @param target_mc Target clip for attaching view
- */
- function Toolbar (target_mc:MovieClip,depth:Number,x:Number,y:Number, mode:Number){
- mx.events.EventDispatcher.initialize(this);
- //Create the model
- toolbarModel = new ToolbarModel(this, mode);
-
- //Create the view
- toolbarView_mc = target_mc.createChildAtDepth("toolbarView", DepthManager.kTop);
-
- //Cast toolbar view clip as ToolbarBview and initialise passing in model
- toolbarView = ToolbarView(toolbarView_mc);
- toolbarView.init(toolbarModel,undefined);
- toolbarView.addEventListener('load',Proxy.create(this,viewLoaded));
-
- //Register view with model to receive update events
- toolbarModel.addObserver(toolbarView);
-
- //Set the position by setting the model which will call update on the view
- toolbarModel.setPosition(x,y);
- toolbarModel.toolbarButtons();
-
- }
-
- /**
- * 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{
- toolbarModel.setSize(width, height);
- }
-
- public function setPosition(x:Number,y:Number){
- //Set the position within limits
- //TODO DI write validation on limits
- toolbarModel.setPosition(x,y);
- }
-
- private function viewLoaded(evt:Object){
- Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Toolbar');
- toolbarModel.setDefaultState();
- if(evt.type=='load') {
- dispatchEvent({type:'load',target:this});
- }else {
- //Raise error for unrecognized event
- }
- }
-
- public function disableAll() {
- Debugger.log("disabling all", Debugger.CRITICAL, "disableAll", "Toolbar");
-
- _prevButtonState = new Array();
- enableAll(false);
- }
-
- public function enableAll(a:Boolean) {
-
- if(a == null) a = true;
- var buttons:Array = toolbarView.toolbarMenu;
-
- Debugger.log("disabling all", Debugger.CRITICAL, "disableAll", "Toolbar");
-
- for(var i=0; i < buttons.length; i++) {
-
- if(a) {
- if(_prevButtonState[i] != null) {
- setButtonState(_prevButtonState[i].name, _prevButtonState[i].value);
- }
-
- } else {
- var buttonState = new Object();
- buttonState.name = buttons[i]._name;
- buttonState.value = buttons[i].enabled;
-
- setButtonState(buttons[i]._name, a);
- _prevButtonState.push(buttonState);
- }
-
- }
-
- if(a)
- Application.getInstance().canvas.checkValidDesign();
- }
-
- public function setButtonState(btnName:String, btnState:Boolean, btnVisible:Boolean){
- toolbarModel.setButtonState(btnName, btnState, btnVisible);
- }
-
- function get className():String{
- return 'Toolbar';
- }
-
- public function get width(){
- return toolbarModel.width;
- }
- public function get height(){
- return toolbarModel.height;
- }
-
- public function get view():MovieClip{
- return getToolbarView();
- }
-
- public function getToolbarView():MovieClip{
- return toolbarView;
- }
-
-}
+/***************************************************************************
+ * 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.Application
+import org.lamsfoundation.lams.authoring.tb.*
+import org.lamsfoundation.lams.common.util.*
+import mx.managers.*;
+
+/*
+* The canvas is the main screen area of the LAMS application where activies are added and sequenced
+*/
+class Toolbar {
+
+ // Model
+ private var toolbarModel:ToolbarModel;
+
+ // View
+ private var toolbarView:ToolbarView;
+ private var toolbarView_mc:MovieClip;
+
+ private var _prevButtonState:Array;
+
+ public static var NORMAL_MODE:Number = 0;
+ public static var EDIT_MODE:Number = 1;
+
+ //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;
+
+ /*
+ * Canvas Constructor
+ *
+ * @param target_mc Target clip for attaching view
+ */
+ function Toolbar (target_mc:MovieClip,depth:Number,x:Number,y:Number, mode:Number){
+ mx.events.EventDispatcher.initialize(this);
+ //Create the model
+ toolbarModel = new ToolbarModel(this, mode);
+
+ //Create the view
+ toolbarView_mc = target_mc.createChildAtDepth("toolbarView", DepthManager.kTop);
+
+ //Cast toolbar view clip as ToolbarBview and initialise passing in model
+ toolbarView = ToolbarView(toolbarView_mc);
+ toolbarView.init(toolbarModel,undefined);
+ toolbarView.addEventListener('load',Proxy.create(this,viewLoaded));
+
+ //Register view with model to receive update events
+ toolbarModel.addObserver(toolbarView);
+
+ //Set the position by setting the model which will call update on the view
+ toolbarModel.setPosition(x,y);
+ toolbarModel.toolbarButtons();
+
+ }
+
+ /**
+ * 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{
+ toolbarModel.setSize(width, height);
+ }
+
+ public function setPosition(x:Number,y:Number){
+ //Set the position within limits
+ //TODO DI write validation on limits
+ toolbarModel.setPosition(x,y);
+ }
+
+ private function viewLoaded(evt:Object){
+ Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Toolbar');
+ toolbarModel.setDefaultState();
+ if(evt.type=='load') {
+ dispatchEvent({type:'load',target:this});
+ }else {
+ //Raise error for unrecognized event
+ }
+ }
+
+ public function disableAll() {
+ Debugger.log("disabling all", Debugger.CRITICAL, "disableAll", "Toolbar");
+
+ _prevButtonState = new Array();
+ enableAll(false);
+ }
+
+ public function enableAll(a:Boolean) {
+
+ if(a == null) a = true;
+ var buttons:Array = toolbarView.toolbarMenu;
+
+ Debugger.log("disabling all", Debugger.CRITICAL, "disableAll", "Toolbar");
+
+ for(var i=0; i < buttons.length; i++) {
+
+ if(a) {
+ if(_prevButtonState[i] != null) {
+ setButtonState(_prevButtonState[i].name, _prevButtonState[i].value);
+ }
+
+ } else {
+ var buttonState = new Object();
+ buttonState.name = buttons[i]._name;
+ buttonState.value = buttons[i].enabled;
+
+ setButtonState(buttons[i]._name, a);
+ _prevButtonState.push(buttonState);
+ }
+
+ }
+
+ if(a)
+ Application.getInstance().canvas.checkValidDesign();
+ }
+
+ public function setButtonState(btnName:String, btnState:Boolean, btnVisible:Boolean){
+ toolbarModel.setButtonState(btnName, btnState, btnVisible);
+ }
+
+ function get className():String{
+ return 'Toolbar';
+ }
+
+ public function get width(){
+ return toolbarModel.width;
+ }
+ public function get height(){
+ return toolbarModel.height;
+ }
+
+ public function get view():MovieClip{
+ return getToolbarView();
+ }
+
+ public function getToolbarView():MovieClip{
+ return toolbarView;
+ }
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarController.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarController.as (.../ToolbarController.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarController.as (.../ToolbarController.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,130 +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.authoring.tb.*
-import org.lamsfoundation.lams.common.mvc.*
-import org.lamsfoundation.lams.common.ui.*
-import org.lamsfoundation.lams.common.util.*
-import org.lamsfoundation.lams.authoring.*
-
-
-/*
-* Makes changes to the Canvas Authoring model's data based on user input.
-*/
-class org.lamsfoundation.lams.authoring.tb.ToolbarController extends AbstractController {
-
- /**
- * Constructor
- *
- * @param cm The model to modify.
- */
- private var _app:Application;
- private var _toolbarModel:ToolbarModel;
- private var isflowActive:Boolean = false;
- private var isOptActive:Boolean = false;
-
- public function ToolbarController (cm:Observable) {
- super (cm);
- _app = Application.getInstance();
- _toolbarModel = ToolbarModel(getModel());
-
- }
-
- public function hideOptionPanels(){
- isflowActive = false;
- isOptActive = false;
- _toolbarModel.getToolbar().view.showHideAssets(false);
- }
-
- /**
- * Recieves the click events from the Toolbar buttons. Based on the label
- * the relevent method is called to action the user request
- * @param evt
- */
- public function click(evt):Void{
- Debugger.log('click evt.target.label:'+evt.target.label,Debugger.GEN,'click','ToolbarController');
- var tgt:String = new String(evt.target);
-
- var optionPanelVisible:Boolean = _toolbarModel.getToolbar().view.isOptionalPanelVisible();
- var flowPanelVisible:Boolean = _toolbarModel.getToolbar().view.isFlowPanelVisible();
-
- hideOptionPanels();
-
- if(tgt.indexOf("new") != -1){
- _app.getCanvas().clearCanvas(false);
- }else if(tgt.indexOf("open") != -1){
- _app.getCanvas().openDesignBySelection();
- }else if(tgt.indexOf("save") != -1){
- Cursor.showCursor(Application.C_HOURGLASS);
- _app.getCanvas().saveDesign();
- }else if(tgt.indexOf("apply_changes") != -1){
- Cursor.showCursor(Application.C_HOURGLASS);
- _app.getCanvas().saveDesign();
- }else if(tgt.indexOf("copy") != -1){
- _app.copy();
- }else if(tgt.indexOf("paste") != -1){
- _app.paste();
- }else if(tgt.indexOf("trans") != -1){
- _app.getCanvas().toggleTransitionTool();
- }else if(tgt.indexOf("optional_act") != -1){
- _app.getCanvas().toggleOptionalActivity();
- }else if(tgt.indexOf("optional_seq") != -1){
- _app.getCanvas().toggleOptionalSequenceActivity();
- }else if(tgt.indexOf("optional") != -1){
- if (!isOptActive && !optionPanelVisible){
- var c:String = Cursor.getCurrentCursor();
- if(c==Application.C_GATE){
- _app.getCanvas().stopGateTool();
- }
-
- isOptActive = true;
- _toolbarModel.getToolbar().view.showHideOptAssets(true);
- }
- }else if(tgt.indexOf("flow") != -1){
- if (!isflowActive && !flowPanelVisible){
- var c:String = Cursor.getCurrentCursor();
-
- if(c==Application.C_GATE){
- _app.getCanvas().stopGateTool();
- }
-
- isflowActive = true;
- _toolbarModel.getToolbar().view.showHideFlowAssets(true);
- }
- }else if(tgt.indexOf("gate") != -1){
- _app.getCanvas().toggleGateTool();
-
- }else if(tgt.indexOf("group") != -1){
- _app.getCanvas().toggleGroupTool();
-
- }else if(tgt.indexOf("branch") != -1){
- _app.getCanvas().toggleBranchTool();
-
- }else if(tgt.indexOf("preview") != -1){
- _app.getCanvas().launchPreviewWindow();
- }else if(tgt.indexOf("cancel") != -1){
- _app.getCanvas().finishEditOnFly();
- }
- }
-
-}
+/***************************************************************************
+ * 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.tb.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.authoring.*
+
+
+/*
+* Makes changes to the Canvas Authoring model's data based on user input.
+*/
+class org.lamsfoundation.lams.authoring.tb.ToolbarController extends AbstractController {
+
+ /**
+ * Constructor
+ *
+ * @param cm The model to modify.
+ */
+ private var _app:Application;
+ private var _toolbarModel:ToolbarModel;
+ private var isflowActive:Boolean = false;
+ private var isOptActive:Boolean = false;
+
+ public function ToolbarController (cm:Observable) {
+ super (cm);
+ _app = Application.getInstance();
+ _toolbarModel = ToolbarModel(getModel());
+
+ }
+
+ public function hideOptionPanels(){
+ isflowActive = false;
+ isOptActive = false;
+ _toolbarModel.getToolbar().view.showHideAssets(false);
+ }
+
+ /**
+ * Recieves the click events from the Toolbar buttons. Based on the label
+ * the relevent method is called to action the user request
+ * @param evt
+ */
+ public function click(evt):Void{
+ Debugger.log('click evt.target.label:'+evt.target.label,Debugger.GEN,'click','ToolbarController');
+ var tgt:String = new String(evt.target);
+
+ var optionPanelVisible:Boolean = _toolbarModel.getToolbar().view.isOptionalPanelVisible();
+ var flowPanelVisible:Boolean = _toolbarModel.getToolbar().view.isFlowPanelVisible();
+
+ hideOptionPanels();
+
+ if(tgt.indexOf("new") != -1){
+ _app.getCanvas().clearCanvas(false);
+ }else if(tgt.indexOf("open") != -1){
+ _app.getCanvas().openDesignBySelection();
+ }else if(tgt.indexOf("save") != -1){
+ Cursor.showCursor(Application.C_HOURGLASS);
+ _app.getCanvas().saveDesign();
+ }else if(tgt.indexOf("apply_changes") != -1){
+ Cursor.showCursor(Application.C_HOURGLASS);
+ _app.getCanvas().saveDesign();
+ }else if(tgt.indexOf("copy") != -1){
+ _app.copy();
+ }else if(tgt.indexOf("paste") != -1){
+ _app.paste();
+ }else if(tgt.indexOf("trans") != -1){
+ _app.getCanvas().toggleTransitionTool();
+ }else if(tgt.indexOf("optional_act") != -1){
+ _app.getCanvas().toggleOptionalActivity();
+ }else if(tgt.indexOf("optional_seq") != -1){
+ _app.getCanvas().toggleOptionalSequenceActivity();
+ }else if(tgt.indexOf("optional") != -1){
+ if (!isOptActive && !optionPanelVisible){
+ var c:String = Cursor.getCurrentCursor();
+ if(c==Application.C_GATE){
+ _app.getCanvas().stopGateTool();
+ }
+
+ isOptActive = true;
+ _toolbarModel.getToolbar().view.showHideOptAssets(true);
+ }
+ }else if(tgt.indexOf("flow") != -1){
+ if (!isflowActive && !flowPanelVisible){
+ var c:String = Cursor.getCurrentCursor();
+
+ if(c==Application.C_GATE){
+ _app.getCanvas().stopGateTool();
+ }
+
+ isflowActive = true;
+ _toolbarModel.getToolbar().view.showHideFlowAssets(true);
+ }
+ }else if(tgt.indexOf("gate") != -1){
+ _app.getCanvas().toggleGateTool();
+
+ }else if(tgt.indexOf("group") != -1){
+ _app.getCanvas().toggleGroupTool();
+
+ }else if(tgt.indexOf("branch") != -1){
+ _app.getCanvas().toggleBranchTool();
+
+ }else if(tgt.indexOf("preview") != -1){
+ _app.getCanvas().launchPreviewWindow();
+ }else if(tgt.indexOf("cancel") != -1){
+ _app.getCanvas().finishEditOnFly();
+ }
+ }
+
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarModel.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarModel.as (.../ToolbarModel.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarModel.as (.../ToolbarModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,220 +1,220 @@
-/***************************************************************************
- * 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.tb.*;
-import org.lamsfoundation.lams.common.util.*;
+/***************************************************************************
+ * 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.tb.*;
+import org.lamsfoundation.lams.common.util.*;
+
/*
* Model for the Toolbar
*/
-class ToolbarModel extends Observable {
-
- private var _tv:Toolbar;
- 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 _btnState:Boolean = false;
- private var _mode:Number;
+class ToolbarModel extends Observable {
+ private var _tv:Toolbar;
+ 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 _btnState:Boolean = false;
+ private var _mode:Number;
+
/**
* Constructor.
*/
- public function ToolbarModel (tv:Toolbar, mode:Number){
- _tv = tv;
+ public function ToolbarModel (tv:Toolbar, mode:Number){
+ _tv = tv;
_mode = mode;
- }
-
- /**
- * 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);
- }
-
- public function toolbarButtons(){
- var buttonArr:Array = new Array();
-
- if(mode != Toolbar.EDIT_MODE) {
-
- buttonArr[0] = ["new_btn", "icon_newDesign"];
- buttonArr[1] = ["open_btn", "icon_openDesign"];
- buttonArr[2] = ["save_btn", "icon_saveDesign"];
- buttonArr[3] = ["copy_btn", "icon_copy"];
- buttonArr[4] = ["paste_btn", "icon_paste"];
- buttonArr[5] = ["trans_btn", "icon_pen"];
- buttonArr[6] = ["optional_btn", "icon_optional"];
- buttonArr[7] = ["flow_btn", "icon_flow"];
- buttonArr[8] = ["group_btn", "icon_group"];
- buttonArr[9] = ["preview_btn", "icon_preview", "preview_btn_click_target"];
- buttonArr[10] = ["optional_act_btn", "icon_optional"];
- buttonArr[11] = ["optional_seq_btn", "icon_optional"];
- buttonArr[12] = ["gate_btn", "icon_gate"];
- buttonArr[13] = ["branch_btn", "icon_branch"];
-
- } else {
- buttonArr[0] = ["apply_changes_btn", "icon_saveDesign"];
- buttonArr[1] = ["cancel_btn", "icon_cancel"];
- buttonArr[2] = ["spacer", null];
- buttonArr[3] = ["copy_btn", "icon_copy"];
- buttonArr[4] = ["paste_btn", "icon_paste"];
- buttonArr[5] = ["trans_btn", "icon_pen"];
- buttonArr[6] = ["optional_btn", "icon_optional"];
- buttonArr[7] = ["flow_btn", "icon_flow"];
- buttonArr[8] = ["group_btn", "icon_group"];
- buttonArr[9] = ["optional_act_btn", "icon_optional"];
- buttonArr[10] = ["optional_seq_btn", "icon_optional"];
- buttonArr[11] = ["gate_btn", "icon_gate"];
- buttonArr[12] = ["branch_btn", "icon_branch"];
-
- }
-
- setChanged();
-
- //send an update
- infoObj = {};
- infoObj.updateType = "SETMENU";
- infoObj.data = buttonArr;
- notifyObservers(infoObj);
-
- }
-
- /**
- * set the button state to enabled/disabled and set a changed flag and notify view and controller.
- */
- public function setDefaultState(){
- Debugger.log('setDefaultState is called: ',Debugger.GEN,'setDefaultState','Toolbar');
- setButtonState("preview_btn", false);
- setButtonState("preview_btn_click_target", true);
- }
-
- /**
- *
- * @usage
- * @param btnName
- * @param btnState
- * @return
- */
- public function setButtonState(btnName:String, btnState:Boolean, btnVisible:Boolean){
- Debugger.log('button name in setButtonState is : '+btnName, Debugger.GEN,'setButtonState','ToolbarModel');
-
- setChanged();
- infoObj = {};
- infoObj.updateType = "BUTTON";
- infoObj.button = btnName;
- infoObj.buttonstate = btnState;
- infoObj.buttonvisible = btnVisible;
- 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;
- }
-
- /**
- * Used by View to get the button state enabled/disabled
- * @returns Object containing true or false . obj.newbtnstate
- */
- public function getState():Object{
- var s:Object = {};
- s.newbtnstate = _btnState;
- 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;
- }
-
- //Acessors for x + y coordinates
- public function get x():Number{
- return __x;
- }
-
- public function get y():Number{
- return __y;
- }
-
- //Acessors for w + h
- public function get width():Number{
- return __width;
- }
-
- public function get mode():Number{
- return _mode;
- }
-
- public function set mode(a:Number){
- _mode = a;
- }
-
- public function get height():Number{
- return __height;
- }
-
-
- public function getToolbar():Toolbar{
- return _tv;
- }
+ }
+
+ /**
+ * 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);
+ }
+
+ public function toolbarButtons(){
+ var buttonArr:Array = new Array();
+
+ if(mode != Toolbar.EDIT_MODE) {
+
+ buttonArr[0] = ["new_btn", "icon_newDesign"];
+ buttonArr[1] = ["open_btn", "icon_openDesign"];
+ buttonArr[2] = ["save_btn", "icon_saveDesign"];
+ buttonArr[3] = ["copy_btn", "icon_copy"];
+ buttonArr[4] = ["paste_btn", "icon_paste"];
+ buttonArr[5] = ["trans_btn", "icon_pen"];
+ buttonArr[6] = ["optional_btn", "icon_optional"];
+ buttonArr[7] = ["flow_btn", "icon_flow"];
+ buttonArr[8] = ["group_btn", "icon_group"];
+ buttonArr[9] = ["preview_btn", "icon_preview", "preview_btn_click_target"];
+ buttonArr[10] = ["optional_act_btn", "icon_optional"];
+ buttonArr[11] = ["optional_seq_btn", "icon_optional"];
+ buttonArr[12] = ["gate_btn", "icon_gate"];
+ buttonArr[13] = ["branch_btn", "icon_branch"];
+
+ } else {
+ buttonArr[0] = ["apply_changes_btn", "icon_saveDesign"];
+ buttonArr[1] = ["cancel_btn", "icon_cancel"];
+ buttonArr[2] = ["spacer", null];
+ buttonArr[3] = ["copy_btn", "icon_copy"];
+ buttonArr[4] = ["paste_btn", "icon_paste"];
+ buttonArr[5] = ["trans_btn", "icon_pen"];
+ buttonArr[6] = ["optional_btn", "icon_optional"];
+ buttonArr[7] = ["flow_btn", "icon_flow"];
+ buttonArr[8] = ["group_btn", "icon_group"];
+ buttonArr[9] = ["optional_act_btn", "icon_optional"];
+ buttonArr[10] = ["optional_seq_btn", "icon_optional"];
+ buttonArr[11] = ["gate_btn", "icon_gate"];
+ buttonArr[12] = ["branch_btn", "icon_branch"];
+
+ }
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "SETMENU";
+ infoObj.data = buttonArr;
+ notifyObservers(infoObj);
+
+ }
+
+ /**
+ * set the button state to enabled/disabled and set a changed flag and notify view and controller.
+ */
+ public function setDefaultState(){
+ Debugger.log('setDefaultState is called: ',Debugger.GEN,'setDefaultState','Toolbar');
+ setButtonState("preview_btn", false);
+ setButtonState("preview_btn_click_target", true);
+ }
+
+ /**
+ *
+ * @usage
+ * @param btnName
+ * @param btnState
+ * @return
+ */
+ public function setButtonState(btnName:String, btnState:Boolean, btnVisible:Boolean){
+ Debugger.log('button name in setButtonState is : '+btnName, Debugger.GEN,'setButtonState','ToolbarModel');
+
+ setChanged();
+ infoObj = {};
+ infoObj.updateType = "BUTTON";
+ infoObj.button = btnName;
+ infoObj.buttonstate = btnState;
+ infoObj.buttonvisible = btnVisible;
+ 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;
+ }
+
+ /**
+ * Used by View to get the button state enabled/disabled
+ * @returns Object containing true or false . obj.newbtnstate
+ */
+ public function getState():Object{
+ var s:Object = {};
+ s.newbtnstate = _btnState;
+ 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;
+ }
+
+ //Acessors for x + y coordinates
+ public function get x():Number{
+ return __x;
+ }
+
+ public function get y():Number{
+ return __y;
+ }
+
+ //Acessors for w + h
+ public function get width():Number{
+ return __width;
+ }
+
+ public function get mode():Number{
+ return _mode;
+ }
+
+ public function set mode(a:Number){
+ _mode = a;
+ }
+
+ public function get height():Number{
+ return __height;
+ }
+
+
+ public function getToolbar():Toolbar{
+ return _tv;
+ }
}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarView.as (.../ToolbarView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tb/ToolbarView.as (.../ToolbarView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,141 +1,141 @@
-/***************************************************************************
- * 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.ui.*
-import org.lamsfoundation.lams.common.util.*
+/***************************************************************************
+ * 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.ui.*
+import org.lamsfoundation.lams.common.util.*
import org.lamsfoundation.lams.authoring.Application
import org.lamsfoundation.lams.authoring.tb.*
-import org.lamsfoundation.lams.common.mvc.*
-import org.lamsfoundation.lams.common.style.*
-import org.lamsfoundation.lams.common.dict.*
-import mx.managers.*
-import mx.controls.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.common.dict.*
+import mx.managers.*
+import mx.controls.*
/*
* Authoring view for the toolbar
*/
class ToolbarView extends AbstractView {
-
+
//Toolbar clip
- private var _toolbar_mc:MovieClip;
- private var _tm:ThemeManager;
- private var _tip:ToolTip;
-
- private var btnOffset_X:Number = 4;
- private var btnOffset_Y:Number = 6;
-
- private var new_btn:Button;
- private var open_btn:Button;
- private var save_btn:Button;
- private var apply_changes_btn:Button;
-
- private var copy_btn:Button;
- private var paste_btn:Button;
-
- private var trans_btn:Button;
-
- private var optional_btn:Button;
- private var optional_act_btn:Button;
- private var optional_seq_btn:Button;
-
- private var gate_btn:Button;
- private var flow_btn:Button;
- private var branch_btn:Button;
-
- private var group_btn:Button;
- private var preview_btn:Button;
- private var preview_btn_click_target:Button;
-
- private var cancel_btn:Button;
-
- private var _toolbarMenu:Array;
-
- private var bkg_pnl:Panel;
- private var flow_bkg_pnl:Panel;
- private var optional_bkg_pnl:Panel;
-
- private var _dictionary:Dictionary;
-
- private static var SPACER_DEPTH:Number = 30;
- private static var SPACER_WIDTH:Number = 20;
-
- //Defined so compiler can 'see' events added at runtime by EventDispatcher
- private var dispatchEvent:Function;
- public var addEventListener:Function;
- public var removeEventListener:Function;
-
- //Compiler needs this, will be overwtitten when mx.managers imported through MovieClip.prototype
- public var createChildAtDepth:Function;
-
+ private var _toolbar_mc:MovieClip;
+ private var _tm:ThemeManager;
+ private var _tip:ToolTip;
+
+ private var btnOffset_X:Number = 4;
+ private var btnOffset_Y:Number = 6;
+
+ private var new_btn:Button;
+ private var open_btn:Button;
+ private var save_btn:Button;
+ private var apply_changes_btn:Button;
+
+ private var copy_btn:Button;
+ private var paste_btn:Button;
+
+ private var trans_btn:Button;
+
+ private var optional_btn:Button;
+ private var optional_act_btn:Button;
+ private var optional_seq_btn:Button;
+
+ private var gate_btn:Button;
+ private var flow_btn:Button;
+ private var branch_btn:Button;
+
+ private var group_btn:Button;
+ private var preview_btn:Button;
+ private var preview_btn_click_target:Button;
+
+ private var cancel_btn:Button;
+
+ private var _toolbarMenu:Array;
+
+ private var bkg_pnl:Panel;
+ private var flow_bkg_pnl:Panel;
+ private var optional_bkg_pnl:Panel;
+
+ private var _dictionary:Dictionary;
+
+ private static var SPACER_DEPTH:Number = 30;
+ private static var SPACER_WIDTH:Number = 20;
+
+ //Defined so compiler can 'see' events added at runtime by EventDispatcher
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ //Compiler needs this, will be overwtitten when mx.managers imported through MovieClip.prototype
+ public var createChildAtDepth:Function;
+
/*
* Constructor
*/
- public function ToolbarView (){
- //Set up to use Flash Event Delegation model
+ public function ToolbarView (){
+ //Set up to use Flash Event Delegation model
- mx.events.EventDispatcher.initialize(this);
- _tm = ThemeManager.getInstance();
- _dictionary = Dictionary.getInstance();
- _tip = new ToolTip();
- }
-
- /**
- * called by container. Sets up MVC and schedules createToolbar() for a frame later
- */
- public function init(m:Observable, c:Controller) {
- //Invoke superconstructor, which sets up MVC relationships.
- super (m, c);
-
- //In one frame call createToolbar this gives components one frame to setup etc.
- MovieClipUtils.doLater(Proxy.create(this,createToolbar));
-
- this.tabChildren = true;
- setTabIndex();
- }
-
- public function showHideAssets(v:Boolean){
- showHideFlowAssets(v);
- showHideOptAssets(v);
- }
-
- public function showHideFlowAssets(v:Boolean){
- gate_btn.visible = v;
- branch_btn.visible = v;
- flow_bkg_pnl.visible = v;
-
- flow_bkg_pnl.setSize(Math.max(Math.max(flow_btn.width, gate_btn.width), Math.max(flow_btn.width, branch_btn.width)) + 6, 95)
- flow_bkg_pnl._x = branch_btn._x - 3;
- }
-
- public function showHideOptAssets(v:Boolean){
- optional_act_btn.visible = v;
- optional_seq_btn.visible = v;
- optional_bkg_pnl.visible = v;
-
- optional_bkg_pnl.setSize(Math.max(Math.max(optional_btn.width, optional_act_btn.width), Math.max(optional_btn.width, optional_seq_btn.width)) + 6, 95);
- optional_bkg_pnl._x = optional_act_btn._x - 3;
- }
+ mx.events.EventDispatcher.initialize(this);
+ _tm = ThemeManager.getInstance();
+ _dictionary = Dictionary.getInstance();
+ _tip = new ToolTip();
+ }
+ /**
+ * called by container. Sets up MVC and schedules createToolbar() for a frame later
+ */
+ public function init(m:Observable, c:Controller) {
+ //Invoke superconstructor, which sets up MVC relationships.
+ super (m, c);
+
+ //In one frame call createToolbar this gives components one frame to setup etc.
+ MovieClipUtils.doLater(Proxy.create(this,createToolbar));
+
+ this.tabChildren = true;
+ setTabIndex();
+ }
+
+ public function showHideAssets(v:Boolean){
+ showHideFlowAssets(v);
+ showHideOptAssets(v);
+ }
+
+ public function showHideFlowAssets(v:Boolean){
+ gate_btn.visible = v;
+ branch_btn.visible = v;
+ flow_bkg_pnl.visible = v;
+
+ flow_bkg_pnl.setSize(Math.max(Math.max(flow_btn.width, gate_btn.width), Math.max(flow_btn.width, branch_btn.width)) + 6, 95)
+ flow_bkg_pnl._x = branch_btn._x - 3;
+ }
+
+ public function showHideOptAssets(v:Boolean){
+ optional_act_btn.visible = v;
+ optional_seq_btn.visible = v;
+ optional_bkg_pnl.visible = v;
+
+ optional_bkg_pnl.setSize(Math.max(Math.max(optional_btn.width, optional_act_btn.width), Math.max(optional_btn.width, optional_seq_btn.width)) + 6, 95);
+ optional_bkg_pnl._x = optional_act_btn._x - 3;
+ }
+
/*
* Creates toolbar clip
*
@@ -144,353 +144,353 @@
* @param x x pos in pixels
* @param y y pos in pixels
*/
- public function createToolbar(){
- setStyles();
- _toolbar_mc = this;
-
- //Add the button handlers, essentially this is handing on clicked event to controller.
- var controller = getController();
-
- new_btn.addEventListener("click", controller);
- open_btn.addEventListener("click", controller);
- save_btn.addEventListener("click", controller);
- copy_btn.addEventListener("click", controller);
- paste_btn.addEventListener("click", controller);
- trans_btn.addEventListener("click", controller);
- optional_btn.addEventListener("click", controller);
- optional_act_btn.addEventListener("click", controller);
- optional_seq_btn.addEventListener("click", controller);
- flow_btn.addEventListener("click", controller);
- gate_btn.addEventListener("click", controller);
- group_btn.addEventListener("click", controller);
- branch_btn.addEventListener("click", controller);
- preview_btn.addEventListener("click", controller);
- preview_btn_click_target.addEventListener("click", controller);
-
- apply_changes_btn.addEventListener("click", controller);
- cancel_btn.addEventListener("click", controller);
-
- // Button handler for rollover and rollout.
-
- new_btn.onRollOver = Proxy.create(this,this['showToolTip'], new_btn, "new_btn_tooltip");
- new_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- open_btn.onRollOver = Proxy.create(this,this['showToolTip'], open_btn, "open_btn_tooltip");
- open_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- save_btn.onRollOver = Proxy.create(this,this['showToolTip'], save_btn, "save_btn_tooltip");
- save_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- copy_btn.onRollOver = Proxy.create(this,this['showToolTip'], copy_btn, "copy_btn_tooltip");
- copy_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- paste_btn.onRollOver = Proxy.create(this,this['showToolTip'], paste_btn, "paste_btn_tooltip");
- paste_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- trans_btn.onRollOver = Proxy.create(this,this['showToolTip'], trans_btn, "trans_btn_tooltip");
- trans_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- optional_btn.onRollOver = Proxy.create(this,this['showToolTip'], optional_btn, "optional_btn_tooltip");
- optional_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- flow_btn.onRollOver = Proxy.create(this,this['showToolTip'], flow_btn, "flow_btn_tooltip");
- flow_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- gate_btn.onRollOver = Proxy.create(this,this['showToolTip'], gate_btn, "gate_btn_tooltip");
- gate_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- branch_btn.onRollOver = Proxy.create(this,this['showToolTip'], branch_btn, "branch_btn_tooltip");
- branch_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- optional_act_btn.onRollOver = Proxy.create(this,this['showToolTip'], optional_act_btn, "optional_btn_tooltip");
- optional_act_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- optional_seq_btn.onRollOver = Proxy.create(this,this['showToolTip'], optional_seq_btn, "optional_seq_btn_tooltip");
- optional_seq_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- group_btn.onRollOver = Proxy.create(this,this['showToolTip'], group_btn, "group_btn_tooltip");
- group_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- preview_btn.onRollOver = Proxy.create(this,this['showToolTip'], preview_btn, "preview_btn_tooltip");
- preview_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- preview_btn_click_target.onRollOver = Proxy.create(this,this['showToolTip'], preview_btn, "preview_btn_tooltip");
- preview_btn_click_target.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- apply_changes_btn.onRollOver = Proxy.create(this,this['showToolTip'], apply_changes_btn, "apply_changes_btn_tooltip");
- apply_changes_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- cancel_btn.onRollOver = Proxy.create(this,this['showToolTip'], cancel_btn, "cancel_btn_tooltip");
- cancel_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- showHideAssets(false);
-
- Debugger.log('dispatch it',Debugger.GEN,'createToolbar','ToolbarView');
-
- //Now that view is setup dispatch loaded event
- dispatchEvent({type:'load',target:this});
- }
-
- public function setupLabels(){
-
- new_btn.label = Dictionary.getValue('new_btn');
- open_btn.label = Dictionary.getValue('open_btn');
- save_btn.label = Dictionary.getValue('save_btn');
- copy_btn.label = Dictionary.getValue('copy_btn');
- paste_btn.label = Dictionary.getValue('paste_btn');
- trans_btn.label = Dictionary.getValue('trans_btn');
- optional_btn.label = Dictionary.getValue('optional_btn');
- optional_act_btn.label = Dictionary.getValue('optional_act_btn');
- optional_seq_btn.label = Dictionary.getValue('optional_seq_btn');
- gate_btn.label = Dictionary.getValue('gate_btn');
- branch_btn.label = Dictionary.getValue('branch_btn');
- flow_btn.label = Dictionary.getValue('flow_btn');
- group_btn.label = Dictionary.getValue('group_btn');
- preview_btn.label = Dictionary.getValue('preview_btn');
- apply_changes_btn.label = Dictionary.getValue('apply_changes_btn');
- cancel_btn.label = Dictionary.getValue('cancel_btn');
+ public function createToolbar(){
+ setStyles();
+ _toolbar_mc = this;
+
+ //Add the button handlers, essentially this is handing on clicked event to controller.
+ var controller = getController();
+
+ new_btn.addEventListener("click", controller);
+ open_btn.addEventListener("click", controller);
+ save_btn.addEventListener("click", controller);
+ copy_btn.addEventListener("click", controller);
+ paste_btn.addEventListener("click", controller);
+ trans_btn.addEventListener("click", controller);
+ optional_btn.addEventListener("click", controller);
+ optional_act_btn.addEventListener("click", controller);
+ optional_seq_btn.addEventListener("click", controller);
+ flow_btn.addEventListener("click", controller);
+ gate_btn.addEventListener("click", controller);
+ group_btn.addEventListener("click", controller);
+ branch_btn.addEventListener("click", controller);
+ preview_btn.addEventListener("click", controller);
+ preview_btn_click_target.addEventListener("click", controller);
+
+ apply_changes_btn.addEventListener("click", controller);
+ cancel_btn.addEventListener("click", controller);
+
+ // Button handler for rollover and rollout.
+
+ new_btn.onRollOver = Proxy.create(this,this['showToolTip'], new_btn, "new_btn_tooltip");
+ new_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ open_btn.onRollOver = Proxy.create(this,this['showToolTip'], open_btn, "open_btn_tooltip");
+ open_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ save_btn.onRollOver = Proxy.create(this,this['showToolTip'], save_btn, "save_btn_tooltip");
+ save_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ copy_btn.onRollOver = Proxy.create(this,this['showToolTip'], copy_btn, "copy_btn_tooltip");
+ copy_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ paste_btn.onRollOver = Proxy.create(this,this['showToolTip'], paste_btn, "paste_btn_tooltip");
+ paste_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ trans_btn.onRollOver = Proxy.create(this,this['showToolTip'], trans_btn, "trans_btn_tooltip");
+ trans_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ optional_btn.onRollOver = Proxy.create(this,this['showToolTip'], optional_btn, "optional_btn_tooltip");
+ optional_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ flow_btn.onRollOver = Proxy.create(this,this['showToolTip'], flow_btn, "flow_btn_tooltip");
+ flow_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ gate_btn.onRollOver = Proxy.create(this,this['showToolTip'], gate_btn, "gate_btn_tooltip");
+ gate_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ branch_btn.onRollOver = Proxy.create(this,this['showToolTip'], branch_btn, "branch_btn_tooltip");
+ branch_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ optional_act_btn.onRollOver = Proxy.create(this,this['showToolTip'], optional_act_btn, "optional_btn_tooltip");
+ optional_act_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ optional_seq_btn.onRollOver = Proxy.create(this,this['showToolTip'], optional_seq_btn, "optional_seq_btn_tooltip");
+ optional_seq_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ group_btn.onRollOver = Proxy.create(this,this['showToolTip'], group_btn, "group_btn_tooltip");
+ group_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ preview_btn.onRollOver = Proxy.create(this,this['showToolTip'], preview_btn, "preview_btn_tooltip");
+ preview_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ preview_btn_click_target.onRollOver = Proxy.create(this,this['showToolTip'], preview_btn, "preview_btn_tooltip");
+ preview_btn_click_target.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ apply_changes_btn.onRollOver = Proxy.create(this,this['showToolTip'], apply_changes_btn, "apply_changes_btn_tooltip");
+ apply_changes_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ cancel_btn.onRollOver = Proxy.create(this,this['showToolTip'], cancel_btn, "cancel_btn_tooltip");
+ cancel_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ showHideAssets(false);
+
+ Debugger.log('dispatch it',Debugger.GEN,'createToolbar','ToolbarView');
+
+ //Now that view is setup dispatch loaded event
+ dispatchEvent({type:'load',target:this});
+ }
+
+ public function setupLabels(){
+
+ new_btn.label = Dictionary.getValue('new_btn');
+ open_btn.label = Dictionary.getValue('open_btn');
+ save_btn.label = Dictionary.getValue('save_btn');
+ copy_btn.label = Dictionary.getValue('copy_btn');
+ paste_btn.label = Dictionary.getValue('paste_btn');
+ trans_btn.label = Dictionary.getValue('trans_btn');
+ optional_btn.label = Dictionary.getValue('optional_btn');
+ optional_act_btn.label = Dictionary.getValue('optional_act_btn');
+ optional_seq_btn.label = Dictionary.getValue('optional_seq_btn');
+ gate_btn.label = Dictionary.getValue('gate_btn');
+ branch_btn.label = Dictionary.getValue('branch_btn');
+ flow_btn.label = Dictionary.getValue('flow_btn');
+ group_btn.label = Dictionary.getValue('group_btn');
+ preview_btn.label = Dictionary.getValue('preview_btn');
+ apply_changes_btn.label = Dictionary.getValue('apply_changes_btn');
+ cancel_btn.label = Dictionary.getValue('cancel_btn');
- }
-
- private function setTabIndex(selectedTab:String){
-
- //All Buttons Tab Index
- new_btn.tabIndex = 201
- open_btn.tabIndex = 202
- save_btn.tabIndex = 203
- apply_changes_btn.tabIndex = 204
- copy_btn.tabIndex = 205
- paste_btn.tabIndex = 206
- trans_btn.tabIndex = 207
- optional_btn.tabIndex = 208
- optional_act_btn.tabIndex = 209
- optional_seq_btn.tabIndex = 210
- flow_btn.tabIndex = 211
- gate_btn.tabIndex = 212
- branch_btn.tabIndex = 213
- group_btn.tabIndex = 214
- preview_btn.tabIndex = 215
- cancel_btn.tabIndex = 216
- }
-
- public function setupButtons(tm:ToolbarModel, menuList:Array){
-
- _toolbarMenu = new Array();
-
- for (var i=0; i= menuList.length-4) && (i < menuList.length-2)) {
- _toolbarMenu[i]._x = this.optional_btn._x;
- _toolbarMenu[i]._y = (_toolbarMenu[i-1]._y+_toolbarMenu[i-1].height)+btnOffset_Y;
-
- }
-
- if (i >= menuList.length-2){
- _toolbarMenu[i]._x = this.flow_btn._x;
- _toolbarMenu[i]._y = (_toolbarMenu[i-3]._y+_toolbarMenu[i-3].height)+btnOffset_Y;
- }
-
- if (i == menuList.length){
- btn_text.removeTextField();
- }
-
- if(_toolbarMenu[i].clickTarget != null) {
- _toolbarMenu[i].clickTarget.btn._x = _toolbarMenu[i]._x;
- _toolbarMenu[i].clickTarget.btn._y = _toolbarMenu[i]._y;
- }
-
- }
-
-
- }
-
- }
-
- 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');
- this[infoObj.button].enabled = infoObj.buttonstate;
- this[infoObj.button].visible = (infoObj.buttonvisible != null) ? infoObj.buttonvisible : true ;
- }
-
- 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 = ApplicationParent.tooltip;
- var ttMessage = Dictionary.getValue(btnTT);
-
- if(btnObj == preview_btn && !btnObj.enabled)
- ttMessage = Dictionary.getValue(btnTT + "_disabled");
-
- _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
- 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);
- optional_act_btn.setStyle('styleName',styleObj);
- optional_seq_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);
- preview_btn_click_target.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);
- optional_bkg_pnl.setStyle('styleName',styleObj);
-
- }
-
- public function isOptionalPanelVisible():Boolean {
- return optional_bkg_pnl.visible;
- }
-
+ private function setTabIndex(selectedTab:String){
+
+ //All Buttons Tab Index
+ new_btn.tabIndex = 201
+ open_btn.tabIndex = 202
+ save_btn.tabIndex = 203
+ apply_changes_btn.tabIndex = 204
+ copy_btn.tabIndex = 205
+ paste_btn.tabIndex = 206
+ trans_btn.tabIndex = 207
+ optional_btn.tabIndex = 208
+ optional_act_btn.tabIndex = 209
+ optional_seq_btn.tabIndex = 210
+ flow_btn.tabIndex = 211
+ gate_btn.tabIndex = 212
+ branch_btn.tabIndex = 213
+ group_btn.tabIndex = 214
+ preview_btn.tabIndex = 215
+ cancel_btn.tabIndex = 216
+ }
+
+ public function setupButtons(tm:ToolbarModel, menuList:Array){
+
+ _toolbarMenu = new Array();
+
+ for (var i=0; i= menuList.length-4) && (i < menuList.length-2)) {
+ _toolbarMenu[i]._x = this.optional_btn._x;
+ _toolbarMenu[i]._y = (_toolbarMenu[i-1]._y+_toolbarMenu[i-1].height)+btnOffset_Y;
+
+ }
+
+ if (i >= menuList.length-2){
+ _toolbarMenu[i]._x = this.flow_btn._x;
+ _toolbarMenu[i]._y = (_toolbarMenu[i-3]._y+_toolbarMenu[i-3].height)+btnOffset_Y;
+ }
+
+ if (i == menuList.length){
+ btn_text.removeTextField();
+ }
+
+ if(_toolbarMenu[i].clickTarget != null) {
+ _toolbarMenu[i].clickTarget.btn._x = _toolbarMenu[i]._x;
+ _toolbarMenu[i].clickTarget.btn._y = _toolbarMenu[i]._y;
+ }
+
+ }
+
+
+ }
+
+ }
+
+ 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');
+ this[infoObj.button].enabled = infoObj.buttonstate;
+ this[infoObj.button].visible = (infoObj.buttonvisible != null) ? infoObj.buttonvisible : true ;
+ }
+
+ 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 = ApplicationParent.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+
+ if(btnObj == preview_btn && !btnObj.enabled)
+ ttMessage = Dictionary.getValue(btnTT + "_disabled");
+
+ _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
+ 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);
+ optional_act_btn.setStyle('styleName',styleObj);
+ optional_seq_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);
+ preview_btn_click_target.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);
+ optional_bkg_pnl.setStyle('styleName',styleObj);
+
+ }
+
+ public function isOptionalPanelVisible():Boolean {
+ return optional_bkg_pnl.visible;
+ }
+
public function isFlowPanelVisible():Boolean {
return flow_bkg_pnl.visible;
- }
-
- /**
- * 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);
- }
-
- public function get toolbarMenu():Array {
- return _toolbarMenu;
}
+
+ /**
+ * 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);
+ }
+
+ public function get toolbarMenu():Array {
+ return _toolbarMenu;
+ }
}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/TemplateActivity.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/TemplateActivity.as (.../TemplateActivity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/TemplateActivity.as (.../TemplateActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,355 +1,355 @@
-/***************************************************************************
- * 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.*;
+/***************************************************************************
+ * 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.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;
+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 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
+ 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 _activities:Array;
+ private var _mainActivity:Activity;
+ private var _childActivities:Array;
+ private var yPos:Number;
- private var _toolkitView:ToolkitView;
-
+ private var _toolkitView:ToolkitView;
+
/**
* Constructor - creates an onEnterFrame doLater call to init
- */
+ */
function TemplateActivity() {
-
- _tm = ThemeManager.getInstance();
- _childActivities = new Array();
- //Tip = new ToolTip();
- //ttHolder = ApplicationParent.tooltip;
- //let it wait one frame to set up the components.
+
+ _tm = ThemeManager.getInstance();
+ _childActivities = new Array();
+ //Tip = new ToolTip();
+ //ttHolder = ApplicationParent.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;
+ */
+ 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();
- }
-
-
+ var tkv = ToolkitView(_toolkitView);
-
- icon_mcl = new MovieClipLoader();
- icon_mcl.addListener(this);
+
+ //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']);
+ 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();
-
+ 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);
- }
- }
+
+ /*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();
-
+ /**
+ * 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
- Debugger.log("_mainActivity.title: "+_mainActivity.title, Debugger.CRITICAL, "draw", "TemplateActivity");
- if (toolTitle.length > 15){
- toolTitle = toolTitle.substr(0, 15)+"..."
- }
-
+ private function draw():Void{
+ var toolTitle:String = _mainActivity.title
+ Debugger.log("_mainActivity.title: "+_mainActivity.title, Debugger.CRITICAL, "draw", "TemplateActivity");
+ if (toolTitle.length > 15){
+ toolTitle = toolTitle.substr(0, 15)+"..."
+ }
+
title_lbl.text= toolTitle;
- //attach the icon now...
- var ICON_OFFSETX = 3;
+ //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');
- bkg_pnl.setStyle('styleName',_taPanelStyle);
- styleObj = _tm.getStyleObject('label');
- title_lbl.setStyle('styleName',styleObj);
- }
-
- /**
- * @depricated
- *
- * Gets this TemplateActivity's data
- */
- public function get toolActivity():Object{
- 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();
+ 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');
+ bkg_pnl.setStyle('styleName',_taPanelStyle);
+ styleObj = _tm.getStyleObject('label');
+ title_lbl.setStyle('styleName',styleObj);
+ }
+
+ /**
+ * @depricated
+ *
+ * Gets this TemplateActivity's data
+ */
+ public function get toolActivity():Object{
+ 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{
+
+ private function select():Void{
_toolkitView.hideToolTip();
- var toolkitController = _toolkitView.getController();
+ 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;
- }
-
- public function get title():String {
- return title_lbl.text;
- }
-
+ }
+
+ 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;
+ }
+
+ public function get title():String {
+ return title_lbl.text;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/Toolkit.as
===================================================================
diff -u -r470bd43cd17fa6128a767fec948850a5815c1c55 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/Toolkit.as (.../Toolkit.as) (revision 470bd43cd17fa6128a767fec948850a5815c1c55)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/Toolkit.as (.../Toolkit.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,319 +1,319 @@
-/***************************************************************************
- * 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(this);
-
- //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('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,'setToolkitLibraries','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
+ 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;
-
- var ta:TemplateActivity = _toolkitModel.getSelectedTemplateActivity();
-
- if(optionalOnCanvas[i].locked){
- var msg:String = (!optionalOnCanvas[i].activity.isSequenceBased) ? Dictionary.getValue('act_lock_chk') : Dictionary.getValue('act_seq_lock_chk');
- LFMessage.showMessageAlert(msg);
- } else if(optionalOnCanvas[i].activity.isSequenceBased && optionalOnCanvas[i].activity.noSequences <= 0) {
- var msg:String = Dictionary.getValue('ta_iconDrop_optseq_error_msg');
- LFMessage.showMessageAlert(msg);
- } else {
- if(optionalOnCanvas[i].activity.isSequenceBased) {
- // test mouse ptr
- var _children:Array = optionalOnCanvas[i].children;
-
- var sequenceDropUIID:Number = null;
- var sequence = null;
-
- var mouseX = (cv.getCanvasModel().activeView instanceof CanvasComplexView) ? cv.model.activeView.content._xmouse : cv.model.activeView.content._xmouse - optionalX;
- var mouseY = (cv.getCanvasModel().activeView instanceof CanvasComplexView) ? cv.model.activeView.content._ymouse : cv.model.activeView.content._ymouse - optionalY;
-
- for(var j=0; j<_children.length; j++) {
- if(mouseX >= _children[j].activity.xCoord &&
- mouseX <= (_children[j].activity.xCoord + _children[j]._width) &&
- mouseY >= _children[j].activity.yCoord &&
- mouseY <= (_children[j].activity.yCoord + _children[j]._height)) {
- sequenceDropUIID = _children[j].activity.activityUIID;
- sequence = _children[j];
- break;
- }
- }
-
- if(sequenceDropUIID != null && sequence != null) {
- cv.setDroppedTemplateActivity(ta, sequenceDropUIID, sequence);
- } else {
- var msg:String = Dictionary.getValue('activityDrop_optSequence_error_msg');
- LFMessage.showMessageAlert(msg);
- }
-
- } else { cv.setDroppedTemplateActivity(ta, optionalOnCanvas[i].activity.activityUIID); }
- }
- }
- }
- }
-
- //remove the drag icon
- dragIcon_mc.removeMovieClip();
-
- Debugger.log("canvas drop: " + isCanvasDrop, Debugger.CRITICAL, "iconDrop", "ToolkitController");
-
- if(isCanvasDrop && !(cv.getCanvasModel().activeView instanceof CanvasComplexView)){
- var ta:TemplateActivity;
+ super (cm);
+ _toolkitModel = ToolkitModel(model);
+ //Debugger.log('fINISHED',4,'Constructor','ToolkitController');
+ }
+
+ /**
+ *Called by ToolkitActivity when one in clicked
+ * @param toolkitActivity - the toolkitActivity that was clicked
+ */
+ public function selectTemplateActivity(templateActivity:TemplateActivity):Void{
+ //Debugger.log('templateActivity:'+templateActivity.getTemplateActivityData().title,4,'selectTemplateActivity','ToolkitController');
+ //_global.breakpoint();
+ _toolkitModel = ToolkitModel(model);
+ _toolkitModel.setSelectedTemplateActivity(templateActivity);
+
+ app = Application.getInstance();
+ app.toolbar.view.getController().hideOptionPanels();
+ }
+
+ /**
+ *Called by the view when a template activity icon is dropped
+ */
+ public function iconDrop(dragIcon_mc:MovieClip):Void{
+ //lets do a test to see if we got the canvas
+ var cv:Canvas = Application.getInstance().getCanvas();
+ var canvasView:MovieClip = cv.getCanvasModel().activeView.content;
+
+ var iconMouseX = (cv.getCanvasModel().activeView instanceof CanvasComplexView)? cv.getCanvasModel().activeView.content._xmouse : _xmouse - cv.model.getPosition().x;
+ var iconMouseY = (cv.getCanvasModel().activeView instanceof CanvasComplexView)? cv.getCanvasModel().activeView.content._ymouse : _ymouse - cv.model.getPosition().y;
+
+ if(cv.getCanvasModel().activeView instanceof CanvasView) {
+ iconMouseX += cv.model.activeView.getScrollPaneHPosition();
+ iconMouseY += cv.model.activeView.getScrollPaneVPosition();
+ } else if(cv.getCanvasModel().activeView instanceof CanvasBranchView) {
+ iconMouseX -= CanvasBranchView.hSpace;
+ iconMouseY -= CanvasBranchView.vSpace;
+ }
+
+ Debugger.log("iconMouseX: "+iconMouseX+" iconMouseY: "+iconMouseY, Debugger.GEN, "iconDrop", "ToolkitController");
+ Debugger.log("av: " + (cv.getCanvasModel().activeView instanceof CanvasComplexView), Debugger.GEN, "iconDrop", "ToolkitController");
+
+ var optionalOnCanvas:Array = (cv.getCanvasModel().activeView instanceof CanvasComplexView) ? [cv.model.activeView.openActivity] : cv.getCanvasModel().findOptionalActivities();
+
+ //SEE IF ITS HIT the canvas
+ var isCanvasDrop:Boolean = cv.getCanvasModel().activeView.content.hitTest(dragIcon_mc);
+
+ Debugger.log('isCanvasDrop:'+isCanvasDrop,Debugger.GEN,'iconDrop','ToolkitController');
+
+ for(var i=0; i= optionalX && iconMouseX <= (optionalX + optionalWidth)){
+ if(iconMouseY >= optionalY && iconMouseY <= (optionalY + optionalHeight)){
+ isCanvasDrop = false;
+
+ var ta:TemplateActivity = _toolkitModel.getSelectedTemplateActivity();
+
+ if(optionalOnCanvas[i].locked){
+ var msg:String = (!optionalOnCanvas[i].activity.isSequenceBased) ? Dictionary.getValue('act_lock_chk') : Dictionary.getValue('act_seq_lock_chk');
+ LFMessage.showMessageAlert(msg);
+ } else if(optionalOnCanvas[i].activity.isSequenceBased && optionalOnCanvas[i].activity.noSequences <= 0) {
+ var msg:String = Dictionary.getValue('ta_iconDrop_optseq_error_msg');
+ LFMessage.showMessageAlert(msg);
+ } else {
+ if(optionalOnCanvas[i].activity.isSequenceBased) {
+ // test mouse ptr
+ var _children:Array = optionalOnCanvas[i].children;
+
+ var sequenceDropUIID:Number = null;
+ var sequence = null;
+
+ var mouseX = (cv.getCanvasModel().activeView instanceof CanvasComplexView) ? cv.model.activeView.content._xmouse : cv.model.activeView.content._xmouse - optionalX;
+ var mouseY = (cv.getCanvasModel().activeView instanceof CanvasComplexView) ? cv.model.activeView.content._ymouse : cv.model.activeView.content._ymouse - optionalY;
+
+ for(var j=0; j<_children.length; j++) {
+ if(mouseX >= _children[j].activity.xCoord &&
+ mouseX <= (_children[j].activity.xCoord + _children[j]._width) &&
+ mouseY >= _children[j].activity.yCoord &&
+ mouseY <= (_children[j].activity.yCoord + _children[j]._height)) {
+ sequenceDropUIID = _children[j].activity.activityUIID;
+ sequence = _children[j];
+ break;
+ }
+ }
+
+ if(sequenceDropUIID != null && sequence != null) {
+ cv.setDroppedTemplateActivity(ta, sequenceDropUIID, sequence);
+ } else {
+ var msg:String = Dictionary.getValue('activityDrop_optSequence_error_msg');
+ LFMessage.showMessageAlert(msg);
+ }
+
+ } else { cv.setDroppedTemplateActivity(ta, optionalOnCanvas[i].activity.activityUIID); }
+ }
+ }
+ }
+ }
+
+ //remove the drag icon
+ dragIcon_mc.removeMovieClip();
+
+ Debugger.log("canvas drop: " + isCanvasDrop, Debugger.CRITICAL, "iconDrop", "ToolkitController");
+
+ if(isCanvasDrop && !(cv.getCanvasModel().activeView instanceof CanvasComplexView)){
+ var ta:TemplateActivity;
ta = _toolkitModel.getSelectedTemplateActivity();
- Debugger.log('ta:'+ta.toolActivity.title,4,'canvasDrop','ToolkitController');
- cv.setDroppedTemplateActivity(ta);
- }
- }
-}
+ 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 -ra9608549c199d2aae45ee7729e4536f6545afe94 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitModel.as (.../ToolkitModel.as) (revision a9608549c199d2aae45ee7729e4536f6545afe94)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitModel.as (.../ToolkitModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,270 +1,268 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * 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.*;
-
+//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;
-
- private var toolkit:Toolkit;
-
- /**
- * View state data
- */
- private var _currentlySelectedTemplateActivity:TemplateActivity;
- private var _lastSelectedTemplateActivity:TemplateActivity;
- private var _currentToolkitDescription:String;
+ 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;
+
+ private var toolkit:Toolkit;
+
+ /**
+ * 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.
- */
+ /**
+ * Container for the Libraries. There maybe many template actvities per learning library.
+ * Currently (1.1) there is only ever one.
+ */
private var _toolkitLearningLibraries:Hashtable;
- private var _dispatchEvent:Boolean;
+ private var _dispatchEvent:Boolean;
/**
* Constructor.
*/
public function ToolkitModel(_toolkit:Toolkit){
- Debugger.log('Running',4,'Constructor','ToolkitModel');
- _toolkitLearningLibraries = new Hashtable();
- toolkit = _toolkit;
- _dispatchEvent = false;
- }
+ Debugger.log('Running',4,'Constructor','ToolkitModel');
+ _toolkitLearningLibraries = new Hashtable();
+ toolkit = _toolkit;
+ _dispatchEvent = false;
+ }
- /**
- * 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
- */
+ /**
+ * 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.
+ //_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 0) {
- //SET A DIRTY FLAG
- setChanged();
- //notify the view there has been a change
- infoObj = {};
- infoObj.updateType = "LIBRARIES_UPDATED";
+ _toolkitLearningLibraries.put(tls[i].learningLibraryID,tls[i]);
+ }
+
+ Debugger.log('Added '+tls.length+' Libraries to _toolkitLearningLibraries',4,'setToolkitLibraryActivities','ToolkitModel');
+
+ if(_dispatchEvent) {
+ //SET A DIRTY FLAG
+ setChanged();
+ //notify the view there has been a change
+ infoObj = {};
+ infoObj.updateType = "LIBRARIES_UPDATED";
//notify observer's this is "this" as if by magic
-
- notifyObservers(infoObj);
- }
- else {
- _dispatchEvent = true;
- toolkit.getToolkitLibraries();
- }
- }
-
- /**
- * Gets toolkit data
- */
- public function getToolkitLibraries():Hashtable{
- return _toolkitLearningLibraries;
+ notifyObservers(infoObj);
+ }
+
+ _dispatchEvent = false;
+
+ Debugger.log('Finished, about to return updateOk',4,'setToolkitLibraryActivities','ToolkitModel');
+ return updateOk;
+ }
+
+ public function broadcastLibraryUpdate() {
+ Debugger.log("tll size: " + _toolkitLearningLibraries.size(), Debugger.CRITICAL, "braodcastLibraryUpdate", "ToolkitModel");
+ if (_toolkitLearningLibraries.size() > 0) {
+ //SET A DIRTY FLAG
+ setChanged();
+ //notify the view there has been a change
+ infoObj = {};
+ infoObj.updateType = "LIBRARIES_UPDATED";
+ //notify observer's this is "this" as if by magic
+
+ notifyObservers(infoObj);
+ }
+ else {
+ _dispatchEvent = true;
+ toolkit.getToolkitLibraries();
+ }
}
-
- /**
- * Sets currecntly selected templateactivity
- */
- public function setSelectedTemplateActivity(templateActivity:TemplateActivity):Void{
+ /**
+ * Gets toolkit data
+ */
+ public function getToolkitLibraries():Hashtable{
+ return _toolkitLearningLibraries;
+ }
+
+ /**
+ * Sets currecntly selected templateactivity
+ */
+ public function setSelectedTemplateActivity(templateActivity:TemplateActivity):Void{
//Debugger.log('templateActivity:'+templateActivity,4,'setSelectedTemplateActivity','ToolkitModel');
-
-
+
+
//_global.breakpoint();
- //set the sates
- _lastSelectedTemplateActivity = _currentlySelectedTemplateActivity;
- _currentlySelectedTemplateActivity = templateActivity;
- //for observer thang
- setChanged();
- //send an update
- infoObj = {};
- infoObj.updateType = "TEMPLATE_ACTIVITY_SELECTED";
- notifyObservers(infoObj);
- }
-
- /**
- * Gets currecntly selected templateactivity
- */
- public function getSelectedTemplateActivity():TemplateActivity{
- return _currentlySelectedTemplateActivity;
- }
-
- /**
- * Gets last selected templateactivity
- */
- public function getLastSelectedTemplateActivity():TemplateActivity{
- return _lastSelectedTemplateActivity;
- }
-
- /**
- * Sends update to view for TOOL_DESCRIPTION
- */
- public function setToolkitDescription(desc:String):Void{
- _currentToolkitDescription = desc;
- infoObj.updateType = "TOOL_DESCRIPTION";
- //notify observer's this is "this" as if by magic
- notifyObservers(infoObj);
- }
-
- public function getToolkitDescription():String{
- return _currentToolkitDescription;
- }
-
- /**
- * Gets a learning Library using its ID
- * @usage
- * @param learningLibraryID
- * @return
- */
- public function getLearningLibrary(learningLibraryID:Number):Object{
- return _toolkitLearningLibraries.get(learningLibraryID);
- }
-
-
-
- /**
- * 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;
- }
-
- //Acessors for x + y coordinates
- public function get x():Number{
- return __x;
- }
-
- public function get y():Number{
- return __y;
- }
-
- //Acessors for x + y coordinates
- public function get width():Number{
- return __width;
- }
-
- public function get height():Number{
- return __height;
- }
+ //set the sates
+ _lastSelectedTemplateActivity = _currentlySelectedTemplateActivity;
+ _currentlySelectedTemplateActivity = templateActivity;
+ //for observer thang
+ setChanged();
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "TEMPLATE_ACTIVITY_SELECTED";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Gets currecntly selected templateactivity
+ */
+ public function getSelectedTemplateActivity():TemplateActivity{
+ return _currentlySelectedTemplateActivity;
+ }
+
+ /**
+ * Gets last selected templateactivity
+ */
+ public function getLastSelectedTemplateActivity():TemplateActivity{
+ return _lastSelectedTemplateActivity;
+ }
+
+ /**
+ * Sends update to view for TOOL_DESCRIPTION
+ */
+ public function setToolkitDescription(desc:String):Void{
+ _currentToolkitDescription = desc;
+ infoObj.updateType = "TOOL_DESCRIPTION";
+ //notify observer's this is "this" as if by magic
+ notifyObservers(infoObj);
+ }
+
+ public function getToolkitDescription():String{
+ return _currentToolkitDescription;
+ }
+
+ /**
+ * Gets a learning Library using its ID
+ * @usage
+ * @param learningLibraryID
+ * @return
+ */
+ public function getLearningLibrary(learningLibraryID:Number):Object{
+ return _toolkitLearningLibraries.get(learningLibraryID);
+ }
+
+
+
+ /**
+ * 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;
+ }
+
+ //Acessors for x + y coordinates
+ public function get x():Number{
+ return __x;
+ }
+
+ public function get y():Number{
+ return __y;
+ }
+
+ //Acessors for x + y coordinates
+ public function get width():Number{
+ return __width;
+ }
+
+ public function get height():Number{
+ return __height;
+ }
function get className():String{
return 'ToolkitModel';
}
-
-
-}
-
+
+
+}
+
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitView.as
===================================================================
diff -u -r470bd43cd17fa6128a767fec948850a5815c1c55 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitView.as (.../ToolkitView.as) (revision 470bd43cd17fa6128a767fec948850a5815c1c55)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/tk/ToolkitView.as (.../ToolkitView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,166 +1,164 @@
-/***************************************************************************
- * 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.*;
+/***************************************************************************
+ * 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.style.*;
-import org.lamsfoundation.lams.authoring.*;
-import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.ui.*
import org.lamsfoundation.lams.authoring.tk.*;
import org.lamsfoundation.lams.common.mvc.*;
-import org.lamsfoundation.lams.authoring.cv.*
-
+import org.lamsfoundation.lams.authoring.cv.*
+
import mx.managers.*;
-import mx.controls.*;
-import mx.events.*
-
+import mx.controls.*;
+import mx.events.*
/**
-* Authoring view for the toolkit
+* Authoring view for the toolkit
* @author DC
*/
-class ToolkitView extends AbstractView {
-
- private var bkg_pnl:MovieClip;
+class ToolkitView extends AbstractView {
+ private var bkg_pnl:MovieClip;
- private var toolkitLibraries_sp:MovieClip;
- private var libraryActivityDesc_txa:TextArea;
- private var title_lbl:Label;
- private var title_btn:Button;
+ private var toolkitLibraries_sp:MovieClip;
+ private var libraryActivityDesc_txa:TextArea;
+ private var title_lbl:Label;
+ private var title_btn:Button;
private var toolTip:MovieClip;
- private var _className = "ToolkitView";
- private var _depth:Number;
-
- private var dragIcon_mc:MovieClip;
- private var dragIcon_mcl:MovieClipLoader;
-
- private var dragIconListener:Object;
- private var _dictionary:Dictionary;
- private var _tm:ThemeManager;
- private var _tip:ToolTip;
-
- //sorry mvc guru but i disagree - little state var here
- private var _dragging:Boolean;
- private var _scrollPanelWidthDiff:Number; //Difference in width between scrollpane and panel
-
- private var _toolkitLoaded:Boolean;
-
- //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;
-
+ private var _className = "ToolkitView";
+ private var _depth:Number;
+
+ private var dragIcon_mc:MovieClip;
+ private var dragIcon_mcl:MovieClipLoader;
+
+ private var dragIconListener:Object;
+ private var _dictionary:Dictionary;
+ private var _tm:ThemeManager;
+ private var _tip:ToolTip;
+
+ //sorry mvc guru but i disagree - little state var here
+ private var _dragging:Boolean;
+ private var _scrollPanelWidthDiff:Number; //Difference in width between scrollpane and panel
+
+ private var _toolkitLoaded:Boolean;
+
+ //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 ToolkitView(){
- //Set up this class to use the Flash event delegation model
- EventDispatcher.initialize(this);
- _tm = ThemeManager.getInstance();
- _dictionary = Dictionary.getInstance();
- _tip = new ToolTip();
- _dictionary.addEventListener('init',Proxy.create(this,setupLabels));
+ public function ToolkitView(){
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+ _tm = ThemeManager.getInstance();
+ _dictionary = Dictionary.getInstance();
+ _tip = new ToolTip();
+ _dictionary.addEventListener('init',Proxy.create(this,setupLabels));
_toolkitLoaded = false;
- //Debugger.log('Running',4,'Constructor','ToolkitView');
- }
+ //Debugger.log('Running',4,'Constructor','ToolkitView');
+ }
- /**
- * 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);
- //Debugger.log('Running',4,'init','ToolkitView');
- _dragging = false;
-
- dragIconListener = new Object();
- dragIconListener.cRef = this;
- dragIcon_mcl = new MovieClipLoader();
- dragIcon_mcl.addListener(dragIconListener);
- title_btn.useHandCursor = false;
- title_btn.onRollOver = Proxy.create(this,this['showToolTip'], undefined, null, null, title_btn);
- title_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
- /**
- * Called by the MovieClip loader that loaded the drag icon.
- *
- * @param dragIcon_mc The target mc that got the loaded movie
- */
- dragIconListener.onLoadInit = function(dragIcon_mc){
- //Debugger.log('dragIcon_mc:'+dragIcon_mc,4,'dragIconListener.onLoadInit','ToolkitView');
- dragIcon_mc._visible = false;
+ /**
+ * 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);
+ //Debugger.log('Running',4,'init','ToolkitView');
+ _dragging = false;
+
+ dragIconListener = new Object();
+ dragIconListener.cRef = this;
+ dragIcon_mcl = new MovieClipLoader();
+ dragIcon_mcl.addListener(dragIconListener);
+ title_btn.useHandCursor = false;
+ title_btn.onRollOver = Proxy.create(this,this['showToolTip'], undefined, null, null, title_btn);
+ title_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+ /**
+ * Called by the MovieClip loader that loaded the drag icon.
+ *
+ * @param dragIcon_mc The target mc that got the loaded movie
+ */
+ dragIconListener.onLoadInit = function(dragIcon_mc){
+ //Debugger.log('dragIcon_mc:'+dragIcon_mc,4,'dragIconListener.onLoadInit','ToolkitView');
+ dragIcon_mc._visible = false;
//dragIcon_mc = dragIcon_mc;
- //Proxy.create(this.cRef,this.cRef['setUpDrag'],dragIcon_mc);
- this.cRef.setUpDrag(dragIcon_mc);
- //dragIcon_mc.startDrag(true);
- /*
- dragIcon_mc.onPress = function(){
- this.startDrag(true);
- }
- */
- }
-
-
-
- //Application.getInstance().setupAppCM(false)
-
+ //Proxy.create(this.cRef,this.cRef['setUpDrag'],dragIcon_mc);
+ this.cRef.setUpDrag(dragIcon_mc);
+ //dragIcon_mc.startDrag(true);
+ /*
+ dragIcon_mc.onPress = function(){
+ this.startDrag(true);
+ }
+ */
+ }
+
+
+
+ //Application.getInstance().setupAppCM(false)
+
//Create a clip that will wait a frame before dispatching init to give components time to setup
- this.onEnterFrame = createToolkit;
- }
-
- public function getCopy(){
- Application.getInstance().copy();
- }
-
- public function getPaste(){
- Application.getInstance().paste();
- }
- public function setupLabels(){
-
- var tkTitle = Dictionary.getValue('tk_title')
- if (tkTitle.length > 25){
- tkTitle = tkTitle.substr(0, 24)+"..."
- }
- title_lbl.text = ""+tkTitle+"";
-
-
+ this.onEnterFrame = createToolkit;
}
+
+ public function getCopy(){
+ Application.getInstance().copy();
+ }
+
+ public function getPaste(){
+ Application.getInstance().paste();
+ }
+ public function setupLabels(){
+
+ var tkTitle = Dictionary.getValue('tk_title')
+ if (tkTitle.length > 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;
+ 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();
- }
+ _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();
+ }
/**
@@ -169,290 +167,288 @@
* @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);
+ 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
+ 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;
- }
+ }
+
+ /**
+ * 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.
- */
+ * 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:: toolkitLoaded: ' + _toolkitLoaded, Debugger.CRITICAL, 'updateLibraries', 'ToolkitView');
- if(_toolkitLoaded) return;
-
- var yPos:Number = 0;
-
- //set SP the content path:
- toolkitLibraries_sp.contentPath = "empty_mc";
-
- var tkv = ToolkitView(this);
- var tkm:ToolkitModel = getModel();
- //get the hashtable
+ Debugger.log('Running:: toolkitLoaded: ' + _toolkitLoaded, Debugger.CRITICAL, 'updateLibraries', 'ToolkitView');
+ if(_toolkitLoaded) return;
+
+ var yPos:Number = 0;
+
+ //set SP the content path:
+ toolkitLibraries_sp.contentPath = "empty_mc";
+
+ var tkv = ToolkitView(this);
+ var tkm:ToolkitModel = getModel();
+ //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');
-
- // First condition true if is a native lams tool
- var toolAct = ToolActivity(activities[0]);
- if (toolAct.extLmsId == null || toolAct.extLmsId == undefined) {
- Debugger.log('ToolActivity->Native tool: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView');
- }
- // Second condition true if it is an external tool adapter tool
- else if (_root.extlmsid != undefined && _root.extlmsid !=null && _root.extlmsid == toolAct.extLmsId){
- Debugger.log('ToolActivity->External tool, external request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView');
- }
- // Else is a tool adapter tool, but the call was not from external server, therefore disable
- else{
- continue;
- Debugger.log('ToolActivity->Externale tool, internal request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView');
- }
-
- 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;
-
-
- }
-
- _toolkitLoaded = true;
+
+ //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');
+
+ // First condition true if is a native lams tool
+ var toolAct = ToolActivity(activities[0]);
+ if (toolAct.extLmsId == null || toolAct.extLmsId == undefined) {
+ Debugger.log('ToolActivity->Native tool: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView');
+ }
+ // Second condition true if it is an external tool adapter tool
+ else if (_root.extlmsid != undefined && _root.extlmsid !=null && _root.extlmsid == toolAct.extLmsId){
+ Debugger.log('ToolActivity->External tool, external request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView');
+ }
+ // Else is a tool adapter tool, but the call was not from external server, therefore disable
+ else{
+ continue;
+ Debugger.log('ToolActivity->Externale tool, internal request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView');
+ }
+
+ 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;
+
+
+ }
+ _toolkitLoaded = true;
//toolkitLibraries_sp.refreshPane();
-
-
- }
-
- public function showToolTip(ttMsg:String, xpos:Number, ypos:Number, btnObj):Void{
- var ttHolder = ApplicationParent.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();
+
+
+ }
+
+ public function showToolTip(ttMsg:String, xpos:Number, ypos:Number, btnObj):Void{
+ var ttHolder = ApplicationParent.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.
+ /**
+ *The currently selected Template Activity
+ *
+ * @param o The model object that is broadcasting an update.
*/
- private function updateSelectedTemplateActivity(o:Observable):Void{
+ 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);
-
+ //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);
}
-
-
- 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);
+ /**
+ * 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 -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Application.as (.../Application.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Application.as (.../Application.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,119 +1,119 @@
-/***************************************************************************
- * 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
+/***************************************************************************
+ * 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.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 _lesson:Lesson;
- private var _header_mc:MovieClip;
- private var _scratchpad_mc:MovieClip;
- private var _presence_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;
- public static var PRES_X:Number = 0;
- public static var PRES_Y:Number = 554;
- public static var PRES_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;
+ private var _lesson:Lesson;
+ private var _header_mc:MovieClip;
+ private var _scratchpad_mc:MovieClip;
+ private var _presence_mc:MovieClip;
+
+ private static var SHOW_DEBUGGER:Boolean = false;
+ private static var MODULE:String = "learner";
- // 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 _userDataLoaded:Boolean; //User data status
-
- private var _lessonLoaded:Boolean; //Lesson loaded flag
- private var _headerLoaded:Boolean;
- private var _scratchpadLoaded:Boolean;
- private var _presenceLoaded:Boolean;
-
+ 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;
+ public static var PRES_X:Number = 0;
+ public static var PRES_Y:Number = 554;
+ public static var PRES_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 _userDataLoaded:Boolean; //User data status
+
+ private var _lessonLoaded:Boolean; //Lesson loaded flag
+ private var _headerLoaded:Boolean;
+ private var _scratchpadLoaded:Boolean;
+ private var _presenceLoaded: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 _debugDialog:MovieClip; //Reference to the debug dialog
- private var chatDialogs:Array;
+ private var _container_mc:MovieClip; //Main container
+ private var _debugDialog:MovieClip; //Reference to the debug dialog
+ private var chatDialogs:Array;
/**
* Application - Constructor
*/
- private function Application(){
- super(this);
+ private function Application(){
+ super(this);
- _lessonLoaded = false;
- _headerLoaded = false;
- _scratchpadLoaded = false;
- _presenceLoaded = false;
-
- _userDataLoaded = false;
-
- _module = Application.MODULE;
+ _lessonLoaded = false;
+ _headerLoaded = false;
+ _scratchpadLoaded = false;
+ _presenceLoaded = false;
+
+ _userDataLoaded = false;
+
+ _module = Application.MODULE;
chatDialogs = new Array();
}
@@ -123,7 +123,7 @@
public static function getInstance():Application{
if(Application._instance == null){
Application._instance = new Application();
- }
+ }
return Application._instance;
}
@@ -135,298 +135,298 @@
_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);
+
+ _customCursor_mc = _container_mc.createEmptyMovieClip('_customCursor_mc', CCURSOR_DEPTH);
+
+ //add the cursors:
+ Cursor.addCursor(C_HOURGLASS);
- }
-
- /**
- * 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);
- }
- }
- }
-
- /**
- * Sets up UI
- */
- private function setupUI():Void {
-
- //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));
-
- _presence_mc = _container_mc.createChildAtDepth('LPresence', DepthManager.kTop, {_x:PRES_X, _y:PRES_Y, _lessonModel:_lesson.model, _lessonController:_lesson.view.getController()});
- _presence_mc.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() {
- //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' :
- _lessonLoaded = true;
- break;
- case 'Header' :
- _headerLoaded = true;
- break;
- case 'Scratchpad' :
- _scratchpadLoaded = true;
- break;
- case 'Presence' :
- _presenceLoaded = true;
- _presence_mc._visible = false;
- Debugger.log('PRESENCE: presence loaded and set to not visible' ,Debugger.MED,'UIElementLoaded','Application');
- break;
- default:
- }
-
- //If all of them are loaded set UILoad accordingly
- if(_lessonLoaded && _headerLoaded && _scratchpadLoaded && _presenceLoaded){
- _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(){
-
- //Fire off a resize to set up sizes
- onResize();
-
- if(SHOW_DEBUGGER){
- showDebugger();
- }
-
- // load lesson
- //_lesson.getUserByID();
- _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 resizeHeight:Number;
- if(_presence_mc._visble) {
- resizeHeight = LESSON_Y+_lesson.model.getSpadHeight() +_lesson.model.getPresenceHeight();
- }
- else {
- resizeHeight = LESSON_Y+_lesson.model.getSpadHeight();
- }
-
- var someListener:Object = new Object();
-
- someListener.onMouseUp = function () {
- _lesson.setSize(w,h-resizeHeight);
- _scratchpad_mc._y = h - _lesson.model.getSpadHeight();
- _presence_mc._y = h - _lesson.model.getSpadHeight() - _lesson.model.getPresenceHeight();
- }
-
- Header(_header_mc).resize(w);
-
- _lesson.setSize(w,h-resizeHeight);
- _scratchpad_mc._y = h - _lesson.model.getSpadHeight();
- _presence_mc._y = h - _lesson.model.getSpadHeight() - _lesson.model.getPresenceHeight();
-
- }
-
- /**
- * Handles KEY presses for Application
- */
- private function onKeyDown(){
-
- // show/hide the debug window:
- if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
- if (!_debugDialog.content){
- showDebugger();
- }else {
- hideDebugger();
- }
- }
- }
-
- /**
- * 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');
-
- 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));
- }
- }
- }
- }
-
- // 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 getPresence():Presence{
- return Presence(_presence_mc)
- }
-
- public function showDebugger():Void{
- _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
- }
-
- public function hideDebugger():Void{
- _debugDialog.deletePopUp();
- }
-
- public function get userDataLoaded():Boolean{
- return _userDataLoaded;
- }
+ //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);
+ }
+ }
+ }
+
+ /**
+ * Sets up UI
+ */
+ private function setupUI():Void {
+
+ //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));
+
+ _presence_mc = _container_mc.createChildAtDepth('LPresence', DepthManager.kTop, {_x:PRES_X, _y:PRES_Y, _lessonModel:_lesson.model, _lessonController:_lesson.view.getController()});
+ _presence_mc.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() {
+ //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' :
+ _lessonLoaded = true;
+ break;
+ case 'Header' :
+ _headerLoaded = true;
+ break;
+ case 'Scratchpad' :
+ _scratchpadLoaded = true;
+ break;
+ case 'Presence' :
+ _presenceLoaded = true;
+ _presence_mc._visible = false;
+ Debugger.log('PRESENCE: presence loaded and set to not visible' ,Debugger.MED,'UIElementLoaded','Application');
+ break;
+ default:
+ }
+
+ //If all of them are loaded set UILoad accordingly
+ if(_lessonLoaded && _headerLoaded && _scratchpadLoaded && _presenceLoaded){
+ _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(){
+
+ //Fire off a resize to set up sizes
+ onResize();
+
+ if(SHOW_DEBUGGER){
+ showDebugger();
+ }
+
+ // load lesson
+ //_lesson.getUserByID();
+ _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 resizeHeight:Number;
+ if(_presence_mc._visble) {
+ resizeHeight = LESSON_Y+_lesson.model.getSpadHeight() +_lesson.model.getPresenceHeight();
+ }
+ else {
+ resizeHeight = LESSON_Y+_lesson.model.getSpadHeight();
+ }
+
+ var someListener:Object = new Object();
+
+ someListener.onMouseUp = function () {
+ _lesson.setSize(w,h-resizeHeight);
+ _scratchpad_mc._y = h - _lesson.model.getSpadHeight();
+ _presence_mc._y = h - _lesson.model.getSpadHeight() - _lesson.model.getPresenceHeight();
+ }
+
+ Header(_header_mc).resize(w);
+
+ _lesson.setSize(w,h-resizeHeight);
+ _scratchpad_mc._y = h - _lesson.model.getSpadHeight();
+ _presence_mc._y = h - _lesson.model.getSpadHeight() - _lesson.model.getPresenceHeight();
+
+ }
+
+ /**
+ * Handles KEY presses for Application
+ */
+ private function onKeyDown(){
+
+ // show/hide the debug window:
+ if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
+ if (!_debugDialog.content){
+ showDebugger();
+ }else {
+ hideDebugger();
+ }
+ }
+ }
+
+ /**
+ * 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');
+
+ 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));
+ }
+ }
+ }
+ }
+
+ // 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 getPresence():Presence{
+ return Presence(_presence_mc)
+ }
+
+ public function showDebugger():Void{
+ _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
+ }
+
+ public function hideDebugger():Void{
+ _debugDialog.deletePopUp();
+ }
+
+ public function get userDataLoaded():Boolean{
+ return _userDataLoaded;
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Header.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Header.as (.../Header.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Header.as (.../Header.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -27,40 +27,40 @@
import mx.events.*
import org.lamsfoundation.lams.learner.*
-import org.lamsfoundation.lams.common.Sequence;
+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;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.common.Config;
import org.lamsfoundation.lams.common.ApplicationParent;
-class Header extends MovieClip {
-
+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";
-
+
+ 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 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 _tm:ThemeManager;
private var _dictionary:Dictionary;
//These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
@@ -75,128 +75,128 @@
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));
-
+
+ _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(){
+ public function init(){
//Delete the enterframe dispatcher
delete this.onEnterFrame;
-
- _header_mc = this;
-
- loadLogo();
-
- setLabels();
- resize(Stage.width);
-
+
+ _header_mc = this;
+
+ loadLogo();
+
+ setLabels();
+ resize(Stage.width);
+
//Add event listeners for resume and exit buttons
resume_btn.onRelease = function(){
var app:Application = Application.getInstance();
- app.getLesson().resumeLesson();
+ app.getLesson().resumeLesson();
}
exit_btn.onRelease = function(){
var app:Application = Application.getInstance();
- app.getLesson().exitLesson();
+ 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 = ApplicationParent.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;
-
- }
+ 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 = ApplicationParent.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/PresenceXIFF.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/PresenceXIFF.as (.../PresenceXIFF.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/PresenceXIFF.as (.../PresenceXIFF.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -19,694 +19,694 @@
*
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
- */
-
-import org.jivesoftware.xiff.conference.Room;
-import org.jivesoftware.xiff.data.IQ;
-import org.jivesoftware.xiff.conference.InviteListener;
-import org.jivesoftware.xiff.data.muc.*;
-import org.jivesoftware.xiff.data.DelayExtension;
-import org.jivesoftware.xiff.im.Roster;
-import org.jivesoftware.xiff.core.XMPPConnection;
-import org.jivesoftware.xiff.data.XMPPStanza;
-import org.jivesoftware.xiff.data.Message;
-import org.jivesoftware.xiff.data.register.RegisterExtension;
-import org.jivesoftware.xiff.data.vcard.VCardExtension;
-import org.jivesoftware.xiff.data.VCardManager;
-import org.jivesoftware.xiff.data.PrivateDataManager;
-import org.jivesoftware.xiff.data.PrivateDataExtension;
+ */
-import org.lamsfoundation.lams.learner.*;
+import org.jivesoftware.xiff.conference.Room;
+import org.jivesoftware.xiff.data.IQ;
+import org.jivesoftware.xiff.conference.InviteListener;
+import org.jivesoftware.xiff.data.muc.*;
+import org.jivesoftware.xiff.data.DelayExtension;
+import org.jivesoftware.xiff.im.Roster;
+import org.jivesoftware.xiff.core.XMPPConnection;
+import org.jivesoftware.xiff.data.XMPPStanza;
+import org.jivesoftware.xiff.data.Message;
+import org.jivesoftware.xiff.data.register.RegisterExtension;
+import org.jivesoftware.xiff.data.vcard.VCardExtension;
+import org.jivesoftware.xiff.data.VCardManager;
+import org.jivesoftware.xiff.data.PrivateDataManager;
+import org.jivesoftware.xiff.data.PrivateDataExtension;
+
+import org.lamsfoundation.lams.learner.*;
import org.lamsfoundation.lams.learner.ls.*;
-import org.lamsfoundation.lams.common.Sequence;
+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.ApplicationParent;
-import mx.controls.*
-import mx.utils.*
-import mx.managers.*
-import mx.events.*
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.ApplicationParent;
+import mx.controls.*
+import mx.utils.*
+import mx.managers.*
+import mx.events.*
-class Presence extends MovieClip {
-
- //Height Properties
- private var presenceHeightHide:Number = 20;
- private var presenceHeightFull:Number = 217;
-
- //Open Close Identifier
- private var _presenceIsExpanded:Boolean;
-
- //Component properties
- private var _presence_mc:MovieClip;
- private var presenceHead_pnl:MovieClip;
- private var presenceTitle_lbl:Label;
- private var presenceMinIcon:MovieClip;
- private var presenceMaxIcon:MovieClip;
- private var presenceClickTarget_mc:MovieClip;
- private var _tip:ToolTip;
- private var _users_dg:DataGrid;
-
+class Presence extends MovieClip {
+
+ //Height Properties
+ private var presenceHeightHide:Number = 20;
+ private var presenceHeightFull:Number = 217;
+
+ //Open Close Identifier
+ private var _presenceIsExpanded:Boolean;
+
+ //Component properties
+ private var _presence_mc:MovieClip;
+ private var presenceHead_pnl:MovieClip;
+ private var presenceTitle_lbl:Label;
+ private var presenceMinIcon:MovieClip;
+ private var presenceMaxIcon:MovieClip;
+ private var presenceClickTarget_mc:MovieClip;
+ private var _tip:ToolTip;
+ private var _users_dg:DataGrid;
+
private var panel:MovieClip;
- private var _lessonModel:LessonModel;
- private var _lessonController:LessonController;
- private var _tm:ThemeManager;
+ 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;
-
- // XIFF things
- private var connection:XMPPConnection;
- private var room:Room;
- private var myHost:InviteListener;
- private var buddyList:Roster;
- private var vcardManager:VCardManager;
- private var privateData:PrivateDataManager;
- private var globalHandler:Object;
- private var chatHandler:Object;
- private var timerTestConnection:Number;
-
- private var selectedChatItem:Object;
- private var lastClickX:Number;
- private var lastClickY:Number;
-
- private var attemptConnectionInterval:Number;
- private var testConnectionInterval:Number;
- private var clickInterval:Number;
- private var rejoinOnIdleInterval:Number;
- private var registrationRetryInterval:Number;
- private var joinChatRetryInterval:Number;
-
- private var ROOMCONNECTTIMEOUT:Number =5000;
- private var REGRETRYTIME:Number = 1000;
- private var JOINCHATRETRYTIME:Number = 1000;
- private var DOUBLECLICKSPEED:Number = 500;
-
- private var regNecessaryFields:Object;
-
- private var chatDialog:MovieClip;
+
+ // XIFF things
+ private var connection:XMPPConnection;
+ private var room:Room;
+ private var myHost:InviteListener;
+ private var buddyList:Roster;
+ private var vcardManager:VCardManager;
+ private var privateData:PrivateDataManager;
+ private var globalHandler:Object;
+ private var chatHandler:Object;
+ private var timerTestConnection:Number;
+
+ private var selectedChatItem:Object;
+ private var lastClickX:Number;
+ private var lastClickY:Number;
+
+ private var attemptConnectionInterval:Number;
+ private var testConnectionInterval:Number;
+ private var clickInterval:Number;
+ private var rejoinOnIdleInterval:Number;
+ private var registrationRetryInterval:Number;
+ private var joinChatRetryInterval:Number;
+ private var ROOMCONNECTTIMEOUT:Number =5000;
+ private var REGRETRYTIME:Number = 1000;
+ private var JOINCHATRETRYTIME:Number = 1000;
+ private var DOUBLECLICKSPEED:Number = 500;
+
+ private var regNecessaryFields:Object;
+
+ private var chatDialog:MovieClip;
+
// Constructor
- public function Presence() {
- Debugger.log('PRESENCE: started constructor',Debugger.MED,'Presence','Presence');
+ public function Presence() {
+ Debugger.log('PRESENCE: started constructor',Debugger.MED,'Presence','Presence');
// 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));
- regNecessaryFields = new Object();
-
- connection = new XMPPConnection();
- connection.username = String(_root.userID);
- connection.password = String(_root.userID);
- connection.server = String(_root.presenceServerUrl);
- connection.port = Number(_root.presenceServerPort);
-
- var myDate = new Date();
- var h = myDate.getHours().toString(), m = myDate.getMinutes().toString(), s = myDate.getSeconds().toString();
- connection.resource = "LAMSPRESENCE"+h+""+m+""+s;
-
- /*
- myHost = new InviteListener(connection);
- buddyList = new Roster(connection);
- vcardManager = new VCardManager(connection);
- privateData= new PrivateDataManager(connection);
- */
-
- connection.addEventListener("message", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("login", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("connection", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("disconnection", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("presence", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("error", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("changePasswordSuccess", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("outgoingData", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("incomingData", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("registrationSuccess", Proxy.create(this, handleGlobalEvent));
- connection.addEventListener("registrationFields", Proxy.create(this, handleGlobalEvent));
-
- /*
- buddyList.addEventListener("subscriptionRequest", Proxy.create(this, handleGlobalEvent));
- buddyList.addEventListener("subscriptionRevocation", Proxy.create(this, handleGlobalEvent));
- buddyList.addEventListener("subscriptionDenial", Proxy.create(this, handleGlobalEvent));
- buddyList.addEventListener("userAvailable", Proxy.create(this, handleGlobalEvent));
- buddyList.addEventListener("userUnavailable", Proxy.create(this, handleGlobalEvent));
-
- vcardManager.addEventListener("VCardReceived", Proxy.create(this, handleGlobalEvent));
- vcardManager.addEventListener("VCardSent", Proxy.create(this, handleGlobalEvent));
-
- privateData.addEventListener("PrivateDataReceived", Proxy.create(this, handleGlobalEvent));
- privateData.addEventListener("PrivateDataSent", Proxy.create(this, handleGlobalEvent));
-
- myHost.addEventListener("invited", Proxy.create(this, handleGlobalEvent));
-
- Key.addListener(keyListenerGlobal);
- buddyList.addEventListener("cellPress", userListener);
- */
-
- Stage.addListener(this);
-
- // Let it wait one frame to set up the components.
- MovieClipUtils.doLater(Proxy.create(this,init));
- Debugger.log('PRESENCE: calling init method',Debugger.MED,'Presence','Presence');
+ EventDispatcher.initialize(this);
+
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+ _dictionary = Dictionary.getInstance();
+ _dictionary.addEventListener('init',Proxy.create(this,setLabels));
+ regNecessaryFields = new Object();
+
+ connection = new XMPPConnection();
+ connection.username = String(_root.userID);
+ connection.password = String(_root.userID);
+ connection.server = String(_root.presenceServerUrl);
+ connection.port = Number(_root.presenceServerPort);
+
+ var myDate = new Date();
+ var h = myDate.getHours().toString(), m = myDate.getMinutes().toString(), s = myDate.getSeconds().toString();
+ connection.resource = "LAMSPRESENCE"+h+""+m+""+s;
+
+ /*
+ myHost = new InviteListener(connection);
+ buddyList = new Roster(connection);
+ vcardManager = new VCardManager(connection);
+ privateData= new PrivateDataManager(connection);
+ */
+
+ connection.addEventListener("message", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("login", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("connection", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("disconnection", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("presence", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("error", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("changePasswordSuccess", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("outgoingData", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("incomingData", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("registrationSuccess", Proxy.create(this, handleGlobalEvent));
+ connection.addEventListener("registrationFields", Proxy.create(this, handleGlobalEvent));
+
+ /*
+ buddyList.addEventListener("subscriptionRequest", Proxy.create(this, handleGlobalEvent));
+ buddyList.addEventListener("subscriptionRevocation", Proxy.create(this, handleGlobalEvent));
+ buddyList.addEventListener("subscriptionDenial", Proxy.create(this, handleGlobalEvent));
+ buddyList.addEventListener("userAvailable", Proxy.create(this, handleGlobalEvent));
+ buddyList.addEventListener("userUnavailable", Proxy.create(this, handleGlobalEvent));
+
+ vcardManager.addEventListener("VCardReceived", Proxy.create(this, handleGlobalEvent));
+ vcardManager.addEventListener("VCardSent", Proxy.create(this, handleGlobalEvent));
+
+ privateData.addEventListener("PrivateDataReceived", Proxy.create(this, handleGlobalEvent));
+ privateData.addEventListener("PrivateDataSent", Proxy.create(this, handleGlobalEvent));
+
+ myHost.addEventListener("invited", Proxy.create(this, handleGlobalEvent));
+
+ Key.addListener(keyListenerGlobal);
+ buddyList.addEventListener("cellPress", userListener);
+ */
+
+ Stage.addListener(this);
+
+ // Let it wait one frame to set up the components.
+ MovieClipUtils.doLater(Proxy.create(this,init));
+ Debugger.log('PRESENCE: calling init method',Debugger.MED,'Presence','Presence');
}
// Called a frame after movie attached to allow components to initialise
- public function init(){
- Debugger.log('PRESENCE: started init',Debugger.MED,'init','Presence');
-
- System.security.loadPolicyFile("xmlsocket://172.20.100.18:9090:5222");
+ public function init(){
+ Debugger.log('PRESENCE: started init',Debugger.MED,'init','Presence');
+ System.security.loadPolicyFile("xmlsocket://172.20.100.18:9090:5222");
+
//Delete the enterframe dispatcher
delete this.onEnterFrame;
- _lessonModel = _lessonModel;
- _lessonController = _lessonController;
- _presence_mc = this;
- _presenceIsExpanded = true;
- presenceMaxIcon._visible = false;
- presenceMinIcon._visible = true;
- _lessonModel.setPresenceHeight(presenceHeightFull);
- setLabels();
- resize(Stage.width);
-
- presenceClickTarget_mc.onRelease = Proxy.create(this, localOnRelease);
-
+ _lessonModel = _lessonModel;
+ _lessonController = _lessonController;
+ _presence_mc = this;
+ _presenceIsExpanded = true;
+ presenceMaxIcon._visible = false;
+ presenceMinIcon._visible = true;
+ _lessonModel.setPresenceHeight(presenceHeightFull);
+ setLabels();
+ resize(Stage.width);
+
+ presenceClickTarget_mc.onRelease = Proxy.create(this, localOnRelease);
+
this.onEnterFrame = setLabels;
- }
-
- // Click handler
- private function localOnRelease():Void{
- if (_presenceIsExpanded){
- _presenceIsExpanded = false
- presenceMinIcon._visible = false;
- presenceMaxIcon._visible = true;
- _lessonModel.setPresenceHeight(presenceHeightHide);
-
- }else {
- _presenceIsExpanded = true
- presenceMinIcon._visible = true;
- presenceMaxIcon._visible = false;
- _lessonModel.setPresenceHeight(presenceHeightFull);
- //Application.getInstance().onResize();
- }
- }
-
- // First connection attempt called once Lesson is loaded correctly
- private function attemptFirstConnection():Void{
- attemptConnection();
- checkConnectionEstablished();
- }
-
- // Attempts a connection with a given Jabber server
- private function attemptConnection():Void{
- Debugger.log('PRESENCE: attempting to connect',Debugger.MED,'connectionTimer','Presence');
- connection.connect("flash");
- }
-
- // Checks to see if a connection has been established
- private function checkConnectionEstablished():Void{
- testConnectionInterval = setInterval(Proxy.create(this,connectionEstablishedTimer),500);
- }
-
- // Keeps testing connection
- private function connectionEstablishedTimer():Void{
- Debugger.log('PRESENCE: checking if connection is established',Debugger.MED,'connectionEstablishedTimer','Presence');
-
- if(connection.isLoggedIn()){
- Debugger.log('PRESENCE: connection established',Debugger.MED,'connectionEstablishedTimer','Presence');
-
- clearInterval(testConnectionInterval);
-
- joinChatRoom();
- setupDataGrid();
- }
- }
-
- // Attempts to register a new user
- private function attemptRegistration(){
- Debugger.log('PRESENCE: attempting to register',Debugger.MED,'attemptRegistration','Presence');
-
- if(_lessonModel.userFirstName == null || _lessonModel.userLastName == null) {
- if(!registrationRetryInterval) {
- registrationRetryInterval = setInterval(Proxy.create(this, attemptRegistration), REGRETRYTIME);
- }
- }
- else {
- clearInterval(registrationRetryInterval);
- var email:String = new String("");
- var name:String = new String(_lessonModel.userFirstName + _lessonModel.userLastName);
- var userID:String = new String(_root.userID);
- var password:String = new String(_root.userID);
- var loginAfter:Boolean = true;
-
- regNecessaryFields = {username:userID, password:password, name:name, email:email, loginAfter:loginAfter};
-
- connection.sendRegistrationFields(regNecessaryFields);
- }
- }
-
- // Attempts to join a chat room
- private function joinChatRoom():Void{
- Debugger.log('PRESENCE: attempting to create and join chatroom',Debugger.MED,'joinChatRoom','Presence');
-
- if(Application.getInstance().userDataLoaded) {
- if(_lessonModel.userFirstName == null || _lessonModel.userLastName == null) {
- Debugger.log('PRESENCE: names are null, can not join chat room',Debugger.MED,'joinChatRoom','Presence');
-
- clearInterval(joinChatRetryInterval);
- clearInterval(testConnectionInterval);
- }
- else {
- Debugger.log('PRESENCE: attempting to create and join chatroom',Debugger.MED,'joinChatRoom','Presence');
-
- clearInterval(joinChatRetryInterval);
- room = new Room(connection);
-
- room.addEventListener("groupMessage", Proxy.create(this, handleChatEvent));
- room.addEventListener("userJoin", Proxy.create(this, handleChatEvent));
- room.addEventListener("userDeparture", Proxy.create(this, handleChatEvent));
- room.addEventListener("subjectChange", Proxy.create(this, handleChatEvent));
- room.addEventListener("affiliations", Proxy.create(this, handleChatEvent));
- room.addEventListener("roomRosterUpdated", Proxy.create(this, handleChatEvent));
- room.addEventListener("configureForm", Proxy.create(this, handleChatEvent));
- room.addEventListener("declined", Proxy.create(this, handleChatEvent));
- room.addEventListener("nickConflict", Proxy.create(this, handleChatEvent));
- room.addEventListener("privateMessage", Proxy.create(this, handleChatEvent));
-
- room.roomName = String(_root.lessonID);
- room.nickname = String(_lessonModel.userFirstName + _lessonModel.userLastName);
- room.password = null;
- room.conferenceServer = "conference." + _root.presenceServerUrl;
- room.join();
- }
- }
- else{
- if(!joinChatRetryInterval) {
- joinChatRetryInterval = setInterval(Proxy.create(this, joinChatRoom), JOINCHATRETRYTIME);
- }
- }
- }
-
- // Chat event handler
- private function handleChatEvent(eventObj):Void{
- Debugger.log("PRESENCE: chat event "+eventObj.type,Debugger.MED,'handleChatEvent','Presence');
- switch (eventObj.type) {
-
- case "nickConflict":
- Debugger.log('PRESENCE: nickConflict event',Debugger.MED,'handleChatEvent','Presence');
- /*
- popUpErreur(_root.__("ERROR")+" : "+newline+_root.__("nick already in use")+newline+_root.__("I add ~ to the nickname") );
- chatRoom.nickname=nickn.text+"~";
- nickn.text=chatRoom.nickname;
- if(!chatRoom.isActive())
- chatRoom.join();
- //SEE PRESENCE EVENT
- */
- break;
-
- case "roomRosterUpdated" :
- Debugger.log('PRESENCE: roomRosterUpdated event',Debugger.MED,'handleChatEvent','Presence');
- break;
-
- case "groupMessage" :
- Debugger.log('PRESENCE: groupMessage event',Debugger.MED,'handleChatEvent','Presence');
- /*
- //Be careful, if there are many chatroom opened, you need to tell them to recognize their message
- var msg = eventObj.data;
-
- //var msgDelay:DelayExtension = msg.getAllExtensionsByNS(DelayExtension.NS)[0];
- //
- var nick = msg.from.split("/")[1];
-
- // trace(msgDelay.stamp);
-
- addToChatOutput(nick, msg.body);
- */
- break;
-
- case "subjectChange" :
- Debugger.log('PRESENCE: subject = ' + eventObj.subject,Debugger.MED,'handleChatEvent','Presence');
- break;
-
- case "login" :
- Debugger.log('PRESENCE: room login event',Debugger.MED,'handleChatEvent','Presence');
-
- // Rejoin room if automatically disconnected
- rejoinOnIdleInterval = setInterval(Proxy.create(this, rejoinTimer), 500);
- break;
-
- case "presence" :
- Debugger.log('PRESENCE: room presence event',Debugger.MED,'handleChatEvent','Presence');
- /*
- // Some error message, like wrong nickname, or multiple room nickname change (impossible to do on jive...)
- if(eventObj.data.type=="error" && chatRoom.isThisRoom(eventObj.data.from)){ //It's this room error
- if(eventObj.data.errorCode!=409){ //Not a nickconflict
- if (eventObj.data.errorMessage != undefined) { //Some have message, if true, we'll display them
- popUpErreur(_root.__("ERROR")+" "+eventObj.data.errorCode+": "+newline+eventObj.data.errorMessage);
- removeMyEventListeners(); // remove the event listeners (not needed anymore)
- clearInterval(timerTest2); // This "room is active" test
- _root.closeFenetre(objectName); //Useless window, we close it
- }else{
- popUpErreur(_root.__("ERROR")+" "+eventObj.data.errorCode); //Just the error code!
- }
- }
+ }
+
+ // Click handler
+ private function localOnRelease():Void{
+ if (_presenceIsExpanded){
+ _presenceIsExpanded = false
+ presenceMinIcon._visible = false;
+ presenceMaxIcon._visible = true;
+ _lessonModel.setPresenceHeight(presenceHeightHide);
+
+ }else {
+ _presenceIsExpanded = true
+ presenceMinIcon._visible = true;
+ presenceMaxIcon._visible = false;
+ _lessonModel.setPresenceHeight(presenceHeightFull);
+ //Application.getInstance().onResize();
+ }
+ }
+
+ // First connection attempt called once Lesson is loaded correctly
+ private function attemptFirstConnection():Void{
+ attemptConnection();
+ checkConnectionEstablished();
+ }
+
+ // Attempts a connection with a given Jabber server
+ private function attemptConnection():Void{
+ Debugger.log('PRESENCE: attempting to connect',Debugger.MED,'connectionTimer','Presence');
+ connection.connect("flash");
+ }
+
+ // Checks to see if a connection has been established
+ private function checkConnectionEstablished():Void{
+ testConnectionInterval = setInterval(Proxy.create(this,connectionEstablishedTimer),500);
+ }
+
+ // Keeps testing connection
+ private function connectionEstablishedTimer():Void{
+ Debugger.log('PRESENCE: checking if connection is established',Debugger.MED,'connectionEstablishedTimer','Presence');
+
+ if(connection.isLoggedIn()){
+ Debugger.log('PRESENCE: connection established',Debugger.MED,'connectionEstablishedTimer','Presence');
+
+ clearInterval(testConnectionInterval);
+
+ joinChatRoom();
+ setupDataGrid();
+ }
+ }
+
+ // Attempts to register a new user
+ private function attemptRegistration(){
+ Debugger.log('PRESENCE: attempting to register',Debugger.MED,'attemptRegistration','Presence');
+
+ if(_lessonModel.userFirstName == null || _lessonModel.userLastName == null) {
+ if(!registrationRetryInterval) {
+ registrationRetryInterval = setInterval(Proxy.create(this, attemptRegistration), REGRETRYTIME);
+ }
+ }
+ else {
+ clearInterval(registrationRetryInterval);
+ var email:String = new String("");
+ var name:String = new String(_lessonModel.userFirstName + _lessonModel.userLastName);
+ var userID:String = new String(_root.userID);
+ var password:String = new String(_root.userID);
+ var loginAfter:Boolean = true;
+
+ regNecessaryFields = {username:userID, password:password, name:name, email:email, loginAfter:loginAfter};
+
+ connection.sendRegistrationFields(regNecessaryFields);
+ }
+ }
+
+ // Attempts to join a chat room
+ private function joinChatRoom():Void{
+ Debugger.log('PRESENCE: attempting to create and join chatroom',Debugger.MED,'joinChatRoom','Presence');
+
+ if(Application.getInstance().userDataLoaded) {
+ if(_lessonModel.userFirstName == null || _lessonModel.userLastName == null) {
+ Debugger.log('PRESENCE: names are null, can not join chat room',Debugger.MED,'joinChatRoom','Presence');
+
+ clearInterval(joinChatRetryInterval);
+ clearInterval(testConnectionInterval);
+ }
+ else {
+ Debugger.log('PRESENCE: attempting to create and join chatroom',Debugger.MED,'joinChatRoom','Presence');
+
+ clearInterval(joinChatRetryInterval);
+ room = new Room(connection);
+
+ room.addEventListener("groupMessage", Proxy.create(this, handleChatEvent));
+ room.addEventListener("userJoin", Proxy.create(this, handleChatEvent));
+ room.addEventListener("userDeparture", Proxy.create(this, handleChatEvent));
+ room.addEventListener("subjectChange", Proxy.create(this, handleChatEvent));
+ room.addEventListener("affiliations", Proxy.create(this, handleChatEvent));
+ room.addEventListener("roomRosterUpdated", Proxy.create(this, handleChatEvent));
+ room.addEventListener("configureForm", Proxy.create(this, handleChatEvent));
+ room.addEventListener("declined", Proxy.create(this, handleChatEvent));
+ room.addEventListener("nickConflict", Proxy.create(this, handleChatEvent));
+ room.addEventListener("privateMessage", Proxy.create(this, handleChatEvent));
+
+ room.roomName = String(_root.lessonID);
+ room.nickname = String(_lessonModel.userFirstName + _lessonModel.userLastName);
+ room.password = null;
+ room.conferenceServer = "conference." + _root.presenceServerUrl;
+ room.join();
+ }
+ }
+ else{
+ if(!joinChatRetryInterval) {
+ joinChatRetryInterval = setInterval(Proxy.create(this, joinChatRoom), JOINCHATRETRYTIME);
+ }
+ }
+ }
+
+ // Chat event handler
+ private function handleChatEvent(eventObj):Void{
+ Debugger.log("PRESENCE: chat event "+eventObj.type,Debugger.MED,'handleChatEvent','Presence');
+ switch (eventObj.type) {
+
+ case "nickConflict":
+ Debugger.log('PRESENCE: nickConflict event',Debugger.MED,'handleChatEvent','Presence');
+ /*
+ popUpErreur(_root.__("ERROR")+" : "+newline+_root.__("nick already in use")+newline+_root.__("I add ~ to the nickname") );
+ chatRoom.nickname=nickn.text+"~";
+ nickn.text=chatRoom.nickname;
+ if(!chatRoom.isActive())
+ chatRoom.join();
+ //SEE PRESENCE EVENT
+ */
+ break;
+
+ case "roomRosterUpdated" :
+ Debugger.log('PRESENCE: roomRosterUpdated event',Debugger.MED,'handleChatEvent','Presence');
+ break;
+
+ case "groupMessage" :
+ Debugger.log('PRESENCE: groupMessage event',Debugger.MED,'handleChatEvent','Presence');
+ /*
+ //Be careful, if there are many chatroom opened, you need to tell them to recognize their message
+ var msg = eventObj.data;
+
+ //var msgDelay:DelayExtension = msg.getAllExtensionsByNS(DelayExtension.NS)[0];
+ //
+ var nick = msg.from.split("/")[1];
+
+ // trace(msgDelay.stamp);
+
+ addToChatOutput(nick, msg.body);
+ */
+ break;
+
+ case "subjectChange" :
+ Debugger.log('PRESENCE: subject = ' + eventObj.subject,Debugger.MED,'handleChatEvent','Presence');
+ break;
+
+ case "login" :
+ Debugger.log('PRESENCE: room login event',Debugger.MED,'handleChatEvent','Presence');
+
+ // Rejoin room if automatically disconnected
+ rejoinOnIdleInterval = setInterval(Proxy.create(this, rejoinTimer), 500);
+ break;
+
+ case "presence" :
+ Debugger.log('PRESENCE: room presence event',Debugger.MED,'handleChatEvent','Presence');
+ /*
+ // Some error message, like wrong nickname, or multiple room nickname change (impossible to do on jive...)
+ if(eventObj.data.type=="error" && chatRoom.isThisRoom(eventObj.data.from)){ //It's this room error
+ if(eventObj.data.errorCode!=409){ //Not a nickconflict
+ if (eventObj.data.errorMessage != undefined) { //Some have message, if true, we'll display them
+ popUpErreur(_root.__("ERROR")+" "+eventObj.data.errorCode+": "+newline+eventObj.data.errorMessage);
+ removeMyEventListeners(); // remove the event listeners (not needed anymore)
+ clearInterval(timerTest2); // This "room is active" test
+ _root.closeFenetre(objectName); //Useless window, we close it
+ }else{
+ popUpErreur(_root.__("ERROR")+" "+eventObj.data.errorCode); //Just the error code!
+ }
+ }
}
- */
- break;
-
- case "userJoin" :
- Debugger.log('PRESENCE: userJoin event',Debugger.MED,'handleChatEvent','Presence');
- break;
-
- case "userDeparture" :
- Debugger.log('PRESENCE: userDeparture event',Debugger.MED,'handleChatEvent','Presence');
-
- break;
-
- case "affiliations" :
- Debugger.log('PRESENCE: affiliations event',Debugger.MED,'handleChatEvent','Presence');
- break;
-
- case "declined" :
- Debugger.log('PRESENCE: declined event',Debugger.MED,'handleChatEvent','Presence');
- break;
-
- case "privateMessage":
- Debugger.log('PRESENCE: privateMessage event',Debugger.MED,'handleChatEvent','Presence');
- /*
- //"message" :
- // Opening a private chat window on new message
- var msg = eventObj.data;
- var nick = msg.from.split("/")[0]; // b0ris@usuc.dyndns.org or nomChat@conference.usuc.dyndns.org
- var nick2 = msg.from.split("/")[1]; // nomClient b0ris
- var nick3 = nick.split("@")[1]; // usuc.dyndns.org conference.usuc.dyndns.org
- if (nick3 == roomServer) {
- addPrivateChatWindow(nick2, msg); // We add the window, and we send it the message
- }
- */
- break;
- }
- }
-
- // Glocal event handler
- private function handleGlobalEvent(eventObj):Void{
- Debugger.log("PRESENCE: global event "+eventObj.type,Debugger.MED,'handleGlobalEvent','Presence');
-
- switch (eventObj.type) {
-
- case "outgoingData":
- Debugger.log('PRESENCE: outgoing data ' + eventObj.data,Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "incomingData":
- Debugger.log('PRESENCE: incoming data ' + eventObj.data,Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "changePasswordSuccess":
- Debugger.log('PRESENCE: changePasswordSuccess event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "PrivateDataReceived":
- Debugger.log('PRESENCE: PrivateDataReceived event',Debugger.MED,'handleGlobalEvent','Presence');
- /*
- wait.log.text+=__("Received private Datas")+"
";
- var tab:Array=new Array();
- tab=PrivateData.getConference();
- for(var i=0;i";
- var resultIQ:IQ=eventObj.resultIQ;
- var ext:VCardExtension = resultIQ.getAllExtensionsByNS(VCardExtension.NS)[0];
- var obj:Array=ext.getAllItems(); // By default, the form is the message form
- var daForm:Array=obj;
- var leJID:String;
- if(resultIQ.from!=undefined){
- var objectName = generateObjectName("VCard_"+resultIQ.from);
- leJID=resultIQ.from;
- }else{ //My VCard
- // The displayed form is the complete form.
- daForm=ext.getAllFields();
- var objectName = generateObjectName("VCard_"+resultIQ.to);
- leJID=resultIQ.to;
- }
- if (ajouter(objectName)) {
- _root.attachMovie("VCard", objectName, curDepth++, {objectName:objectName,leJID:leJID.split("/")[0], receivedMessage:obj, form:daForm});
- barre.addNewTab(objectName, objectName, true);
- }
- */
- break;
-
- case "VCardSent":
- Debugger.log('PRESENCE: VCardSent event',Debugger.MED,'handleGlobalEvent','Presence');
- /*
- var resultIQ:IQ=eventObj.resultIQ;
- var objectName = generateObjectName("VCard_"+resultIQ.to);
-
- if (!ajouter(objectName)) { //We close this window!
- closeFenetre(objectName);
- }
- */
- break;
-
- case "login" :
- Debugger.log('PRESENCE: global login event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "connection" :
- Debugger.log('PRESENCE: global connection event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "disconnection" :
- Debugger.log('PRESENCE: global disconnection event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "invited":
- Debugger.log('PRESENCE: invited event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "registrationFields":
- Debugger.log('PRESENCE: registrationFields event - fields required: ' + eventObj.fields,Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "registrationSuccess":
- Debugger.log('PRESENCE: registrationSuccess event',Debugger.MED,'handleGlobalEvent','Presence');
- attemptConnection();
- break;
-
- case "message" :
- Debugger.log('PRESENCE: message from ' + eventObj.data.from,Debugger.MED,'handleGlobalEvent','Presence');
- /*
- //Opens private chat windows, listen to all entering messages - display broadcast messages (written to SERVER/announces/motd or SERVER/announces/online)
- var msg = eventObj.data;
- if(msg.from==domaine){ //It's a jabber server broadcast
- d=new Date();
- ch = "{"+d.getUTCHours()+":"+d.getUTCMinutes()+":"+d.getUTCSeconds()+"} - ";
- MainMenu.logContacts.text += ch+"Broadcast:
"+msg.body+"
";
- } // We got a b0ris@usuc.dyndns.org/xiff address
- var nick = msg.from.split("/")[0]; // b0ris@usuc.dyndns.org
- var nick2 = nick.split("@")[0]; // clientName : xiff
- var nick3 = nick.split("@")[1]; // Domain Name : usuc.dyndns.org
- if (msg.type == Message.CHAT_TYPE) {
- // DO IT BETTER ------ parsing chat or conference is not a beautiful solution
- if (nick3.split(".")[0].indexOf("chat") == -1 && nick3.split(".")[0].indexOf("conference") == -1 && nick3.split(".")[0].indexOf("public") == -1) {
- //It doesn't come from a public chat (the public chat private message interception is made on each public chat)
- //trace("global ouvre prive "+nick)
- addPrivateChatWindow(nick, msg); //Opens the needed window, and sends the message to the newly created object
- }
- }
- */
- break;
-
- case "subscriptionRequest" :
- Debugger.log('PRESENCE: subscriptionRequest event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "subscriptionRevocation" :
- Debugger.log('PRESENCE: subscriptionRevocation event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "subscriptionDenial" :
- Debugger.log('PRESENCE: subscriptionDenial event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "presence" :
- Debugger.log('PRESENCE: global presence event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "error":
- Debugger.log('PRESENCE: errorevent - error code: '+ String(eventObj.data.errorCode) + ' - errorMessage: ' + String(eventObj.data.errorMessage),Debugger.MED,'handleGlobalEvent','Presence');
-
- // Switch on error code
- switch(eventObj.data.errorCode) {
- // Case 401 login unauthorized, attempt to register user
- case 401:
- Debugger.log('PRESENCE: case 401 - attempting to register',Debugger.MED,'handleGlobalEvent','Presence');
- attemptRegistration();
- break;
- // Case 409 registration details incorrect
- case 409:
- Debugger.log('PRESENCE: case 409 - registration details incorrect',Debugger.MED,'handleGlobalEvent','Presence');
- break;
- // Default error case login unauthorized, attempt to register user
- default:
- Debugger.log('PRESENCE: default case - attempting to register',Debugger.MED,'handleGlobalEvent','Presence');
- attemptRegistration();
- break;
- }
- break;
-
- case "userUnavailable" :
- Debugger.log('PRESENCE: userUnavailable event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
-
- case "userAvailable" :
- Debugger.log('PRESENCE: userAvailable event',Debugger.MED,'handleGlobalEvent','Presence');
- break;
- }
- }
-
- public function isPresenceExpanded():Boolean{
- return _presenceIsExpanded;
- }
-
- public function presenceFullHeight():Number{
- return presenceHeightFull;
- }
-
- 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 = ApplicationParent.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(){
- Debugger.log('PRESENCE: setting styles',Debugger.MED,'setStyles','Presence');
- var styleObj = _tm.getStyleObject('smallLabel');
-
- styleObj = _tm.getStyleObject('textarea');
- presenceTitle_lbl.setStyle('styleName', styleObj);
-
- //For Panels
- styleObj = _tm.getStyleObject('BGPanel');
- presenceHead_pnl.setStyle('styleName',styleObj);
- }
-
- private function setLabels(){
- Debugger.log('PRESENCE: setting labels',Debugger.MED,'setLabels','Presence');
-
- presenceTitle_lbl.text = Dictionary.getValue('pres_panel_lbl');
- setStyles();
- delete this.onEnterFrame;
- dispatchEvent({type:'load',target:this});
-
- }
-
- private function setupDataGrid(){
- Debugger.log('PRESENCE: setting up dataGrid',Debugger.MED,'setLabels','Presence');
- _users_dg.addEventListener("cellPress", Proxy.create(this, cellPress));
- _users_dg.columnNames = ["nickname"];
-
- var col:mx.controls.gridclasses.DataGridColumn;
- col = _users_dg.getColumnAt(0);
- col.headerText = "Learners:";
- col.width = _users_dg._width;
-
- _users_dg.vScrollPolicy = "auto";
-
- _users_dg.dataProvider = room;
- _users_dg.sortItemsBy("nickname");
- }
-
- private function cellPress(event) {
- // I'm not clicking on an empty cell
- if (event.target.selectedItem.nickname != undefined) {
- //Double click action
- if (clickInterval != null && _users_dg.selectedItem.nickname == selectedChatItem.nickname) {
- Debugger.log('PRESENCE: double click event',Debugger.MED,'cellPress','Presence');
-
- //_debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
-
- clearInterval(clickInterval);
+ */
+ break;
+
+ case "userJoin" :
+ Debugger.log('PRESENCE: userJoin event',Debugger.MED,'handleChatEvent','Presence');
+ break;
+
+ case "userDeparture" :
+ Debugger.log('PRESENCE: userDeparture event',Debugger.MED,'handleChatEvent','Presence');
+
+ break;
+
+ case "affiliations" :
+ Debugger.log('PRESENCE: affiliations event',Debugger.MED,'handleChatEvent','Presence');
+ break;
+
+ case "declined" :
+ Debugger.log('PRESENCE: declined event',Debugger.MED,'handleChatEvent','Presence');
+ break;
+
+ case "privateMessage":
+ Debugger.log('PRESENCE: privateMessage event',Debugger.MED,'handleChatEvent','Presence');
+ /*
+ //"message" :
+ // Opening a private chat window on new message
+ var msg = eventObj.data;
+ var nick = msg.from.split("/")[0]; // b0ris@usuc.dyndns.org or nomChat@conference.usuc.dyndns.org
+ var nick2 = msg.from.split("/")[1]; // nomClient b0ris
+ var nick3 = nick.split("@")[1]; // usuc.dyndns.org conference.usuc.dyndns.org
+ if (nick3 == roomServer) {
+ addPrivateChatWindow(nick2, msg); // We add the window, and we send it the message
+ }
+ */
+ break;
+ }
+ }
+
+ // Glocal event handler
+ private function handleGlobalEvent(eventObj):Void{
+ Debugger.log("PRESENCE: global event "+eventObj.type,Debugger.MED,'handleGlobalEvent','Presence');
+
+ switch (eventObj.type) {
+
+ case "outgoingData":
+ Debugger.log('PRESENCE: outgoing data ' + eventObj.data,Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "incomingData":
+ Debugger.log('PRESENCE: incoming data ' + eventObj.data,Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "changePasswordSuccess":
+ Debugger.log('PRESENCE: changePasswordSuccess event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "PrivateDataReceived":
+ Debugger.log('PRESENCE: PrivateDataReceived event',Debugger.MED,'handleGlobalEvent','Presence');
+ /*
+ wait.log.text+=__("Received private Datas")+"
";
+ var tab:Array=new Array();
+ tab=PrivateData.getConference();
+ for(var i=0;i";
+ var resultIQ:IQ=eventObj.resultIQ;
+ var ext:VCardExtension = resultIQ.getAllExtensionsByNS(VCardExtension.NS)[0];
+ var obj:Array=ext.getAllItems(); // By default, the form is the message form
+ var daForm:Array=obj;
+ var leJID:String;
+ if(resultIQ.from!=undefined){
+ var objectName = generateObjectName("VCard_"+resultIQ.from);
+ leJID=resultIQ.from;
+ }else{ //My VCard
+ // The displayed form is the complete form.
+ daForm=ext.getAllFields();
+ var objectName = generateObjectName("VCard_"+resultIQ.to);
+ leJID=resultIQ.to;
+ }
+ if (ajouter(objectName)) {
+ _root.attachMovie("VCard", objectName, curDepth++, {objectName:objectName,leJID:leJID.split("/")[0], receivedMessage:obj, form:daForm});
+ barre.addNewTab(objectName, objectName, true);
+ }
+ */
+ break;
+
+ case "VCardSent":
+ Debugger.log('PRESENCE: VCardSent event',Debugger.MED,'handleGlobalEvent','Presence');
+ /*
+ var resultIQ:IQ=eventObj.resultIQ;
+ var objectName = generateObjectName("VCard_"+resultIQ.to);
+
+ if (!ajouter(objectName)) { //We close this window!
+ closeFenetre(objectName);
+ }
+ */
+ break;
+
+ case "login" :
+ Debugger.log('PRESENCE: global login event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "connection" :
+ Debugger.log('PRESENCE: global connection event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "disconnection" :
+ Debugger.log('PRESENCE: global disconnection event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "invited":
+ Debugger.log('PRESENCE: invited event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "registrationFields":
+ Debugger.log('PRESENCE: registrationFields event - fields required: ' + eventObj.fields,Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "registrationSuccess":
+ Debugger.log('PRESENCE: registrationSuccess event',Debugger.MED,'handleGlobalEvent','Presence');
+ attemptConnection();
+ break;
+
+ case "message" :
+ Debugger.log('PRESENCE: message from ' + eventObj.data.from,Debugger.MED,'handleGlobalEvent','Presence');
+ /*
+ //Opens private chat windows, listen to all entering messages - display broadcast messages (written to SERVER/announces/motd or SERVER/announces/online)
+ var msg = eventObj.data;
+ if(msg.from==domaine){ //It's a jabber server broadcast
+ d=new Date();
+ ch = "{"+d.getUTCHours()+":"+d.getUTCMinutes()+":"+d.getUTCSeconds()+"} - ";
+ MainMenu.logContacts.text += ch+"Broadcast:
"+msg.body+"
";
+ } // We got a b0ris@usuc.dyndns.org/xiff address
+ var nick = msg.from.split("/")[0]; // b0ris@usuc.dyndns.org
+ var nick2 = nick.split("@")[0]; // clientName : xiff
+ var nick3 = nick.split("@")[1]; // Domain Name : usuc.dyndns.org
+ if (msg.type == Message.CHAT_TYPE) {
+ // DO IT BETTER ------ parsing chat or conference is not a beautiful solution
+ if (nick3.split(".")[0].indexOf("chat") == -1 && nick3.split(".")[0].indexOf("conference") == -1 && nick3.split(".")[0].indexOf("public") == -1) {
+ //It doesn't come from a public chat (the public chat private message interception is made on each public chat)
+ //trace("global ouvre prive "+nick)
+ addPrivateChatWindow(nick, msg); //Opens the needed window, and sends the message to the newly created object
+ }
+ }
+ */
+ break;
+
+ case "subscriptionRequest" :
+ Debugger.log('PRESENCE: subscriptionRequest event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "subscriptionRevocation" :
+ Debugger.log('PRESENCE: subscriptionRevocation event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "subscriptionDenial" :
+ Debugger.log('PRESENCE: subscriptionDenial event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "presence" :
+ Debugger.log('PRESENCE: global presence event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "error":
+ Debugger.log('PRESENCE: errorevent - error code: '+ String(eventObj.data.errorCode) + ' - errorMessage: ' + String(eventObj.data.errorMessage),Debugger.MED,'handleGlobalEvent','Presence');
+
+ // Switch on error code
+ switch(eventObj.data.errorCode) {
+ // Case 401 login unauthorized, attempt to register user
+ case 401:
+ Debugger.log('PRESENCE: case 401 - attempting to register',Debugger.MED,'handleGlobalEvent','Presence');
+ attemptRegistration();
+ break;
+ // Case 409 registration details incorrect
+ case 409:
+ Debugger.log('PRESENCE: case 409 - registration details incorrect',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+ // Default error case login unauthorized, attempt to register user
+ default:
+ Debugger.log('PRESENCE: default case - attempting to register',Debugger.MED,'handleGlobalEvent','Presence');
+ attemptRegistration();
+ break;
+ }
+ break;
+
+ case "userUnavailable" :
+ Debugger.log('PRESENCE: userUnavailable event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+
+ case "userAvailable" :
+ Debugger.log('PRESENCE: userAvailable event',Debugger.MED,'handleGlobalEvent','Presence');
+ break;
+ }
+ }
+
+ public function isPresenceExpanded():Boolean{
+ return _presenceIsExpanded;
+ }
+
+ public function presenceFullHeight():Number{
+ return presenceHeightFull;
+ }
+
+ 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 = ApplicationParent.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(){
+ Debugger.log('PRESENCE: setting styles',Debugger.MED,'setStyles','Presence');
+ var styleObj = _tm.getStyleObject('smallLabel');
+
+ styleObj = _tm.getStyleObject('textarea');
+ presenceTitle_lbl.setStyle('styleName', styleObj);
+
+ //For Panels
+ styleObj = _tm.getStyleObject('BGPanel');
+ presenceHead_pnl.setStyle('styleName',styleObj);
+ }
+
+ private function setLabels(){
+ Debugger.log('PRESENCE: setting labels',Debugger.MED,'setLabels','Presence');
+
+ presenceTitle_lbl.text = Dictionary.getValue('pres_panel_lbl');
+ setStyles();
+ delete this.onEnterFrame;
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ private function setupDataGrid(){
+ Debugger.log('PRESENCE: setting up dataGrid',Debugger.MED,'setLabels','Presence');
+ _users_dg.addEventListener("cellPress", Proxy.create(this, cellPress));
+ _users_dg.columnNames = ["nickname"];
+
+ var col:mx.controls.gridclasses.DataGridColumn;
+ col = _users_dg.getColumnAt(0);
+ col.headerText = "Learners:";
+ col.width = _users_dg._width;
+
+ _users_dg.vScrollPolicy = "auto";
+
+ _users_dg.dataProvider = room;
+ _users_dg.sortItemsBy("nickname");
+ }
+
+ private function cellPress(event) {
+ // I'm not clicking on an empty cell
+ if (event.target.selectedItem.nickname != undefined) {
+ //Double click action
+ if (clickInterval != null && _users_dg.selectedItem.nickname == selectedChatItem.nickname) {
+ Debugger.log('PRESENCE: double click event',Debugger.MED,'cellPress','Presence');
+
+ //_debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'});
+
+ clearInterval(clickInterval);
clickInterval = null;
- // First click
- } else {
- clearInterval(clickInterval);
- clickInterval = null;
- selectedChatItem = _users_dg.selectedItem;
- lastClickX = _root._xmouse;
- lastClickY = _root._ymouse;
- clickInterval = setInterval(Proxy.create(this, endClickTimer), DOUBLECLICKSPEED);
- }
- }
- }
-
- private function endClickTimer() {
- // Do actions of first click
- Debugger.log('PRESENCE: single click event',Debugger.MED,'cellPress','Presence');
- clearInterval(clickInterval);
- //ajoutMenuChat(xK, yK);
- clickInterval = null;
- }
-
- function rejoinTimer() {
- // If not active, join
- if(!room.isActive()) {
- room.join();
- // If active, clear the interval
- } else{
- clearInterval(rejoinOnIdleInterval);
- }
- }
-
- public function resize(width:Number){
- panel._width = width;
-
- }
+ // First click
+ } else {
+ clearInterval(clickInterval);
+ clickInterval = null;
+ selectedChatItem = _users_dg.selectedItem;
+ lastClickX = _root._xmouse;
+ lastClickY = _root._ymouse;
+ clickInterval = setInterval(Proxy.create(this, endClickTimer), DOUBLECLICKSPEED);
+ }
+ }
+ }
+ private function endClickTimer() {
+ // Do actions of first click
+ Debugger.log('PRESENCE: single click event',Debugger.MED,'cellPress','Presence');
+ clearInterval(clickInterval);
+ //ajoutMenuChat(xK, yK);
+ clickInterval = null;
+ }
+
+ function rejoinTimer() {
+ // If not active, join
+ if(!room.isActive()) {
+ room.join();
+ // If active, clear the interval
+ } else{
+ clearInterval(rejoinOnIdleInterval);
+ }
+ }
+
+ public function resize(width:Number){
+ panel._width = width;
+
+ }
+
function get className():String {
return 'Presence';
- }
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Scratchpad.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Scratchpad.as (.../Scratchpad.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Scratchpad.as (.../Scratchpad.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -20,54 +20,54 @@
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
*/
-import org.lamsfoundation.lams.learner.*;
+import org.lamsfoundation.lams.learner.*;
import org.lamsfoundation.lams.learner.ls.*;
-import org.lamsfoundation.lams.common.Sequence;
+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.ApplicationParent;
-import mx.controls.*
-import mx.utils.*
-import mx.managers.*
-import mx.events.*
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.ApplicationParent;
+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;
+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 _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 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 _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
@@ -81,15 +81,15 @@
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));
-
+
+ _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));
+
}
/**
@@ -98,159 +98,159 @@
public function init(){
//Delete the enterframe dispatcher
delete this.onEnterFrame;
- _lessonModel = _lessonModel;
- _lessonController = _lessonController;
- _scratchpad_mc = this;
- _spadIsExpended = false;
- maxIcon._visible = true;
- minIcon._visible = false;
- _lessonModel.setSpadHeight(spadHeightHide);
- setLabels();
- resize(Stage.width);
-
-
+ _lessonModel = _lessonModel;
+ _lessonController = _lessonController;
+ _scratchpad_mc = this;
+ _spadIsExpended = false;
+ maxIcon._visible = true;
+ minIcon._visible = false;
+ _lessonModel.setSpadHeight(spadHeightHide);
+ setLabels();
+ resize(Stage.width);
+
+
//Add event listeners for resume and exit buttons
view_btn.onRelease = function(){
- Application.getInstance().getScratchpad().viewNotebookEntries();
+ Application.getInstance().getScratchpad().viewNotebookEntries();
}
save_btn.onRelease = function(){
- 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;
+ Application.getInstance().getScratchpad().saveEntry();
+ }
- }
-
- public function localOnRelease():Void{
-
- if (_spadIsExpended){
- _spadIsExpended = false
- minIcon._visible = false;
- maxIcon._visible = true;
- _lessonModel.setSpadHeight(spadHeightHide);
-
- }else {
- _spadIsExpended = true
- minIcon._visible = true;
- maxIcon._visible = false;
- _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 = ApplicationParent.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;
-
- }
+ 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){
+ _spadIsExpended = false
+ minIcon._visible = false;
+ maxIcon._visible = true;
+ _lessonModel.setSpadHeight(spadHeightHide);
+
+ }else {
+ _spadIsExpended = true
+ minIcon._visible = true;
+ maxIcon._visible = false;
+ _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 = ApplicationParent.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/ls/Lesson.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/Lesson.as (.../Lesson.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/Lesson.as (.../Lesson.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,36 +1,36 @@
-/***************************************************************************
- * 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.*;
+/***************************************************************************
+ * 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.util.*;
-import org.lamsfoundation.lams.common.Progress;
-import org.lamsfoundation.lams.common.ui.Cursor;
-import org.lamsfoundation.lams.common.ui.LFMessage;
-import org.lamsfoundation.lams.common.dict.Dictionary;
-import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.Progress;
+import org.lamsfoundation.lams.common.ui.Cursor;
+import org.lamsfoundation.lams.common.ui.LFMessage;
+import org.lamsfoundation.lams.common.dict.Dictionary;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
-import mx.managers.*;
+import mx.managers.*;
/**
* Lesson - LAMS Application
@@ -43,19 +43,19 @@
// View
private var lessonView:LessonView;
private var lessonView_mc:MovieClip;
-
- private var _lesson:Lesson;
-
+
+ private var _lesson:Lesson;
+
private var _instance:Lesson;
private var _className:String = "Lesson";
- private var _finishedDesign:Boolean = false;
-
- private static var LOAD_CHECK_INTERVAL:Number = 50;
- private static var LOAD_CHECK_TIMEOUT_COUNT:Number = 300;
-
- private var _loadCheckCount = 0;
- private var _loadCheckIntervalID:Number;
-
+ private var _finishedDesign:Boolean = false;
+
+ private static var LOAD_CHECK_INTERVAL:Number = 50;
+ private static var LOAD_CHECK_TIMEOUT_COUNT:Number = 300;
+
+ private var _loadCheckCount = 0;
+ private var _loadCheckIntervalID:Number;
+
private var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
@@ -70,7 +70,7 @@
//Create the model
lessonModel = new LessonModel(this);
-
+
//Create the view
lessonView_mc = target_mc.createChildAtDepth("Lesson",DepthManager.kTop);
lessonView = LessonView(lessonView_mc);
@@ -83,301 +83,301 @@
//Set the position by setting the model which will call update on the view
lessonModel.setPosition(x,y);
-
- }
-
- /**
- * event broadcast when a new lesson is loaded
- */
- public function broadcastInit(){
- dispatchEvent({type:'init',target:this});
- }
-
- /**
- * gets lesson to populate its properties from server reponse dto
- */
- public function populateFromDTO(dto:Object){
- lessonModel.populateFromDTO(dto);
+
}
-
- /**
- * redirects the view's load event
+
+ /**
+ * event broadcast when a new lesson is loaded
*/
+ public function broadcastInit(){
+ dispatchEvent({type:'init',target:this});
+ }
+
+ /**
+ * gets lesson to populate its properties from server reponse dto
+ */
+ public function populateFromDTO(dto:Object){
+ lessonModel.populateFromDTO(dto);
+ }
+
+ /**
+ * redirects the view's load event
+ */
private function viewLoaded(evt:Object){
Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Lesson');
-
+
if(evt.type=='load') {
dispatchEvent({type:'load',target:this});
}else {
//Raise error for unrecognized event
}
}
-
- /**
- * gets lesson from server given its ID
+
+ /**
+ * gets lesson from server given its ID
*/
- public function getLesson():Boolean {
- var callback:Function = Proxy.create(this,storeLessonData);
-
- // call action
- var lessonId:Number = _root.lessonID;
-
- // do request
- Application.getInstance().getComms().getRequest('learning/learner.do?method=getLesson&lessonID='+String(lessonId), callback, false);
-
- return true;
- }
-
- public function joinLesson():Boolean {
-
- var callback:Function = Proxy.create(this,startLesson);
-
- // call action
- var lessonId:Number = lessonModel.ID;
-
- // do request
- Application.getInstance().getComms().getRequest('learning/learner.do?method=joinLesson&lessonID='+String(lessonId), callback, false);
-
- // get Learning Design for lesson
- openLearningDesign();
-
- return true;
- }
-
- public function resumeLesson():Boolean{
- var callback:Function = Proxy.create(this,continueLesson);
-
- // call action
- var lessonId:Number = lessonModel.ID;
-
- // do request
- Application.getInstance().getComms().getRequest('learning/learner.do?method=resumeLesson&lessonID='+String(lessonId), callback, false);
-
- return true;
- }
-
- public function continueLesson(pkt:Object){
- getURL(_root.serverURL + 'learning'+String(pkt)+'?progressId='+lessonModel.getLessonID(),'contentFrame');
-
- }
-
- public function exitLesson():Boolean {
- var callback:Function = Proxy.create(this, exitConfirm);
-
- // call action
- var lessonId:Number = lessonModel.ID;
-
- // do request
- Application.getInstance().getComms().getRequest('learning/learner.do?method=exitLesson&lessonID='+String(lessonId), callback, false);
-
- return true;
- }
-
- public function exitConfirm(pkt:Object){
- if(pkt) { fscommand('closeWindow', null); }
- }
-
- public function exportLesson(){
- // do export call
- var exp_url:String = _root.serverURL + 'learning/exportWaitingPage.jsp?mode=learner&lessonID='+String(lessonModel.ID);
-
- JsPopup.getInstance().launchPopupWindow(exp_url, 'ExportPortfolioLearner', 410, 640, true, true, false, false, false);
- }
-
- private function storeLessonData(dto:Object){
- lessonModel.populateFromDTO(dto);
- openLearningDesign();
- }
-
- private function startLesson(pkt:Object){
- // set lesson as active
- lessonModel.setActive();
- getURL(_root.serverURL + 'learning'+String(pkt)+'?lessonID='+lessonModel.getLessonID(),'contentFrame');
-
- // check was successful join
- getFlashProgress();
-
- }
-
- public function moveToActivity(fromAct, toAct){
- var callback:Function = Proxy.create(this, afterMoveActivity);
-
- // call action
- var lessonId:Number = lessonModel.ID;
-
- // do request
- Application.getInstance().getComms().getRequest('learning/learner.do?method=forceMove&lessonID='+String(lessonId)+'&learnerID='+_root.userID+'¤tActivityID='+fromAct+'&destActivityID='+toAct, callback, false);
-
- return true;
-
- }
-
- private function afterMoveActivity(pkt:Object){
- getURL(_root.serverURL + 'learning'+String(pkt)+'?lessonID='+lessonModel.getLessonID(),'contentFrame');
- }
-
- private function getFlashProgress():Void{
- Debugger.log('Loading flash progress.',Debugger.CRITICAL,'getFlashProgress','Lesson');
-
- if(!finishedDesign) {
- // first time through set interval for method polling
- if(!_loadCheckIntervalID) {
- _loadCheckIntervalID = setInterval(Proxy.create(this, getFlashProgress), LOAD_CHECK_INTERVAL);
- } else {
- _loadCheckCount++;
- Debugger.log('Waiting (' + _loadCheckCount + ') for data to load...',Debugger.CRITICAL,'getFlashProgress','Lesson');
-
- // if design loaded
- if(finishedDesign) {
- clearInterval(_loadCheckIntervalID);
-
- callFlashProgress();
-
- } else if(_loadCheckCount >= 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){
- // load exit jsp
- getURL(_root.serverURL + 'learning'+String(pkt), 'contentFrame');
- }
-
- public function reloadLearningDesign() {
- openLearningDesign();
- }
-
- private function openLearningDesign(){
- 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){
- 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 getLesson():Boolean {
+ var callback:Function = Proxy.create(this,storeLessonData);
+
+ // call action
+ var lessonId:Number = _root.lessonID;
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=getLesson&lessonID='+String(lessonId), callback, false);
+
+ return true;
}
-
- 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;
- }
+ public function joinLesson():Boolean {
+
+ var callback:Function = Proxy.create(this,startLesson);
+
+ // call action
+ var lessonId:Number = lessonModel.ID;
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=joinLesson&lessonID='+String(lessonId), callback, false);
+
+ // get Learning Design for lesson
+ openLearningDesign();
+
+ return true;
+ }
+
+ public function resumeLesson():Boolean{
+ var callback:Function = Proxy.create(this,continueLesson);
+
+ // call action
+ var lessonId:Number = lessonModel.ID;
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=resumeLesson&lessonID='+String(lessonId), callback, false);
+
+ return true;
+ }
+
+ public function continueLesson(pkt:Object){
+ getURL(_root.serverURL + 'learning'+String(pkt)+'?progressId='+lessonModel.getLessonID(),'contentFrame');
+
+ }
+
+ public function exitLesson():Boolean {
+ var callback:Function = Proxy.create(this, exitConfirm);
+
+ // call action
+ var lessonId:Number = lessonModel.ID;
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=exitLesson&lessonID='+String(lessonId), callback, false);
+
+ return true;
+ }
+
+ public function exitConfirm(pkt:Object){
+ if(pkt) { fscommand('closeWindow', null); }
+ }
+
+ public function exportLesson(){
+ // do export call
+ var exp_url:String = _root.serverURL + 'learning/exportWaitingPage.jsp?mode=learner&lessonID='+String(lessonModel.ID);
+
+ JsPopup.getInstance().launchPopupWindow(exp_url, 'ExportPortfolioLearner', 410, 640, true, true, false, false, false);
+ }
+
+ private function storeLessonData(dto:Object){
+ lessonModel.populateFromDTO(dto);
+ openLearningDesign();
+ }
+
+ private function startLesson(pkt:Object){
+ // set lesson as active
+ lessonModel.setActive();
+ getURL(_root.serverURL + 'learning'+String(pkt)+'?lessonID='+lessonModel.getLessonID(),'contentFrame');
+
+ // check was successful join
+ getFlashProgress();
+
+ }
+
+ public function moveToActivity(fromAct, toAct){
+ var callback:Function = Proxy.create(this, afterMoveActivity);
+
+ // call action
+ var lessonId:Number = lessonModel.ID;
+
+ // do request
+ Application.getInstance().getComms().getRequest('learning/learner.do?method=forceMove&lessonID='+String(lessonId)+'&learnerID='+_root.userID+'¤tActivityID='+fromAct+'&destActivityID='+toAct, callback, false);
+
+ return true;
+
+ }
+
+ private function afterMoveActivity(pkt:Object){
+ getURL(_root.serverURL + 'learning'+String(pkt)+'?lessonID='+lessonModel.getLessonID(),'contentFrame');
+ }
+
+ private function getFlashProgress():Void{
+ Debugger.log('Loading flash progress.',Debugger.CRITICAL,'getFlashProgress','Lesson');
+
+ if(!finishedDesign) {
+ // first time through set interval for method polling
+ if(!_loadCheckIntervalID) {
+ _loadCheckIntervalID = setInterval(Proxy.create(this, getFlashProgress), LOAD_CHECK_INTERVAL);
+ } else {
+ _loadCheckCount++;
+ Debugger.log('Waiting (' + _loadCheckCount + ') for data to load...',Debugger.CRITICAL,'getFlashProgress','Lesson');
+
+ // if design loaded
+ if(finishedDesign) {
+ clearInterval(_loadCheckIntervalID);
+
+ callFlashProgress();
+
+ } else if(_loadCheckCount >= 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){
+ // load exit jsp
+ getURL(_root.serverURL + 'learning'+String(pkt), 'contentFrame');
+ }
+
+ public function reloadLearningDesign() {
+ openLearningDesign();
+ }
+
+ private function openLearningDesign(){
+ 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){
+ 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
@@ -408,18 +408,18 @@
public function get y():Number{
return lessonModel.y;
- }
-
- public function set finishedDesign(a:Boolean){
- _finishedDesign = a;
- }
-
- public function get finishedDesign():Boolean{
- return _finishedDesign;
}
+
+ 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 -rbc59f3782fcd9f37b6e1984f235c8b5e8c0087f5 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonController.as (.../LessonController.as) (revision bc59f3782fcd9f37b6e1984f235c8b5e8c0087f5)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonController.as (.../LessonController.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,43 +1,43 @@
-/***************************************************************************
- * 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.LearnerActivity;
-import org.lamsfoundation.lams.common.LearnerComplexActivity;
+/***************************************************************************
+ * 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.LearnerActivity;
+import org.lamsfoundation.lams.common.LearnerComplexActivity;
import org.lamsfoundation.lams.common.ApplicationParent;
-import org.lamsfoundation.lams.common.comms.Communication;
+import org.lamsfoundation.lams.common.comms.Communication;
import org.lamsfoundation.lams.common.mvc.*;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.dict.*;
-
-import org.lamsfoundation.lams.learner.*;
-import org.lamsfoundation.lams.learner.ls.*;
-
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*;
+
+import org.lamsfoundation.lams.learner.*;
+import org.lamsfoundation.lams.learner.ls.*;
+
import org.lamsfoundation.lams.authoring.Activity;
-
-import mx.managers.*;
-import mx.controls.*;
-import mx.events.*
+import mx.managers.*;
+import mx.controls.*;
+import mx.events.*
+
/*
* Make changes to Lesson's model data based on user input
*/
@@ -49,20 +49,20 @@
* @param cm The model to modify.
*/
private var _lessonModel:LessonModel;
- private var _app:Application;
+ 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;
+ //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();
+ _app = Application.getInstance();
_comms = _app.getComms();
- _lessonModel = LessonModel(model);
- _isBusy = false;
-
+ _lessonModel = LessonModel(model);
+ _isBusy = false;
+
EventDispatcher.initialize(this);
}
@@ -71,100 +71,100 @@
* the relevent method is called to action the user request
* @param evt
*/
- public function click(evt):Void{
+ public function click(evt):Void{
- var tgt:String = new String(evt.target);
- if(tgt.indexOf("export_btn") != -1){
- _lessonModel.getLesson().exportLesson();
- }
+ var tgt:String = new String(evt.target);
+ if(tgt.indexOf("export_btn") != -1){
+ _lessonModel.getLesson().exportLesson();
+ }
- }
-
- public function activityClick(ca:Object):Void{
- 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.isOptionalActivity() || ca.activity.isOptionsWithSequencesActivity() || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isGroupActivity() || ca.activity.isBranchingActivity() || ca.activity.isSequenceActivity()) {
-
- 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.isOptionalActivity() && !ca.activity.isOptionsWithSequencesActivity() && !ca.activity.isBranchingActivity()){
- _lessonModel.getLesson().getActivityURL(URLToSend, true);
- } else if(ca.activityStatus == 'completed_mc' && ca.activity.isOptionalActivity() && !ca.activity.isOptionsWithSequencesActivity() && !ca.activity.isBranchingActivity()){
- _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(_app.module == 'learner' && // sequence activities of optional sequences
- ca.activity.isOptionalSequenceActivity(_lessonModel.learningDesignModel.getActivityByUIID(ca.activity.parentUIID)) &&
- (ca._parent._parent.activityStatus == "current_mc" || ca._parent._parent.activityStatus == "attempted_mc")) {
-
- _lessonModel.getLesson().moveToActivity(_lessonModel.progressData.getCurrentActivityId(), ca.activity.parentActivityID);
-
- } 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 if(_app.module == 'learner' && ca.activityStatus == undefined && ca._parent._parent.activityStatus == "completed_mc") {
- var alertMSG:String = Dictionary.getValue('al_act_reached_max')
- getURL("javascript:alert('"+alertMSG+"');");
- } 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{
- var myObj:Object = new Object();
- myObj.compX = Application.LESSON_X
- myObj.compY = Application.LESSON_Y
- myObj.ttHolder = ApplicationParent.tooltip;
- return myObj;
-
- }
+ }
+
+ public function activityClick(ca:Object):Void{
+ 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.isOptionalActivity() || ca.activity.isOptionsWithSequencesActivity() || ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE || ca.activity.isGroupActivity() || ca.activity.isBranchingActivity() || ca.activity.isSequenceActivity()) {
+
+ 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.isOptionalActivity() && !ca.activity.isOptionsWithSequencesActivity() && !ca.activity.isBranchingActivity()){
+ _lessonModel.getLesson().getActivityURL(URLToSend, true);
+ } else if(ca.activityStatus == 'completed_mc' && ca.activity.isOptionalActivity() && !ca.activity.isOptionsWithSequencesActivity() && !ca.activity.isBranchingActivity()){
+ _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(_app.module == 'learner' && // sequence activities of optional sequences
+ ca.activity.isOptionalSequenceActivity(_lessonModel.learningDesignModel.getActivityByUIID(ca.activity.parentUIID)) &&
+ (ca._parent._parent.activityStatus == "current_mc" || ca._parent._parent.activityStatus == "attempted_mc")) {
+
+ _lessonModel.getLesson().moveToActivity(_lessonModel.progressData.getCurrentActivityId(), ca.activity.parentActivityID);
+
+ } 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 if(_app.module == 'learner' && ca.activityStatus == undefined && ca._parent._parent.activityStatus == "completed_mc") {
+ var alertMSG:String = Dictionary.getValue('al_act_reached_max')
+ getURL("javascript:alert('"+alertMSG+"');");
+ } 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{
+ var myObj:Object = new Object();
+ myObj.compX = Application.LESSON_X
+ myObj.compY = Application.LESSON_Y
+ myObj.ttHolder = ApplicationParent.tooltip;
+ return myObj;
+
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonModel.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonModel.as (.../LessonModel.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonModel.as (.../LessonModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,35 +1,35 @@
-/***************************************************************************
- * 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.*;
+/***************************************************************************
+ * 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.SequenceActivity;
-import org.lamsfoundation.lams.authoring.Transition;
+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.SequenceActivity;
+import org.lamsfoundation.lams.authoring.Transition;
/*
* Model for the Lesson
@@ -40,125 +40,125 @@
private var __width:Number;
private var __height:Number;
private var __x:Number;
- private var __y:Number;
- private var _spadHeight:Number;
+ private var __y:Number;
+ private var _spadHeight:Number;
private var _presenceHeight:Number;
private var _isDirty:Boolean;
private var infoObj:Object;
-
- private var _lesson:Lesson;
+ private var _lesson:Lesson;
+
// unique Lesson identifier
- private var _lessonID:Number;
-
- private var ddmActivity_keys:Array;
- private var ddmTransition_keys:Array;
+ 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;
- private var _learnerPresenceAvailable:Boolean;
- private var _learnerImAvailable:Boolean;
-
- /* the learningDesignModel gets set when you join a lesson */
- private var _learningDesignModel:DesignDataModel;
-
- private var _progressData:Progress;
+ private var _lessonStateID:Number;
+ private var _learningDesignID:Number;
+ private var _learnerExportAvailable:Boolean;
+ private var _learnerPresenceAvailable:Boolean;
+ private var _learnerImAvailable: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;
-
- private var _activeSeq:Array;
-
- private var _eventsDisabled:Boolean;
-
- /* user data */
- private var _userName:String = null;
- private var _userFirstName:String = null;
- private var _userLastName:String = null;
+ private var _active:Boolean;
+ private var _activeSeq:Array;
+
+ private var _eventsDisabled:Boolean;
+
+ /* user data */
+ private var _userName:String = null;
+ private var _userFirstName:String = null;
+ private var _userLastName:String = null;
+
/**
* Constructor.
*/
- public function LessonModel (lesson:Lesson){
- _lesson = lesson;
- _active = false;
- _learningDesignModel = null;
- _progressData = null;
- _currentActivityOpen = null;
-
- ddmActivity_keys = new Array();
- ddmTransition_keys = new Array();
- _activeSeq = new Array();
- _eventsDisabled = false;
-
+ public function LessonModel (lesson:Lesson){
+ _lesson = lesson;
+ _active = false;
+ _learningDesignModel = null;
+ _progressData = null;
+ _currentActivityOpen = null;
+
+ ddmActivity_keys = new Array();
+ ddmTransition_keys = new Array();
+ _activeSeq = new Array();
+ _eventsDisabled = false;
+
_activitiesDisplayed = new Hashtable("_activitiesDisplayed");
- }
-
- public function populateFromDTO(dto:Object){
- _lessonID = dto.lessonID;
- _lessonName = dto.lessonName;
- _lessonDescription = dto.lessonDescription;
- _lessonStateID = dto.lessonStateID;
- _learningDesignID = dto.learningDesignID;
- _learnerExportAvailable = dto.learnerExportAvailable;
- _learnerPresenceAvailable = dto.learnerPresenceAvailable;
- _learnerImAvailable = dto.learnerImAvailable;
-
- Debugger.log("PRESENCE: " + dto.lessonID + " " + dto.lessonName + " " + dto.learnerExportAvailable + " " + dto.learnerPresenceAvailable + " " + dto.learnerImAvailable,Debugger.MED,'populateUserFromDTO','LessonModel');
-
- setChanged();
-
- // send update
- infoObj = {};
- infoObj.updateType = "LESSON";
- notifyObservers(infoObj);
- }
-
- public function setSpadHeight(h:Number){
- _spadHeight = h
- Application.getInstance().onResize();
- }
-
- public function getSpadHeight(){
- return _spadHeight;
- }
-
- public function setPresenceHeight(h:Number){
- _presenceHeight = h
- Application.getInstance().onResize();
- }
-
- public function getPresenceHeight(){
- return _presenceHeight;
- }
- /**
- * 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;
}
+
+ public function populateFromDTO(dto:Object){
+ _lessonID = dto.lessonID;
+ _lessonName = dto.lessonName;
+ _lessonDescription = dto.lessonDescription;
+ _lessonStateID = dto.lessonStateID;
+ _learningDesignID = dto.learningDesignID;
+ _learnerExportAvailable = dto.learnerExportAvailable;
+ _learnerPresenceAvailable = dto.learnerPresenceAvailable;
+ _learnerImAvailable = dto.learnerImAvailable;
+
+ Debugger.log("PRESENCE: " + dto.lessonID + " " + dto.lessonName + " " + dto.learnerExportAvailable + " " + dto.learnerPresenceAvailable + " " + dto.learnerImAvailable,Debugger.MED,'populateUserFromDTO','LessonModel');
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "LESSON";
+ notifyObservers(infoObj);
+ }
+
+ public function setSpadHeight(h:Number){
+ _spadHeight = h
+ Application.getInstance().onResize();
+ }
+
+ public function getSpadHeight(){
+ return _spadHeight;
+ }
+
+ public function setPresenceHeight(h:Number){
+ _presenceHeight = h
+ Application.getInstance().onResize();
+ }
+
+ public function getPresenceHeight(){
+ return _presenceHeight;
+ }
+ /**
+ * 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 userName
@@ -174,7 +174,7 @@
// send update
infoObj = {};
infoObj.updateType = "USERNAME";
- notifyObservers(infoObj);
+ notifyObservers(infoObj);
}
/**
@@ -184,107 +184,107 @@
*/
public function getUserName():String {
- return _userName;
+ return _userName;
}
-
- public function get userName():String{
- return _userName;
- }
-
- /**
- * Set the userFirstName
- *
- * @param userFirstName
- */
-
- public function setuserFirstName(userFirstName:String){
- _userFirstName = userFirstName;
-
- setChanged();
-
- // send update
- infoObj = {};
- infoObj.updateType = "USERFIRSTNAME";
- notifyObservers(infoObj);
- }
-
- /**
- * Get the userFirstName
- *
- * @return userFirstName
- */
-
- public function getuserFirstName():String {
- return _userFirstName;
- }
-
- public function get userFirstName():String{
- return _userFirstName;
- }
+
+ public function get userName():String{
+ return _userName;
+ }
+
+ /**
+ * Set the userFirstName
+ *
+ * @param userFirstName
+ */
+
+ public function setuserFirstName(userFirstName:String){
+ _userFirstName = userFirstName;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "USERFIRSTNAME";
+ notifyObservers(infoObj);
+ }
+
+ /**
+ * Get the userFirstName
+ *
+ * @return userFirstName
+ */
+
+ public function getuserFirstName():String {
+ return _userFirstName;
+ }
+
+ public function get userFirstName():String{
+ return _userFirstName;
+ }
- /**
- * Set the userLastName
- *
- * @param userLastName
- */
-
- public function setuserLastName(userLastName:String){
- _userLastName = userLastName;
-
- setChanged();
-
- // send update
- infoObj = {};
- infoObj.updateType = "USERLASTNAME";
- notifyObservers(infoObj);
- }
-
- /**
- * Get the userLastName
- *
- * @return userLastName
- */
-
- public function getuserLastName():String {
- return _userLastName;
- }
-
- public function get userLastName():String{
- return _userLastName;
- }
-
- /**
- * 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 userLastName
+ *
+ * @param userLastName
+ */
+ public function setuserLastName(userLastName:String){
+ _userLastName = userLastName;
+
+ setChanged();
+
+ // send update
+ infoObj = {};
+ infoObj.updateType = "USERLASTNAME";
+ notifyObservers(infoObj);
+ }
+
/**
+ * Get the userLastName
+ *
+ * @return userLastName
+ */
+
+ public function getuserLastName():String {
+ return _userLastName;
+ }
+
+ public function get userLastName():String{
+ return _userLastName;
+ }
+
+ /**
+ * 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
@@ -298,7 +298,7 @@
// send update
infoObj = {};
infoObj.updateType = "DESCRIPTION";
- notifyObservers(infoObj);
+ notifyObservers(infoObj);
}
/**
@@ -307,13 +307,13 @@
* @return lesson description
*/
public function getLessonDescription():String {
- return _lessonDescription;
- }
-
- public function get description():String{
- return _lessonDescription;
+ return _lessonDescription;
}
+ public function get description():String{
+ return _lessonDescription;
+ }
+
public function setLessonStateID(lessonStateID:Number) {
_lessonStateID = lessonStateID;
@@ -322,334 +322,334 @@
// send update
infoObj = {};
infoObj.updateType = "STATE";
- notifyObservers(infoObj);
+ 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 set learnerPresenceAvailable(b:Boolean) {
- _learnerPresenceAvailable = b;
- }
-
- public function get learnerPresenceAvailable():Boolean {
- return _learnerPresenceAvailable;
- }
-
- public function set learnerImAvailable(b:Boolean) {
- _learnerImAvailable = b;
- }
-
- public function get learnerImAvailable():Boolean {
- return _learnerImAvailable;
- }
-
- 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;
-
- setChanged();
-
- //send an update
- infoObj = {};
- infoObj.updateType = "STATUS";
- notifyObservers(infoObj);
- }
-
- public function setInactive() {
- _active = false;
-
- setChanged();
-
- //send an update
- infoObj = {};
- infoObj.updateType = "STATUS";
- notifyObservers(infoObj);
- }
-
- public function getStatus():Boolean {
- return _active;
- }
- private function orderDesign(activity:Activity, order:Array, backtrack:Boolean):Boolean{
- Debugger.log("order design activity: " + activity.title, Debugger.CRITICAL, "orderDesign", "LessonModel");
- if(backtrack == null || backtrack == undefined)
- backtrack = false;
-
- if(backtrack) order.pop();
- else order.push(activity);
-
- if(activity.isBranchingActivity()) {
- Debugger.log("branching activity found: " + activity.activityUIID, Debugger.CRITICAL, "orderDesign", "LessonModel");
-
- var children:Array = learningDesignModel.getComplexActivityChildren(activity.activityUIID);
- Debugger.log("seq children length: " + children.length, Debugger.CRITICAL, "orderDesign", "LessonModel");
-
- for(var i=0; i 0) {
- for(var i=0; i 0 || ddm_activity.parentUIID > 0) {
- if(_learningDesignModel.getActivityByUIID(ddm_activity.parentUIID).isSequenceActivity())
- broadcastViewUpdate("DRAW_ACTIVITY", ddm_activity);
- } else {
- broadcastViewUpdate("DRAW_ACTIVITY",ddm_activity);
- }
- }
-
- }
-
- public function updateDesign(){
- var indexArray:Array = setDesignOrder();
-
- Debugger.log("indexArray length: " + indexArray.length, Debugger.CRITICAL, "updateDesign", "LessonModel");
- Debugger.log("activitiesDisplayed length: " + activitiesDisplayed.size(), Debugger.CRITICAL, "updateDesign", "LessonModel");
-
- if(indexArray.length > activitiesDisplayed.size()) {
- broadcastViewUpdate("REMOVE_ACTIVITY_ALL");
- }
-
- //go through the design and get the activities and transitions
- var dataObj:Object;
- ddmActivity_keys = learningDesignModel.activities.keys();
-
- //loop through
- for(var i=0;i 0 || ddm_activity.parentUIID > 0){
- if(_learningDesignModel.getActivityByUIID(ddm_activity.parentUIID).isSequenceActivity())
- broadcastViewUpdate("UPDATE_ACTIVITY",ddm_activity);
- } else {
- broadcastViewUpdate("UPDATE_ACTIVITY",ddm_activity);
- }
- }
- }
-
- public function broadcastViewUpdate(updateType, data){
- if(_eventsDisabled) return;
-
- setChanged();
-
- //send an update
- infoObj = {};
- infoObj.updateType = updateType;
- infoObj.data = data;
- 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 set learnerPresenceAvailable(b:Boolean) {
+ _learnerPresenceAvailable = b;
+ }
+
+ public function get learnerPresenceAvailable():Boolean {
+ return _learnerPresenceAvailable;
+ }
+
+ public function set learnerImAvailable(b:Boolean) {
+ _learnerImAvailable = b;
+ }
+
+ public function get learnerImAvailable():Boolean {
+ return _learnerImAvailable;
+ }
+
+ 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;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "STATUS";
+ notifyObservers(infoObj);
+ }
+
+ public function setInactive() {
+ _active = false;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "STATUS";
+ notifyObservers(infoObj);
+ }
+
+ public function getStatus():Boolean {
+ return _active;
+ }
+
+ private function orderDesign(activity:Activity, order:Array, backtrack:Boolean):Boolean{
+ Debugger.log("order design activity: " + activity.title, Debugger.CRITICAL, "orderDesign", "LessonModel");
+ if(backtrack == null || backtrack == undefined)
+ backtrack = false;
+
+ if(backtrack) order.pop();
+ else order.push(activity);
+
+ if(activity.isBranchingActivity()) {
+ Debugger.log("branching activity found: " + activity.activityUIID, Debugger.CRITICAL, "orderDesign", "LessonModel");
+
+ var children:Array = learningDesignModel.getComplexActivityChildren(activity.activityUIID);
+ Debugger.log("seq children length: " + children.length, Debugger.CRITICAL, "orderDesign", "LessonModel");
+
+ for(var i=0; i 0) {
+ for(var i=0; i 0 || ddm_activity.parentUIID > 0) {
+ if(_learningDesignModel.getActivityByUIID(ddm_activity.parentUIID).isSequenceActivity())
+ broadcastViewUpdate("DRAW_ACTIVITY", ddm_activity);
+ } else {
+ broadcastViewUpdate("DRAW_ACTIVITY",ddm_activity);
+ }
+ }
+
+ }
+
+ public function updateDesign(){
+ var indexArray:Array = setDesignOrder();
+
+ Debugger.log("indexArray length: " + indexArray.length, Debugger.CRITICAL, "updateDesign", "LessonModel");
+ Debugger.log("activitiesDisplayed length: " + activitiesDisplayed.size(), Debugger.CRITICAL, "updateDesign", "LessonModel");
+
+ if(indexArray.length > activitiesDisplayed.size()) {
+ broadcastViewUpdate("REMOVE_ACTIVITY_ALL");
+ }
+
+ //go through the design and get the activities and transitions
+ var dataObj:Object;
+ ddmActivity_keys = learningDesignModel.activities.keys();
+
+ //loop through
+ for(var i=0;i 0 || ddm_activity.parentUIID > 0){
+ if(_learningDesignModel.getActivityByUIID(ddm_activity.parentUIID).isSequenceActivity())
+ broadcastViewUpdate("UPDATE_ACTIVITY",ddm_activity);
+ } else {
+ broadcastViewUpdate("UPDATE_ACTIVITY",ddm_activity);
+ }
+ }
+ }
+
+ public function broadcastViewUpdate(updateType, data){
+ if(_eventsDisabled) return;
+
+ 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
@@ -683,7 +683,7 @@
public function setPosition(x:Number,y:Number):Void{
//Set state variables
__x = x;
- __y = y;
+ __y = y;
//Set flag for notify observers
setChanged();
@@ -704,15 +704,15 @@
p.y = y;
return p;
}
-
- public function get activitiesDisplayed():Hashtable{
- return _activitiesDisplayed;
- }
-
- public function getActivityKeys():Array{
- return ddmActivity_keys;
- }
+
+ 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;
@@ -733,22 +733,22 @@
function get className():String{
return 'LessonModel';
}
-
- /**
- *
- * @return the Lesson
- */
- public function getLesson():Lesson{
- return _lesson;
- }
-
- public function findParent(a:Activity, b:Activity):Boolean {
- if(a.parentUIID == b.activityUIID)
- return true;
- else if(a.parentUIID == null)
- return false;
- else
- return findParent(_learningDesignModel.getActivityByUIID(a.parentUIID), b);
+
+ /**
+ *
+ * @return the Lesson
+ */
+ public function getLesson():Lesson{
+ return _lesson;
+ }
+
+ public function findParent(a:Activity, b:Activity):Boolean {
+ if(a.parentUIID == b.activityUIID)
+ return true;
+ else if(a.parentUIID == null)
+ return false;
+ else
+ return findParent(_learningDesignModel.getActivityByUIID(a.parentUIID), b);
}
-
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonView.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonView.as (.../LessonView.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/ls/LessonView.as (.../LessonView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,37 +1,37 @@
-/***************************************************************************
- * 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.*;
-
+/***************************************************************************
+ * 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.*;
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.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.*;
@@ -43,34 +43,34 @@
* @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 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;
+ 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;
@@ -79,11 +79,11 @@
/**
* Constructor
*/
- public function LessonView(){
- _activityList = new Array();
-
- _tm = ThemeManager.getInstance();
+ public function LessonView(){
+ _activityList = new Array();
+ _tm = ThemeManager.getInstance();
+
//Set up this class to use the Flash event delegation model
EventDispatcher.initialize(this);
}
@@ -95,21 +95,21 @@
public function init(m:Observable, c:Controller){
//Invoke superconstructor, which sets up MVC relationships.
- super (m, c);
+ super (m, c);
this.onEnterFrame = createLesson;
}
/**
* Sets up the lesson (clip)
*/
- public function createLesson() {
- //Delete the enterframe dispatcher
- delete this.onEnterFrame;
+ public function createLesson() {
+ //Delete the enterframe dispatcher
+ delete this.onEnterFrame;
setStyles();
- _lesson_mc = this;
+ _lesson_mc = this;
_depth = this.getNextHighestDepth();
//Now that view is setup dispatch loaded event
@@ -126,257 +126,257 @@
public function update (o:Observable,infoObj:Object):Void {
//Cast the generic observable object into the Toolbar model.
var lm:LessonModel = LessonModel(o);
-
+
//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 'REMOVE_ACTIVITY_ALL' :
- removeAll(lm);
- break;
- case 'LESSON' :
- // if export is available in model, make button available
- setLessonName(lm.name);
- Application.getInstance().getHeader().showExportButton(lm.learnerExportAvailable);
-
- // if presence is available in model, make the panel visible and connect
- if(lm.learnerPresenceAvailable) {
- Application.getInstance().getPresence().showPresence(lm.learnerPresenceAvailable);
- Application.getInstance().getPresence().attemptConnection();
- }
-
- break;
- case 'DESIGNMODEL' :
- 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');
- 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;
+ 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 'REMOVE_ACTIVITY_ALL' :
+ removeAll(lm);
+ break;
+ case 'LESSON' :
+ // if export is available in model, make button available
+ setLessonName(lm.name);
+ Application.getInstance().getHeader().showExportButton(lm.learnerExportAvailable);
+
+ // if presence is available in model, make the panel visible and connect
+ if(lm.learnerPresenceAvailable) {
+ Application.getInstance().getPresence().showPresence(lm.learnerPresenceAvailable);
+ Application.getInstance().getPresence().attemptConnection();
+ }
+
+ break;
+ case 'DESIGNMODEL' :
+ 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');
+ 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
- var r = lm.activitiesDisplayed.remove(a.activityUIID);
- r.removeMovieClip();
- var s:Boolean = (r==null) ? false : true;
-
- }
-
- public function removeAll(lm:LessonModel){
- Debugger.log("removin all", Debugger.CRITICAL, "removeAll", "LessonView");
-
- 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() || (a.isBranchingActivity() && _root.mode != 'preview')){
- 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/branching 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 || a.activityTypeID==Activity.OPTIONS_WITH_SEQUENCES_TYPE || (a.isBranchingActivity() && _root.mode == 'preview')){
- //get the children
- var children:Array = lm.learningDesignModel.getComplexActivityChildren(a.activityUIID);
- Debugger.log('The activity:'+a.title+','+a.activityTypeID+' is is complex (parallel, optional, branching) 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');
-
- }
- }
- }
+ 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
+ var r = lm.activitiesDisplayed.remove(a.activityUIID);
+ r.removeMovieClip();
+ var s:Boolean = (r==null) ? false : true;
+
+ }
+
+ public function removeAll(lm:LessonModel){
+ Debugger.log("removin all", Debugger.CRITICAL, "removeAll", "LessonView");
+
+ 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() || (a.isBranchingActivity() && _root.mode != 'preview')){
+ 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/branching 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 || a.activityTypeID==Activity.OPTIONS_WITH_SEQUENCES_TYPE || (a.isBranchingActivity() && _root.mode == 'preview')){
+ //get the children
+ var children:Array = lm.learningDesignModel.getComplexActivityChildren(a.activityUIID);
+ Debugger.log('The activity:'+a.title+','+a.activityTypeID+' is is complex (parallel, optional, branching) 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
*/
@@ -385,7 +385,7 @@
var s:Object = lm.getSize();
//Size panel
- bkg_pnl.setSize(s.w,s.h);
+ bkg_pnl.setSize(s.w,s.h);
progress_scp.setSize(s.w, s.h-progress_scp._y)
}
@@ -402,13 +402,13 @@
/**
* 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);
- }
+ 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
@@ -417,26 +417,26 @@
*/
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();
-
- Debugger.log("getting controller: " + LessonController(c), Debugger.CRITICAL, "getController", "LessonView");
-
- return LessonController(c);
- }
+ /**
+ * 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();
+
+ Debugger.log("getting controller: " + LessonController(c), Debugger.CRITICAL, "getController", "LessonView");
+
+ 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 -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/Application.as (.../Application.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/Application.as (.../Application.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,54 +1,54 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
+/***************************************************************************
+ * 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.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.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.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 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";
-
- public static var TOOLBAR_X:Number = 0;
- public static var TOOLBAR_Y:Number = 21;
+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";
+
+ public static var TOOLBAR_X:Number = 0;
+ public static var TOOLBAR_Y:Number = 21;
public static var MONITOR_X:Number = 0;
public static var MONITOR_Y:Number = 55;
@@ -58,93 +58,93 @@
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 = 55; //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 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;
+ 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 = 55; //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 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 _lessons:Lesson;
+ 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 _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 _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 _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;
+
+ 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;
+ 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);
-
+ 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);
+
}
/**
@@ -155,490 +155,490 @@
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;
-
- _root.preloader.setStartValue(50);
- _root.preloader.setEndValue(100);
- _root.preloader.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()
- _root.preloader.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){
- clearInterval(_UILoadCheckIntervalID);
- start();
- }else {
- //If UI loaded check which events can be broadcast
- if(_UILoaded){
- //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'){
-
- _layout.manager.addLayoutItem(new LFLayoutItem(evt.target.className, evt.target));
- _root.preloader.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 = _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{
- var ca = _monitor.getMM().selectedItem;
- if(CanvasActivity(ca) != null){
- _monitor.getMV().getController().activityDoubleClick(ca, "MonitorTabView", null, true);
- } 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
- _root.preloader.stop();
- _root._visible = true;
-
- if(SHOW_DEBUGGER){
- showDebugger();
- }
- }
-
- /**
- * 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;
-
- _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{
- }
-
- public function copy():Void{
- }
-
- public function paste():Void{
+ }
+
+ /**
+ * Main entry point to the application
+ */
+ public function main(container_mc:MovieClip){
+ _container_mc = container_mc;
+ _UILoaded = false;
+
+ _root.preloader.setStartValue(50);
+ _root.preloader.setEndValue(100);
+ _root.preloader.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()
+ _root.preloader.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){
+ clearInterval(_UILoadCheckIntervalID);
+ start();
+ }else {
+ //If UI loaded check which events can be broadcast
+ if(_UILoaded){
+ //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'){
+
+ _layout.manager.addLayoutItem(new LFLayoutItem(evt.target.className, evt.target));
+ _root.preloader.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 = _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{
+ var ca = _monitor.getMM().selectedItem;
+ if(CanvasActivity(ca) != null){
+ _monitor.getMV().getController().activityDoubleClick(ca, "MonitorTabView", null, true);
+ } 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
+ _root.preloader.stop();
+ _root._visible = true;
+
+ if(SHOW_DEBUGGER){
+ showDebugger();
+ }
+ }
+
+ /**
+ * 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;
+
+ _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{
+ }
+
+ public function copy():Void{
+ }
+
+ public function paste():Void{
+ }
+
+ /**
* returns the the canvas instance
*/
public function getMonitor():Monitor{
return _monitor;
- }
-
- /**
- * 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 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 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 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();
- }
- }
- }
+ /**
+ * 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 -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/ContributeActivity.as (.../ContributeActivity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/ContributeActivity.as (.../ContributeActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -28,21 +28,21 @@
* 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;
- public static var SYS_GATE:Number = 8;
- public static var TEACHER_CHOSEN_BRANCHNG:Number = 9;
-
- private var _childActivities:Array;
+
+ /* 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;
+ public static var SYS_GATE:Number = 8;
+ public static var TEACHER_CHOSEN_BRANCHNG:Number = 9;
+
+ private var _childActivities:Array;
private var _contributeEntries:Array;
- private var _contributionType:Number;
+ private var _contributionType:Number;
private var _taskURL:String;
private var _isRequired:Boolean;
@@ -51,9 +51,9 @@
/**
* Constructor.
*/
- public function ContributeActivity (){
- super(null);
- _childActivities = new Array();
+ public function ContributeActivity (){
+ super(null);
+ _childActivities = new Array();
_contributeEntries = new Array();
}
@@ -67,73 +67,72 @@
}
return ContributeActivity._instance;
}
-
public function populateFromDTO(dto:Object, id:String){
- _activityID = dto.activityID;
+ _activityID = dto.activityID;
_parentActivityID = dto.parentActivityID;
_activityTypeID = dto.activityTypeID;
-
- if(dto.childActivities != null){
- // create children
- for(var i=0; i> button clicks
- var buttonText:String = String(label.text)
-
- if (buttonText == "<<") {
- Debugger.log("<< clicked", Debugger.GEN, "indexClicked", "IndexButton");
- mm.drawIndexButtons = false;
- mm.updateIndexButtons("<<");
- } else if (buttonText == ">>") {
- Debugger.log(">> clicked", Debugger.GEN, "indexClicked", "IndexButton");
- mm.drawIndexButtons = false;
- mm.updateIndexButtons(">>");
- } else if (_btnType == "Go") { // 'Go' button
- mm.learnerIndexView.textFieldContents = String(mm.learnerIndexView.getIdxTextField().text); // backup the string incase need to remove textfield
-
- if(!isNaN(mm.learnerIndexView.getIdxTextField().text)) { // if the text field contains a number
- var idx:Number = Number(mm.learnerIndexView.getIdxTextField().text);
- if (idx >= 1 && idx <= mm.numIndexButtons) { // if the selected index exists
- mm.drawIndexButtons = false;
- mm.currentLearnerIndex = idx;
- if (!mm.inSearchView)
- mm.oldIndex = mm.currentLearnerIndex;
- }
- else
- LFMessage.showMessageAlert(Dictionary.getValue('mv_search_invalid_input_msg', [mm.numIndexButtons]), null);
- }
- else if (mm.learnerIndexView.getIdxTextField().text == "") {
- LFMessage.showMessageAlert(Dictionary.getValue('mv_search_error_msg', [mm.numIndexButtons]), null);
- }
- else {
- var mc:MonitorController = mm.getMonitor().getMV().getController();
- matchesArr = mc.searchForLearners(String(mm.learnerIndexView.getIdxTextField().text));
- if (matchesArr.length > 0) {
- mm.drawIndexButtons = true;
- mm.currentLearnerIndexNoRedraw = 1;
- mm.searchResults = matchesArr;
- var indexViewBtn:MovieClip = mm.getMonitor().getMV().getLearnerIndexPanel().indexViewBtn;
- indexViewBtn._visible = true;
- } else {
- LFMessage.showMessageAlert(Dictionary.getValue('mv_search_not_found_msg', [mm.learnerIndexView.getIdxTextField().text]), null);
- }
- }
- }
- else if (_btnType == "IndexView") { // the 'Index View' button
- mm.drawIndexButtons = true;
- mm.inSearchView = false;
- mm.resetSearchTextField = true;
- mm.currentLearnerIndexNoRedraw = mm.oldIndex;
- mm.setLessonProgressData(mm.progressArrBackup);
- }
- else {
- mm.drawIndexButtons = false;
- mm.indexSelected = true;
- mm.currentLearnerIndex = Number(label.text);
- if (!mm.inSearchView)
- mm.oldIndex = mm.currentLearnerIndex;
- }
-
- }
-
- /**
- * Get the CSSStyleDeclaration objects for each component and apply them
- * directly to the instance
- */
- private function setStyles():Void{
- var styleObj = _tm.getStyleObject('IndexButton');
- idxLabel.setStyle('styleName', styleObj);
- }
-
- public function setSize(_btnWidth:Number):Void {
- this._width = _btnWidth;
-
- idxLabel._width = _btnWidth;
- _bgPanel._width = _btnWidth;
- }
-
- public function set label(a:String):Void {
- idxLabel.text = a;
- }
-
- public function get label():Label {
- return idxLabel;
- }
-
- public function set btnType(_t:String):Void {
- _btnType = _t;
- }
+ public static var _tabID:Number = 2;
+
+ private var _className = "IndexButton";
+
+ private var _bgPanel:MovieClip;
+
+ private var idxLabel_mc:MovieClip;
+ private var idxLabel:Label;
+ private var _labelText:String;
+ private var _btnType:String; // "Go", "Previous", "Numeric", "Next", "IndexView"
+
+ private var matchesArr:Array;
+
+ private var _tm:ThemeManager;
+ private var mm:MonitorModel;
+ private var lblWidth:Number;
+
+ /**
+ * Called to Indexbutton. Called by LearnerIndexView
+ */
+ public function init(m:Observable, c:Controller){
+ super (m, c);
+ mm = MonitorModel(m);
+
+ _tm = ThemeManager.getInstance();
+
+ idxLabel_mc = this.attachMovie("Label", "idxLabel", this.getNextHighestDepth(), {text:_labelText, _width: 45, autoSize: "center"});
+ idxLabel = Label(idxLabel_mc);
+ setStyles();
+
+ _bgPanel.onRollOver = Delegate.create(this, onMouseOver);
+ _bgPanel.onPress = Delegate.create(this, indexClicked);
+ }
+
+ public function onMouseOver(): Void {
+ Debugger.log("onMouseOver event triggered", Debugger.GEN, "onMouseOver", "IndexButton");
+ // TODO: some cool mouse over effects
+ }
+
+ public function indexClicked(): Void {
+ Selection.setFocus(mm.getMonitor().getMV().getMonitorLearnerScp()); // take focus off idx textfield as it interferes << and >> button clicks
+ var buttonText:String = String(label.text)
+
+ if (buttonText == "<<") {
+ Debugger.log("<< clicked", Debugger.GEN, "indexClicked", "IndexButton");
+ mm.drawIndexButtons = false;
+ mm.updateIndexButtons("<<");
+ } else if (buttonText == ">>") {
+ Debugger.log(">> clicked", Debugger.GEN, "indexClicked", "IndexButton");
+ mm.drawIndexButtons = false;
+ mm.updateIndexButtons(">>");
+ } else if (_btnType == "Go") { // 'Go' button
+ mm.learnerIndexView.textFieldContents = String(mm.learnerIndexView.getIdxTextField().text); // backup the string incase need to remove textfield
+
+ if(!isNaN(mm.learnerIndexView.getIdxTextField().text)) { // if the text field contains a number
+ var idx:Number = Number(mm.learnerIndexView.getIdxTextField().text);
+ if (idx >= 1 && idx <= mm.numIndexButtons) { // if the selected index exists
+ mm.drawIndexButtons = false;
+ mm.currentLearnerIndex = idx;
+ if (!mm.inSearchView)
+ mm.oldIndex = mm.currentLearnerIndex;
+ }
+ else
+ LFMessage.showMessageAlert(Dictionary.getValue('mv_search_invalid_input_msg', [mm.numIndexButtons]), null);
+ }
+ else if (mm.learnerIndexView.getIdxTextField().text == "") {
+ LFMessage.showMessageAlert(Dictionary.getValue('mv_search_error_msg', [mm.numIndexButtons]), null);
+ }
+ else {
+ var mc:MonitorController = mm.getMonitor().getMV().getController();
+ matchesArr = mc.searchForLearners(String(mm.learnerIndexView.getIdxTextField().text));
+ if (matchesArr.length > 0) {
+ mm.drawIndexButtons = true;
+ mm.currentLearnerIndexNoRedraw = 1;
+ mm.searchResults = matchesArr;
+ var indexViewBtn:MovieClip = mm.getMonitor().getMV().getLearnerIndexPanel().indexViewBtn;
+ indexViewBtn._visible = true;
+ } else {
+ LFMessage.showMessageAlert(Dictionary.getValue('mv_search_not_found_msg', [mm.learnerIndexView.getIdxTextField().text]), null);
+ }
+ }
+ }
+ else if (_btnType == "IndexView") { // the 'Index View' button
+ mm.drawIndexButtons = true;
+ mm.inSearchView = false;
+ mm.resetSearchTextField = true;
+ mm.currentLearnerIndexNoRedraw = mm.oldIndex;
+ mm.setLessonProgressData(mm.progressArrBackup);
+ }
+ else {
+ mm.drawIndexButtons = false;
+ mm.indexSelected = true;
+ mm.currentLearnerIndex = Number(label.text);
+ if (!mm.inSearchView)
+ mm.oldIndex = mm.currentLearnerIndex;
+ }
+
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('IndexButton');
+ idxLabel.setStyle('styleName', styleObj);
+ }
+
+ public function setSize(_btnWidth:Number):Void {
+ this._width = _btnWidth;
+
+ idxLabel._width = _btnWidth;
+ _bgPanel._width = _btnWidth;
+ }
+
+ public function set label(a:String):Void {
+ idxLabel.text = a;
+ }
+
+ public function get label():Label {
+ return idxLabel;
+ }
+
+ public function set btnType(_t:String):Void {
+ _btnType = _t;
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/Monitor.as
===================================================================
diff -u -r327655a8d92f9ed44f5662c92704ade48ec4c1ed -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/Monitor.as (.../Monitor.as) (revision 327655a8d92f9ed44f5662c92704ade48ec4c1ed)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/Monitor.as (.../Monitor.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,732 +1,733 @@
-/***************************************************************************
- * 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.Application;
-import org.lamsfoundation.lams.monitoring.Organisation;
-import org.lamsfoundation.lams.monitoring.User;
-import org.lamsfoundation.lams.monitoring.mv.*;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
-import org.lamsfoundation.lams.authoring.DesignDataModel;
-import org.lamsfoundation.lams.authoring.Activity;
-import org.lamsfoundation.lams.authoring.cmpt.CompetenceEditorDialog;
-import org.lamsfoundation.lams.authoring.cv.CanvasActivity;
-import org.lamsfoundation.lams.authoring.cv.CanvasOptionalActivity;
-import org.lamsfoundation.lams.authoring.cv.CanvasComplexView;
-import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
-import org.lamsfoundation.lams.common.ui.*;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.dict.*;
-import org.lamsfoundation.lams.common.Progress;
-import org.lamsfoundation.lams.common.Sequence;
-import org.lamsfoundation.lams.common.* ;
-
-import mx.utils.*;
-import mx.managers.*;
-import mx.events.*;
-
-class Monitor {
- //Constants
- public static var USE_PROPERTY_INSPECTOR = true;
-
- private var _className:String = "Monitor";
-
- // Root movieclip
- private var _root_mc:MovieClip;
-
- // Model
- private var monitorModel:MonitorModel;
-
- // View
- private var monitorView:MonitorView;
- private var monitorLockView:MonitorLockView;
- private var monitorView_mc:MovieClip;
- private var monitorLockView_mc:MovieClip;
-
- private var canvasComplexView:CanvasComplexView;
- private var _canvasComplexView_mc:MovieClip;
-
- private var locked:Boolean;
-
- private var app:Application;
- private var _sequence:Sequence;
- private var _ddm:DesignDataModel;
- private var _dictionary:Dictionary;
-
- private var _currentUserRole:String;
-
- private var _pi:MovieClip; //Property inspector
-
- private var dispatchEvent:Function;
- public var addEventListener:Function;
- public var removeEventListener:Function;
-
- private var _onOKCallBack:Function;
-
- /**
- * Monitor Constructor Function
- *
- * @usage
- * @return target_mc //Target clip for attaching view
- */
- public function Monitor(target_mc:MovieClip,depth:Number,x:Number,y:Number,w:Number,h:Number, locked:Boolean, isEditingUser:Boolean){
- mx.events.EventDispatcher.initialize(this);
-
- // Set root movieclip
- _root_mc = target_mc;
- this.locked = locked;
- app = Application.getInstance();
-
- //Create the model
- monitorModel = new MonitorModel(this);
- monitorModel.locked = locked;
-
- _dictionary = Dictionary.getInstance();
-
- if(monitorView_mc == null || monitorView_mc == undefined) {
- createNormalViewModel(x, y, w, h);
- }
-
- if(monitorModel.locked) {
- createLockedViewModel(x, y, w, h, isEditingUser);
- monitorView_mc._visible = false;
- }
-
- //Set the position by setting the model which will call update on the view
- monitorModel.setPosition(x,y);
- monitorModel.setSize(w,h);
- monitorModel.initOrganisationTree();
-
- }
-
- private function createNormalViewModel(x:Number,y:Number,w:Number,h:Number) {
- //Create the view
- monitorView_mc = _root_mc.createChildAtDepth("monitorView",DepthManager.kTop);
-
- monitorView = MonitorView(monitorView_mc);
-
- //Register view with model to receive update events
- monitorModel.addObserver(monitorView);
-
- monitorView.init(monitorModel,undefined,x,y,w,h);
-
- monitorView.addEventListener('load',Proxy.create(this,viewLoaded));
- monitorView.addEventListener('tload',Proxy.create(this,tabsLoaded));
-
- monitorModel.addEventListener('learnersLoad',Proxy.create(this,onUserLoad));
- monitorModel.addEventListener('staffLoad',Proxy.create(this,onUserLoad));
-
- }
-
- private function createLockedViewModel(x:Number,y:Number,w:Number,h:Number, isEditingUser:Boolean) {
- monitorLockView_mc = _root_mc.createChildAtDepth("monitorLockView",DepthManager.kTop);
- monitorLockView = MonitorLockView(monitorLockView_mc);
-
- //Register view with model to receive update events
- monitorModel.addObserver(monitorLockView);
-
- monitorLockView.init(monitorModel,undefined,x,y,w,h,isEditingUser);
- monitorLockView.addEventListener('load',Proxy.create(this,viewLoaded));
-
- }
-
- /**
- * event broadcast when Monitor is loaded
- */
- public function broadcastInit(){
- dispatchEvent({type:'init',target:this});
- }
-
-
- private function viewLoaded(evt:Object){
- Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Monitor');
-
- if(evt.type=='load') {
-
- if(evt.target instanceof CanvasBranchView) {
- monitorModel.activeView = evt.target;
-
- evt.target.open();
- monitorModel.setDirty(false);
- } else if(evt.target instanceof CanvasComplexView) {
- monitorModel.activeView = evt.target;
-
- // open complex view
- evt.target.showActivity();
- } else if((monitorLockView != null || !locked) && monitorView != null) {
- dispatchEvent({type:'load',target:this});
- }
-
- } else {
- //Raise error for unrecognized event
- }
- }
-
- private function tabsLoaded(evt:Object){
- Debugger.log('tabsLoaded called',Debugger.GEN,'tabsLoaded','Monitor');
- monitorModel.activeView = MonitorView(evt.target).getMonitorTabView();
-
- monitorModel.setSequence(app.sequence);
- saveDataDesignModel(null);
-
- }
-
- /**
- * Opens the help->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));
-
- }
-
- public function viewToolOutputConditions() {
- var controller:MonitorController = monitorView.getController();
-
- var dialog_title:String = (monitorModel.selectedItem.activity.activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE) ? Dictionary.getValue('ccm_monitor_view_condition_mappings') : Dictionary.getValue('ccm_monitor_view_group_mappings');
-
- var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:dialog_title, closeButton:true, scrollContentPath:'ViewBranchConditionMappingsDialog'});
- dialog.addEventListener('contentLoaded', Delegate.create(controller, controller.viewBranchConditionMappingsDialogLoaded));
-
- }
-
- public function showMappedCompetences() {
-
- var controller:MonitorController = monitorView.getController();
- var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue("mapped_competences_lbl"),closeButton:true,scrollContentPath:'CompetenceEditorDialog'});
- dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
- }
-
- /**
- * 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){
- if(b){
- loadLessonToMonitor(_root.lessonID);
- } else {
- // error occured
- }
- }
-
- /**
- * Create LessonClass using wizard data and CreateLessonClass servlet
- *
- */
- public function createLessonClass():Void{
- 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
- monitorModel.broadcastViewUpdate("SAVED_LC", null);
- loadLessonToMonitor(_root.lessonID);
- } else {
- // 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){
- 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){
- 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{
- 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();
- Debugger.log('getting progress data for Sequence: '+seqId, Debugger.GEN, "getProgressData", "Monitor");
- var callback:Function = Proxy.create(this, saveProgressData);
- Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getAllLearnersProgress&lessonID=' + seqId, callback, false);
- }
-
- /**
- * @deprecated
- * Not used atm but leaving here in case we ever want to implement batch loading
- */
- public function getInitialLearnersProgress(seq:Object) {
- var seqId:Number = seq.getSequenceID();
- Debugger.log('getting initial progress data for Sequence: '+seqId, Debugger.CRITICAL, "getInitialLearnersProgress", "Monitor");
- var callback:Function = Proxy.create(this, saveProgressData);
- Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getInitialLearnersProgress&lessonID=' + seqId,callback, false);
- }
-
- /**
- * @deprecated
- * Not used atm but leaving here in case we ever want to implement batch loading
- */
- public function getAdditionalLearnersProgress(seq:Object) {
- var seqId:Number = seq.getSequenceID();
- Debugger.log('getting additional progress data for Sequence: '+seqId, Debugger.CRITICAL, "getInitialLearnersProgress", "Monitor");
- var callback:Function = Proxy.create(this, saveProgressData);
- }
-
- private function saveProgressData(progressDTO:Object){
- Debugger.log("saveProgressData invoked", Debugger.GEN, "saveProgressData", "Monitor");
- 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);
- allLearners.push(lessonProgress);
- }
-
- //sets these in the monitor model in a hashtable by learnerID
- monitorModel.activeView = monitorView.getMonitorTabView();
- monitorModel.setLessonProgressData(allLearners);
- monitorModel.backupLearnersProgress(monitorModel.allLearnersProgress);
-
- dispatchEvent({type:'load',target:this});
-
- Debugger.log("Progress data saved...", Debugger.GEN, "saveProgressData", "Monitor");
- }
-
- public function getCELiteral(taskType:Number):String{
- var seqStat:String;
-
- switch(String(taskType)){
- case '1' :
- seqStat = Dictionary.getValue("ls_seq_status_moderation"); // "Moderation"
- break;
- case '2' :
- seqStat = Dictionary.getValue("ls_seq_status_define_later"); // "Define Later"
- break;
- case '3' :
- seqStat = Dictionary.getValue("ls_seq_status_perm_gate"); // "Permission Gate"
- break;
- case '4' :
- seqStat = Dictionary.getValue("ls_seq_status_synch_gate"); // "Syncronise Gate"
- break;
- case '5' :
- seqStat = Dictionary.getValue("ls_seq_status_sched_gate"); // "Schedule Gate"
- break;
- case '6' :
- seqStat = Dictionary.getValue("ls_seq_status_choose_grouping"); // "Choose Grouping"
- break;
- case '7' :
- seqStat = Dictionary.getValue("ls_seq_status_contribution"); // "Contribution"
- break;
- case '8' :
- seqStat = Dictionary.getValue("ls_seq_status_system_gate"); // "System Gate"
- break;
- case '9' :
- seqStat = Dictionary.getValue("ls_seq_status_teacher_branching"); // "Teacher Chosen Branching"
- break;
- default:
- seqStat = Dictionary.getValue("ls_seq_status_not_set"); // "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{
- var s = false;
- var ref = this;
-
- Debugger.log('noWarn:'+noWarn,4,'clearCanvas','Monitor');
-
- if(noWarn){
-
- _ddm = new DesignDataModel();
-
- Debugger.log('noWarn2:'+noWarn,4,'clearCanvas','Monitor');//_ddm.addEventListener('ddmBeforeUpdate',Proxy.create(this,onDDMBeforeUpdate));
-
- monitorModel.setDirty();
- return true;
- }else{
- Debugger.log('Set design failed as old design could not be cleared',Debugger.CRITICAL,"setDesign",'Canvas');
- }
- }
-
- public function openBranchView(ba, visible:Boolean){
-
- var cx:Number = ba._x + ba.getVisibleWidth()/2;
- var cy:Number = ba._y + ba.getVisibleHeight()/2;
- var isVisible:Boolean = (visible == null) ? true : visible;
-
- var target:MovieClip = monitorModel.activeView.branchContent;
- var _branchView_mc:MovieClip = target.createChildAtDepth("canvasBranchView", DepthManager.kTop, {_x: cx, _y: cy, _canvasBranchingActivity:ba, _open:isVisible, _prevActiveView: monitorModel.activeView});
- var branchView:CanvasBranchView = CanvasBranchView(_branchView_mc);
-
- branchView.init(monitorModel, monitorView.getController());
-
- //Add listener to view so that we know when it's loaded
- branchView.addEventListener('load', Proxy.create(this, viewLoaded));
-
- monitorModel.addObserver(branchView);
- ba.activity.branchView = branchView;
-
- var actToPush = monitorModel.getMonitor().ddm.getActivityByUIID(ba.activity.activityUIID);
-
- Debugger.log("Pushing activity: "+actToPush.title+" to the stack", Debugger.CRITICAL, "openBranchActivityContent", "MonitorModel");
- Debugger.log("It has a UIID of: "+actToPush.activityUIID, Debugger.CRITICAL, "openBranchActivityContent", "MonitorModel");
-
- monitorModel.openBranchingActivities.push(ba.activity.activityUIID);
- }
-
- public function closeBranchView(prevActiveView) {
- var parentBranching:CanvasActivity = null;
- var isCBV:Boolean = false;
-
- if(monitorModel.activeView.activity.parentUIID != null)
- parentBranching = CanvasActivity(monitorModel.activitiesDisplayed.get(_ddm.getActivityByUIID(monitorModel.activeView.activity.parentUIID).parentUIID));
-
- if(prevActiveView != null)
- monitorModel.activeView = prevActiveView;
- else
- monitorModel.activeView = (parentBranching.activity.isBranchingActivity()) ? parentBranching.activity.branchView : monitorView.getMonitorTabView();
-
- monitorModel.currentBranchingActivity = (parentBranching.activity.isBranchingActivity()) ? parentBranching : null;
-
- var poppedActivityUIID:Number = monitorModel.openBranchingActivities.pop();
- var poppedActivity = monitorModel.getMonitor().ddm.getActivityByUIID(poppedActivityUIID);
-
- Debugger.log("Closing branching activity: "+poppedActivity.title, Debugger.CRITICAL, "closeBranchView", "Monitor");
- Debugger.log("It had a UIID of: "+poppedActivityUIID, Debugger.CRITICAL, "openBranchActivityContent", "Monitor");
- }
-
- public function openComplexView(ca:Object):Void {
-
- var target:MovieClip = monitorModel.activeView.complexViewer; //(monitorModel.activeView instanceof CanvasBranchView) ? monitorModel.activeView.complexViewer : monitorView.getMonitorTabView().complexViewer;
-
- var cx:Number;
- var cy:Number;
-
- var parentAct:Activity = ddm.getActivityByUIID(ca.activity.parentUIID);
- var grandParentActivity:MovieClip = monitorModel.activitiesDisplayed.get(parentAct.parentUIID);
- var parentActivity:MovieClip = monitorModel.activitiesDisplayed.get(parentAct.activityUIID);
-
- if(monitorModel.activeView instanceof CanvasComplexView) {
- if(monitorModel.activeView.complexActivity == ca) {
- return;
- }
-
- target = monitorModel.activeView.complexViewer;
-
- Debugger.log("parentAct: " + parentAct.activityUIID, Debugger.CRITICAL, "openComplexView", "Monitor");
- Debugger.log("parentAct type: " + parentAct.activityTypeID, Debugger.CRITICAL, "openComplexView", "Monitor");
- Debugger.log("gpAct: " + grandParentActivity.activity.activityUIID, Debugger.CRITICAL, "openComplexView", "Monitor");
-
- if(parentAct.isSequenceActivity() && monitorModel.activeView.openActivity instanceof CanvasOptionalActivity) {
- cx = parentAct.xCoord + ca._x;
- cy = parentAct.yCoord + ca._y;
- } else {
- cx = ca._x;
- cy = ca._y;
- }
- } else {
-
- if(parentAct.isSequenceActivity() && grandParentActivity instanceof CanvasOptionalActivity) {
- cx = grandParentActivity._x + parentAct.xCoord + ca._x;
- cy = grandParentActivity._y + parentAct.yCoord + ca._y;
- } else {
- cx = parentActivity._x + ca._x;
- cy = parentActivity._y + ca._y;
- }
- }
-
- Debugger.log("co ord x: " + cx + " y: " + cy, Debugger.CRITICAL, "openComplexView", "Monitor");
-
- _canvasComplexView_mc = target.createChildAtDepth("canvasComplexView", DepthManager.kTop, {_x: cx, _y: cy, _complexActivity:ca, _parentActivity:parentActivity, _visible:false, _prevActiveView: monitorModel.activeView});
- canvasComplexView = CanvasComplexView(_canvasComplexView_mc);
-
- canvasComplexView.init(monitorModel, undefined);
- canvasComplexView.addEventListener('load', Proxy.create(this, viewLoaded));
-
- monitorModel.addObserver(canvasComplexView);
- }
-
-
- /**
- * 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: " + ca.activity.helpURL + app.module, Debugger.GEN, 'getHelp', 'Monitor');
-
- ApplicationParent.extCall("openURL", ca.activity.helpURL + app.module);
- } else {
- if (ca.activity.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE){
- var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GROUP);
- 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, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GATE);
- app.getHelpURL(callback);
- } else if(ca.activity.isBranchingActivity()) {
- var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_BRANCHING);
- app.getHelpURL(callback);
- } else {
- LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_helpURL_undefined', [ca.activity.toolDisplayName]));
- }
- }
- }
-
- private function openSystemToolHelp(url:String, toolSignature:String){
- var target:String = toolSignature + app.module;
- url = ApplicationParent.addLocaleToURL(url);
-
- ApplicationParent.extCall("openURL", url + target);
- }
-
- 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 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{
- return monitorView;
- }
-
- public function get ddm():DesignDataModel{
- return _ddm;
- }
-
- public function get model():MonitorModel {
- return monitorModel;
- }
-
- public function get root():MovieClip{
- return _root_mc;
- }
-
- public function get App():Application{
- return Application.getInstance();
- }
+/***************************************************************************
+ * 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.Application;
+import org.lamsfoundation.lams.monitoring.Organisation;
+import org.lamsfoundation.lams.monitoring.User;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.cmpt.CompetenceEditorDialog;
+import org.lamsfoundation.lams.authoring.cv.CanvasActivity;
+import org.lamsfoundation.lams.authoring.cv.CanvasOptionalActivity;
+import org.lamsfoundation.lams.authoring.cv.CanvasComplexView;
+import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.Progress;
+import org.lamsfoundation.lams.common.Sequence;
+import org.lamsfoundation.lams.common.* ;
+
+import mx.utils.*;
+import mx.managers.*;
+import mx.events.*;
+
+class Monitor {
+ //Constants
+ public static var USE_PROPERTY_INSPECTOR = true;
+
+ private var _className:String = "Monitor";
+
+ // Root movieclip
+ private var _root_mc:MovieClip;
+
+ // Model
+ private var monitorModel:MonitorModel;
+
+ // View
+ private var monitorView:MonitorView;
+ private var monitorLockView:MonitorLockView;
+ private var monitorView_mc:MovieClip;
+ private var monitorLockView_mc:MovieClip;
+
+ private var canvasComplexView:CanvasComplexView;
+ private var _canvasComplexView_mc:MovieClip;
+
+ private var locked:Boolean;
+
+ private var app:Application;
+ private var _sequence:Sequence;
+ private var _ddm:DesignDataModel;
+ private var _dictionary:Dictionary;
+
+ private var _currentUserRole:String;
+
+ private var _pi:MovieClip; //Property inspector
+
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ private var _onOKCallBack:Function;
+
+ /**
+ * Monitor Constructor Function
+ *
+ * @usage
+ * @return target_mc //Target clip for attaching view
+ */
+ public function Monitor(target_mc:MovieClip,depth:Number,x:Number,y:Number,w:Number,h:Number, locked:Boolean, isEditingUser:Boolean){
+ mx.events.EventDispatcher.initialize(this);
+
+ // Set root movieclip
+ _root_mc = target_mc;
+ this.locked = locked;
+ app = Application.getInstance();
+
+ //Create the model
+ monitorModel = new MonitorModel(this);
+ monitorModel.locked = locked;
+
+ _dictionary = Dictionary.getInstance();
+
+ if(monitorView_mc == null || monitorView_mc == undefined) {
+ createNormalViewModel(x, y, w, h);
+ }
+
+ if(monitorModel.locked) {
+ createLockedViewModel(x, y, w, h, isEditingUser);
+ monitorView_mc._visible = false;
+ }
+
+ //Set the position by setting the model which will call update on the view
+ monitorModel.setPosition(x,y);
+ monitorModel.setSize(w,h);
+ monitorModel.initOrganisationTree();
+
+ }
+
+ private function createNormalViewModel(x:Number,y:Number,w:Number,h:Number) {
+ //Create the view
+ monitorView_mc = _root_mc.createChildAtDepth("monitorView",DepthManager.kTop);
+
+ monitorView = MonitorView(monitorView_mc);
+
+ //Register view with model to receive update events
+ monitorModel.addObserver(monitorView);
+
+ monitorView.init(monitorModel,undefined,x,y,w,h);
+
+ monitorView.addEventListener('load',Proxy.create(this,viewLoaded));
+ monitorView.addEventListener('tload',Proxy.create(this,tabsLoaded));
+
+ monitorModel.addEventListener('learnersLoad',Proxy.create(this,onUserLoad));
+ monitorModel.addEventListener('staffLoad',Proxy.create(this,onUserLoad));
+
+ }
+
+ private function createLockedViewModel(x:Number,y:Number,w:Number,h:Number, isEditingUser:Boolean) {
+ monitorLockView_mc = _root_mc.createChildAtDepth("monitorLockView",DepthManager.kTop);
+ monitorLockView = MonitorLockView(monitorLockView_mc);
+
+ //Register view with model to receive update events
+ monitorModel.addObserver(monitorLockView);
+
+ monitorLockView.init(monitorModel,undefined,x,y,w,h,isEditingUser);
+ monitorLockView.addEventListener('load',Proxy.create(this,viewLoaded));
+
+ }
+
+ /**
+ * event broadcast when Monitor is loaded
+ */
+ public function broadcastInit(){
+ dispatchEvent({type:'init',target:this});
+ }
+
+
+ private function viewLoaded(evt:Object){
+ Debugger.log('viewLoaded called',Debugger.GEN,'viewLoaded','Monitor');
+
+ if(evt.type=='load') {
+
+ if(evt.target instanceof CanvasBranchView) {
+ monitorModel.activeView = evt.target;
+
+ evt.target.open();
+ monitorModel.setDirty(false);
+ } else if(evt.target instanceof CanvasComplexView) {
+ monitorModel.activeView = evt.target;
+
+ // open complex view
+ evt.target.showActivity();
+ } else if((monitorLockView != null || !locked) && monitorView != null) {
+ dispatchEvent({type:'load',target:this});
+ }
+
+ } else {
+ //Raise error for unrecognized event
+ }
+ }
+
+ private function tabsLoaded(evt:Object){
+ Debugger.log('tabsLoaded called',Debugger.GEN,'tabsLoaded','Monitor');
+ monitorModel.activeView = MonitorView(evt.target).getMonitorTabView();
+
+ monitorModel.setSequence(app.sequence);
+ saveDataDesignModel(null);
+
+ }
+
+ /**
+ * Opens the help->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));
+
+ }
+
+ public function viewToolOutputConditions() {
+ var controller:MonitorController = monitorView.getController();
+
+ var dialog_title:String = (monitorModel.selectedItem.activity.activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE) ? Dictionary.getValue('ccm_monitor_view_condition_mappings') : Dictionary.getValue('ccm_monitor_view_group_mappings');
+
+ var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true, {title:dialog_title, closeButton:true, scrollContentPath:'ViewBranchConditionMappingsDialog'});
+ dialog.addEventListener('contentLoaded', Delegate.create(controller, controller.viewBranchConditionMappingsDialogLoaded));
+
+ }
+
+ public function showMappedCompetences() {
+
+ var controller:MonitorController = monitorView.getController();
+ var dialog:MovieClip = PopUpManager.createPopUp(Application.root, LFWindow, true,{title:Dictionary.getValue("mapped_competences_lbl"),closeButton:true,scrollContentPath:'CompetenceEditorDialog'});
+ dialog.addEventListener('contentLoaded',Delegate.create(controller, controller.openDialogLoaded));
+ }
+
+ /**
+ * 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){
+ if(b){
+ loadLessonToMonitor(_root.lessonID);
+ } else {
+ // error occured
+ }
+ }
+
+ /**
+ * Create LessonClass using wizard data and CreateLessonClass servlet
+ *
+ */
+ public function createLessonClass():Void{
+ 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
+ monitorModel.broadcastViewUpdate("SAVED_LC", null);
+ loadLessonToMonitor(_root.lessonID);
+ } else {
+ // 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){
+ 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){
+ 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{
+ 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();
+ Debugger.log('getting progress data for Sequence: '+seqId, Debugger.GEN, "getProgressData", "Monitor");
+ var callback:Function = Proxy.create(this, saveProgressData);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getAllLearnersProgress&lessonID=' + seqId, callback, false);
+ }
+
+ /**
+ * @deprecated
+ * Not used atm but leaving here in case we ever want to implement batch loading
+ */
+ public function getInitialLearnersProgress(seq:Object) {
+ var seqId:Number = seq.getSequenceID();
+ Debugger.log('getting initial progress data for Sequence: '+seqId, Debugger.CRITICAL, "getInitialLearnersProgress", "Monitor");
+ var callback:Function = Proxy.create(this, saveProgressData);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=getInitialLearnersProgress&lessonID=' + seqId,callback, false);
+ }
+
+ /**
+ * @deprecated
+ * Not used atm but leaving here in case we ever want to implement batch loading
+ */
+ public function getAdditionalLearnersProgress(seq:Object) {
+ var seqId:Number = seq.getSequenceID();
+ Debugger.log('getting additional progress data for Sequence: '+seqId, Debugger.CRITICAL, "getInitialLearnersProgress", "Monitor");
+ var callback:Function = Proxy.create(this, saveProgressData);
+ }
+
+ private function saveProgressData(progressDTO:Object){
+ Debugger.log("saveProgressData invoked", Debugger.GEN, "saveProgressData", "Monitor");
+ 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);
+ allLearners.push(lessonProgress);
+ }
+
+ //sets these in the monitor model in a hashtable by learnerID
+ monitorModel.activeView = monitorView.getMonitorTabView();
+ monitorModel.setLessonProgressData(allLearners);
+ monitorModel.backupLearnersProgress(monitorModel.allLearnersProgress);
+
+ dispatchEvent({type:'load',target:this});
+
+ Debugger.log("Progress data saved...", Debugger.GEN, "saveProgressData", "Monitor");
+ }
+
+ public function getCELiteral(taskType:Number):String{
+ var seqStat:String;
+
+ switch(String(taskType)){
+ case '1' :
+ seqStat = Dictionary.getValue("ls_seq_status_moderation"); // "Moderation"
+ break;
+ case '2' :
+ seqStat = Dictionary.getValue("ls_seq_status_define_later"); // "Define Later"
+ break;
+ case '3' :
+ seqStat = Dictionary.getValue("ls_seq_status_perm_gate"); // "Permission Gate"
+ break;
+ case '4' :
+ seqStat = Dictionary.getValue("ls_seq_status_synch_gate"); // "Syncronise Gate"
+ break;
+ case '5' :
+ seqStat = Dictionary.getValue("ls_seq_status_sched_gate"); // "Schedule Gate"
+ break;
+ case '6' :
+ seqStat = Dictionary.getValue("ls_seq_status_choose_grouping"); // "Choose Grouping"
+ break;
+ case '7' :
+ seqStat = Dictionary.getValue("ls_seq_status_contribution"); // "Contribution"
+ break;
+ case '8' :
+ seqStat = Dictionary.getValue("ls_seq_status_system_gate"); // "System Gate"
+ break;
+ case '9' :
+ seqStat = Dictionary.getValue("ls_seq_status_teacher_branching"); // "Teacher Chosen Branching"
+ break;
+ default:
+ seqStat = Dictionary.getValue("ls_seq_status_not_set"); // "Not yet set"
+ }
+
+ Debugger.log("SeqStat: " + seqStat, Debugger.MED, "getCELiteral", "Monitor");
+ 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{
+ var s = false;
+ var ref = this;
+
+ Debugger.log('noWarn:'+noWarn,4,'clearCanvas','Monitor');
+
+ if(noWarn){
+
+ _ddm = new DesignDataModel();
+
+ Debugger.log('noWarn2:'+noWarn,4,'clearCanvas','Monitor');//_ddm.addEventListener('ddmBeforeUpdate',Proxy.create(this,onDDMBeforeUpdate));
+
+ monitorModel.setDirty();
+ return true;
+ }else{
+ Debugger.log('Set design failed as old design could not be cleared',Debugger.CRITICAL,"setDesign",'Canvas');
+ }
+ }
+
+ public function openBranchView(ba, visible:Boolean){
+
+ var cx:Number = ba._x + ba.getVisibleWidth()/2;
+ var cy:Number = ba._y + ba.getVisibleHeight()/2;
+ var isVisible:Boolean = (visible == null) ? true : visible;
+
+ var target:MovieClip = monitorModel.activeView.branchContent;
+ var _branchView_mc:MovieClip = target.createChildAtDepth("canvasBranchView", DepthManager.kTop, {_x: cx, _y: cy, _canvasBranchingActivity:ba, _open:isVisible, _prevActiveView: monitorModel.activeView});
+ var branchView:CanvasBranchView = CanvasBranchView(_branchView_mc);
+
+ branchView.init(monitorModel, monitorView.getController());
+
+ //Add listener to view so that we know when it's loaded
+ branchView.addEventListener('load', Proxy.create(this, viewLoaded));
+
+ monitorModel.addObserver(branchView);
+ ba.activity.branchView = branchView;
+
+ var actToPush = monitorModel.getMonitor().ddm.getActivityByUIID(ba.activity.activityUIID);
+
+ Debugger.log("Pushing activity: "+actToPush.title+" to the stack", Debugger.CRITICAL, "openBranchActivityContent", "MonitorModel");
+ Debugger.log("It has a UIID of: "+actToPush.activityUIID, Debugger.CRITICAL, "openBranchActivityContent", "MonitorModel");
+
+ monitorModel.openBranchingActivities.push(ba.activity.activityUIID);
+ }
+
+ public function closeBranchView(prevActiveView) {
+ var parentBranching:CanvasActivity = null;
+ var isCBV:Boolean = false;
+
+ if(monitorModel.activeView.activity.parentUIID != null)
+ parentBranching = CanvasActivity(monitorModel.activitiesDisplayed.get(_ddm.getActivityByUIID(monitorModel.activeView.activity.parentUIID).parentUIID));
+
+ if(prevActiveView != null)
+ monitorModel.activeView = prevActiveView;
+ else
+ monitorModel.activeView = (parentBranching.activity.isBranchingActivity()) ? parentBranching.activity.branchView : monitorView.getMonitorTabView();
+
+ monitorModel.currentBranchingActivity = (parentBranching.activity.isBranchingActivity()) ? parentBranching : null;
+
+ var poppedActivityUIID:Number = monitorModel.openBranchingActivities.pop();
+ var poppedActivity = monitorModel.getMonitor().ddm.getActivityByUIID(poppedActivityUIID);
+
+ Debugger.log("Closing branching activity: "+poppedActivity.title, Debugger.CRITICAL, "closeBranchView", "Monitor");
+ Debugger.log("It had a UIID of: "+poppedActivityUIID, Debugger.CRITICAL, "openBranchActivityContent", "Monitor");
+ }
+
+ public function openComplexView(ca:Object):Void {
+
+ var target:MovieClip = monitorModel.activeView.complexViewer; //(monitorModel.activeView instanceof CanvasBranchView) ? monitorModel.activeView.complexViewer : monitorView.getMonitorTabView().complexViewer;
+
+ var cx:Number;
+ var cy:Number;
+
+ var parentAct:Activity = ddm.getActivityByUIID(ca.activity.parentUIID);
+ var grandParentActivity:MovieClip = monitorModel.activitiesDisplayed.get(parentAct.parentUIID);
+ var parentActivity:MovieClip = monitorModel.activitiesDisplayed.get(parentAct.activityUIID);
+
+ if(monitorModel.activeView instanceof CanvasComplexView) {
+ if(monitorModel.activeView.complexActivity == ca) {
+ return;
+ }
+
+ target = monitorModel.activeView.complexViewer;
+
+ Debugger.log("parentAct: " + parentAct.activityUIID, Debugger.CRITICAL, "openComplexView", "Monitor");
+ Debugger.log("parentAct type: " + parentAct.activityTypeID, Debugger.CRITICAL, "openComplexView", "Monitor");
+ Debugger.log("gpAct: " + grandParentActivity.activity.activityUIID, Debugger.CRITICAL, "openComplexView", "Monitor");
+
+ if(parentAct.isSequenceActivity() && monitorModel.activeView.openActivity instanceof CanvasOptionalActivity) {
+ cx = parentAct.xCoord + ca._x;
+ cy = parentAct.yCoord + ca._y;
+ } else {
+ cx = ca._x;
+ cy = ca._y;
+ }
+ } else {
+
+ if(parentAct.isSequenceActivity() && grandParentActivity instanceof CanvasOptionalActivity) {
+ cx = grandParentActivity._x + parentAct.xCoord + ca._x;
+ cy = grandParentActivity._y + parentAct.yCoord + ca._y;
+ } else {
+ cx = parentActivity._x + ca._x;
+ cy = parentActivity._y + ca._y;
+ }
+ }
+
+ Debugger.log("co ord x: " + cx + " y: " + cy, Debugger.CRITICAL, "openComplexView", "Monitor");
+
+ _canvasComplexView_mc = target.createChildAtDepth("canvasComplexView", DepthManager.kTop, {_x: cx, _y: cy, _complexActivity:ca, _parentActivity:parentActivity, _visible:false, _prevActiveView: monitorModel.activeView});
+ canvasComplexView = CanvasComplexView(_canvasComplexView_mc);
+
+ canvasComplexView.init(monitorModel, undefined);
+ canvasComplexView.addEventListener('load', Proxy.create(this, viewLoaded));
+
+ monitorModel.addObserver(canvasComplexView);
+ }
+
+
+ /**
+ * 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: " + ca.activity.helpURL + app.module, Debugger.GEN, 'getHelp', 'Monitor');
+
+ ApplicationParent.extCall("openURL", ca.activity.helpURL + app.module);
+ } else {
+ if (ca.activity.activityTypeID == Activity.GROUPING_ACTIVITY_TYPE){
+ var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GROUP);
+ 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, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_GATE);
+ app.getHelpURL(callback);
+ } else if(ca.activity.isBranchingActivity()) {
+ var callback:Function = Proxy.create(this, openSystemToolHelp, Application.FLASH_TOOLSIGNATURE_BRANCHING);
+ app.getHelpURL(callback);
+ } else {
+ LFMessage.showMessageAlert(Dictionary.getValue('cv_activity_helpURL_undefined', [ca.activity.toolDisplayName]));
+ }
+ }
+ }
+
+ private function openSystemToolHelp(url:String, toolSignature:String){
+ var target:String = toolSignature + app.module;
+ url = ApplicationParent.addLocaleToURL(url);
+
+ ApplicationParent.extCall("openURL", url + target);
+ }
+
+ 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 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{
+ return monitorView;
+ }
+
+ public function get ddm():DesignDataModel{
+ return _ddm;
+ }
+
+ public function get model():MonitorModel {
+ return monitorModel;
+ }
+
+ 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 -r6071623eaaab7f58e5c1befe499b0fc1c76850dc -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorController.as (.../MonitorController.as) (revision 6071623eaaab7f58e5c1befe499b0fc1c76850dc)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorController.as (.../MonitorController.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -22,39 +22,39 @@
*/
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.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.BranchingActivity;
-import org.lamsfoundation.lams.authoring.cv.ICanvasActivity;
-import org.lamsfoundation.lams.authoring.cv.CanvasParallelActivity;
-import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.BranchingActivity;
+import org.lamsfoundation.lams.authoring.cv.ICanvasActivity;
+import org.lamsfoundation.lams.authoring.cv.CanvasParallelActivity;
+import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
-import mx.utils.*
-import mx.controls.*
-import mx.behaviors.*
-import mx.core.*
-import mx.events.*
-import mx.effects.*
+import mx.utils.*
+import mx.controls.*
+import mx.behaviors.*
+import mx.core.*
+import mx.events.*
+import mx.effects.*
import mx.managers.DepthManager;
-
-import org.lamsfoundation.lams.authoring.cv.CanvasModel;
+import org.lamsfoundation.lams.authoring.cv.CanvasModel;
+
/**
* 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;
-
+ private var _monitorController:MonitorController;
+ private var _app:Application;
+ private var _isBusy:Boolean;
+
/**
* Constructor
*
@@ -63,464 +63,464 @@
public function MonitorController (mm:Observable) {
super (mm);
_monitorModel = MonitorModel(model);
- _monitorController = this;
- _app = Application.getInstance();
+ _monitorController = this;
+ _app = Application.getInstance();
_isBusy = false;
}
-
- public function activityClick(act:Object, forObj:String):Void{
- Debugger.log("act.activity.title: "+act.activity.title, Debugger.GEN, "activityClick", "MonitorController");
-
- if (forObj == "LearnerIcon"){
- _monitorModel.isDragging = true;
-
- act.startDrag(false);
- }
- else {
- var _tempSelectedItem = _monitorModel.selectedItem;
-
- var parentAct = _monitorModel.getMonitor().ddm.getActivityByUIID(act.activity.parentUIID);
- var parentSelectedAct = _monitorModel.getMonitor().ddm.getActivityByUIID(_monitorModel.selectedItem.activity.parentUIID);
-
- if(_tempSelectedItem != null) {
-
- // clear currently selected activity
- if(_monitorModel.getMonitor().ddm.getActivityByUIID(parentSelectedAct.parentUIID).activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE) {
- _tempSelectedItem._parent._parent.swapDepths(_tempSelectedItem._parent._parent.depthHistory);
- _tempSelectedItem._parent._parent.depthHistory = null;
-
- _tempSelectedItem.swapDepths(_tempSelectedItem.depthHistory);
- _tempSelectedItem.depthHistory = null;
- }
-
- }
-
- if(_monitorModel.getMonitor().ddm.getActivityByUIID(parentAct.parentUIID).activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE) {
- act._parent._parent.depthHistory = act._parent._parent.getDepth();
- act._parent._parent.swapDepths(DepthManager.kTop);
-
- act.depthHistory = act.getDepth();
- act.swapDepths(DepthManager.kTop);
- }
-
- _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, we have either an optional activity or an optional sequence
- for (var k=0; k 0 we have an optional sequence, for each sequence check its children activities
- if (cActivity.children[j].children != null) {
- var matchedAct = matchChildActivity(cActivity.children[j].children, dropTarget);
- if (matchedAct != null) {
- cActivity = matchedAct;
- hasHit = true;
- break;
- }
- }
- }
- }
- }
- }
-
- if (CanvasBranchView(_monitorModel.activeView).isEnd(MovieClip(dropTarget))) {
- // the drop target is the exit door icon of a branching activity
- hasHit = true;
- forceCompleteTransfer(act, dropTarget);
- }
-
- var _parent:Object = _monitorModel.getMonitor().ddm.getActivityByUIID(dropTarget.activity.parentUIID);
- var _grandParent:Object = _monitorModel.getMonitor().ddm.getActivityByUIID(_parent.parentUIID);
-
- if (_parent.isOptionalSequenceActivity(_grandParent)) {
- hasHit = true;
- forceCompleteTransfer(act, dropTarget);
- }
-
- if (cActivity.activity.activityUIID == dropTarget.activity.activityUIID) {
- hasHit = checkHit(cActivity, act);
- }
- }
- }
-
- if (act.hitTest(_monitorModel.endGate)){
- _monitorModel.endGate.doorClosed._visible = false;
- _monitorModel.endGate.doorOpen._visible = true;
-
- var URLToSend:String = _root.monitoringURL+"forceComplete&lessonID="+_root.lessonID+"&learnerID="+act.Learner.getLearnerId()+"&activityID=null";
- var ref = this;
- var fnOk:Function = Proxy.create(ref,reloadProgress, ref, URLToSend);
- var fnCancel:Function = Proxy.create(ref,activitySnapBack, act);
-
- LFMessage.showMessageConfirm(Dictionary.getValue('al_confirm_forcecomplete_tofinish',[act.Learner.getFullName(), indexArray[i].activity.title]), fnOk,fnCancel);
- hasHit = true;
- }
-
- Debugger.log("droptarget: " + eval(act._droptarget), Debugger.CRITICAL, "activityRelease", "MonitoringController");
-
- if (!hasHit){
- activitySnapBack(act);
-
- if(eval(act._droptarget)._parent instanceof LearnerIcon) return;
-
- var msg:String = Dictionary.getValue('al_error_forcecomplete_notarget',[act.Learner.getFullName()]) ;
- LFMessage.showMessageAlert(msg);
- }
- }
- }
-
- private function reloadProgress(ref, URLToSend){
- var callback:Function = Proxy.create(ref, getProgressData);
- Application.getInstance().getComms().getRequest(URLToSend,callback, false);
- }
-
- private function activitySnapBack(act:Object){
- act._x = act.xCoord;
- act._y = act.yCoord;
- _monitorModel.endGate.doorClosed._visible = true;
- _monitorModel.endGate.doorOpen._visible = false;
- }
-
- private function getProgressData(r){
- trace('force complete ok');
- if(r instanceof LFError) {
- r.showErrorAlert();
- } else if(r) {
- LFMessage.showMessageAlert(r);
- _monitorModel.broadcastViewUpdate("RELOADPROGRESS", null, _monitorModel.getSelectedTab());
- }
- }
-
- public function transitionRelease(t:Object):Void {
- Debugger.log('transitionRelease:'+t.transition.transitionUIID,Debugger.GEN,'transitionRelease','MonitorController');
- Debugger.log('toUIID:'+t.transition.toUIID + " fromUIID: " + t.transition.fromUIID,Debugger.CRITICAL,'transitionRelease','MonitorController');
- }
-
- public function activityReleaseOutside(ca:Object):Void{
- Debugger.log('activityReleaseOutside CanvasActivity:'+ca.activity.activityID,Debugger.GEN,'activityReleaseOutside','MonitorController');
- }
-
- public function activityDoubleClick(ca:Object, forTabView:String, learnerID:Number, fromContextMenu:Boolean):Void{
-
- Debugger.log("ca.activity.isBranchingActivity(): "+ca.activity.isBranchingActivity(), Debugger.GEN, "activityDoubleClick", "MonitorController");
- if(!fromContextMenu && ca.activity.isBranchingActivity() && _monitorModel.getSelectedTab() == MonitorTabView._tabID) {
- _monitorModel.openBranchActivityContent(ca, true);
- }
+
+ public function activityClick(act:Object, forObj:String):Void{
+ Debugger.log("act.activity.title: "+act.activity.title, Debugger.GEN, "activityClick", "MonitorController");
+
+ if (forObj == "LearnerIcon"){
+ _monitorModel.isDragging = true;
+
+ act.startDrag(false);
+ }
else {
- var _learnerID:Number;
- var URLToSend:String;
-
- setBusy();
-
- if(forTabView == "MonitorTabView"){
-
- URLToSend = _root.serverURL+_root.monitoringURL+'getActivityMonitorURL&activityID='+ca.activity.activityID+'&lessonID='+_root.lessonID;
- URLToSend += '&contentFolderID='+MonitorModel(getModel()).getSequence().contentFolderID
-
- } else {
- if(learnerID != null){
- _learnerID = learnerID;
- } else {
- _learnerID = ca.learnerID;
- }
-
- if (forTabView == "MonitorTabViewLearner"){
- URLToSend = _root.serverURL+_root.monitoringURL+'getLearnerActivityURL&activityID='+ca.activityID+'&userID='+_learnerID+'&lessonID='+_root.lessonID;
- }else {
- URLToSend = _root.serverURL+_root.monitoringURL+'getLearnerActivityURL&activityID='+ca.activity.activityID+'&userID='+_learnerID+'&lessonID='+_root.lessonID;
- }
-
- Debugger.log('activityDoubleClick CanvasActivity:'+ca.activityID,Debugger.GEN,'activityDoubleClick','MonitorController');
- }
-
- Debugger.log('Opening url (ca.activityID) :'+URLToSend+" Opening url (ca.activityID)"+URLToSend,Debugger.CRITICAL,'openToolActivityContent','MonitorModel');
-
- if(forTabView != "MonitorTabView" && forTabView != "MonitorTabViewLearner"){
- if(ca.activityStatus == undefined){
-
- var alertMSG:String = Dictionary.getValue('al_doubleclick_todoactivity',[ca.learnerName, ca.activity.title]);
- getURL("javascript:alert('"+alertMSG+"');");
-
- } else {
- JsPopup.getInstance().launchPopupWindow(URLToSend, 'MonitorLearnerActivity', 600, 800, true, true, false, false, false);
- }
- } else {
-
- if(ca.activity.parentUIID != null && (ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE ||
- ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE ||
- ca.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE)) {
-
- // open complex inside complex view
- Debugger.log("open complex viewer: " + ca.activity.activityUIID, Debugger.CRITICAL, "activityDoubleClick", "MonitorController")
- _monitorModel.getMonitor().openComplexView(ca);
- } else {
- JsPopup.getInstance().launchPopupWindow(URLToSend, 'MonitorLearnerActivity', 600, 800, true, true, false, false, false);
- }
-
- }
-
- clearBusy();
- }
- }
-
+ var _tempSelectedItem = _monitorModel.selectedItem;
+
+ var parentAct = _monitorModel.getMonitor().ddm.getActivityByUIID(act.activity.parentUIID);
+ var parentSelectedAct = _monitorModel.getMonitor().ddm.getActivityByUIID(_monitorModel.selectedItem.activity.parentUIID);
+
+ if(_tempSelectedItem != null) {
+
+ // clear currently selected activity
+ if(_monitorModel.getMonitor().ddm.getActivityByUIID(parentSelectedAct.parentUIID).activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE) {
+ _tempSelectedItem._parent._parent.swapDepths(_tempSelectedItem._parent._parent.depthHistory);
+ _tempSelectedItem._parent._parent.depthHistory = null;
+
+ _tempSelectedItem.swapDepths(_tempSelectedItem.depthHistory);
+ _tempSelectedItem.depthHistory = null;
+ }
+
+ }
+
+ if(_monitorModel.getMonitor().ddm.getActivityByUIID(parentAct.parentUIID).activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE) {
+ act._parent._parent.depthHistory = act._parent._parent.getDepth();
+ act._parent._parent.swapDepths(DepthManager.kTop);
+
+ act.depthHistory = act.getDepth();
+ act.swapDepths(DepthManager.kTop);
+ }
+
+ _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, we have either an optional activity or an optional sequence
+ for (var k=0; k 0 we have an optional sequence, for each sequence check its children activities
+ if (cActivity.children[j].children != null) {
+ var matchedAct = matchChildActivity(cActivity.children[j].children, dropTarget);
+ if (matchedAct != null) {
+ cActivity = matchedAct;
+ hasHit = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (CanvasBranchView(_monitorModel.activeView).isEnd(MovieClip(dropTarget))) {
+ // the drop target is the exit door icon of a branching activity
+ hasHit = true;
+ forceCompleteTransfer(act, dropTarget);
+ }
+
+ var _parent:Object = _monitorModel.getMonitor().ddm.getActivityByUIID(dropTarget.activity.parentUIID);
+ var _grandParent:Object = _monitorModel.getMonitor().ddm.getActivityByUIID(_parent.parentUIID);
+
+ if (_parent.isOptionalSequenceActivity(_grandParent)) {
+ hasHit = true;
+ forceCompleteTransfer(act, dropTarget);
+ }
+
+ if (cActivity.activity.activityUIID == dropTarget.activity.activityUIID) {
+ hasHit = checkHit(cActivity, act);
+ }
+ }
+ }
+
+ if (act.hitTest(_monitorModel.endGate)){
+ _monitorModel.endGate.doorClosed._visible = false;
+ _monitorModel.endGate.doorOpen._visible = true;
+
+ var URLToSend:String = _root.monitoringURL+"forceComplete&lessonID="+_root.lessonID+"&learnerID="+act.Learner.getLearnerId()+"&activityID=null";
+ var ref = this;
+ var fnOk:Function = Proxy.create(ref,reloadProgress, ref, URLToSend);
+ var fnCancel:Function = Proxy.create(ref,activitySnapBack, act);
+
+ LFMessage.showMessageConfirm(Dictionary.getValue('al_confirm_forcecomplete_tofinish',[act.Learner.getFullName(), indexArray[i].activity.title]), fnOk,fnCancel);
+ hasHit = true;
+ }
+
+ Debugger.log("droptarget: " + eval(act._droptarget), Debugger.CRITICAL, "activityRelease", "MonitoringController");
+
+ if (!hasHit){
+ activitySnapBack(act);
+
+ if(eval(act._droptarget)._parent instanceof LearnerIcon) return;
+
+ var msg:String = Dictionary.getValue('al_error_forcecomplete_notarget',[act.Learner.getFullName()]) ;
+ LFMessage.showMessageAlert(msg);
+ }
+ }
+ }
+
+ private function reloadProgress(ref, URLToSend){
+ var callback:Function = Proxy.create(ref, getProgressData);
+ Application.getInstance().getComms().getRequest(URLToSend,callback, false);
+ }
+
+ private function activitySnapBack(act:Object){
+ act._x = act.xCoord;
+ act._y = act.yCoord;
+ _monitorModel.endGate.doorClosed._visible = true;
+ _monitorModel.endGate.doorOpen._visible = false;
+ }
+
+ private function getProgressData(r){
+ trace('force complete ok');
+ if(r instanceof LFError) {
+ r.showErrorAlert();
+ } else if(r) {
+ LFMessage.showMessageAlert(r);
+ _monitorModel.broadcastViewUpdate("RELOADPROGRESS", null, _monitorModel.getSelectedTab());
+ }
+ }
+
+ public function transitionRelease(t:Object):Void {
+ Debugger.log('transitionRelease:'+t.transition.transitionUIID,Debugger.GEN,'transitionRelease','MonitorController');
+ Debugger.log('toUIID:'+t.transition.toUIID + " fromUIID: " + t.transition.fromUIID,Debugger.CRITICAL,'transitionRelease','MonitorController');
+ }
+
+ public function activityReleaseOutside(ca:Object):Void{
+ Debugger.log('activityReleaseOutside CanvasActivity:'+ca.activity.activityID,Debugger.GEN,'activityReleaseOutside','MonitorController');
+ }
+
+ public function activityDoubleClick(ca:Object, forTabView:String, learnerID:Number, fromContextMenu:Boolean):Void{
+
+ Debugger.log("ca.activity.isBranchingActivity(): "+ca.activity.isBranchingActivity(), Debugger.GEN, "activityDoubleClick", "MonitorController");
+ if(!fromContextMenu && ca.activity.isBranchingActivity() && _monitorModel.getSelectedTab() == MonitorTabView._tabID) {
+ _monitorModel.openBranchActivityContent(ca, true);
+ }
+ else {
+ var _learnerID:Number;
+ var URLToSend:String;
+
+ setBusy();
+
+ if(forTabView == "MonitorTabView"){
+
+ URLToSend = _root.serverURL+_root.monitoringURL+'getActivityMonitorURL&activityID='+ca.activity.activityID+'&lessonID='+_root.lessonID;
+ URLToSend += '&contentFolderID='+MonitorModel(getModel()).getSequence().contentFolderID
+
+ } else {
+ if(learnerID != null){
+ _learnerID = learnerID;
+ } else {
+ _learnerID = ca.learnerID;
+ }
+
+ if (forTabView == "MonitorTabViewLearner"){
+ URLToSend = _root.serverURL+_root.monitoringURL+'getLearnerActivityURL&activityID='+ca.activityID+'&userID='+_learnerID+'&lessonID='+_root.lessonID;
+ }else {
+ URLToSend = _root.serverURL+_root.monitoringURL+'getLearnerActivityURL&activityID='+ca.activity.activityID+'&userID='+_learnerID+'&lessonID='+_root.lessonID;
+ }
+
+ Debugger.log('activityDoubleClick CanvasActivity:'+ca.activityID,Debugger.GEN,'activityDoubleClick','MonitorController');
+ }
+
+ Debugger.log('Opening url (ca.activityID) :'+URLToSend+" Opening url (ca.activityID)"+URLToSend,Debugger.CRITICAL,'openToolActivityContent','MonitorModel');
+
+ if(forTabView != "MonitorTabView" && forTabView != "MonitorTabViewLearner"){
+ if(ca.activityStatus == undefined){
+
+ var alertMSG:String = Dictionary.getValue('al_doubleclick_todoactivity',[ca.learnerName, ca.activity.title]);
+ getURL("javascript:alert('"+alertMSG+"');");
+
+ } else {
+ JsPopup.getInstance().launchPopupWindow(URLToSend, 'MonitorLearnerActivity', 600, 800, true, true, false, false, false);
+ }
+ } else {
+
+ if(ca.activity.parentUIID != null && (ca.activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE ||
+ ca.activity.activityTypeID == Activity.OPTIONAL_ACTIVITY_TYPE ||
+ ca.activity.activityTypeID == Activity.OPTIONS_WITH_SEQUENCES_TYPE)) {
+
+ // open complex inside complex view
+ Debugger.log("open complex viewer: " + ca.activity.activityUIID, Debugger.CRITICAL, "activityDoubleClick", "MonitorController")
+ _monitorModel.getMonitor().openComplexView(ca);
+ } else {
+ JsPopup.getInstance().launchPopupWindow(URLToSend, 'MonitorLearnerActivity', 600, 800, true, true, false, false, false);
+ }
+
+ }
+
+ clearBusy();
+ }
+ }
+
+
// add control methods
-
- /**
- * Event listener for when when tab is clicked
- *
- * @usage
- * @param evt
- * @return
- */
- public function change(evt):Void{
- _monitorModel.setSelectedTab(evt.target.selectedIndex)
-
- if (_monitorModel.getSequence() != null)
- _monitorModel.changeTab(evt.target.selectedIndex);
- }
-
- private function exportClassPortfolio():Void{
- var exp_url:String = _root.serverURL+"learning/exportWaitingPage.jsp?mode=teacher&lessonID="+_root.lessonID;
- JsPopup.getInstance().launchPopupWindow(exp_url, 'ExportPortfolio', 410, 640, true, true, false, false, false);
+
+ /**
+ * Event listener for when when tab is clicked
+ *
+ * @usage
+ * @param evt
+ * @return
+ */
+ public function change(evt):Void{
+ _monitorModel.setSelectedTab(evt.target.selectedIndex)
+
+ if (_monitorModel.getSequence() != null)
+ _monitorModel.changeTab(evt.target.selectedIndex);
}
-
- private function openJournalEntries():Void{
- var journals_url:String = _root.serverURL+"learning/notebook.do?method=viewAllJournals&lessonID="+_root.lessonID;
- JsPopup.getInstance().launchPopupWindow(journals_url, 'JournalEntries', 570, 796, true, true, false, false, false);
- }
-
- private function openEditOnFly():Void{
- var fnOk:Function = Proxy.create(this, setupEditOnFly);
- LFMessage.showMessageConfirm(Dictionary.getValue('al_confirm_live_edit'), fnOk, null);
- }
-
- private function setupEditOnFly() {
- Debugger.log('!opening edit on fly!',Debugger.CRITICAL,'openEditOnFly','org.lamsfoundation.lams.MonitorController');
-
- _monitorModel.getMonitor().setupEditOnFly(_monitorModel.getSequence().learningDesignID);
- }
+
+ private function exportClassPortfolio():Void{
+ var exp_url:String = _root.serverURL+"learning/exportWaitingPage.jsp?mode=teacher&lessonID="+_root.lessonID;
+ JsPopup.getInstance().launchPopupWindow(exp_url, 'ExportPortfolio', 410, 640, true, true, false, false, false);
+ }
+ private function openJournalEntries():Void{
+ var journals_url:String = _root.serverURL+"learning/notebook.do?method=viewAllJournals&lessonID="+_root.lessonID;
+ JsPopup.getInstance().launchPopupWindow(journals_url, 'JournalEntries', 570, 796, true, true, false, false, false);
+ }
+
+ private function openEditOnFly():Void{
+ var fnOk:Function = Proxy.create(this, setupEditOnFly);
+ LFMessage.showMessageConfirm(Dictionary.getValue('al_confirm_live_edit'), fnOk, null);
+ }
+
+ private function setupEditOnFly() {
+ Debugger.log('!opening edit on fly!',Debugger.CRITICAL,'openEditOnFly','org.lamsfoundation.lams.MonitorController');
+
+ _monitorModel.getMonitor().setupEditOnFly(_monitorModel.getSequence().learningDesignID);
+ }
+
public function click(evt):Void{
var tgt:String = new String(evt.target);
if(tgt.indexOf("editClass_btn") != -1){
- _monitorModel.setDialogOpen("LM_DIALOG");
- } else if(tgt.indexOf("viewLearners_btn") != -1){
+ _monitorModel.setDialogOpen("LM_DIALOG");
+ } else if(tgt.indexOf("viewLearners_btn") != -1){
_monitorModel.setDialogOpen("VM_DIALOG");
- } else if(tgt.indexOf("start_btn") != -1){
- _monitorModel.getMonitor().startLesson(false, _root.lessonID);
- } else if(tgt.indexOf("exportPortfolio_btn") != -1){
- exportClassPortfolio();
- }else if(tgt.indexOf("refresh_btn") != -1){
- if (_monitorModel.getSelectedTab() == 2)
- _monitorModel.resetLearnerIndexBar();
-
- _app.reloadLearningDesign(_monitorModel.getSequence(), Proxy.create(_monitorModel, _monitorModel.refreshAllData));
- }else if(tgt.indexOf("help_btn") != -1){
- _monitorModel.tabHelp();
- }else if(tgt.indexOf("viewJournals_btn") != -1){
- trace('you clicked journal entries button..');
- openJournalEntries();
- }else if(tgt.indexOf("editFly_btn") != -1){
- openEditOnFly();
- }else if(tgt.indexOf("action_btn") != -1){
- _monitorModel.broadcastViewUpdate("TRIGGER_ACTION", null);
+ } else if(tgt.indexOf("start_btn") != -1){
+ _monitorModel.getMonitor().startLesson(false, _root.lessonID);
+ } else if(tgt.indexOf("exportPortfolio_btn") != -1){
+ exportClassPortfolio();
+ }else if(tgt.indexOf("refresh_btn") != -1){
+ if (_monitorModel.getSelectedTab() == 2)
+ _monitorModel.resetLearnerIndexBar();
+
+ _app.reloadLearningDesign(_monitorModel.getSequence(), Proxy.create(_monitorModel, _monitorModel.refreshAllData));
+ }else if(tgt.indexOf("help_btn") != -1){
+ _monitorModel.tabHelp();
+ }else if(tgt.indexOf("viewJournals_btn") != -1){
+ trace('you clicked journal entries button..');
+ openJournalEntries();
+ }else if(tgt.indexOf("editFly_btn") != -1){
+ openEditOnFly();
+ }else if(tgt.indexOf("action_btn") != -1){
+ _monitorModel.broadcastViewUpdate("TRIGGER_ACTION", null);
}
}
-
-
-
+
+
+
/**
* called when the dialog is loaded, calles methods to set up content in dialogue
* also sets up the okClicked event listener
@@ -530,28 +530,28 @@
*/
public function openDialogLoaded(evt:Object) {
Debugger.log('!evt.type:'+evt.type,Debugger.GEN,'openDialogLoaded','org.lamsfoundation.lams.MonitorController');
-
- //Check type is correct
+
+ //Check type is correct
if(evt.type == 'contentLoaded'){
//set a ref to the view
- evt.target.scrollContent.monitorView = LessonTabView(getView());
+ evt.target.scrollContent.monitorView = LessonTabView(getView());
//set a ref to the dia in the view
- LessonTabView(getView()).dialog = evt.target.scrollContent;
+ LessonTabView(getView()).dialog = evt.target.scrollContent;
//set up UI
- //note this function registeres the dialog to receive view updates
+ //note this function registeres the dialog to receive view updates
if (evt.target.scrollContent instanceof org.lamsfoundation.lams.authoring.cmpt.CompetenceEditorDialog) {
- evt.target.scrollContent.setUpContent(_monitorModel);
- } else {
- evt.target.scrollContent.setUpContent();
- }
+ evt.target.scrollContent.setUpContent(_monitorModel);
+ } else {
+ evt.target.scrollContent.setUpContent();
+ }
} else {
//TODO DI 25/05/05 raise wrong event type error
}
}
-
+
/**
* Workspace dialog OK button clicked handler
@@ -578,7 +578,7 @@
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');
}
@@ -590,16 +590,16 @@
Debugger.log('type::'+evt.type,Debugger.GEN,'onTreeNodeClose','org.lamsfoundation.lams.MonitorController');
var treeview = evt.target;
}
-
- /**
- * Save Lesson Class after Lesson is initialized
- *
- * @param lessonID
- * @return
- */
- public function editLessonClass(resultDTO:Object){
- _monitorModel.resultDTO = resultDTO;
- _monitorModel.getMonitor().createLessonClass();
+
+ /**
+ * Save Lesson Class after Lesson is initialized
+ *
+ * @param lessonID
+ * @return
+ */
+ public function editLessonClass(resultDTO:Object){
+ _monitorModel.resultDTO = resultDTO;
+ _monitorModel.getMonitor().createLessonClass();
}
/**
@@ -612,16 +612,16 @@
if(!_isBusy){
setBusy();
var stateID:Number = evt.target.changeStatus_cmb.selectedItem.data;
- switch(stateID){
- case LessonTabView.REMOVE_CBI :
- var confirmMsg:String = Dictionary.getValue('ls_remove_confirm_msg');
- var warningMsg:String = Dictionary.getValue('ls_remove_warning_msg', [LessonTabView(getView()).showStatus(_monitorModel.getSequence().state).toLowerCase()]);
-
- var warningNoHandler = Proxy.create(_monitorModel, _monitorModel.removeSequence);
- var confirmOkHandler = Proxy.create(this, removalAlert, warningMsg, null, warningNoHandler);
-
- removalAlert(confirmMsg, confirmOkHandler, null);
-
+ switch(stateID){
+ case LessonTabView.REMOVE_CBI :
+ var confirmMsg:String = Dictionary.getValue('ls_remove_confirm_msg');
+ var warningMsg:String = Dictionary.getValue('ls_remove_warning_msg', [LessonTabView(getView()).showStatus(_monitorModel.getSequence().state).toLowerCase()]);
+
+ var warningNoHandler = Proxy.create(_monitorModel, _monitorModel.removeSequence);
+ var confirmOkHandler = Proxy.create(this, removalAlert, warningMsg, null, warningNoHandler);
+
+ removalAlert(confirmMsg, confirmOkHandler, null);
+
break;
case LessonTabView.NULL_CBI :
// TODO: error msg
@@ -636,88 +636,88 @@
_monitorModel.archiveSequence();
break;
case LessonTabView.UNARCHIVE_CBI :
- _monitorModel.unarchiveSequence();
+ _monitorModel.unarchiveSequence();
break;
default :
}
clearBusy();
- } else {
- Debugger.log("Unable to run method as controller is busy", Debugger.CRITICAL, "changeStatus", "MonitorController");
+ } else {
+ Debugger.log("Unable to run method as controller is busy", Debugger.CRITICAL, "changeStatus", "MonitorController");
}
}
-
- public function setBusy(){
- _isBusy = true;
- }
-
- public function clearBusy(){
- _isBusy = false;
- }
-
- public function get appData():Object{
- var myObj:Object = new Object();
- myObj.compX = Application.MONITOR_X
- myObj.compY = Application.MONITOR_Y
- myObj.ttHolder = ApplicationParent.tooltip;
- return myObj;
-
- }
-
- /**
- * Searches for learners by name, and returns an array of learners whose full names contain the search string (case insensitive).
- *
- * @param searchStr The learner name to search
- * @return matches Array of Learners whose names contain the search string
- */
- public function searchForLearners(searchStr:String):Array {
- Debugger.log("searchForLearners invoked, searching for "+searchStr, Debugger.CRITICAL, "searchForLearners", "MonitorController");
-
- var len:Number = _monitorModel.progressArrBackup.length;
-
- var matches:Array = new Array();
- for (var i = 0; i < len; i++) {
- var fullName:String = _monitorModel.progressArrBackup[i].getFullName();
- if (fullName.toLowerCase().indexOf(searchStr.toLowerCase()) != -1){
- Debugger.log("Match Found With: "+ fullName, Debugger.CRITICAL, "searchForLearners", "MonitorController");
- matches.push(_monitorModel.progressArrBackup[i]);
- }
- }
- return matches;
- }
-
- /**
- * Alert message after applying the remove action on a archived lesson.
- *
- * @param msg Message to display
- * @param okHandler Method to pass to onPress of OK button
- */
- private function removalAlert(msg:String, okHandler:Function, cancelHandler:Function) {
- LFMessage.showMessageConfirm(msg,okHandler,cancelHandler,Dictionary.getValue('al_yes'),Dictionary.getValue('al_no'));
- }
-
- public function openAboutDialogLoaded(evt:Object) {
- if(evt.type == 'contentLoaded'){
- //set up UI
- //note this function registers the dialog to recieve view updates
- evt.target.scrollContent.setUpContent();
-
- } else {
- //TODO DI 25/05/05 raise wrong event type error
- }
- }
-
- public function viewBranchConditionMappingsDialogLoaded(evt:Object) {
- if(evt.type == 'contentLoaded'){
- //set up UI
- //note this function registers the dialog to recieve view updates
- var branchingActivity:BranchingActivity = BranchingActivity(_monitorModel.selectedItem.activity);
-
- evt.target.scrollContent.branchingActivity = branchingActivity;
- evt.target.scrollContent.mappings = _monitorModel.ddm.getBranchMappingsByActivityUIIDAndType(branchingActivity.activityUIID).all;
- evt.target.scrollContent.loadLists();
- } else {
- //TODO DI 25/05/05 raise wrong event type error
- }
- }
+
+ public function setBusy(){
+ _isBusy = true;
+ }
+
+ public function clearBusy(){
+ _isBusy = false;
+ }
+
+ public function get appData():Object{
+ var myObj:Object = new Object();
+ myObj.compX = Application.MONITOR_X
+ myObj.compY = Application.MONITOR_Y
+ myObj.ttHolder = ApplicationParent.tooltip;
+ return myObj;
+
+ }
+
+ /**
+ * Searches for learners by name, and returns an array of learners whose full names contain the search string (case insensitive).
+ *
+ * @param searchStr The learner name to search
+ * @return matches Array of Learners whose names contain the search string
+ */
+ public function searchForLearners(searchStr:String):Array {
+ Debugger.log("searchForLearners invoked, searching for "+searchStr, Debugger.CRITICAL, "searchForLearners", "MonitorController");
+
+ var len:Number = _monitorModel.progressArrBackup.length;
+
+ var matches:Array = new Array();
+ for (var i = 0; i < len; i++) {
+ var fullName:String = _monitorModel.progressArrBackup[i].getFullName();
+ if (fullName.toLowerCase().indexOf(searchStr.toLowerCase()) != -1){
+ Debugger.log("Match Found With: "+ fullName, Debugger.CRITICAL, "searchForLearners", "MonitorController");
+ matches.push(_monitorModel.progressArrBackup[i]);
+ }
+ }
+ return matches;
+ }
+
+ /**
+ * Alert message after applying the remove action on a archived lesson.
+ *
+ * @param msg Message to display
+ * @param okHandler Method to pass to onPress of OK button
+ */
+ private function removalAlert(msg:String, okHandler:Function, cancelHandler:Function) {
+ LFMessage.showMessageConfirm(msg,okHandler,cancelHandler,Dictionary.getValue('al_yes'),Dictionary.getValue('al_no'));
+ }
+
+ public function openAboutDialogLoaded(evt:Object) {
+ if(evt.type == 'contentLoaded'){
+ //set up UI
+ //note this function registers the dialog to recieve view updates
+ evt.target.scrollContent.setUpContent();
+
+ } else {
+ //TODO DI 25/05/05 raise wrong event type error
+ }
+ }
+
+ public function viewBranchConditionMappingsDialogLoaded(evt:Object) {
+ if(evt.type == 'contentLoaded'){
+ //set up UI
+ //note this function registers the dialog to recieve view updates
+ var branchingActivity:BranchingActivity = BranchingActivity(_monitorModel.selectedItem.activity);
+
+ evt.target.scrollContent.branchingActivity = branchingActivity;
+ evt.target.scrollContent.mappings = _monitorModel.ddm.getBranchMappingsByActivityUIIDAndType(branchingActivity.activityUIID).all;
+ evt.target.scrollContent.loadLists();
+ } else {
+ //TODO DI 25/05/05 raise wrong event type error
+ }
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorLearnerActivity.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorLearnerActivity.as (.../MonitorLearnerActivity.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorLearnerActivity.as (.../MonitorLearnerActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,270 +1,270 @@
-/***************************************************************************
- * 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.*;
+/***************************************************************************
+ * 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.monitoring.*;
-import org.lamsfoundation.lams.monitoring.mv.*;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
-import org.lamsfoundation.lams.authoring.Activity;
-import org.lamsfoundation.lams.common.style.*
-
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.common.style.*
+
import com.polymercode.Draw;
-import mx.managers.*
-import mx.containers.*;
-import mx.events.*
+import mx.managers.*
+import mx.containers.*;
+import mx.events.*
import mx.utils.*
/**
* MonitorLearnerActivity
*/
-class org.lamsfoundation.lams.monitoring.mv.MonitorLearnerActivity extends MovieClip {
+class org.lamsfoundation.lams.monitoring.mv.MonitorLearnerActivity extends MovieClip {
- public static var GATE_ACTIVITY_HEIGHT:Number =50;
- public static var GATE_ACTIVITY_WIDTH:Number = 50;
- public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
- public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
-
- private var xPos:Number;
- private var yPos:Number;
+ public static var GATE_ACTIVITY_HEIGHT:Number =50;
+ public static var GATE_ACTIVITY_WIDTH:Number = 50;
+ public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
+ public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
- //this is set by the init object
- private var _monitorController:MonitorController;
- private var _monitorView;
- private var _tm:ThemeManager;
-
- //TODO:This should be ToolActivity
- private var _activity:Activity;
- private var _isSelected:Boolean;
- private var app:Application;
-
- //locals
- private var actStatus:String;
- private var learner:Object = new Object();
- private var completed_mc:MovieClip;
- private var current_mc:MovieClip;
- private var todo_mc:MovieClip;
- private var attempted_mc:MovieClip;
- private var canvasActivity_mc:MovieClip;
- private var clickTarget_mc:MovieClip;
- private var title_lbl:MovieClip;
- private var groupIcon_mc:MovieClip;
- private var stopSign_mc:MovieClip;
- private var sentFrom:String;
+ private var xPos:Number;
+ private var yPos:Number;
+
+ //this is set by the init object
+ private var _monitorController:MonitorController;
+ private var _monitorView;
+ private var _tm:ThemeManager;
+
+ //TODO:This should be ToolActivity
+ private var _activity:Activity;
+ private var _isSelected:Boolean;
+ private var app:Application;
+
+ //locals
+ private var actStatus:String;
+ private var learner:Object = new Object();
+ private var completed_mc:MovieClip;
+ private var current_mc:MovieClip;
+ private var todo_mc:MovieClip;
+ private var attempted_mc:MovieClip;
+ private var canvasActivity_mc:MovieClip;
+ private var clickTarget_mc:MovieClip;
+ private var title_lbl:MovieClip;
+ private var groupIcon_mc:MovieClip;
+ private var stopSign_mc:MovieClip;
+ private var sentFrom:String;
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 _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;
function MonitorLearnerActivity(){
- _tm = ThemeManager.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 = MonitorLearnerActivity.GATE_ACTIVITY_HEIGHT;
- _visibleWidth = MonitorLearnerActivity.GATE_ACTIVITY_WIDTH;
- }else if(_activity.isGroupActivity()){
- _visibleHeight = MonitorLearnerActivity.TOOL_ACTIVITY_HEIGHT;
- _visibleWidth = MonitorLearnerActivity.TOOL_ACTIVITY_WIDTH;
- }
-
+ _tm = ThemeManager.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 = MonitorLearnerActivity.GATE_ACTIVITY_HEIGHT;
+ _visibleWidth = MonitorLearnerActivity.GATE_ACTIVITY_WIDTH;
+ }else if(_activity.isGroupActivity()){
+ _visibleHeight = MonitorLearnerActivity.TOOL_ACTIVITY_HEIGHT;
+ _visibleWidth = MonitorLearnerActivity.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();
- }
+ //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{
- if(initObj){
-
- _monitorView = initObj._monitorView;
- _monitorController = initObj._monitorController;
- _activity = initObj.activity;
- }
-
- showAssets(false);
-
- if(!_activity.isGateActivity() && !_activity.isGroupActivity()){
- }
-
- setStyles();
- MovieClipUtils.doLater(Proxy.create(this,draw));
+ public function init(initObj):Void{
+ if(initObj){
+
+ _monitorView = initObj._monitorView;
+ _monitorController = initObj._monitorController;
+ _activity = initObj.activity;
+ }
+
+ showAssets(false);
- }
-
- private function showAssets(isVisible:Boolean){
- completed_mc._visible = isVisible;
- current_mc._visible = isVisible;
- canvasActivity_mc._visible = isVisible;
- clickTarget_mc.enabled = isVisible;
- todo_mc._visible = isVisible;
- attempted_mc._visible = isVisible
- title_lbl._visible = true;
- }
-
- /**
- * Updates the CanvasActivity display fields with the current data
- * @usage
- * @return
- */
- public function refresh():Void{
- 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(){
- clickTarget_mc.onPress = Proxy.create (this, localOnPress);
- clickTarget_mc.onRelease = Proxy.create (this, localOnRelease);
+ if(!_activity.isGateActivity() && !_activity.isGroupActivity()){
+ }
+
+ setStyles();
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
+ }
+
+ private function showAssets(isVisible:Boolean){
+ completed_mc._visible = isVisible;
+ current_mc._visible = isVisible;
+ canvasActivity_mc._visible = isVisible;
+ clickTarget_mc.enabled = isVisible;
+ todo_mc._visible = isVisible;
+ attempted_mc._visible = isVisible
+ title_lbl._visible = true;
+ }
+
+ /**
+ * Updates the CanvasActivity display fields with the current data
+ * @usage
+ * @return
+ */
+ public function refresh():Void{
+ 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(){
+ clickTarget_mc.onPress = Proxy.create (this, localOnPress);
+ clickTarget_mc.onRelease = Proxy.create (this, localOnRelease);
clickTarget_mc.onReleaseOutside = Proxy.create (this, localOnReleaseOutside);
-
- Debugger.log(_activity.title+',_activity.isGateActivity():'+_activity.isGateActivity(),4,'draw','CanvasActivity');
-
- if (actStatus == undefined){
- actStatus = Progress.compareProgressData(learner, _activity.activityID);
- }
-
- title_lbl._visible = true;
-
- switch (actStatus){
- case 'completed_mc' :
- completed_mc._visible = true;
- clickTarget_mc.enabled = true;
- break;
- case 'current_mc' :
- current_mc._visible = true;
- clickTarget_mc.enabled = true;
- break;
- case 'attempted_mc' :
- attempted_mc._visible = true;
- clickTarget_mc.enabled = true;
- break;
- default :
- todo_mc._visible = true;
- }
-
+
+ Debugger.log(_activity.title+',_activity.isGateActivity():'+_activity.isGateActivity(),4,'draw','CanvasActivity');
+
+ if (actStatus == undefined){
+ actStatus = Progress.compareProgressData(learner, _activity.activityID);
+ }
+
+ title_lbl._visible = true;
+
+ switch (actStatus){
+ case 'completed_mc' :
+ completed_mc._visible = true;
+ clickTarget_mc.enabled = true;
+ break;
+ case 'current_mc' :
+ current_mc._visible = true;
+ clickTarget_mc.enabled = true;
+ break;
+ case 'attempted_mc' :
+ attempted_mc._visible = true;
+ clickTarget_mc.enabled = true;
+ break;
+ default :
+ todo_mc._visible = true;
+ }
+
//write text
- title_lbl.text = _activity.title;
+ title_lbl.text = _activity.title;
}
-
+
- private function localOnPress():Void{
- // check double-click
- var now:Number = new Date().getTime();
-
- if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
- if (app.controlKeyPressed != "transition"){
- _doubleClicking = true;
- _monitorController.activityDoubleClick(this);
- }
- }else{
- Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','MonitorLearnerActivity');
- _doubleClicking = false;
- }
-
- _dcStartTime = now;
-
- }
-
- private function localOnRelease():Void{
- if(!_doubleClicking){
- Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','MonitorLearnerActivity');
- _monitorController.activityRelease(this);
- }
-
- }
-
- private function localOnReleaseOutside():Void{
- Debugger.log('ReleasingOutside:'+this,Debugger.GEN,'onReleaseOutside','MonitorLearnerActivity');
- _monitorController.activityReleaseOutside(this);
- }
+ private function localOnPress():Void{
+ // check double-click
+ var now:Number = new Date().getTime();
+
+ if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
+ if (app.controlKeyPressed != "transition"){
+ _doubleClicking = true;
+ _monitorController.activityDoubleClick(this);
+ }
+ }else{
+ Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','MonitorLearnerActivity');
+ _doubleClicking = false;
+ }
+
+ _dcStartTime = now;
- /**
- *
- * @usage
- * @return
- */
- public function getVisibleWidth ():Number {
- return _visibleWidth;
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function getVisibleHeight ():Number {
- return _visibleHeight;
- }
-
-
+ }
- 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 localOnRelease():Void{
+ if(!_doubleClicking){
+ Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','MonitorLearnerActivity');
+ _monitorController.activityRelease(this);
+ }
+
}
-
-
- /**
- * Get the CSSStyleDeclaration objects for each component and applies them
- * directly to the instanced
- * @usage
- * @return
- */
- private function setStyles() {
- var styleObj = _tm.getStyleObject('label');
-
- title_lbl.setStyle('styleName',styleObj);
- title_lbl.setStyle('textAlign', 'center');
- }
+
+ private function localOnReleaseOutside():Void{
+ Debugger.log('ReleasingOutside:'+this,Debugger.GEN,'onReleaseOutside','MonitorLearnerActivity');
+ _monitorController.activityReleaseOutside(this);
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleWidth ():Number {
+ return _visibleWidth;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleHeight ():Number {
+ return _visibleHeight;
+ }
+
+
+
+ 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;
+ }
+
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and applies them
+ * directly to the instanced
+ * @usage
+ * @return
+ */
+ private function setStyles() {
+ var styleObj = _tm.getStyleObject('label');
+
+ title_lbl.setStyle('styleName',styleObj);
+ title_lbl.setStyle('textAlign', 'center');
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorLockView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorLockView.as (.../MonitorLockView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorLockView.as (.../MonitorLockView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,267 +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.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.*;
-import org.lamsfoundation.lams.common.dict.*
-import org.lamsfoundation.lams.common.mvc.*
-
-import org.lamsfoundation.lams.common.Config;
-
-import org.lamsfoundation.lams.common.ApplicationParent;
-
-import mx.managers.*
-import mx.containers.*
-import mx.events.*
-import mx.utils.*
-import mx.controls.*
-
-
-/**
-*Monitoring Lock view for the Monitor
-* Relects changes in the MonitorModel
-*/
-
-class org.lamsfoundation.lams.monitoring.mv.MonitorLockView extends AbstractView {
-
- private var _className = "MonitorLockView";
-
- private var _app:Application;
- private var _tm:ThemeManager;
-
- private var _monitorLockView_mc:MovieClip;
-
- //Background panel clip
- private var bkg_pnl:MovieClip;
-
- // Message box
- private var messageBox:MovieClip;
-
- // message and action labels
- private var msg_lbl:Label;
- private var action_lbl:Label;
-
- // buttons
- private var action_btn:Button;
-
- // state variable
- private var _enabled:Boolean;
- private var _isChecking:Boolean;
-
- private var _monitorLockView:MonitorLockView;
- private var _monitorModel:MonitorModel;
- private var _monitorController:MonitorController;
-
- //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 MonitorLockView(){
- _monitorLockView = this;
- _app = Application.getInstance();
- _tm = ThemeManager.getInstance();
-
- action_btn = messageBox.action_btn;
- msg_lbl = messageBox.msg_lbl;
- action_lbl = messageBox.action_lbl;
-
- _isChecking = 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, enabled:Boolean) {
- super (m, c);
- MovieClipUtils.doLater(Proxy.create(this,draw,enabled));
- }
-
- /**
- * 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 'TRIGGER_ACTION' :
- callAction(mm);
- break;
- case 'SEQUENCE' :
- break;
- case 'PROGRESS' :
- checkAvailability(mm);
- break;
- default :
- Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorView');
- }
-
- }
-
- /**
- * layout visual elements on the canvas on initialisation
- */
- private function draw(enabled:Boolean){
- var mcontroller = getController();
-
- _enabled = enabled;
- action_btn.addEventListener("click",mcontroller);
-
- setLabels(enabled);
- setStyles();
-
- dispatchEvent({type:'load',target:this});
-
- }
-
- /**
- * 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('Label');
- msg_lbl.setStyle('styleName', styleObj);
- action_lbl.setStyle('styleName', styleObj);
-
- styleObj = _tm.getStyleObject('Button');
- action_btn.setStyle('styleName', styleObj);
- }
-
- private function setLabels(enabled:Boolean):Void{
- if(enabled) {
- msg_lbl.text = Dictionary.getValue("ls_continue_lbl", [_app.sequence.getSequenceName(), _app.sequence.getLearningDesignModel().editOverrideUserFullName]);
- action_lbl.text = Dictionary.getValue("ls_continue_action_lbl", [Dictionary.getValue("continue_btn")]);
- action_btn.label = Dictionary.getValue("continue_btn");
- } else {
- msg_lbl.text = Dictionary.getValue("ls_locked_msg_lbl", [_app.sequence.getSequenceName(), _app.sequence.getLearningDesignModel().editOverrideUserFullName])
- action_lbl.text = "";
- action_btn.label = Dictionary.getValue("check_avail_btn");
- }
- }
-
- /**
- * Sets the size of the canvas on stage, called from update
- */
- private function setSize(mm:MonitorModel):Void{
- bkg_pnl.setSize(Stage.width,Stage.height);
-
- var offset:Number = 8;
-
- // adjust bubble width
- messageBox.messageBubble.messageBubbleRect._width = (msg_lbl._width < action_lbl._width) ? action_lbl._width + offset : msg_lbl._width + offset;
-
- // position message box in center
- messageBox._x = (bkg_pnl._width/2) - (messageBox._width/2);
- messageBox._y = (bkg_pnl._height/2) - (messageBox._height/2);
-
- }
-
- /**
- * 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();
-
- this._x = p.x;
- this._y = p.y - Application.MONITOR_Y;
- }
-
- private function callAction(mm:MonitorModel):Void{
-
- if(_enabled) {
- // continue action - open live edit
- mm.getMonitor().readyEditOnFly(true);
- } else {
- // check availabilty action - re-get model and check
- action_lbl.text = Dictionary.getValue("msg_bubble_check_action_lbl"); // "Checking..."
- _isChecking = true;
- mm.getMonitor().reloadLessonToMonitor();
- }
- }
-
- private function checkAvailability(mm:MonitorModel):Void {
- var app:Application = Application.getInstance();
- var obj:Object = app.layout.manager.checkAvailability(mm.getSequence());
-
- Debugger.log("isLocked: " + obj.locked + " isEditingUser: " + obj.isEditingUser, Debugger.CRITICAL, "checkAvailability", "MonitorLockView");
-
- if(!obj.locked) {
- // reload monitor
- Debugger.log("Now unlocked, Reloading UI" + obj.isEditingUser, Debugger.CRITICAL, "checkAvailability", "MonitorLockView");
- app.sequence = mm.getSequence();
-
- mm.getMonitor().getMV()._visible = true;
- LFMenuBar.getInstance().setVisible(true);
- destroy();
- } else if(obj.locked && !obj.isEditingUser && _isChecking) {
- action_lbl.text = Dictionary.getValue("msg_bubble_failed_action_lbl"); // "Unavailable. Try Again.";
- _isChecking = false;
- }
- }
-
- /**
- * 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);
- }
-
- /*
- * Returns the default controller for this view.
- */
- public function defaultController (model:Observable):Controller {
- return new MonitorController(model);
- }
-
- public function destroy() {
- this.removeMovieClip();
- }
-
+/***************************************************************************
+ * 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.*;
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.mvc.*
+
+import org.lamsfoundation.lams.common.Config;
+
+import org.lamsfoundation.lams.common.ApplicationParent;
+
+import mx.managers.*
+import mx.containers.*
+import mx.events.*
+import mx.utils.*
+import mx.controls.*
+
+
+/**
+*Monitoring Lock view for the Monitor
+* Relects changes in the MonitorModel
+*/
+
+class org.lamsfoundation.lams.monitoring.mv.MonitorLockView extends AbstractView {
+
+ private var _className = "MonitorLockView";
+
+ private var _app:Application;
+ private var _tm:ThemeManager;
+
+ private var _monitorLockView_mc:MovieClip;
+
+ //Background panel clip
+ private var bkg_pnl:MovieClip;
+
+ // Message box
+ private var messageBox:MovieClip;
+
+ // message and action labels
+ private var msg_lbl:Label;
+ private var action_lbl:Label;
+
+ // buttons
+ private var action_btn:Button;
+
+ // state variable
+ private var _enabled:Boolean;
+ private var _isChecking:Boolean;
+
+ private var _monitorLockView:MonitorLockView;
+ private var _monitorModel:MonitorModel;
+ private var _monitorController:MonitorController;
+
+ //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 MonitorLockView(){
+ _monitorLockView = this;
+ _app = Application.getInstance();
+ _tm = ThemeManager.getInstance();
+
+ action_btn = messageBox.action_btn;
+ msg_lbl = messageBox.msg_lbl;
+ action_lbl = messageBox.action_lbl;
+
+ _isChecking = 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, enabled:Boolean) {
+ super (m, c);
+ MovieClipUtils.doLater(Proxy.create(this,draw,enabled));
+ }
+
+ /**
+ * 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 'TRIGGER_ACTION' :
+ callAction(mm);
+ break;
+ case 'SEQUENCE' :
+ break;
+ case 'PROGRESS' :
+ checkAvailability(mm);
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorView');
+ }
+
+ }
+
+ /**
+ * layout visual elements on the canvas on initialisation
+ */
+ private function draw(enabled:Boolean){
+ var mcontroller = getController();
+
+ _enabled = enabled;
+ action_btn.addEventListener("click",mcontroller);
+
+ setLabels(enabled);
+ setStyles();
+
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ /**
+ * 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('Label');
+ msg_lbl.setStyle('styleName', styleObj);
+ action_lbl.setStyle('styleName', styleObj);
+
+ styleObj = _tm.getStyleObject('Button');
+ action_btn.setStyle('styleName', styleObj);
+ }
+
+ private function setLabels(enabled:Boolean):Void{
+ if(enabled) {
+ msg_lbl.text = Dictionary.getValue("ls_continue_lbl", [_app.sequence.getSequenceName(), _app.sequence.getLearningDesignModel().editOverrideUserFullName]);
+ action_lbl.text = Dictionary.getValue("ls_continue_action_lbl", [Dictionary.getValue("continue_btn")]);
+ action_btn.label = Dictionary.getValue("continue_btn");
+ } else {
+ msg_lbl.text = Dictionary.getValue("ls_locked_msg_lbl", [_app.sequence.getSequenceName(), _app.sequence.getLearningDesignModel().editOverrideUserFullName])
+ action_lbl.text = "";
+ action_btn.label = Dictionary.getValue("check_avail_btn");
+ }
+ }
+
+ /**
+ * Sets the size of the canvas on stage, called from update
+ */
+ private function setSize(mm:MonitorModel):Void{
+ bkg_pnl.setSize(Stage.width,Stage.height);
+
+ var offset:Number = 8;
+
+ // adjust bubble width
+ messageBox.messageBubble.messageBubbleRect._width = (msg_lbl._width < action_lbl._width) ? action_lbl._width + offset : msg_lbl._width + offset;
+
+ // position message box in center
+ messageBox._x = (bkg_pnl._width/2) - (messageBox._width/2);
+ messageBox._y = (bkg_pnl._height/2) - (messageBox._height/2);
+
+ }
+
+ /**
+ * 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();
+
+ this._x = p.x;
+ this._y = p.y - Application.MONITOR_Y;
+ }
+
+ private function callAction(mm:MonitorModel):Void{
+
+ if(_enabled) {
+ // continue action - open live edit
+ mm.getMonitor().readyEditOnFly(true);
+ } else {
+ // check availabilty action - re-get model and check
+ action_lbl.text = Dictionary.getValue("msg_bubble_check_action_lbl"); // "Checking..."
+ _isChecking = true;
+ mm.getMonitor().reloadLessonToMonitor();
+ }
+ }
+
+ private function checkAvailability(mm:MonitorModel):Void {
+ var app:Application = Application.getInstance();
+ var obj:Object = app.layout.manager.checkAvailability(mm.getSequence());
+
+ Debugger.log("isLocked: " + obj.locked + " isEditingUser: " + obj.isEditingUser, Debugger.CRITICAL, "checkAvailability", "MonitorLockView");
+
+ if(!obj.locked) {
+ // reload monitor
+ Debugger.log("Now unlocked, Reloading UI" + obj.isEditingUser, Debugger.CRITICAL, "checkAvailability", "MonitorLockView");
+ app.sequence = mm.getSequence();
+
+ mm.getMonitor().getMV()._visible = true;
+ LFMenuBar.getInstance().setVisible(true);
+ destroy();
+ } else if(obj.locked && !obj.isEditingUser && _isChecking) {
+ action_lbl.text = Dictionary.getValue("msg_bubble_failed_action_lbl"); // "Unavailable. Try Again.";
+ _isChecking = false;
+ }
+ }
+
+ /**
+ * 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);
+ }
+
+ /*
+ * Returns the default controller for this view.
+ */
+ public function defaultController (model:Observable):Controller {
+ return new MonitorController(model);
+ }
+
+ public function destroy() {
+ this.removeMovieClip();
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorModel.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorModel.as (.../MonitorModel.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorModel.as (.../MonitorModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -20,221 +20,221 @@
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
*/
-
+
import org.lamsfoundation.lams.monitoring.*;
-import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.*;
import org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView;
-import org.lamsfoundation.lams.authoring.Activity;
-import org.lamsfoundation.lams.authoring.Branch;
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.Branch;
import org.lamsfoundation.lams.authoring.BranchingActivity;
-import org.lamsfoundation.lams.authoring.Transition
-import org.lamsfoundation.lams.authoring.GateActivity;
-import org.lamsfoundation.lams.authoring.DesignDataModel;
-import org.lamsfoundation.lams.authoring.SequenceActivity;
-import org.lamsfoundation.lams.authoring.br.BranchConnector;
+import org.lamsfoundation.lams.authoring.Transition
+import org.lamsfoundation.lams.authoring.GateActivity;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.authoring.SequenceActivity;
+import org.lamsfoundation.lams.authoring.br.BranchConnector;
import org.lamsfoundation.lams.authoring.cv.CanvasComplexView;
import org.lamsfoundation.lams.common.Sequence;
import org.lamsfoundation.lams.common.util.Observable;
-import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.util.*;
import org.lamsfoundation.lams.common.*;
-import mx.managers.*
-import mx.utils.*
-import mx.events.*;
+import mx.managers.*
+import mx.utils.*
+import mx.events.*;
/*
* Model for the Monitoring Tabs
*/
class MonitorModel extends Observable{
private var _className:String = "MonitorModel";
-
- public var RT_FOLDER:String = "Folder";
- public var RT_ORG:String = "Organisation";
-
- private static var LEARNER_ROLE:String = "LEARNER";
- private static var MONITOR_ROLE:String = "MONITOR";
- private static var TEACHER_ROLE:String = "TEACHER";
+
+ public var RT_FOLDER:String = "Folder";
+ public var RT_ORG:String = "Organisation";
+ private static var LEARNER_ROLE:String = "LEARNER";
+ private static var MONITOR_ROLE:String = "MONITOR";
+ private static var TEACHER_ROLE:String = "TEACHER";
+
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 selectedTab:Number;
- private var _dialogOpen:String; // the type of dialog currently open
-
- private var _staffLoaded:Boolean;
- private var _learnersLoaded:Boolean;
- private var _isLessonProgressChanged:Boolean;
- private var _isSequenceProgressChanged:Boolean;
- private var _isLearnerProgressChanged:Boolean;
- private var _isSequenceSet:Boolean = false;
- private var _isDragging:Boolean;
- private var _isLocked:Boolean;
- private var monitor_y:Number;
- private var monitor_x:Number;
+ private var selectedTab:Number;
+ private var _dialogOpen:String; // the type of dialog currently open
+
+ private var _staffLoaded:Boolean;
+ private var _learnersLoaded:Boolean;
+ private var _isLessonProgressChanged:Boolean;
+ private var _isSequenceProgressChanged:Boolean;
+ private var _isLearnerProgressChanged:Boolean;
+ private var _isSequenceSet:Boolean = false;
+ private var _isDragging:Boolean;
+ private var _isLocked:Boolean;
+ private var monitor_y:Number;
+ private var monitor_x:Number;
private var ttHolder:MovieClip;
private var _monitor:Monitor;
-
- private var _selectedItem:Object; // the currently selected thing - could be activity, transition etc.
- private var _prevSelectedItem:Object;
-
- private var _currentBranchingActivity:Object;
- private var _activeView:Object;
+ private var _selectedItem:Object; // the currently selected thing - could be activity, transition etc.
+ private var _prevSelectedItem:Object;
+
+ private var _currentBranchingActivity:Object;
+ private var _activeView:Object;
+
// add model data
private var _activeSeq:Sequence;
- private var _lastSelectedSeq:Sequence;
+ private var _lastSelectedSeq:Sequence;
private var app:Application;
private var _org:Organisation;
private var _todos:Array; // Array of ToDo ContributeActivity(s)
-
- // state data
+
+ // state data
private var _isDesignDrawn:Boolean;
- private var _showLearners:Boolean;
- private var _inSearchView:Boolean;
- private var _indexSelected:Boolean;
+ private var _showLearners:Boolean;
+ private var _inSearchView:Boolean;
+ private var _indexSelected:Boolean;
private var _resetSearchTextField:Boolean;
- private var _endGate:MovieClip;
- private var _learnerIndexView:MovieClip;
+ private var _endGate:MovieClip;
+ private var _learnerIndexView:MovieClip;
//these are hashtables of mc refs MOVIECLIPS (like CanvasActivity or CanvasTransition)
//each on contains a reference to the emelment in the ddm (activity or transition)
private var _activitiesDisplayed:Hashtable;
- private var _transitionsDisplayed:Hashtable;
- private var _branchesDisplayed:Hashtable;
+ private var _transitionsDisplayed:Hashtable;
+ private var _branchesDisplayed:Hashtable;
private var _learnersProgress:Hashtable;
-
- //this is the dataprovider for the org tree
- private var _treeDP:XML;
- private var _orgResources:Array;
- private var learnerTabActArr:Array;
- private var ddmActivity_keys:Array;
- private var ddmTransition_keys:Array;
+
+ //this is the dataprovider for the org tree
+ private var _treeDP:XML;
+ private var _orgResources:Array;
+ private var learnerTabActArr:Array;
+ private var ddmActivity_keys:Array;
+ private var ddmTransition_keys:Array;
private var _orgs:Array;
- private var _resultDTO:Object;
-
- private static var USER_LOAD_CHECK_INTERVAL:Number = 50;
- private static var USER_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
- 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
-
- private var _currentLearnerIndex:Number;
- private var _oldIndex:Number;
- private var _learnersPerPage:Number;
- private var _numLearners:Number;
- private var _firstDisplayedIndexButton:Number;
- private var _oldFirstDisplayedIndexButton:Number;
- private var _lastDisplayedIndexButton:Number;
- private var _numDisplayedIdxButtons:Number
- private var _numPreferredIndexButtons:Number;
- private var lastIndexInitialised:Boolean;
- private var _drawButtons:Boolean;
-
- private var _doRefresh:Boolean;
-
- private var _matchesArr:Array;
- private var backupLearnersProgArr:Array;
- private var _searchResultsBackup:Array;
- private var _openBranchingActivities:Array;
-
- private var _openBranchingActivity:Number;
-
- private var dispatchEvent:Function;
- public var addEventListener:Function;
- public var removeEventListener:Function;
+ private var _resultDTO:Object;
+ private static var USER_LOAD_CHECK_INTERVAL:Number = 50;
+ private static var USER_LOAD_CHECK_TIMEOUT_COUNT:Number = 200;
+ 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
+
+ private var _currentLearnerIndex:Number;
+ private var _oldIndex:Number;
+ private var _learnersPerPage:Number;
+ private var _numLearners:Number;
+ private var _firstDisplayedIndexButton:Number;
+ private var _oldFirstDisplayedIndexButton:Number;
+ private var _lastDisplayedIndexButton:Number;
+ private var _numDisplayedIdxButtons:Number
+ private var _numPreferredIndexButtons:Number;
+ private var lastIndexInitialised:Boolean;
+ private var _drawButtons:Boolean;
+
+ private var _doRefresh:Boolean;
+
+ private var _matchesArr:Array;
+ private var backupLearnersProgArr:Array;
+ private var _searchResultsBackup:Array;
+ private var _openBranchingActivities:Array;
+
+ private var _openBranchingActivity:Number;
+
+ private var dispatchEvent:Function;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
/**
* Constructor.
*/
public function MonitorModel (monitor:Monitor){
_monitor = monitor;
-
- _showLearners = true;
- isDesignDrawn = true;
- _drawButtons = true;
- _staffLoaded = false;
- _learnersLoaded = false;
- lastIndexInitialised = false;
- _inSearchView = false;
- _resetSearchTextField = false;
- _indexSelected = false;
- _doRefresh = true;
-
- _currentLearnerIndex = 1;
- _oldIndex = 1;
- _numPreferredIndexButtons = 10; // to be displayed at a time
- _learnersPerPage = (_root.pb == undefined) ? 10 : _root.pb;
- _firstDisplayedIndexButton = 1;
- _oldFirstDisplayedIndexButton = 1;
- Debugger.log("progress batch number: "+_root.pb,Debugger.CRITICAL,"MonitorModel","MonitorModel");
-
- _activeView = null;
+ _showLearners = true;
+ isDesignDrawn = true;
+ _drawButtons = true;
+ _staffLoaded = false;
+ _learnersLoaded = false;
+ lastIndexInitialised = false;
+ _inSearchView = false;
+ _resetSearchTextField = false;
+ _indexSelected = false;
+ _doRefresh = true;
+
+ _currentLearnerIndex = 1;
+ _oldIndex = 1;
+ _numPreferredIndexButtons = 10; // to be displayed at a time
+ _learnersPerPage = (_root.pb == undefined) ? 10 : _root.pb;
+ _firstDisplayedIndexButton = 1;
+ _oldFirstDisplayedIndexButton = 1;
+ Debugger.log("progress batch number: "+_root.pb,Debugger.CRITICAL,"MonitorModel","MonitorModel");
+
+ _activeView = null;
+
_activitiesDisplayed = new Hashtable("_activitiesDisplayed");
- _transitionsDisplayed = new Hashtable("_transitionsDisplayed");
- _branchesDisplayed = new Hashtable("_branchesDisplayed");
+ _transitionsDisplayed = new Hashtable("_transitionsDisplayed");
+ _branchesDisplayed = new Hashtable("_branchesDisplayed");
_learnersProgress = new Hashtable("_learnersProgress");
-
- _orgResources = new Array();
- learnerTabActArr = new Array();
- ddmActivity_keys = new Array();
- ddmTransition_keys = new Array();
- _openBranchingActivities = new Array();
+
+ _orgResources = new Array();
+ learnerTabActArr = new Array();
+ ddmActivity_keys = new Array();
+ ddmTransition_keys = new Array();
+ _openBranchingActivities = new Array();
_resultDTO = new Object();
- ttHolder = ApplicationParent.tooltip;
- monitor_y = Application.MONITOR_Y;
- monitor_x = Application.MONITOR_X;
-
- mx.events.EventDispatcher.initialize(this);
+ ttHolder = ApplicationParent.tooltip;
+ monitor_y = Application.MONITOR_Y;
+ monitor_x = Application.MONITOR_X;
+
+ mx.events.EventDispatcher.initialize(this);
app = Application.getInstance();
- }
+ }
// add get/set methods
public function setSequence(activeSeq:Sequence){
-
+
Debugger.log("Active seq: " + activeSeq.ID + " ddm: " + activeSeq.getLearningDesignModel(), Debugger.CRITICAL, "setSequence", "MonitorModel");
- _activeSeq = activeSeq;
-
- var seq:Sequence = Sequence(_activeSeq);
- if (seq.getLearningDesignModel() != null){
- setIsSequenceSet(true);
-
- var obj:Object = app.layout.manager.checkAvailability(_activeSeq);
- locked = obj.locked;
-
- } else {
- getMonitor().openLearningDesign(_activeSeq);
- }
-
- setChanged();
-
+ _activeSeq = activeSeq;
+
+ var seq:Sequence = Sequence(_activeSeq);
+ if (seq.getLearningDesignModel() != null){
+ setIsSequenceSet(true);
+
+ var obj:Object = app.layout.manager.checkAvailability(_activeSeq);
+ locked = obj.locked;
+
+ } else {
+ getMonitor().openLearningDesign(_activeSeq);
+ }
+
+ setChanged();
+
// if seq locked for edit TODO
//send an update
infoObj = {};
- infoObj.updateType = "SEQUENCE";
+ infoObj.updateType = "SEQUENCE";
infoObj.tabID = getSelectedTab();
- notifyObservers(infoObj);
-
+ notifyObservers(infoObj);
+
}
public function getSequence():Sequence{
- return _activeSeq;
- }
-
- public function setIsSequenceSet(setSeq:Boolean){
- _isSequenceSet = setSeq;
- }
-
- private function getIsSequenceSet():Boolean{
- return _isSequenceSet;
+ return _activeSeq;
}
-
- public function loadSequence(_seq:Object):Boolean{
- // create new Sequence from DTO
+
+ public function setIsSequenceSet(setSeq:Boolean){
+ _isSequenceSet = setSeq;
+ }
+
+ private function getIsSequenceSet():Boolean{
+ return _isSequenceSet;
+ }
+
+ public function loadSequence(_seq:Object):Boolean{
+ // create new Sequence from DTO
var seq:Sequence = new Sequence(_seq);
setSequence(seq);
return true;
@@ -253,41 +253,41 @@
public function unarchiveSequence():Void{
var callback:Function = Proxy.create(_monitor, _monitor.reloadLessonToMonitor);
Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=unarchiveLesson&lessonID=' + String(_activeSeq.ID) + '&userID=' + _root.userID,callback, false);
- }
-
- public function removeSequence():Void{
- var callback:Function = Proxy.create(_monitor, _monitor.closeAndRefresh);
- Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=removeLesson&lessonID=' + String(_activeSeq.ID) + '&userID=' + _root.userID,callback, false);
}
+
+ public function removeSequence():Void{
+ var callback:Function = Proxy.create(_monitor, _monitor.closeAndRefresh);
+ Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=removeLesson&lessonID=' + String(_activeSeq.ID) + '&userID=' + _root.userID,callback, false);
+ }
public function activateSequence():Void{
var callback:Function = Proxy.create(_monitor, _monitor.reloadLessonToMonitor);
Application.getInstance().getComms().getRequest('monitoring/monitoring.do?method=unsuspendLesson&lessonID=' + String(_activeSeq.ID) + '&userID=' + _root.userID,callback, false);
- }
-
- public function setLessonProgressData(learnerProg:Array){
- //clear the old lot of Learner Progress data
- _learnersProgress.clear();
- learnerTabActArr = new Array();
-
- learnerTabActArr = learnerProg;
-
- for(var i=0; i>") {
- var diff:Number = numIndexButtons - lastDisplayedIndexButton;
- var minButtons:Number = Math.min(diff, _numPreferredIndexButtons);
- _lastDisplayedIndexButton += minButtons;
- _firstDisplayedIndexButton = _lastDisplayedIndexButton - Math.min(numIndexButtons, _numPreferredIndexButtons) + 1;
- if (!_inSearchView)
- _oldFirstDisplayedIndexButton = _firstDisplayedIndexButton;
- sendButtonUpdate();
- }
- else if (s == "<<") {
- _firstDisplayedIndexButton -= _numPreferredIndexButtons;
- if (_firstDisplayedIndexButton < 1)
- _firstDisplayedIndexButton = 1;
- if (!_inSearchView)
- _oldFirstDisplayedIndexButton = _firstDisplayedIndexButton;
- _lastDisplayedIndexButton = numIndexButtons > _numPreferredIndexButtons ? (_firstDisplayedIndexButton + _numPreferredIndexButtons - 1) : numIndexButtons;
- sendButtonUpdate();
- }
- else { // 'Refresh', 'Go' or 'Index View' or numeric index button clicked
- if (_indexSelected) {
- _indexSelected = false;
- }
- else if (_inSearchView) {
- _firstDisplayedIndexButton = 1; // index View
- _lastDisplayedIndexButton = Math.min(numIndexButtons,_numPreferredIndexButtons);
- }
- else {
- _firstDisplayedIndexButton = (_oldFirstDisplayedIndexButton > 0) ? _oldFirstDisplayedIndexButton : 1;
- _lastDisplayedIndexButton = _firstDisplayedIndexButton + Math.min(numIndexButtons,_numPreferredIndexButtons) - 1;
- }
- }
- }
-
- public function set indexSelected(idxSelected:Boolean) {
- _indexSelected = idxSelected;
- }
-
- public function sendButtonUpdate():Void {
- //Set flag for notify observers
- setChanged();
-
- //build and send update object
- infoObj = {};
- infoObj.tabID = 2;
- infoObj.updateType = "DRAW_BUTTONS";
- notifyObservers(infoObj);
- }
-
- public function set drawIndexButtons(drawButtons:Boolean):Void {
- _drawButtons = drawButtons;
- }
-
- public function get drawIndexButtons():Boolean {
- return _drawButtons;
- }
-
- public function get numDisplayedIdxButtons():Number {
- return _numDisplayedIdxButtons = _lastDisplayedIndexButton - _firstDisplayedIndexButton + 1;
+
+ public function set currentLearnerIndexNoRedraw(idx:Number):Void {
+ _currentLearnerIndex = idx;
}
-
- public function get firstDisplayedIndexButton():Number {
- return _firstDisplayedIndexButton;
- }
-
- public function get lastDisplayedIndexButton():Number {
- if (!lastIndexInitialised) {
- _lastDisplayedIndexButton = Math.min(numIndexButtons, _numPreferredIndexButtons);
- lastIndexInitialised = true;
- }
- return _lastDisplayedIndexButton;
- }
-
- public function get numPreferredIndexButtons():Number {
- return _numPreferredIndexButtons;
- }
-
- public function set searchResults(matchesArr:Array) {
- if (!_inSearchView) {
- _currentLearnerIndex = 1;
- }
- _inSearchView = true;
- setLessonProgressData(matchesArr);
- _searchResultsBackup = matchesArr;
- }
-
- // invoked on refresh
- public function resetLearnerIndexBar():Void {
- _drawButtons = true;
- if (_inSearchView)
- _currentLearnerIndex = 1;
- _oldFirstDisplayedIndexButton = 1;
- _inSearchView = false;
- _resetSearchTextField = true;
- }
-
- public function set resetSearchTextField(resetTextField:Boolean):Void {
- _resetSearchTextField = resetTextField;
- }
-
- public function get resetSearchTextField():Boolean {
- return _resetSearchTextField;
- }
-
- public function set oldIndex(idx:Number):Void {
- _oldIndex = idx;
- }
-
- public function get oldIndex():Number {
- return _oldIndex;
- }
-
- public function set inSearchView(inSearchView:Boolean):Void {
- _inSearchView = inSearchView;
- }
-
- public function get inSearchView():Boolean {
- return _inSearchView;
- }
-
- public function getlearnerTabActArr():Array{
- return learnerTabActArr;
- }
-
- public function set activeView(a:Object):Void{
- _activeView = a;
-
- broadcastViewUpdate("SET_ACTIVE", a);
- }
-
- public function get activeView():Object {
- return _activeView;
- }
-
- public function isActiveView(view:Object):Boolean {
- return (activeView == view);
- }
- public function addNewBranch(sequence:SequenceActivity, branchingActivity:BranchingActivity, isDefault:Boolean):Void {
+ public function set currentLearnerIndex(idx:Number):Void {
+ Debugger.log("in currentLearnerIndex idx: "+idx, Debugger.CRITICAL, "currentLearnerIndex", "MonitorModel");
+ _currentLearnerIndex = idx;
+
+ //Set flag for notify observers
+ setChanged();
+
+ //build and send update object
+ infoObj = {};
+ infoObj.tabID = 2;
+ infoObj.updateType = "DRAW_DESIGN";
+ notifyObservers(infoObj);
+ }
+
+ public function get currentLearnerIndex():Number {
+ return _currentLearnerIndex;
+ }
+
+ public function set learnersPerPage(num:Number):Void {
+ _learnersPerPage = num;
+ }
+
+ public function get learnersPerPage():Number {
+ return _learnersPerPage;
+ }
+
+ public function get numIndexButtons(): Number {
+ var numIdxBtns:Number;
+ if (inSearchView) {
+ numIdxBtns = Math.ceil(_learnersProgress.size()/learnersPerPage);
+ } else {
+ numIdxBtns = Math.ceil(Math.max(getSequence().noStartedLearners,_learnersProgress.size())/learnersPerPage);
+ }
+ return numIdxBtns;
+ }
+
+ public function updateIndexButtons(s:String):Void {
+ if (s == ">>") {
+ var diff:Number = numIndexButtons - lastDisplayedIndexButton;
+ var minButtons:Number = Math.min(diff, _numPreferredIndexButtons);
+ _lastDisplayedIndexButton += minButtons;
+ _firstDisplayedIndexButton = _lastDisplayedIndexButton - Math.min(numIndexButtons, _numPreferredIndexButtons) + 1;
+ if (!_inSearchView)
+ _oldFirstDisplayedIndexButton = _firstDisplayedIndexButton;
+ sendButtonUpdate();
+ }
+ else if (s == "<<") {
+ _firstDisplayedIndexButton -= _numPreferredIndexButtons;
+ if (_firstDisplayedIndexButton < 1)
+ _firstDisplayedIndexButton = 1;
+ if (!_inSearchView)
+ _oldFirstDisplayedIndexButton = _firstDisplayedIndexButton;
+ _lastDisplayedIndexButton = numIndexButtons > _numPreferredIndexButtons ? (_firstDisplayedIndexButton + _numPreferredIndexButtons - 1) : numIndexButtons;
+ sendButtonUpdate();
+ }
+ else { // 'Refresh', 'Go' or 'Index View' or numeric index button clicked
+ if (_indexSelected) {
+ _indexSelected = false;
+ }
+ else if (_inSearchView) {
+ _firstDisplayedIndexButton = 1; // index View
+ _lastDisplayedIndexButton = Math.min(numIndexButtons,_numPreferredIndexButtons);
+ }
+ else {
+ _firstDisplayedIndexButton = (_oldFirstDisplayedIndexButton > 0) ? _oldFirstDisplayedIndexButton : 1;
+ _lastDisplayedIndexButton = _firstDisplayedIndexButton + Math.min(numIndexButtons,_numPreferredIndexButtons) - 1;
+ }
+ }
+ }
+
+ public function set indexSelected(idxSelected:Boolean) {
+ _indexSelected = idxSelected;
+ }
+
+ public function sendButtonUpdate():Void {
+ //Set flag for notify observers
+ setChanged();
+
+ //build and send update object
+ infoObj = {};
+ infoObj.tabID = 2;
+ infoObj.updateType = "DRAW_BUTTONS";
+ notifyObservers(infoObj);
+ }
+
+ public function set drawIndexButtons(drawButtons:Boolean):Void {
+ _drawButtons = drawButtons;
+ }
+
+ public function get drawIndexButtons():Boolean {
+ return _drawButtons;
+ }
+
+ public function get numDisplayedIdxButtons():Number {
+ return _numDisplayedIdxButtons = _lastDisplayedIndexButton - _firstDisplayedIndexButton + 1;
+ }
+
+ public function get firstDisplayedIndexButton():Number {
+ return _firstDisplayedIndexButton;
+ }
+
+ public function get lastDisplayedIndexButton():Number {
+ if (!lastIndexInitialised) {
+ _lastDisplayedIndexButton = Math.min(numIndexButtons, _numPreferredIndexButtons);
+ lastIndexInitialised = true;
+ }
+ return _lastDisplayedIndexButton;
+ }
+
+ public function get numPreferredIndexButtons():Number {
+ return _numPreferredIndexButtons;
+ }
+
+ public function set searchResults(matchesArr:Array) {
+ if (!_inSearchView) {
+ _currentLearnerIndex = 1;
+ }
+ _inSearchView = true;
+ setLessonProgressData(matchesArr);
+ _searchResultsBackup = matchesArr;
+ }
+
+ // invoked on refresh
+ public function resetLearnerIndexBar():Void {
+ _drawButtons = true;
+ if (_inSearchView)
+ _currentLearnerIndex = 1;
+ _oldFirstDisplayedIndexButton = 1;
+ _inSearchView = false;
+ _resetSearchTextField = true;
+ }
+
+ public function set resetSearchTextField(resetTextField:Boolean):Void {
+ _resetSearchTextField = resetTextField;
+ }
+
+ public function get resetSearchTextField():Boolean {
+ return _resetSearchTextField;
+ }
+
+ public function set oldIndex(idx:Number):Void {
+ _oldIndex = idx;
+ }
+
+ public function get oldIndex():Number {
+ return _oldIndex;
+ }
+
+ public function set inSearchView(inSearchView:Boolean):Void {
+ _inSearchView = inSearchView;
+ }
+
+ public function get inSearchView():Boolean {
+ return _inSearchView;
+ }
+
+ public function getlearnerTabActArr():Array{
+ return learnerTabActArr;
+ }
+
+ public function set activeView(a:Object):Void{
+ _activeView = a;
+
+ broadcastViewUpdate("SET_ACTIVE", a);
+ }
+
+ public function get activeView():Object {
+ return _activeView;
+ }
+
+ public function isActiveView(view:Object):Boolean {
+ return (activeView == view);
+ }
+
+ public function addNewBranch(sequence:SequenceActivity, branchingActivity:BranchingActivity, isDefault:Boolean):Void {
Debugger.log("sequence.firstActivityUIID: "+sequence.firstActivityUIID, Debugger.CRITICAL, "addNewBranch", "MonitorModel");
@@ -691,105 +691,105 @@
if(!sequence.stopAfterActivity) {
b = new Branch(app.getMonitor().ddm.newUIID(), BranchConnector.DIR_TO_END, app.getMonitor().ddm.getActivityByUIID(this.getLastActivityUIID(sequence.firstActivityUIID)).activityUIID, branchingActivity.activityUIID, sequence, app.getMonitor().ddm.learningDesignID);
app.getMonitor().ddm.addBranch(b);
- }
-
- if(isDefault)
- branchingActivity.defaultBranch = b;
- }
-
- setDirty();
- }
-
- public function moveActivitiesToBranchSequence(activityUIID:Number, sequence:SequenceActivity):Boolean {
- return true;
- }
-
- private function getLastActivityUIID(activityUIID:Number):Number {
-
- // get next activity from transition
- var transObj = app.getMonitor().ddm.getTransitionsForActivityUIID(activityUIID);
- Debugger.log("transObj: "+transObj, Debugger.CRITICAL, "getLastActivityUIID", "MonitorModel");
-
- return (transObj.out == null) ? activityUIID : getLastActivityUIID(transObj.out.toUIID);
- }
-
- private function orderDesign(activity:Activity, order:Array, omitComplex:Boolean):Void{
- order.push(activity);
-
- if(!omitComplex && (activity.isBranchingActivity() || activity.isSequenceActivity() || activity.isOptionalActivity() || activity.isOptionsWithSequencesActivity())) {
- var children:Array = _activeSeq.getLearningDesignModel().getComplexActivityChildren(activity.activityUIID);
- 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 refreshAllData(learningDesignDTO:Object){
+ var ddm:DesignDataModel = new DesignDataModel();
+ ddm.setDesign(learningDesignDTO);
+ if(!app.layout.manager.checkAvailabilityOnDDM(ddm).locked) {
+
+ selectedTab = getSelectedTab();
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "RELOADPROGRESS";
+ infoObj.tabID = selectedTab;
+ notifyObservers(infoObj);
+ } else {
+ ApplicationParent.extCall("reloadWindow", null);
+ }
+ }
+
+ public function tabHelp(){
+ var callback:Function = Proxy.create(this, openTabHelp);
+ app.getHelpURL(callback)
+ }
+
+ private function selectedTabName():String{
+ selectedTab = getSelectedTab();
+ var tabName:String
+ switch (String(selectedTab)){
+ case '0' :
+ tabName = "lesson"
+ break;
+ case '1' :
+ tabName = "sequence"
+ break;
+ case '2' :
+ tabName = "learners"
+ break;
+ default :
+ }
+ return tabName;
+
+
+ }
+
+ private function openTabHelp(url:String){
+ var tabName:String = selectedTabName();
+ var locale:String = _root.lang + _root.country;
+ var target:String = app.module +tabName+ '#' + app.module +tabName+ '-' + locale;
+
+ ApplicationParent.extCall("openURL", url + target);
+ }
+ /**
+ * 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);
+
+ // 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;
+ }
+
public function requestLearners(data:Object, callback:Function){
_monitor.requestUsers(LEARNER_ROLE, data.organisationID, callback);
@@ -1008,25 +1008,25 @@
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){
- user.addRole(role);
- } else {
- user = new User();
- user.populateFromDTO(u);
- user.addRole(role);
-
- organisation.addUser(user);
- }
- }
- }
+
+
+ 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){
+ user.addRole(role);
+ } else {
+ user = new User();
+ user.populateFromDTO(u);
+ user.addRole(role);
+
+ organisation.addUser(user);
+ }
+ }
+ }
public function getLessonClassData():Object{
var classData:Object = new Object();
@@ -1047,53 +1047,53 @@
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");
- }
-
+
+
+ /////////////////////// 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 openBranchActivityContent(ba, visible:Boolean):Void {
- currentBranchingActivity = ba;
+ currentBranchingActivity = ba;
Debugger.log("openBranchActivityContent invoked: " + ba, Debugger.CRITICAL, "openBranchActivityContent", "MonitorModel");
if(visible == null) visible = true;
Debugger.log("visible: " + visible, Debugger.CRITICAL, "openBranchActivityContent", "MonitorModel");
-
+
if(ba.activity.branchView != null) {
- ba.activity.branchView.prevActiveView = activeView;
+ ba.activity.branchView.prevActiveView = activeView;
activeView = (visible) ? ba.activity.branchView : activeView;
- ba.activity.branchView.setOpen(visible);
- ba.activity.branchView.open();
+ ba.activity.branchView.setOpen(visible);
+ ba.activity.branchView.open();
setDirty();
} else {
- _monitor.openBranchView(currentBranchingActivity, visible);
+ _monitor.openBranchView(currentBranchingActivity, visible);
}
- }
-
+ }
+
public function setDirty(doClear:Boolean){
- _isDirty = true;
-
+ _isDirty = true;
+
if(_doRefresh) {
- if(doClear || doClear == undefined) clearDesign();
- drawDesign();
+ if(doClear || doClear == undefined) clearDesign();
+ drawDesign();
}
}
@@ -1145,104 +1145,104 @@
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();
+ }
+
+ /**
+ * 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;
- }
-
- 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;
- }
-
+
+ /**
+ *
+ * @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;
+ }
+
+ 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;
- }
+ }
+ 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;
@@ -1271,40 +1271,40 @@
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 learnerIndexView(a:MovieClip){
- _learnerIndexView = a;
- }
-
- public function get learnerIndexView():MovieClip{
- return _learnerIndexView;
- }
-
- 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;
- }
+
+ public function set endGate(a:MovieClip){
+ _endGate = a;
+ }
+
+ public function get endGate():MovieClip{
+ return _endGate;
+ }
+
+ public function set learnerIndexView(a:MovieClip){
+ _learnerIndexView = a;
+ }
+
+ public function get learnerIndexView():MovieClip{
+ return _learnerIndexView;
+ }
+ 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
@@ -1323,109 +1323,109 @@
public function get transitionsDisplayed():Hashtable{
return _transitionsDisplayed;
- }
-
- public function get branchesDisplayed():Hashtable{
- return _branchesDisplayed;
- }
-
- public function get allLearnersProgress():Array{
- learnerTabActArr.sortOn(["_learnerLName", "_learnerFName"], Array.CASEINSENSITIVE);
- return learnerTabActArr;
- }
-
- public function backupLearnersProgress(learnersProgArr:Array):Void {
- backupLearnersProgArr = learnersProgArr;
- }
-
- public function get progressArrBackup():Array {
- return backupLearnersProgArr;
- }
-
- public function get searchResultsBackup():Array {
- return _searchResultsBackup;
- }
-
- public function getActivityKeys():Array{
- trace("ddmActivity_keys length: "+ ddmActivity_keys.length)
- return ddmActivity_keys;
- }
-
- public function getTransitionKeys():Array{
- return ddmTransition_keys;
- }
+ }
+
+ public function get branchesDisplayed():Hashtable{
+ return _branchesDisplayed;
+ }
+
+ public function get allLearnersProgress():Array{
+ learnerTabActArr.sortOn(["_learnerLName", "_learnerFName"], Array.CASEINSENSITIVE);
+ return learnerTabActArr;
+ }
+
+ public function backupLearnersProgress(learnersProgArr:Array):Void {
+ backupLearnersProgArr = learnersProgArr;
+ }
+
+ public function get progressArrBackup():Array {
+ return backupLearnersProgArr;
+ }
+
+ public function get searchResultsBackup():Array {
+ return _searchResultsBackup;
+ }
+
+ 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;
- }
-
-
- public function get currentBranchingActivity():Object {
- return _currentBranchingActivity;
- }
-
- public function set currentBranchingActivity(a:Object) {
- _currentBranchingActivity = a;
- }
-
- public function findParent(a:Activity, b:Activity):Boolean {
- if(a.parentUIID == b.activityUIID)
- return true;
- else if(a.parentUIID == null)
- return false;
- else
- return findParent(_activeSeq.getLearningDesignModel().getActivityByUIID(a.parentUIID), b);
- }
-
- public function get ddm():DesignDataModel {
- return _monitor.ddm;
- }
+ }
- public function haltRefresh(a:Boolean):Void {
- _doRefresh = !a;
- }
-
- public function get isDirty():Boolean {
- return _isDirty;
- }
-
- public function set openBranchingActivity(a:Number):Void {
- _openBranchingActivity = a;
- }
-
- public function get openBranchingActivity():Number {
- return _openBranchingActivity;
- }
-
- public function get openBranchingActivities():Array {
- return _openBranchingActivities;
- }
-
+ 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;
+ }
+
+
+ public function get currentBranchingActivity():Object {
+ return _currentBranchingActivity;
+ }
+
+ public function set currentBranchingActivity(a:Object) {
+ _currentBranchingActivity = a;
+ }
+
+ public function findParent(a:Activity, b:Activity):Boolean {
+ if(a.parentUIID == b.activityUIID)
+ return true;
+ else if(a.parentUIID == null)
+ return false;
+ else
+ return findParent(_activeSeq.getLearningDesignModel().getActivityByUIID(a.parentUIID), b);
+ }
+
+ public function get ddm():DesignDataModel {
+ return _monitor.ddm;
+ }
+
+ public function haltRefresh(a:Boolean):Void {
+ _doRefresh = !a;
+ }
+
+ public function get isDirty():Boolean {
+ return _isDirty;
+ }
+
+ public function set openBranchingActivity(a:Number):Void {
+ _openBranchingActivity = a;
+ }
+
+ public function get openBranchingActivity():Number {
+ return _openBranchingActivity;
+ }
+
+ public function get openBranchingActivities():Array {
+ return _openBranchingActivities;
+ }
+
}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorView.as (.../MonitorView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/MonitorView.as (.../MonitorView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,464 +1,464 @@
-/***************************************************************************
- * 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:ScrollPane;
- 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 _monitorPanels_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 _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;
-
- //MonitorGateView
- private var monitorGateView:MonitorGateView;
- private var monitorGateView_mc:MovieClip;
-
- //TodoTabView
- private var todoTabView:TodoTabView;
- private var todoTabView_mc:MovieClip;
-
- //LearnerTabView
- private var learnerTabView:LearnerTabView;
- private var learnerTabView_mc:MovieClip;
-
- //LearnerIndexView
- private var learnerIndexView:LearnerIndexView;
- private var learnerIndexView_mc:MovieClip;
-
- private var _monitorController:MonitorController;
-
- private var lessonTabLoaded;
- private var monitorTabLoaded;
- private var monitorGateLoaded;
- private var learnerTabLoaded;
- private var learnerIndexLoaded;
-
- //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;
- monitorGateLoaded = false;
- learnerTabLoaded = false;
- learnerIndexLoaded = 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;
-
- bkg_pnl._visible = false;
-
- 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('monitorGateView_mc') != -1) { monitorGateLoaded = true; }
- else if(tgt.indexOf('learnerTabView_mc') != -1) { learnerTabLoaded = true; }
- else if(tgt.indexOf('learnerIndexView_mc') != -1) { learnerIndexLoaded = true; }
- else Debugger.log('not recognised instance ' + evt.target,Debugger.GEN,'tabLoaded','MonitorView');
-
- if(lessonTabLoaded && monitorTabLoaded && learnerTabLoaded && monitorGateLoaded && learnerIndexLoaded) {
- 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();
- }
-
- 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(){
- 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());
-
- 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();
-
- _monitorPanels_mc = this.createEmptyMovieClip('_monitorPanels_mc', DepthManager.kTop);
-
- // 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 Monitor Gate View
- monitorGateView_mc = _monitorPanels_mc.attachMovie("endGate", "monitorGateView_mc", _monitorPanels_mc.getNextHighestDepth(), {_x: 0, _y: 0});
- monitorGateView = MonitorGateView(monitorGateView_mc);
- monitorGateView.init(mm, undefined);
- monitorGateView.addEventListener('load',Proxy.create(this,tabLoaded));
-
- // Inititialsation for Learner Index View
- learnerIndexView_mc = _monitorPanels_mc.attachMovie("LearnerIndexView", "learnerIndexView_mc", _monitorPanels_mc.getNextHighestDepth());
- learnerIndexView = LearnerIndexView(learnerIndexView_mc);
- learnerIndexView.init(mm, undefined);
- learnerIndexView.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(monitorGateView);
- mm.addObserver(learnerIndexView);
- mm.addObserver(learnerTabView);
- }
-
- public function showToolTip(btnObj, btnTT:String):Void{
- var btnLabel = btnObj.label;
- var xpos:Number = btnObj._x;
-
- var Xpos = Application.MONITOR_X + xpos;
- var Ypos = (Application.MONITOR_Y + btnObj._y + btnObj.height) + 5;
- var ttHolder = ApplicationParent.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();
- bkg_pnl.setSize(s.w,s.h);
- Debugger.log("s.h: "+s.h, Debugger.CRITICAL, "setSize", "MonitorView");
-
- bkgHeader_pnl.setSize(s.w, bkgHeader_pnl._height);
-
- monitorLesson_scp.setSize(s.w-monitorLesson_scp._x, s.h);
- monitorSequence_scp.setSize(s.w-monitorSequence_scp._x, s.h-40.7); // endGate height = 40.7
- monitorGateView.setSize(mm);
-
- Debugger.log("MonitorViews.w: "+s.w, Debugger.CRITICAL, "setSize", "MonitorView");
-
- learnerIndexView.setSize(mm);
- (mm.numIndexButtons > 1 || mm.inSearchView) ? monitorLearner_scp.setSize(s.w-monitorLearner_scp._x, s.h-20) : monitorLearner_scp.setSize(s.w-monitorLearner_scp._x, s.h);
-
- 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();
-
- this._x = p.x;
- this._y = p.y;
- }
-
- public function getLessonTabView():LessonTabView{
- return lessonTabView;
- }
-
- public function getMonitorTabView():MonitorTabView{
- return monitorTabView;
- }
-
- /**
- * Overrides method in abstract view to ensure correct 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{
- return monitorLesson_scp;
- }
- public function getMonitorSequenceScp():MovieClip{
- return monitorSequence_scp;
- }
- public function getMonitorLearnerScp():ScrollPane{
- return monitorLearner_scp;
- }
-
- public function getLearnerIndexPanel():MovieClip {
- return learnerIndexView_mc;
- }
-
- /*
- * Returns the default controller for this view.
- */
- public function defaultController (model:Observable):Controller {
- return new MonitorController(model);
- }
-
+/***************************************************************************
+ * 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:ScrollPane;
+ 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 _monitorPanels_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 _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;
+
+ //MonitorGateView
+ private var monitorGateView:MonitorGateView;
+ private var monitorGateView_mc:MovieClip;
+
+ //TodoTabView
+ private var todoTabView:TodoTabView;
+ private var todoTabView_mc:MovieClip;
+
+ //LearnerTabView
+ private var learnerTabView:LearnerTabView;
+ private var learnerTabView_mc:MovieClip;
+
+ //LearnerIndexView
+ private var learnerIndexView:LearnerIndexView;
+ private var learnerIndexView_mc:MovieClip;
+
+ private var _monitorController:MonitorController;
+
+ private var lessonTabLoaded;
+ private var monitorTabLoaded;
+ private var monitorGateLoaded;
+ private var learnerTabLoaded;
+ private var learnerIndexLoaded;
+
+ //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;
+ monitorGateLoaded = false;
+ learnerTabLoaded = false;
+ learnerIndexLoaded = 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;
+
+ bkg_pnl._visible = false;
+
+ 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('monitorGateView_mc') != -1) { monitorGateLoaded = true; }
+ else if(tgt.indexOf('learnerTabView_mc') != -1) { learnerTabLoaded = true; }
+ else if(tgt.indexOf('learnerIndexView_mc') != -1) { learnerIndexLoaded = true; }
+ else Debugger.log('not recognised instance ' + evt.target,Debugger.GEN,'tabLoaded','MonitorView');
+
+ if(lessonTabLoaded && monitorTabLoaded && learnerTabLoaded && monitorGateLoaded && learnerIndexLoaded) {
+ 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();
+ }
+
+ 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(){
+ 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());
+
+ 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();
+
+ _monitorPanels_mc = this.createEmptyMovieClip('_monitorPanels_mc', DepthManager.kTop);
+
+ // 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 Monitor Gate View
+ monitorGateView_mc = _monitorPanels_mc.attachMovie("endGate", "monitorGateView_mc", _monitorPanels_mc.getNextHighestDepth(), {_x: 0, _y: 0});
+ monitorGateView = MonitorGateView(monitorGateView_mc);
+ monitorGateView.init(mm, undefined);
+ monitorGateView.addEventListener('load',Proxy.create(this,tabLoaded));
+
+ // Inititialsation for Learner Index View
+ learnerIndexView_mc = _monitorPanels_mc.attachMovie("LearnerIndexView", "learnerIndexView_mc", _monitorPanels_mc.getNextHighestDepth());
+ learnerIndexView = LearnerIndexView(learnerIndexView_mc);
+ learnerIndexView.init(mm, undefined);
+ learnerIndexView.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(monitorGateView);
+ mm.addObserver(learnerIndexView);
+ mm.addObserver(learnerTabView);
+ }
+
+ public function showToolTip(btnObj, btnTT:String):Void{
+ var btnLabel = btnObj.label;
+ var xpos:Number = btnObj._x;
+
+ var Xpos = Application.MONITOR_X + xpos;
+ var Ypos = (Application.MONITOR_Y + btnObj._y + btnObj.height) + 5;
+ var ttHolder = ApplicationParent.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();
+ bkg_pnl.setSize(s.w,s.h);
+ Debugger.log("s.h: "+s.h, Debugger.CRITICAL, "setSize", "MonitorView");
+
+ bkgHeader_pnl.setSize(s.w, bkgHeader_pnl._height);
+
+ monitorLesson_scp.setSize(s.w-monitorLesson_scp._x, s.h);
+ monitorSequence_scp.setSize(s.w-monitorSequence_scp._x, s.h-40.7); // endGate height = 40.7
+ monitorGateView.setSize(mm);
+
+ Debugger.log("MonitorViews.w: "+s.w, Debugger.CRITICAL, "setSize", "MonitorView");
+
+ learnerIndexView.setSize(mm);
+ (mm.numIndexButtons > 1 || mm.inSearchView) ? monitorLearner_scp.setSize(s.w-monitorLearner_scp._x, s.h-20) : monitorLearner_scp.setSize(s.w-monitorLearner_scp._x, s.h);
+
+ 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();
+
+ this._x = p.x;
+ this._y = p.y;
+ }
+
+ public function getLessonTabView():LessonTabView{
+ return lessonTabView;
+ }
+
+ public function getMonitorTabView():MonitorTabView{
+ return monitorTabView;
+ }
+
+ /**
+ * Overrides method in abstract view to ensure correct 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{
+ return monitorLesson_scp;
+ }
+ public function getMonitorSequenceScp():MovieClip{
+ return monitorSequence_scp;
+ }
+ public function getMonitorLearnerScp():ScrollPane{
+ return monitorLearner_scp;
+ }
+
+ public function getLearnerIndexPanel():MovieClip {
+ return learnerIndexView_mc;
+ }
+
+ /*
+ * 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/LearnerIndexView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerIndexView.as (.../LearnerIndexView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerIndexView.as (.../LearnerIndexView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -32,64 +32,64 @@
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.authoring.cv.CanvasActivity;
import org.lamsfoundation.lams.common.Sequence;
import org.lamsfoundation.lams.common.ToolTip;
-import org.lamsfoundation.lams.authoring.Transition;
-
+import org.lamsfoundation.lams.authoring.Transition;
+
import mx.managers.*;
import mx.containers.*;
import mx.events.*;
import mx.utils.*;
import mx.controls.*;
-
-/**
- * Page index panel when LearnerTabView is active
- * @author Daniel Carlier
+
+/**
+ * Page index panel when LearnerTabView is active
+ * @author Daniel Carlier
*/
class org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerIndexView extends AbstractView {
public static var _tabID:Number = 2;
private var _className = "LearnerIndexView";
-
- private var _bgPanel:MovieClip;
+
+ private var _bgPanel:MovieClip;
private var _tm:ThemeManager;
private var _tip:ToolTip;
- private var mm:MonitorModel;
-
- //IndexButton
- private var _indexButton:IndexButton;
- private var _indexButton_mc:MovieClip;
- private var _buttonsPanel_mc:MovieClip;
+ private var mm:MonitorModel;
+
+ //IndexButton
+ private var _indexButton:IndexButton;
+ private var _indexButton_mc:MovieClip;
+ private var _buttonsPanel_mc:MovieClip;
private var displayedButtons:Array;
private var dispatchEvent:Function;
- public var addEventListener:Function;
- public var removeEventListener:Function;
-
- private var nextPosition:Number;
- private var btnWidth:Number;
-
- private var backBtn:MovieClip;
- private var nextBtn:MovieClip;
- private var goBtn:MovieClip;
- private var indexViewBtn:MovieClip;
- private var textFieldBackground_mc:MovieClip;
- private var labelBackground_mc:MovieClip;
- private var idxTextField:TextField;
- private var _textFieldContents:String;
- private var defaultString:String;
- private var rangeLabel;
- private var btnSpacing:Number;
- private var txtFieldSpacing:Number;
- private var untranslatedWidth:Number;
- private var fontWidthVariance:Number;
-
- private var buttonsShown:Boolean;
+ public var addEventListener:Function;
+ public var removeEventListener:Function;
+
+ private var nextPosition:Number;
+ private var btnWidth:Number;
+
+ private var backBtn:MovieClip;
+ private var nextBtn:MovieClip;
+ private var goBtn:MovieClip;
+ private var indexViewBtn:MovieClip;
+ private var textFieldBackground_mc:MovieClip;
+ private var labelBackground_mc:MovieClip;
+ private var idxTextField:TextField;
+ private var _textFieldContents:String;
+ private var defaultString:String;
+ private var rangeLabel;
+ private var btnSpacing:Number;
+ private var txtFieldSpacing:Number;
+ private var untranslatedWidth:Number;
+ private var fontWidthVariance:Number;
+
+ private var buttonsShown:Boolean;
private var navigationButtonsDrawn:Boolean;
-
+
private var direction:String;
/**
@@ -98,40 +98,40 @@
function LearnerIndexView(){
Debugger.log("LearnerIndexView Constructor", Debugger.CRITICAL, "LearnerIndexView", "LearnerIndexView");
_tm = ThemeManager.getInstance();
- _tip = new ToolTip();
-
- nextPosition = 0;
- btnWidth = 40;
- btnSpacing = 20;
- txtFieldSpacing = 5;
- fontWidthVariance = 1.15; // Tahoma font requires greater width
+ _tip = new ToolTip();
+
+ nextPosition = 0;
+ btnWidth = 40;
+ btnSpacing = 20;
+ txtFieldSpacing = 5;
+ fontWidthVariance = 1.15; // Tahoma font requires greater width
buttonsShown = false;
- navigationButtonsDrawn = false;
- defaultString = Dictionary.getValue("mv_search_default_txt");
+ navigationButtonsDrawn = false;
+ defaultString = Dictionary.getValue("mv_search_default_txt");
untranslatedWidth = Math.ceil(StringUtils.getButtonWidthForStr('?') * fontWidthVariance);
- this._visible = false;
- displayedButtons = new Array();
+ this._visible = false;
+ displayedButtons = new Array();
//Init for event delegation
mx.events.EventDispatcher.initialize(this);
- }
-
- public function textFieldHasFocus() {
- Debugger.log("idxTextField.text: "+idxTextField.text, Debugger.CRITICAL, "textFieldHasFocus", "LearnerIndexView");
- if (idxTextField.text == defaultString) {
- idxTextField.text = "";
- }
- }
-
+ }
+
+ public function textFieldHasFocus() {
+ Debugger.log("idxTextField.text: "+idxTextField.text, Debugger.CRITICAL, "textFieldHasFocus", "LearnerIndexView");
+ if (idxTextField.text == defaultString) {
+ idxTextField.text = "";
+ }
+ }
+
public function init(m:Observable,c:Controller){
Debugger.log("LearnerIndexView init", Debugger.CRITICAL, "init", "LearnerIndexView");
//Invoke superconstructor, which sets up MVC relationships.
- super (m, c);
+ super (m, c);
- mm = MonitorModel(model)
- mm.learnerIndexView = this;
-
+ mm = MonitorModel(model)
+ mm.learnerIndexView = this;
+
MovieClipUtils.doLater(Proxy.create(this,draw));
}
@@ -141,295 +141,295 @@
switch (infoObj.updateType){
case 'TABCHANGE' :
- if (infoObj.tabID == _tabID && !mm.locked && mm.numIndexButtons>1) {
- mm.resetLearnerIndexBar();
- _textFieldContents = defaultString;
+ if (infoObj.tabID == _tabID && !mm.locked && mm.numIndexButtons>1) {
+ mm.resetLearnerIndexBar();
+ _textFieldContents = defaultString;
setupButtons(mm);
this._visible = true;
}else {
this._visible = false;
}
- break;
- case 'POSITION' :
- if (infoObj.tabID == _tabID && !mm.locked){
- setPosition(mm);
- }
- break;
- case 'SIZE' :
- if (infoObj.tabID == _tabID && !mm.locked){
- setSize(mm);
- }
- break;
- case 'DRAW_DESIGN' :
- if (infoObj.tabID == _tabID && !mm.locked && (mm.numIndexButtons>1 || mm.inSearchView)) {
- setStyles();
- mm.updateIndexButtons();
- setupButtons(mm);
- this._visible = true;
-
- }
- break;
- case 'DRAW_BUTTONS' : // this event is only fired when << or >> buttons clicked as it doesn't redraw learnertabview contents
- if (infoObj.tabID == _tabID && !mm.locked && mm.numIndexButtons>1) {
- if (!buttonsShown || (mm.numIndexButtons > displayedButtons.length)) {
- setStyles();
- setupButtons(mm); // this only renames the index buttons as drawbuttons equals false
- this._visible = true;
- }
- }
break;
+ case 'POSITION' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ setPosition(mm);
+ }
+ break;
+ case 'SIZE' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ setSize(mm);
+ }
+ break;
+ case 'DRAW_DESIGN' :
+ if (infoObj.tabID == _tabID && !mm.locked && (mm.numIndexButtons>1 || mm.inSearchView)) {
+ setStyles();
+ mm.updateIndexButtons();
+ setupButtons(mm);
+ this._visible = true;
+
+ }
+ break;
+ case 'DRAW_BUTTONS' : // this event is only fired when << or >> buttons clicked as it doesn't redraw learnertabview contents
+ if (infoObj.tabID == _tabID && !mm.locked && mm.numIndexButtons>1) {
+ if (!buttonsShown || (mm.numIndexButtons > displayedButtons.length)) {
+ setStyles();
+ setupButtons(mm); // this only renames the index buttons as drawbuttons equals false
+ this._visible = true;
+ }
+ }
+ break;
default :
Debugger.log('unknown update type :' + infoObj.updateType,Debugger.GEN,'update','org.lamsfoundation.lams.MonitorTabView');
}
- }
-
- private function draw(){
- setStyles();
- dispatchEvent({type:'load',target:this});
- }
-
- /**
- * Get the CSSStyleDeclaration objects for each component and apply them
- * directly to the instance
- */
- private function setStyles():Void{
- var styleObj = _tm.getStyleObject('IndexBar');
- var _bgPanelColor:Color = new Color(_bgPanel);
- drawOutline();
- }
-
- public function drawOutline():Void {
- var outline_mc = this.createEmptyMovieClip("outline_mc", _bgPanel.getNextHighestDepth());
- var outline = this['outline_mc'];
-
- outline.lineStyle(0, 0x000000, 100);
- outline.lineTo(10000, 0); // TODO: base this on mm.getSize().w or Stage._width instead of 10000
- outline.lineTo(10000, 20); // similarly
- outline.lineTo(0, 20);
- outline.lineTo(0, 0);
- }
-
- public function setupButtons(mm:MonitorModel):Void {
- rangeLabel.text = Dictionary.getValue('mv_search_current_page_lbl', [mm.currentLearnerIndex, mm.numIndexButtons]);
- Debugger.log("displayedButtons.length: "+displayedButtons.length, Debugger.CRITICAL, "setupButtons", "LearnerIndexView");
- if (!navigationButtonsDrawn && mm.numIndexButtons > displayedButtons.length && displayedButtons.length == mm.numPreferredIndexButtons)
- mm.drawIndexButtons = true;
-
- if ((displayedButtons.length > 0) && (mm.drawIndexButtons)) {
- removeButtons();
- }
-
- if (mm.drawIndexButtons) {
- _buttonsPanel_mc = this.createEmptyMovieClip("_buttonsPanel_mc", DepthManager.kTop);
- addRangeLabel(mm);
- addIndexTextField(mm);
- addGoButton(mm);
- if (mm.inSearchView) {
- addIndexViewButton(mm);
- }
- }
-
- if (mm.drawIndexButtons) {
- if (mm.numIndexButtons > mm.numPreferredIndexButtons) {
- addBackNavigationButton(mm);
- }
- }
-
- // if drawButtons = false, just rename labels
- addIndexButtons(mm);
-
- if (mm.drawIndexButtons) {
- if (mm.numIndexButtons > mm.numPreferredIndexButtons) {
- addForwardNavigationButton(mm);
- navigationButtonsDrawn = true;
- buttonsShown = true;
- direction = null;
- }
- }
-
- nextPosition = 0;
- }
-
- public function removeButtons(){
- Debugger.log("Removing Index Buttons", Debugger.GEN, "removeButtons", "LearnerIndexView");
-
- _buttonsPanel_mc.removeMovieClip(rangeLabel);
-
- //need to remove the text field from the background
- textFieldBackground_mc.removeMovieClip(idxTextField);
- _buttonsPanel_mc.removeMovieClip(textFieldBackground_mc);
-
- if (mm.numIndexButtons > mm.numPreferredIndexButtons)
- _buttonsPanel_mc.removeMovieClip(backBtn);
-
- while (displayedButtons.length != 0) {
- var idxBtn:MovieClip = MovieClip(displayedButtons.pop());
- _buttonsPanel_mc.removeMovieClip(idxBtn);
- }
-
- if (mm.numIndexButtons > mm.numPreferredIndexButtons) {
+ }
+
+ private function draw(){
+ setStyles();
+ dispatchEvent({type:'load',target:this});
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('IndexBar');
+ var _bgPanelColor:Color = new Color(_bgPanel);
+ drawOutline();
+ }
+
+ public function drawOutline():Void {
+ var outline_mc = this.createEmptyMovieClip("outline_mc", _bgPanel.getNextHighestDepth());
+ var outline = this['outline_mc'];
+
+ outline.lineStyle(0, 0x000000, 100);
+ outline.lineTo(10000, 0); // TODO: base this on mm.getSize().w or Stage._width instead of 10000
+ outline.lineTo(10000, 20); // similarly
+ outline.lineTo(0, 20);
+ outline.lineTo(0, 0);
+ }
+
+ public function setupButtons(mm:MonitorModel):Void {
+ rangeLabel.text = Dictionary.getValue('mv_search_current_page_lbl', [mm.currentLearnerIndex, mm.numIndexButtons]);
+ Debugger.log("displayedButtons.length: "+displayedButtons.length, Debugger.CRITICAL, "setupButtons", "LearnerIndexView");
+ if (!navigationButtonsDrawn && mm.numIndexButtons > displayedButtons.length && displayedButtons.length == mm.numPreferredIndexButtons)
+ mm.drawIndexButtons = true;
+
+ if ((displayedButtons.length > 0) && (mm.drawIndexButtons)) {
+ removeButtons();
+ }
+
+ if (mm.drawIndexButtons) {
+ _buttonsPanel_mc = this.createEmptyMovieClip("_buttonsPanel_mc", DepthManager.kTop);
+ addRangeLabel(mm);
+ addIndexTextField(mm);
+ addGoButton(mm);
+ if (mm.inSearchView) {
+ addIndexViewButton(mm);
+ }
+ }
+
+ if (mm.drawIndexButtons) {
+ if (mm.numIndexButtons > mm.numPreferredIndexButtons) {
+ addBackNavigationButton(mm);
+ }
+ }
+
+ // if drawButtons = false, just rename labels
+ addIndexButtons(mm);
+
+ if (mm.drawIndexButtons) {
+ if (mm.numIndexButtons > mm.numPreferredIndexButtons) {
+ addForwardNavigationButton(mm);
+ navigationButtonsDrawn = true;
+ buttonsShown = true;
+ direction = null;
+ }
+ }
+
+ nextPosition = 0;
+ }
+
+ public function removeButtons(){
+ Debugger.log("Removing Index Buttons", Debugger.GEN, "removeButtons", "LearnerIndexView");
+
+ _buttonsPanel_mc.removeMovieClip(rangeLabel);
+
+ //need to remove the text field from the background
+ textFieldBackground_mc.removeMovieClip(idxTextField);
+ _buttonsPanel_mc.removeMovieClip(textFieldBackground_mc);
+
+ if (mm.numIndexButtons > mm.numPreferredIndexButtons)
+ _buttonsPanel_mc.removeMovieClip(backBtn);
+
+ while (displayedButtons.length != 0) {
+ var idxBtn:MovieClip = MovieClip(displayedButtons.pop());
+ _buttonsPanel_mc.removeMovieClip(idxBtn);
+ }
+
+ if (mm.numIndexButtons > mm.numPreferredIndexButtons) {
_buttonsPanel_mc.removeMovieClip(nextBtn);
navigationButtonsDrawn = false;
- }
-
- _buttonsPanel_mc.removeMovieClip(goBtn);
- _buttonsPanel_mc.removeMovieClip(indexViewBtn);
- }
-
- private function addRangeLabel(mm:MonitorModel):Void {
- // Label that displays 'Page # of #'
- var idxLabel_mc:MovieClip = _buttonsPanel_mc.attachMovie("Label", "rangeLabel", _buttonsPanel_mc.getNextHighestDepth());
- rangeLabel = _buttonsPanel_mc["rangeLabel"];
-
- // style info
- var styleObj = _tm.getStyleObject('IndexButton');
- rangeLabel.setStyle('styleName', styleObj);
-
- rangeLabel._x = 0;
- rangeLabel.autoSize = "center"
- rangeLabel.text = Dictionary.getValue('mv_search_current_page_lbl', [mm.currentLearnerIndex, mm.numIndexButtons]);
- var generatedWidth:Number = Math.ceil(StringUtils.getButtonWidthForStr(String(rangeLabel.text)) * fontWidthVariance);
- rangeLabel._width = (generatedWidth <= untranslatedWidth) ? 90 : generatedWidth + btnSpacing;
-
- nextPosition += rangeLabel._width;
- }
+ }
+
+ _buttonsPanel_mc.removeMovieClip(goBtn);
+ _buttonsPanel_mc.removeMovieClip(indexViewBtn);
+ }
+ private function addRangeLabel(mm:MonitorModel):Void {
+ // Label that displays 'Page # of #'
+ var idxLabel_mc:MovieClip = _buttonsPanel_mc.attachMovie("Label", "rangeLabel", _buttonsPanel_mc.getNextHighestDepth());
+ rangeLabel = _buttonsPanel_mc["rangeLabel"];
+
+ // style info
+ var styleObj = _tm.getStyleObject('IndexButton');
+ rangeLabel.setStyle('styleName', styleObj);
+
+ rangeLabel._x = 0;
+ rangeLabel.autoSize = "center"
+ rangeLabel.text = Dictionary.getValue('mv_search_current_page_lbl', [mm.currentLearnerIndex, mm.numIndexButtons]);
+ var generatedWidth:Number = Math.ceil(StringUtils.getButtonWidthForStr(String(rangeLabel.text)) * fontWidthVariance);
+ rangeLabel._width = (generatedWidth <= untranslatedWidth) ? 90 : generatedWidth + btnSpacing;
+
+ nextPosition += rangeLabel._width;
+ }
+
private function addBackNavigationButton(mm:MonitorModel):Void {
- // add back navigation button
- var generatedWidth:Number = StringUtils.getButtonWidthForStr('<<');
+ // add back navigation button
+ var generatedWidth:Number = StringUtils.getButtonWidthForStr('<<');
var backIdxBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? btnWidth : generatedWidth + btnSpacing;
backBtn = _buttonsPanel_mc.attachMovie("IndexButton", "backBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: backIdxBtnWidth, _labelText: "<<"});
_indexButton = IndexButton(backBtn);
- _indexButton.init(mm, undefined);
+ _indexButton.init(mm, undefined);
_indexButton.btnType = "Previous";
backBtn._x = nextPosition;
nextPosition += (backIdxBtnWidth);
}
-
- private function addIndexButtons(mm:MonitorModel):Void {
- // The index buttons
- Debugger.log("mm.numIndexButtons: "+mm.numIndexButtons, Debugger.GEN, "addIndexButton", "LearnerIndexView");
- Debugger.log("mm.firstDisplayedIndexButton: "+mm.firstDisplayedIndexButton, Debugger.GEN, "addIndexButton", "LearnerIndexView");
- Debugger.log("mm.lastDisplayedIndexButton: "+mm.lastDisplayedIndexButton, Debugger.GEN, "addIndexButton", "LearnerIndexView");
- var count:Number = 0;
-
- if (mm.inSearchView && (mm.firstDisplayedIndexButton == mm.lastDisplayedIndexButton)) {
- // do nothing
- // won't draw numbered index buttons if in search view and there's only one page of results
- }
- else {
- for (var i=mm.firstDisplayedIndexButton; i<=mm.lastDisplayedIndexButton; i++) {
- if (mm.drawIndexButtons) {
- var idxBtn:MovieClip = _buttonsPanel_mc.attachMovie("IndexButton", "idxBtn"+i, _buttonsPanel_mc.getNextHighestDepth(), {_width: btnWidth, _labelText: String(i)});
- _indexButton = IndexButton(idxBtn);
- _indexButton.init(mm, undefined);
- _indexButton.btnType = "Numeric";
- displayedButtons.push(idxBtn);
- idxBtn._x = nextPosition;
- nextPosition += btnWidth;
- } else {
- _indexButton = IndexButton(displayedButtons[count]);
- displayedButtons[count].label = String(i);
- displayedButtons[count]._width = btnWidth;
- nextPosition += btnWidth;
- count++;
- }
- }
- }
- }
-
- private function addForwardNavigationButton(mm:MonitorModel):Void {
- var generatedWidth:Number = StringUtils.getButtonWidthForStr('>>');
- var forwardIdxBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? btnWidth : generatedWidth + btnSpacing;
- nextBtn = _buttonsPanel_mc.attachMovie("IndexButton", "nextBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: forwardIdxBtnWidth, _labelText: ">>"});
- _indexButton = IndexButton(nextBtn);
- _indexButton.init(mm, undefined);
- _indexButton.btnType = "Next";
- nextBtn._x = nextPosition;
- nextPosition += (forwardIdxBtnWidth);
- }
-
- private function addIndexTextField(mm:MonitorModel):Void {
-
- _buttonsPanel_mc.attachMovie("textFieldBackground", "textFieldBackground_mc", _buttonsPanel_mc.getNextHighestDepth(), {_x: nextPosition, _y: 0});
-
- var textFieldBackground = _buttonsPanel_mc["textFieldBackground_mc"];
-
- var textFieldColor:Color = new Color(textFieldBackground);
-
- var generatedWidth:Number = Math.round(StringUtils.getButtonWidthForStr(defaultString) * fontWidthVariance);
- textFieldBackground._width = (generatedWidth <= untranslatedWidth) ? 175 : generatedWidth + txtFieldSpacing;
-
- textFieldBackground.createTextField("idxTextField", textFieldBackground.getNextHighestDepth(), 0, 0, textFieldBackground._width, 20);
-
- idxTextField = textFieldBackground["idxTextField"];
-
- idxTextField._visible = true;
- idxTextField.enabled = true;
- idxTextField._editable = true;
- idxTextField.type = "input";
- idxTextField.autosize = "center"
-
- // style info
- var styleObj = _tm.getStyleObject('IndexTextField');
- var txtFmt:TextFormat = new TextFormat();
- txtFmt.font = styleObj.fontFamily;
- txtFmt.size = styleObj.fontSize;
- txtFmt.color = styleObj.color;
- idxTextField.setNewTextFormat(txtFmt);
-
- if (!mm.resetSearchTextField)
- idxTextField.text = (_textFieldContents == undefined) ? defaultString : _textFieldContents;
- else {
- idxTextField.text = defaultString;
- mm.resetSearchTextField = false;
- }
- nextPosition += idxTextField._width;
-
- idxTextField.onSetFocus = Delegate.create(this, textFieldHasFocus);
- }
-
- public function set textFieldContents(s:String) {
- _textFieldContents = s;
- }
-
- private function addGoButton(mm:MonitorModel):Void {
- var generatedWidth:Number = Math.ceil(StringUtils.getButtonWidthForStr(Dictionary.getValue('mv_search_go_btn_lbl')) * fontWidthVariance);
- var goBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? btnWidth : generatedWidth + btnSpacing;
- goBtn = _buttonsPanel_mc.attachMovie("IndexButton", "goBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: goBtnWidth, _labelText: Dictionary.getValue('mv_search_go_btn_lbl')});
- _indexButton = IndexButton(goBtn);
- _indexButton.init(mm, undefined);
- _indexButton.btnType = "Go";
- goBtn._x = nextPosition;
- nextPosition += (goBtnWidth);
- }
-
- private function addIndexViewButton(mm:MonitorModel):Void {
- var generatedWidth:Number = Math.round(StringUtils.getButtonWidthForStr(Dictionary.getValue('mv_search_index_view_btn_lbl')) * fontWidthVariance);
- var indexViewBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? 93 : generatedWidth + btnSpacing;
- indexViewBtn = _buttonsPanel_mc.attachMovie("IndexButton", "indexViewBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: indexViewBtnWidth, _labelText: Dictionary.getValue('mv_search_index_view_btn_lbl')});
- _indexButton = IndexButton(indexViewBtn);
- _indexButton.init(mm, undefined);
- _indexButton.btnType = "IndexView";
- indexViewBtn._x = nextPosition;
- Debugger.log("addIndexButton1_nextPosition: "+nextPosition, Debugger.CRITICAL, "addIndexButton", "LearnerIndexView");
- Debugger.log("addIndexButton1_indexViewBtnWidth: "+indexViewBtnWidth, Debugger.CRITICAL, "addIndexButton", "LearnerIndexView");
- nextPosition += indexViewBtnWidth;
- Debugger.log("addIndexButton2_nextPosition: "+nextPosition, Debugger.CRITICAL, "addIndexButton", "LearnerIndexView");
- nextPosition--;
- }
+
+ private function addIndexButtons(mm:MonitorModel):Void {
+ // The index buttons
+ Debugger.log("mm.numIndexButtons: "+mm.numIndexButtons, Debugger.GEN, "addIndexButton", "LearnerIndexView");
+ Debugger.log("mm.firstDisplayedIndexButton: "+mm.firstDisplayedIndexButton, Debugger.GEN, "addIndexButton", "LearnerIndexView");
+ Debugger.log("mm.lastDisplayedIndexButton: "+mm.lastDisplayedIndexButton, Debugger.GEN, "addIndexButton", "LearnerIndexView");
+ var count:Number = 0;
+ if (mm.inSearchView && (mm.firstDisplayedIndexButton == mm.lastDisplayedIndexButton)) {
+ // do nothing
+ // won't draw numbered index buttons if in search view and there's only one page of results
+ }
+ else {
+ for (var i=mm.firstDisplayedIndexButton; i<=mm.lastDisplayedIndexButton; i++) {
+ if (mm.drawIndexButtons) {
+ var idxBtn:MovieClip = _buttonsPanel_mc.attachMovie("IndexButton", "idxBtn"+i, _buttonsPanel_mc.getNextHighestDepth(), {_width: btnWidth, _labelText: String(i)});
+ _indexButton = IndexButton(idxBtn);
+ _indexButton.init(mm, undefined);
+ _indexButton.btnType = "Numeric";
+ displayedButtons.push(idxBtn);
+ idxBtn._x = nextPosition;
+ nextPosition += btnWidth;
+ } else {
+ _indexButton = IndexButton(displayedButtons[count]);
+ displayedButtons[count].label = String(i);
+ displayedButtons[count]._width = btnWidth;
+ nextPosition += btnWidth;
+ count++;
+ }
+ }
+ }
+ }
+
+ private function addForwardNavigationButton(mm:MonitorModel):Void {
+ var generatedWidth:Number = StringUtils.getButtonWidthForStr('>>');
+ var forwardIdxBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? btnWidth : generatedWidth + btnSpacing;
+ nextBtn = _buttonsPanel_mc.attachMovie("IndexButton", "nextBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: forwardIdxBtnWidth, _labelText: ">>"});
+ _indexButton = IndexButton(nextBtn);
+ _indexButton.init(mm, undefined);
+ _indexButton.btnType = "Next";
+ nextBtn._x = nextPosition;
+ nextPosition += (forwardIdxBtnWidth);
+ }
+
+ private function addIndexTextField(mm:MonitorModel):Void {
+
+ _buttonsPanel_mc.attachMovie("textFieldBackground", "textFieldBackground_mc", _buttonsPanel_mc.getNextHighestDepth(), {_x: nextPosition, _y: 0});
+
+ var textFieldBackground = _buttonsPanel_mc["textFieldBackground_mc"];
+
+ var textFieldColor:Color = new Color(textFieldBackground);
+
+ var generatedWidth:Number = Math.round(StringUtils.getButtonWidthForStr(defaultString) * fontWidthVariance);
+ textFieldBackground._width = (generatedWidth <= untranslatedWidth) ? 175 : generatedWidth + txtFieldSpacing;
+
+ textFieldBackground.createTextField("idxTextField", textFieldBackground.getNextHighestDepth(), 0, 0, textFieldBackground._width, 20);
+
+ idxTextField = textFieldBackground["idxTextField"];
+
+ idxTextField._visible = true;
+ idxTextField.enabled = true;
+ idxTextField._editable = true;
+ idxTextField.type = "input";
+ idxTextField.autosize = "center"
+
+ // style info
+ var styleObj = _tm.getStyleObject('IndexTextField');
+ var txtFmt:TextFormat = new TextFormat();
+ txtFmt.font = styleObj.fontFamily;
+ txtFmt.size = styleObj.fontSize;
+ txtFmt.color = styleObj.color;
+ idxTextField.setNewTextFormat(txtFmt);
+
+ if (!mm.resetSearchTextField)
+ idxTextField.text = (_textFieldContents == undefined) ? defaultString : _textFieldContents;
+ else {
+ idxTextField.text = defaultString;
+ mm.resetSearchTextField = false;
+ }
+ nextPosition += idxTextField._width;
+
+ idxTextField.onSetFocus = Delegate.create(this, textFieldHasFocus);
+ }
+
+ public function set textFieldContents(s:String) {
+ _textFieldContents = s;
+ }
+
+ private function addGoButton(mm:MonitorModel):Void {
+ var generatedWidth:Number = Math.ceil(StringUtils.getButtonWidthForStr(Dictionary.getValue('mv_search_go_btn_lbl')) * fontWidthVariance);
+ var goBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? btnWidth : generatedWidth + btnSpacing;
+ goBtn = _buttonsPanel_mc.attachMovie("IndexButton", "goBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: goBtnWidth, _labelText: Dictionary.getValue('mv_search_go_btn_lbl')});
+ _indexButton = IndexButton(goBtn);
+ _indexButton.init(mm, undefined);
+ _indexButton.btnType = "Go";
+ goBtn._x = nextPosition;
+ nextPosition += (goBtnWidth);
+ }
+
+ private function addIndexViewButton(mm:MonitorModel):Void {
+ var generatedWidth:Number = Math.round(StringUtils.getButtonWidthForStr(Dictionary.getValue('mv_search_index_view_btn_lbl')) * fontWidthVariance);
+ var indexViewBtnWidth:Number = (generatedWidth <= untranslatedWidth) ? 93 : generatedWidth + btnSpacing;
+ indexViewBtn = _buttonsPanel_mc.attachMovie("IndexButton", "indexViewBtn", _buttonsPanel_mc.getNextHighestDepth(), {_width: indexViewBtnWidth, _labelText: Dictionary.getValue('mv_search_index_view_btn_lbl')});
+ _indexButton = IndexButton(indexViewBtn);
+ _indexButton.init(mm, undefined);
+ _indexButton.btnType = "IndexView";
+ indexViewBtn._x = nextPosition;
+ Debugger.log("addIndexButton1_nextPosition: "+nextPosition, Debugger.CRITICAL, "addIndexButton", "LearnerIndexView");
+ Debugger.log("addIndexButton1_indexViewBtnWidth: "+indexViewBtnWidth, Debugger.CRITICAL, "addIndexButton", "LearnerIndexView");
+ nextPosition += indexViewBtnWidth;
+ Debugger.log("addIndexButton2_nextPosition: "+nextPosition, Debugger.CRITICAL, "addIndexButton", "LearnerIndexView");
+ nextPosition--;
+ }
+
private function setPosition(mm:MonitorModel):Void{
var p:Object = mm.getPosition();
this._x = p.x;
this._y = 0;
- }
-
- public function setSize(mm:MonitorModel):Void{
- var panelOffset:Number = mm.getSize().w/100;
- _bgPanel._width = Math.round(mm.getSize().w + panelOffset);
}
+
+ public function setSize(mm:MonitorModel):Void{
+ var panelOffset:Number = mm.getSize().w/100;
+ _bgPanel._width = Math.round(mm.getSize().w + panelOffset);
+ }
public function getController():MonitorController{
var c:Controller = super.getController();
@@ -443,17 +443,17 @@
public function getIndexView():MovieClip{
return this;
- }
-
- public function getRangeLabel():Label {
- return rangeLabel;
- }
-
- public function getIdxTextField():TextField {
- return idxTextField;
- }
-
- public function getIndexViewBtn():MovieClip {
- return indexViewBtn;
}
+
+ public function getRangeLabel():Label {
+ return rangeLabel;
+ }
+
+ public function getIdxTextField():TextField {
+ return idxTextField;
+ }
+
+ public function getIndexViewBtn():MovieClip {
+ return indexViewBtn;
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerTabView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerTabView.as (.../LearnerTabView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LearnerTabView.as (.../LearnerTabView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -28,13 +28,13 @@
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.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 org.lamsfoundation.lams.authoring.Transition;
import mx.managers.*;
import mx.containers.*;
@@ -48,10 +48,10 @@
* Reflects progress data of the learner class.
*/
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;
@@ -64,39 +64,39 @@
private var activeLearner:Number;
private var prevLearner:Number;
private var learnersDrawn:Number;
- private var learnerListArr:Array;
+ private var learnerListArr:Array;
- private var _tm:ThemeManager;
- private var _tip:ToolTip;
+ 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 _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 _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;
+ private var completed_mc:MovieClip;
+
+ private var refresh_btn:Button;
+ private var help_btn:Button;
private var panelLowered:Boolean;
-
- private var activitiesDrawn:Number;
- private var mostRowActivities:Number;
- private var drawCount:Number;
- private var maxCount:Number;
- private var evtArr:Array;
-
- private var currentLearnerIndex:Number;
- private var maxLearnerIndex:Number;
- private var learnersDrawnIndex:Number;
-
- private var hAdjustment:Boolean;
+ private var activitiesDrawn:Number;
+ private var mostRowActivities:Number;
+ private var drawCount:Number;
+ private var maxCount:Number;
+ private var evtArr:Array;
+
+ private var currentLearnerIndex:Number;
+ private var maxLearnerIndex:Number;
+ private var learnersDrawnIndex:Number;
+
+ private var hAdjustment:Boolean;
+
//Defined so compiler can 'see' events added at runtime by EventDispatcher
private var dispatchEvent:Function;
public var addEventListener:Function;
@@ -108,8 +108,8 @@
function LearnerTabView(){
_learnerTabView = this;
_learnerTabViewContainer_mc = this;
- _tm = ThemeManager.getInstance();
- _tip = new ToolTip();
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
//Init for event delegation
mx.events.EventDispatcher.initialize(this);
@@ -121,19 +121,19 @@
public function init(m:Observable,c:Controller){
//Invoke superconstructor, which sets up MVC relationships.
super (m, c);
- mm = MonitorModel(model)
-
- learnerListArr = new Array();
- panelLowered = false;
- hAdjustment = false;
+ mm = MonitorModel(model)
+
+ learnerListArr = new Array();
+ panelLowered = false;
+ hAdjustment = false;
//Set up parameters for the grid
H_GAP = 10;
- V_GAP = 10;
-
- activitiesDrawn = 0;
- mostRowActivities = 0;
+ V_GAP = 10;
+ activitiesDrawn = 0;
+ mostRowActivities = 0;
+
MovieClipUtils.doLater(Proxy.create(this,draw));
mm.getMonitor().getMV().getMonitorLearnerScp()._visible = false;
}
@@ -154,128 +154,128 @@
case 'SIZE' :
setSize(mm);
break;
- case 'TABCHANGE' :
- if (infoObj.tabID == _tabID && !mm.locked){
- hideMainExp(mm);
- mm.broadcastViewUpdate("JOURNALSSHOWHIDE", true);
- adjustLearnerPanel(mm);
-
+ case 'TABCHANGE' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ hideMainExp(mm);
+ mm.broadcastViewUpdate("JOURNALSSHOWHIDE", true);
+ adjustLearnerPanel(mm);
+
if (mm.activitiesDisplayed.isEmpty()){
mm.getMonitor().openLearningDesign(mm.getSequence());
- } else if(mm.getIsProgressChangedLearner()) {
- reloadProgress(mm, false);
- } else {
- reloadProgress(mm, true);
- }
-
- mm.getMonitor().getMV().getMonitorLearnerScp()._visible = true;
- LFMenuBar.getInstance().setDefaults();
+ } else if(mm.getIsProgressChangedLearner()) {
+ reloadProgress(mm, false);
+ } else {
+ reloadProgress(mm, true);
+ }
- } else {
- if (mm.isDesignDrawn)
- clearCanvas(mm);
-
+ mm.getMonitor().getMV().getMonitorLearnerScp()._visible = true;
+ LFMenuBar.getInstance().setDefaults();
+
+ } else {
+ if (mm.isDesignDrawn)
+ clearCanvas(mm);
+
mm.getMonitor().getMV().getMonitorLearnerScp()._visible = false;
}
- break;
- case 'PROGRESS' :
- Debugger.log("Progress event received", Debugger.CRITICAL, "update", "LearnerTabView");
- if (infoObj.tabID == _tabID){
- if(!mm.locked){
- mm.getMonitor().getProgressData(mm.getSequence());
- } else {
- ApplicationParent.extCall("reloadWindow", null);
- }
- }
- break;
- case 'RELOADPROGRESS' :
- Debugger.log("Reload Progress event received", Debugger.CRITICAL, "update", "LearnerTabView");
- if (infoObj.tabID == _tabID && !mm.locked){
- reloadProgress(mm, true);
- }
+ break;
+ case 'PROGRESS' :
+ Debugger.log("Progress event received", Debugger.CRITICAL, "update", "LearnerTabView");
+ if (infoObj.tabID == _tabID){
+ if(!mm.locked){
+ mm.getMonitor().getProgressData(mm.getSequence());
+ } else {
+ ApplicationParent.extCall("reloadWindow", null);
+ }
+ }
+ break;
+ case 'RELOADPROGRESS' :
+ Debugger.log("Reload Progress event received", Debugger.CRITICAL, "update", "LearnerTabView");
+ if (infoObj.tabID == _tabID && !mm.locked){
+ reloadProgress(mm, true);
+ }
break;
case 'DRAW_ACTIVITY' :
- if (infoObj.tabID == _tabID && !mm.locked){
+ 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 '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' :
- Debugger.log("DRAW_DESIGN received",Debugger.CRITICAL,"update","LearnerTabView");
+ case 'DRAW_DESIGN' :
+ Debugger.log("DRAW_DESIGN received",Debugger.CRITICAL,"update","LearnerTabView");
adjustLearnerPanel(mm);
- if (infoObj.tabID == _tabID && !mm.locked){
- if (mm.isDesignDrawn) {
- clearCanvas(mm);
+ if (infoObj.tabID == _tabID && !mm.locked){
+ if (mm.isDesignDrawn) {
+ clearCanvas(mm);
}
drawAllLearnersDesign(mm, infoObj.tabID);
}
- break;
- case 'DRAW_ALL' :
- adjustLearnerPanel(mm);
- if (infoObj.tabID == _tabID && !mm.locked){
- evtArr = infoObj.data;
- drawAll();
- }
- setSize(mm);
break;
+ case 'DRAW_ALL' :
+ adjustLearnerPanel(mm);
+ if (infoObj.tabID == _tabID && !mm.locked){
+ evtArr = infoObj.data;
+ drawAll();
+ }
+ setSize(mm);
+ break;
default :
Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.LearnerTabView');
}
}
-
- private function drawAll(){
- drawCount = 0;
-
- maxCount = evtArr.length;
-
- Debugger.log("drawing all activities: " + maxCount, Debugger.CRITICAL, "drawAll", "LearnerTabView");
-
- drawNext();
- }
-
- public function drawNext():Void {
- if(drawCount < maxCount) {
- Debugger.log("drawing: " + evtArr[drawCount].updateType, Debugger.CRITICAL, "drawNext", "LearnerTabView");
- activitiesDrawn++;
- update(mm, evtArr[drawCount])
- setSize(mm);
- } else {
- activitiesDrawn = 0;
- drawNextLearner();
-
- return;
- }
-
- drawCount++;
- }
+ private function drawAll(){
+ drawCount = 0;
+
+ maxCount = evtArr.length;
+
+ Debugger.log("drawing all activities: " + maxCount, Debugger.CRITICAL, "drawAll", "LearnerTabView");
+
+ drawNext();
+ }
+
+ public function drawNext():Void {
+ if(drawCount < maxCount) {
+ Debugger.log("drawing: " + evtArr[drawCount].updateType, Debugger.CRITICAL, "drawNext", "LearnerTabView");
+ activitiesDrawn++;
+ update(mm, evtArr[drawCount])
+ setSize(mm);
+ } else {
+ activitiesDrawn = 0;
+ drawNextLearner();
+
+ return;
+ }
+
+ drawCount++;
+ }
+
/**
* 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});
+ 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);
- }
-
+ }
+
+ private function hideMainExp(mm:MonitorModel):Void{
+ mm.broadcastViewUpdate("EXPORTSHOWHIDE", false);
+ mm.broadcastViewUpdate("EDITFLYSHOWHIDE", false);
+ }
+
/**
* Sets last selected Sequence
*/
@@ -289,124 +289,123 @@
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 1 && !panelLowered) {
- if (hAdjustment) {
- _scroll.setSize(s.w-_scroll._x, s.h - 20);
- hAdjustment = false;
- }
-
- _scroll._y += 20;
-
- panelLowered = true;
- }
- else if (mm.numIndexButtons <= 1 && !hAdjustment) {
- _scroll.setSize(s.w-_scroll._x, s.h);
- hAdjustment = true;
- }
-
- }
-
- public function clearCanvas(mm:MonitorModel, isChanged:Boolean):Void {
- Debugger.log("in clearCanvas", Debugger.CRITICAL, "clearCanvas", "LearnerTabView");
- learnersDrawn = 0;
- learnersDrawnIndex = 0;
-
- ACT_X = 0;
- ACT_Y = 35;
-
- if (learnerListArr == null || learnerListArr == undefined){
- learnerListArr = new Array();
- }
-
- this._activityLayer_mc.removeMovieClip();
- this._nameLayer_mc.removeMovieClip();
-
- this._nameLayer_mc = this.createEmptyMovieClip("_nameLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
- this._activityLayer_mc = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
-
- if (isChanged == false){
- mm.setIsProgressChangedLearner(false);
- mm.setIsProgressChangedSequence(true);
- } else {
- mm.setIsProgressChangedLesson(true);
- mm.setIsProgressChangedSequence(true);
- }
-
- mm.transitionsDisplayed.clear();
- mm.activitiesDisplayed.clear();
-
- mm.isDesignDrawn = false;
- }
- private function drawAllLearnersDesign(mm:MonitorModel, tabID:Number){
- activitiesDrawn = 0;
- var learnersPerPage:Number = mm.learnersPerPage;
- currentLearnerIndex = (mm.currentLearnerIndex-1)*learnersPerPage;
- maxLearnerIndex = (learnersPerPage*mm.currentLearnerIndex)-1;
- learnersDrawnIndex = 0;
-
- drawNextLearner();
- }
-
- private function drawNextLearner(){
- Debugger.log("drawing next learner: " + currentLearnerIndex, Debugger.CRITICAL, "drawNextLearner", "LearnerTabView")
-
- if(currentLearnerIndex <= maxLearnerIndex) {
- Debugger.log("learner progress: " + mm.allLearnersProgress[currentLearnerIndex], Debugger.CRITICAL, "drawNextLearner", "LearnerTabView")
-
- if (mm.allLearnersProgress[currentLearnerIndex] != undefined) {
- learnersDrawn = currentLearnerIndex+1;
-
- ACT_X = 0;
- ACT_Y = (learnersDrawnIndex*80)+35;
-
- learnersDrawnIndex++;
- mm.drawDesign(_tabID, mm.allLearnersProgress[currentLearnerIndex]);
- }
- } else {
- mm.isDesignDrawn = true;
+ /*
+ * Clear Method to clear movies from scrollpane
+ *
+ */
+ private function clearLearnersData(array:Array):Array{
+ if(array != null){
+ for (var i=0; i 1 && !panelLowered) {
+ if (hAdjustment) {
+ _scroll.setSize(s.w-_scroll._x, s.h - 20);
+ hAdjustment = false;
+ }
+
+ _scroll._y += 20;
+
+ panelLowered = true;
+ }
+ else if (mm.numIndexButtons <= 1 && !hAdjustment) {
+ _scroll.setSize(s.w-_scroll._x, s.h);
+ hAdjustment = true;
+ }
+
+ }
+
+ public function clearCanvas(mm:MonitorModel, isChanged:Boolean):Void {
+ Debugger.log("in clearCanvas", Debugger.CRITICAL, "clearCanvas", "LearnerTabView");
+ learnersDrawn = 0;
+ learnersDrawnIndex = 0;
+
+ ACT_X = 0;
+ ACT_Y = 35;
+
+ if (learnerListArr == null || learnerListArr == undefined){
+ learnerListArr = new Array();
}
-
- currentLearnerIndex++;
+ this._activityLayer_mc.removeMovieClip();
+ this._nameLayer_mc.removeMovieClip();
+
+ this._nameLayer_mc = this.createEmptyMovieClip("_nameLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
+ this._activityLayer_mc = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
+
+ if (isChanged == false){
+ mm.setIsProgressChangedLearner(false);
+ mm.setIsProgressChangedSequence(true);
+ } else {
+ mm.setIsProgressChangedLesson(true);
+ mm.setIsProgressChangedSequence(true);
+ }
+
+ mm.transitionsDisplayed.clear();
+ mm.activitiesDisplayed.clear();
+
+ mm.isDesignDrawn = false;
}
+ private function drawAllLearnersDesign(mm:MonitorModel, tabID:Number){
+ activitiesDrawn = 0;
+ var learnersPerPage:Number = mm.learnersPerPage;
+ currentLearnerIndex = (mm.currentLearnerIndex-1)*learnersPerPage;
+ maxLearnerIndex = (learnersPerPage*mm.currentLearnerIndex)-1;
+ learnersDrawnIndex = 0;
+
+ drawNextLearner();
+ }
+
+ private function drawNextLearner(){
+ Debugger.log("drawing next learner: " + currentLearnerIndex, Debugger.CRITICAL, "drawNextLearner", "LearnerTabView")
+
+ if(currentLearnerIndex <= maxLearnerIndex) {
+ Debugger.log("learner progress: " + mm.allLearnersProgress[currentLearnerIndex], Debugger.CRITICAL, "drawNextLearner", "LearnerTabView")
+
+ if (mm.allLearnersProgress[currentLearnerIndex] != undefined) {
+ learnersDrawn = currentLearnerIndex+1;
+
+ ACT_X = 0;
+ ACT_Y = (learnersDrawnIndex*80)+35;
+
+ learnersDrawnIndex++;
+ mm.drawDesign(_tabID, mm.allLearnersProgress[currentLearnerIndex]);
+ }
+ } else {
+ mm.isDesignDrawn = true;
+ }
+
+ currentLearnerIndex++;
+ }
+
/**
* Remove the activityies from screen on selection of new lesson
*
@@ -420,77 +419,77 @@
r.removeMovieClip();
var s:Boolean = (r==null) ? false : true;
- }
-
- private function printLearner(mm:MonitorModel, learner:Object){
- var z:Object = mm.getSize();
-
- var styleObj = _tm.getStyleObject('button');
- var EP_btn_label:String = Dictionary.getValue('learner_exportPortfolio_btn')
-
- var nameTextFormat = new TextFormat();
-
- var exp_url = _root.serverURL+"learning/exportWaitingPage.jsp?mode=learner&role=teacher&lessonID="+_root.lessonID+"&userID="+learner.getLearnerId();
-
- if(_nameLayer_mc["learnerName"+learner.getLearnerId()] != undefined) {
- _nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"].removeTextField();
- }
-
- _nameLayer_mc.createTextField("learnerName"+learner.getLearnerId(), _nameLayer_mc.getNextHighestDepth(), ACT_X+2, ACT_Y, z.w-22, 20);
-
- if(_nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"] != undefined) {
- _nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"].removeMovieClip();
- }
-
- _nameLayer_mc.attachMovie("Button", "learnerName"+learner.getLearnerId()+"_btn", _nameLayer_mc.getNextHighestDepth(),{label:EP_btn_label, _x:z.w-110, _y:ACT_Y+2, styleName:styleObj} )
-
- var learnerName_txt = _nameLayer_mc["learnerName"+learner.getLearnerId()];
- var learnerExp_btn = _nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"];
-
- learnerExp_btn.setSize(90, 17);
- learnerExp_btn.onRelease = function (){
- JsPopup.getInstance().launchPopupWindow(exp_url, 'ExportPortfolio', 410, 640, true, true, false, false, false);
- }
-
- learnerExp_btn.onRollOver = Proxy.create(this,this['showToolTip'], learnerExp_btn, "learner_exportPortfolio_btn_tooltip");
- learnerExp_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- var sLearner:mx.styles.CSSStyleDeclaration = _tm.getStyleObject("LTVLearnerText");
-
- nameTextFormat.bold = (sLearner.getStyle("fontWeight")=="bold") ? true : false;
- nameTextFormat.font = sLearner.getStyle("fontFamily");
- nameTextFormat.size = sLearner.getStyle("fontSize");
- learnerName_txt.border = (sLearner.getStyle("borderStyle") != "none") ? true : false;
- learnerName_txt.background = true;
- learnerName_txt.backgroundColor = sLearner.getStyle("backgroundColor");
- learnerName_txt.textColor = sLearner.getStyle("color");
- learnerName_txt.setNewTextFormat(nameTextFormat);
- learnerName_txt.selectable = false;
- learnerName_txt.text = "\t"+learner.getLearnerFirstName() + " "+learner.getLearnerLastName();
-
- var tempObj = new Object();
- tempObj.learnerName = learnerName_txt;
- tempObj.learnerButton = learnerExp_btn;
- learnerListArr.push(tempObj);
- Debugger.log("learnerListArr.length: "+learnerListArr.length, Debugger.GEN, "printLearner", "LearnerTabView");
- }
-
- public function showToolTip(btnObj, btnTT:String):Void{
- var scpWidth:Number = mm.getMonitor().getMV().getMonitorLearnerScp().width;
- var btnLabel = btnObj.label;
- var xpos:Number = scpWidth - 190;
- var Xpos = xpos;
- var Ypos = (Application.MONITOR_Y+ btnObj._y+btnObj.height)+5;
- var ttHolder = ApplicationParent.tooltip;
- var ttMessage = Dictionary.getValue(btnTT);
- _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos);
-
- }
-
- public function hideToolTip():Void{
- _tip.CloseToolTip();
- }
+ }
+ private function printLearner(mm:MonitorModel, learner:Object){
+ var z:Object = mm.getSize();
+
+ var styleObj = _tm.getStyleObject('button');
+ var EP_btn_label:String = Dictionary.getValue('learner_exportPortfolio_btn')
+
+ var nameTextFormat = new TextFormat();
+
+ var exp_url = _root.serverURL+"learning/exportWaitingPage.jsp?mode=learner&role=teacher&lessonID="+_root.lessonID+"&userID="+learner.getLearnerId();
+
+ if(_nameLayer_mc["learnerName"+learner.getLearnerId()] != undefined) {
+ _nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"].removeTextField();
+ }
+
+ _nameLayer_mc.createTextField("learnerName"+learner.getLearnerId(), _nameLayer_mc.getNextHighestDepth(), ACT_X+2, ACT_Y, z.w-22, 20);
+
+ if(_nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"] != undefined) {
+ _nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"].removeMovieClip();
+ }
+
+ _nameLayer_mc.attachMovie("Button", "learnerName"+learner.getLearnerId()+"_btn", _nameLayer_mc.getNextHighestDepth(),{label:EP_btn_label, _x:z.w-110, _y:ACT_Y+2, styleName:styleObj} )
+
+ var learnerName_txt = _nameLayer_mc["learnerName"+learner.getLearnerId()];
+ var learnerExp_btn = _nameLayer_mc["learnerName"+learner.getLearnerId()+"_btn"];
+
+ learnerExp_btn.setSize(90, 17);
+ learnerExp_btn.onRelease = function (){
+ JsPopup.getInstance().launchPopupWindow(exp_url, 'ExportPortfolio', 410, 640, true, true, false, false, false);
+ }
+
+ learnerExp_btn.onRollOver = Proxy.create(this,this['showToolTip'], learnerExp_btn, "learner_exportPortfolio_btn_tooltip");
+ learnerExp_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ var sLearner:mx.styles.CSSStyleDeclaration = _tm.getStyleObject("LTVLearnerText");
+
+ nameTextFormat.bold = (sLearner.getStyle("fontWeight")=="bold") ? true : false;
+ nameTextFormat.font = sLearner.getStyle("fontFamily");
+ nameTextFormat.size = sLearner.getStyle("fontSize");
+ learnerName_txt.border = (sLearner.getStyle("borderStyle") != "none") ? true : false;
+ learnerName_txt.background = true;
+ learnerName_txt.backgroundColor = sLearner.getStyle("backgroundColor");
+ learnerName_txt.textColor = sLearner.getStyle("color");
+ learnerName_txt.setNewTextFormat(nameTextFormat);
+ learnerName_txt.selectable = false;
+ learnerName_txt.text = "\t"+learner.getLearnerFirstName() + " "+learner.getLearnerLastName();
+
+ var tempObj = new Object();
+ tempObj.learnerName = learnerName_txt;
+ tempObj.learnerButton = learnerExp_btn;
+ learnerListArr.push(tempObj);
+ Debugger.log("learnerListArr.length: "+learnerListArr.length, Debugger.GEN, "printLearner", "LearnerTabView");
+ }
+
+ public function showToolTip(btnObj, btnTT:String):Void{
+ var scpWidth:Number = mm.getMonitor().getMV().getMonitorLearnerScp().width;
+ var btnLabel = btnObj.label;
+ var xpos:Number = scpWidth - 190;
+ var Xpos = xpos;
+ var Ypos = (Application.MONITOR_Y+ btnObj._y+btnObj.height)+5;
+ var ttHolder = ApplicationParent.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos);
+
+ }
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
/**
* Draws new activity to monitor tab view stage.
* @usage
@@ -499,129 +498,129 @@
* @return Boolean - successfullit
*/
private function drawActivity(a:Activity, mm:MonitorModel, learner:Object):Boolean{
-
- var ltv = LearnerTabView(this);
- var mc = getController();
- var newActivity_mc:MovieClip = null;
+ var ltv = LearnerTabView(this);
+ var mc = getController();
+ var newActivity_mc:MovieClip = null;
+
Debugger.log('The activity:'+a.title+','+a.activityTypeID+' is now be drawn',Debugger.CRITICAL,'drawActivity','LearnerTabView');
-
- if (ACT_X == 0) {
+
+ if (ACT_X == 0) {
printLearner(mm, learner);
- }
+ }
//take action depending on act type
- if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity()) {
- newActivity_mc = _activityLayer_mc.createChildAtDepth("LearnerActivity", _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
-
- ACT_X = newActivity_mc._x + newActivity_mc._width;
-
- } else if(a.isGateActivity()){
- var actLabel:String = gateTitle(a);
- newActivity_mc = _activityLayer_mc.createChildAtDepth("LearnerGateActivity", _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, actLabel:actLabel, learner:learner});
-
- ACT_X = newActivity_mc._x + newActivity_mc._width;
-
- } else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONS_WITH_SEQUENCES_TYPE || a.isBranchingActivity()){
+ if(a.activityTypeID==Activity.TOOL_ACTIVITY_TYPE || a.isGroupActivity()) {
+ newActivity_mc = _activityLayer_mc.createChildAtDepth("LearnerActivity", _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
+
+ ACT_X = newActivity_mc._x + newActivity_mc._width;
+
+ } else if(a.isGateActivity()){
+ var actLabel:String = gateTitle(a);
+ newActivity_mc = _activityLayer_mc.createChildAtDepth("LearnerGateActivity", _activityLayer_mc.getNextHighestDepth(),{_activity:a,_controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, actLabel:actLabel, learner:learner});
+
+ ACT_X = newActivity_mc._x + newActivity_mc._width;
+
+ } else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONS_WITH_SEQUENCES_TYPE || a.isBranchingActivity()){
var children:Array = mm.getMonitor().ddm.getComplexActivityChildren(a.activityUIID);
newActivity_mc = _activityLayer_mc.createChildAtDepth("LearnerComplexActivity", _activityLayer_mc.getNextHighestDepth(),{_activity:a,_children:children,_controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
-
- ACT_X = newActivity_mc._x + newActivity_mc._width;
-
+
+ ACT_X = newActivity_mc._x + newActivity_mc._width;
+
} else{
Debugger.log('The activity:'+a.title+','+a.activityUIID+' is of unknown type, it cannot be drawn',Debugger.CRITICAL,'drawActivity','LearnerTabView');
- }
-
- var actItems:Number = mm.activitiesDisplayed.size();
+ }
- if (actItems < mm.getActivityKeys().length)
+ var actItems:Number = mm.activitiesDisplayed.size();
+
+ if (actItems < mm.getActivityKeys().length)
mm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
-
+
return true;
- }
-
- /**
- * Create a clone of the Learning Design with the learner progress data applied to the cloned instance.
- *
- * @usage
- * @param learner Learner's progress data
- * @return
- */
-
- private function cloneActivity(a:Activity, mm:MonitorModel, learner:Object) {
- var ltv = LearnerTabView(this);
- var mc = getController();
-
- var mc_to_clone:MovieClip = MovieClip(mm.activitiesDisplayed.get(a.activityUIID));
- var _activityLayer_mc_clone:MovieClip = null;
-
- if (ACT_X == 0) {
- printLearner(mm, learner);
- }
-
- //take action depending on act type
- if(a.isGateActivity()){
- var actLabel:String = gateTitle(a);
- _activityLayer_mc_clone = ApplicationParent.cloneMovieClip(mc_to_clone, "_activityLayer_mc_clone_" + learner.getLearnerId() + "_" + a.activityUIID, _activityLayer_mc.getNextHighestDepth(), {_activity:a, _controller:mc, _view:ltv, _x:ACT_X, _y:ACT_Y+40, actLabel:actLabel, learner:learner});
- } else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE){
- var children:Array = mm.getMonitor().ddm.getComplexActivityChildren(a.activityUIID);
- _activityLayer_mc_clone = ApplicationParent.cloneMovieClip(mc_to_clone, "_activityLayer_mc_clone_" + learner.getLearnerId() + "_" + a.activityUIID, _activityLayer_mc.getNextHighestDepth(), {_activity:a, _children:children, _controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
- } else {
- _activityLayer_mc_clone = ApplicationParent.cloneMovieClip(mc_to_clone, "_activityLayer_mc_clone_" + learner.getLearnerId() + "_" + a.activityUIID, _activityLayer_mc.getNextHighestDepth(), {_activity:a, _controller:mc, _view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
- }
-
- ACT_X = (_activityLayer_mc_clone != null) ? _activityLayer_mc_clone._x + _activityLayer_mc_clone._width : 0;
-
- Debugger.log("_clone:" + _activityLayer_mc_clone + " xPOS=" + mc_to_clone._x + " yPOS=" + mc_to_clone._y + " _x=" + _activityLayer_mc_clone._x + " _y=" + _activityLayer_mc_clone._y, Debugger.CRITICAL, "cloneDesign", "LTV");
-
- }
-
+ }
+
/**
+ * Create a clone of the Learning Design with the learner progress data applied to the cloned instance.
+ *
+ * @usage
+ * @param learner Learner's progress data
+ * @return
+ */
+
+ private function cloneActivity(a:Activity, mm:MonitorModel, learner:Object) {
+ var ltv = LearnerTabView(this);
+ var mc = getController();
+
+ var mc_to_clone:MovieClip = MovieClip(mm.activitiesDisplayed.get(a.activityUIID));
+ var _activityLayer_mc_clone:MovieClip = null;
+
+ if (ACT_X == 0) {
+ printLearner(mm, learner);
+ }
+
+ //take action depending on act type
+ if(a.isGateActivity()){
+ var actLabel:String = gateTitle(a);
+ _activityLayer_mc_clone = ApplicationParent.cloneMovieClip(mc_to_clone, "_activityLayer_mc_clone_" + learner.getLearnerId() + "_" + a.activityUIID, _activityLayer_mc.getNextHighestDepth(), {_activity:a, _controller:mc, _view:ltv, _x:ACT_X, _y:ACT_Y+40, actLabel:actLabel, learner:learner});
+ } else if(a.activityTypeID==Activity.PARALLEL_ACTIVITY_TYPE || a.activityTypeID==Activity.OPTIONAL_ACTIVITY_TYPE){
+ var children:Array = mm.getMonitor().ddm.getComplexActivityChildren(a.activityUIID);
+ _activityLayer_mc_clone = ApplicationParent.cloneMovieClip(mc_to_clone, "_activityLayer_mc_clone_" + learner.getLearnerId() + "_" + a.activityUIID, _activityLayer_mc.getNextHighestDepth(), {_activity:a, _children:children, _controller:mc,_view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
+ } else {
+ _activityLayer_mc_clone = ApplicationParent.cloneMovieClip(mc_to_clone, "_activityLayer_mc_clone_" + learner.getLearnerId() + "_" + a.activityUIID, _activityLayer_mc.getNextHighestDepth(), {_activity:a, _controller:mc, _view:ltv, _x:ACT_X, _y:ACT_Y+40, learner:learner});
+ }
+
+ ACT_X = (_activityLayer_mc_clone != null) ? _activityLayer_mc_clone._x + _activityLayer_mc_clone._width : 0;
+
+ Debugger.log("_clone:" + _activityLayer_mc_clone + " xPOS=" + mc_to_clone._x + " yPOS=" + mc_to_clone._y + " _x=" + _activityLayer_mc_clone._x + " _y=" + _activityLayer_mc_clone._y, Debugger.CRITICAL, "cloneDesign", "LTV");
+
+ }
+
+ /**
* 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);
}
-
- private function gateTitle(a:Activity):String{
- var titleToReturn:String
- switch(String(a.activityTypeID)){
- case '3' :
- titleToReturn = "Synchronise Gate"
- return titleToReturn;
- break;
- case '4' :
- titleToReturn = "Schedule Gate"
- return titleToReturn;
- break;
- case '5' :
- titleToReturn = "Permission Gate"
- return titleToReturn;
- break;
- default:
- Debugger.log('not defined yet',Debugger.GEN,'drawActivity','LearnerTabView');
- }
+
+ private function gateTitle(a:Activity):String{
+ var titleToReturn:String
+ switch(String(a.activityTypeID)){
+ case '3' :
+ titleToReturn = "Synchronise Gate"
+ return titleToReturn;
+ break;
+ case '4' :
+ titleToReturn = "Schedule Gate"
+ return titleToReturn;
+ break;
+ case '5' :
+ titleToReturn = "Permission Gate"
+ return titleToReturn;
+ break;
+ default:
+ Debugger.log('not defined yet',Debugger.GEN,'drawActivity','LearnerTabView');
+ }
}
/**
* Sets the size of the canvas on stage, called from update
*/
private function setSize(mm:MonitorModel):Void{
- if (mostRowActivities < activitiesDrawn)
- mostRowActivities = activitiesDrawn;
-
- var scpWidth:Number = Math.max((mostRowActivities)*130 + 6, mm.getMonitor().getMV().getMonitorLearnerScp()._width);
+ if (mostRowActivities < activitiesDrawn)
+ mostRowActivities = activitiesDrawn;
+
+ var scpWidth:Number = Math.max((mostRowActivities)*130 + 6, mm.getMonitor().getMV().getMonitorLearnerScp()._width);
- var newWidth:Number = (_activityLayer_mc._width < scpWidth) ? scpWidth - 6 : _activityLayer_mc._width;
+ var newWidth:Number = (_activityLayer_mc._width < scpWidth) ? scpWidth - 6 : _activityLayer_mc._width;
for (var i=0; iVIEW_COMPETENCES_DIALOG update received", Debugger.CRITICAL, "update", "LessonTabView");
- _monitorController = getController();
- showCompetencesDialog(mm);
- break;
- case 'LEARNERS_LOADED' :
- _dialog.checkLearners(mm.organisation);
- break;
- case 'STAFF_LOADED' :
- _dialog.checkStaff(mm.organisation);
- break;
- case 'DRAW_DESIGN' :
- if (infoObj.tabID == _tabID && !mm.locked){
- populateLessonDetails();
- }
break;
+ case 'VM_DIALOG' :
+ _monitorController = getController();
+ showLearnersDialog(mm);
+ break;
+ case 'VIEW_COMPETENCES_DIALOG' :
+ Debugger.log("LessonTabView->VIEW_COMPETENCES_DIALOG update received", Debugger.CRITICAL, "update", "LessonTabView");
+ _monitorController = getController();
+ showCompetencesDialog(mm);
+ break;
+ case 'LEARNERS_LOADED' :
+ _dialog.checkLearners(mm.organisation);
+ break;
+ case 'STAFF_LOADED' :
+ _dialog.checkStaff(mm.organisation);
+ break;
+ case 'DRAW_DESIGN' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ populateLessonDetails();
+ }
+ break;
default :
Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.LessonTabView');
}
- }
-
- private function setupTab(){
- _monitorController = getController();
-
- editClass_btn.addEventListener("click", _monitorController);
- viewLearners_btn.addEventListener("click", _monitorController);
- schedule_btn.addEventListener("click", Delegate.create(this, scheduleLessonStart));
- start_btn.addEventListener("click", _monitorController);
- statusApply_btn.addEventListener("click", Proxy.create(this, changeStatus));
- learner_expp_cb.addEventListener("click", Delegate.create(this, toogleExpPortfolio));
- this.addEventListener("apply", Proxy.create(_monitorController, _monitorController.changeStatus));
-
- editClass_btn.onRollOver = Proxy.create(this,this['showToolTip'], editClass_btn, "ls_manage_editclass_btn_tooltip");
- editClass_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- viewLearners_btn.onRollOver = Proxy.create(this,this['showToolTip'], viewLearners_btn, "ls_manage_learners_btn_tooltip");
- viewLearners_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- schedule_btn.onRollOver = Proxy.create(this,this['showToolTip'], schedule_btn, "ls_manage_schedule_btn_tooltip");
- schedule_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- start_btn.onRollOver = Proxy.create(this,this['showToolTip'], start_btn, "ls_manage_start_btn_tooltip");
- start_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- statusApply_btn.onRollOver = Proxy.create(this,this['showToolTip'], statusApply_btn, "ls_manage_apply_btn_tooltip");
- statusApply_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- setScheduleDateRange();
-
- dispatchEvent({type:'load',target:this});
}
-
-
- private function setScheduleDateRange():Void{
-
- var mydate = new Date();
- var year = mydate.getFullYear();
- var month = mydate.getMonth();
- var date = mydate.getDate();
-
- Debugger.log('schedule date range starts from :'+date + "/" +month+ "/" +year,Debugger.CRITICAL,'setScheduleDateRange','org.lamsfoundation.lams.WizardView');
- scheduleDate_dt.selectableRange = {rangeStart: new Date(year, month, date)};
- }
-
+ private function setupTab(){
+ _monitorController = getController();
+
+ editClass_btn.addEventListener("click", _monitorController);
+ viewLearners_btn.addEventListener("click", _monitorController);
+ schedule_btn.addEventListener("click", Delegate.create(this, scheduleLessonStart));
+ start_btn.addEventListener("click", _monitorController);
+ statusApply_btn.addEventListener("click", Proxy.create(this, changeStatus));
+ learner_expp_cb.addEventListener("click", Delegate.create(this, toogleExpPortfolio));
+ this.addEventListener("apply", Proxy.create(_monitorController, _monitorController.changeStatus));
+
+ editClass_btn.onRollOver = Proxy.create(this,this['showToolTip'], editClass_btn, "ls_manage_editclass_btn_tooltip");
+ editClass_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ viewLearners_btn.onRollOver = Proxy.create(this,this['showToolTip'], viewLearners_btn, "ls_manage_learners_btn_tooltip");
+ viewLearners_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ schedule_btn.onRollOver = Proxy.create(this,this['showToolTip'], schedule_btn, "ls_manage_schedule_btn_tooltip");
+ schedule_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ start_btn.onRollOver = Proxy.create(this,this['showToolTip'], start_btn, "ls_manage_start_btn_tooltip");
+ start_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ statusApply_btn.onRollOver = Proxy.create(this,this['showToolTip'], statusApply_btn, "ls_manage_apply_btn_tooltip");
+ statusApply_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ setScheduleDateRange();
+
+ dispatchEvent({type:'load',target:this});
+ }
+
+
+ private function setScheduleDateRange():Void{
+
+ var mydate = new Date();
+ var year = mydate.getFullYear();
+ var month = mydate.getMonth();
+ var date = mydate.getDate();
+
+ Debugger.log('schedule date range starts from :'+date + "/" +month+ "/" +year,Debugger.CRITICAL,'setScheduleDateRange','org.lamsfoundation.lams.WizardView');
+ scheduleDate_dt.selectableRange = {rangeStart: new Date(year, month, date)};
+ }
+
+
private function hideMainExp(mm:MonitorModel):Void{
- mm.broadcastViewUpdate("EXPORTSHOWHIDE", false)
+ mm.broadcastViewUpdate("EXPORTSHOWHIDE", false)
mm.broadcastViewUpdate("EDITFLYSHOWHIDE", false);
}
-
- /**
- * 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){
-
- if (isChanged == false){
- mm.setIsProgressChangedLesson(false);
-
- }else {
- mm.setIsProgressChangedLearner(true);
- mm.setIsProgressChangedSequence(true)
- }
-
- mm.getMonitor().reloadLessonToMonitor();
- }
+
+ /**
+ * 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){
+
+ if (isChanged == false){
+ mm.setIsProgressChangedLesson(false);
+
+ }else {
+ mm.setIsProgressChangedLearner(true);
+ mm.setIsProgressChangedSequence(true)
+ }
+
+ mm.getMonitor().reloadLessonToMonitor();
+ }
/**
* layout visual elements on the canvas on initialisation
*/
- private function draw(){
+ private function draw(){
Debugger.log('Lesson Launch set in sysadmin :'+_root.lessonLaunch, Debugger.CRITICAL,'Draw','org.lamsfoundation.lams.LessonTabView');
listCount = 0;
-
- this.onEnterFrame = setupLabels;
+ this.onEnterFrame = setupLabels;
+
_monitorReqTask_mc = reqTasks_scp.content;
_monitorController = getController();
- startMsg_txt.visible = false;
- editLockMessage_txt.visible = false;
-
- var seq:Sequence = mm.getSequence();
-
- if (_root.lessonLaunch == "false" && isLessonLaunchChecked){
- rearrangeAll();
- isLessonLaunchChecked = false;
- }
+ startMsg_txt.visible = false;
+ editLockMessage_txt.visible = false;
+
+ var seq:Sequence = mm.getSequence();
- populateStatusList(seq.state);
- populateLessonDetails();
- enableEditClass(seq.state);
-
- var requestLessonID:Number = seq.ID;
-
+ if (_root.lessonLaunch == "false" && isLessonLaunchChecked){
+ rearrangeAll();
+ isLessonLaunchChecked = false;
+ }
+
+ populateStatusList(seq.state);
+ populateLessonDetails();
+ enableEditClass(seq.state);
+
+ var requestLessonID:Number = seq.ID;
+
if (mm.getSequence().ID == mm.getLastSelectedSequence().ID){
- if(mm.getToDos() == null){
- mm.getMonitor().getContributeActivities(mm.getSequence().ID);
- } else {
- populateContributeActivities();
- }
- }else{
- mm.getMonitor().getContributeActivities(mm.getSequence().ID);
- }
-
- setMenu();
- setStyles();
- mm.getMonitor().getMV().getMonitorLessonScp().redraw(true);
+ if(mm.getToDos() == null){
+ mm.getMonitor().getContributeActivities(mm.getSequence().ID);
+ } else {
+ populateContributeActivities();
+ }
+ }else{
+ mm.getMonitor().getContributeActivities(mm.getSequence().ID);
+ }
+ setMenu();
+ setStyles();
+ mm.getMonitor().getMV().getMonitorLessonScp().redraw(true);
+
}
-
- private function rearrangeAll():Void{
- learnerURL_lbl.visible = false;
- learnerURL_txt.visible = false;
- class_lbl._y = class_lbl._y - 30
- class_txt._y = class_txt._y - 30
- lessonManager._y = lessonManager._y - 30
- taskManager._y = taskManager._y - 30
-
- lessonManager_lbl._x = lessonManager._x + 2
- lessonManager_lbl._y = lessonManager._y
- taskManager_lbl._x = taskManager._x + 2
- taskManager_lbl._y = taskManager._y
-
- manageClass_lbl._y = manageClass_lbl._y - 30
- manageStatus_lbl._y = manageStatus_lbl._y - 30
- manageStart_lbl._y = manageStart_lbl._y - 30
- manageDate_lbl._y = manageDate_lbl._y - 30
- manageTime_lbl._y = manageTime_lbl._y - 30
- start_date_lbl._y = start_date_lbl._y - 30
- schedule_date_lbl._y = schedule_date_lbl._y - 30
- scheduleDate_dt._y = scheduleDate_dt._y - 30
- scheduleTime._y = scheduleTime._y - 30
- viewLearners_btn._y = viewLearners_btn._y - 30
- editClass_btn._y = editClass_btn._y - 30
- changeStatus_cmb._y = changeStatus_cmb._y - 30
- statusApply_btn._y = statusApply_btn._y - 30
- schedule_btn._y = schedule_btn._y - 30
- start_btn._y = start_btn._y - 30
- reqTasks_scp._y = reqTasks_scp._y - 30
- learner_expp_cb._y = learner_expp_cb._y - 30
- learner_expp_cb_lbl._y = learner_expp_cb_lbl._y - 30
- }
+ private function rearrangeAll():Void{
+ learnerURL_lbl.visible = false;
+ learnerURL_txt.visible = false;
+ class_lbl._y = class_lbl._y - 30
+ class_txt._y = class_txt._y - 30
+ lessonManager._y = lessonManager._y - 30
+ taskManager._y = taskManager._y - 30
+
+ lessonManager_lbl._x = lessonManager._x + 2
+ lessonManager_lbl._y = lessonManager._y
+ taskManager_lbl._x = taskManager._x + 2
+ taskManager_lbl._y = taskManager._y
+
+ manageClass_lbl._y = manageClass_lbl._y - 30
+ manageStatus_lbl._y = manageStatus_lbl._y - 30
+ manageStart_lbl._y = manageStart_lbl._y - 30
+ manageDate_lbl._y = manageDate_lbl._y - 30
+ manageTime_lbl._y = manageTime_lbl._y - 30
+ start_date_lbl._y = start_date_lbl._y - 30
+ schedule_date_lbl._y = schedule_date_lbl._y - 30
+ scheduleDate_dt._y = scheduleDate_dt._y - 30
+ scheduleTime._y = scheduleTime._y - 30
+ viewLearners_btn._y = viewLearners_btn._y - 30
+ editClass_btn._y = editClass_btn._y - 30
+ changeStatus_cmb._y = changeStatus_cmb._y - 30
+ statusApply_btn._y = statusApply_btn._y - 30
+ schedule_btn._y = schedule_btn._y - 30
+ start_btn._y = start_btn._y - 30
+ reqTasks_scp._y = reqTasks_scp._y - 30
+ learner_expp_cb._y = learner_expp_cb._y - 30
+ learner_expp_cb_lbl._y = learner_expp_cb_lbl._y - 30
+ }
+
/**
* Populate the lesson details from HashTable Sequence in MOnitorModel
*/
- private function populateLessonDetails():Void{
+ private function populateLessonDetails():Void{
- var s:Object = mm.getSequence();
- var limit:Number = 120;
-
- LSTitle_lbl.text = "" + s.name + "";
-
- var charCount:Array = StringUtils.scanString(String(s.description), "\n");
- LSDescription_txa.text = String(s.description);
-
+ var s:Object = mm.getSequence();
+ var limit:Number = 120;
+
+ LSTitle_lbl.text = "" + s.name + "";
+
+ var charCount:Array = StringUtils.scanString(String(s.description), "\n");
+ LSDescription_txa.text = String(s.description);
+
sessionStatus_txt.text = showStatus(s.state);
- numLearners_txt.text = String(s.noStartedLearners) + " " + Dictionary.getValue('ls_of_text')+" "+String(s.noPossibleLearners);
- learnerURL_txt.text = _root.serverURL+"launchlearner.do?lessonID="+_root.lessonID;
-
- class_txt.text = s.organisationName;
+ numLearners_txt.text = String(s.noStartedLearners) + " " + Dictionary.getValue('ls_of_text')+" "+String(s.noPossibleLearners);
+ learnerURL_txt.text = _root.serverURL+"launchlearner.do?lessonID="+_root.lessonID;
+
+ 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);
- changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_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_disable'), LessonTabView.DISABLE_CBI);
- changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_archive'), LessonTabView.ARCHIVE_CBI);
- changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_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);
- changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_CBI);
- break;
- case Sequence.REMOVED_STATE_ID :
- changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
- break;
- default : // started state
- 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);
- changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_CBI);
+ }
+
+ 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);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_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_disable'), LessonTabView.DISABLE_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_archive'), LessonTabView.ARCHIVE_CBI);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_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);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_CBI);
+ break;
+ case Sequence.REMOVED_STATE_ID :
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_manage_status_cmb'), LessonTabView.NULL_CBI);
+ break;
+ default : // started state
+ 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);
+ changeStatus_cmb.addItem(Dictionary.getValue('ls_status_cmb_remove'), LessonTabView.REMOVE_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;
-
- }
-
- public 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 schDT = getScheduleDateTime(scheduleDate_dt.selectedDate, scheduleTime.f_returnTime());
- if (!schDT.validTime){
- LFMessage.showMessageAlert(Dictionary.getValue('al_validation_schtime'), null, null);
- return;
- }else {
- mm.getMonitor().startLesson(true, _root.lessonID, schDT.dateTime);
- }
-
- }
-
+
}
-
+
+ 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;
+
+ }
+
+ public 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 schDT = getScheduleDateTime(scheduleDate_dt.selectedDate, scheduleTime.f_returnTime());
+ if (!schDT.validTime){
+ LFMessage.showMessageAlert(Dictionary.getValue('al_validation_schtime'), null, null);
+ return;
+ }else {
+ 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
-
- Debugger.log("ca._parentActivityID: " + ca._parentActivityID, Debugger.CRITICAL, "drawIsRequiredTasks", "LessonTabView");
-
- if (ca._parentActivityID == null){
- requiredTaskList[listCount].contributeActivity.text = " "+ca.title
- requiredTaskList[listCount].contributeActivity.backgroundColor = 0xD5E6FF;
- listCount++;
-
- } else {
- requiredTaskList[listCount].contributeActivity.text = "\t"+ca.title
- requiredTaskList[listCount].contributeActivity.backgroundColor = 0xF9F2DD;
- listCount++;
- }
- for(var i=0; i 0){
- // write child ca title (indented - x + 10 position)
- drawIsRequiredTasks(o.child, o.entries, x);
- }
- }
- }
-
- reqTasks_scp.redraw(true)
- }
-
- private function drawContributeActivity(o:Object, x:Number) {
- Debugger.log("it is a contribute activity", Debugger.CRITICAL, "drawContributeActivity", "LessonTabView");
- Debugger.log("o : " + requiredTaskList[listCount-1]._o , Debugger.CRITICAL, "drawContributeActivity", "LessonTabView");
- Debugger.log("equals : " + (requiredTaskList[listCount-1]._o == o) , Debugger.CRITICAL, "drawContributeActivity", "LessonTabView");
-
- if(requiredTaskList[listCount-1]._o == o) return;
-
- // normal CA entries
- requiredTaskList[listCount] =_monitorReqTask_mc.attachMovie("contributeEntryRow", "contributeEntryRow"+listCount, this._monitorReqTask_mc.getNextHighestDepth(), {_x:x, _y:19*listCount, buttonLabel:btnLabel, _o:o})
- reqTasks_scp.redraw(true);
-
- requiredTaskList[listCount].contributeEntry.text = "\t\t"+mm.getMonitor().getCELiteral(o._contributionType);
- requiredTaskList[listCount].goContribute._x = reqTasks_scp._width-50
-
- requiredTaskList[listCount].goContribute.onRelease = function (){
- JsPopup.getInstance().launchPopupWindow(o.taskURL, 'ContributeActivity', 600, 800, true, true, false, false, false);
- }
-
- requiredTaskList[listCount].goContribute.onRollOver = Proxy.create(this,this['showToolTip'], requiredTaskList[listCount].goContribute, "goContribute_btn_tooltip", reqTasks_scp._y+requiredTaskList[listCount]._y+requiredTaskList[listCount]._height, reqTasks_scp._x);
- requiredTaskList[listCount].goContribute.onRollOut = Proxy.create(this,this['hideToolTip']);
-
- var styleObj = _tm.getStyleObject('button');
- requiredTaskList[listCount].goContribute.setStyle('styleName',styleObj);
-
- listCount++;
- }
/**
+ * Return isRequired entries
+ *
+ * @usage
+ * @param ca ContributeActivity
+ * @return Array of isRequired entries
+ */
+
+ private function getEntries(ca:Object):Array{
+ var array:Array = new Array();
+
+ 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
+
+ Debugger.log("ca._parentActivityID: " + ca._parentActivityID, Debugger.CRITICAL, "drawIsRequiredTasks", "LessonTabView");
+ Debugger.log("ca.title: " + ca.title, Debugger.MED, "drawIsRequiredTasks", "LessonTabView");
+
+ if (ca._parentActivityID == null){
+ requiredTaskList[listCount].contributeActivity.text = " " + ca.title;
+ requiredTaskList[listCount].contributeActivity.backgroundColor = 0xD5E6FF;
+ listCount++;
+
+ } else {
+ requiredTaskList[listCount].contributeActivity.text = "\t" + ca.title;
+ requiredTaskList[listCount].contributeActivity.backgroundColor = 0xF9F2DD;
+ listCount++;
+ }
+ for(var i=0; i 0){
+ // write child ca title (indented - x + 10 position)
+ drawIsRequiredTasks(o.child, o.entries, x);
+ }
+ }
+ }
+
+ reqTasks_scp.redraw(true)
+ }
+
+ private function drawContributeActivity(o:Object, x:Number) {
+ Debugger.log("it is a contribute activity", Debugger.CRITICAL, "drawContributeActivity", "LessonTabView");
+ Debugger.log("o : " + requiredTaskList[listCount-1]._o , Debugger.CRITICAL, "drawContributeActivity", "LessonTabView");
+ Debugger.log("equals : " + (requiredTaskList[listCount-1]._o == o) , Debugger.CRITICAL, "drawContributeActivity", "LessonTabView");
+
+ if(requiredTaskList[listCount-1]._o == o) return;
+
+ // normal CA entries
+ requiredTaskList[listCount] =_monitorReqTask_mc.attachMovie("contributeEntryRow", "contributeEntryRow"+listCount, this._monitorReqTask_mc.getNextHighestDepth(), {_x:x, _y:19*listCount, buttonLabel:btnLabel, _o:o})
+ reqTasks_scp.redraw(true);
+
+ requiredTaskList[listCount].contributeEntry.text = "\t\t"+mm.getMonitor().getCELiteral(o._contributionType);
+ requiredTaskList[listCount].goContribute._x = reqTasks_scp._width-50
+
+ Debugger.log("contributeEntry.text: " + requiredTaskList[listCount].contributeEntry.text , Debugger.MED, "drawContributeActivity", "LessonTabView");
+
+ requiredTaskList[listCount].goContribute.onRelease = function (){
+ JsPopup.getInstance().launchPopupWindow(o.taskURL, 'ContributeActivity', 600, 800, true, true, false, false, false);
+ }
+
+ requiredTaskList[listCount].goContribute.onRollOver = Proxy.create(this,this['showToolTip'], requiredTaskList[listCount].goContribute, "goContribute_btn_tooltip", reqTasks_scp._y+requiredTaskList[listCount]._y+requiredTaskList[listCount]._height, reqTasks_scp._x);
+ requiredTaskList[listCount].goContribute.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ var styleObj = _tm.getStyleObject('button');
+ requiredTaskList[listCount].goContribute.setStyle('styleName',styleObj);
+
+ listCount++;
+ }
+
+ /**
* Opens the lesson manager dialog
*/
public function showLessonManagerDialog(mm:MonitorModel) {
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) {
- 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));
-
- }
-
-
- /**
- * Opens the view competences dialog
- */
- public function showCompetencesDialog(mm:MonitorModel) {
- var opendialog:MovieClip = PopUpManager.createPopUp(mm.getMonitor().root, LFWindow, false,{title:"View Competences",closeButton:true,scrollContentPath:'viewCompetencesDialog'});
- opendialog.addEventListener('contentLoaded',Delegate.create(_monitorController,testFunction));
- }
-
- public function testFunction():Void {
- Debugger.log("testFunction invoked, therefore content has been loaded", Debugger.CRITICAL, "testFunction", "LessonTabView");
- }
/**
+ * Opens the lesson manager dialog
+ */
+ public function showLearnersDialog(mm:MonitorModel) {
+ 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));
+
+ }
+
+
+ /**
+ * Opens the view competences dialog
+ */
+ public function showCompetencesDialog(mm:MonitorModel) {
+ var opendialog:MovieClip = PopUpManager.createPopUp(mm.getMonitor().root, LFWindow, false,{title:"View Competences",closeButton:true,scrollContentPath:'viewCompetencesDialog'});
+ opendialog.addEventListener('contentLoaded',Delegate.create(_monitorController,testFunction));
+ }
+
+ public function testFunction():Void {
+ Debugger.log("testFunction invoked, therefore content has been loaded", Debugger.CRITICAL, "testFunction", "LessonTabView");
+ }
+
+ /**
*
* @usage
* @param newworkspaceDialog
@@ -735,272 +738,272 @@
public function get dialog ():MovieClip {
return _dialog;
}
-
- public function showToolTip(btnObj, btnTT:String, goBtnYpos:Number, goBtnXpos:Number):Void{
- var ttData = mm.getTTData();
-
- 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(){
-
- //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');
-
- 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 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);
-
- 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);
-
- //BlueTextArea
- styleObj = _tm.getStyleObject('BlueTextArea');
- LSDescription_txa.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();
-
- 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();
-
- 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;
- }
-
- 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;
- }
- }
+ public function showToolTip(btnObj, btnTT:String, goBtnYpos:Number, goBtnXpos:Number):Void{
+ var ttData = mm.getTTData();
+
+ 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(){
+
+ //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');
+
+ 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 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);
+
+ 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);
+
+ //BlueTextArea
+ styleObj = _tm.getStyleObject('BlueTextArea');
+ LSDescription_txa.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();
+
+ 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();
+
+ 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;
+ }
+
+ 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();
-
- lessonManager.setSize(s.w-20,lessonManager._height);
+
+ lessonManager.setSize(s.w-20,lessonManager._height);
taskManager.setSize(s.w-20,lessonManager._height);
-
- var scpHeight:Number = mm.getMonitor().getMV().getMonitorLessonScp()._height;
- reqTasks_scp.setSize(s.w-30,(scpHeight-reqTasks_scp._y)-20);
-
- for (var i=0; i "+finishedLearners+" of "+ totalLearners;
- }
-
- /**
- * Sets the position of the gate, called from update
- * @param cm Canvas model object
- */
- private function setPosition(mm:MonitorModel):Void{
- var p:Object = mm.getPosition();
-
- this._x = p.x;
- this._y = mm.getSize().h - 40.7;
- }
-
- /**
- * Get the CSSStyleDeclaration objects for each component and apply them
- * directly to the instance
- */
- private function setStyles():Void{
- var styleObj = _tm.getStyleObject('MHPanel');
- bg_pnl.setStyle('styleName',styleObj);
- styleObj = _tm.getStyleObject('BGPanel');
- bar_pnl.setStyle('styleName',styleObj);
- styleObj = _tm.getStyleObject('EndGatelabel');
- lessonEnd_lbl.setStyle('styleName',styleObj);
- }
-
- public function setSize(mm:MonitorModel):Void{
- var s:Object = mm.getSize();
-
- bg_pnl.setSize(s.w, bg_pnl.height);
- bar_pnl.setSize(s.w-20, bar_pnl.height);
- mm.endGate.tt_btn.setSize(s.w, bg_pnl.height);
- }
-
- /**
- * Overrides method in abstract view to ensure correct type of controller is returned
- * @usage
- * @return CanvasController
- */
- public function getController():MonitorController{
- var c:Controller = super.getController();
- return MonitorController(c);
- }
-
- /*
- * Returns the default controller for this view.
- */
- public function defaultController (model:Observable):Controller {
- return new MonitorController(model);
- }
-
- public function getEndGate():MovieClip{
- return this;
- }
+ if (infoObj.tabID == _tabID && !mm.locked){
+ this._visible = true;
+ }else {
+ this._visible = false;
+ }
+
+ break;
+ case 'DRAW_DESIGN' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+
+ setStyles();
+ setSize(mm);
+
+ showEndGateData(mm);
+ mm.drawDesign(infoObj.tabID);
+ }
+ break;
+ default :
+ Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorGateView');
+ }
+ }
+
+ /**
+ * layout visual elements on the MonitorTabView on initialisation
+ */
+ private function draw(){
+ _learnerContainer_mc = this.createEmptyMovieClip("_learnerContainer_mc", DepthManager.kTop);
+
+ var s:Object = mm.getSize();
+
+ mm.endGate = this;
+
+ mm.endGate.tt_btn.onRollOver = Proxy.create(this,this['showToolTip'], "finish_learner_tooltip");
+ mm.endGate.tt_btn.onRollOut = Proxy.create(this,this['hideToolTip']);
+
+ setStyles();
+
+ dispatchEvent({type:'load',target:this});
+ }
+
+ public function showToolTip(btnTT:String):Void{
+ var Xpos = this._x + 5;
+ var Ypos = this._y + this._height;
+ var ttHolder = ApplicationParent.tooltip;
+ var ttMessage = Dictionary.getValue(btnTT);
+ Debugger.log("ttMessage"+ttMessage, Debugger.CRITICAL);
+
+ //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 showEndGateData(mm:MonitorModel):Void{
+ var mc = getController();
+ var finishedLearners:Number = 0;
+ var totalLearners:Number = mm.allLearnersProgress.length;
+
+ doorClosed._visible = true;
+ finishedLearnersList = new Array();
+
+ for (var i=0; i "+finishedLearners+" of "+ totalLearners;
+ }
+
+ /**
+ * Sets the position of the gate, called from update
+ * @param cm Canvas model object
+ */
+ private function setPosition(mm:MonitorModel):Void{
+ var p:Object = mm.getPosition();
+
+ this._x = p.x;
+ this._y = mm.getSize().h - 40.7;
+ }
+
+ /**
+ * Get the CSSStyleDeclaration objects for each component and apply them
+ * directly to the instance
+ */
+ private function setStyles():Void{
+ var styleObj = _tm.getStyleObject('MHPanel');
+ bg_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('BGPanel');
+ bar_pnl.setStyle('styleName',styleObj);
+ styleObj = _tm.getStyleObject('EndGatelabel');
+ lessonEnd_lbl.setStyle('styleName',styleObj);
+ }
+
+ public function setSize(mm:MonitorModel):Void{
+ var s:Object = mm.getSize();
+
+ bg_pnl.setSize(s.w, bg_pnl.height);
+ bar_pnl.setSize(s.w-20, bar_pnl.height);
+ mm.endGate.tt_btn.setSize(s.w, bg_pnl.height);
+ }
+
+ /**
+ * Overrides method in abstract view to ensure correct type of controller is returned
+ * @usage
+ * @return CanvasController
+ */
+ public function getController():MonitorController{
+ var c:Controller = super.getController();
+ return MonitorController(c);
+ }
+
+ /*
+ * Returns the default controller for this view.
+ */
+ public function defaultController (model:Observable):Controller {
+ return new MonitorController(model);
+ }
+
+ public function getEndGate():MovieClip{
+ return this;
+ }
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/MonitorTabView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/MonitorTabView.as (.../MonitorTabView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/MonitorTabView.as (.../MonitorTabView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -24,20 +24,20 @@
import org.lamsfoundation.lams.common.util.*
import org.lamsfoundation.lams.common.ui.*
import org.lamsfoundation.lams.common.*
-import org.lamsfoundation.lams.common.style.*
-import org.lamsfoundation.lams.common.dict.*
-import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.mvc.*
import org.lamsfoundation.lams.monitoring.mv.*
import org.lamsfoundation.lams.monitoring.mv.tabviews.*;
-import org.lamsfoundation.lams.monitoring.*;
+import org.lamsfoundation.lams.monitoring.*;
import org.lamsfoundation.lams.authoring.Activity;
import org.lamsfoundation.lams.authoring.ComplexActivity;
-import org.lamsfoundation.lams.authoring.cv.CanvasActivity;
-import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
+import org.lamsfoundation.lams.authoring.cv.CanvasActivity;
+import org.lamsfoundation.lams.authoring.br.CanvasBranchView;
import org.lamsfoundation.lams.authoring.DesignDataModel;
-import org.lamsfoundation.lams.authoring.Transition;
+import org.lamsfoundation.lams.authoring.Transition;
import mx.managers.*
import mx.containers.*;
@@ -52,41 +52,41 @@
*/
class org.lamsfoundation.lams.monitoring.mv.tabviews.MonitorTabView extends CommonCanvasView {
-
- public static var _tabID:Number = 1;
- private var _className = "MonitorTabView";
-
- private var _tm:ThemeManager;
-
- private var mm:MonitorModel;
- private var _monitorTabView:MonitorTabView;
+ public static var _tabID:Number = 1;
+
+ private var _className = "MonitorTabView";
+
+ private var _tm:ThemeManager;
+
+ private var mm:MonitorModel;
+ private var _monitorTabView:MonitorTabView;
private var learner_X:Number = 22;
private var learner_Y:Number = 19;
-
+
private var drawDesignCalled:String;
-
+
private var finishedLearnersList:Array;
-
+
private var learnerMenuBar:MovieClip;
private var monitorTabs_tb:MovieClip;
- private var _monitorTabViewContainer_mc:MovieClip;
+ private var _monitorTabViewContainer_mc:MovieClip;
private var bkg_pnl:MovieClip;
- private var _learnerContainer_mc:MovieClip;
-
- private var orig_width:Number;
- private var orig_height:Number
- private var firstRun:Number;
+ private var _learnerContainer_mc:MovieClip;
+
+ private var orig_width:Number;
+ private var orig_height:Number
+ private var firstRun:Number;
/**
* Constructor
*/
function MonitorTabView(){
_monitorTabView = this;
- _monitorTabViewContainer_mc = this;
+ _monitorTabViewContainer_mc = this;
- _tm = ThemeManager.getInstance();
+ _tm = ThemeManager.getInstance();
//Init for event delegation
mx.events.EventDispatcher.initialize(this);
@@ -98,14 +98,14 @@
public function init(m:Observable,c:Controller){
//Invoke superconstructor, which sets up MVC relationships.
super (m, c);
- mm = MonitorModel(model);
+ mm = MonitorModel(model);
//Set up parameters for the grid
H_GAP = 10;
- V_GAP = 10;
-
- firstRun = 1;
-
+ V_GAP = 10;
+
+ firstRun = 1;
+
MovieClipUtils.doLater(Proxy.create(this,draw));
mm.getMonitor().getMV().getMonitorSequenceScp()._visible = false;
@@ -136,11 +136,11 @@
mm.getMonitor().getMV().getMonitorSequenceScp()._visible = true;
hideMainExp(mm);
mm.broadcastViewUpdate("JOURNALSSHOWHIDE", false);
-
+
if (mm.activitiesDisplayed.isEmpty() || mm.transitionsDisplayed.isEmpty()){
redrawCanvas(o.hasChanged());
mm.getMonitor().openLearningDesign(mm.getSequence());
- } else {
+ } else {
if (drawDesignCalled == undefined){
drawDesignCalled = "called";
@@ -150,21 +150,21 @@
if(mm.getIsProgressChangedSequence()){
reloadProgress(o.hasChanged(), mm);
}
- }
+ }
- LFMenuBar.getInstance().setDefaults();
- }
+ LFMenuBar.getInstance().setDefaults();
+ }
else {
mm.getMonitor().getMV().getMonitorSequenceScp()._visible = false;
- }
+ }
break;
case 'PROGRESS' :
if (infoObj.tabID == _tabID){
if(!mm.locked){
mm.getMonitor().getProgressData(mm.getSequence());
} else {
- ApplicationParent.extCall("reloadWindow", null);
+ ApplicationParent.extCall("reloadWindow", null);
}
}
break;
@@ -215,18 +215,18 @@
drawDesignCalled = "called";
mm.drawDesign(infoObj.tabID);
- }
+ }
- break;
- case 'DRAW_ALL' :
- if (infoObj.tabID == _tabID && !mm.locked){
- drawAll(infoObj.data, mm);
- }
- break;
- case 'SET_ACTIVE' :
- Debugger.log('setting active :' + infoObj.updateType + " event.data: " + infoObj.data + " condition: " + (infoObj.data == this),Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorTabView');
- transparentCover._visible = (infoObj.data == this) ? false : true;
break;
+ case 'DRAW_ALL' :
+ if (infoObj.tabID == _tabID && !mm.locked){
+ drawAll(infoObj.data, mm);
+ }
+ break;
+ case 'SET_ACTIVE' :
+ Debugger.log('setting active :' + infoObj.updateType + " event.data: " + infoObj.data + " condition: " + (infoObj.data == this),Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorTabView');
+ transparentCover._visible = (infoObj.data == this) ? false : true;
+ break;
default :
Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.MonitorTabView');
}
@@ -235,25 +235,25 @@
/**
* layout visual elements on the MonitorTabView on initialisation
*/
- private function draw(){
- content = this;
+ private function draw(){
+ content = this;
bkg_pnl = this.attachMovie("Panel", "bkg_pnl", this.getNextHighestDepth());
gridLayer = this.createEmptyMovieClip("_gridLayer_mc", this.getNextHighestDepth());
- transitionLayer = this.createEmptyMovieClip("_transitionLayer_mc", this.getNextHighestDepth());
+ transitionLayer = this.createEmptyMovieClip("_transitionLayer_mc", this.getNextHighestDepth());
activityLayer = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
-
- // creates learner icon on initial draw
- _learnerContainer_mc = this.createEmptyMovieClip("_learnerContainer_mc", this.getNextHighestDepth());
-
- transparentCover = this.attachMovie("Panel", "_transparentCover_mc", this.getNextHighestDepth(), {_visible: false, enabled: true, _alpha: 50});
- transparentCover.onPress = Proxy.create(this, onTransparentCoverClick);
-
- complexViewer = this.createEmptyMovieClip("_complex_viewer_mc", this.getNextHighestDepth());
- branchContent = this.createEmptyMovieClip("_branch_content_mc", DepthManager.kTopmost);
- var s:Object = mm.getSize();
+ // creates learner icon on initial draw
+ _learnerContainer_mc = this.createEmptyMovieClip("_learnerContainer_mc", this.getNextHighestDepth());
+
+ transparentCover = this.attachMovie("Panel", "_transparentCover_mc", this.getNextHighestDepth(), {_visible: false, enabled: true, _alpha: 50});
+ transparentCover.onPress = Proxy.create(this, onTransparentCoverClick);
+ complexViewer = this.createEmptyMovieClip("_complex_viewer_mc", this.getNextHighestDepth());
+ branchContent = this.createEmptyMovieClip("_branch_content_mc", DepthManager.kTopmost);
+
+ var s:Object = mm.getSize();
+
setStyles();
dispatchEvent({type:'load',target:this});
@@ -263,80 +263,80 @@
mm.broadcastViewUpdate("EXPORTSHOWHIDE", true);
mm.broadcastViewUpdate("EDITFLYSHOWHIDE", true);
}
-
- private function redrawCanvas(isChanged:Boolean):Void {
- var s:Object = mm.getSize();
- //var openBranchingActivity:Object = mm.currentBranchingActivity;
-
- drawDesignCalled = undefined;
-
- showAssets(true);
-
- mm.activeView = this;
- mm.currentBranchingActivity = null;
-
- //Remove all the movies drawn on the transition and activity movieclip holder
- this._learnerContainer_mc.removeMovieClip();
- this.transitionLayer.removeMovieClip();
- this.activityLayer.removeMovieClip();
- this.transparentCover.removeMovieClip();
-
- this.branchContent.removeMovieClip();
- this.complexViewer.removeMovieClip();
-
- //Recreate both Transition holder and Activity holder Movieclips
- transitionLayer = this.createEmptyMovieClip("_transitionLayer_mc", this.getNextHighestDepth());
- activityLayer = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
- _learnerContainer_mc = this.createEmptyMovieClip("_learnerContainer_mc", this.getNextHighestDepth());
-
- transparentCover = this.attachMovie("Panel", "_transparentCover_mc", this.getNextHighestDepth(), {_visible: false, enabled: true, _alpha: 50});
- transparentCover.onPress = Proxy.create(this, onTransparentCoverClick);
-
- complexViewer = this.createEmptyMovieClip("_complex_viewer_mc", this.getNextHighestDepth());
- branchContent = this.createEmptyMovieClip("_branch_content_mc", DepthManager.kTopmost);
-
- if (isChanged == false){
- mm.setIsProgressChangedSequence(false);
-
- } else {
- mm.setIsProgressChangedLesson(true);
- mm.setIsProgressChangedLearner(true);
- }
-
- mm.branchesDisplayed.clear();
- mm.transitionsDisplayed.clear();
- mm.activitiesDisplayed.clear();
-
- }
+ private function redrawCanvas(isChanged:Boolean):Void {
+ var s:Object = mm.getSize();
+ //var openBranchingActivity:Object = mm.currentBranchingActivity;
+
+ drawDesignCalled = undefined;
+
+ showAssets(true);
+
+ mm.activeView = this;
+ mm.currentBranchingActivity = null;
+
+ //Remove all the movies drawn on the transition and activity movieclip holder
+ this._learnerContainer_mc.removeMovieClip();
+ this.transitionLayer.removeMovieClip();
+ this.activityLayer.removeMovieClip();
+ this.transparentCover.removeMovieClip();
+
+ this.branchContent.removeMovieClip();
+ this.complexViewer.removeMovieClip();
+
+ //Recreate both Transition holder and Activity holder Movieclips
+ transitionLayer = this.createEmptyMovieClip("_transitionLayer_mc", this.getNextHighestDepth());
+ activityLayer = this.createEmptyMovieClip("_activityLayer_mc", this.getNextHighestDepth(),{_y:learnerMenuBar._height});
+ _learnerContainer_mc = this.createEmptyMovieClip("_learnerContainer_mc", this.getNextHighestDepth());
+
+ transparentCover = this.attachMovie("Panel", "_transparentCover_mc", this.getNextHighestDepth(), {_visible: false, enabled: true, _alpha: 50});
+ transparentCover.onPress = Proxy.create(this, onTransparentCoverClick);
+
+ complexViewer = this.createEmptyMovieClip("_complex_viewer_mc", this.getNextHighestDepth());
+ branchContent = this.createEmptyMovieClip("_branch_content_mc", DepthManager.kTopmost);
+
+ if (isChanged == false){
+ mm.setIsProgressChangedSequence(false);
+
+ } else {
+ mm.setIsProgressChangedLesson(true);
+ mm.setIsProgressChangedLearner(true);
+ }
+
+ mm.branchesDisplayed.clear();
+ mm.transitionsDisplayed.clear();
+ mm.activitiesDisplayed.clear();
+
+ }
+
/**
* 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){
-
- redrawCanvas(isChanged);
- mm.getMonitor().getProgressData(mm.getSequence());
+ private function reloadProgress(isChanged:Boolean){
+
+ redrawCanvas(isChanged);
+ mm.getMonitor().getProgressData(mm.getSequence());
}
-
- public function showAssets(v:Boolean) {
- this._learnerContainer_mc._visible = v;
- this.transitionLayer._visible = v;
- this.activityLayer._visible = v;
- }
+ public function showAssets(v:Boolean) {
+ this._learnerContainer_mc._visible = v;
+ this.transitionLayer._visible = v;
+ this.activityLayer._visible = v;
+ }
+
/**
* Remove the activityies from screen on selection of new lesson
*
* @usage
* @param activityUIID
* @return
*/
- private function removeActivity(a:Activity, mm:MonitorModel){
- if(!mm.isActiveView(this)) return false;
-
+ private function removeActivity(a:Activity, mm:MonitorModel){
+ if(!mm.isActiveView(this)) return false;
+
//dispatch an event to show the design has changed
var r = mm.activitiesDisplayed.remove(a.activityUIID);
r.removeMovieClip();
@@ -352,8 +352,8 @@
* @return
*/
private function removeTransition(t:Transition, mm:MonitorModel){
- if(!mm.isActiveView(this)) return false;
-
+ if(!mm.isActiveView(this)) return false;
+
var r = mm.transitionsDisplayed.remove(t.transitionUIID);
r.removeMovieClip();
var s:Boolean = (r==null) ? false : true;
@@ -371,9 +371,9 @@
var mtv = MonitorTabView(this);
var mc = getController();
var newActivity_mc = null;
-
- if(!mm.isActiveView(this)) return false;
+ if(!mm.isActiveView(this)) return false;
+
Debugger.log("activityTypeID: " + a.activityTypeID,Debugger.CRITICAL,'drawActivity','MonitorTabView');
//take action depending on act type
@@ -388,59 +388,59 @@
var children:Array = mm.getMonitor().ddm.getComplexActivityChildren(a.activityUIID);
newActivity_mc = activityLayer.createChildAtDepth("CanvasOptionalActivity", DepthManager.kTop, {_activity:a, _children:children, _monitorController:mc, _monitorTabView:mtv, fromModuleTab:"monitorMonitorTab", learnerContainer:_learnerContainer_mc});
} else if(a.isBranchingActivity()){
- a.branchView = null;
- newActivity_mc = activityLayer.createChildAtDepth("CanvasBranchingActivity", DepthManager.kBottom, {_activity:a,_monitorController:mc, _monitorView:mtv, _module:"monitoring", learnerContainer:_learnerContainer_mc, setupBranchView:false, showDiagram: true});
+ a.branchView = null;
+ newActivity_mc = activityLayer.createChildAtDepth("CanvasBranchingActivity", DepthManager.kBottom, {_activity:a,_monitorController:mc, _monitorView:mtv, _module:"monitoring", learnerContainer:_learnerContainer_mc, setupBranchView:false, showDiagram: true});
} 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){
- Debugger.log("adding to hashtable: " + newActivity_mc.activity.activityUIID, Debugger.CRITICAL, "drawActivity", "MonitorTabView");
+ if (actItems < mm.getActivityKeys().length && newActivity_mc != null){
+ Debugger.log("adding to hashtable: " + newActivity_mc.activity.activityUIID, Debugger.CRITICAL, "drawActivity", "MonitorTabView");
mm.activitiesDisplayed.put(a.activityUIID,newActivity_mc);
}
- mm.getMonitor().getMV().getMonitorSequenceScp().redraw(true);
-
+ mm.getMonitor().getMV().getMonitorSequenceScp().redraw(true);
+
return true;
- }
-
- private function drawAll(objArr:Array, mm:MonitorModel){
- for (var i=0; i span.x) {
- span.x = activitiesHash.get(activityKeys[i]).xCoord;
- }
- if (activitiesHash.get(activityKeys[i]).yCoord > span.y) {
- span.y = activitiesHash.get(activityKeys[i]).yCoord;
- }
- }
- return span;
- }
-
+ }
+
+ private function drawAll(objArr:Array, mm:MonitorModel){
+ for (var i=0; i span.x) {
+ span.x = activitiesHash.get(activityKeys[i]).xCoord;
+ }
+ if (activitiesHash.get(activityKeys[i]).yCoord > span.y) {
+ span.y = activitiesHash.get(activityKeys[i]).yCoord;
+ }
+ }
+ return span;
+ }
+
+ /**
* Add to canvas stage but keep hidden from view.
*
* @usage
@@ -472,20 +472,20 @@
private function drawTransition(t:Transition,mm:MonitorModel):Boolean{
var mtv = MonitorTabView(this);
var mc = getController();
-
- if(!isActivityOnLayer(mm.activitiesDisplayed.get(t.fromUIID), this.activityLayers) && !isActivityOnLayer(mm.activitiesDisplayed.get(t.toUIID), this.activityLayers)) return false;
- if(mm.transitionsDisplayed.containsKey(t.transitionUIID)) return false;
+
+ if(!isActivityOnLayer(mm.activitiesDisplayed.get(t.fromUIID), this.activityLayers) && !isActivityOnLayer(mm.activitiesDisplayed.get(t.toUIID), this.activityLayers)) return false;
+ if(mm.transitionsDisplayed.containsKey(t.transitionUIID)) return false;
var newTransition_mc:MovieClip = transitionLayer.createChildAtDepth("CanvasTransition",DepthManager.kTop,{_transition:t,_monitorController:mc,_monitorTabView:mtv});
- var trnsItems:Number = mm.transitionsDisplayed.size();
+ 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;
}
@@ -517,39 +517,39 @@
*/
private function setStyles():Void{
var styleObj = _tm.getStyleObject('CanvasPanel');
- bkg_pnl.setStyle('styleName',styleObj);
- transparentCover.setStyle('styleName', styleObj);
+ bkg_pnl.setStyle('styleName',styleObj);
+ transparentCover.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();
- var span:Object = getActivitySpan();
+ private function setSize(mm:MonitorModel):Void{
+
+ var s:Object = mm.getSize();
+ var span:Object = getActivitySpan();
- var vSpacing:Number = 100;
- var hSpacing:Number = 170;
-
- if (firstRun) {
- // Get original width/height as we want these values define the minimum size of the canvas
- orig_width = Math.max((span.x + hSpacing), s.w);
- orig_height = Math.max((span.y + vSpacing), s.h);
- firstRun = 0;
- }
-
- var cvWidth:Number = Math.max(Math.max(orig_width, span.x + hSpacing), s.w);
- var cvHeight:Number = Math.max(Math.max(orig_height, span.y + vSpacing), s.h);
-
- bkg_pnl.setSize(cvWidth, cvHeight);
- bkg_pnl.redraw(true);
-
- transparentCover.setSize(cvWidth, cvHeight);
-
- //Create the grid. The grid is re-drawn each time the canvas is resized.
- var grid_mc = Grid.drawGrid(gridLayer,Math.round(cvWidth),Math.round(cvHeight), V_GAP, H_GAP);
- gridLayer.redraw(true);
+ var vSpacing:Number = 100;
+ var hSpacing:Number = 170;
+
+ if (firstRun) {
+ // Get original width/height as we want these values define the minimum size of the canvas
+ orig_width = Math.max((span.x + hSpacing), s.w);
+ orig_height = Math.max((span.y + vSpacing), s.h);
+ firstRun = 0;
+ }
+
+ var cvWidth:Number = Math.max(Math.max(orig_width, span.x + hSpacing), s.w);
+ var cvHeight:Number = Math.max(Math.max(orig_height, span.y + vSpacing), s.h);
+
+ bkg_pnl.setSize(cvWidth, cvHeight);
+ bkg_pnl.redraw(true);
+
+ transparentCover.setSize(cvWidth, cvHeight);
+
+ //Create the grid. The grid is re-drawn each time the canvas is resized.
+ var grid_mc = Grid.drawGrid(gridLayer,Math.round(cvWidth),Math.round(cvHeight), V_GAP, H_GAP);
+ gridLayer.redraw(true);
mm.getMonitor().getMV().getMonitorSequenceScp().redraw(true);
}
@@ -561,16 +561,16 @@
var p:Object = mm.getPosition();
this._x = p.x;
this._y = p.y;
- }
-
- public function getLearnerIcon():MovieClip {
- return _learnerContainer_mc;
- }
-
- public function get ddm():DesignDataModel {
- return mm.getMonitor().ddm;
- }
-
+ }
+
+ public function getLearnerIcon():MovieClip {
+ return _learnerContainer_mc;
+ }
+
+ public function get ddm():DesignDataModel {
+ return mm.getMonitor().ddm;
+ }
+
/**
* Overrides method in abstract view to ensure cortect type of controller is returned
* @usage
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/TodoTabView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/TodoTabView.as (.../TodoTabView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/TodoTabView.as (.../TodoTabView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -44,28 +44,28 @@
class org.lamsfoundation.lams.monitoring.mv.tabviews.TodoTabView extends AbstractView{
public static var _tabID:Number = 3;
private var _className = "TodoTabView";
-
+
//constants:
private var _tm:ThemeManager;
- private var mm:MonitorModel;
- private var _dictionary:Dictionary;
+ private var mm:MonitorModel;
+ private var _dictionary:Dictionary;
- //TabView clips
- private var YPOS:Number = 70;
- private var listCount:Number = 0;
+ //TabView clips
+ private var YPOS:Number = 70;
+ private var listCount:Number = 0;
private var todoTaskList:Array = new Array();
private var _monitorTodoTask_mc:MovieClip;
- private var goContribute:Button;
- private var btnLabel:String;
-
- private var bkg_pnl:MovieClip;
+ private var goContribute:Button;
+ private var btnLabel:String;
+
+ private var bkg_pnl:MovieClip;
//Text Items
private var genralInfo_txt:TextField;
private var _todoTabView:TodoTabView;
private var _monitorController:MonitorController;
-
+
//Defined so compiler can 'see' events added at runtime by EventDispatcher
private var dispatchEvent:Function;
public var addEventListener:Function;
@@ -75,14 +75,14 @@
* Constructor
*/
function TodoTabView(){
- _todoTabView = this;
+ _todoTabView = this;
_monitorTodoTask_mc = this;
-
+
this._visible = false;
-
+
_tm = ThemeManager.getInstance();
-
- //Init for event delegation
+
+ //Init for event delegation
_dictionary = Dictionary.getInstance();
mx.events.EventDispatcher.initialize(this);
}
@@ -91,7 +91,7 @@
* Called to initialise Canvas . CAlled by the Canvas container
*/
public function init(m:Observable,c:Controller){
- super (m, c);
+ super (m, c);
btnLabel = Dictionary.getValue('td_goContribute_btn');
}
@@ -107,21 +107,21 @@
switch (infoObj.updateType){
case 'SIZE' :
setSize(mm);
- break;
- case 'POSITION' :
- setPosition(mm);
- break;
- case 'TODOS' :
- populateContributeActivities();
- break;
+ break;
+ case 'POSITION' :
+ setPosition(mm);
+ break;
+ case 'TODOS' :
+ populateContributeActivities();
+ break;
case 'TABCHANGE' :
if (infoObj.tabID == _tabID){
trace("TabID for Selected tab is (LessonTab TABCHANGE): "+infoObj.tabID)
- this._visible = true;
- hideMainExp(mm);
+ this._visible = true;
+ hideMainExp(mm);
//mm.setDirty();
- MovieClipUtils.doLater(Proxy.create(this,draw));
-
+ MovieClipUtils.doLater(Proxy.create(this,draw));
+
LFMenuBar.getInstance().setDefaults();
} else {
this._visible = false;
@@ -132,32 +132,32 @@
}
}
-
- private function hideMainExp(mm:MonitorModel):Void{
- mm.broadcastViewUpdate("EXPORTSHOWHIDE", false)
- }
+ private function hideMainExp(mm:MonitorModel):Void{
+ mm.broadcastViewUpdate("EXPORTSHOWHIDE", false)
+ }
+
/**
* layout visual elements on the canvas on initialisation
*/
private function draw(){
listCount = 0;
_monitorController = getController();
-
- populateLessonDetails();
-
+
+ populateLessonDetails();
+
if (mm.getSequence().getSequenceID() == mm.getLastSelectedSequence().getSequenceID()){
- if(mm.getToDos() == null){
- mm.getMonitor().getContributeActivities(mm.getSequence().getSequenceID());
- } else {
- populateContributeActivities();
- }
- }else{
- mm.getMonitor().getContributeActivities(mm.getSequence().getSequenceID());
- }
-
- setStyles();
+ if(mm.getToDos() == null){
+ mm.getMonitor().getContributeActivities(mm.getSequence().getSequenceID());
+ } else {
+ populateContributeActivities();
+ }
+ }else{
+ mm.getMonitor().getContributeActivities(mm.getSequence().getSequenceID());
+ }
+ setStyles();
+
dispatchEvent({type:'load',target:this});
}
@@ -169,129 +169,129 @@
var desc:String = "" + Dictionary.getValue('td_desc_heading') + "" + 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);
- }
- }
-
- 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){
- // 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);
- }
/**
+ * Return isRequired entries
+ *
+ * @usage
+ * @param ca ContributeActivity
+ * @return Array of isRequired entries
+ */
+ private function getEntries(ca:Object):Array{
+ var array:Array = new Array();
+
+ 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
+ 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){
+ // 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();
+ 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){
- clearInterval(_UILoadCheckIntervalID);
- start();
- }else {
- //If UI loaded check which events can be broadcast
- if(_UILoaded){
- //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'){
- switch (evt.target.className) {
- case 'Wizard' :
- _wizardLoaded = true;
- break;
- default:
- }
-
- _root.preloader.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 = _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
- _root.preloader.stop();
- _root._visible = true;
-
- 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(){
- }
-
- /**
- * 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{
- }
-
- public function copy():Void{
- }
-
- public function paste():Void{
- }
+
+ /**
+ * Main entry point to the application
+ */
+ public function main(container_mc:MovieClip){
+ _container_mc = container_mc;
+ _UILoaded = false;
+
+ _root.preloader.setStartValue(50);
+ _root.preloader.setEndValue(100);
+ _root.preloader.start(COMPONENT_NO);
+
+ _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));
+
+ //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()
+
+ _root.preloader.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,'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){
+ clearInterval(_UILoadCheckIntervalID);
+ start();
+ }else {
+ //If UI loaded check which events can be broadcast
+ if(_UILoaded){
+ //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'){
+ switch (evt.target.className) {
+ case 'Wizard' :
+ _wizardLoaded = true;
+ break;
+ default:
+ }
+
+ _root.preloader.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 = _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
+ _root.preloader.stop();
+ _root._visible = true;
+
+ 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'});
+ }
+ */
- public function get controlKeyPressed():String{
- return _controlKeyPressed;
+ /**
+ * 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(){
}
-
- 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
-
- }
- }
+
+ /**
+ * 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{
+ }
+
+ public function copy():Void{
+ }
+
+ public function paste():Void{
+ }
+
+ 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 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(){
- //the debug window:
- if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
- if (!_debugDialog.content){
- showDebugger();
- }else {
- hideDebugger();
- }
- }
- }
-}
+ /**
+ * 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(){
+ //the debug window:
+ if (Key.isDown(Key.CONTROL) && Key.isDown(Key.ALT) && Key.isDown(QUESTION_MARK_KEY)) {
+ if (!_debugDialog.content){
+ showDebugger();
+ }else {
+ hideDebugger();
+ }
+ }
+ }
+}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/Wizard.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/Wizard.as (.../Wizard.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/Wizard.as (.../Wizard.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,381 +1,381 @@
-/***************************************************************************
- * 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);
-
- 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){
- 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{
- // create root (dummy) node
- var odto = getDataObject(dto);
-
- wizardModel.initOrganisationTree();
- var rootNode:XMLNode = wizardModel.treeDP.addTreeNode(odto.name, odto);
-
- 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){
- 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;
- var enablePresence:Boolean = resultDTO.enablePresence;
- var enableIm:Boolean = resultDTO.enableIm;
-
- // get data object to send to servlet
- var data = DesignDataModel.getDataForInitializing(lessonName, lessonDesc, designId, orgId, learnerExpPortfolio, enablePresence, enableIm);
-
- trace(data.lessonName + data.enablePresence + data.enableIm);
- Debugger.log(data.lessonName + data.enablePresence + data.enableIm, Debugger.MED, "initializeLesson", "Wizard");
-
- // servlet call
- Application.getInstance().getComms().sendAndReceive(data, 'monitoring/initializeLesson', callback, false);
-
- }
-
- public function startLesson(isScheduled:Boolean, lessonID:Number, datetime:String){
- 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){
- if(b){
- wizardModel.broadcastViewUpdate("LESSON_STARTED", WizardView.FINISH_MODE);
- } else {
- // error occured
- }
- }
-
- /**
- * Create LessonClass using wizard data and CreateLessonClass servlet
- *
- */
-
- public function createLessonClass():Void{
- 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
- wizardModel.broadcastViewUpdate("SAVED_LC", wizardModel.resultDTO.mode);
- } else {
- // 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;
- }
+/***************************************************************************
+ * 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);
+
+ 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){
+ 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{
+ // create root (dummy) node
+ var odto = getDataObject(dto);
+
+ wizardModel.initOrganisationTree();
+ var rootNode:XMLNode = wizardModel.treeDP.addTreeNode(odto.name, odto);
+
+ 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){
+ 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;
+ var enablePresence:Boolean = resultDTO.enablePresence;
+ var enableIm:Boolean = resultDTO.enableIm;
+
+ // get data object to send to servlet
+ var data = DesignDataModel.getDataForInitializing(lessonName, lessonDesc, designId, orgId, learnerExpPortfolio, enablePresence, enableIm);
+
+ trace(data.lessonName + data.enablePresence + data.enableIm);
+ Debugger.log(data.lessonName + data.enablePresence + data.enableIm, Debugger.MED, "initializeLesson", "Wizard");
+
+ // servlet call
+ Application.getInstance().getComms().sendAndReceive(data, 'monitoring/initializeLesson', callback, false);
+
+ }
+
+ public function startLesson(isScheduled:Boolean, lessonID:Number, datetime:String){
+ 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){
+ if(b){
+ wizardModel.broadcastViewUpdate("LESSON_STARTED", WizardView.FINISH_MODE);
+ } else {
+ // error occured
+ }
+ }
+
+ /**
+ * Create LessonClass using wizard data and CreateLessonClass servlet
+ *
+ */
+
+ public function createLessonClass():Void{
+ 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
+ wizardModel.broadcastViewUpdate("SAVED_LC", wizardModel.resultDTO.mode);
+ } else {
+ // 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 -rc9c32e6dd572edaad6ed4e8eb39821ca20c0c26a -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as (.../WizardController.as) (revision c9c32e6dd572edaad6ed4e8eb39821ca20c0c26a)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as (.../WizardController.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -22,25 +22,25 @@
*/
import org.lamsfoundation.lams.common.mvc.*;
-import org.lamsfoundation.lams.common.util.*;
-
-import org.lamsfoundation.lams.wizard.*;
-import org.lamsfoundation.lams.wizard.steps.*;
-import org.lamsfoundation.lams.common.ws.*;
-import org.lamsfoundation.lams.common.ApplicationParent;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.wizard.*;
+import org.lamsfoundation.lams.wizard.steps.*;
+import org.lamsfoundation.lams.common.ws.*;
+import org.lamsfoundation.lams.common.ApplicationParent;
+
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 _wizardController:WizardController;
+ private var _wizardView:WizardView;
private var _resultDTO:Object;
private var _isBusy:Boolean;
-
+
/**
* Constructor
*
@@ -49,190 +49,190 @@
public function WizardController (wm:Observable) {
super (wm);
_wizardModel = WizardModel(getModel());
- _wizardController = this;
- _wizardView = WizardView(getView());
+ _wizardController = this;
+ _wizardView = WizardView(getView());
_isBusy = false;
}
// add control methods
-
- /**
- * Event listener for when when tab is clicked
- *
- * @usage
- * @param evt
- * @return
- */
- public function change(evt):Void{
- Debugger.log("hitting change: " + evt.target.selectedIndex, Debugger.CRITICAL, "change", "WizardController");
- Debugger.log("wizard model: " + _wizardModel, Debugger.CRITICAL, "change", "WizardController");
-
- _wizardModel.setLocationTab(evt.target.selectedIndex);
- }
+ /**
+ * Event listener for when when tab is clicked
+ *
+ * @usage
+ * @param evt
+ * @return
+ */
+ public function change(evt):Void{
+ Debugger.log("hitting change: " + evt.target.selectedIndex, Debugger.CRITICAL, "change", "WizardController");
+ Debugger.log("wizard model: " + _wizardModel, Debugger.CRITICAL, "change", "WizardController");
+
+ _wizardModel.setLocationTab(evt.target.selectedIndex);
+ }
+
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();
- }else if(tgt.indexOf("addmore_btn") != -1){
- goaddmore();
- }
+ 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
- }
-
- 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++;
- }
- }
-
- private function gocancel(evt:Object){
- ApplicationParent.extCall("closeWindow", null);
- }
-
- private function goclose(evt:Object){
- ApplicationParent.extCall("closeWizard", null);
- }
-
- private function goprev(evt:Object){
- _wizardModel.stepID--;
- }
-
- private function gofinish(evt:Object){
- var wizView:WizardView = getView();
- if(wizView.validateStep(_wizardModel)){
- wizView.resultDTO.mode = WizardView.FINISH_MODE;
- wizView.disableButtons();
- initializeLesson(wizView.resultDTO);
- }
- }
-
- private function gostart(evt:Object){
- var wizView:WizardView = getView();
- if(wizView.validateStep(_wizardModel)){
- wizView.resultDTO.mode = WizardView.START_MODE;
- wizView.disableButtons();
- initializeLesson(wizView.resultDTO);
- }
- }
-
- private function goaddmore(evt:Object){
- // go back to step 1
- _wizardModel.stepID = 1;
- }
-
- /**
- * 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);
- }
+ 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();
+ }else if(tgt.indexOf("addmore_btn") != -1){
+ goaddmore();
+ }
+
}
-
- /**
- * 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;
- WizardView(getView()).disableButtons();
- }
-
- public function clearBusy(){
- _isBusy = false;
- WizardView(getView()).enableButtons(_wizardModel);
- }
-
+
+ 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++;
+ }
+ }
+
+ private function gocancel(evt:Object){
+ ApplicationParent.extCall("closeWindow", null);
+ }
+
+ private function goclose(evt:Object){
+ ApplicationParent.extCall("closeWizard", null);
+ }
+
+ private function goprev(evt:Object){
+ _wizardModel.stepID--;
+ }
+
+ private function gofinish(evt:Object){
+ var wizView:WizardView = getView();
+ if(wizView.validateStep(_wizardModel)){
+ wizView.resultDTO.mode = WizardView.FINISH_MODE;
+ wizView.disableButtons();
+ initializeLesson(wizView.resultDTO);
+ }
+ }
+
+ private function gostart(evt:Object){
+ var wizView:WizardView = getView();
+ if(wizView.validateStep(_wizardModel)){
+ wizView.resultDTO.mode = WizardView.START_MODE;
+ wizView.disableButtons();
+ initializeLesson(wizView.resultDTO);
+ }
+ }
+
+ private function goaddmore(evt:Object){
+ // go back to step 1
+ _wizardModel.stepID = 1;
+ }
+
+ /**
+ * 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;
+ WizardView(getView()).disableButtons();
+ }
+
+ public function clearBusy(){
+ _isBusy = false;
+ WizardView(getView()).enableButtons(_wizardModel);
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as (.../WizardModel.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as (.../WizardModel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -20,88 +20,88 @@
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
*/
-
-import org.lamsfoundation.lams.monitoring.*;
+
+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.util.*;
import org.lamsfoundation.lams.common.ws.*;
-import mx.managers.*
-import mx.utils.*
-import mx.events.*;
+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;
+
+ 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;
-
+ private var infoObj:Object;
+
// wizard main
private var _wizard:Wizard;
- private var _org:Organisation;
- private var _lessonID:Number;
-
- private var selectedTab: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;
+ private var _org:Organisation;
+ private var _lessonID:Number;
+ private var selectedTab: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;
-
+
+ _orgResources = new Array();
+ _staffLoaded = false;
+ _learnersLoaded = false;
+
+ _workspaceResultDTO = new Object();
+ _resultDTO = new Object();
+ _stepID = 1;
+
mx.events.EventDispatcher.initialize(this);
- }
+ }
// add get/set methods
@@ -113,22 +113,22 @@
//send an update
infoObj = {};
infoObj.updateType = "ORGANISATION_UPDATED";
- notifyObservers(infoObj);
+ notifyObservers(infoObj);
}
public function getOrganisation():Organisation{
- return _org;
- }
-
- public function saveOrgs(orgs:Array){
- _orgs = orgs;
- }
-
- public function getOrgs():Array{
- return _orgs;
- }
-
+ return _org;
+ }
+ public function saveOrgs(orgs:Array){
+ _orgs = orgs;
+ }
+
+ public function getOrgs():Array{
+ return _orgs;
+ }
+
+
public function broadcastViewUpdate(updateType, data){
setChanged();
@@ -139,78 +139,78 @@
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);
-
- // 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){
- var callback:Function = Proxy.create(this,saveLearners);
- _wizard.requestUsers(LEARNER_ROLE, data.organisationID, callback);
- }
-
-
- private function requestStaff(data:Object){
- var callback:Function = Proxy.create(this,saveStaff);
-
- _wizard.requestUsers(MONITOR_ROLE, data.organisationID, callback);
- }
-
- public function saveLearners(users:Array){
- saveUsers(users, LEARNER_ROLE);
-
- dispatchEvent({type:'learnersLoad',target:this});
- }
-
- public function saveStaff(users:Array){
- 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){
- user.addRole(role);
- } else {
- user = new User();
- user.populateFromDTO(u);
- user.addRole(role);
-
- organisation.addUser(user);
- }
- }
- }
+ /**
+ * 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);
+
+ // 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){
+ var callback:Function = Proxy.create(this,saveLearners);
+ _wizard.requestUsers(LEARNER_ROLE, data.organisationID, callback);
+ }
+
+
+ private function requestStaff(data:Object){
+ var callback:Function = Proxy.create(this,saveStaff);
+
+ _wizard.requestUsers(MONITOR_ROLE, data.organisationID, callback);
+ }
+
+ public function saveLearners(users:Array){
+ saveUsers(users, LEARNER_ROLE);
+
+ dispatchEvent({type:'learnersLoad',target:this});
+ }
+
+ public function saveStaff(users:Array){
+ 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){
+ user.addRole(role);
+ } else {
+ user = new User();
+ user.populateFromDTO(u);
+ user.addRole(role);
+
+ organisation.addUser(user);
+ }
+ }
+ }
+
public function setDirty(){
_isDirty = true;
}
@@ -245,7 +245,7 @@
//Set state variables
__x = x;
__y = y;
-
+
//Set flag for notify observers
setChanged();
@@ -264,179 +264,179 @@
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;
- 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);
- }
-
- public function setLocationTab(tabID:Number){
- Debugger.log("tabID:" + tabID, Debugger.CRITICAL, "setLocationTab", "WizardModel");
- selectedTab = tabID;
-
- setChanged();
-
- //send an update
- infoObj = {};
- infoObj.updateType = "TABCHANGE";
- infoObj.tabID = tabID;
- notifyObservers(infoObj);
- }
-
- public function getLocationTab():Number{
- return selectedTab;
- }
-
- 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){
- 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;
- }
+ }
+ /**
+ * 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;
+ 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);
+ }
+
+ public function setLocationTab(tabID:Number){
+ Debugger.log("tabID:" + tabID, Debugger.CRITICAL, "setLocationTab", "WizardModel");
+ selectedTab = tabID;
+
+ setChanged();
+
+ //send an update
+ infoObj = {};
+ infoObj.updateType = "TABCHANGE";
+ infoObj.tabID = tabID;
+ notifyObservers(infoObj);
+ }
+
+ public function getLocationTab():Number{
+ return selectedTab;
+ }
+
+ 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){
+ 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;
@@ -461,6 +461,6 @@
public function getWizard():Wizard{
return _wizard;
- }
-
+ }
+
}
Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardSummery.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardSummery.as (.../WizardSummery.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardSummery.as (.../WizardSummery.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -120,7 +120,7 @@
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');
+ 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 -rc9c32e6dd572edaad6ed4e8eb39821ca20c0c26a -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as (.../WizardView.as) (revision c9c32e6dd572edaad6ed4e8eb39821ca20c0c26a)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as (.../WizardView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,753 +1,753 @@
-/***************************************************************************
- * 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.common.util.*
-import org.lamsfoundation.lams.common.ui.*
-import org.lamsfoundation.lams.common.style.*
-import org.lamsfoundation.lams.wizard.*
-import org.lamsfoundation.lams.wizard.steps.*
-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 static var RT_ORG:String = "Organisation";
- public static var STRING_NULL:String = "string_null_value";
-
- // step views
- public static var WIZARD_SEQ_VIEW:Number = 1;
- public static var WIZARD_ORG_VIEW:Number = 2;
- public static var WIZARD_LESSON_VIEW:Number = 3;
- public static var WIZARD_SUMMARY_VIEW:Number = 4;
-
- // 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;
-
- // MovieClip for each Step
- private var _wizardSeqView:WizardSequenceView;
- private var _wizardOrgView:WizardOrganisationView;
- private var _wizardLessonView:WizardLessonDetailsView;
- private var _wizardSummaryView:WizardSummaryView;
-
- private var _tm:ThemeManager;
- private var _dictionary:Dictionary;
-
- private var _wizardView_mc:MovieClip;
- private var logo:MovieClip;
-
- //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;
-
- public var panel:MovieClip; //The underlaying panel base
-
- // common elements
- private var wizTitle_lbl:Label;
- private var wizDesc_txt:TextField;
-
- // buttons
- 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 start_btn:Button;
- private var addmore_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;
-
- /**
- * 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);
-
- // add views as observers
- var _model:WizardModel = WizardModel(getModel());
-
- _model.addObserver(_wizardSeqView);
- _model.addObserver(_wizardOrgView);
- _model.addObserver(_wizardLessonView);
- _model.addObserver(_wizardSummaryView);
-
- Debugger.log("model: " + _model, Debugger.CRITICAL, "init", "WizardView");
-
- 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 'SAVED_LC' :
- conclusionStep(infoObj.data, wm);
- break;
- case 'LESSON_STARTED' :
- conclusionStep(infoObj.data, wm);
- break;
- case 'USERS_LOADED' :
- _wizardOrgView.loadLearners(wm.organisation.getLearners(), true);
- _wizardOrgView.loadStaff(wm.organisation.getMonitors(), false);
- _wizardOrgView.selectStaffMember(_root.userID, true);
- _wizardOrgView.enableUsers((resultDTO.selectedJointLessonID == null));
- _wizardController.clearBusy();
- Debugger.log("controller: " + _wizardController, Debugger.CRITICAL, "update", "WizardView");
- break;
- case 'STAFF_RELOAD' :
- _wizardOrgView.loadStaff(wm.organisation.getMonitors(), false);
- break;
- case 'LEARNER_RELOAD' :
- _wizardOrgView.loadLearners(wm.organisation.getLearners(), true);
- break;
- case 'TABCHANGE' :
- _wizardSeqView.showTab(infoObj.tabID);
- 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');
- }
-
- }
-
- /**
- * layout visual elements on the canvas on initialisation
- */
- private function draw(){
- var c = undefined;
- var m = WizardModel(getModel());
-
- Debugger.log("model: " + m, Debugger.CRITICAL, "draw", "WizardView");
-
- _wizardSeqView.init(m, c);
- _wizardOrgView.init(m, c);
- _wizardLessonView.init(m, c);
- _wizardSummaryView.init(m, c);
-
- setStyles();
- _wizardLessonView.setScheduleDateRange();
-
- showStep1();
-
- dispatchEvent({type:'load',target:this});
-
- }
-
- /**
- * Called by the wizardController after the workspace has loaded
- */
- public function setUpContent():Void{
- //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);
- addmore_btn.addEventListener("click",controller);
-
- _wizardOrgView.setupContent();
- _wizardLessonView.setupContent();
-
- //Set up the treeview
- _wizardSeqView.setUpTreeview();
-
- }
-
- /**
- * 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');
- addmore_btn.label = Dictionary.getValue('addmore_btn');
-
- //labels
- setTitle(Dictionary.getValue('wizardTitle_1_lbl'));
- setDescription(Dictionary.getValue('wizardDesc_1_lbl'));
-
- _wizardLessonView.setupLabels();
- _wizardOrgView.setupLabels();
-
- resizeButtons([cancel_btn, prev_btn, next_btn, close_btn, finish_btn, start_btn, _wizardLessonView.getScheduleBtn(), addmore_btn]);
- positionButtons();
- }
-
- /**
- * 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(treeview:Tree, node:XMLNode, isOpen:Boolean, iconLinkage:String){
- if(node.hasChildNodes() || node.attributes.isBranch){
- treeview.setIsBranch(node, true);
- if(iconLinkage != null) treeview.setIcon(node, iconLinkage);
- if(isOpen || node.attributes.isOpen){ treeview.setIsOpen(node, true);}
- for (var i = 0; i";
- }
-
- public function setDescription(desc:String){
- wizDesc_txt.wordWrap = true;
- wizDesc_txt.text = desc;
- }
-
- /**
- * 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);
- }
-
-
+/***************************************************************************
+ * 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.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.wizard.*
+import org.lamsfoundation.lams.wizard.steps.*
+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 static var RT_ORG:String = "Organisation";
+ public static var STRING_NULL:String = "string_null_value";
+
+ // step views
+ public static var WIZARD_SEQ_VIEW:Number = 1;
+ public static var WIZARD_ORG_VIEW:Number = 2;
+ public static var WIZARD_LESSON_VIEW:Number = 3;
+ public static var WIZARD_SUMMARY_VIEW:Number = 4;
+
+ // 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;
+
+ // MovieClip for each Step
+ private var _wizardSeqView:WizardSequenceView;
+ private var _wizardOrgView:WizardOrganisationView;
+ private var _wizardLessonView:WizardLessonDetailsView;
+ private var _wizardSummaryView:WizardSummaryView;
+
+ private var _tm:ThemeManager;
+ private var _dictionary:Dictionary;
+
+ private var _wizardView_mc:MovieClip;
+ private var logo:MovieClip;
+
+ //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;
+
+ public var panel:MovieClip; //The underlaying panel base
+
+ // common elements
+ private var wizTitle_lbl:Label;
+ private var wizDesc_txt:TextField;
+
+ // buttons
+ 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 start_btn:Button;
+ private var addmore_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;
+
+ /**
+ * 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);
+
+ // add views as observers
+ var _model:WizardModel = WizardModel(getModel());
+
+ _model.addObserver(_wizardSeqView);
+ _model.addObserver(_wizardOrgView);
+ _model.addObserver(_wizardLessonView);
+ _model.addObserver(_wizardSummaryView);
+
+ Debugger.log("model: " + _model, Debugger.CRITICAL, "init", "WizardView");
+
+ 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 'SAVED_LC' :
+ conclusionStep(infoObj.data, wm);
+ break;
+ case 'LESSON_STARTED' :
+ conclusionStep(infoObj.data, wm);
+ break;
+ case 'USERS_LOADED' :
+ _wizardOrgView.loadLearners(wm.organisation.getLearners(), true);
+ _wizardOrgView.loadStaff(wm.organisation.getMonitors(), false);
+ _wizardOrgView.selectStaffMember(_root.userID, true);
+ _wizardOrgView.enableUsers((resultDTO.selectedJointLessonID == null));
+ _wizardController.clearBusy();
+ Debugger.log("controller: " + _wizardController, Debugger.CRITICAL, "update", "WizardView");
+ break;
+ case 'STAFF_RELOAD' :
+ _wizardOrgView.loadStaff(wm.organisation.getMonitors(), false);
+ break;
+ case 'LEARNER_RELOAD' :
+ _wizardOrgView.loadLearners(wm.organisation.getLearners(), true);
+ break;
+ case 'TABCHANGE' :
+ _wizardSeqView.showTab(infoObj.tabID);
+ 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');
+ }
+
+ }
+
+ /**
+ * layout visual elements on the canvas on initialisation
+ */
+ private function draw(){
+ var c = undefined;
+ var m = WizardModel(getModel());
+
+ Debugger.log("model: " + m, Debugger.CRITICAL, "draw", "WizardView");
+
+ _wizardSeqView.init(m, c);
+ _wizardOrgView.init(m, c);
+ _wizardLessonView.init(m, c);
+ _wizardSummaryView.init(m, c);
+
+ setStyles();
+ _wizardLessonView.setScheduleDateRange();
+
+ showStep1();
+
+ dispatchEvent({type:'load',target:this});
+
+ }
+
+ /**
+ * Called by the wizardController after the workspace has loaded
+ */
+ public function setUpContent():Void{
+ //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);
+ addmore_btn.addEventListener("click",controller);
+
+ _wizardOrgView.setupContent();
+ _wizardLessonView.setupContent();
+
+ //Set up the treeview
+ _wizardSeqView.setUpTreeview();
+
+ }
+
+ /**
+ * 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');
+ addmore_btn.label = Dictionary.getValue('addmore_btn');
+
+ //labels
+ setTitle(Dictionary.getValue('wizardTitle_1_lbl'));
+ setDescription(Dictionary.getValue('wizardDesc_1_lbl'));
+
+ _wizardLessonView.setupLabels();
+ _wizardOrgView.setupLabels();
+
+ resizeButtons([cancel_btn, prev_btn, next_btn, close_btn, finish_btn, start_btn, _wizardLessonView.getScheduleBtn(), addmore_btn]);
+ positionButtons();
+ }
+
+ /**
+ * 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(treeview:Tree, node:XMLNode, isOpen:Boolean, iconLinkage:String){
+ if(node.hasChildNodes() || node.attributes.isBranch){
+ treeview.setIsBranch(node, true);
+ if(iconLinkage != null) treeview.setIcon(node, iconLinkage);
+ if(isOpen || node.attributes.isOpen){ treeview.setIsOpen(node, true);}
+ for (var i = 0; i";
+ }
+
+ public function setDescription(desc:String){
+ wizDesc_txt.wordWrap = true;
+ wizDesc_txt.text = desc;
+ }
+
+ /**
+ * 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/org/lamsfoundation/lams/wizard/steps/WizardLessonDetailsView.as
===================================================================
diff -u -r53a530570087c6901259fb2958a4b7974df55372 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardLessonDetailsView.as (.../WizardLessonDetailsView.as) (revision 53a530570087c6901259fb2958a4b7974df55372)
+++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardLessonDetailsView.as (.../WizardLessonDetailsView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -57,8 +57,8 @@
public static var SUMMERY_OFFSET:Number = 2;
private var schedule_cb:CheckBox;
- private var learner_expp_cb:CheckBox;
- private var learner_enpres_cb:CheckBox;
+ private var learner_expp_cb:CheckBox;
+ private var learner_enpres_cb:CheckBox;
private var learner_enim_cb:CheckBox;
private var start_btn:Button;
private var schedule_time:MovieClip;
@@ -90,9 +90,9 @@
public function setupContent():Void {
schedule_btn.addEventListener('click', Delegate.create(this, scheduleNow));
schedule_cb.addEventListener("click", Delegate.create(this, scheduleChange));
- learner_expp_cb.addEventListener("click", Delegate.create(this, toogleExpPortfolio));
- learner_enpres_cb.addEventListener("click", Delegate.create(this, toggleEnableIm));
-
+ learner_expp_cb.addEventListener("click", Delegate.create(this, toogleExpPortfolio));
+ learner_enpres_cb.addEventListener("click", Delegate.create(this, toggleEnableIm));
+
learner_expp_cb.selected = true;
}
@@ -106,9 +106,9 @@
schedule_btn.label = Dictionary.getValue('schedule_cb_lbl');
schedule_cb.label = Dictionary.getValue('schedule_cb_lbl');
- learner_expp_cb.label = Dictionary.getValue('wizard_learner_expp_cb_lbl');
- learner_enpres_cb.label = Dictionary.getValue('wizard_learner_enpres_cb_lbl');
- learner_enim_cb.label = Dictionary.getValue('wizard_learner_enim_cb_lbl');
+ learner_expp_cb.label = Dictionary.getValue('wizard_learner_expp_cb_lbl');
+ learner_enpres_cb.label = Dictionary.getValue('wizard_learner_enpres_cb_lbl');
+ learner_enim_cb.label = Dictionary.getValue('wizard_learner_enim_cb_lbl');
}
public function setStyles(_tm:ThemeManager):Void {
@@ -129,7 +129,7 @@
resourceTitle_txi.setStyle('styleName',styleObj);
styleObj = _tm.getStyleObject('scrollpane');
- summery_scp.setStyle('styleName',styleObj);
+ summery_scp.setStyle('styleName',styleObj);
}
public function show():Void {
@@ -143,13 +143,13 @@
start_btn.visible = true;
summery_scp.visible = true;
summery_lbl.visible = true;
- learner_expp_cb.visible = true;
- learner_enpres_cb.visible = true;
- learner_enim_cb.visible = false;
+ learner_expp_cb.visible = true;
+ learner_enpres_cb.visible = true;
+ learner_enim_cb.visible = false;
learner_enim_cb.enabled = false;
schedule_cb.visible = true;
schedule_time._visible = true;
- scheduleDate_dt.visible = true;
+ scheduleDate_dt.visible = true;
// check for NULL value
if(resourceDesc_txa.text == WizardView.STRING_NULL){
@@ -173,38 +173,38 @@
_parent.showButtons([false, true, true, true, true]);
}
-
- learner_expp_cb.selected = true;
- _parent.positionButtons(true);
-
+
+ learner_expp_cb.selected = true;
+ _parent.positionButtons(true);
+
}
-
- public function clear():Void {
- if(summery_lbl_arr.length > 0) {
- for(var i=0; i 0) {
+ for(var i=0; iimport it.sephiroth.TreeDnd
- * myDndTree.dragRules = TreeDnd.DENYDRAGFOLDER | TreeDnd.DENYDROPITEM
- *
- */
- static var DENYDRAGFOLDER:Number = 1
- /** deny drag an item node */
- static var DENYDRAGITEM:Number = 2
- /** deny drop into an item */
- static var DENYDROPITEM:Number = 4
- /** everything is allowed */
- static var DEFAULT:Number = 0
- /** deny drop through nodes, only into is allowed */
- static var DENYDROPUPSIDEDOWN:Number = 8
- /** deny all */
- static var DENYALL:Number = DENYDRAGITEM | DENYDRAGFOLDER | DENYDROPITEM | DENYDROPUPSIDEDOWN
-
- private var __options:Number = DEFAULT
-
- /**
- * constructor
- */
- function TreeDnd()
- {
- }
-
- /**
- * internal, set enabled on off
- * @param enabled
- */
- private function setEnabled(enabled:Boolean):Void
- {
- super.setEnabled();
- tree.enabled = enabled
- }
-
- // ******************************************
- // Private methods
- // ******************************************
-
- /**
- * override UIComponent init constructor
- * @return Void
- */
- private function init():Void
- {
- super.init();
- var width = __width
- var height = __height
- __options = DEFAULT
- boundingBox_mc._visible = false
- boundingBox_mc._width = boundingBox_mc._height = 0;
- // create the objects to be used in the component
- createClassObject(mx.controls.Tree, "tree", TREEDEPTH, {_width : width, _height : height})
- controller_mc = createEmptyObject("controller_mc", CONTDEPTH);
- // initialize the event object
- EventDispatcher.initialize( this );
- initTreeListener();
- setEnabled(enabled)
- tree.rowHeight = __rowHeight
- }
-
-
- /**
- *
- * @param Void
- * @return Void
- */
- function size(Void) : Void
- {
- super.size();
- tree.setSize( __width, __height, true );
- }
-
-
- /**
- *
- * @param Void
- * @return Void
- */
- function draw(Void):Void{
- super.draw();
- }
-
- /**
- * Initialize Tree listeners and Tree MovieClip controller
- * @usage
- * @return Void
- */
- private function initTreeListener():Void
- {
- // Tree listeners
- tfList = new Object();
- tfList.selectedItem = undefined
- tfList.selectedIndex = undefined
- tfList._parent = this
- tfList._time = getTimer();
- tfList._oldItem = undefined
- // tree itemRollOver
- tfList.itemRollOver = function( evt ){
- var item = this._parent.tree.getItemAt(evt.index)
- if( item != undefined )
- {
- var opt:Number = this._parent.dragRules
- var opt_1:Number = opt
- if(opt >= TreeDnd.DENYDROPUPSIDEDOWN){
- opt_1 = opt ^ TreeDnd.DENYDROPUPSIDEDOWN
- }
- if( this._parent.__dragFunction != undefined){
- if(!this._parent.__dragFunction( item )){
- this.itemRollOut()
- return
- }
- } else {
- if( (opt_1 == DENYDRAGFOLDER or opt_1 == (DENYDRAGFOLDER | DENYDROPITEM) or opt_1 == (DENYDRAGITEM | DENYDRAGFOLDER) or opt == DENYALL) and this._parent.tree.getIsBranch( item ))
- {
- this.itemRollOut()
- return
- } else if( !this._parent.tree.getIsBranch( item ) and (opt_1 == DENYDRAGITEM or opt == DENYALL or opt_1 == (DENYDRAGITEM | DENYDROPITEM) or opt_1 == (DENYDRAGITEM | DENYDRAGFOLDER)))
- {
- this.itemRollOut()
- return
- }
- }
- this.selectedItem = item
- this.selectedIndex = evt.index
- } else {
- this.itemRollOut();
- }
- }
-
- // tree itemRollOut
- tfList.itemRollOut = function(evt:Object)
- {
- this.selectedItem = undefined
- this.selectedIndex = undefined
- }
-
- tfList.change = function( evt:Object)
- {
- if( (getTimer() - this._time) < 300)
- {
- if( evt.target.selectedItem == this._oldItem)
- {
- this._parent.dispatchEvent({type:"double_click", target: this._parent.tree});
- }
- }
- this._oldItem = evt.target.selectedItem
- this._time = getTimer()
- }
-
- // add tree listeners
- tree.addEventListener("change", tfList)
- tree.addEventListener("itemRollOver", tfList)
- tree.addEventListener("itemRollOut", tfList)
-
- // controller functions
- controller_mc.tree = tree
- controller_mc.item = undefined
- controller_mc.index = undefined
- controller_mc.__canDrop = false
- controller_mc.__canDropTarget = false
- controller_mc.__dropTargetMc = undefined
- controller_mc.__dropIndex = undefined
- controller_mc.__targetNode = undefined
- controller_mc.__dragStart = false
- controller_mc.onMouseDown = function(){
- this.__dragStart = false
- this.item = this._parent.tfList.selectedItem
- this.index = this._parent.tfList.selectedIndex
- this.added = false
- this.__targetNode = undefined
- this.points = new Array( this._xmouse, this._ymouse);
- if( this.item == undefined ){
- return;
- }
- this.onEnterFrame = function(){
- /**
- * canDrop:
- * -1 => deny always
- * 0 => deny if dropIndex == undefined
- * 1 => allow
- */
- this.clear();
- var canDrop:Number = -1
- var dropIndex:Number = undefined
- var opt:Number = this._parent.dragRules
- var opt_1:Number = opt
- this.__canDropTarget = false
- this.__dropTargetMc = undefined
- if(opt >= TreeDnd.DENYDROPUPSIDEDOWN){
- opt_1 = opt ^ TreeDnd.DENYDROPUPSIDEDOWN
- }
- var targetLabel:Boolean = false
- var default_icon:String
- var point:Object = new Object()
- point.x = this._parent._xmouse
- point.y = this._parent._ymouse
- this._parent.localToGlobal( point )
- if( !this.added ){
- var x = this._xmouse
- var y = this._ymouse
- if(Math.abs( x - this.points[0] ) > 2 or Math.abs( y - this.points[1] ) > 2 ){
- if( !this.added and this.item != undefined ){
- this.__dragStart = true
- this.added = true
- this._parent.createIcon( )
- this._parent.dispatchEvent({type:"drag_start", target:this.tree, sourceNode: this.item});
- }
- }
- } else {
- for(var a = 0; a < this.tree.rows.length; a++)
- {
- if( this.tree.rows[a].item != undefined)
- {
- //if( this.tree.rows[a].hitTest( this._parent._xmouse, this._parent._ymouse, true) )
- if( this.tree.rows[a].hitTest( point.x, point.y, true) )
- {
- var item = this.tree.rows[a]
- this.__targetNode = item
- if( item.item == this.item ){
- // if the same item, then DENY
- canDrop = 0;
- // If trying to DROP an item inside itself, DENY
- } else if ( this._parent.isSubNode(this.item , item.item ) ){
- canDrop = -1;
- } else {
- if( this._parent.__dropFunction != undefined ){
- canDrop = this._parent.__dropFunction( this.item, this.__targetNode.node )
- } else {
- canDrop = 1;
- // now core functions..
- // check if item can be dropped and where it will be dropped!
- // deny drop into item 3,4,5,6,7
- if( (opt_1 >= (DENYDRAGITEM | DENYDRAGFOLDER) and opt <= DENYALL) and !this.tree.getIsBranch( item.node )){
- if( opt == DENYALL ){
- canDrop = -1
- } else {
- canDrop = 0;
- }
- }
- }
- }
- if( item._ymouse > ((item.bG_mc._height/2) + item.bG_mc._height/4) and opt < DENYDROPUPSIDEDOWN && (this._parent.tree._ymouse + item._height < this._parent.tree._height))
- {
- this.beginFill(this._parent.getStyle("separatorColor") ? this._parent.getStyle("separatorColor") : 0x666666,100)
- this.drawRect( 0, item._y + item.bG_mc._height, this._parent.tree.width - (this._parent.tree.vSB.width ? this._parent.tree.vSB.width : 0) - 1, item._y + item.bG_mc._height + 1 )
- this.endFill();
- // try to retrieve the item index
- if( this.tree.getIsBranch( item.node ) )
- {
- if( this.tree.getIsOpen( item.node ))
- {
- // it's the first element of the branch
- dropIndex = item.rowIndex
- }
- }
- dropIndex = item.rowIndex
- }
- break;
- }
- }
- }
- // Now apply permissions to dragging icon
- if( canDrop == 1 )
- {
- targetLabel = true
- this.__canDrop = true
- } else if(canDrop == 0)
- {
- if(dropIndex == undefined)
- {
- targetLabel = false
- this.__canDrop = false
- } else {
- targetLabel = true
- this.__canDrop = true
- }
- } else {
- targetLabel = false
- this.__canDrop = false
- }
- this.__dropIndex = dropIndex
- default_icon = this._parent._iconFunction( targetLabel )
-
- // dropTarget
- if(this._parent.dropTarget != undefined){
- for(var a in this._parent.dropTarget){
- if(this._parent.dropTarget[a].hitTest(point.x, point.y, true))
- {
- targetLabel = true
- this.__canDropTarget = true
- this.__dropTargetMc = this._parent.dropTarget[a]
- break;
- }
- }
- }
-
- if( default_icon == undefined )
- {
- default_icon = targetLabel ? "icon_allow_drag" : "icon_deny_drag"
- }
- if( this._parent.icon[default_icon]._name != default_icon or this._parent.icon[default_icon] == undefined)
- {
- this._parent.icon.attachMovie( default_icon, default_icon , 1 )
- }
- }
-
- var _mouseP = new Object();
- _mouseP.x = this._parent._xmouse
- _mouseP.y = this._parent._ymouse
- //this._parent.globalToLocal( _mouseP )
- this._parent.icon._x = _mouseP.x + 5
- this._parent.icon._y = _mouseP.y + 15
- }
- this.onEnterFrame();
- }
-
- /**
- * mouse up, drag and drop end
- */
- controller_mc.onMouseUp = function(){
- delete this.onEnterFrame
- if( this.__dragStart != true ){
- return;
- }
- if( this.__canDrop == true )
- {
- var node = this.tree.getItemAt(this.index)
- var cloned = node.cloneNode(true)
- if( this.__dropIndex != undefined )
- {
- if( this.tree.getIsBranch( this.__targetNode.item ) and this.tree.getIsOpen( this.__targetNode.item ))
- {
- node.removeNode()
- this.__targetNode.item.addTreeNodeAt(0, cloned )
- } else {
- if(this.__targetNode.item.nextSibling == null)
- {
- node.removeNode()
- this.__targetNode.item.parentNode.addTreeNode( cloned )
- } else {
- if( node != this.__targetNode.item and node != this.__targetNode.item.nextSibling ) // fix by TAKATAMA, Hirokazu
- {
- node.removeNode()
- this.__targetNode.item.parentNode.insertBefore( cloned, this.__targetNode.item.nextSibling )
- this.tree.refresh()
- }
- }
- }
- } else {
- node.removeNode()
- this.__targetNode.item.addTreeNode( cloned )
- }
- this._parent.dispatchEvent({type:"drag_complete", target: this.tree, sourceNode: node, targetNode: this.__targetNode.item})
- this.tree.dataProvider = this.tree.getDataProvider()
- } else {
- this._parent.dispatchEvent({type:"drag_fail", target: this.tree, sourceNode: node, targetNode: this.__targetNode.item})
- }
- if(this.__canDropTarget == true){
- var node = this.tree.getItemAt(this.index)
- this._parent.dispatchEvent({type:"drag_target", target: this.tree, sourceNode: node, targetMc: this.__dropTargetMc})
- }
- this.clear();
- this.__canDrop = false
- this.__dropIndex = undefined
- this._parent.removeIcon()
- this.points = new Array();
- this.item = undefined
- this.index = undefined
- this.added = false
- }
- }
-
-
- /**
- * Internal, remove the dragging mouse icon
- * @usage
- * @return Void
- */
- private function removeIcon():Void
- {
- icon.removeMovieClip();
- }
-
-
- /**
- * internal, create the dragging icon attaching from library
- * @usage
- * @return MovieClip
- */
- private function createIcon():MovieClip
- {
- return createEmptyObject( "icon", ICONDEPTH );
- }
-
-
- /**
- * Verify that targetNode is a subnode of dragNode
- * @usage TreeDnd.isSubNode( sourceNode, targetNode )
- * @param dragNode (XMLNode)
- * @param targetNode (XMLNode)
- * @return Boolean
- */
- private function isSubNode( dragNode:XMLNode, targetNode:XMLNode):Boolean
- {
- var ret:Boolean = false;
- while( targetNode.parentNode != undefined)
- {
- if(targetNode == dragNode)
- {
- ret = true;
- break;
- }
- targetNode = targetNode.parentNode
- }
- return ret;
- }
-
-
- // ******************************************
- // Getter / Setter
- // ******************************************
-
- /**
- * Set the Tree Drag and Drop rules
- * @usage TreeDnd.dragRules = TreeDnd.DENYDRAGITEM | TreeDnd.DENYDROPITEM
- * @param value (Number)
- * @return Void
- */
- [Inspectable(defaultValue=0,type=Number)]
- public function set dragRules(value:Number)
- {
- if(value >= 0 and value <= DENYALL and value != undefined)
- {
- __options = value
- } else {
- throw new Error("IndexError: value must be an integer between " + DEFAULT + " and " + DENYALL);
- }
- /**
- 0 DEFAULT -> Allow everything
- 1 DENYDRAGFOLDER -> DENY drag folders
- 2 DENYDRAGITEM -> DENY drag items
- 4 DENYDROPITEM -> DENY drop into items
- 5 DENYDRAGFOLDER | DENYDROPITEM -> Deny Drag folder & deny drop on items
- 6 DENYDRAGITEM | DENYDROPITEM -> Deny drag item & deny drop item
- 7 DENYALL -> Deny All
- 3 DENYDRAGITEM | DENYDRAGFOLDER -> Deny All
- 8 DENYDROPUPSIDEDOWN -> deny lines
- */
- }
-
- /**
- * return the current drag rules
- * @usage
- * @return Number
- */
- public function get dragRules():Number
- {
- return __options
- }
-
- // set icon function for display allow/deny dragging icon
- public function set iconFunction(func:Function)
- {
- _iconFunction = func
- }
-
- public function get iconFunction():Function
- {
- return _iconFunction
- }
-
- // ******************************************
- // Tree public functions
- // ******************************************
-
- /**
- * Return a pointer to the current used Tree component
- * @usage
- * @return mx.controls.Tree the tree component used
- */
- public function getTree():mx.controls.Tree
- {
- return this.tree
- }
-
- public function set dropTarget(mc:Array):Void
- {
- this.__dropTarget = mc
- }
-
- public function get dropTarget():Array
- {
- return this.__dropTarget
- }
-
- [Inspectable(defaultValue=20,type=Number)]
- public function set rowHeight(w:Number)
- {
- __rowHeight = w
- this.tree.rowHeight = w
- }
-
- public function get rowHeight():Number
- {
- return __rowHeight
- }
-
- /**
- * set a user defined drop function,
- * this function must return a boolean
- * @usage
- * myDndTree.dropFunction = function(sourceNode:XMLNode, targetNode:XMLNode){
- // in this way you can define a custom dragRule
- * return sourceNode.attributes.name != targetNode.attributes.value
- * }
- *
- */
- public function set dropFunction(fn:Function){
- __dropFunction = fn
- }
-
- /**
- * user defined drag function, which decide if item
- * can be dragged
- * @usage
- * myDndTree.dragFunction = function(item:XMLNode){
- * return item.attributes.myattribue == 'some value'
- * }
- *
- */
- public function set dragFunction(fn:Function){
- __dragFunction = fn
- }
-
+import it.sephiroth.iTreeDnd
+import mx.events.EventDispatcher
+import mx.core.UIComponent
+
+
+[Event("double_click")]
+[Event("drag_start")]
+[Event("drag_complete")]
+[Event("drag_fail")]
+[InspectableList("enabled","visible","dragRules","rowHeight")]
+
+
+/**
+ * Drag and Drop extension for Macromedia Tree component.
+ * It allows you to define different rules for dragging items and folder
+ * into a tree component
+ * @author alessandro crugnola
+ * @version 1.5
+ */
+class it.sephiroth.TreeDnd extends UIComponent implements iTreeDnd
+{
+ // define component specific variables
+ static var symbolName:String = "TreeDnd"
+ static var symbolOwner:Object = TreeDnd
+ private var className:String = "TreeDnd"
+
+ static var componentVersion:String = "1.5";
+ // define private variables
+ private var label:MovieClip
+ private var tree:mx.controls.Tree
+ private var icon:MovieClip
+ private var tree_listener:Object
+ private var controller_mc:MovieClip
+ private var boundingBox_mc:MovieClip
+ private var tfList:Object
+ private var __dropTarget:Array
+ private var _iconFunction:Function
+ private var __rowHeight:Number = 20
+ private var __dropFunction:Function
+ private var __dragFunction:Function
+
+ private var TREEDEPTH:Number = 10
+ private var CONTDEPTH:Number = 11
+ private var ICONDEPTH:Number = 12
+
+ var addEventListener:Function
+ var removeEventListener:Function
+ var dispatchEvent:Function
+
+ /**
+ * deny drag a folder.
+ * Each of treednd constant can be used associated with multiple other constants
+ * @usage import it.sephiroth.TreeDnd
+ * myDndTree.dragRules = TreeDnd.DENYDRAGFOLDER | TreeDnd.DENYDROPITEM
+ *
+ */
+ static var DENYDRAGFOLDER:Number = 1
+ /** deny drag an item node */
+ static var DENYDRAGITEM:Number = 2
+ /** deny drop into an item */
+ static var DENYDROPITEM:Number = 4
+ /** everything is allowed */
+ static var DEFAULT:Number = 0
+ /** deny drop through nodes, only into is allowed */
+ static var DENYDROPUPSIDEDOWN:Number = 8
+ /** deny all */
+ static var DENYALL:Number = DENYDRAGITEM | DENYDRAGFOLDER | DENYDROPITEM | DENYDROPUPSIDEDOWN
+
+ private var __options:Number = DEFAULT
+
+ /**
+ * constructor
+ */
+ function TreeDnd()
+ {
+ }
+
+ /**
+ * internal, set enabled on off
+ * @param enabled
+ */
+ private function setEnabled(enabled:Boolean):Void
+ {
+ super.setEnabled();
+ tree.enabled = enabled
+ }
+
+ // ******************************************
+ // Private methods
+ // ******************************************
+
+ /**
+ * override UIComponent init constructor
+ * @return Void
+ */
+ private function init():Void
+ {
+ super.init();
+ var width = __width
+ var height = __height
+ __options = DEFAULT
+ boundingBox_mc._visible = false
+ boundingBox_mc._width = boundingBox_mc._height = 0;
+ // create the objects to be used in the component
+ createClassObject(mx.controls.Tree, "tree", TREEDEPTH, {_width : width, _height : height})
+ controller_mc = createEmptyObject("controller_mc", CONTDEPTH);
+ // initialize the event object
+ EventDispatcher.initialize( this );
+ initTreeListener();
+ setEnabled(enabled)
+ tree.rowHeight = __rowHeight
+ }
+
+
+ /**
+ *
+ * @param Void
+ * @return Void
+ */
+ function size(Void) : Void
+ {
+ super.size();
+ tree.setSize( __width, __height, true );
+ }
+
+
+ /**
+ *
+ * @param Void
+ * @return Void
+ */
+ function draw(Void):Void{
+ super.draw();
+ }
+
+ /**
+ * Initialize Tree listeners and Tree MovieClip controller
+ * @usage
+ * @return Void
+ */
+ private function initTreeListener():Void
+ {
+ // Tree listeners
+ tfList = new Object();
+ tfList.selectedItem = undefined
+ tfList.selectedIndex = undefined
+ tfList._parent = this
+ tfList._time = getTimer();
+ tfList._oldItem = undefined
+ // tree itemRollOver
+ tfList.itemRollOver = function( evt ){
+ var item = this._parent.tree.getItemAt(evt.index)
+ if( item != undefined )
+ {
+ var opt:Number = this._parent.dragRules
+ var opt_1:Number = opt
+ if(opt >= TreeDnd.DENYDROPUPSIDEDOWN){
+ opt_1 = opt ^ TreeDnd.DENYDROPUPSIDEDOWN
+ }
+ if( this._parent.__dragFunction != undefined){
+ if(!this._parent.__dragFunction( item )){
+ this.itemRollOut()
+ return
+ }
+ } else {
+ if( (opt_1 == DENYDRAGFOLDER or opt_1 == (DENYDRAGFOLDER | DENYDROPITEM) or opt_1 == (DENYDRAGITEM | DENYDRAGFOLDER) or opt == DENYALL) and this._parent.tree.getIsBranch( item ))
+ {
+ this.itemRollOut()
+ return
+ } else if( !this._parent.tree.getIsBranch( item ) and (opt_1 == DENYDRAGITEM or opt == DENYALL or opt_1 == (DENYDRAGITEM | DENYDROPITEM) or opt_1 == (DENYDRAGITEM | DENYDRAGFOLDER)))
+ {
+ this.itemRollOut()
+ return
+ }
+ }
+ this.selectedItem = item
+ this.selectedIndex = evt.index
+ } else {
+ this.itemRollOut();
+ }
+ }
+
+ // tree itemRollOut
+ tfList.itemRollOut = function(evt:Object)
+ {
+ this.selectedItem = undefined
+ this.selectedIndex = undefined
+ }
+
+ tfList.change = function( evt:Object)
+ {
+ if( (getTimer() - this._time) < 300)
+ {
+ if( evt.target.selectedItem == this._oldItem)
+ {
+ this._parent.dispatchEvent({type:"double_click", target: this._parent.tree});
+ }
+ }
+ this._oldItem = evt.target.selectedItem
+ this._time = getTimer()
+ }
+
+ // add tree listeners
+ tree.addEventListener("change", tfList)
+ tree.addEventListener("itemRollOver", tfList)
+ tree.addEventListener("itemRollOut", tfList)
+
+ // controller functions
+ controller_mc.tree = tree
+ controller_mc.item = undefined
+ controller_mc.index = undefined
+ controller_mc.__canDrop = false
+ controller_mc.__canDropTarget = false
+ controller_mc.__dropTargetMc = undefined
+ controller_mc.__dropIndex = undefined
+ controller_mc.__targetNode = undefined
+ controller_mc.__dragStart = false
+ controller_mc.onMouseDown = function(){
+ this.__dragStart = false
+ this.item = this._parent.tfList.selectedItem
+ this.index = this._parent.tfList.selectedIndex
+ this.added = false
+ this.__targetNode = undefined
+ this.points = new Array( this._xmouse, this._ymouse);
+ if( this.item == undefined ){
+ return;
+ }
+ this.onEnterFrame = function(){
+ /**
+ * canDrop:
+ * -1 => deny always
+ * 0 => deny if dropIndex == undefined
+ * 1 => allow
+ */
+ this.clear();
+ var canDrop:Number = -1
+ var dropIndex:Number = undefined
+ var opt:Number = this._parent.dragRules
+ var opt_1:Number = opt
+ this.__canDropTarget = false
+ this.__dropTargetMc = undefined
+ if(opt >= TreeDnd.DENYDROPUPSIDEDOWN){
+ opt_1 = opt ^ TreeDnd.DENYDROPUPSIDEDOWN
+ }
+ var targetLabel:Boolean = false
+ var default_icon:String
+ var point:Object = new Object()
+ point.x = this._parent._xmouse
+ point.y = this._parent._ymouse
+ this._parent.localToGlobal( point )
+ if( !this.added ){
+ var x = this._xmouse
+ var y = this._ymouse
+ if(Math.abs( x - this.points[0] ) > 2 or Math.abs( y - this.points[1] ) > 2 ){
+ if( !this.added and this.item != undefined ){
+ this.__dragStart = true
+ this.added = true
+ this._parent.createIcon( )
+ this._parent.dispatchEvent({type:"drag_start", target:this.tree, sourceNode: this.item});
+ }
+ }
+ } else {
+ for(var a = 0; a < this.tree.rows.length; a++)
+ {
+ if( this.tree.rows[a].item != undefined)
+ {
+ //if( this.tree.rows[a].hitTest( this._parent._xmouse, this._parent._ymouse, true) )
+ if( this.tree.rows[a].hitTest( point.x, point.y, true) )
+ {
+ var item = this.tree.rows[a]
+ this.__targetNode = item
+ if( item.item == this.item ){
+ // if the same item, then DENY
+ canDrop = 0;
+ // If trying to DROP an item inside itself, DENY
+ } else if ( this._parent.isSubNode(this.item , item.item ) ){
+ canDrop = -1;
+ } else {
+ if( this._parent.__dropFunction != undefined ){
+ canDrop = this._parent.__dropFunction( this.item, this.__targetNode.node )
+ } else {
+ canDrop = 1;
+ // now core functions..
+ // check if item can be dropped and where it will be dropped!
+ // deny drop into item 3,4,5,6,7
+ if( (opt_1 >= (DENYDRAGITEM | DENYDRAGFOLDER) and opt <= DENYALL) and !this.tree.getIsBranch( item.node )){
+ if( opt == DENYALL ){
+ canDrop = -1
+ } else {
+ canDrop = 0;
+ }
+ }
+ }
+ }
+ if( item._ymouse > ((item.bG_mc._height/2) + item.bG_mc._height/4) and opt < DENYDROPUPSIDEDOWN && (this._parent.tree._ymouse + item._height < this._parent.tree._height))
+ {
+ this.beginFill(this._parent.getStyle("separatorColor") ? this._parent.getStyle("separatorColor") : 0x666666,100)
+ this.drawRect( 0, item._y + item.bG_mc._height, this._parent.tree.width - (this._parent.tree.vSB.width ? this._parent.tree.vSB.width : 0) - 1, item._y + item.bG_mc._height + 1 )
+ this.endFill();
+ // try to retrieve the item index
+ if( this.tree.getIsBranch( item.node ) )
+ {
+ if( this.tree.getIsOpen( item.node ))
+ {
+ // it's the first element of the branch
+ dropIndex = item.rowIndex
+ }
+ }
+ dropIndex = item.rowIndex
+ }
+ break;
+ }
+ }
+ }
+ // Now apply permissions to dragging icon
+ if( canDrop == 1 )
+ {
+ targetLabel = true
+ this.__canDrop = true
+ } else if(canDrop == 0)
+ {
+ if(dropIndex == undefined)
+ {
+ targetLabel = false
+ this.__canDrop = false
+ } else {
+ targetLabel = true
+ this.__canDrop = true
+ }
+ } else {
+ targetLabel = false
+ this.__canDrop = false
+ }
+ this.__dropIndex = dropIndex
+ default_icon = this._parent._iconFunction( targetLabel )
+
+ // dropTarget
+ if(this._parent.dropTarget != undefined){
+ for(var a in this._parent.dropTarget){
+ if(this._parent.dropTarget[a].hitTest(point.x, point.y, true))
+ {
+ targetLabel = true
+ this.__canDropTarget = true
+ this.__dropTargetMc = this._parent.dropTarget[a]
+ break;
+ }
+ }
+ }
+
+ if( default_icon == undefined )
+ {
+ default_icon = targetLabel ? "icon_allow_drag" : "icon_deny_drag"
+ }
+ if( this._parent.icon[default_icon]._name != default_icon or this._parent.icon[default_icon] == undefined)
+ {
+ this._parent.icon.attachMovie( default_icon, default_icon , 1 )
+ }
+ }
+
+ var _mouseP = new Object();
+ _mouseP.x = this._parent._xmouse
+ _mouseP.y = this._parent._ymouse
+ //this._parent.globalToLocal( _mouseP )
+ this._parent.icon._x = _mouseP.x + 5
+ this._parent.icon._y = _mouseP.y + 15
+ }
+ this.onEnterFrame();
+ }
+
+ /**
+ * mouse up, drag and drop end
+ */
+ controller_mc.onMouseUp = function(){
+ delete this.onEnterFrame
+ if( this.__dragStart != true ){
+ return;
+ }
+ if( this.__canDrop == true )
+ {
+ var node = this.tree.getItemAt(this.index)
+ var cloned = node.cloneNode(true)
+ if( this.__dropIndex != undefined )
+ {
+ if( this.tree.getIsBranch( this.__targetNode.item ) and this.tree.getIsOpen( this.__targetNode.item ))
+ {
+ node.removeNode()
+ this.__targetNode.item.addTreeNodeAt(0, cloned )
+ } else {
+ if(this.__targetNode.item.nextSibling == null)
+ {
+ node.removeNode()
+ this.__targetNode.item.parentNode.addTreeNode( cloned )
+ } else {
+ if( node != this.__targetNode.item and node != this.__targetNode.item.nextSibling ) // fix by TAKATAMA, Hirokazu
+ {
+ node.removeNode()
+ this.__targetNode.item.parentNode.insertBefore( cloned, this.__targetNode.item.nextSibling )
+ this.tree.refresh()
+ }
+ }
+ }
+ } else {
+ node.removeNode()
+ this.__targetNode.item.addTreeNode( cloned )
+ }
+ this._parent.dispatchEvent({type:"drag_complete", target: this.tree, sourceNode: node, targetNode: this.__targetNode.item})
+ this.tree.dataProvider = this.tree.getDataProvider()
+ } else {
+ this._parent.dispatchEvent({type:"drag_fail", target: this.tree, sourceNode: node, targetNode: this.__targetNode.item})
+ }
+ if(this.__canDropTarget == true){
+ var node = this.tree.getItemAt(this.index)
+ this._parent.dispatchEvent({type:"drag_target", target: this.tree, sourceNode: node, targetMc: this.__dropTargetMc})
+ }
+ this.clear();
+ this.__canDrop = false
+ this.__dropIndex = undefined
+ this._parent.removeIcon()
+ this.points = new Array();
+ this.item = undefined
+ this.index = undefined
+ this.added = false
+ }
+ }
+
+
+ /**
+ * Internal, remove the dragging mouse icon
+ * @usage
+ * @return Void
+ */
+ private function removeIcon():Void
+ {
+ icon.removeMovieClip();
+ }
+
+
+ /**
+ * internal, create the dragging icon attaching from library
+ * @usage
+ * @return MovieClip
+ */
+ private function createIcon():MovieClip
+ {
+ return createEmptyObject( "icon", ICONDEPTH );
+ }
+
+
+ /**
+ * Verify that targetNode is a subnode of dragNode
+ * @usage TreeDnd.isSubNode( sourceNode, targetNode )
+ * @param dragNode (XMLNode)
+ * @param targetNode (XMLNode)
+ * @return Boolean
+ */
+ private function isSubNode( dragNode:XMLNode, targetNode:XMLNode):Boolean
+ {
+ var ret:Boolean = false;
+ while( targetNode.parentNode != undefined)
+ {
+ if(targetNode == dragNode)
+ {
+ ret = true;
+ break;
+ }
+ targetNode = targetNode.parentNode
+ }
+ return ret;
+ }
+
+
+ // ******************************************
+ // Getter / Setter
+ // ******************************************
+
+ /**
+ * Set the Tree Drag and Drop rules
+ * @usage TreeDnd.dragRules = TreeDnd.DENYDRAGITEM | TreeDnd.DENYDROPITEM
+ * @param value (Number)
+ * @return Void
+ */
+ [Inspectable(defaultValue=0,type=Number)]
+ public function set dragRules(value:Number)
+ {
+ if(value >= 0 and value <= DENYALL and value != undefined)
+ {
+ __options = value
+ } else {
+ throw new Error("IndexError: value must be an integer between " + DEFAULT + " and " + DENYALL);
+ }
+ /**
+ 0 DEFAULT -> Allow everything
+ 1 DENYDRAGFOLDER -> DENY drag folders
+ 2 DENYDRAGITEM -> DENY drag items
+ 4 DENYDROPITEM -> DENY drop into items
+ 5 DENYDRAGFOLDER | DENYDROPITEM -> Deny Drag folder & deny drop on items
+ 6 DENYDRAGITEM | DENYDROPITEM -> Deny drag item & deny drop item
+ 7 DENYALL -> Deny All
+ 3 DENYDRAGITEM | DENYDRAGFOLDER -> Deny All
+ 8 DENYDROPUPSIDEDOWN -> deny lines
+ */
+ }
+
+ /**
+ * return the current drag rules
+ * @usage
+ * @return Number
+ */
+ public function get dragRules():Number
+ {
+ return __options
+ }
+
+ // set icon function for display allow/deny dragging icon
+ public function set iconFunction(func:Function)
+ {
+ _iconFunction = func
+ }
+
+ public function get iconFunction():Function
+ {
+ return _iconFunction
+ }
+
+ // ******************************************
+ // Tree public functions
+ // ******************************************
+
+ /**
+ * Return a pointer to the current used Tree component
+ * @usage
+ * @return mx.controls.Tree the tree component used
+ */
+ public function getTree():mx.controls.Tree
+ {
+ return this.tree
+ }
+
+ public function set dropTarget(mc:Array):Void
+ {
+ this.__dropTarget = mc
+ }
+
+ public function get dropTarget():Array
+ {
+ return this.__dropTarget
+ }
+
+ [Inspectable(defaultValue=20,type=Number)]
+ public function set rowHeight(w:Number)
+ {
+ __rowHeight = w
+ this.tree.rowHeight = w
+ }
+
+ public function get rowHeight():Number
+ {
+ return __rowHeight
+ }
+
+ /**
+ * set a user defined drop function,
+ * this function must return a boolean
+ * @usage
+ * myDndTree.dropFunction = function(sourceNode:XMLNode, targetNode:XMLNode){
+ // in this way you can define a custom dragRule
+ * return sourceNode.attributes.name != targetNode.attributes.value
+ * }
+ *
+ */
+ public function set dropFunction(fn:Function){
+ __dropFunction = fn
+ }
+
+ /**
+ * user defined drag function, which decide if item
+ * can be dragged
+ * @usage
+ * myDndTree.dragFunction = function(item:XMLNode){
+ * return item.attributes.myattribue == 'some value'
+ * }
+ *
+ */
+ public function set dragFunction(fn:Function){
+ __dragFunction = fn
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/it/sephiroth/XML2Object.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/it/sephiroth/XML2Object.as (.../XML2Object.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/it/sephiroth/XML2Object.as (.../XML2Object.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,114 +1,95 @@
-/**
-* @class it.sephiroth.XML2Object
-* @author Alessandro Crugnola
-
-* @version 1.0
-* @description return an object with the content of the XML translated
-
-* If a node has more than 1 child with the same name, an array is created with the children contents
-
-* The object created will have this structure:
-
-* - obj {
-
-* nodeName : {
-
-* attributes : an object containing the node attributes
-
-* data : an object containing the node contents
-
-* }
-
-* @usage data = new XML2Object().parseXML( anXML);
-*/
-class it.sephiroth.XML2Object extends XML {
- private var oResult:Object = new Object ();
- private var oXML:XML;
-
- /**
-
- * @method get xml
-
- * @description return the xml passed in the parseXML method
-
- * @usage theXML = XML2Object.xml
-
- */
- public function get xml():XML{
- return oXML
- }
+/**
+* @class it.sephiroth.XML2Object
+* @author Alessandro Crugnola
+* @version 1.0
+* @description return an object with the content of the XML translated
+* If a node has more than 1 child with the same name, an array is created with the children contents
+* The object created will have this structure:
+* - obj {
+* nodeName : {
+* attributes : an object containing the node attributes
+* data : an object containing the node contents
+* }
+* @usage data = new XML2Object().parseXML( anXML);
+*/
+class it.sephiroth.XML2Object extends XML {
+ private var oResult:Object = new Object ();
+ private var oXML:XML;
/**
- * @method public parseXML
-
- * @description return the parsed Object
-
- * @usage XML2Object.parseXML( theXMLtoParse );
-
- * @param sFile XML
-
- * @returns an Object with the contents of the passed XML
- */
- public function parseXML (sFile:XML):Object {
- this.oResult = new Object ();
- this.oXML = sFile;
- this.oResult = this.translateXML();
- return this.oResult;
- }
- /**
- * @method private translateXML
-
- * @description core of the XML2Object class
- */
- private function translateXML (from, path, name, position) {
- var nodes, node, old_path;
- if (path == undefined) {
- path = this;
- name = "oResult";
- }
- path = path[name];
- if (from == undefined) {
- from = new XML (this.xml);
- from.ignoreWhite = true;
- }
- if (from.hasChildNodes ()) {
- nodes = from.childNodes;
- if (position != undefined) {
- var old_path = path;
- path = path[position];
- }
- while (nodes.length > 0) {
- node = nodes.shift ();
- if (node.nodeName != undefined) {
- var __obj__ = new Object ();
- __obj__.attributes = node.attributes;
- __obj__.data = node.firstChild.nodeValue;
- if (position != undefined) {
- var old_path = path;
- }
- if (path[node.nodeName] != undefined) {
- if (path[node.nodeName].__proto__ == Array.prototype) {
- path[node.nodeName].push (__obj__);
- name = node.nodeName;
- position = path[node.nodeName].length - 1;
- } else {
- var copyObj = path[node.nodeName];
- path[node.nodeName] = new Array ();
- path[node.nodeName].push (copyObj);
- path[node.nodeName].push (__obj__);
- name = node.nodeName;
- position = path[node.nodeName].length - 1;
- }
- } else {
- path[node.nodeName] = __obj__;
- name = node.nodeName;
- position = undefined;
- }
- }
- if (node.hasChildNodes ()) {
- this.translateXML (node, path, name, position);
- }
- }
- }
- return this.oResult;
- }
-}
+ * @method get xml
+ * @description return the xml passed in the parseXML method
+ * @usage theXML = XML2Object.xml
+ */
+ public function get xml():XML{
+ return oXML
+ }
+ /**
+ * @method public parseXML
+ * @description return the parsed Object
+ * @usage XML2Object.parseXML( theXMLtoParse );
+ * @param sFile XML
+ * @returns an Object with the contents of the passed XML
+ */
+ public function parseXML (sFile:XML):Object {
+ this.oResult = new Object ();
+ this.oXML = sFile;
+ this.oResult = this.translateXML();
+ return this.oResult;
+ }
+ /**
+ * @method private translateXML
+ * @description core of the XML2Object class
+ */
+ private function translateXML (from, path, name, position) {
+ var nodes, node, old_path;
+ if (path == undefined) {
+ path = this;
+ name = "oResult";
+ }
+ path = path[name];
+ if (from == undefined) {
+ from = new XML (this.xml);
+ from.ignoreWhite = true;
+ }
+ if (from.hasChildNodes ()) {
+ nodes = from.childNodes;
+ if (position != undefined) {
+ var old_path = path;
+ path = path[position];
+ }
+ while (nodes.length > 0) {
+ node = nodes.shift ();
+ if (node.nodeName != undefined) {
+ var __obj__ = new Object ();
+ __obj__.attributes = node.attributes;
+ __obj__.data = node.firstChild.nodeValue;
+ if (position != undefined) {
+ var old_path = path;
+ }
+ if (path[node.nodeName] != undefined) {
+ if (path[node.nodeName].__proto__ == Array.prototype) {
+ path[node.nodeName].push (__obj__);
+ name = node.nodeName;
+ position = path[node.nodeName].length - 1;
+ } else {
+ var copyObj = path[node.nodeName];
+ path[node.nodeName] = new Array ();
+ path[node.nodeName].push (copyObj);
+ path[node.nodeName].push (__obj__);
+ name = node.nodeName;
+ position = path[node.nodeName].length - 1;
+ }
+ } else {
+ path[node.nodeName] = __obj__;
+ name = node.nodeName;
+ position = undefined;
+ }
+ }
+ if (node.hasChildNodes ()) {
+ this.translateXML (node, path, name, position);
+ }
+ }
+ }
+ return this.oResult;
+ }
+}
Index: lams_flash/src/common/flash/it/sephiroth/iTreeDnd.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/it/sephiroth/iTreeDnd.as (.../iTreeDnd.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/it/sephiroth/iTreeDnd.as (.../iTreeDnd.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,8 +1,8 @@
-
-/**
-* Interface for defining public available methods
-*/
-
-interface it.sephiroth.iTreeDnd {
- function getTree():mx.controls.Tree;
+
+/**
+* Interface for defining public available methods
+*/
+
+interface it.sephiroth.iTreeDnd {
+ function getTree():mx.controls.Tree;
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/AboutDialog.as
===================================================================
diff -u -ra24c5a3f781d4862f94f0c3e1fa99da66e3505a2 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/AboutDialog.as (.../AboutDialog.as) (revision a24c5a3f781d4862f94f0c3e1fa99da66e3505a2)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/AboutDialog.as (.../AboutDialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -27,7 +27,7 @@
import mx.controls.*;
import mx.events.*;
-import org.lamsfoundation.lams.common.*
+import org.lamsfoundation.lams.common.*
import org.lamsfoundation.lams.common.comms.*
import org.lamsfoundation.lams.common.util.*
import org.lamsfoundation.lams.common.ui.*
@@ -43,34 +43,34 @@
//Declarations
//Static vars
- private static var LOGO_X:Number = 9;
- private static var LOGO_Y:Number = 5;
- public static var LOGO_WIDTH:Number = 67;
- public static var LOGO_HEIGHT:Number = 25;
-
- public static var LOGO_PATH:String = "www/images/about.logo.swf";
+ private static var LOGO_X:Number = 9;
+ private static var LOGO_Y:Number = 5;
+ public static var LOGO_WIDTH:Number = 67;
+ public static var LOGO_HEIGHT:Number = 25;
- public var className:String = 'AboutDialog';
-
-
- private var _bg:Panel;
+ public static var LOGO_PATH:String = "www/images/about.logo.swf";
+
+ public var className:String = 'AboutDialog';
+
+
+ private var _bg:Panel;
private var logo:MovieClip; // LAMS/RAMS logo
- private var version_lbl:TextField;
- private var version_txt:TextField;
- private var copyright_txt:TextField;
- private var trademark_txt:TextField;
+ private var version_lbl:TextField;
+ private var version_txt:TextField;
+ private var copyright_txt:TextField;
+ private var trademark_txt:TextField;
private var license_txt:TextField;
private var _scrollList_scp:MovieClip;
- private var _listText:String;
+ private var _listText:String;
//References to components + clips
private var _container:MovieClip; //The container window that holds the dialog
private var app:ApplicationParent;
private var tm:ThemeManager;
- private var _dictionary:Dictionary;
- private var _comms:Communication;
+ private var _dictionary:Dictionary;
+ private var _comms:Communication;
private var fm:FocusManager; //Reference to focus manager
//These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
@@ -84,7 +84,7 @@
EventDispatcher.initialize(this);
//Create a clip that will wait a frame before dispatching init to give components time to setup
- this.onEnterFrame = init;
+ this.onEnterFrame = init;
this._visible = false;
}
@@ -95,140 +95,140 @@
//Get a reference to the application, ThemeManager and Dictionary
app = ApplicationParent.getInstance();
tm = ThemeManager.getInstance();
-
- _comms = ApplicationParent.getInstance().getComms();
+
+ _comms = ApplicationParent.getInstance().getComms();
_dictionary = Dictionary.getInstance();
_dictionary.addEventListener('init', Delegate.create(this, setup));
//Assign Click (close button) and resize handlers
_container.addEventListener('click',this);
_container.addEventListener('size',this);
-
- //get focus manager + set focus to OK button, focus manager is available to all components through getFocusManager
- fm = _container.getFocusManager();
- fm.enabled = true;
-
- // autosize labels/textfields
- version_lbl.autoSize = "true";
- version_txt.autoSize = "true";
- copyright_txt.autoSize = "true";
- trademark_txt.autoSize = "true";
- license_txt.autoSize = "true";
-
- getList();
+
+ //get focus manager + set focus to OK button, focus manager is available to all components through getFocusManager
+ fm = _container.getFocusManager();
+ fm.enabled = true;
+
+ // autosize labels/textfields
+ version_lbl.autoSize = "true";
+ version_txt.autoSize = "true";
+ copyright_txt.autoSize = "true";
+ trademark_txt.autoSize = "true";
+ license_txt.autoSize = "true";
+
+ getList();
}
/*
* @usage
* @return
*/
- public function setUpContent():Void{
- this._visible = true;
+ public function setUpContent():Void{
+ this._visible = true;
}
/**
* set the container refernce to the window holding the dialog
*/
function set container(value:MovieClip){
_container = value;
- }
+ }
/**
* overrides UIObject.setStyle to provide custom style setting
*/
- public function setStyles() {
+ public function setStyles() {
var styleObj = tm.getStyleObject('AboutDialogPanel');
_bg.setStyle('styleName', styleObj);
}
public function setLabels() {
-
- }
-
- public function getList():Void {
- var callBack = Proxy.create(this,loadData);
- _comms.getRequest('flashxml/contributorData.xml',callBack);
- }
-
- public function loadData(data:Object) {
- if(data instanceof LFError) {
- Debugger.log("unsuccessful load", Debugger.CRITICAL, "openAboutLams", "Canvas");
- return;
- }
-
- var list_mc:MovieClip = _scrollList_scp.content;
- var empty_mc = list_mc.createEmptyMovieClip('empty_mc', list_mc.getNextHighestDepth());
- var xOffset:Number = 1;
- var yOffset:Number = 1;
- var styleObj_General = tm.getStyleObject("AboutDialogScpGeneralItem");
- var styleObj_Header = tm.getStyleObject("AboutDialogScpHeaderItem");
-
- for (var prop in data) {
-
- // parse xml to create text string
- var child = data[prop];
- var _labelHeader:Label = empty_mc.attachMovie("Label", "scrollList_" + prop.toString(), empty_mc.getNextHighestDepth(), {_x:xOffset, _y:yOffset, _height:20, autoSize:true, text:prop.toString(), styleName:styleObj_Header});
- yOffset += 15;
-
- for(var i=0; i < child.length; i++) {
- var name = child[i].value;
- var _label = empty_mc.attachMovie("Label", "scrollList_" + prop.toString() + "_" + i, empty_mc.getNextHighestDepth(), {_x:xOffset+10, _y:yOffset, _height:20, autoSize:true, text:name, styleName:styleObj_General});
- yOffset += 15;
- }
-
- yOffset += 20;
-
- }
-
- setup();
-
- _scrollList_scp._width = this._width - (2*_scrollList_scp._x);
- _scrollList_scp.redraw(true);
-
- //fire event to say we have loaded
- _container.contentLoaded();
+
}
- public function setup() {
- setStyles();
- loadLogo();
-
- Debugger.log("build no: " + ApplicationParent.SERIAL_NO, Debugger.GEN, "setup", "AboutDialog");
-
+ public function getList():Void {
+ var callBack = Proxy.create(this,loadData);
+ _comms.getRequest('flashxml/contributorData.xml',callBack);
+ }
+
+ public function loadData(data:Object) {
+ if(data instanceof LFError) {
+ Debugger.log("unsuccessful load", Debugger.CRITICAL, "openAboutLams", "Canvas");
+ return;
+ }
+
+ var list_mc:MovieClip = _scrollList_scp.content;
+ var empty_mc = list_mc.createEmptyMovieClip('empty_mc', list_mc.getNextHighestDepth());
+ var xOffset:Number = 1;
+ var yOffset:Number = 1;
+ var styleObj_General = tm.getStyleObject("AboutDialogScpGeneralItem");
+ var styleObj_Header = tm.getStyleObject("AboutDialogScpHeaderItem");
+
+ for (var prop in data) {
+
+ // parse xml to create text string
+ var child = data[prop];
+ var _labelHeader:Label = empty_mc.attachMovie("Label", "scrollList_" + prop.toString(), empty_mc.getNextHighestDepth(), {_x:xOffset, _y:yOffset, _height:20, autoSize:true, text:prop.toString(), styleName:styleObj_Header});
+ yOffset += 15;
+
+ for(var i=0; i < child.length; i++) {
+ var name = child[i].value;
+ var _label = empty_mc.attachMovie("Label", "scrollList_" + prop.toString() + "_" + i, empty_mc.getNextHighestDepth(), {_x:xOffset+10, _y:yOffset, _height:20, autoSize:true, text:name, styleName:styleObj_General});
+ yOffset += 15;
+ }
+
+ yOffset += 20;
+
+ }
+
+ setup();
+
+ _scrollList_scp._width = this._width - (2*_scrollList_scp._x);
+ _scrollList_scp.redraw(true);
+
+ //fire event to say we have loaded
+ _container.contentLoaded();
+ }
+
+ public function setup() {
+ setStyles();
+ loadLogo();
+
+ Debugger.log("build no: " + ApplicationParent.SERIAL_NO, Debugger.GEN, "setup", "AboutDialog");
+
version_lbl.text = Dictionary.getValue('about_popup_version_lbl');
- version_txt.htmlText = _root.version;
-
- version_txt._x = version_lbl._x + version_lbl.textWidth + 2;
-
- var ref_lbl:String = Dictionary.getValue('stream_reference_lbl');
- var stream_url:String = Dictionary.getValue('stream_url', [ref_lbl.toLowerCase()]);
- var stream_url_atag:String = "" + stream_url + ""
-
- copyright_txt.htmlText = Dictionary.getValue('about_popup_copyright_lbl', [ref_lbl]);
- trademark_txt.htmlText = Dictionary.getValue('about_popup_trademark_lbl', [ref_lbl, stream_url_atag]);
-
- var license_url:String = Dictionary.getValue('gpl_license_url');
- var license_url_atag:String = "" + license_url + "";
- license_txt.htmlText = Dictionary.getValue('about_popup_license_lbl', [license_url_atag]);
-
- }
-
- private function loadLogo():Void{
- logo = this.createEmptyMovieClip("logo", this.getNextHighestDepth());
- var ml = new MovieLoader(Config.getInstance().serverUrl+AboutDialog.LOGO_PATH,setUpLogo,this,logo);
- }
-
- private function setUpLogo(logo):Void{
- logo._x = AboutDialog.LOGO_X;
- logo._y = AboutDialog.LOGO_Y;
- }
+ version_txt.htmlText = _root.version;
+
+ version_txt._x = version_lbl._x + version_lbl.textWidth + 2;
+
+ var ref_lbl:String = Dictionary.getValue('stream_reference_lbl');
+ var stream_url:String = Dictionary.getValue('stream_url', [ref_lbl.toLowerCase()]);
+ var stream_url_atag:String = "" + stream_url + ""
+
+ copyright_txt.htmlText = Dictionary.getValue('about_popup_copyright_lbl', [ref_lbl]);
+ trademark_txt.htmlText = Dictionary.getValue('about_popup_trademark_lbl', [ref_lbl, stream_url_atag]);
+
+ var license_url:String = Dictionary.getValue('gpl_license_url');
+ var license_url_atag:String = "" + license_url + "";
+ license_txt.htmlText = Dictionary.getValue('about_popup_license_lbl', [license_url_atag]);
+
+ }
+ private function loadLogo():Void{
+ logo = this.createEmptyMovieClip("logo", this.getNextHighestDepth());
+ var ml = new MovieLoader(Config.getInstance().serverUrl+AboutDialog.LOGO_PATH,setUpLogo,this,logo);
+ }
+
+ private function setUpLogo(logo):Void{
+ logo._x = AboutDialog.LOGO_X;
+ logo._y = AboutDialog.LOGO_Y;
+ }
+
/**
* Main resize method, called by scrollpane container/parent
*/
- public function setSize(w:Number,h:Number):Void{
+ public function setSize(w:Number,h:Number):Void{
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ApplicationParent.as
===================================================================
diff -u -r669e93c1a44351fe2d01e886e5ada98ee3c65ea5 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ApplicationParent.as (.../ApplicationParent.as) (revision 669e93c1a44351fe2d01e886e5ada98ee3c65ea5)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ApplicationParent.as (.../ApplicationParent.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -21,314 +21,314 @@
* ************************************************************************
*/
-import org.lamsfoundation.lams.common.*;
-import org.lamsfoundation.lams.common.comms.*; //communications
-import org.lamsfoundation.lams.common.dict.*; //Dictionary
-import org.lamsfoundation.lams.common.style.*; //Themes/Styles
-import org.lamsfoundation.lams.common.util.Debugger;
-import org.lamsfoundation.lams.common.util.Proxy;
-import org.lamsfoundation.lams.common.ws.*;
-
-import org.lamsfoundation.lams.authoring.*;
-import org.lamsfoundation.lams.authoring.cv.Canvas;
-
-import org.lamsfoundation.lams.learner.*
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.comms.*; //communications
+import org.lamsfoundation.lams.common.dict.*; //Dictionary
+import org.lamsfoundation.lams.common.style.*; //Themes/Styles
+import org.lamsfoundation.lams.common.util.Debugger;
+import org.lamsfoundation.lams.common.util.Proxy;
+import org.lamsfoundation.lams.common.ws.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.authoring.cv.Canvas;
+
+import org.lamsfoundation.lams.learner.*
+
class ApplicationParent {
//public constants
public static var C_HOURGLASS:String = "c_hourglass";
public static var C_TRANSITION:String = "c_pen";
public static var C_OPTIONAL:String = "c_optionalBoxPen";
public static var C_GATE:String = "c_gate";
- public static var C_GROUP:String = "c_group";
+ public static var C_GROUP:String = "c_group";
public static var C_BRANCH:String = "c_branch";
- public static var C_DEFAULT:String = "default";
- public static var C_LICON:String = "c_licon";
-
- public static var RTL:String = "RTL";
-
+ public static var C_DEFAULT:String = "default";
+ public static var C_LICON:String = "c_licon";
+
+ public static var RTL:String = "RTL";
+
public static var TRANSITION:String = "transition";
-
- public static var SERIAL_NO = "0000-0000-0000-0001-AAAA";
- public static var FLASH_TOOLSIGNATURE_GATE:String = "lagat11";
- public static var FLASH_TOOLSIGNATURE_GROUP:String = "lagrp11";
- public static var FLASH_TOOLSIGNATURE_BRANCHING:String = "labranch21";
+ public static var SERIAL_NO = "0000-0000-0000-0001-AAAA";
+ public static var FLASH_TOOLSIGNATURE_GATE:String = "lagat11";
+ public static var FLASH_TOOLSIGNATURE_GROUP:String = "lagrp11";
+ public static var FLASH_TOOLSIGNATURE_BRANCHING:String = "labranch21";
+
public static var NORMAL_MODE:String = "author"; // Normal Operation Mode
public static var EDIT_MODE:String = "editonfly"; // Edit-On-The-Fly Mode
-
- public static var DIALOGUE_DEPTH:Number = 55; //depth of the cursors
-
- private var _comms:Communication;
- private var _themeManager:ThemeManager;
- private var _dictionary:Dictionary;
- private var _config:Config;
- private var _workspace:Workspace;
-
- private var _currentDialog:MovieClip;
- private var _customCursor_mc:MovieClip; //Cursor container
-
- private static var _controlKeyPressed:String;
-
- //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
-
- //Application instance is stored as a static in the application parent class
- private static var _instance:ApplicationParent = null;
+
+ public static var DIALOGUE_DEPTH:Number = 55; //depth of the cursors
+
+ private var _comms:Communication;
+ private var _themeManager:ThemeManager;
+ private var _dictionary:Dictionary;
+ private var _config:Config;
+ private var _workspace:Workspace;
+
+ private var _currentDialog:MovieClip;
+ private var _customCursor_mc:MovieClip; //Cursor container
+
+ private static var _controlKeyPressed:String;
+
+ //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
+
+ //Application instance is stored as a static in the application parent class
+ private static var _instance:ApplicationParent = null;
private var _module:String;
-
- private var _appRoot_mc:MovieClip; //Application root clip
- private var _dialogueContainer_mc:MovieClip; //Dialog container
- private var _tooltipContainer_mc:MovieClip; //Tooltip container
+
+ private var _appRoot_mc:MovieClip; //Application root clip
+ private var _dialogueContainer_mc:MovieClip; //Dialog container
+ private var _tooltipContainer_mc:MovieClip; //Tooltip container
// constructor
- public function ApplicationParent(app:Object) {
- _instance = ApplicationParent(app);
+ public function ApplicationParent(app:Object) {
+ _instance = ApplicationParent(app);
- _themeLoaded = false;
- _themeEventDispatched = false;
- _dictionaryLoaded = false;
- _dictionaryEventDispatched = false;
-
- //Comms object - do this before any objects are created that require it for server communication
- _comms = new Communication();
-
- }
-
- /**
- * Retrieves an instance of the Application singleton
- */
- public static function getInstance():ApplicationParent{
- if(ApplicationParent._instance == null){
- ApplicationParent._instance = new ApplicationParent();
- }
- return ApplicationParent._instance;
- }
-
- public static function extCall(method:String, param:String):Void {
- var isMac:Boolean = (_root.isMac == "true")?true:false;
- var versionSplit = getVersion().split(",", 2);
- var v:Number = Number(versionSplit[0].substr(versionSplit[0].length - 1, 1));
-
- Debugger.log("ExtCall:: method: " + method + " :: isMac: " + isMac + " :: version: " + getVersion() + ":: v: " + v.toString() , Debugger.GEN, "extCall", "ApplicationParent");
-
- if((v <= 8) && (isMac)) {
- Debugger.log("using Javascript method", Debugger.GEN, "extCall", "ApplicationParent");
- getURL("javascript: " + method + "(" + param + ")");
- } else {
- Debugger.log("using FSCommand method", Debugger.GEN, "extCall", "ApplicationParent");
- fscommand(method, param);
- }
-
- }
-
- /**
- * Called when Dictionary loaded
- * @param evt:Object the event object
- */
- private function onDictionaryLoad(evt:Object){
- if(evt.type=='load'){
- _root.preloader.complete();
- _dictionaryLoaded = true;
- Debugger.log('Dictionary loaded :',Debugger.CRITICAL,'onDictionaryLoad','Application');
- } else {
- Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onDictionaryLoad','Application');
- }
- }
-
- /**
- * Called when the current selected theme has been loaded
- * @param evt:Object the event object
- */
- private function onThemeLoad(evt:Object) {
- if(evt.type=='load'){
- _root.preloader.complete();
- _themeLoaded = true;
- Debugger.log('!Theme loaded :',Debugger.CRITICAL,'onThemeLoad','Application');
- } else {
- Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onThemeLoad','Application');
- }
-
- }
-
- public static function addLocaleToURL(url:String):String {
- var locale:String = (_root.lang == "en") ? "" : _root.lang;
- var newURL:String;
-
- if(url.substr(url.length-1, url.length) == "/") {
- newURL = url.substr(0, url.length-1) + locale + "/";
- } else {
- newURL = url + locale + "/";
- }
-
- return newURL;
- }
-
- /**
- * Retrieve the help url from config.
- * @param callback (optional)
- */
- public function getHelpURL(callback:Function) {
- var _callback:Function = callback;
-
- if(callback == null || callback == undefined) {
- _callback = Proxy.create(this, openHelp); // default callback
- } else {
- Debugger.log('called from Monitor :',Debugger.CRITICAL,'getHelpURL','ApplicationParent');
- }
-
- Application.getInstance().getComms().getRequest('authoring/author.do?method=getHelpURL',_callback, false);
-
- }
-
- /**
- * Open the generic help page
- * @param url generic help url
- */
- public function openHelp(url:String) {
- ApplicationParent.extCall("openURL", addLocaleToURL(url) + this.module);
- }
-
- /**
- * returns the the Comms instance
- */
- public function getComms():Communication{
- return _comms;
- }
-
- /**
- * returns the the Dictionary instance
- */
- public function getDictionary():Dictionary{
- return _dictionary;
- }
-
- /**
- * returns the the workspace instance
- */
- public function getWorkspace():Workspace{
- return _workspace;
- }
-
- /**
- * 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 Cursor conatiner mc
- *
- * @usage Import authoring package and then use
- *
- */
- static function get ccursor():MovieClip {
- //Return root if valid otherwise raise a big system error as app. will not work without it
- if(_instance._customCursor_mc != undefined) {
- return _instance._customCursor_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
-
- }
- }
-
- public function get loader():MovieClip{
- if(_root.preloader != undefined) { return _root.preloader; }
- else {
- }
- }
-
- public function get module():String{
- return _module;
- }
-
- public static function cloneMovieClip(
- target:MovieClip, newName:String,
- depth:Number, initObject:Object):MovieClip {
-
- target.duplicateMovieClip(newName, depth, initObject);
-
- return target._parent[newName];
- }
-
- /**
- * 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 != undefined) {
-
- return _instance.dialogueContainer;
- } else {
- //TODO DI 11/05/05 Raise error if mc hasn't been created
- Debugger.log("dialogue undefined: " + _instance, Debugger.CRITICAL, "dialogue", "ApplicationParent");
- }
- }
-
- public function set dialogueContainer(a:MovieClip):Void{
- _dialogueContainer_mc = a;
- }
-
- public function get dialogueContainer():MovieClip {
- Debugger.log("check application root: " + _root, Debugger.CRITICAL, "dialogueContainer", "ApplicationParent");
- if(_dialogueContainer_mc == undefined || _dialogueContainer_mc == null) _dialogueContainer_mc = _root.createEmptyMovieClip('_dialogueContainer_mc', DIALOGUE_DEPTH);
- return _dialogueContainer_mc;
- }
-
- public function get dialog():MovieClip {
- return _currentDialog;
- }
-
- public function set dialog(a:MovieClip) {
- _currentDialog = a;
- }
-
- public function get controlKeyPressed():String{
- return _controlKeyPressed;
- }
-
- public function set controlKeyPressed(key:String){
- _controlKeyPressed = key;
- }
-
- public static function isRTL():Boolean {
- Debugger.log("root direction: " + _root.direction, Debugger.CRITICAL, "isRTL", "ApplicationParent");
- return (_root.direction == ApplicationParent.RTL);
+ _themeLoaded = false;
+ _themeEventDispatched = false;
+ _dictionaryLoaded = false;
+ _dictionaryEventDispatched = false;
+
+ //Comms object - do this before any objects are created that require it for server communication
+ _comms = new Communication();
+
}
-
+
+ /**
+ * Retrieves an instance of the Application singleton
+ */
+ public static function getInstance():ApplicationParent{
+ if(ApplicationParent._instance == null){
+ ApplicationParent._instance = new ApplicationParent();
+ }
+ return ApplicationParent._instance;
+ }
+
+ public static function extCall(method:String, param:String):Void {
+ var isMac:Boolean = (_root.isMac == "true")?true:false;
+ var versionSplit = getVersion().split(",", 2);
+ var v:Number = Number(versionSplit[0].substr(versionSplit[0].length - 1, 1));
+
+ Debugger.log("ExtCall:: method: " + method + " :: isMac: " + isMac + " :: version: " + getVersion() + ":: v: " + v.toString() , Debugger.GEN, "extCall", "ApplicationParent");
+
+ if((v <= 8) && (isMac)) {
+ Debugger.log("using Javascript method", Debugger.GEN, "extCall", "ApplicationParent");
+ getURL("javascript: " + method + "(" + param + ")");
+ } else {
+ Debugger.log("using FSCommand method", Debugger.GEN, "extCall", "ApplicationParent");
+ fscommand(method, param);
+ }
+
+ }
+
+ /**
+ * Called when Dictionary loaded
+ * @param evt:Object the event object
+ */
+ private function onDictionaryLoad(evt:Object){
+ if(evt.type=='load'){
+ _root.preloader.complete();
+ _dictionaryLoaded = true;
+ Debugger.log('Dictionary loaded :',Debugger.CRITICAL,'onDictionaryLoad','Application');
+ } else {
+ Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onDictionaryLoad','Application');
+ }
+ }
+
+ /**
+ * Called when the current selected theme has been loaded
+ * @param evt:Object the event object
+ */
+ private function onThemeLoad(evt:Object) {
+ if(evt.type=='load'){
+ _root.preloader.complete();
+ _themeLoaded = true;
+ Debugger.log('!Theme loaded :',Debugger.CRITICAL,'onThemeLoad','Application');
+ } else {
+ Debugger.log('event type not recognised :'+evt.type,Debugger.CRITICAL,'onThemeLoad','Application');
+ }
+
+ }
+
+ public static function addLocaleToURL(url:String):String {
+ var locale:String = (_root.lang == "en") ? "" : _root.lang;
+ var newURL:String;
+
+ if(url.substr(url.length-1, url.length) == "/") {
+ newURL = url.substr(0, url.length-1) + locale + "/";
+ } else {
+ newURL = url + locale + "/";
+ }
+
+ return newURL;
+ }
+
+ /**
+ * Retrieve the help url from config.
+ * @param callback (optional)
+ */
+ public function getHelpURL(callback:Function) {
+ var _callback:Function = callback;
+
+ if(callback == null || callback == undefined) {
+ _callback = Proxy.create(this, openHelp); // default callback
+ } else {
+ Debugger.log('called from Monitor :',Debugger.CRITICAL,'getHelpURL','ApplicationParent');
+ }
+
+ Application.getInstance().getComms().getRequest('authoring/author.do?method=getHelpURL',_callback, false);
+
+ }
+
+ /**
+ * Open the generic help page
+ * @param url generic help url
+ */
+ public function openHelp(url:String) {
+ ApplicationParent.extCall("openURL", addLocaleToURL(url) + this.module);
+ }
+
+ /**
+ * returns the the Comms instance
+ */
+ public function getComms():Communication{
+ return _comms;
+ }
+
+ /**
+ * returns the the Dictionary instance
+ */
+ public function getDictionary():Dictionary{
+ return _dictionary;
+ }
+
+ /**
+ * returns the the workspace instance
+ */
+ public function getWorkspace():Workspace{
+ return _workspace;
+ }
+
+ /**
+ * 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 Cursor conatiner mc
+ *
+ * @usage Import authoring package and then use
+ *
+ */
+ static function get ccursor():MovieClip {
+ //Return root if valid otherwise raise a big system error as app. will not work without it
+ if(_instance._customCursor_mc != undefined) {
+ return _instance._customCursor_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
+
+ }
+ }
+
+ public function get loader():MovieClip{
+ if(_root.preloader != undefined) { return _root.preloader; }
+ else {
+ }
+ }
+
+ public function get module():String{
+ return _module;
+ }
+
+ public static function cloneMovieClip(
+ target:MovieClip, newName:String,
+ depth:Number, initObject:Object):MovieClip {
+
+ target.duplicateMovieClip(newName, depth, initObject);
+
+ return target._parent[newName];
+ }
+
+ /**
+ * 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 != undefined) {
+
+ return _instance.dialogueContainer;
+ } else {
+ //TODO DI 11/05/05 Raise error if mc hasn't been created
+ Debugger.log("dialogue undefined: " + _instance, Debugger.CRITICAL, "dialogue", "ApplicationParent");
+ }
+ }
+
+ public function set dialogueContainer(a:MovieClip):Void{
+ _dialogueContainer_mc = a;
+ }
+
+ public function get dialogueContainer():MovieClip {
+ Debugger.log("check application root: " + _root, Debugger.CRITICAL, "dialogueContainer", "ApplicationParent");
+ if(_dialogueContainer_mc == undefined || _dialogueContainer_mc == null) _dialogueContainer_mc = _root.createEmptyMovieClip('_dialogueContainer_mc', DIALOGUE_DEPTH);
+ return _dialogueContainer_mc;
+ }
+
+ public function get dialog():MovieClip {
+ return _currentDialog;
+ }
+
+ public function set dialog(a:MovieClip) {
+ _currentDialog = a;
+ }
+
+ public function get controlKeyPressed():String{
+ return _controlKeyPressed;
+ }
+
+ public function set controlKeyPressed(key:String){
+ _controlKeyPressed = key;
+ }
+
+ public static function isRTL():Boolean {
+ Debugger.log("root direction: " + _root.direction, Debugger.CRITICAL, "isRTL", "ApplicationParent");
+ return (_root.direction == ApplicationParent.RTL);
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/CommonCanvasView.as
===================================================================
diff -u -rd065d513d8d620f940a0adb75935ebc5553cc276 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/CommonCanvasView.as (.../CommonCanvasView.as) (revision d065d513d8d620f940a0adb75935ebc5553cc276)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/CommonCanvasView.as (.../CommonCanvasView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -24,7 +24,7 @@
import org.lamsfoundation.lams.common.dict.*;
import org.lamsfoundation.lams.common.ui.*;
import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.mvc.*;
import org.lamsfoundation.lams.authoring.DesignDataModel;
import org.lamsfoundation.lams.authoring.cv.*;
import org.lamsfoundation.lams.monitoring.mv.*;
@@ -49,21 +49,21 @@
private var model:Observable;
private var controller:Controller;
-
- private var _cm:CanvasModel;
- private var _mm:MonitorModel;
+ private var _cm:CanvasModel;
+ private var _mm:MonitorModel;
+
private var bkg_pnl:Panel;
- private var _content_mc:MovieClip;
- private var _branch_content_mc:MovieClip;
- private var _complex_viewer_mc:MovieClip;
+ private var _content_mc:MovieClip;
+ private var _branch_content_mc:MovieClip;
+ private var _complex_viewer_mc:MovieClip;
private var _gridLayer_mc:MovieClip;
private var _transitionLayer_mc:MovieClip;
private var _activityLayer_mc:MovieClip;
- private var _activityComplexLayer_mc:MovieClip;
-
+ private var _activityComplexLayer_mc:MovieClip;
+
private var _transparentCover_mc:MovieClip;
private var _transitionPropertiesOK:Function;
@@ -74,7 +74,7 @@
public var removeEventListener:Function;
public function CommonCanvasView (m:Observable, c:Controller) {
- super(m, c);
+ super(m, c);
mx.events.EventDispatcher.initialize(this);
}
@@ -90,9 +90,9 @@
var ca = ICanvasActivity(m.selectedItem);
var a:Activity = ca.activity;
var module = (model instanceof MonitorModel) ? MonitorModel(model).getMonitor() : CanvasModel(model).getCanvas();
-
- Debugger.log("prevSelectedItem : " + m.prevSelectedItem.activity.title, Debugger.CRITICAL, "highlightActivity", "CommonCanvasView");
-
+
+ Debugger.log("prevSelectedItem : " + m.prevSelectedItem.activity.title, Debugger.CRITICAL, "highlightActivity", "CommonCanvasView");
+
// deselect previously selected item
if(m.prevSelectedItem != null) {
// if child of an complex activity is previously selected, it is easiest to clear all the children
@@ -118,20 +118,20 @@
}
}
-
- public function onTransparentCoverClick(evt:Object):Void {
- var _model = getModel();
-
- var m = (_model instanceof MonitorModel) ? MonitorModel(_model) : null;
- m = (_model instanceof CanvasModel) ? CanvasModel(_model) : m;
-
- Debugger.log("active view: " + m.activeView, Debugger.CRITICAL, "onTransparentcoverClick", "CommonCanvasView");
- Debugger.log("running transparent click: " + m.activeView instanceof CanvasComplexView, Debugger.CRITICAL, "onTransparentcoverClick", "CommonCanvasView");
-
- if(m.activeView instanceof CanvasComplexView)
- m.activeView.close();
- }
+ public function onTransparentCoverClick(evt:Object):Void {
+ var _model = getModel();
+
+ var m = (_model instanceof MonitorModel) ? MonitorModel(_model) : null;
+ m = (_model instanceof CanvasModel) ? CanvasModel(_model) : m;
+
+ Debugger.log("active view: " + m.activeView, Debugger.CRITICAL, "onTransparentcoverClick", "CommonCanvasView");
+ Debugger.log("running transparent click: " + m.activeView instanceof CanvasComplexView, Debugger.CRITICAL, "onTransparentcoverClick", "CommonCanvasView");
+
+ if(m.activeView instanceof CanvasComplexView)
+ m.activeView.close();
+ }
+
private function initDrawTempTrans(){
Debugger.log("Initialising drawing temp. Transition", Debugger.GEN, "initDrawTempTrans", "CommonCanvasView");
@@ -140,9 +140,9 @@
activityLayer.attachMovie("squareHandle", "h2", activityLayer.getNextHighestDepth());
activityLayer.h1._x = content._xmouse;
- activityLayer.h1._y = content._ymouse;
+ activityLayer.h1._y = content._ymouse;
- Debugger.log("content: " + content, Debugger.GEN, "initDrawTempTrans", "CommonCanvasView");
+ Debugger.log("content: " + content, Debugger.GEN, "initDrawTempTrans", "CommonCanvasView");
activityLayer.tempTrans.onEnterFrame = drawTempTrans;
@@ -158,15 +158,15 @@
this.clear();
- Debugger.log("Runtime movieclips cleared from CanvasView: clear()", Debugger.GEN, "drawTempTrans", "CommonCanvasView");
+ Debugger.log("Runtime movieclips cleared from CanvasView: clear()", Debugger.GEN, "drawTempTrans", "CommonCanvasView");
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;
+ _parent.h2._y = _parent._parent._ymouse - 3;
}
-
+
public function removeTempTrans(){
Debugger.log("Stopped drawing temp. Transition", Debugger.GEN, "removeTempTrans", "CommonCanvasView");
delete activityLayer.tempTrans.onEnterFrame;
@@ -208,35 +208,35 @@
public function get content():MovieClip {
- return _content_mc;
+ return _content_mc;
}
public function set content(a:MovieClip):Void {
- _content_mc = a;
+ _content_mc = a;
}
-
- public function get branchContent():MovieClip {
- return _branch_content_mc;
- }
-
- public function set branchContent(a:MovieClip):Void {
- _branch_content_mc = a;
- }
-
- public function get complexViewer():MovieClip {
- return _complex_viewer_mc;
- }
-
- public function set complexViewer(a:MovieClip):Void {
- _complex_viewer_mc = a;
- }
+ public function get branchContent():MovieClip {
+ return _branch_content_mc;
+ }
+
+ public function set branchContent(a:MovieClip):Void {
+ _branch_content_mc = a;
+ }
+
+ public function get complexViewer():MovieClip {
+ return _complex_viewer_mc;
+ }
+
+ public function set complexViewer(a:MovieClip):Void {
+ _complex_viewer_mc = a;
+ }
+
public function get activityLayer():MovieClip {
- return _activityLayer_mc;
+ return _activityLayer_mc;
}
public function set activityLayer(a:MovieClip):Void {
- _activityLayer_mc = a;
+ _activityLayer_mc = a;
}
public function get activityComplexLayer():MovieClip {
@@ -248,11 +248,11 @@
}
public function get gridLayer():MovieClip {
- return _gridLayer_mc;
+ return _gridLayer_mc;
}
public function set gridLayer(a:MovieClip):Void {
- _gridLayer_mc = a;
+ _gridLayer_mc = a;
}
public function get transitionLayer():MovieClip {
@@ -262,28 +262,28 @@
public function set transitionLayer(a:MovieClip):Void {
_transitionLayer_mc = a;
}
-
- public function get transparentCover():MovieClip {
- return _transparentCover_mc;
- }
-
- public function set transparentCover(a:MovieClip):Void {
- _transparentCover_mc = a;
- }
-
- public function isActivityOnLayer(a:MovieClip, layers:Array) {
- for(var i=0; i0) {
- var beginPos:Number = 0;
- var endPos:Number = text_str.indexOf('=');
- var obj_str:String = text_str.substr(0,endPos);
- var prop = text_str.substr(endPos+1,text_str.length-endPos);
- var o:String = '_root'
- var p:String = '_root._x';
- var val:String = '500'
- } else {
- traceMsg('Missing = sign or invalid string');
- }
}
-
- /**
- * Evaluates a user defined string to an object, serializes the result and prints it
- */
- private function serialize() {
- //Get the text to assign
- var text_str:String = input_ti.text;
- //Need the text before equals
- var obj:Object = eval(text_str);
- if(obj) {
- //Check if toData or itemToData (for config class) methods exist
- if(obj.toData || obj.itemToData){
- if(obj.itemToData){
- var data = obj.itemToData();
- } else {
- var data = obj.toData();
- }
- //Get comms and serialize object
- var comms = ApplicationParent.getInstance().getComms();
- var sx:String = comms.serializeObj(data);
-
- //Write out the serialized object
- messages_ta.html=false;
- traceMsg('serializing \n' + input_ti.text +'\n \n' + sx);
- messages_ta.html=true;
-
- //Copy to clipboard
- System.setClipboard(sx);
- }else {
- traceMsg("no 'toData' or 'itemToData' method or found for :" + text_str);
- }
- } else {
- traceMsg("can't find object :" + text_str);
- }
- }
-
- private function crashDumpToServer(){
- Debugger.crashDataDump();
-
- }
-
- /**
- * Shows the properties of the object entered into the textInput
- */
- function showProperties() {
- var text_str:String = input_ti.text;
- if(text_str != '' || text_str!=undefined ) {
- // ASSetPropFlags(_global, null, 6, 1);
- //Eval the target
- var target = eval(text_str);
- var i=0;
- if(target!=undefined) {
- traceMsg(text_str + ' = ' + target);
- for (var x in target) {
- i++;
- traceMsg(i add '.obj: ' add [x] add ' val: ' add target[x]);
- }
- } else {
- traceMsg("Can't find " add text_str);
- }
- }
- }
-
- /**
- * traces a message to the debug text area
- */
- private function traceMsg(msg:String) {
- messages_ta.text+= msg;
- messages_ta.vPosition = messages_ta.maxVPosition;
- }
-
- /**
- * Clears the text in the text area
- */
- private function clearText() {
- messages_ta.text = '';
- }
+ //This will make the assignment
+ private function assignProperty() {
+ //Get the text to assign
+ var text_str:String = input_ti.text;
+
+ if(text_str != '' && text_str!=undefined && text_str.indexOf('=')>0) {
+ var beginPos:Number = 0;
+ var endPos:Number = text_str.indexOf('=');
+ var obj_str:String = text_str.substr(0,endPos);
+ var prop = text_str.substr(endPos+1,text_str.length-endPos);
+ var o:String = '_root'
+ var p:String = '_root._x';
+ var val:String = '500'
+ } else {
+ traceMsg('Missing = sign or invalid string');
+ }
+ }
+
/**
+ * Evaluates a user defined string to an object, serializes the result and prints it
+ */
+ private function serialize() {
+ //Get the text to assign
+ var text_str:String = input_ti.text;
+ //Need the text before equals
+ var obj:Object = eval(text_str);
+ if(obj) {
+ //Check if toData or itemToData (for config class) methods exist
+ if(obj.toData || obj.itemToData){
+ if(obj.itemToData){
+ var data = obj.itemToData();
+ } else {
+ var data = obj.toData();
+ }
+ //Get comms and serialize object
+ var comms = ApplicationParent.getInstance().getComms();
+ var sx:String = comms.serializeObj(data);
+
+ //Write out the serialized object
+ messages_ta.html=false;
+ traceMsg('serializing \n' + input_ti.text +'\n \n' + sx);
+ messages_ta.html=true;
+
+ //Copy to clipboard
+ System.setClipboard(sx);
+ }else {
+ traceMsg("no 'toData' or 'itemToData' method or found for :" + text_str);
+ }
+ } else {
+ traceMsg("can't find object :" + text_str);
+ }
+ }
+
+ private function crashDumpToServer(){
+ Debugger.crashDataDump();
+
+ }
+
+ /**
+ * Shows the properties of the object entered into the textInput
+ */
+ function showProperties() {
+ var text_str:String = input_ti.text;
+ if(text_str != '' || text_str!=undefined ) {
+ // ASSetPropFlags(_global, null, 6, 1);
+ //Eval the target
+ var target = eval(text_str);
+ var i=0;
+ if(target!=undefined) {
+ traceMsg(text_str + ' = ' + target);
+ for (var x in target) {
+ i++;
+ traceMsg(i add '.obj: ' add [x] add ' val: ' add target[x]);
+ }
+ } else {
+ traceMsg("Can't find " add text_str);
+ }
+ }
+ }
+
+ /**
+ * traces a message to the debug text area
+ */
+ private function traceMsg(msg:String) {
+ messages_ta.text+= msg;
+ messages_ta.vPosition = messages_ta.maxVPosition;
+ }
+
+ /**
+ * Clears the text in the text area
+ */
+ private function clearText() {
+ messages_ta.text = '';
+ }
+
+ /**
* Called by the cancel button
*/
private function cancel(){
//close parent window
- _container.deletePopUp();
+ _container.deletePopUp();
}
/**
* Called by the OK button
*/
private function ok(){
- //close popup
- _container.deletePopUp();
- }
-
- private function loadHandler(){
- //load some wddx and
- var url_str:String = input_ti.text;
- var comms = ApplicationParent.getInstance().getComms();
- comms.getRequest(url_str,testLoadXMLLoaded,true);
- }
-
- /**
- * XML onLoad handler for data
- */
- private function testLoadXMLLoaded (dto:Object){
- _global.breakpoint();
- var test=dto;
- ObjectUtils.printObject(dto);
- }
-
- /**
- * Clean up on unload
- */
- private function onUnload(){
- //Remove event listeners from debug
- debug.removeEventListener('update',onDebugUpdate);
- themeManager.removeEventListener('themeChanged',themeChanged);
- }
+ //close popup
+ _container.deletePopUp();
+ }
+
+ private function loadHandler(){
+ //load some wddx and
+ var url_str:String = input_ti.text;
+ var comms = ApplicationParent.getInstance().getComms();
+ comms.getRequest(url_str,testLoadXMLLoaded,true);
+ }
+
+ /**
+ * XML onLoad handler for data
+ */
+ private function testLoadXMLLoaded (dto:Object){
+ _global.breakpoint();
+ var test=dto;
+ ObjectUtils.printObject(dto);
+ }
+
+ /**
+ * Clean up on unload
+ */
+ private function onUnload(){
+ //Remove event listeners from debug
+ debug.removeEventListener('update',onDebugUpdate);
+ themeManager.removeEventListener('themeChanged',themeChanged);
+ }
/**
* Event dispatched by parent container when close button clicked
@@ -341,23 +341,23 @@
*/
public function setSize(w:Number,h:Number):Void{
//Debugger.log('setSize',Debugger.GEN,'setSize','org.lamsfoundation.lams.common.ws.WorkspaceDialog');
- if(w>400 && h>260){
- //Size the panel
- panel.setSize(w,h);
-
- //Buttons
+ if(w>400 && h>260){
+ //Size the panel
+ panel.setSize(w,h);
+
+ //Buttons
ok_btn.move(w-xOkOffset-20,h-yOkOffset-20);
- cancel_btn.move(w-xCancelOffset-20,h-yCancelOffset-20);
-
- //Resize text area
- messages_ta.setSize(w-40,h-133);
-
- //align buttons
- clear_btn._y = showProps_btn._y = serialize_btn._y = assign_btn._y = load_btn._y = h - 75;
- sendData_btn._y = h - 35;
- input_ti.setSize(w-40,input_ti.height);
- input_ti._y = h - 104;
- }
+ cancel_btn.move(w-xCancelOffset-20,h-yCancelOffset-20);
+
+ //Resize text area
+ messages_ta.setSize(w-40,h-133);
+
+ //align buttons
+ clear_btn._y = showProps_btn._y = serialize_btn._y = assign_btn._y = load_btn._y = h - 75;
+ sendData_btn._y = h - 35;
+ input_ti.setSize(w-40,input_ti.height);
+ input_ti._y = h - 104;
+ }
}
//Gets+Sets
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/LearnerActivity.as
===================================================================
diff -u -raa7fb007420fc9abcf974fd750fc50c6c25cb0ae -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/LearnerActivity.as (.../LearnerActivity.as) (revision aa7fb007420fc9abcf974fd750fc50c6c25cb0ae)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/LearnerActivity.as (.../LearnerActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,585 +1,585 @@
-/***************************************************************************
- * 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.mvc.*;
-import org.lamsfoundation.lams.common.style.*;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.ui.*;
-
-import org.lamsfoundation.lams.learner.ls.*;
-
-import org.lamsfoundation.lams.monitoring.mv.*;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView;
-
-import org.lamsfoundation.lams.authoring.Activity;
-import org.lamsfoundation.lams.authoring.ComplexActivity;
-import org.lamsfoundation.lams.authoring.GateActivity;
-import org.lamsfoundation.lams.authoring.SequenceActivity;
-
-import com.polymercode.Draw;
-
-import mx.managers.*
-import mx.containers.*;
-import mx.events.*
-import mx.utils.*
-import mx.controls.*
-
-/**
-* LearnerActivity
-*
-* This class represets and controls the display of a simple tool or system activity in the Learner's progress bar.
-* The Progress Bar is displayed in the Learner application and in the Monitor application (Learner tab).
-*
-* A simple movieclip is displayed in the progess bar using an icon to identify the status of the activity in the progress bar.
-* This class can also be nested within a LCA (Learner Complex Activity) at multiple levels.
-*
-*/
-class LearnerActivity extends MovieClip {
-
- public static var GATE_ACTIVITY_HEIGHT:Number =50;
- public static var GATE_ACTIVITY_WIDTH:Number = 50;
- public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
- public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
-
- public static var LABEL_X:Number = 0;
- public static var LABEL_Y:Number = 10;
- public static var LABEL_W:Number = 130;
- public static var LABEL_H:Number = 22;
-
- private var xPos:Number;
- private var yPos:Number;
-
- //this is set by the init object
- private var _controller:AbstractController;
- private var _view:AbstractView;
-
- private var _activity:Activity; //TODO:This should be ToolActivity
- private var _isSelected:Boolean;
-
- private var app:ApplicationParent;
- private var _tm:ThemeManager;
- private var _tip:ToolTip;
-
- //locals
- private var tooltipTitle:String;
- private var actStatus:String;
- private var actLabel:String;
- private var learner:Progress;
- private var clickTarget_mc:MovieClip;
- private var completed_mc:MovieClip;
- private var current_mc:MovieClip;
- private var todo_mc:MovieClip;
- private var attempted_mc:MovieClip;
- private var canvasActivity_mc:MovieClip;
- private var title_lbl:MovieClip;
- private var groupIcon_mc:MovieClip;
- private var stopSign_mc:MovieClip;
- private var sentFrom:String;
- private var canvasActivityGrouped_mc:MovieClip;
- private var _dcStartTime:Number = 0;
- private var _doubleClickInterval:Number;
- private var _doubleClicking:Boolean;
- private var _visibleWidth:Number;
- private var _visibleHeight:Number;
- private var _base_mc:MovieClip;
- private var _selected_mc:MovieClip;
-
- private var _line_bottom:MovieClip;
- private var _line_top:MovieClip;
-
- // Identifies if the activity is a child of a complex activity and therefore nested inside a LCA and the level it is nested at.
- private var _complex:Boolean;
- private var _level:Number;
-
- /* Constructor */
- function LearnerActivity(){
- Debugger.log("_activity:"+_activity.title,4,'Constructor','LearnerActivity');
- Debugger.log("actStatus:"+ actStatus,4,'Constructor','LearnerActivity');
- Debugger.log("learner:"+ learner,4,'Constructor','LearnerActivity');
-
- _tm = ThemeManager.getInstance();
- _tip = new ToolTip();
-
- _dcStartTime = new Date().getTime();
-
- //Get reference to application and design data model
- app = ApplicationParent.getInstance();
-
- //let it wait one frame to set up the components.
- //this has to be set b4 the do later :)
- if(_activity.isGateActivity()){
- _visibleHeight = LearnerActivity.GATE_ACTIVITY_HEIGHT;
- _visibleWidth = LearnerActivity.GATE_ACTIVITY_WIDTH;
- } else if(_activity.isGroupActivity() || _activity.isBranchingActivity()) {
- _visibleHeight = LearnerActivity.TOOL_ACTIVITY_HEIGHT;
- _visibleWidth = LearnerActivity.TOOL_ACTIVITY_WIDTH;
- }
-
- //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();
- }
-
- }
-
- /**
- * Setup and draw the component.
- *
- */
- public function init(initObj):Void{
- var styleObj = _tm.getStyleObject('smallLabel');
- var _autosize:String;
-
- if(initObj){
- _view = initObj._view;
- _controller = initObj._controller;
- _activity = initObj._activity;
- learner = initObj.learner;
- }
-
- if(_complex){
- _autosize = "left";
- LABEL_X = 18;
- LABEL_Y = 2;
- } else {
- LABEL_X = 0
- LABEL_Y = 10
- _autosize = "center";
- }
- if (actLabel == undefined){
- tooltipTitle = _activity.title;
- }else {
- tooltipTitle = actLabel;
- }
-
- title_lbl = this.attachMovie("Label", "Label"+_activity.activityID, this.getNextHighestDepth(), {_x:LABEL_X , _y:LABEL_Y, _width:LABEL_W, _height:LABEL_H, autoSize:_autosize, styleName:styleObj});
-
- showAssets(false);
-
- MovieClipUtils.doLater(Proxy.create(this, draw));
-
- }
-
- private function showAssets(isVisible:Boolean){
- completed_mc._visible = isVisible;
- current_mc._visible = isVisible;
- canvasActivity_mc._visible = isVisible;
- todo_mc._visible = isVisible;
- attempted_mc._visible = isVisible
- title_lbl._visible = true;
- }
-
- /**
- * Updates the LearnerActivity display fields with the current data
- * @usage
- * @return
- */
- public function refresh():Void{
- showAssets(false);
- learner = (model instanceof LessonModel) ? model.progressData : learner;
- actStatus = null;
-
- draw();
- }
-
- /**
- * Clear this component.
- *
- */
-
- public function destroy():Void {
- title_lbl.removeMovieClip();
- this._visible = false;
- this.removeMovieClip();
- }
-
- /**
- * Does the work of laying out the screen assets, displaying the title label and setting the progress icon.
- *
- */
- private function draw(){
-
- var toolTitle:String;
- if (actStatus == null || actStatus == undefined){
- actStatus = Progress.compareProgressData(learner, _activity.activityID);
- }
-
- Debugger.log("activity: " + _activity.activityID + " // activity status : " + actStatus, Debugger.CRITICAL,'draw','org.lamsfoundation.lams.LearnerActivity');
-
- clickTarget_mc._visible = true;
-
- switch (actStatus){
- case 'completed_mc' :
- completed_mc._visible = true;
- break;
- case 'current_mc' :
- current_mc._visible = true;
- break;
- case 'attempted_mc' :
- attempted_mc._visible = true;
- break;
- default :
- todo_mc._visible = true;
- }
-
- //write text
- if (actLabel == undefined){
- toolTitle = _activity.title;
- }else {
- toolTitle = actLabel;
- }
-
- Debugger.log("parent level: " + _parent._parent.level, Debugger.CRITICAL, "draw", "LearnerActivity");
-
- // Using a dash to indicate level depth when nested inside a LCA
-
- if(_parent._parent.level > 0) {
- for(var i=0; i<(_parent._parent.level + _parent._parent.complexLevel); i++)
- toolTitle = "-" + toolTitle;
- }
-
- if(level > 0)
- for(var i=0; i 18){
- toolTitle = toolTitle.substr(0, 16)+"...";
- }
-
- title_lbl.text = toolTitle;
-
- // Continue drawing the next activity in the design if on top level.
- if(_view instanceof LearnerTabView && !_complex)
- LearnerTabView(_view).drawNext();
-
- }
-
- /**
- * Display the tooltip.
- *
- */
-
- public function showToolTip(btnObj, ttMessage:String):Void{
- Debugger.log("showToolTip invoked", Debugger.CRITICAL, "showToolTip", "LearnerActivity");
- var appData = getAppData();
- if(_complex){
- var ttXpos = appData.compX + xPos;
- var ttYpos = appData.compY + yPos;
- } else {
- if(app.module == 'learner'){
- var ttXpos = appData.compX + this._x-10;
- }else {
- var ttXpos = appData.compX + this._x;
- }
- var targetHeightOffset:Number = (btnObj._height == undefined) ? 15 : btnObj._height;
- var ttYpos = appData.compY + this._y+targetHeightOffset;
- }
-
- var ttHolder = appData.ttHolder;
- Debugger.log("ttHolder: "+ttHolder, Debugger.CRITICAL, "showToolTip", "LearnerActivity");
-
- if (ttMessage == undefined || ttMessage == null || ttMessage == "" || ttMessage == "undefined"){
- ttMessage = ""+ _activity.title+"";
- } else {
- ttMessage = ""+ _activity.title+"\n" + ttMessage;
- }
-
- var ttWidth = 140;
- _tip.DisplayToolTip(ttHolder, ttMessage, ttXpos, ttYpos, undefined, ttWidth);
-
- }
-
- /**
- * Hide the tooltip.
- *
- */
-
- public function hideToolTip():Void{
- _tip.CloseToolTip();
- }
-
- /**
- * Handles the rollOver event and displays a tooltip for the activity.
- *
- */
-
- private function onRollOver(){
- if (actStatus == "completed_mc"){
- showToolTip(this.clickTarget_mc, Dictionary.getValue("completed_act_tooltip"));
-
- }else if (actStatus == "current_mc"){
- showToolTip(this.clickTarget_mc, Dictionary.getValue("current_act_tooltip"));
-
- }else { // Handle tooltips for not yet attempted activities
- var attemptedActs:Array = learner.getAttemptedActivities();
- var attempted:Boolean = false;
- for (var i=0; ionPress: (now - _dcStartTime)"+(now - _dcStartTime), Debugger.GEN, "onPress", "LearnerActivity");
-
- if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
- _doubleClicking = true;
- if (_doubleClickInterval != null && _doubleClickInterval != undefined) {
- clearInterval(_doubleClickInterval);
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- }
- c.activityDoubleClick(this);
- Debugger.log('DoubleClicking:+'+this,Debugger.GEN,'onPress','LearnerActivity');
- }else{
- Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','LearnerActivity');
- _doubleClicking = false;
- }
-
- _dcStartTime = now;
-
- hideToolTip();
-
- }
-
- /**
- * Handles the onRelease event.
- * Assists with setting active sequence/complex activities of a LCA when the component is manually selected to be opened/closed.
- *
- */
-
- public function onRelease():Void{
- var c = (_controller instanceof LessonController) ? LessonController(_controller) : MonitorController(_controller);
-
- if(!_doubleClicking){
- Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','LearnerActivity');
- Debugger.log('Is sequence:'+this.activity.isSequenceActivity(),Debugger.GEN,'onRelease','LearnerActivity');
-
- Debugger.log('cmap:'+LearnerComplexActivity(_parent._parent).sequenceMap,Debugger.CRITICAL,'onRelease','LearnerActivity');
- Debugger.log('cmap length:'+LearnerComplexActivity(_parent._parent).sequenceMap.values().length,Debugger.CRITICAL,'onRelease','LearnerActivity');
-
- Debugger.log('activity uiid:'+this.activity.activityUIID,Debugger.CRITICAL,'onRelease','LearnerActivity');
- Debugger.log('c value :'+ LearnerComplexActivity(_parent._parent).sequenceMap.containsValue(SequenceActivity(this.activity)),Debugger.CRITICAL,'onRelease','LearnerActivity');
- Debugger.log('c title :'+ LearnerComplexActivity(_parent._parent).sequenceMap.values()[0].title,Debugger.CRITICAL,'onRelease','LearnerActivity');
-
-
- var activeComplex = LearnerComplexActivity(_parent._parent).complexMap.get(this.activity.activityUIID);
- var activeSequence = LearnerComplexActivity(_parent._parent).sequenceMap.get(this.activity.activityUIID);
-
- if(this.activity.isSequenceActivity()) {
- Debugger.log('parent :'+this._parent._parent, Debugger.CRITICAL,'onRelease','LearnerActivity');
- Debugger.log('activeSequence:'+activeSequence, Debugger.CRITICAL,'onRelease','LearnerActivity');
-
- if(LearnerComplexActivity(this._parent._parent).activity.activityUIID == this.activity.parentUIID) {
-
- _doubleClickInterval = setInterval(Proxy.create(this, selectActiveSequence, activeSequence), (Config.DOUBLE_CLICK_DELAY - 100));
- Cursor.showCursor(ApplicationParent.C_HOURGLASS);
- }
- } else if(this.activity.isOptionsWithSequencesActivity() || this.activity.isOptionalActivity() || this.activity.isParallelActivity() || this.activity.isBranchingActivity()) {
- Debugger.log('activeComplex:'+activeComplex, Debugger.CRITICAL,'onRelease','LearnerActivity');
-
- if(model.findParent(this.activity, LearnerComplexActivity(this._parent._parent).activity) || (activeSequence.activityUIID == this.activity.parentUIID)) {
- if(activeComplex != null) {
- // close current active complex
- LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputComplex(null, null, true);
- } else {
- // open complex
- LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputComplex(this.activity, this.level, true);
- }
- }
- }
-
- c.activityRelease(this);
-
- }
-
- }
-
- private function selectActiveSequence(activeSequence):Void {
-
- if (_doubleClickInterval != null && _doubleClickInterval != undefined) {
- clearInterval(_doubleClickInterval);
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- }
-
- LearnerComplexActivity(this._parent._parent).setActiveComplex(null); //****
-
- if(activeSequence) {
- // close current active sequence
- LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputSequence(null, true);
- } else {
- // open sequence
- LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputSequence(this.activity, true);
- }
- }
-
- public function onReleaseOutside():Void{
- Debugger.log('ReleasingOutside:'+this,Debugger.GEN,'onReleaseOutside','LearnerActivity');
-
- controller.activityReleaseOutside(this);
- }
-
- public function set progressData(a:Progress){
- learner = a;
- }
-
- public function get controller(){
- if(_controller instanceof LessonController){
- return LessonController(_controller);
- } else {
- return MonitorController(_controller);
- }
- }
-
- public function set controller(a:AbstractController){
- _controller = a;
- }
-
- public function get model(){
- if(app.module == 'learner')
- return LessonModel(_controller.getModel());
- else
- return MonitorModel(_controller.getModel());
- }
-
- public function getAppData():Object{
- return controller.appData;
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function getVisibleWidth ():Number {
- return _visibleWidth;
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function getVisibleHeight ():Number {
- return _visibleHeight;
- }
-
- 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;
- }
-
- public function get activityStatus():String{
- return actStatus;
- }
-
- public function set activityStatus(a:String){
- actStatus = a;
- }
-
- public function get learnerID():Number{
- return learner.getLearnerId();
- }
-
- public function get learnerName():String{
- return learner.getFullName();
- }
-
- public function set lineTopVisible(a:Boolean):Void {
- _line_top._visible = a;
- }
-
- public function set lineBottomVisible(a:Boolean):Void {
- _line_bottom._visible = a;
- }
-
- public function get isCurrent():Boolean {
- return (actStatus == 'current_mc');
- }
-
- public function get isCompleted():Boolean {
- return (actStatus == 'completed_mc');
- }
-
- public function get isAttempted():Boolean {
- return (actStatus == 'attempted_mc');
- }
-
- public function get level():Number {
- return _level;
- }
+/***************************************************************************
+ * 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.mvc.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+
+import org.lamsfoundation.lams.learner.ls.*;
+
+import org.lamsfoundation.lams.monitoring.mv.*;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView;
+
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.ComplexActivity;
+import org.lamsfoundation.lams.authoring.GateActivity;
+import org.lamsfoundation.lams.authoring.SequenceActivity;
+
+import com.polymercode.Draw;
+
+import mx.managers.*
+import mx.containers.*;
+import mx.events.*
+import mx.utils.*
+import mx.controls.*
+
+/**
+* LearnerActivity
+*
+* This class represets and controls the display of a simple tool or system activity in the Learner's progress bar.
+* The Progress Bar is displayed in the Learner application and in the Monitor application (Learner tab).
+*
+* A simple movieclip is displayed in the progess bar using an icon to identify the status of the activity in the progress bar.
+* This class can also be nested within a LCA (Learner Complex Activity) at multiple levels.
+*
+*/
+class LearnerActivity extends MovieClip {
+
+ public static var GATE_ACTIVITY_HEIGHT:Number =50;
+ public static var GATE_ACTIVITY_WIDTH:Number = 50;
+ public static var TOOL_ACTIVITY_WIDTH:Number = 123.1;
+ public static var TOOL_ACTIVITY_HEIGHT:Number = 50.5;
+
+ public static var LABEL_X:Number = 0;
+ public static var LABEL_Y:Number = 10;
+ public static var LABEL_W:Number = 130;
+ public static var LABEL_H:Number = 22;
+
+ private var xPos:Number;
+ private var yPos:Number;
+
+ //this is set by the init object
+ private var _controller:AbstractController;
+ private var _view:AbstractView;
+
+ private var _activity:Activity; //TODO:This should be ToolActivity
+ private var _isSelected:Boolean;
+
+ private var app:ApplicationParent;
+ private var _tm:ThemeManager;
+ private var _tip:ToolTip;
+
+ //locals
+ private var tooltipTitle:String;
+ private var actStatus:String;
+ private var actLabel:String;
+ private var learner:Progress;
+ private var clickTarget_mc:MovieClip;
+ private var completed_mc:MovieClip;
+ private var current_mc:MovieClip;
+ private var todo_mc:MovieClip;
+ private var attempted_mc:MovieClip;
+ private var canvasActivity_mc:MovieClip;
+ private var title_lbl:MovieClip;
+ private var groupIcon_mc:MovieClip;
+ private var stopSign_mc:MovieClip;
+ private var sentFrom:String;
+ private var canvasActivityGrouped_mc:MovieClip;
+ private var _dcStartTime:Number = 0;
+ private var _doubleClickInterval:Number;
+ private var _doubleClicking:Boolean;
+ private var _visibleWidth:Number;
+ private var _visibleHeight:Number;
+ private var _base_mc:MovieClip;
+ private var _selected_mc:MovieClip;
+
+ private var _line_bottom:MovieClip;
+ private var _line_top:MovieClip;
+
+ // Identifies if the activity is a child of a complex activity and therefore nested inside a LCA and the level it is nested at.
+ private var _complex:Boolean;
+ private var _level:Number;
+
+ /* Constructor */
+ function LearnerActivity(){
+ Debugger.log("_activity:"+_activity.title,4,'Constructor','LearnerActivity');
+ Debugger.log("actStatus:"+ actStatus,4,'Constructor','LearnerActivity');
+ Debugger.log("learner:"+ learner,4,'Constructor','LearnerActivity');
+
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+
+ _dcStartTime = new Date().getTime();
+
+ //Get reference to application and design data model
+ app = ApplicationParent.getInstance();
+
+ //let it wait one frame to set up the components.
+ //this has to be set b4 the do later :)
+ if(_activity.isGateActivity()){
+ _visibleHeight = LearnerActivity.GATE_ACTIVITY_HEIGHT;
+ _visibleWidth = LearnerActivity.GATE_ACTIVITY_WIDTH;
+ } else if(_activity.isGroupActivity() || _activity.isBranchingActivity()) {
+ _visibleHeight = LearnerActivity.TOOL_ACTIVITY_HEIGHT;
+ _visibleWidth = LearnerActivity.TOOL_ACTIVITY_WIDTH;
+ }
+
+ //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();
+ }
+
+ }
+
+ /**
+ * Setup and draw the component.
+ *
+ */
+ public function init(initObj):Void{
+ var styleObj = _tm.getStyleObject('smallLabel');
+ var _autosize:String;
+
+ if(initObj){
+ _view = initObj._view;
+ _controller = initObj._controller;
+ _activity = initObj._activity;
+ learner = initObj.learner;
+ }
+
+ if(_complex){
+ _autosize = "left";
+ LABEL_X = 18;
+ LABEL_Y = 2;
+ } else {
+ LABEL_X = 0
+ LABEL_Y = 10
+ _autosize = "center";
+ }
+ if (actLabel == undefined){
+ tooltipTitle = _activity.title;
+ }else {
+ tooltipTitle = actLabel;
+ }
+
+ title_lbl = this.attachMovie("Label", "Label"+_activity.activityID, this.getNextHighestDepth(), {_x:LABEL_X , _y:LABEL_Y, _width:LABEL_W, _height:LABEL_H, autoSize:_autosize, styleName:styleObj});
+
+ showAssets(false);
+
+ MovieClipUtils.doLater(Proxy.create(this, draw));
+
+ }
+
+ private function showAssets(isVisible:Boolean){
+ completed_mc._visible = isVisible;
+ current_mc._visible = isVisible;
+ canvasActivity_mc._visible = isVisible;
+ todo_mc._visible = isVisible;
+ attempted_mc._visible = isVisible
+ title_lbl._visible = true;
+ }
+
+ /**
+ * Updates the LearnerActivity display fields with the current data
+ * @usage
+ * @return
+ */
+ public function refresh():Void{
+ showAssets(false);
+ learner = (model instanceof LessonModel) ? model.progressData : learner;
+ actStatus = null;
+
+ draw();
+ }
+
+ /**
+ * Clear this component.
+ *
+ */
+
+ public function destroy():Void {
+ title_lbl.removeMovieClip();
+ this._visible = false;
+ this.removeMovieClip();
+ }
+
+ /**
+ * Does the work of laying out the screen assets, displaying the title label and setting the progress icon.
+ *
+ */
+ private function draw(){
+
+ var toolTitle:String;
+ if (actStatus == null || actStatus == undefined){
+ actStatus = Progress.compareProgressData(learner, _activity.activityID);
+ }
+
+ Debugger.log("activity: " + _activity.activityID + " // activity status : " + actStatus, Debugger.CRITICAL,'draw','org.lamsfoundation.lams.LearnerActivity');
+
+ clickTarget_mc._visible = true;
+
+ switch (actStatus){
+ case 'completed_mc' :
+ completed_mc._visible = true;
+ break;
+ case 'current_mc' :
+ current_mc._visible = true;
+ break;
+ case 'attempted_mc' :
+ attempted_mc._visible = true;
+ break;
+ default :
+ todo_mc._visible = true;
+ }
+
+ //write text
+ if (actLabel == undefined){
+ toolTitle = _activity.title;
+ }else {
+ toolTitle = actLabel;
+ }
+
+ Debugger.log("parent level: " + _parent._parent.level, Debugger.CRITICAL, "draw", "LearnerActivity");
+
+ // Using a dash to indicate level depth when nested inside a LCA
+
+ if(_parent._parent.level > 0) {
+ for(var i=0; i<(_parent._parent.level + _parent._parent.complexLevel); i++)
+ toolTitle = "-" + toolTitle;
+ }
+
+ if(level > 0)
+ for(var i=0; i 18){
+ toolTitle = toolTitle.substr(0, 16)+"...";
+ }
+
+ title_lbl.text = toolTitle;
+
+ // Continue drawing the next activity in the design if on top level.
+ if(_view instanceof LearnerTabView && !_complex)
+ LearnerTabView(_view).drawNext();
+
+ }
+
+ /**
+ * Display the tooltip.
+ *
+ */
+
+ public function showToolTip(btnObj, ttMessage:String):Void{
+ Debugger.log("showToolTip invoked", Debugger.CRITICAL, "showToolTip", "LearnerActivity");
+ var appData = getAppData();
+ if(_complex){
+ var ttXpos = appData.compX + xPos;
+ var ttYpos = appData.compY + yPos;
+ } else {
+ if(app.module == 'learner'){
+ var ttXpos = appData.compX + this._x-10;
+ }else {
+ var ttXpos = appData.compX + this._x;
+ }
+ var targetHeightOffset:Number = (btnObj._height == undefined) ? 15 : btnObj._height;
+ var ttYpos = appData.compY + this._y+targetHeightOffset;
+ }
+
+ var ttHolder = appData.ttHolder;
+ Debugger.log("ttHolder: "+ttHolder, Debugger.CRITICAL, "showToolTip", "LearnerActivity");
+
+ if (ttMessage == undefined || ttMessage == null || ttMessage == "" || ttMessage == "undefined"){
+ ttMessage = ""+ _activity.title+"";
+ } else {
+ ttMessage = ""+ _activity.title+"\n" + ttMessage;
+ }
+
+ var ttWidth = 140;
+ _tip.DisplayToolTip(ttHolder, ttMessage, ttXpos, ttYpos, undefined, ttWidth);
+
+ }
+
+ /**
+ * Hide the tooltip.
+ *
+ */
+
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ /**
+ * Handles the rollOver event and displays a tooltip for the activity.
+ *
+ */
+
+ private function onRollOver(){
+ if (actStatus == "completed_mc"){
+ showToolTip(this.clickTarget_mc, Dictionary.getValue("completed_act_tooltip"));
+
+ }else if (actStatus == "current_mc"){
+ showToolTip(this.clickTarget_mc, Dictionary.getValue("current_act_tooltip"));
+
+ }else { // Handle tooltips for not yet attempted activities
+ var attemptedActs:Array = learner.getAttemptedActivities();
+ var attempted:Boolean = false;
+ for (var i=0; ionPress: (now - _dcStartTime)"+(now - _dcStartTime), Debugger.GEN, "onPress", "LearnerActivity");
+
+ if((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY){
+ _doubleClicking = true;
+ if (_doubleClickInterval != null && _doubleClickInterval != undefined) {
+ clearInterval(_doubleClickInterval);
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ }
+ c.activityDoubleClick(this);
+ Debugger.log('DoubleClicking:+'+this,Debugger.GEN,'onPress','LearnerActivity');
+ }else{
+ Debugger.log('SingleClicking:+'+this,Debugger.GEN,'onPress','LearnerActivity');
+ _doubleClicking = false;
+ }
+
+ _dcStartTime = now;
+
+ hideToolTip();
+
+ }
+
+ /**
+ * Handles the onRelease event.
+ * Assists with setting active sequence/complex activities of a LCA when the component is manually selected to be opened/closed.
+ *
+ */
+
+ public function onRelease():Void{
+ var c = (_controller instanceof LessonController) ? LessonController(_controller) : MonitorController(_controller);
+
+ if(!_doubleClicking){
+ Debugger.log('Releasing:'+this,Debugger.GEN,'onRelease','LearnerActivity');
+ Debugger.log('Is sequence:'+this.activity.isSequenceActivity(),Debugger.GEN,'onRelease','LearnerActivity');
+
+ Debugger.log('cmap:'+LearnerComplexActivity(_parent._parent).sequenceMap,Debugger.CRITICAL,'onRelease','LearnerActivity');
+ Debugger.log('cmap length:'+LearnerComplexActivity(_parent._parent).sequenceMap.values().length,Debugger.CRITICAL,'onRelease','LearnerActivity');
+
+ Debugger.log('activity uiid:'+this.activity.activityUIID,Debugger.CRITICAL,'onRelease','LearnerActivity');
+ Debugger.log('c value :'+ LearnerComplexActivity(_parent._parent).sequenceMap.containsValue(SequenceActivity(this.activity)),Debugger.CRITICAL,'onRelease','LearnerActivity');
+ Debugger.log('c title :'+ LearnerComplexActivity(_parent._parent).sequenceMap.values()[0].title,Debugger.CRITICAL,'onRelease','LearnerActivity');
+
+
+ var activeComplex = LearnerComplexActivity(_parent._parent).complexMap.get(this.activity.activityUIID);
+ var activeSequence = LearnerComplexActivity(_parent._parent).sequenceMap.get(this.activity.activityUIID);
+
+ if(this.activity.isSequenceActivity()) {
+ Debugger.log('parent :'+this._parent._parent, Debugger.CRITICAL,'onRelease','LearnerActivity');
+ Debugger.log('activeSequence:'+activeSequence, Debugger.CRITICAL,'onRelease','LearnerActivity');
+
+ if(LearnerComplexActivity(this._parent._parent).activity.activityUIID == this.activity.parentUIID) {
+
+ _doubleClickInterval = setInterval(Proxy.create(this, selectActiveSequence, activeSequence), (Config.DOUBLE_CLICK_DELAY - 100));
+ Cursor.showCursor(ApplicationParent.C_HOURGLASS);
+ }
+ } else if(this.activity.isOptionsWithSequencesActivity() || this.activity.isOptionalActivity() || this.activity.isParallelActivity() || this.activity.isBranchingActivity()) {
+ Debugger.log('activeComplex:'+activeComplex, Debugger.CRITICAL,'onRelease','LearnerActivity');
+
+ if(model.findParent(this.activity, LearnerComplexActivity(this._parent._parent).activity) || (activeSequence.activityUIID == this.activity.parentUIID)) {
+ if(activeComplex != null) {
+ // close current active complex
+ LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputComplex(null, null, true);
+ } else {
+ // open complex
+ LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputComplex(this.activity, this.level, true);
+ }
+ }
+ }
+
+ c.activityRelease(this);
+
+ }
+
+ }
+
+ private function selectActiveSequence(activeSequence):Void {
+
+ if (_doubleClickInterval != null && _doubleClickInterval != undefined) {
+ clearInterval(_doubleClickInterval);
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ }
+
+ LearnerComplexActivity(this._parent._parent).setActiveComplex(null); //****
+
+ if(activeSequence) {
+ // close current active sequence
+ LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputSequence(null, true);
+ } else {
+ // open sequence
+ LearnerComplexActivity(this._parent._parent).removeAllChildrenAndInputSequence(this.activity, true);
+ }
+ }
+
+ public function onReleaseOutside():Void{
+ Debugger.log('ReleasingOutside:'+this,Debugger.GEN,'onReleaseOutside','LearnerActivity');
+
+ controller.activityReleaseOutside(this);
+ }
+
+ public function set progressData(a:Progress){
+ learner = a;
+ }
+
+ public function get controller(){
+ if(_controller instanceof LessonController){
+ return LessonController(_controller);
+ } else {
+ return MonitorController(_controller);
+ }
+ }
+
+ public function set controller(a:AbstractController){
+ _controller = a;
+ }
+
+ public function get model(){
+ if(app.module == 'learner')
+ return LessonModel(_controller.getModel());
+ else
+ return MonitorModel(_controller.getModel());
+ }
+
+ public function getAppData():Object{
+ return controller.appData;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleWidth ():Number {
+ return _visibleWidth;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getVisibleHeight ():Number {
+ return _visibleHeight;
+ }
+
+ 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;
+ }
+
+ public function get activityStatus():String{
+ return actStatus;
+ }
+
+ public function set activityStatus(a:String){
+ actStatus = a;
+ }
+
+ public function get learnerID():Number{
+ return learner.getLearnerId();
+ }
+
+ public function get learnerName():String{
+ return learner.getFullName();
+ }
+
+ public function set lineTopVisible(a:Boolean):Void {
+ _line_top._visible = a;
+ }
+
+ public function set lineBottomVisible(a:Boolean):Void {
+ _line_bottom._visible = a;
+ }
+
+ public function get isCurrent():Boolean {
+ return (actStatus == 'current_mc');
+ }
+
+ public function get isCompleted():Boolean {
+ return (actStatus == 'completed_mc');
+ }
+
+ public function get isAttempted():Boolean {
+ return (actStatus == 'attempted_mc');
+ }
+
+ public function get level():Number {
+ return _level;
+ }
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/LearnerComplexActivity.as
===================================================================
diff -u -r10766a6dfd47dea5597012f7a34c090d099e15c2 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/LearnerComplexActivity.as (.../LearnerComplexActivity.as) (revision 10766a6dfd47dea5597012f7a34c090d099e15c2)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/LearnerComplexActivity.as (.../LearnerComplexActivity.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -20,69 +20,69 @@
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
*/
-import org.lamsfoundation.lams.common.*;
-import org.lamsfoundation.lams.common.dict.*;
-import org.lamsfoundation.lams.common.mvc.*;
-import org.lamsfoundation.lams.common.style.*;
-import org.lamsfoundation.lams.common.util.*;
-import org.lamsfoundation.lams.common.ui.*;
-
-import org.lamsfoundation.lams.authoring.Activity;
-import org.lamsfoundation.lams.authoring.ComplexActivity;
-import org.lamsfoundation.lams.authoring.DesignDataModel;
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.dict.*;
+import org.lamsfoundation.lams.common.mvc.*;
+import org.lamsfoundation.lams.common.style.*;
+import org.lamsfoundation.lams.common.util.*;
+import org.lamsfoundation.lams.common.ui.*;
+
+import org.lamsfoundation.lams.authoring.Activity;
+import org.lamsfoundation.lams.authoring.ComplexActivity;
+import org.lamsfoundation.lams.authoring.DesignDataModel;
import org.lamsfoundation.lams.authoring.SequenceActivity;
-import org.lamsfoundation.lams.authoring.cv.ICanvasActivity;
-
-import org.lamsfoundation.lams.learner.Application;
-import org.lamsfoundation.lams.learner.ls.*;
-
-import org.lamsfoundation.lams.monitoring.mv.MonitorController;
-import org.lamsfoundation.lams.monitoring.mv.MonitorModel;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView;
-import org.lamsfoundation.lams.monitoring.mv.tabviews.LessonTabView;
+import org.lamsfoundation.lams.authoring.cv.ICanvasActivity;
+import org.lamsfoundation.lams.learner.Application;
+import org.lamsfoundation.lams.learner.ls.*;
+
+import org.lamsfoundation.lams.monitoring.mv.MonitorController;
+import org.lamsfoundation.lams.monitoring.mv.MonitorModel;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.LearnerTabView;
+import org.lamsfoundation.lams.monitoring.mv.tabviews.LessonTabView;
+
import mx.controls. *;
-import mx.managers. *;
+import mx.managers. *;
/**
-* LearnerComplexActivity
-*
-* This class represents and controls the complex activity presentation in the Learner Progress Bar.
-* The Progress Bar is displayed in the Learner application and in the Monitor application (Learner tab).
-*
-* A complex activity can have multiple children, this class displays the children of the complex activity (_activity) in a linear/vertical
-* way with only the single level shown in the progress component. However, for any children of a complex type another instance of this class is
-* nested to represent and control this child activity.
-*
-* This class is designed to handle multiple complex children and uses two local variables to identify the active ones for a Sequence Activity
-* (_activeSequence) and Complex Activity (_activeComplex).
-*
+* LearnerComplexActivity
*
+* This class represents and controls the complex activity presentation in the Learner Progress Bar.
+* The Progress Bar is displayed in the Learner application and in the Monitor application (Learner tab).
+*
+* A complex activity can have multiple children, this class displays the children of the complex activity (_activity) in a linear/vertical
+* way with only the single level shown in the progress component. However, for any children of a complex type another instance of this class is
+* nested to represent and control this child activity.
+*
+* This class is designed to handle multiple complex children and uses two local variables to identify the active ones for a Sequence Activity
+* (_activeSequence) and Complex Activity (_activeComplex).
+*
+*
*/
-
+
class LearnerComplexActivity 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 LABEL_W:Number = 130;
- private var LABEL_H:Number = 22;
-
- // Set by the init obj
- private var _controller:AbstractController;
- private var _view:AbstractView;
- private var _tip:ToolTip;
+ private var LABEL_W:Number = 130;
+ private var LABEL_H:Number = 22;
+
+ // Set by the init obj
+ private var _controller:AbstractController;
+ private var _view:AbstractView;
+ private var _tip:ToolTip;
+
// Set by the init obj - the complex/sequence activity and children array
private var _activity:Activity;
private var _children:Array;
//refs to screen items:
private var container_pnl:MovieClip;
- private var title_lbl:MovieClip;
+ private var title_lbl:MovieClip;
private var labelHolder_mc:MovieClip;
-
+
private var actStatus:String;
private var childActivities_mc : MovieClip;
private var complexActivity_mc : MovieClip;
@@ -96,10 +96,10 @@
private var learner:Progress;
private var containerPanelHeader:MovieClip;
private var completed_mc:MovieClip;
- private var current_mc:MovieClip;
+ private var current_mc:MovieClip;
private var attempted_mc:MovieClip;
private var todo_mc:MovieClip;
- private var childHolder_mc:MovieClip;
+ private var childHolder_mc:MovieClip;
private var children_mc:Array
//---------------------------//
@@ -108,519 +108,519 @@
private var _visibleWidth:Number;
private var _tm:ThemeManager;
- private var _ddm:DesignDataModel;
- private var app:ApplicationParent;
-
- // Identify if activity is nested inside another active LCA and at the depth level
- private var _nested:Boolean;
- private var _level:Number;
- private var _complexLevel:Number;
-
- // Current active sequence/complex activities
- private var _activeSequence:SequenceActivity;
- private var _activeComplex:ComplexActivity;
-
- // Map tracking of open, nested sequence/complex activities.
- private var activeSequenceMap:Hashtable;
- private var activeComplexMap:Hashtable;
-
- private var delegates:Array;
+ private var _ddm:DesignDataModel;
+ private var app:ApplicationParent;
+
+ // Identify if activity is nested inside another active LCA and at the depth level
+ private var _nested:Boolean;
+ private var _level:Number;
+ private var _complexLevel:Number;
+
+ // Current active sequence/complex activities
+ private var _activeSequence:SequenceActivity;
+ private var _activeComplex:ComplexActivity;
+
+ // Map tracking of open, nested sequence/complex activities.
+ private var activeSequenceMap:Hashtable;
+ private var activeComplexMap:Hashtable;
+
+ private var delegates:Array;
private var _manualSelect:Boolean;
- private var lockedRefresh:Boolean;
-
+ private var lockedRefresh:Boolean;
+
/* Constructor */
function LearnerComplexActivity () {
- complexActivity_mc = this;
-
- _activeSequence = null;
- _activeComplex = null;
-
- activeSequenceMap = new Hashtable("activeSequenceMap");
- activeComplexMap = new Hashtable("activeComplexMap");
+ complexActivity_mc = this;
- _manualSelect = false;
-
- app = ApplicationParent.getInstance();
-
+ _activeSequence = null;
+ _activeComplex = null;
+
+ activeSequenceMap = new Hashtable("activeSequenceMap");
+ activeComplexMap = new Hashtable("activeComplexMap");
+
+ _manualSelect = false;
+
+ app = ApplicationParent.getInstance();
+
_visible = false;
-
- _tm = ThemeManager.getInstance();
- _tip = new ToolTip();
+ _tm = ThemeManager.getInstance();
+ _tip = new ToolTip();
+
_visibleHeight = container_pnl._height;
- _visibleWidth = container_pnl._width;
-
- if(!_nested)
- _level = 0;
-
- if(_complexLevel == null)
- _complexLevel = 0;
-
+ _visibleWidth = container_pnl._width;
+
+ if(!_nested)
+ _level = 0;
+
+ if(_complexLevel == null)
+ _complexLevel = 0;
+
init();
}
-
- /**
- * Setup the components labels and events and start processing the children.
- *
- */
- public function init():Void {
- var styleObj = _tm.getStyleObject('smallLabel');
- title_lbl = labelHolder_mc.attachMovie("Label", "actTitle", this.getNextHighestDepth(), {_width:LABEL_W, _height:LABEL_H, autoSize:"center", styleName:styleObj});
-
- children_mc = new Array();
- delegates = new Array();
-
- var childrenArray:Array;
- childActivities_mc = this;
-
- _locked = false;
- lockedRefresh = false;
-
- showStatus(false);
-
- // click target events
- clickTarget_mc.onRollOver = Proxy.create(this, localOnRollOver);
+ /**
+ * Setup the components labels and events and start processing the children.
+ *
+ */
+
+ public function init():Void {
+ var styleObj = _tm.getStyleObject('smallLabel');
+ title_lbl = labelHolder_mc.attachMovie("Label", "actTitle", this.getNextHighestDepth(), {_width:LABEL_W, _height:LABEL_H, autoSize:"center", styleName:styleObj});
+
+ children_mc = new Array();
+ delegates = new Array();
+
+ var childrenArray:Array;
+ childActivities_mc = this;
+
+ _locked = false;
+ lockedRefresh = false;
+
+ showStatus(false);
+
+ // click target events
+ 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(_activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE){
- if(_children[0].orderID < _children[1].orderID){
- childrenArray = orderParallelActivities(_children[0],_children[1]);
- } else {
- childrenArray = orderParallelActivities(_children[1],_children[0]);
- }
- } else {
- childrenArray = _children;
- }
-
- // draw the children and any nested LCA's
- createChildren(childrenArray);
- clearDelegates();
-
+ clickTarget_mc.onReleaseOutside = Proxy.create(this, localOnReleaseOutside);
+
+ if(_activity.activityTypeID == Activity.PARALLEL_ACTIVITY_TYPE){
+ if(_children[0].orderID < _children[1].orderID){
+ childrenArray = orderParallelActivities(_children[0],_children[1]);
+ } else {
+ childrenArray = orderParallelActivities(_children[1],_children[0]);
+ }
+ } else {
+ childrenArray = _children;
+ }
+
+ // draw the children and any nested LCA's
+ createChildren(childrenArray);
+ clearDelegates();
+
childHolder_mc._visible = (!_nested) ? false : true;
- }
-
- /**
- * Run through and call all the functions pushed to the delegates array for processing.
- * Used to control the order of drawing the children when nested LCA's are open/active.
- */
-
- private function clearDelegates():Void {
- if(delegates.length > 0) {
- MovieClipUtils.doLater(Function(delegates.shift()));
- } else {
- MovieClipUtils.doLater(Proxy.create(this, draw, Proxy.create(this, checkIfSequenceActive)))
- return;
- }
-
- MovieClipUtils.doLater(Proxy.create(this, clearDelegates));
- }
-
- /**
- * Drawing the children activites in this complex object.
- *
- * @param _children Array of children activities
- * @param index Index position to start iteration
- */
-
- private function createChildren(_children:Array, index:Number):Void {
-
- var rIndex:Number = drawChildren(_children, index);
-
- // rIndex returns not null the function needs to be set for later processing at the array position it had to halt.
- if(rIndex != null) delegates.push(Proxy.create(this, createChildren, _children, rIndex));
-
- return;
- }
-
- /**
- * Main function for drawing the MovieClip to represent the children activities. Complex type children will create a nested LCA.
- * Identifies when a active/open sequence (of Optional Sequence for example) is reached and halts for later processing, to control
- * drawing order and timing.
- *
- * @param _children Array of children activities
- * @param index Index position to start iteration
- *
- * @return The index location where the function had to halt due to inserting of a sequence or LCA (complex activity).
- *
- */
-
- private function drawChildren(_children:Array, index:Number):Number {
- var childCoordY:Number = 0;
-
- Debugger.log("draw children: " + _children.length + " :: index: " + index + " :: level: " + _level, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
- var _idx=0;
- if(index != null) _idx = index;
-
- for(var i=_idx; i<_children.length; i++) {
- var learnerAct;
-
- var progStatus:String = Progress.compareProgressData(learner, _children[i].activityID);
- var parentAct:Activity = (model instanceof LessonModel) ? model.learningDesignModel.getActivityByUIID(Activity(_children[i]).parentUIID) : model.ddm.getActivityByUIID(Activity(_children[i]).parentUIID);
-
- if(complexMap.containsKey(_children[i].activityUIID) && _activeComplex == null) {
- _activeComplex = complexMap.get(_children[i].activityUIID);
- _complexLevel = _children[i].level;
- }
-
- if(sequenceMap.containsKey(_children[i].activityUIID) && _activeSequence == null)
- _activeSequence = sequenceMap.get(_children[i].activityUIID);
-
- if(children_mc.length > 0)
- childCoordY = (children_mc[children_mc.length-1] instanceof LearnerComplexActivity) ? children_mc[children_mc.length-1]._y + children_mc[children_mc.length-1].getChildrenHeight() : children_mc[children_mc.length-1]._y + 21; // (count*21);
-
- Debugger.log("progStatus: " + progStatus, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
- var _newLevel:Number = (parentAct.isOptionalSequenceActivity(activity) || parentAct.isSequenceActivity()) ? 1 : 0;
- learnerAct = LearnerActivity(childHolder_mc.createChildAtDepth("LearnerActivity_forComplex", childHolder_mc.getNextHighestDepth(), {_activity:_children[i], _controller:_controller, _view:_view, learner:learner, actStatus:progStatus, _complex:true, _level: _newLevel, xPos:this._x, yPos:childCoordY}));
-
- Debugger.log('newLevel:' + _newLevel,Debugger.CRITICAL,'drawChildren','LearnerComplexActivity');
- Debugger.log('attaching child movieL ' + learnerAct,Debugger.CRITICAL,'drawChildren','LearnerComplexActivity');
-
- //set the positioning co-ords
- if(children_mc.length > 0)
- learnerAct._y = (children_mc[children_mc.length-1].nested) ? children_mc[children_mc.length-1]._y + children_mc[children_mc.length-1].getChildrenHeight() : children_mc[children_mc.length-1]._y + 21;
- else
- learnerAct._y = 0;
-
- learnerAct._visible = true;
-
- if((activity.isBranchingActivity() && parentAct.isSequenceActivity()) || (activity.isOptionsWithSequencesActivity() && parentAct.isSequenceActivity())) {
- learnerAct.lineTopVisible = (i != 0) ? false : true;
- learnerAct.lineBottomVisible = (i == _children.length-1) ? true : false;
- }
-
- children_mc.push(learnerAct);
-
- Debugger.log("activeSequence : " + activeSequence, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
- Debugger.log("activeComplex : " + activeComplex, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
- Debugger.log("activeComplex test: " + (learnerAct.activity.activityUIID == activeComplex.activityUIID), Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
- Debugger.log("activeSequence test: " + (learnerAct.activity.activityUIID == activeSequence.activityUIID), Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
- Debugger.log("activeSequence firstUIID: " + SequenceActivity(activeSequence).firstActivityUIID, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
-
- if(learnerAct.activity.activityUIID == activeSequence.activityUIID && SequenceActivity(activeSequence).firstActivityUIID != null) {
- Debugger.log("test: activeseq", Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
- var actOrder:Array = model.getDesignOrder(SequenceActivity(activeSequence).firstActivityUIID, true);
- createChildren(actOrder, null);
-
- return i+1;
-
- } else if(learnerAct.activity.activityUIID == activeComplex.activityUIID) {
- Debugger.log("test: activecompl", Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
- var _cChildren:Array = (model instanceof LessonModel) ? model.learningDesignModel.getComplexActivityChildren(activeComplex.activityUIID) : model.ddm.getComplexActivityChildren(activeComplex.activityUIID);
-
- Debugger.log("learner level: " + _level, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
- Debugger.log("learner complex level: " + _complexLevel, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
- learnerAct = LearnerComplexActivity(childHolder_mc.createChildAtDepth("LearnerComplexActivity_Nested", DepthManager.kTop, {_activity:_children[i], _children:_cChildren, _controller:_controller, _view:_view, learner:learner, actStatus:progStatus, _nested:true, _level: _level+1, _complexLevel:_complexLevel, _x:0, _y:childCoordY+21}));
- children_mc.push(learnerAct);
-
- return i+1;
- } else {
- Debugger.log("test: unknown", Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
-
- }
-
- }
-
- return null;
-
}
-
- /**
- * Not currently in use due to a nested LCA being used to display the active Branch sequence.
- *
- * @deprecated
- */
- private function drawActiveBranch(learnerAct:LearnerActivity):Void {
- var _cChildren:Array = model.ddm.getComplexActivityChildren(learnerAct.activity.activityUIID);
-
- for(var i=0; i<_cChildren.length; i++) {
- var progressStr:String = Progress.compareProgressData(learner, _cChildren[i].activityID);
-
- if(progressStr == 'attempted_mc' || progressStr == 'completed_mc') {
- var actOrder:Array = model.getDesignOrder(SequenceActivity(_cChildren[i]).firstActivityUIID, true);
- actOrder.unshift(_cChildren[i]);
-
- createChildren(actOrder);
-
- return;
- }
- }
- }
-
- /**
- * Progress status of the complex activity.
- *
- * @usage
- * @param isVisible
- * @return
- */
+ /**
+ * Run through and call all the functions pushed to the delegates array for processing.
+ * Used to control the order of drawing the children when nested LCA's are open/active.
+ */
+
+ private function clearDelegates():Void {
+ if(delegates.length > 0) {
+ MovieClipUtils.doLater(Function(delegates.shift()));
+ } else {
+ MovieClipUtils.doLater(Proxy.create(this, draw, Proxy.create(this, checkIfSequenceActive)))
+ return;
+ }
+
+ MovieClipUtils.doLater(Proxy.create(this, clearDelegates));
+ }
+
+ /**
+ * Drawing the children activites in this complex object.
+ *
+ * @param _children Array of children activities
+ * @param index Index position to start iteration
+ */
+
+ private function createChildren(_children:Array, index:Number):Void {
+
+ var rIndex:Number = drawChildren(_children, index);
+
+ // rIndex returns not null the function needs to be set for later processing at the array position it had to halt.
+ if(rIndex != null) delegates.push(Proxy.create(this, createChildren, _children, rIndex));
+
+ return;
+ }
+
+ /**
+ * Main function for drawing the MovieClip to represent the children activities. Complex type children will create a nested LCA.
+ * Identifies when a active/open sequence (of Optional Sequence for example) is reached and halts for later processing, to control
+ * drawing order and timing.
+ *
+ * @param _children Array of children activities
+ * @param index Index position to start iteration
+ *
+ * @return The index location where the function had to halt due to inserting of a sequence or LCA (complex activity).
+ *
+ */
+
+ private function drawChildren(_children:Array, index:Number):Number {
+ var childCoordY:Number = 0;
+
+ Debugger.log("draw children: " + _children.length + " :: index: " + index + " :: level: " + _level, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+ var _idx=0;
+ if(index != null) _idx = index;
+
+ for(var i=_idx; i<_children.length; i++) {
+ var learnerAct;
+
+ var progStatus:String = Progress.compareProgressData(learner, _children[i].activityID);
+ var parentAct:Activity = (model instanceof LessonModel) ? model.learningDesignModel.getActivityByUIID(Activity(_children[i]).parentUIID) : model.ddm.getActivityByUIID(Activity(_children[i]).parentUIID);
+
+ if(complexMap.containsKey(_children[i].activityUIID) && _activeComplex == null) {
+ _activeComplex = complexMap.get(_children[i].activityUIID);
+ _complexLevel = _children[i].level;
+ }
+
+ if(sequenceMap.containsKey(_children[i].activityUIID) && _activeSequence == null)
+ _activeSequence = sequenceMap.get(_children[i].activityUIID);
+
+ if(children_mc.length > 0)
+ childCoordY = (children_mc[children_mc.length-1] instanceof LearnerComplexActivity) ? children_mc[children_mc.length-1]._y + children_mc[children_mc.length-1].getChildrenHeight() : children_mc[children_mc.length-1]._y + 21; // (count*21);
+
+ Debugger.log("progStatus: " + progStatus, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+ var _newLevel:Number = (parentAct.isOptionalSequenceActivity(activity) || parentAct.isSequenceActivity()) ? 1 : 0;
+ learnerAct = LearnerActivity(childHolder_mc.createChildAtDepth("LearnerActivity_forComplex", childHolder_mc.getNextHighestDepth(), {_activity:_children[i], _controller:_controller, _view:_view, learner:learner, actStatus:progStatus, _complex:true, _level: _newLevel, xPos:this._x, yPos:childCoordY}));
+
+ Debugger.log('newLevel:' + _newLevel,Debugger.CRITICAL,'drawChildren','LearnerComplexActivity');
+ Debugger.log('attaching child movieL ' + learnerAct,Debugger.CRITICAL,'drawChildren','LearnerComplexActivity');
+
+ //set the positioning co-ords
+ if(children_mc.length > 0)
+ learnerAct._y = (children_mc[children_mc.length-1].nested) ? children_mc[children_mc.length-1]._y + children_mc[children_mc.length-1].getChildrenHeight() : children_mc[children_mc.length-1]._y + 21;
+ else
+ learnerAct._y = 0;
+
+ learnerAct._visible = true;
+
+ if((activity.isBranchingActivity() && parentAct.isSequenceActivity()) || (activity.isOptionsWithSequencesActivity() && parentAct.isSequenceActivity())) {
+ learnerAct.lineTopVisible = (i != 0) ? false : true;
+ learnerAct.lineBottomVisible = (i == _children.length-1) ? true : false;
+ }
+
+ children_mc.push(learnerAct);
+
+ Debugger.log("activeSequence : " + activeSequence, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+ Debugger.log("activeComplex : " + activeComplex, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+ Debugger.log("activeComplex test: " + (learnerAct.activity.activityUIID == activeComplex.activityUIID), Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+ Debugger.log("activeSequence test: " + (learnerAct.activity.activityUIID == activeSequence.activityUIID), Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+ Debugger.log("activeSequence firstUIID: " + SequenceActivity(activeSequence).firstActivityUIID, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+
+ if(learnerAct.activity.activityUIID == activeSequence.activityUIID && SequenceActivity(activeSequence).firstActivityUIID != null) {
+ Debugger.log("test: activeseq", Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+ var actOrder:Array = model.getDesignOrder(SequenceActivity(activeSequence).firstActivityUIID, true);
+ createChildren(actOrder, null);
+
+ return i+1;
+
+ } else if(learnerAct.activity.activityUIID == activeComplex.activityUIID) {
+ Debugger.log("test: activecompl", Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+ var _cChildren:Array = (model instanceof LessonModel) ? model.learningDesignModel.getComplexActivityChildren(activeComplex.activityUIID) : model.ddm.getComplexActivityChildren(activeComplex.activityUIID);
+
+ Debugger.log("learner level: " + _level, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+ Debugger.log("learner complex level: " + _complexLevel, Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+ learnerAct = LearnerComplexActivity(childHolder_mc.createChildAtDepth("LearnerComplexActivity_Nested", DepthManager.kTop, {_activity:_children[i], _children:_cChildren, _controller:_controller, _view:_view, learner:learner, actStatus:progStatus, _nested:true, _level: _level+1, _complexLevel:_complexLevel, _x:0, _y:childCoordY+21}));
+ children_mc.push(learnerAct);
+
+ return i+1;
+ } else {
+ Debugger.log("test: unknown", Debugger.CRITICAL, "drawChildren", "LearnerComplexActivity");
+
+ }
+
+ }
+
+ return null;
+
+ }
+
+ /**
+ * Not currently in use due to a nested LCA being used to display the active Branch sequence.
+ *
+ * @deprecated
+ */
+ private function drawActiveBranch(learnerAct:LearnerActivity):Void {
+ var _cChildren:Array = model.ddm.getComplexActivityChildren(learnerAct.activity.activityUIID);
+
+ for(var i=0; i<_cChildren.length; i++) {
+ var progressStr:String = Progress.compareProgressData(learner, _cChildren[i].activityID);
+
+ if(progressStr == 'attempted_mc' || progressStr == 'completed_mc') {
+ var actOrder:Array = model.getDesignOrder(SequenceActivity(_cChildren[i]).firstActivityUIID, true);
+ actOrder.unshift(_cChildren[i]);
+
+ createChildren(actOrder);
+
+ return;
+ }
+ }
+ }
+
+ /**
+ * Progress status of the complex activity.
+ *
+ * @usage
+ * @param isVisible
+ * @return
+ */
+
private function showStatus(isVisible:Boolean) {
completed_mc._visible = isVisible;
- current_mc._visible = isVisible;
+ current_mc._visible = isVisible;
attempted_mc._visible = isVisible;
todo_mc._visible = isVisible;
}
-
- /**
- * Refresh and redraw the complex component.
- *
- * @param _clear Set no active sequence/complex activities
- */
-
- public function refresh(_clear:Boolean) {
- if(lockedRefresh) return;
-
- showStatus(false);
-
- learner = (model instanceof LessonModel) ? model.progressData : learner;
- actStatus = null;
-
- if(_clear) {
- activeSequence = null;
- activeComplex = null;
- }
-
- delegates = new Array();
-
- // Not setting an activity active manually (mouse click) then check progress information for further branching or sequence activity updates.
- if(!_manualSelect) {
- checkIfBranchActive();
- checkIfSequenceActive();
- }
-
- draw();
-
- }
-
- /**
- * Checking if the Learner is currently attempting or completed a Branch.
- *
- */
-
- private function checkIfBranchActive():Void {
- for(var i=0; i 19)
- toolTitle = toolTitle.substr(0, 17)+"...";
+ toolTitle = _activity.title;
- title_lbl.text = toolTitle;
-
+ if (toolTitle.length > 19)
+ toolTitle = toolTitle.substr(0, 17)+"...";
+
+ title_lbl.text = toolTitle;
+
containerPanelHeader.title_lbl.text = toolTitle;
-
- var bgcolor = new Color(this.container_pnl.panel);
- var border_color = new Color(this.container_pnl.bg);
-
- var styleObject = _tm.getStyleObject("progressBar");
-
- bgcolor.setRGB(styleObject.colors[_level%styleObject.colors.length].backgroundColor);
- border_color.setRGB(styleObject.colors[_level%styleObject.colors.length].borderColor);
+ var bgcolor = new Color(this.container_pnl.panel);
+ var border_color = new Color(this.container_pnl.bg);
+
+ var styleObject = _tm.getStyleObject("progressBar");
+
+ bgcolor.setRGB(styleObject.colors[_level%styleObject.colors.length].backgroundColor);
+ border_color.setRGB(styleObject.colors[_level%styleObject.colors.length].borderColor);
+
//position the container (this)
container_pnl._height = (_nested) ? getChildrenHeight() : 16 + getChildrenHeight();
- _visible = true;
-
- if(_callback != null)
- _callback();
-
- // If this component is not nested, draw the nested activity in the design.
- if(_view instanceof LearnerTabView && !nested)
- LearnerTabView(_view).drawNext();
+ _visible = true;
+
+ if(_callback != null)
+ _callback();
+
+ // If this component is not nested, draw the nested activity in the design.
+ if(_view instanceof LearnerTabView && !nested)
+ LearnerTabView(_view).drawNext();
- }
-
- /**
- * Display the tooltip.
- */
-
- public function showToolTip(btnObj, btnTT:String):Void{
- var appData = getAppData();
- var Xpos = appData.compX+ this._x - 10;
- var Ypos = appData.compY+( (this._y+btnObj._height)-4);
- var ttHolder = appData.ttHolder;
-
- if (btnTT == undefined || btnTT == null || btnTT == "" || btnTT == "undefined"){
- var ttMessage = ""+ _activity.title+""
- }else {
- var ttMessage = ""+ _activity.title+" \n"+Dictionary.getValue(btnTT);
- }
-
- var ttWidth = 140;
- _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, undefined, ttWidth);
-
- }
-
- /**
- * Hide the tooltip.
- */
- public function hideToolTip():Void{
- _tip.CloseToolTip();
- }
-
- private function localOnRollOver(){
- if(isCompleted){
- showToolTip(this.clickTarget_mc, "completed_act_tooltip");
- } else if(isCurrent){
- showToolTip(this.clickTarget_mc, "current_act_tooltip");
- } else if(isAttempted){
- showToolTip(this.clickTarget_mc, "current_act_tooltip");
- } else {
- if(String(_activity.title).length > 19){
- showToolTip(this.clickTarget_mc, "undefined");
- }
- }
-
- }
-
- private function localOnRollOut(){
- hideToolTip();
}
-
- /**
- * Handles double clicking event.
- *
- * @usage
- * @param noDoubleClick
- * @return
- */
- private function localOnPress(noDoubleClick:Boolean):Void{
+ /**
+ * Display the tooltip.
+ */
+
+ public function showToolTip(btnObj, btnTT:String):Void{
+ var appData = getAppData();
+ var Xpos = appData.compX+ this._x - 10;
+ var Ypos = appData.compY+( (this._y+btnObj._height)-4);
+ var ttHolder = appData.ttHolder;
+
+ if (btnTT == undefined || btnTT == null || btnTT == "" || btnTT == "undefined"){
+ var ttMessage = ""+ _activity.title+""
+ }else {
+ var ttMessage = ""+ _activity.title+" \n"+Dictionary.getValue(btnTT);
+ }
+
+ var ttWidth = 140;
+ _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, undefined, ttWidth);
+
+ }
+
+ /**
+ * Hide the tooltip.
+ */
+ public function hideToolTip():Void{
+ _tip.CloseToolTip();
+ }
+
+ private function localOnRollOver(){
+ if(isCompleted){
+ showToolTip(this.clickTarget_mc, "completed_act_tooltip");
+ } else if(isCurrent){
+ showToolTip(this.clickTarget_mc, "current_act_tooltip");
+ } else if(isAttempted){
+ showToolTip(this.clickTarget_mc, "current_act_tooltip");
+ } else {
+ if(String(_activity.title).length > 19){
+ showToolTip(this.clickTarget_mc, "undefined");
+ }
+ }
+
+ }
+
+ private function localOnRollOut(){
hideToolTip();
-
+ }
+
+ /**
+ * Handles double clicking event.
+ *
+ * @usage
+ * @param noDoubleClick
+ * @return
+ */
+
+ private function localOnPress(noDoubleClick:Boolean):Void{
+ hideToolTip();
+
this.swapDepths(this._parent.getNextHighestDepth());
- // check double-click
+ // check double-click
var now:Number = new Date().getTime();
if ((now - _dcStartTime) <= Config.DOUBLE_CLICK_DELAY) {
Debugger.log ('DoubleClicking:' + this, Debugger.GEN, 'localOnPress', 'LearnerOptionalActivity');
_doubleClicking = true;
-
+
//if we double click on the glass mask - then open the container to allow the usr to see the activities inside.
- draw();
+ draw();
if(!noDoubleClick) controller.activityDoubleClick(this);
-
+
} else {
Debugger.log ('SingleClicking:+' + this, Debugger.GEN, 'localOnPress', 'LearnerOptionalActivity');
_doubleClicking = false;
- }
+ }
_dcStartTime = now;
}
- /**
- * Local mouse release event which opens/closes the component.
- *
- */
+ /**
+ * Local mouse release event which opens/closes the component.
+ *
+ */
private function localOnRelease():Void{
Debugger.log ('_doubleClicking:' + _doubleClicking + ', localOnRelease:' + this, Debugger.GEN, 'localOnRelease', 'LearnerOptionalActivity');
if (_locked && !_doubleClicking){
- collapse();
+ collapse();
if(isLearnerModule()) controller.complexActivityRelease(this, _doubleClicking);
} else {
- expand();
+ expand();
if(isLearnerModule()) controller.complexActivityRelease(this,_doubleClicking);
}
}
private function localOnReleaseOutside():Void {
Debugger.log ('localOnReleaseOutside:' + this, Debugger.GEN, 'localOnReleaseOutside', 'LearnerOptionalActivity');
- }
-
- /**
- * Closes the component to hide the children.
- *
- */
-
- public function collapse():Void{
- _locked = false;
- gotoAndStop('collapse');
- childHolder_mc._visible = false;
- draw();
- }
-
- /**
- * Opens the component to display the children.
- *
- * @usage
- * @return
- */
-
- public function expand():Void{
- _locked = true;
- childHolder_mc._visible = true;
- gotoAndStop('expand')
- draw();
- }
-
- /**
- * Changes order of children.
- *
- * @usage
- * @param child1 First child
- * @param child2 Second child
- * @return new ordered children array
- */
-
- private function orderParallelActivities(child1:Activity, child2:Activity):Array{
- var a:Array = new Array();
- a.push(child1);
- a.push(child2);
-
- return a;
- }
-
- 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;
- }
-
- public function set controller(a:AbstractController){
- _controller = a;
- }
-
- public function get controller(){
- if(_controller instanceof LessonController){
- return LessonController(_controller);
- } else {
- return MonitorController(_controller);
- }
- }
-
- public function getAppData():Object{
- return controller.appData;
- }
-
- public function isLearnerModule():Boolean{
- if(app.module == 'learner'){
- return true;
- } else {
- return false;
- }
- }
-
- public function get model(){
- if(isLearnerModule())
- return LessonModel(_controller.getModel());
- else
- return MonitorModel(_controller.getModel());
- }
-
- public function get activityStatus():String{
- return actStatus;
- }
-
- public function set progressData(a:Progress){
- learner = a;
- }
+ }
/**
+ * Closes the component to hide the children.
+ *
+ */
+
+ public function collapse():Void{
+ _locked = false;
+ gotoAndStop('collapse');
+ childHolder_mc._visible = false;
+ draw();
+ }
+
+ /**
+ * Opens the component to display the children.
+ *
+ * @usage
+ * @return
+ */
+
+ public function expand():Void{
+ _locked = true;
+ childHolder_mc._visible = true;
+ gotoAndStop('expand')
+ draw();
+ }
+
+ /**
+ * Changes order of children.
+ *
+ * @usage
+ * @param child1 First child
+ * @param child2 Second child
+ * @return new ordered children array
+ */
+
+ private function orderParallelActivities(child1:Activity, child2:Activity):Array{
+ var a:Array = new Array();
+ a.push(child1);
+ a.push(child2);
+
+ return a;
+ }
+
+ 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;
+ }
+
+ public function set controller(a:AbstractController){
+ _controller = a;
+ }
+
+ public function get controller(){
+ if(_controller instanceof LessonController){
+ return LessonController(_controller);
+ } else {
+ return MonitorController(_controller);
+ }
+ }
+
+ public function getAppData():Object{
+ return controller.appData;
+ }
+
+ public function isLearnerModule():Boolean{
+ if(app.module == 'learner'){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function get model(){
+ if(isLearnerModule())
+ return LessonModel(_controller.getModel());
+ else
+ return MonitorModel(_controller.getModel());
+ }
+
+ public function get activityStatus():String{
+ return actStatus;
+ }
+
+ public function set progressData(a:Progress){
+ learner = a;
+ }
+
+ /**
*
* @usage
* @return
@@ -885,126 +885,126 @@
}
public function get locked():Boolean {
return _locked;
- }
- public function get activityChildren():Array {
- return _children;
- }
- public function get doubleClicking():Boolean {
- return _doubleClicking;
}
-
- public function setSelected(isSelected) {
- }
+ public function get activityChildren():Array {
+ return _children;
+ }
+ public function get doubleClicking():Boolean {
+ return _doubleClicking;
+ }
- public function get isCurrent():Boolean {
- return (actStatus == 'current_mc');
- }
-
- public function get isCompleted():Boolean {
- return (actStatus == 'completed_mc');
- }
-
- public function get isAttempted():Boolean {
- return (actStatus == 'attempted_mc');
- }
-
- public function get learnerID():Number{
- return learner.getLearnerId();
- }
-
- public function getActiveSequence():SequenceActivity {
- return activeSequence;
- }
-
- public function getActiveComplex():ComplexActivity {
- return activeComplex;
- }
-
- public function setActiveComplex(a:ComplexActivity) {
- activeComplex = a;
- }
-
- public function get nested():Boolean {
- return _nested;
- }
-
- public function get level():Number {
- return _level;
- }
-
- public function get complexLevel():Number {
- return _complexLevel;
- }
-
- public function destroy():Void {
- this._visible = false;
- this.removeMovieClip();
- }
-
- /**
- * Returns height value of the children. Useful for finding the y-position after drawing a nested LCA.
- *
- * @return height
- */
-
- public function getChildrenHeight():Number {
- if(children_mc.length <= 0) return 0;
-
- var cHeight:Number = children_mc[children_mc.length-1]._y;
- cHeight += (children_mc[children_mc.length-1] instanceof LearnerComplexActivity) ? children_mc[children_mc.length-1].getChildrenHeight() : 21;
-
- return cHeight;
- }
-
- /**
- * Sets the active Sequence activity and adds to tracking map.
- *
- * @param a activity
- */
-
- public function set activeSequence(a:SequenceActivity):Void {
- Debugger.log("adding sequence: " + a.activityUIID, Debugger.CRITICAL, "activeSequence", "LearnerComplexActivity");
- if(a != null) sequenceMap.put(a.activityUIID, a);
- if(_activeSequence != null) sequenceMap.remove(SequenceActivity(activeSequence).activityUIID);
-
- Debugger.log("seq map length: " + sequenceMap.size(), Debugger.CRITICAL, "activeSequence", "LearnerComplexActivity");
-
- _activeSequence = a;
- }
-
- /**
- * Sets the active Complex activity and adds to tracking map.
- *
- * @param a activity
- */
-
- public function set activeComplex(a:ComplexActivity):Void {
- Debugger.log("adding complex: " + a.activityUIID, Debugger.CRITICAL, "activeComplex", "LearnerComplexActivity");
-
- if(a != null) complexMap.put(a.activityUIID, a);
- if(_activeComplex != null) complexMap.remove(ComplexActivity(activeComplex).activityUIID);
-
- Debugger.log("complex map length: " + complexMap.size(), Debugger.CRITICAL, "activeComplex", "LearnerComplexActivity");
-
- _activeComplex = a;
- }
-
- public function get activeSequence():SequenceActivity {
- return _activeSequence;
- }
-
- public function get activeComplex():ComplexActivity {
- return _activeComplex;
- }
-
- public function get complexMap():Hashtable {
- Debugger.log("test: " + (_parent._parent instanceof LearnerComplexActivity), Debugger.CRITICAL, "complexMap", "LearnerComplexActivity");
- return (_parent._parent instanceof LearnerComplexActivity) ? Hashtable(LearnerComplexActivity(_parent._parent).complexMap) : activeComplexMap;
- }
-
- public function get sequenceMap():Hashtable {
- Debugger.log("test: " + (_parent._parent instanceof LearnerComplexActivity), Debugger.CRITICAL, "sequenceMap", "LearnerComplexActivity");
- return (_parent._parent instanceof LearnerComplexActivity) ? Hashtable(LearnerComplexActivity(_parent._parent).sequenceMap) : activeSequenceMap;
- }
+ public function setSelected(isSelected) {
+ }
+ public function get isCurrent():Boolean {
+ return (actStatus == 'current_mc');
+ }
+
+ public function get isCompleted():Boolean {
+ return (actStatus == 'completed_mc');
+ }
+
+ public function get isAttempted():Boolean {
+ return (actStatus == 'attempted_mc');
+ }
+
+ public function get learnerID():Number{
+ return learner.getLearnerId();
+ }
+
+ public function getActiveSequence():SequenceActivity {
+ return activeSequence;
+ }
+
+ public function getActiveComplex():ComplexActivity {
+ return activeComplex;
+ }
+
+ public function setActiveComplex(a:ComplexActivity) {
+ activeComplex = a;
+ }
+
+ public function get nested():Boolean {
+ return _nested;
+ }
+
+ public function get level():Number {
+ return _level;
+ }
+
+ public function get complexLevel():Number {
+ return _complexLevel;
+ }
+
+ public function destroy():Void {
+ this._visible = false;
+ this.removeMovieClip();
+ }
+
+ /**
+ * Returns height value of the children. Useful for finding the y-position after drawing a nested LCA.
+ *
+ * @return height
+ */
+
+ public function getChildrenHeight():Number {
+ if(children_mc.length <= 0) return 0;
+
+ var cHeight:Number = children_mc[children_mc.length-1]._y;
+ cHeight += (children_mc[children_mc.length-1] instanceof LearnerComplexActivity) ? children_mc[children_mc.length-1].getChildrenHeight() : 21;
+
+ return cHeight;
+ }
+
+ /**
+ * Sets the active Sequence activity and adds to tracking map.
+ *
+ * @param a activity
+ */
+
+ public function set activeSequence(a:SequenceActivity):Void {
+ Debugger.log("adding sequence: " + a.activityUIID, Debugger.CRITICAL, "activeSequence", "LearnerComplexActivity");
+ if(a != null) sequenceMap.put(a.activityUIID, a);
+ if(_activeSequence != null) sequenceMap.remove(SequenceActivity(activeSequence).activityUIID);
+
+ Debugger.log("seq map length: " + sequenceMap.size(), Debugger.CRITICAL, "activeSequence", "LearnerComplexActivity");
+
+ _activeSequence = a;
+ }
+
+ /**
+ * Sets the active Complex activity and adds to tracking map.
+ *
+ * @param a activity
+ */
+
+ public function set activeComplex(a:ComplexActivity):Void {
+ Debugger.log("adding complex: " + a.activityUIID, Debugger.CRITICAL, "activeComplex", "LearnerComplexActivity");
+
+ if(a != null) complexMap.put(a.activityUIID, a);
+ if(_activeComplex != null) complexMap.remove(ComplexActivity(activeComplex).activityUIID);
+
+ Debugger.log("complex map length: " + complexMap.size(), Debugger.CRITICAL, "activeComplex", "LearnerComplexActivity");
+
+ _activeComplex = a;
+ }
+
+ public function get activeSequence():SequenceActivity {
+ return _activeSequence;
+ }
+
+ public function get activeComplex():ComplexActivity {
+ return _activeComplex;
+ }
+
+ public function get complexMap():Hashtable {
+ Debugger.log("test: " + (_parent._parent instanceof LearnerComplexActivity), Debugger.CRITICAL, "complexMap", "LearnerComplexActivity");
+ return (_parent._parent instanceof LearnerComplexActivity) ? Hashtable(LearnerComplexActivity(_parent._parent).complexMap) : activeComplexMap;
+ }
+
+ public function get sequenceMap():Hashtable {
+ Debugger.log("test: " + (_parent._parent instanceof LearnerComplexActivity), Debugger.CRITICAL, "sequenceMap", "LearnerComplexActivity");
+ return (_parent._parent instanceof LearnerComplexActivity) ? Hashtable(LearnerComplexActivity(_parent._parent).sequenceMap) : activeSequenceMap;
+ }
+
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/PreferencesDialog.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/PreferencesDialog.as (.../PreferencesDialog.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/PreferencesDialog.as (.../PreferencesDialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,36 +1,36 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * 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 mx.events.*
import org.lamsfoundation.lams.common.ws.*
import org.lamsfoundation.lams.common.util.*
import org.lamsfoundation.lams.common.dict.*
import org.lamsfoundation.lams.common.style.*
-import org.lamsfoundation.lams.common.*
+import org.lamsfoundation.lams.common.*
import org.lamsfoundation.lams.authoring.*
/*
@@ -40,7 +40,7 @@
class PreferencesDialog extends MovieClip implements Dialog{
//References to components + clips
- private var _container:MovieClip; //The container window that holds the dialog
+ private var _container:MovieClip; //The container window that holds the dialog
private var cfg:Config; //local config reference
private var ok_btn:Button; //OK+Cancel buttons
@@ -56,24 +56,24 @@
private var fm:FocusManager; //Reference to focus manager
- private var themeManager:ThemeManager; //Theme manager
-
- private var currentLanguage:String; //Language and theme settings for current and new
+ private var themeManager:ThemeManager; //Theme manager
+
+ private var currentLanguage:String; //Language and theme settings for current and new
private var newLanguage:String;
-
- private var currentTheme:String;
- private var newTheme:String;
+
+ private var currentTheme:String;
+ private var newTheme:String;
//Dimensions for resizing
private var xOkOffset:Number;
private var yOkOffset:Number;
private var xCancelOffset:Number;
private var yCancelOffset:Number;
- //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;
+ //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;
/**
@@ -82,23 +82,23 @@
function PreferencesDialog(){
//Set up this class to use the Flash event delegation model
EventDispatcher.initialize(this);
-
- //set up local config reference
- cfg = Config.getInstance();
+
+ //set up local config reference
+ cfg = Config.getInstance();
//Create a clip that will wait a frame before dispatching init to give components time to setup
- this.onEnterFrame = init;
+ this.onEnterFrame = init;
}
/**
* Called a frame after movie attached to allow components to initialise
*/
private function init():Void{
//Delete the enterframe dispatcher
- delete this.onEnterFrame;
-
- //Store current language for rollback if needed
- currentLanguage = newLanguage = String(cfg.getItem('language'));
+ delete this.onEnterFrame;
+
+ //Store current language for rollback if needed
+ currentLanguage = newLanguage = String(cfg.getItem('language'));
currentTheme = newTheme = String(cfg.getItem('theme'));
//set the reference to the StyleManager
@@ -120,7 +120,7 @@
//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));
-
+
//Assign Click (close button) and resize handlers
_container.addEventListener('click',this);
_container.addEventListener('size',this);
@@ -133,76 +133,76 @@
//Register as listener with StyleManager and set Styles
themeManager.addEventListener('themeChanged',this);
- setStyles();
-
- //Populate themes and languages combo
- //Languages is an array containing objects with label and data properties
- var languages = cfg.getItem('languages');
- lang_cb.dataProvider = languages;
-
- //Select current language
- var language = cfg.getItem('language');
-
- //Go through all options to find current language index and select it in combo
- for(var i=0;i this.ttWidth){
- multiline = true;
- wordWrap = true;
- _width = this.ttWidth;
- _height = textHeight + 5;
- }
- _visible = false
- }
-
- var bgwidth = ttHolder.ToolTipHolder.ToolTipText.textWidth + 8;
- var bgheight = ttHolder.ToolTipHolder.ToolTipText.textHeight + 4;
-
- // Create the background on the tool tip
- ttHolder.ToolTipHolder.createEmptyMovieClip("ToolTipBackground", 2);
- with (ttHolder.ToolTipHolder.ToolTipBackground){
- beginFill (this.backgroundcolour, 100);
- lineStyle (1, this.bordercolour, 100);
- moveTo(0, 0);
- lineTo(bgwidth, 0);
- lineTo(bgwidth, bgheight);
- lineTo(0, bgheight);
- lineTo(0, 0);
- endFill();
- }
-
- // Create our shadow (if specified)
- if(shadow == true) {
- with(ttHolder.ToolTipHolder) {
- // Background shadow
- ToolTipBackground.duplicateMovieClip("ToolTipBackgroundShadow", 1);
- with(ToolTipBackgroundShadow){
- _x = ToolTipBackground._x + 2;
- _y = ToolTipBackground._y + 2;
- _alpha = 30;
- }
-
- // Text shadow
- createTextField("ToolTipTextShadow", 3, ToolTipText._x + 1, ToolTipText._y+1, ToolTipText._width, ToolTipText._height);
- with(ToolTipTextShadow){
- html = true;
- htmlText = ToolTipText.text;
- setTextFormat(this.tiptextshadow);
- selectable = ToolTipText.selectable;
- _width = ToolTipText._width;
- _height = ToolTipText._height;
- multiline = ToolTipText.multiline;
- wordWrap = ToolTipText.wordWrap;
- _alpha = 30;
-
- }
- }
- }
- // position tooltip based on param
- if (!showAbove){
- ttHolder.ToolTipHolder._x = xoffset;
- ttHolder.ToolTipHolder._y = yoffset;
- }else {
- ttHolder.ToolTipHolder._x = xoffset;
- ttHolder.ToolTipHolder._y = yoffset- (ttHolder.ToolTipHolder.ToolTipBackground._height+5);
- }
-
- // Conceal our tooltip for now
- ttHolder.ToolTipHolder._visible = false;
-
- }
-
-
-
- private function formatText():Object{
- var FObj:Object = new Object();
- var TipText:TextFormat = new TextFormat();
- TipText.color = 0x333333;
- TipText.font = "Verdana";
- TipText.size = 9;
-
- var TipTextShadow:TextFormat = new TextFormat();
- TipTextShadow.color = 0xECE9D8;
- TipTextShadow.font = "Verdana";
- TipTextShadow.size = 9;
-
- FObj.tiptext = TipText
- FObj.tiptextshadow = TipTextShadow
-
- return FObj
- }
-
-
- public function DisplayToolTip(p_ttHolder:MovieClip, p_message:String, p_xoffset:Number, p_yoffset:Number, p_above:Boolean, p_width:Number, p_btn:Button, p_tiptext:TextFormat, p_tiptextshadow:TextFormat, p_backgroundcolour:Number, p_bordercolour:Number, p_delay:Number, p_shadow:Boolean){
- // wait
- //Our tooltip holder (required parameter).
- ttHolder = p_ttHolder
- // Our tooltip text (required parameter).
- message = p_message;
-
- // Our TextFormats
- if(p_tiptext != undefined && p_tiptextshadow != undefined){
- tiptext = p_tiptext;
- tiptextshadow = p_tiptextshadow;
- }else {
- tiptext = textFormat.tiptext;
- tiptextshadow = textFormat.tiptextshadow;
- }
-
- // The x & y offset of the tooltip (optional).
- if (p_xoffset != undefined && p_yoffset != undefined){
- xoffset = p_xoffset;
- yoffset = p_yoffset;
- }else {
- xoffset = _root._xmouse + xoffset;
- yoffset = _root._ymouse + yoffset;
- }
-
- if(p_above != undefined) showAbove = p_above;
-
- if(p_width != undefined) ttWidth = p_width;
-
- // The visible features (optional).
- if(p_backgroundcolour != undefined) backgroundcolour = p_backgroundcolour;
- if(p_bordercolour != undefined) bordercolour = p_bordercolour;
-
- // The behavioural features (optional).
- if(p_delay != undefined) delay = p_delay;
- if(p_shadow != undefined) shadow = p_shadow;
-
- // Create out actual ToolTip which consists of a movieclip holding one (or two) textfields and one(or two) background clips
- createTT();
- showTT();
-
- ttHolder.ToolTipHolder._visible = true;
- ttHolder.ToolTipHolder._alpha = 0;
-
- var delayed = 0;
- var delayfor = this.delay * 10;
-
- ttHolder.ToolTipHolder.onEnterFrame = function(){
- if(delayed < delayfor){
- delayed++;
- }
- else{
- if(_alpha < 100){
- _alpha += 20;
- }else{
- ToolTipText._visible = true
- delete this.onEnterFrame;
- }
- }
- }
- }
-
- public function CloseToolTip(){
- delete ttHolder.ToolTipHolder.onEnterFrame;
- ttHolder.ToolTipHolder.removeMovieClip();
- }
+/***************************************************************************
+ * 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.managers.*
+import mx.controls.*
+
+class org.lamsfoundation.lams.common.ToolTip extends MovieClip {
+ // The button to display the ToolTip on
+ var btn:Button;
+ var ttHolder:MovieClip;
+
+ // The movieclips & textfield which form the tooltip
+ var ToolTipHolder:MovieClip;
+ var ToolTipBackground:MovieClip;
+ var ToolTipText:TextField;
+
+ var ToolTipBackgroundShadow:MovieClip;
+ var ToolTipTextShadow:TextField;
+
+ // The tooltip text.
+ var message:String;
+
+ // X and Y Offset
+ var xoffset:Number = 0;
+ var yoffset:Number = 5;
+ var showAbove:Boolean = false;
+ var ttWidth:Number = 155;
+
+ // Visible features
+ var textFormat:Object;
+ var tiptext:TextFormat;
+ var tiptextshadow:TextFormat;
+
+ var backgroundcolour:Number = 0xF5EFC0;
+ var bordercolour:Number = 0x666666;
+
+ // Behavioural features.
+ var shadow:Boolean = false;
+ var interval;
+
+ var delay:Number = 0.5;
+
+ // Class Constructor
+ // ----------------------------------------------------------------------------------------
+ // All of the tooltips properties have default values except the actual message to display
+ // in the tip. Because of this, only the message is required to be sent to the constructor.
+
+ public function ToolTip(){
+ textFormat = formatText();
+ }
+
+ private function createTT() {
+ ttHolder.createEmptyMovieClip("ToolTipHolder", ttHolder.getNextHighestDepth());
+ ttHolder.delay = delay;
+ }
+
+ private function showTT(){
+ // Create our text field
+ ttHolder.ToolTipHolder.createTextField("ToolTipText", 4, 2, 0, 1, 1);
+ with(ttHolder.ToolTipHolder.ToolTipText) {
+ html = true;
+ htmlText = this.message;
+ setTextFormat(this.tiptext);
+ selectable = false;
+ _width = textWidth + 5;
+ _height = textHeight + 5;
+
+ // see if we should wrap the text
+ if(_width > this.ttWidth){
+ multiline = true;
+ wordWrap = true;
+ _width = this.ttWidth;
+ _height = textHeight + 5;
+ }
+ _visible = false
+ }
+
+ var bgwidth = ttHolder.ToolTipHolder.ToolTipText.textWidth + 8;
+ var bgheight = ttHolder.ToolTipHolder.ToolTipText.textHeight + 4;
+
+ // Create the background on the tool tip
+ ttHolder.ToolTipHolder.createEmptyMovieClip("ToolTipBackground", 2);
+ with (ttHolder.ToolTipHolder.ToolTipBackground){
+ beginFill (this.backgroundcolour, 100);
+ lineStyle (1, this.bordercolour, 100);
+ moveTo(0, 0);
+ lineTo(bgwidth, 0);
+ lineTo(bgwidth, bgheight);
+ lineTo(0, bgheight);
+ lineTo(0, 0);
+ endFill();
+ }
+
+ // Create our shadow (if specified)
+ if(shadow == true) {
+ with(ttHolder.ToolTipHolder) {
+ // Background shadow
+ ToolTipBackground.duplicateMovieClip("ToolTipBackgroundShadow", 1);
+ with(ToolTipBackgroundShadow){
+ _x = ToolTipBackground._x + 2;
+ _y = ToolTipBackground._y + 2;
+ _alpha = 30;
+ }
+
+ // Text shadow
+ createTextField("ToolTipTextShadow", 3, ToolTipText._x + 1, ToolTipText._y+1, ToolTipText._width, ToolTipText._height);
+ with(ToolTipTextShadow){
+ html = true;
+ htmlText = ToolTipText.text;
+ setTextFormat(this.tiptextshadow);
+ selectable = ToolTipText.selectable;
+ _width = ToolTipText._width;
+ _height = ToolTipText._height;
+ multiline = ToolTipText.multiline;
+ wordWrap = ToolTipText.wordWrap;
+ _alpha = 30;
+
+ }
+ }
+ }
+ // position tooltip based on param
+ if (!showAbove){
+ ttHolder.ToolTipHolder._x = xoffset;
+ ttHolder.ToolTipHolder._y = yoffset;
+ }else {
+ ttHolder.ToolTipHolder._x = xoffset;
+ ttHolder.ToolTipHolder._y = yoffset- (ttHolder.ToolTipHolder.ToolTipBackground._height+5);
+ }
+
+ // Conceal our tooltip for now
+ ttHolder.ToolTipHolder._visible = false;
+
+ }
+
+
+
+ private function formatText():Object{
+ var FObj:Object = new Object();
+ var TipText:TextFormat = new TextFormat();
+ TipText.color = 0x333333;
+ TipText.font = "Verdana";
+ TipText.size = 9;
+
+ var TipTextShadow:TextFormat = new TextFormat();
+ TipTextShadow.color = 0xECE9D8;
+ TipTextShadow.font = "Verdana";
+ TipTextShadow.size = 9;
+
+ FObj.tiptext = TipText
+ FObj.tiptextshadow = TipTextShadow
+
+ return FObj
+ }
+
+
+ public function DisplayToolTip(p_ttHolder:MovieClip, p_message:String, p_xoffset:Number, p_yoffset:Number, p_above:Boolean, p_width:Number, p_btn:Button, p_tiptext:TextFormat, p_tiptextshadow:TextFormat, p_backgroundcolour:Number, p_bordercolour:Number, p_delay:Number, p_shadow:Boolean){
+ // wait
+ //Our tooltip holder (required parameter).
+ ttHolder = p_ttHolder
+ // Our tooltip text (required parameter).
+ message = p_message;
+
+ // Our TextFormats
+ if(p_tiptext != undefined && p_tiptextshadow != undefined){
+ tiptext = p_tiptext;
+ tiptextshadow = p_tiptextshadow;
+ }else {
+ tiptext = textFormat.tiptext;
+ tiptextshadow = textFormat.tiptextshadow;
+ }
+
+ // The x & y offset of the tooltip (optional).
+ if (p_xoffset != undefined && p_yoffset != undefined){
+ xoffset = p_xoffset;
+ yoffset = p_yoffset;
+ }else {
+ xoffset = _root._xmouse + xoffset;
+ yoffset = _root._ymouse + yoffset;
+ }
+
+ if(p_above != undefined) showAbove = p_above;
+
+ if(p_width != undefined) ttWidth = p_width;
+
+ // The visible features (optional).
+ if(p_backgroundcolour != undefined) backgroundcolour = p_backgroundcolour;
+ if(p_bordercolour != undefined) bordercolour = p_bordercolour;
+
+ // The behavioural features (optional).
+ if(p_delay != undefined) delay = p_delay;
+ if(p_shadow != undefined) shadow = p_shadow;
+
+ // Create out actual ToolTip which consists of a movieclip holding one (or two) textfields and one(or two) background clips
+ createTT();
+ showTT();
+
+ ttHolder.ToolTipHolder._visible = true;
+ ttHolder.ToolTipHolder._alpha = 0;
+
+ var delayed = 0;
+ var delayfor = this.delay * 10;
+
+ ttHolder.ToolTipHolder.onEnterFrame = function(){
+ if(delayed < delayfor){
+ delayed++;
+ }
+ else{
+ if(_alpha < 100){
+ _alpha += 20;
+ }else{
+ ToolTipText._visible = true
+ delete this.onEnterFrame;
+ }
+ }
+ }
+ }
+
+ public function CloseToolTip(){
+ delete ttHolder.ToolTipHolder.onEnterFrame;
+ ttHolder.ToolTipHolder.removeMovieClip();
+ }
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/comms/Communication.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/comms/Communication.as (.../Communication.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/comms/Communication.as (.../Communication.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,400 +1,400 @@
-/***************************************************************************
- * 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.*
+/***************************************************************************
+ * 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.comms.*
-import org.lamsfoundation.lams.common.*;
-import org.lamsfoundation.lams.common.ui.*;
-import org.lamsfoundation.lams.authoring.*;
-import org.lamsfoundation.lams.common.dict.*
-
-/**
+import org.lamsfoundation.lams.common.*;
+import org.lamsfoundation.lams.common.ui.*;
+import org.lamsfoundation.lams.authoring.*;
+import org.lamsfoundation.lams.common.dict.*
+
+/**
* Communication - responsible for server side communication and wddx serialisation/de-serialisation
* @author DI 05/04/05
*
*/
-class org.lamsfoundation.lams.common.comms.Communication {
-
-
- private static var FRIENDLY_ERROR_CODE:Number = 1; //Server error codes
- private static var SYSTEM_ERROR_CODE:Number = 2;
-
- private static var MAX_REQUESTS:Number = 20; //Maximum no of simultaneous requests
-
-
-
+class org.lamsfoundation.lams.common.comms.Communication {
+
+
+ private static var FRIENDLY_ERROR_CODE:Number = 1; //Server error codes
+ private static var SYSTEM_ERROR_CODE:Number = 2;
+
+ private static var MAX_REQUESTS:Number = 20; //Maximum no of simultaneous requests
+
+
+
private var _serverURL:String;
- private var ignoreWhite:Boolean;
- private var responseXML:XML; //XML object for server response
- private var wddx:Wddx; //WDDX serializer/de-serializer
-
- private var queue:Array;
- private var queueID:Number;
+ private var ignoreWhite:Boolean;
+ private var responseXML:XML; //XML object for server response
+ private var wddx:Wddx; //WDDX serializer/de-serializer
+
+ private var queue:Array;
+ private var queueID:Number;
/**
* Comms constructor
*/
- function Communication(aServerURL:String){
- //Set up queue
- queue=[];
- queueID=0;
-
-
- ignoreWhite = true;
-
- if(_serverURL == null){
- if(_root.serverURL!=null){
- _serverURL = _root.serverURL;
- }else if(aServerURL != null){
- _serverURL = aServerURL;
- }else{
- Debugger.log("! serverURL is not set, unable to connect to server !!",Debugger.CRITICAL,'Consturcutor','Communication');
- }
-
- }
-
+ function Communication(aServerURL:String){
+ //Set up queue
+ queue=[];
+ queueID=0;
+
+
+ ignoreWhite = true;
+
+ if(_serverURL == null){
+ if(_root.serverURL!=null){
+ _serverURL = _root.serverURL;
+ }else if(aServerURL != null){
+ _serverURL = aServerURL;
+ }else{
+ Debugger.log("! serverURL is not set, unable to connect to server !!",Debugger.CRITICAL,'Consturcutor','Communication');
+ }
+
+ }
+
wddx = new Wddx();
}
- /**
- * Make a request to the server. Each request handlers is added to a queue whilst waiting for the (asynchronous) response
- * from the server. The server returns a wrapped XML packet that is unwrapped and de-serialised on load and passed back
- * to the request handler
- *
- * @usage - var myObject.test = function (deserializedObject) {
- * //Code to process object here....
- * }
- * commsInstance.getRequest('http://dolly.uklams.net/lams/lams_authoring/all_library_details.xml',myObject.test,true) //Note: all_library_details.xml has been deleted from cvs
- *
- * @param requestURL:String URL on the server for request script
- * @param handler:Function callback function to call with the response object
- * @param isFullURL:Boolean Inicates if the requestURL is fully qualified, if false serverURL will be prepended
- * @returns Void
- */
- public function getRequest(requestURL:String,handler:Function,isFullURL:Boolean):Void{
-
- Cursor.showCursor(ApplicationParent.C_HOURGLASS);
-
- //Create XML response object
- var responseXML = new XML();
- responseXML.ignoreWhite = ignoreWhite;
- //Assign onLoad handler
- responseXML.onLoad = Proxy.create(this,onServerResponse,queueID);
- //Add handler to queue
- addToQueue(handler);
- //Assign onData function
- setOnData(responseXML);
-
- //TODO DI 11/04/05 Stub here for now until we have server implmenting new WDDX structure
- if(isFullURL){
- Debugger.log('Requesting:'+requestURL,Debugger.GEN,'getRequest','Communication');
- responseXML.load(requestURL);
- }else{
- Debugger.log('Requesting:'+_serverURL+requestURL,Debugger.GEN,'getRequest','Communication');
- responseXML.load(_serverURL+requestURL);
- }
- }
-
- /**
- * Sends a data object to the server and directs response to handler function.
- *
- * @param dto:Object The flash object to send. Will be WDDX serialised
- * @param requestURL:String The url to send and load the data from
- * @param handler:Function The function that will handle the response (usually an ACK response)
- * @param isFullURL:Boolean Inicates if the requestURL is fully qualified, if false serverURL will be prepended
- *
- * @usage:
- *
- */
- public function sendAndReceive(rawDto:Object, requestURL:String,handler:Function,isFullURL){
- //Serialise the Data Transfer Object
- var xmlToSend:XML = serializeObj(rawDto);
- xmlToSend.ignoreWhite = ignoreWhite;
-
- //Create XML response object
- var responseXML = new XML();
- //Assign onLoad handler
- responseXML.onLoad = Proxy.create(this,onServerResponse,queueID);
-
- //Assign onLoad handler
- //responseXML.onLoad = Proxy.create(this,onSendACK,queueID);
- //Add handler to queue
- addToQueue(handler);
-
- //Assign onData function
- setOnData(responseXML);
-
- //TODO DI 11/04/05 Stub here for now until we have server implmenting new WDDX structure
- if(isFullURL){
- Debugger.log('Posting to:'+requestURL,Debugger.GEN,'sendAndReceive','Communication');
- Debugger.log('Sending XML:'+xmlToSend.toString(),Debugger.GEN,'sendAndReceive','Communication');
- xmlToSend.sendAndLoad(requestURL,responseXML);
- }else{
- Debugger.log('Posting to:'+_serverURL+requestURL,Debugger.GEN,'sendAndReceive','Communication');
- Debugger.log('Sending XML:'+xmlToSend.toString(),Debugger.GEN,'sendAndReceive','Communication');
- xmlToSend.sendAndLoad(_serverURL+requestURL,responseXML);
- }
- }
-
- /**
- * XML load handler for getRequest()
- * @param success XML load status
- * @param wrappedPacketXML The wrapped XML response object
- * @param queueID:Number ID of request handler on queue
- */
- private function onServerResponse(success:Boolean,wrappedPacketXML:XML,queueID:Number){
- Debugger.log('xml recieved is:'+wrappedPacketXML.toString(),Debugger.VERBOSE,'onServerResponse','Communication');
-
- //Load ok?
- if(success){
- var responseObj:Object = wddx.deserialize(wrappedPacketXML);
- if(responseObj.messageType == null){
- Debugger.log('Message type was:'+responseObj.messageType+' , cannot continue',Debugger.CRITICAL,'onServerResponse','Communication');
- Debugger.log('xml recieved is:'+wrappedPacketXML.toString(),Debugger.CRITICAL,'onServerResponse','Communication');
- return -1;
- }
-
- //Check for errors in message type that's returned from server
- if(responseObj.messageType == FRIENDLY_ERROR_CODE){
- //user friendly error
- var e = new LFError(responseObj.messageValue,"onServerResponse",this);
- dispatchToHandlerByID(queueID,e);
-
- var sendMsg:String = Dictionary.getValue('sys_error_msg_start')+"\n\n"+Dictionary.getValue('sys_error_msg_finish')+"\n\n\n";
-
- LFError.showSendErrorRequest(sendMsg, 'sys_error', Debugger.crashDataDump, null);
-
- }else if(responseObj.messageType == SYSTEM_ERROR_CODE){
- var sendMsg:String = Dictionary.getValue('sys_error_msg_start')+"\n\n"+Dictionary.getValue('sys_error_msg_finish');
- LFError.showSendErrorRequest(sendMsg, 'sys_error', Debugger.crashDataDump, null);
- }else{
- //Everything is fine so lookup callback handler on queue
- if(responseObj.messageValue != null){
- dispatchToHandlerByID(queueID,responseObj.messageValue);
- }else{
- Debugger.log('Message value was null, cannot continue',Debugger.CRITICAL,'onServerResponse','Communication');
- }
- }
-
- //Now delete the XML
- delete wrappedPacketXML;
- }else {
- Debugger.log("XML Load failed",Debugger.CRITICAL,'onServerResponse','Communication');
- var e = new LFError("Communication with the server has failed. \nPlease check you are connected to the internet and/or LAMS server","onServerResponse",this,'Server URL:'+_serverURL);
- e.showMessageConfirm();
- }
- }
-
- /**
- * Received Acknowledgement from server, response to sendAndReceive() method
- *
- * @usage
- * @param success
- * @param loadedXML
- * @param queueID
- * @param deserialize
- * @return
- */
- private function onSendACK(success:Boolean,loadedXML:XML,queueID:Number,deserialize:Boolean) {
- //TODO DI 06/06/05 find out what is required here, is it enough to assign onLoad handler to onServerResponse?
- }
-
- /**
- * Load Plain XML with optional deserialisation
- */
- public function loadXML(requestURL:String,handler:Function,isFullURL:Boolean,deserialize:Boolean):Void{
- //Create XML response object
- var responseXML = new XML();
-
- //Assign onLoad handler
- responseXML.onLoad = Proxy.create(this,onXMLLoad,queueID,deserialize);
-
- //Add handler to queue
- addToQueue(handler);
-
- //Assign onData function
- setOnData(responseXML);
-
- //TODO DI 11/04/05 Stub here for now until we have server implmenting new WDDX structure
- if(isFullURL){
- Debugger.log('Requesting:'+requestURL,Debugger.GEN,'loadXML','Communication');
- responseXML.load(requestURL);
- }else{
- Debugger.log('Requesting:'+_serverURL+requestURL,Debugger.GEN,'loadXML','Communication');
- responseXML.load(_serverURL+requestURL);
- }
- }
-
- /**
- * Load XML load handler for loadXML() -
- *
- * @param success:Boolean XML load status
- * @param loadedXML:XML unwrapped WDDX XML
- * @param queueID:Number ID of request handler on queue
- * @param deserialize:Boolean flag to determin whether object should be deserialised before being passed back to handler
- */
- private function onXMLLoad(success:Boolean,loadedXML:XML,queueID:Number,deserialize:Boolean) {
- //Deserialize
- if(deserialize){
- //Deserialize and pass back to handler
- var responseObj:Object = deserializeObj(loadedXML);
- dispatchToHandlerByID(queueID,responseObj);
- }else {
- //Call handler, passing in XML Object
- dispatchToHandlerByID(queueID,loadedXML);
- }
- }
-
- /**
- * Assign the onData method for the XML object
- *
- * @param xmlObject:XML the xml object to assign the onData method
- */
- private function setOnData(xmlObject:XML){
- //Set ondata handler to validate data returned in XML object
- xmlObject.onData = function(src){
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
-
- if (src != undefined) {
- //Check for login page
- if(src.indexOf("j_security_login_page") != -1){
- //TODO DI 12/04/05 deal with error from session timeout/server error
- trace('j_security_login_page received');
- this.onLoad(false);
- }else {
- //Data alright, must be a packet, allow onLoad event
- this.parseXML(src);
- this.loaded=true;
- this.onLoad(true,this);
- }
- } else {
- this.onLoad(false);
- }
- }
- }
-
- /**
- * Serializes an object into WDDX XML
- * @usage var wddxXML:XML = commsInstance.serializeObj(obj);
- * @param dto The object to be serialized
- * @return sXML WDDX Serialized XML
- */
- public function serializeObj(dto:Object):XML{
- var sXML:XML = new XML();
- sXML = wddx.serialize(dto);
- Debugger.log('monitor data send to Server:'+sXML.toString(),Debugger.GEN,' serializeObj ','Communication');
- return sXML;
- }
-
- /**
- * Deserializes WDDX XML to produce an object
- * @usage var wddxXML:XML = commsInstance.serializeObj(obj);
- * @param wddx The XML to be de-serialized
- * @return Object de-serialized object
- */
- public function deserializeObj(xmlObj:XML):Object{
- var dto:Object = wddx.deserialize(xmlObj);
- Debugger.log('monitor data recieved from Server:'+xmlObj.toString(),Debugger.GEN,' deserializeObj ','Communication');
- return dto;
- }
-
-
-
- /**
- * Finds handler in queue, dispatches object to it and deletes item from queue
- */
- private function dispatchToHandlerByID (ID:Number,o:Object) {
- var index:Number = getIndexByQueueID(ID);
- //Dispatch handler passing in object stored under messageValue
- queue[index].handler(o);
- //Now that request has been dealt with remove item from queue
- removeFromQueue(ID);
- }
-
- /**
- * Adds a key handler pair to the queue
- */
- private function addToQueue(handler:Function){
- //Add to the queue and increment the queue ID
- queue.push({queueID:queueID++,handler:handler});
-
- //Reset queueID?
- if(queueID>=MAX_REQUESTS) {
- queueID=0;
- }
- }
-
- /**
- * removes a key handler pair from the queue
- * @returns boolean indicating success
- */
- private function removeFromQueue(queueID:Number):Boolean{
- //find item and delete it
- var index:Number = getIndexByQueueID(queueID);
- if(index!=-1) {
- //Remove the item from the queue
- queue.splice(index,1);
- return true;
- }else {
- return false;
- Debugger.log('Item not found in queue :' + queueID,Debugger.GEN,'removeFromQueue','Communication');
- }
- }
-
- /**
- * searches queue for item by key
- * @returns Array index value, -1 if key not found
- */
- private function getIndexByQueueID(queueID):Number {
- //Go through handlers and remove key
- for(var i=0;i=MAX_REQUESTS) {
+ queueID=0;
+ }
+ }
+
+ /**
+ * removes a key handler pair from the queue
+ * @returns boolean indicating success
+ */
+ private function removeFromQueue(queueID:Number):Boolean{
+ //find item and delete it
+ var index:Number = getIndexByQueueID(queueID);
+ if(index!=-1) {
+ //Remove the item from the queue
+ queue.splice(index,1);
+ return true;
+ }else {
+ return false;
+ Debugger.log('Item not found in queue :' + queueID,Debugger.GEN,'removeFromQueue','Communication');
+ }
+ }
+
+ /**
+ * searches queue for item by key
+ * @returns Array index value, -1 if key not found
+ */
+ private function getIndexByQueueID(queueID):Number {
+ //Go through handlers and remove key
+ for(var i=0;i";
- at[i] = "";
- } else if (i<128) {
- et[i] = chr(i);
- at[i] = chr(i);
- } else {
- et[i] = ""+i.toString(16)+";";
- etRev[""+i.toString(16)+";"] = chr(i);
- at[i] = ""+i.toString(16)+";";
- atRev[""+i.toString(16)+";"] = chr(i);
- }
- }
- et[ord("<")] = "<";
- et[ord(">")] = ">";
- et[ord("&")] = "&";
- etRev["<"] = "<";
- etRev[">"] = ">";
- etRev["&"] = "&";
-
- at[ord("<")] = "<";
- at[ord(">")] = ">";
- at[ord("&")] = "&";
- at[ord("'")] = "'";
- at[ord("\"")] = """;
- atRev["<"] = "<";
- atRev[">"] = ">";
- atRev["&"] = "&";
- atRev["'"] = "'";
- atRev["""] = "\"";
- // Deal with timezone offsets
- tzOffset = (new Date()).getTimezoneOffset();
- if (tzOffset>=0) {
- timezoneString = "-";
- } else {
- timezoneString = "+";
- }
- timezoneString += Math.floor(Math.abs(tzOffset)/60)+":"+(Math.abs(tzOffset)%60);
- }
- // Serialize a Flash object
- function serialize(rootObj) {
- delete wddxPacket;
- var temp:XML = new XML();
- packet = new XML();
- packet.appendChild(temp.createElement("wddxPacket"));
- wddxPacket = packet.firstChild;
- wddxPacket.attributes["version"] = "1.0";
- wddxPacket.appendChild(temp.createElement("header"));
- wddxPacket.appendChild(temp.createElement("data"));
- if (serializeValue(rootObj, wddxPacket.childNodes[1])) {
- return packet;
- } else {
- return null;
- }
- }
- // Determine the type of a Flash object and serialize it
- function serializeValue(obj, node) {
- var bSuccess:Boolean = true;
- var val:String = obj.valueOf();
- var tzString = null;
- var temp:XML = new XML();
- // null object
- if (obj == null) {
- node.appendChild(temp.createElement("null"));
- // string object
- } else if (typeof (val) == "string") {
- serializeString(val, node);
- // numeric objects (number or date)
- } else if (typeof (val) == "number") {
- // date object
- if (typeof (obj.getTimezoneOffset) == "function") {
- // deal with timezone offset if asked to
- if (useTimeZoneInfo) {
- tzString = timezoneString;
- }
- node.appendChild(temp.createElement("dateTime"));
- node.lastChild.appendChild(temp.createTextNode(obj.getFullYear()+"-"+(obj.getMonth()+1)+"-"+obj.getDate()+"T"+obj.getHours()+":"+obj.getMinutes()+":"+obj.getSeconds()+tzString));
- // number object
- } else {
- node.appendChild((new XML()).createElement("number"));
- node.lastChild.appendChild((new XML()).createTextNode(val));
- }
- // boolean object
- } else if (typeof (val) == "boolean") {
- node.appendChild(temp.createElement("boolean"));
- node.lastChild.attributes["value"] = val;
- // actual objects
- } else if (typeof (obj) == "object") {
- // if it has a built in serializer, use it
- if (typeof (obj.wddxSerialize) == "function") {
- bSuccess = obj.wddxSerialize(this, node);
- // array object
- } else if (typeof (obj.join) == "function" && typeof (obj.reverse) == "function") {
- node.appendChild(temp.createElement("array"));
- node.lastChild.attributes["length"] = obj.length;
- for (var i:Number = 0; bSuccess && i1) {
- dataObj = "";
- var i:Number = 0;
- for (i=0; i=0; i--) {
- if (node.childNodes[i].nodeName.toLowerCase() == "field") {
- var attr:Object = this.deserializeAttr(node.childNodes[i].attributes["name"]);
- dataObj[attr].wddxSerializationType = "field";
- for (var j = (node.childNodes[i].childNodes.length-1); j>=0; j--) {
- dataObj[attr][j] = new Object();
- var tempObj:Object = this.deserializeNode(node.childNodes[i].childNodes[j]);
- dataObj.setField(j, attr, tempObj);
- }
- }
- }
- // dataObj.wddxSerializationType = "recordset";
- return dataObj;
- }
- }
- function deserializeAttr(attr) {
- var max:Number = attr.length;
- var i:Number = 0;
- var char:String;
- var output:String = "";
- while (i";
+ at[i] = "";
+ } else if (i<128) {
+ et[i] = chr(i);
+ at[i] = chr(i);
+ } else {
+ et[i] = ""+i.toString(16)+";";
+ etRev[""+i.toString(16)+";"] = chr(i);
+ at[i] = ""+i.toString(16)+";";
+ atRev[""+i.toString(16)+";"] = chr(i);
+ }
+ }
+ et[ord("<")] = "<";
+ et[ord(">")] = ">";
+ et[ord("&")] = "&";
+ etRev["<"] = "<";
+ etRev[">"] = ">";
+ etRev["&"] = "&";
+
+ at[ord("<")] = "<";
+ at[ord(">")] = ">";
+ at[ord("&")] = "&";
+ at[ord("'")] = "'";
+ at[ord("\"")] = """;
+ atRev["<"] = "<";
+ atRev[">"] = ">";
+ atRev["&"] = "&";
+ atRev["'"] = "'";
+ atRev["""] = "\"";
+ // Deal with timezone offsets
+ tzOffset = (new Date()).getTimezoneOffset();
+ if (tzOffset>=0) {
+ timezoneString = "-";
+ } else {
+ timezoneString = "+";
+ }
+ timezoneString += Math.floor(Math.abs(tzOffset)/60)+":"+(Math.abs(tzOffset)%60);
+ }
+ // Serialize a Flash object
+ function serialize(rootObj) {
+ delete wddxPacket;
+ var temp:XML = new XML();
+ packet = new XML();
+ packet.appendChild(temp.createElement("wddxPacket"));
+ wddxPacket = packet.firstChild;
+ wddxPacket.attributes["version"] = "1.0";
+ wddxPacket.appendChild(temp.createElement("header"));
+ wddxPacket.appendChild(temp.createElement("data"));
+ if (serializeValue(rootObj, wddxPacket.childNodes[1])) {
+ return packet;
+ } else {
+ return null;
+ }
+ }
+ // Determine the type of a Flash object and serialize it
+ function serializeValue(obj, node) {
+ var bSuccess:Boolean = true;
+ var val:String = obj.valueOf();
+ var tzString = null;
+ var temp:XML = new XML();
+ // null object
+ if (obj == null) {
+ node.appendChild(temp.createElement("null"));
+ // string object
+ } else if (typeof (val) == "string") {
+ serializeString(val, node);
+ // numeric objects (number or date)
+ } else if (typeof (val) == "number") {
+ // date object
+ if (typeof (obj.getTimezoneOffset) == "function") {
+ // deal with timezone offset if asked to
+ if (useTimeZoneInfo) {
+ tzString = timezoneString;
+ }
+ node.appendChild(temp.createElement("dateTime"));
+ node.lastChild.appendChild(temp.createTextNode(obj.getFullYear()+"-"+(obj.getMonth()+1)+"-"+obj.getDate()+"T"+obj.getHours()+":"+obj.getMinutes()+":"+obj.getSeconds()+tzString));
+ // number object
+ } else {
+ node.appendChild((new XML()).createElement("number"));
+ node.lastChild.appendChild((new XML()).createTextNode(val));
+ }
+ // boolean object
+ } else if (typeof (val) == "boolean") {
+ node.appendChild(temp.createElement("boolean"));
+ node.lastChild.attributes["value"] = val;
+ // actual objects
+ } else if (typeof (obj) == "object") {
+ // if it has a built in serializer, use it
+ if (typeof (obj.wddxSerialize) == "function") {
+ bSuccess = obj.wddxSerialize(this, node);
+ // array object
+ } else if (typeof (obj.join) == "function" && typeof (obj.reverse) == "function") {
+ node.appendChild(temp.createElement("array"));
+ node.lastChild.attributes["length"] = obj.length;
+ for (var i:Number = 0; bSuccess && i1) {
+ dataObj = "";
+ var i:Number = 0;
+ for (i=0; i=0; i--) {
+ if (node.childNodes[i].nodeName.toLowerCase() == "field") {
+ var attr:Object = this.deserializeAttr(node.childNodes[i].attributes["name"]);
+ dataObj[attr].wddxSerializationType = "field";
+ for (var j = (node.childNodes[i].childNodes.length-1); j>=0; j--) {
+ dataObj[attr][j] = new Object();
+ var tempObj:Object = this.deserializeNode(node.childNodes[i].childNodes[j]);
+ dataObj.setField(j, attr, tempObj);
+ }
+ }
+ }
+ // dataObj.wddxSerializationType = "recordset";
+ return dataObj;
+ }
+ }
+ function deserializeAttr(attr) {
+ var max:Number = attr.length;
+ var i:Number = 0;
+ var char:String;
+ var output:String = "";
+ while (i0) {
- var val;
- if (typeof (val=arguments[0].valueOf()) == "boolean") {
- // Case preservation flag is provided as 1st argument
- preserveFieldCase = arguments[0];
- } else {
- // First argument is the array of column names
- var cols = arguments[0];
- // Second argument could be the length or the preserve case flag
- var nLen = 0;
- if (arguments.length>1) {
- if (typeof (val=arguments[1].valueOf()) == "boolean") {
- // Case preservation flag is provided as 2nd argument
- preserveFieldCase = arguments[1];
- } else {
- // Explicitly specified recordset length
- nLen = arguments[1];
- if (arguments.length>2) {
- // Case preservation flag is provided as 3rd argument
- preserveFieldCase = arguments[2];
- }
- }
- }
- for (var i:Number = 0; i0) {
- colNamesList += ",";
- }
- colNamesList += col;
- }
- }
- var nRows:Number = this.getRowCount();
- node.appendChild((new XML()).createElement("recordset"));
- node.lastChild.attributes["rowCount"] = nRows;
- node.lastChild.attributes["fieldNames"] = colNamesList;
- var bSuccess:Boolean = true;
- for (i=0; bSuccess && i0) {
+ var val;
+ if (typeof (val=arguments[0].valueOf()) == "boolean") {
+ // Case preservation flag is provided as 1st argument
+ preserveFieldCase = arguments[0];
+ } else {
+ // First argument is the array of column names
+ var cols = arguments[0];
+ // Second argument could be the length or the preserve case flag
+ var nLen = 0;
+ if (arguments.length>1) {
+ if (typeof (val=arguments[1].valueOf()) == "boolean") {
+ // Case preservation flag is provided as 2nd argument
+ preserveFieldCase = arguments[1];
+ } else {
+ // Explicitly specified recordset length
+ nLen = arguments[1];
+ if (arguments.length>2) {
+ // Case preservation flag is provided as 3rd argument
+ preserveFieldCase = arguments[2];
+ }
+ }
+ }
+ for (var i:Number = 0; i0) {
+ colNamesList += ",";
+ }
+ colNamesList += col;
+ }
+ }
+ var nRows:Number = this.getRowCount();
+ node.appendChild((new XML()).createElement("recordset"));
+ node.lastChild.attributes["rowCount"] = nRows;
+ node.lastChild.attributes["fieldNames"] = colNamesList;
+ var bSuccess:Boolean = true;
+ for (i=0; bSuccess && i ' + getInstance().items.get(key).value,Debugger.GEN,'getValue','org.lamsfoundation.lams.dict.Dictionary');
- var v:String = _instance.items.get(key).value;
- if(v!=null){
- if(param!=null){
- for(var i=0; i ' + getInstance().items.get(key).description,Debugger.GEN,'getValue','org.lamsfoundation.lams.dict.Dictionary');
- var v:String = _instance.items.get(key).description;
- if(v!=null){
- return v;
- }else{
- Debugger.log('Entry not found in '+getInstance()._currentLanguage+' dictionary, key='+key,Debugger.CRITICAL,'createFromData','Dictionary');
- return "?";
- }
-
-
- }
-
- /**
- * Converts the dictionary data into a data object ready for serializing
- * @returns Object containing the dictionary converted to a dataObject
- */
- public function toData():Object{
- var obj:Object ={};
- var hashKeys:Array = items.keys();
- var hashValues:Array = items.values();
-
- obj = [];
-
- //Go through hash of dictionary items and get data objects for each
- for(var i=0;i ' + getInstance().items.get(key).value,Debugger.GEN,'getValue','org.lamsfoundation.lams.dict.Dictionary');
+ var v:String = _instance.items.get(key).value;
+ if(v!=null){
+ if(param!=null){
+ for(var i=0; i ' + getInstance().items.get(key).description,Debugger.GEN,'getValue','org.lamsfoundation.lams.dict.Dictionary');
+ var v:String = _instance.items.get(key).description;
+ if(v!=null){
+ return v;
+ }else{
+ Debugger.log('Entry not found in '+getInstance()._currentLanguage+' dictionary, key='+key,Debugger.CRITICAL,'createFromData','Dictionary');
+ return "?";
+ }
+
+
+ }
+
+ /**
+ * Converts the dictionary data into a data object ready for serializing
+ * @returns Object containing the dictionary converted to a dataObject
+ */
+ public function toData():Object{
+ var obj:Object ={};
+ var hashKeys:Array = items.keys();
+ var hashValues:Array = items.values();
+
+ obj = [];
+
+ //Go through hash of dictionary items and get data objects for each
+ for(var i=0;i)
-*
-* //Registering for theme changed events
-* myThemeManagerReference.addEventListener('themeChanged',);
-*
-* //NOTE: make sure that event listeners are removed when object goes out of scope e.g.
-* myThemeManagerReference.removeEventListener('themeChanged',);
-*
-*/
-class ThemeManager {
-
- //Declarations
- //This ensures that the ThemeManager is created
- private static var _instance:ThemeManager;
- private static var THEME_PREFIX:String = "theme.";
- private static var THEME_LOADED:String = THEME_PREFIX + "loaded";
-
- //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;
-
- //The current theme
- private var _currentThemeName:String;
- private var _theme:Theme;
- private var comms:Communication;
- private var app:ApplicationParent;
-
-
- //Constructor
- private function ThemeManager() {
- Debugger.log('constructor',Debugger.GEN,'constructor','org.lamsfoundation.lams.ThemeManager');
-
- //Set up this class to use the Flash event delegation model
- EventDispatcher.initialize(this);
-
- //Get comms and application references
- app = ApplicationParent.getInstance();
- comms = app.getComms();
- }
-
- /**
- * Load themes from the Server
- */
- public function loadTheme(theme:String){
- //TODO DI 03/05/05 Stub for now but should query server to access themes
- //Set the selected theme to the default theme initially
- _currentThemeName = theme;
- var _removeCache:Boolean = Config.getInstance().removeCache;
-
- //Cookie or server?
- if(CookieMonster.cookieExists('theme.'+theme)&&Config.USE_CACHE&&!_removeCache) {
- //Whilst waiting for theme to load from disk - show busy
- Cursor.showCursor(ApplicationParent.C_HOURGLASS);
- openFromDisk(theme);
-
- // show default cursor
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
-
- } else if(_removeCache) {
- clearAll(CookieMonster.open(THEME_LOADED, true));
- openFromServer(theme);
- } else {
- //testing style creator
- //createThemeFromCode(theme);
-
- openFromServer(theme);
- }
- }
-
- /**
- * Opens Theme from server
- */
- public function openFromServer(theme) {
- var callBack = Delegate.create(this,themeBackFromServer);
- //loadXML(requestURL:String,handler:Function,isFullURL:Boolean,deserialize:Boolean)
- //TODO DI 08/06/05 Stub for now until server can provide theme data as wrapped packet
- //comms.getRequest('lams_authoring/defaultTheme.xml',callBack);
- //loadXML(requestURL,handler,isFullURL,deserialize)
- //comms.loadXML('lams_authoring/defaultTheme.xml',callBack,false,true);
-
- comms.loadXML('flashxml/' + theme + 'Theme.xml',callBack,false,true);
- Debugger.log('Loading theme data from server for: ' + theme,Debugger.GEN,'openFromServer','ThemeManager');
- }
-
- /**
- * Opens Theme from server
- */
- public function themeBackFromServer(themeDTO:Object){
- Debugger.log('theme back from server',Debugger.GEN,'themeBackFromServer','ThemeManager');
- //Create from the server response
- createFromData(themeDTO);
- //Now that theme has been loaded by server, cache it
- saveToDisk();
-
-
- }
-
-
- /**
- * @deprecated
- * TODO: THIS IS ONLY USED FOR TESTING WHILST SERVER DOES NOT SUPPORT STRUCTURE
- * REMOVE WHEN NO LONGER REQUIRED
- * //BASE STYLE OBJ not being used - see the node on getStyleObject
- */
- public function createThemeFromCode(theme:String) {
- switch (theme) {
- case 'default' :
- //Base style object for 'default' theme
- //BASE STYLE OBJ not being used - see the node on getStyleObject
- var baseStyleObj = new mx.styles.CSSStyleDeclaration();
- baseStyleObj.setStyle('color', 0x333648);
- baseStyleObj.setStyle('themeColor', 0x669BF2);
-
- baseStyleObj.setStyle('fontFamily', 'Verdana');
- baseStyleObj.setStyle('fontSize', 10);
-
- //Create default theme
- _theme = new Theme('default',baseStyleObj);
-
-
- //----BUTTON------------------------------------------------
- //Style object
- var buttonSO = new mx.styles.CSSStyleDeclaration();
- buttonSO.setStyle('color', 0x333648);
- buttonSO.setStyle('themeColor', 0x669BF2);
-
- buttonSO.setStyle('fontFamily', 'Verdana');
- buttonSO.setStyle('fontSize', 9);
- buttonSO.setStyle('emphasizedStyleDeclaration', 0x669BF2);
-
- //Visual Element
- var buttonVisualElement = new VisualElement('button',buttonSO);
- //add visual element to the default theme
- _theme.addVisualElement(buttonVisualElement);
- //----------------------------------------------------------
-
- //----Text Area-------------------------------------------------
- //Style object
- var txaSO = new mx.styles.CSSStyleDeclaration();
- txaSO.setStyle('color', 0x333648);
- txaSO.setStyle('fontFamily', 'Verdana');
- txaSO.setStyle('fontSize', 10);
- //Visual Element
- var txaVisualElement = new VisualElement('textarea',txaSO);
- //add visual element to the default theme
- _theme.addVisualElement(txaVisualElement);
- //--------------------------------------------------------
-
-
- //----LABEL-------------------------------------------------
- //Style object
- var labelSO = new mx.styles.CSSStyleDeclaration();
- labelSO.setStyle('fontFamily', 'Verdana');
- labelSO.setStyle('fontSize', 10);
- labelSO.setStyle('color', 0x333648);
- labelSO.setStyle('embedFonts', false);
- //Visual Element
- var labelVisualElement = new VisualElement('label',labelSO);
- //add visual element to the default theme
- _theme.addVisualElement(labelVisualElement);
- //--------------------------------------------------------
-
-
- //----TextInput-------------------------------------------------
- //Style object
- var txiSO = new mx.styles.CSSStyleDeclaration();
- txiSO.setStyle('color', 0x333648);
- txiSO.setStyle('themeColor', 0x669BF2);
-
- txiSO.setStyle('fontFamily', 'Verdana');
- txiSO.setStyle('fontSize', 10);
- //Visual Element
- var txiVisualElement = new VisualElement('textinput',txiSO);
- //add visual element to the default theme
- _theme.addVisualElement(txiVisualElement);
- //--------------------------------------------------------
-
-
- //----LFWINDOW--------------------------------------------
- //Style object
- var LFWindowSO = new mx.styles.CSSStyleDeclaration();
- LFWindowSO.setStyle('fontSize', 14);
- LFWindowSO.setStyle('borderStyle', 'inset');
- //Visual Element
- var LFWindowVisualElement = new VisualElement('LFWindow',LFWindowSO);
- //add visual element to the default theme
- _theme.addVisualElement(LFWindowVisualElement);
- //-----------------------------------------------------
-
- //Style object
- var spSO = new mx.styles.CSSStyleDeclaration();
- spSO.setStyle('themeColor', 0x669BF2);
- //Visual Element
- var spVisualElement = new VisualElement('scrollpane',spSO);
- //add visual element to the default theme
- _theme.addVisualElement(spVisualElement);
- //------------------------------------------------------
-
- //----TREE VIEW ---------------------------------------
- //Style object
- var treeviewSO = new mx.styles.CSSStyleDeclaration();
- //treeviewSO.setStyle('rollOverColor', 0xC4C7D5);
- treeviewSO.setStyle('color', 0x333648);
- treeviewSO.setStyle('themeColor', 0x669BF2);
-
- treeviewSO.setStyle('fontFamily', 'Verdana');
- treeviewSO.setStyle('fontSize', 10);
- treeviewSO.setStyle('openEasing', 'Elastic');
- //Visual Element
- var treeviewVisualElement = new VisualElement('treeview',treeviewSO);
- //add visual element to the default theme
- _theme.addVisualElement(treeviewVisualElement);
- //------------------------------------------------------
-
- //----DATA GRID------------------------------------------
- //Style object
- var datagridSO = new mx.styles.CSSStyleDeclaration();
- //datagridSO.setStyle('rollOverColor', 0xC4C7D5);
- datagridSO.setStyle('openEasing', 'Elastic');
- //Visual Element
- var datagridVisualElement = new VisualElement('datagrid',datagridSO);
- //add visual element to the default theme
- _theme.addVisualElement(datagridVisualElement);
- //------------------------------------------------------
-
- //----checkbox------------------------------------------
- //Style object
- var checkboxSO = new mx.styles.CSSStyleDeclaration();
- checkboxSO.setStyle('color', 0x333648);
- checkboxSO.setStyle('themeColor', 0x669BF2);
-
- checkboxSO.setStyle('fontFamily', 'Verdana');
- checkboxSO.setStyle('fontSize', 10);
- //Visual Element
- var checkboxVisualElement = new VisualElement('checkbox',checkboxSO);
- //add visual element to the default theme
- _theme.addVisualElement(checkboxVisualElement);
- //------------------------------------------------------
-
- //----Small LABEL-------------------------------------------------
- //Style object
- var smlLabelSO = new mx.styles.CSSStyleDeclaration();
- smlLabelSO.setStyle('fontFamily', 'Tahoma');
- smlLabelSO.setStyle('fontSize', 9);
- smlLabelSO.setStyle('color', 0x333648);
-
- //Visual Element
- var smlLabelVisualElement = new VisualElement('smlLabel',smlLabelSO);
- //add visual element to the default theme
- _theme.addVisualElement(smlLabelVisualElement);
- //--------------------------------------------------------
-
- //----COMBO------------------------------------------
- //Style object
- var comboSO = new mx.styles.CSSStyleDeclaration();
- comboSO.setStyle('color', 0x333648);
- comboSO.setStyle('themeColor', 0x669BF2);
- comboSO.setStyle('fontFamily', 'Verdana');
- comboSO.setStyle('fontSize', 10);
- comboSO.setStyle('openEasing', Elastic.easeOut);
- //Visual Element
- var comboVisualElement = new VisualElement('combo',comboSO);
- //add visual element to the default theme
- _theme.addVisualElement(comboVisualElement);
- //------------------------------------------------------
-
- //----LF MENU-------------------------------------------
- //Style object
- var lfMenuSO = new mx.styles.CSSStyleDeclaration();
- lfMenuSO.setStyle('color', 0x333648);
- lfMenuSO.setStyle('themeColor', 0x669BF2);
- lfMenuSO.setStyle('fontFamily', 'Verdana');
- lfMenuSO.setStyle('fontSize', 10);
- lfMenuSO.setStyle('openEasing', Elastic.easeOut);
- //Visual Element
- var lfMenuVisualElement = new VisualElement('LFMenuBar',lfMenuSO);
- //add visual element to the default theme
- _theme.addVisualElement(lfMenuVisualElement);
- //------------------------------------------------------
-
- //----BGPanel-------------------------------------------
- //Style object
- var BGPanelSO = new mx.styles.CSSStyleDeclaration();
- BGPanelSO.setStyle('borderStyle', 'outset');
- BGPanelSO.setStyle('backgroundColor', 0xC2D5FE);
-
- //Visual Element
- var BGPanelVisualElement = new VisualElement('BGPanel',BGPanelSO);
- //add visual element to the default TAPanelVisualElement
- _theme.addVisualElement(BGPanelVisualElement);
- //------------------------------------------------------
-
- //----ACTPanel-------------------------------------------
- //Style object
- var ACTPanelSO = new mx.styles.CSSStyleDeclaration();
- ACTPanelSO.setStyle('borderStyle', 'none');
- ACTPanelSO.setStyle('backgroundColor', 0xC2D5FE);
-
- //Visual Element
- var ACTPanelVisualElement = new VisualElement('ACTPanel',ACTPanelSO);
- //add visual element to the default ACTPanelVisualElement
- _theme.addVisualElement(ACTPanelVisualElement);
- //------------------------------------------------------
-
- //----TAPanel-------------------------------------------
- //Style object
- var TAPanelSO = new mx.styles.CSSStyleDeclaration();
- TAPanelSO.setStyle('borderStyle', 'solid');
- TAPanelSO.setStyle('backgroundColor', 0xC2D5FE);
- TAPanelSO.setStyle('borderColor', 0x000000);
-
-
- //Visual Element
- var TAPanelVisualElement = new VisualElement('TAPanel',TAPanelSO);
- //add visual element to the default TAPanelVisualElement
- _theme.addVisualElement(TAPanelVisualElement);
- //------------------------------------------------------
-
- //----CanvasPanel-------------------------------------------
- //Style object
- var CAPanelSO = new mx.styles.CSSStyleDeclaration();
-
- CAPanelSO.setStyle('backgroundColor', 0xF4F5FD);
-
-
-
- //Visual Element
- var CAPanelVisualElement = new VisualElement('CanvasPanel',CAPanelSO);
- //add visual element to the default TAPanelVisualElement
- _theme.addVisualElement(CAPanelVisualElement);
- //------------------------------------------------------
-
-
-
- //----LFBUTTON----------------------------------------------
- //NOTE:This style is used in conjunction with LFButtonSkin class. For usage, see common.style.LFButtonSkin.as
- //Style object
- /*
- var LFButtonSO = new mx.styles.CSSStyleDeclaration();
- LFButtonSO.setStyle('fontFamily', 'Tahoma');
- LFButtonSO.setStyle('fontSize', 10);
- LFButtonSO.setStyle('color', 0xff0000);
- LFButtonSO.setStyle('themeColor', 0xff0000);
- LFButtonSO.setStyle('borderStyle', 'outset');
- //Custom LAMS styles
- LFButtonSO.setStyle('up', 0xCCCCCC);
- LFButtonSO.setStyle('over', 0xFAF270);
- LFButtonSO.setStyle('down', 0xccff3c);
- //Visual Element
- var LFButtonVisualElement = new VisualElement('LFButton',LFButtonSO);
- //add visual element to the default theme
- _theme.addVisualElement(LFButtonVisualElement);
- */
- //----------------------------------------------------------
- break;
- default:
- }
-
- //New theme loaded so dispatch a load event
- dispatchEvent({type:'load',target:this});
-
- _currentThemeName = theme;
-
- //Now theme has been created save it to disk and broadcast themeChanged event
- saveToDisk();
- broadcastThemeChanged();
- }
-
- private function setGlobalDefaults():Void{
- //go throughu the _theme and set the _global styles
- //_global.styles.Label.setStyle('styleName',getStyleObject('label'));
- var BGPanelVisualElement = new VisualElement('BGPanel',getStyleObject('BGPanel'));
- //add visual element to the default theme
- _theme.addVisualElement(BGPanelVisualElement);
-
- }
-
- /**
- * Retrieves an instance of the ThemeManager singleton, creating it if necessary
- */
- public static function getInstance():ThemeManager{
- if(ThemeManager._instance == null){
- ThemeManager._instance = new ThemeManager();
- }
- return ThemeManager._instance;
- }
+/***************************************************************************
+ * 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.events.*
+import mx.utils.*
+import mx.transitions.easing.*
+import org.lamsfoundation.lams.common.ApplicationParent;
+import org.lamsfoundation.lams.common.Config;
+import org.lamsfoundation.lams.common.style.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.comms.*
+import org.lamsfoundation.lams.authoring.*
+
+/**
+* Manages themes throughout LAMS using the Flash event delegation model. Themes are comprised of Visual elements
+* which contains styles.
+* E.g.,
+* Theme: 'default'
+* Visual element 'LFWindow' or 'Button'
+* StyleObject contains style attributes such as 'ThemeColor', 'Color', 'borderStyle' etc.
+*
+* D:C 14-02-06 //BASE STYLE OBJ not being used - see the note on getStyleObject as its crashing the player
+*
+*
+* @class ThemeManager
+* @author DI
+* @usage //retrieving style info
+* import org.lamsfoundation.lams.common.style.*
+* myThemeManagerReference:ThemeManager = ThemeManager.getInstance();
+* myThemeManagerReference.getStyleObject()
+*
+* //Registering for theme changed events
+* myThemeManagerReference.addEventListener('themeChanged',);
+*
+* //NOTE: make sure that event listeners are removed when object goes out of scope e.g.
+* myThemeManagerReference.removeEventListener('themeChanged',);
+*
+*/
+class ThemeManager {
+
+ //Declarations
+ //This ensures that the ThemeManager is created
+ private static var _instance:ThemeManager;
+ private static var THEME_PREFIX:String = "theme.";
+ private static var THEME_LOADED:String = THEME_PREFIX + "loaded";
+
+ //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;
+
+ //The current theme
+ private var _currentThemeName:String;
+ private var _theme:Theme;
+ private var comms:Communication;
+ private var app:ApplicationParent;
+
+
+ //Constructor
+ private function ThemeManager() {
+ Debugger.log('constructor',Debugger.GEN,'constructor','org.lamsfoundation.lams.ThemeManager');
+
+ //Set up this class to use the Flash event delegation model
+ EventDispatcher.initialize(this);
+
+ //Get comms and application references
+ app = ApplicationParent.getInstance();
+ comms = app.getComms();
+ }
+
+ /**
+ * Load themes from the Server
+ */
+ public function loadTheme(theme:String){
+ //TODO DI 03/05/05 Stub for now but should query server to access themes
+ //Set the selected theme to the default theme initially
+ _currentThemeName = theme;
+ var _removeCache:Boolean = Config.getInstance().removeCache;
- /**
- * Notify registered listeners that a Styles update has happened
- */
- public function broadcastThemeChanged(){
- dispatchEvent({type:'themeChanged',target:_instance});
- }
-
-
- /**
- * Returns a style object with styles for the VisualElementId passed in
- * Returns the base style object + any features overwritten by the extended visual elemnt definition.
- * DC: Well its not returning base style obj anymore as it seems to splat the player when you try and run the merge
- * As such each style definition will have to define all thier own styles. This might speed everything up a fair bit
- */
- public function getStyleObject(visualElementId:String):mx.styles.CSSStyleDeclaration{
- //TODO DI 06/05/05 check for errors here with ID not found
- //TODO DI 06/05/05 implement, for now just return style for visual element
-
- //Get base style object theme + overwrite properties with ones in visual element for selected theme if found
- var baseSO = _theme.baseStyleObject;
-
- //Get the correct visual element
- var visualElement:VisualElement = _theme.getVisualElement(visualElementId);
- if(visualElement){
- return visualElement.styleObject;
- }else{
- Debugger.log('Visual element "'+visualElementId+'" not found, returning default',Debugger.HIGH,'getStyleObject','ThemeManager');
- return _theme.getVisualElement(visualElementId).styleObject;
- }
-
- //this bit is v.inefficent, seems to crash player - esp in toolkit
-
- //Was it found?
- if(visualElement) {
- var customSO = visualElement.styleObject;
- var sObj:Object;
-
- //Overwrite baseSO styles with those in customSO
- //Do this by converting both into a data object, copy over and then convert back from data object
- customSO = styleObjectToData(customSO);
- baseSO = styleObjectToData(baseSO);
-
- //Merge/overwrite
- //TODO: This may not be working properly, button is not reciving style infor from base.
- for (var prop in customSO){
- baseSO[prop] = customSO[prop];
- }
-
- //Convert back
- baseSO = dataToStyleObject(customSO);
-
-
- }
-
- //Construct style object by superimposing base style and visua
- return baseSO;
-
-
- }
-
- /**
- * @returns an object containing the serializable (data) parts of this class
- */
- public function toData():Object{
- //Create the empty object for holding data
- var obj:Object = {};
-
- //Call
- obj = _theme.toData();
- return obj;
- }
-
- /**
- * Creates the theme from a data object
- *
- * @param dataObj - data object containing structure of themes needed to populate themes hash table
- */
- public function createFromData(dataObj):Object{
- _theme = Theme.createFromData(dataObj);
-
- Debugger.log('Theme data: '+_theme+' found, returning'+dataObj,Debugger.HIGH,'getStyleObject','ThemeManager');
- //New theme loaded so dispatch a load event
- dispatchEvent({type:'load',target:this});
- return this;
- }
-
- /**
- * Save the Theme manager data to disk
- * @return
- */
- public function saveToDisk():Void{
- //Convert to data object and then serialize before saving to a cookie
- var dataObj:Object = toData();
- CookieMonster.save(dataObj,'theme.' + _currentThemeName,true);
-
- // open theme cookie if exists
- var themeCookie:Object = null;
- if(CookieMonster.cookieExists(THEME_LOADED)){
- themeCookie = CookieMonster.open(THEME_LOADED, true);
- }
-
- // create new theme cookie object
- var themeObj = new Object();
- themeObj.data = (themeCookie == null) ? new Array() : getThemeArray(themeCookie.data);
-
- themeObj.data.push(_currentThemeName);
-
- // save to file
- CookieMonster.save(themeObj, THEME_LOADED, true);
-
- }
-
- /**
- * Get the string array of loaded themes
- *
- *
- * @param data theme loaded cookie
- * @return array of themes
- */
-
- private function getThemeArray(data:Array):Array {
- var arr:Array = new Array();
- for(var i=0; i= 16){
- I/=16;
- count++;
- }
- for(var n:Number=count; n>0; n--){
- res += hex[Math.floor(I)];
- I = (I-Math.floor(I))*16;
- }
-
- res += hex[I];
-
- return res;
- }
-
- /**
- * Converts style object to a data format that can be serialized
- * @param so - an MX style object
- * @return Object
- */
- public static function styleObjectToData(so:Object):Object{
- //Create return obj
- var obj:Object = {};
- //Parse SO to get data
- for(var prop in so) {
- //Dont pick up functions, just objects and variables
- if(typeof(so[prop])!='function'){
- //Assign style object property to object property of same name
- obj[prop] = so.getStyle(String(prop));
-
- Debugger.log('From XML Theme data : '+prop+' found, returning'+so.getStyle(prop),Debugger.HIGH,'getStyleObject','ThemeManager');
- }
- }
- return obj;
- }
-
- /**
- * Converts data to style object (inverse method for 'styleObjectToData')
- * @usage
- * @param dataObj
- * @return
- */
- public static function dataToStyleObject(dataObj:Object):mx.styles.CSSStyleDeclaration{
-
-
- //Create Style Object
- var so = new mx.styles.CSSStyleDeclaration();
- //Parse data object and copy over properties
- for(var prop in dataObj) {
- if (typeof(dataObj[prop])=='number' && String(prop)!='fontSize'){
- var dataVal = DecToHex(dataObj[prop]);
- so.setStyle(String(prop), 0+"\x"+dataVal);
- } else {
- so.setStyle(String(prop), dataObj[prop]);
- }
- }
-
- return so;
- }
-
- /**
- * Remove all stored theme data and theme tracking cookie
- *
- * @param obj Array of theme strings
- *
- */
- public function clearAll(obj:Object) {
- for(var i=0; i= 16){
+ I/=16;
+ count++;
+ }
+ for(var n:Number=count; n>0; n--){
+ res += hex[Math.floor(I)];
+ I = (I-Math.floor(I))*16;
+ }
+
+ res += hex[I];
+
+ return res;
+ }
+
+ /**
+ * Converts style object to a data format that can be serialized
+ * @param so - an MX style object
+ * @return Object
+ */
+ public static function styleObjectToData(so:Object):Object{
+ //Create return obj
+ var obj:Object = {};
+ //Parse SO to get data
+ for(var prop in so) {
+ //Dont pick up functions, just objects and variables
+ if(typeof(so[prop])!='function'){
+ //Assign style object property to object property of same name
+ obj[prop] = so.getStyle(String(prop));
+
+ Debugger.log('From XML Theme data : '+prop+' found, returning'+so.getStyle(prop),Debugger.HIGH,'getStyleObject','ThemeManager');
+ }
+ }
+ return obj;
+ }
+
+ /**
+ * Converts data to style object (inverse method for 'styleObjectToData')
+ * @usage
+ * @param dataObj
+ * @return
+ */
+ public static function dataToStyleObject(dataObj:Object):mx.styles.CSSStyleDeclaration{
+
+
+ //Create Style Object
+ var so = new mx.styles.CSSStyleDeclaration();
+ //Parse data object and copy over properties
+ for(var prop in dataObj) {
+ if (typeof(dataObj[prop])=='number' && String(prop)!='fontSize'){
+ var dataVal = DecToHex(dataObj[prop]);
+ so.setStyle(String(prop), 0+"\x"+dataVal);
+ } else {
+ so.setStyle(String(prop), dataObj[prop]);
+ }
+ }
+
+ return so;
+ }
+
+ /**
+ * Remove all stored theme data and theme tracking cookie
+ *
+ * @param obj Array of theme strings
+ *
+ */
+ public function clearAll(obj:Object) {
+ for(var i=0; i Stage.width) { this._x = Stage.width; }
- if (this._y < 0) { this._y = 0; }
- if (this._y > Stage.height) { this._y = Stage.height; }
-
- this.stopDrag();
- _isDragging = false;
- }
- }
-
- private function addTransparentLayer(target:MovieClip) {
- var styleObj = themeManager.getStyleObject('CanvasPanel');
-
- transparentCover = target.createClassObject(Panel, "transparentCover", DepthManager.kTop, {_visible: true, enabled: false, _alpha: 0, _width: Stage.width, _height: Stage.height, styleName: styleObj});
- transparentCover.onPress = null;
- }
-
- private function removeTransparentLayer() {
- transparentCover.removeMovieClip();
- }
- public function setOKButton(lbl:String,fn:Function){
+ /**
+ * method called by content when it is loaded
+ */
+ public function contentLoaded() {
+ //dispatch an onContentLoaded event to listeners
+ dispatchEvent({type:'contentLoaded',target:this});
+ }
+
+ private function onDrag() {
+ if(!_isDragging) {
+ this.startDrag();
+ _isDragging = true;
+ }
+ else {
+ if (this._x < 0) { this._x = 0; }
+ if (this._x > Stage.width) { this._x = Stage.width; }
+ if (this._y < 0) { this._y = 0; }
+ if (this._y > Stage.height) { this._y = Stage.height; }
+
+ this.stopDrag();
+ _isDragging = false;
+ }
+ }
+
+ private function addTransparentLayer(target:MovieClip) {
+ var styleObj = themeManager.getStyleObject('CanvasPanel');
+
+ transparentCover = target.createClassObject(Panel, "transparentCover", DepthManager.kTop, {_visible: true, enabled: false, _alpha: 0, _width: Stage.width, _height: Stage.height, styleName: styleObj});
+ transparentCover.onPress = null;
+ }
+
+ private function removeTransparentLayer() {
+ transparentCover.removeMovieClip();
+ }
+
+ public function setOKButton(lbl:String,fn:Function){
if(lbl != null) {
- ok_btn.label = lbl;
- ok_btn.visible = true;
- }
-
- _okHandler = fn;
- var w = StringUtils.getButtonWidthForStr(lbl);
-
- if(w > ok_btn.width)
+ ok_btn.label = lbl;
+ ok_btn.visible = true;
+ }
+
+ _okHandler = fn;
+ var w = StringUtils.getButtonWidthForStr(lbl);
+
+ if(w > ok_btn.width)
ok_btn.setSize(w, ok_btn.height);
}
- public function setCancelButton(lbl:String,fn:Function){
- if(lbl != null) {
- cancel_btn.label = lbl;
- cancel_btn.visible = true;
- }
+ public function setCancelButton(lbl:String,fn:Function){
+ if(lbl != null) {
+ cancel_btn.label = lbl;
+ cancel_btn.visible = true;
+ }
- _cancelHandler = fn;
- var w = StringUtils.getButtonWidthForStr(lbl);
-
- if(w > cancel_btn.width)
- cancel_btn.setSize(w, cancel_btn.height);
+ _cancelHandler = fn;
+ var w = StringUtils.getButtonWidthForStr(lbl);
+ if(w > cancel_btn.width)
+ cancel_btn.setSize(w, cancel_btn.height);
+
}
-
- public function set title(__title:String) {
- modTextArea(_title);
- _title.text = __title;
- }
- public function set message(msg:String) {
+ public function set title(__title:String) {
+ modTextArea(_title);
+ _title.text = __title;
+ }
+
+ public function set message(msg:String) {
modTextArea(_message);
- _message.text = "" + msg + "
";
-
- setMessageHeight();
- setSize(200, 200);
-
- if(_parent == ApplicationParent.root)
- setPosition(Stage.width/2, Stage.height/2);
- else
- setPosition(Stage.width/2 - _parent._x, Stage.height/2 - _parent._y);
-
- _title._y = _bgpanel._y + 10;
- _title._x = -_title._width/2;
-
- _message._x = -_message._width/2;
- _message._y = _title._y + _title._height;
- }
-
- private function modTextArea(_obj:TextArea) {
- _obj._alpha = 0;
- _obj.enabled = false;
- _obj.html = true;
- }
-
- private function setMessageHeight() {
- this.createTextField("message", this.getNextHighestDepth(), -1000, -1000, 0, 0);
-
- var msg_text = this["message"];
-
- msg_text.html = true;
- msg_text.htmlText = _message.text;
- msg_text.wordWrap = true;
- msg_text.autoSize = true;
- msg_text._width = _message.width;
-
- Debugger.log('textHeight: ' + msg_text.textHeight + 120, Debugger.GEN, 'setMessageHeight', 'org.lamsfoundation.lams.Alertialog');
- _message.setSize(_message.width, msg_text.textHeight + 120);
- _textHeight = msg_text.textHeight + 120;
- }
-
- public function set type(a:Number) {
- _type = a;
-
- if(_type == AlertDialog.ALERT) {
- // centre OK button
- ok_btn._x = _bgpanel._x + _bgpanel._width/2 - ok_btn._width/2;
- ok_btn._y = _bgpanel._y + _bgpanel._height - ok_btn._height - 10;
-
- } else {
-
- cancel_btn._x = _bgpanel._x + _bgpanel._width/2 + 5;
- cancel_btn._y = _bgpanel._y + _bgpanel._height - cancel_btn._height - 10;
-
- ok_btn._x = _bgpanel._x + _bgpanel._width/2 - ok_btn._width;
- ok_btn._y = _bgpanel._y + _bgpanel._height - ok_btn._height - 10;
- }
-
- Debugger.log("bg width: " + _bgpanel._width + " setting height: " + Math.round(Math.abs(_bgpanel._y) + Math.abs(ok_btn._y) + ok_btn._height), Debugger.CRITICAL, "type", "AlertDialog");
-
+ _message.text = "" + msg + "
";
+
+ setMessageHeight();
+ setSize(200, 200);
+
+ if(_parent == ApplicationParent.root)
+ setPosition(Stage.width/2, Stage.height/2);
+ else
+ setPosition(Stage.width/2 - _parent._x, Stage.height/2 - _parent._y);
+
+ _title._y = _bgpanel._y + 10;
+ _title._x = -_title._width/2;
+
+ _message._x = -_message._width/2;
+ _message._y = _title._y + _title._height;
}
+ private function modTextArea(_obj:TextArea) {
+ _obj._alpha = 0;
+ _obj.enabled = false;
+ _obj.html = true;
+ }
+
+ private function setMessageHeight() {
+ this.createTextField("message", this.getNextHighestDepth(), -1000, -1000, 0, 0);
+
+ var msg_text = this["message"];
+
+ msg_text.html = true;
+ msg_text.htmlText = _message.text;
+ msg_text.wordWrap = true;
+ msg_text.autoSize = true;
+ msg_text._width = _message.width;
+
+ Debugger.log('textHeight: ' + msg_text.textHeight + 120, Debugger.GEN, 'setMessageHeight', 'org.lamsfoundation.lams.Alertialog');
+ _message.setSize(_message.width, msg_text.textHeight + 120);
+ _textHeight = msg_text.textHeight + 120;
+ }
+
+ public function set type(a:Number) {
+ _type = a;
+
+ if(_type == AlertDialog.ALERT) {
+ // centre OK button
+ ok_btn._x = _bgpanel._x + _bgpanel._width/2 - ok_btn._width/2;
+ ok_btn._y = _bgpanel._y + _bgpanel._height - ok_btn._height - 10;
+
+ } else {
+
+ cancel_btn._x = _bgpanel._x + _bgpanel._width/2 + 5;
+ cancel_btn._y = _bgpanel._y + _bgpanel._height - cancel_btn._height - 10;
+
+ ok_btn._x = _bgpanel._x + _bgpanel._width/2 - ok_btn._width;
+ ok_btn._y = _bgpanel._y + _bgpanel._height - ok_btn._height - 10;
+ }
+
+ Debugger.log("bg width: " + _bgpanel._width + " setting height: " + Math.round(Math.abs(_bgpanel._y) + Math.abs(ok_btn._y) + ok_btn._height), Debugger.CRITICAL, "type", "AlertDialog");
+
+ }
+
/**
* Event fired by StyleManager class to notify listeners that Theme has changed
* it is up to listeners to then query Style Manager for relevant style info
@@ -272,47 +272,47 @@
//Get the button style from the style manager and apply to both buttons
var styleObj = themeManager.getStyleObject('button');
ok_btn.setStyle('styleName',styleObj);
- cancel_btn.setStyle('styleName',styleObj);
-
- styleObj = themeManager.getStyleObject('textarea');
+ cancel_btn.setStyle('styleName',styleObj);
+
+ styleObj = themeManager.getStyleObject('textarea');
_message.setStyle("styleName", styleObj);
- _message.setStyle("disabledColor", "0xFFFFFF");
-
- _title.setStyle("styleName", styleObj);
- _title.setStyle("disabledColor", "0xFFFFFF");
-
- styleObj = themeManager.getStyleObject('AlertDialog');
- var colorTransform = styleObj.colorTransform;
-
- _bgcolor = new Color(_bgpanel);
- _bgcolor.setTransform(colorTransform);
+ _message.setStyle("disabledColor", "0xFFFFFF");
+ _title.setStyle("styleName", styleObj);
+ _title.setStyle("disabledColor", "0xFFFFFF");
+
+ styleObj = themeManager.getStyleObject('AlertDialog');
+ var colorTransform = styleObj.colorTransform;
+
+ _bgcolor = new Color(_bgpanel);
+ _bgcolor.setTransform(colorTransform);
+
}
-
- /** Fade out on click if normal Alert (not Confirm)*/
- private function onOkPress(evt:Object) {
-
- var tween_obj_handler:Object = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0.25, true);
- tween_obj_handler.onMotionFinished = Delegate.create(this, ok);
- }
-
- /** Fade out on click if normal Alert (not Confirm)*/
- private function onCancelPress(evt:Object) {
-
- var tween_obj_handler:Object = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0.25, true);
- tween_obj_handler.onMotionFinished = Delegate.create(this, cancel);
-
- }
+ /** Fade out on click if normal Alert (not Confirm)*/
+ private function onOkPress(evt:Object) {
+
+ var tween_obj_handler:Object = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0.25, true);
+ tween_obj_handler.onMotionFinished = Delegate.create(this, ok);
+ }
+
+ /** Fade out on click if normal Alert (not Confirm)*/
+ private function onCancelPress(evt:Object) {
+
+ var tween_obj_handler:Object = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0.25, true);
+ tween_obj_handler.onMotionFinished = Delegate.create(this, cancel);
+
+ }
+
/**
* Called by the cancel button
*/
private function cancel(){
Debugger.log('cancel click',Debugger.GEN,'cancel','org.lamsfoundation.lams.common.ui.InputDialog');
-
- removeTransparentLayer();
-
- _cancelHandler();
+
+ removeTransparentLayer();
+
+ _cancelHandler();
this.removeMovieClip();
}
@@ -321,49 +321,49 @@
*/
public function ok(){
Debugger.log('ok click',Debugger.GEN,'ok','org.lamsfoundation.lams.common.ui.InputDialog');
-
- removeTransparentLayer();
-
- Debugger.log('okHandler fn:' + _okHandler, Debugger.CRITICAL, "ok", "AlertDialog");
-
- _okHandler();
+
+ removeTransparentLayer();
+
+ Debugger.log('okHandler fn:' + _okHandler, Debugger.CRITICAL, "ok", "AlertDialog");
+
+ _okHandler();
this.removeMovieClip();
- }
+ }
/**
* If an alert was spawned by this dialog this method is called when it's closed
*/
- private function alertClosed(){
+ private function alertClosed(){
removeTransparentLayer();
this.removeMovieClip();
- }
+ }
/**
* Main resize method, called by scrollpane container/parent
*/
- public function setSize(w:Number,h:Number):Void{
-
- _bgpanel._width = w;
- clickTarget._width = w;
-
- if (_textHeight > h) {
- _bgpanel._height = _textHeight;
- clickTarget._height = _textHeight;
- } else {
- _bgpanel._height = h;
- clickTarget._height = h;
+ public function setSize(w:Number,h:Number):Void{
+
+ _bgpanel._width = w;
+ clickTarget._width = w;
+
+ if (_textHeight > h) {
+ _bgpanel._height = _textHeight;
+ clickTarget._height = _textHeight;
+ } else {
+ _bgpanel._height = h;
+ clickTarget._height = h;
}
- }
-
- public function setPosition(x:Number, y:Number):Void {
- _x = x;
- _y = y;
-
- _bgpanel._x = -_bgpanel._width/2;
- _bgpanel._Y = -_bgpanel._height/2;
-
- clickTarget._x = -clickTarget._width/2;
- clickTarget._Y = -clickTarget._height/2;
+ }
+
+ public function setPosition(x:Number, y:Number):Void {
+ _x = x;
+ _y = y;
+
+ _bgpanel._x = -_bgpanel._width/2;
+ _bgpanel._Y = -_bgpanel._height/2;
+
+ clickTarget._x = -clickTarget._width/2;
+ clickTarget._Y = -clickTarget._height/2;
}
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Cursor.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Cursor.as (.../Cursor.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Cursor.as (.../Cursor.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,54 +1,54 @@
-/***************************************************************************
- * 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.ApplicationParent;
+/***************************************************************************
+ * 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.ApplicationParent;
import org.lamsfoundation.lams.common.ui.*
import org.lamsfoundation.lams.common.util.*
import org.lamsfoundation.lams.authoring.*
import mx.managers.DepthManager;
-/**
+/**
* Cursor
-* Used to set alternitive cursors to the UI
-*/
-class Cursor {
- private static var _cursors:Array = new Array();
+* Used to set alternitive cursors to the UI
+*/
+class Cursor {
+ private static var _cursors:Array = new Array();
private static var _bk_cursors:Array = new Array();
- private static var _current:String = new String();
-
- //Declarations
-
- //Constructor
- function Cursor() {
+ private static var _current:String = new String();
+
+ //Declarations
+
+ //Constructor
+ function Cursor() {
}
-
+
public static function addCursor(id:String,aCursor_mc:MovieClip):Void{
- updateOrCreateCursorRef(id, ApplicationParent.ccursor, DepthManager.kCursor);
+ updateOrCreateCursorRef(id, ApplicationParent.ccursor, DepthManager.kCursor);
Debugger.log('Adding cursor ID:'+id+'('+_cursors[id]+')',Debugger.GEN,'addCursor','Cursor');
}
@@ -75,58 +75,58 @@
Mouse.show();
_cursors[_current]._visible = false;
}else{
- Mouse.hide();
- _cursors[_current]._visible = false;
-
- if(_current != id) {
-
- if(target != null || target != undefined) {
- updateOrCreateCursorRef(id, target, target._parent.getNextHighestDepth());
- } else {
- updateOrCreateCursorRef(id, ApplicationParent.ccursor, DepthManager.kCursor);
- }
- }
-
+ Mouse.hide();
+ _cursors[_current]._visible = false;
+
+ if(_current != id) {
+
+ if(target != null || target != undefined) {
+ updateOrCreateCursorRef(id, target, target._parent.getNextHighestDepth());
+ } else {
+ updateOrCreateCursorRef(id, ApplicationParent.ccursor, DepthManager.kCursor);
+ }
+ }
+
startDrag(_cursors[id], true);
_cursors[id]._visible = true;
}
_current = id;
}
-
- public static function updateOrCreateCursorRef(cursor_id:String, target:MovieClip, depth:Number) {
- Debugger.log('cursor_id:'+cursor_id + " target: " + target + " depth: " + depth,Debugger.GEN,'updateOrCreateCursorRef','Cursor');
- if(target != ApplicationParent.ccursor) {
- _bk_cursors[cursor_id] = _cursors[cursor_id];
- }
-
- var cursor_mc = target.createChildAtDepth(cursor_id, depth);
-
- cursor_mc._visible = false;
- _cursors[cursor_id] = cursor_mc;
-
- Debugger.log('cursor_mc: '+ cursor_mc,Debugger.GEN,'updateOrCreateCursorRef','Cursor');
- }
+
+ public static function updateOrCreateCursorRef(cursor_id:String, target:MovieClip, depth:Number) {
+ Debugger.log('cursor_id:'+cursor_id + " target: " + target + " depth: " + depth,Debugger.GEN,'updateOrCreateCursorRef','Cursor');
+ if(target != ApplicationParent.ccursor) {
+ _bk_cursors[cursor_id] = _cursors[cursor_id];
+ }
+ var cursor_mc = target.createChildAtDepth(cursor_id, depth);
+
+ cursor_mc._visible = false;
+ _cursors[cursor_id] = cursor_mc;
+
+ Debugger.log('cursor_mc: '+ cursor_mc,Debugger.GEN,'updateOrCreateCursorRef','Cursor');
+ }
+
/**
* Returns current cursor
* @usage
* @return String name of current cursor
*/
public static function getCurrentCursor():String{
return _current;
- }
-
- /**
- * Returns current cursor, if cursor is the mouse, then null is returned
- * @usage
- * @return Reference of current cursor
- */
- public static function getCurrentCursorRef():MovieClip{
- if(_current == "default"){
- return null;
- }else{
- return _cursors[_current];
- }
}
-
+
+ /**
+ * Returns current cursor, if cursor is the mouse, then null is returned
+ * @usage
+ * @return Reference of current cursor
+ */
+ public static function getCurrentCursorRef():MovieClip{
+ if(_current == "default"){
+ return null;
+ }else{
+ return _cursors[_current];
+ }
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Dialog.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Dialog.as (.../Dialog.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Dialog.as (.../Dialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -30,7 +30,7 @@
import org.lamsfoundation.lams.common.*;
import org.lamsfoundation.lams.common.ui.*
import org.lamsfoundation.lams.common.util.*
-import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.dict.*
import mx.containers.*
import mx.managers.*
@@ -40,60 +40,60 @@
class org.lamsfoundation.lams.common.ui.Dialog {
private static var _inputDialog:MovieClip;
- private static var _inputInstructions:String;
+ private static var _inputInstructions:String;
private static var _inputTitle:String;
- private static var _inputMessage:String;
- private static var _inputType:Number;
+ private static var _inputMessage:String;
+ private static var _inputType:Number;
private static var _inputOkButtonLabel:String;
private static var _inputCancelButtonLabel:String;
private static var _inputOkHandler:Function;
- private static var _inputCancelHandler:Function;
-
+ private static var _inputCancelHandler:Function;
+
static function createPopUp(path:MovieClip,cls:Object, initobj:Object):MovieClip{
return path.createClassChildAtDepth(cls, DepthManager.kTopmost, initobj);
}
- static function createAlertDialog(title:String, msg:String, okButtonLabel:String, cancelButtonLabel:String, okHandler:Function, cancelHandler:Function, type:Number):MovieClip {
- Debugger.log("static fn", Debugger.CRITICAL, "createAlertDialog", "Dialog");
-
- var _alertDialog:MovieClip;
-
- _inputTitle = title;
+ static function createAlertDialog(title:String, msg:String, okButtonLabel:String, cancelButtonLabel:String, okHandler:Function, cancelHandler:Function, type:Number):MovieClip {
+ Debugger.log("static fn", Debugger.CRITICAL, "createAlertDialog", "Dialog");
+
+ var _alertDialog:MovieClip;
+
+ _inputTitle = title;
_inputMessage = msg;
_inputOkButtonLabel = okButtonLabel;
_inputCancelButtonLabel = cancelButtonLabel;
_inputOkHandler = okHandler;
- _inputCancelHandler = cancelHandler;
-
- if(type != null) _inputType = type;
-
- var target:MovieClip = null;
-
- if(ApplicationParent.getInstance().getWorkspace().getWV().isOpen) {
- target = ApplicationParent.getInstance().getWorkspace().getWV().workspaceDialog;
- Debugger.log("target 1:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
- } else if(ApplicationParent.getInstance().dialog.content) {
- target = ApplicationParent.getInstance().dialog;
- Debugger.log("target 2:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
- } else {
- target = ApplicationParent.dialogue;
- Debugger.log("target 3:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
- }
-
- try {
- _alertDialog = target.attachMovie('alertDialog', 'alertDialog' + new Date().toString(), DepthManager.kTopmost, {_x:0, _y:0});
-
- Debugger.log("target:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
- Debugger.log("alertDialog:" + _alertDialog, Debugger.CRITICAL, "createAlertDialog", "Dialog");
-
- } catch(error:Error) {
- Debugger.log(error.name + ": " + error.message, Debugger.CRITICAL, "createAlertDialog", "Dialog");
- _alertDialog.removeMovieClip();
- }
+ _inputCancelHandler = cancelHandler;
+
+ if(type != null) _inputType = type;
+
+ var target:MovieClip = null;
+
+ if(ApplicationParent.getInstance().getWorkspace().getWV().isOpen) {
+ target = ApplicationParent.getInstance().getWorkspace().getWV().workspaceDialog;
+ Debugger.log("target 1:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
+ } else if(ApplicationParent.getInstance().dialog.content) {
+ target = ApplicationParent.getInstance().dialog;
+ Debugger.log("target 2:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
+ } else {
+ target = ApplicationParent.dialogue;
+ Debugger.log("target 3:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
+ }
+
+ try {
+ _alertDialog = target.attachMovie('alertDialog', 'alertDialog' + new Date().toString(), DepthManager.kTopmost, {_x:0, _y:0});
+
+ Debugger.log("target:" + target, Debugger.CRITICAL, "createAlertDialog", "Dialog");
+ Debugger.log("alertDialog:" + _alertDialog, Debugger.CRITICAL, "createAlertDialog", "Dialog");
+
+ } catch(error:Error) {
+ Debugger.log(error.name + ": " + error.message, Debugger.CRITICAL, "createAlertDialog", "Dialog");
+ _alertDialog.removeMovieClip();
+ }
//Assign dialog load handler
_alertDialog.addEventListener('contentLoaded', Proxy.create(org.lamsfoundation.lams.common.ui.Dialog,alertDialogLoaded));
-
- return _alertDialog;
+
+ return _alertDialog;
}
static function createInputDialog(instructions:String, okButtonLabel:String, cancelButtonLabel:String, okHandler:Function, cancelHandler:Function){
@@ -125,12 +125,12 @@
Debugger.log('!evt.type:'+evt.type,Debugger.GEN,'alertDialogLoaded','org.lamsfoundation.lams.common.ui.Dialog');
//Set up handlers and labels
- Debugger.log('!evt.target:'+evt.target,Debugger.GEN,'inputDialogLoaded','org.lamsfoundation.lams.common.ui.Dialog');
+ Debugger.log('!evt.target:'+evt.target,Debugger.GEN,'inputDialogLoaded','org.lamsfoundation.lams.common.ui.Dialog');
evt.target.title = _inputTitle;
evt.target.message = _inputMessage;
evt.target.setOKButton(_inputOkButtonLabel,_inputOkHandler);
- evt.target.setCancelButton(_inputCancelButtonLabel,_inputCancelHandler);
-
+ evt.target.setCancelButton(_inputCancelButtonLabel,_inputCancelHandler);
+
evt.target.type = (_inputType != null) ? _inputType : AlertDialog.ALERT;
evt.target._visible = true;
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFLoader.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFLoader.as (.../LFLoader.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFLoader.as (.../LFLoader.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -19,11 +19,11 @@
*
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
- */
-
-import org.lamsfoundation.lams.common.util.Proxy;
-import org.lamsfoundation.lams.common.util.Debugger;
-import org.lamsfoundation.lams.common.ui.*;
+ */
+
+import org.lamsfoundation.lams.common.util.Proxy;
+import org.lamsfoundation.lams.common.util.Debugger;
+import org.lamsfoundation.lams.common.ui.*;
import mx.controls.*
import mx.utils.*
@@ -35,25 +35,25 @@
* @author MS
*/
class LFLoader extends MovieClip {
-
- // components
- private var lams_logo:MovieClip;
- private var pBar:MovieClip;
- private var pBar_lbl:Label;
-
- // static variables
- private static var LOGO_X_OFFSET:Number = 43;
- private static var LABEL_X_OFFSET:Number = 66;
- private static var LOGO_Y_OFFSET:Number = 25;
- private static var LABEL_Y_OFFSET:Number = 10;
- private static var LOADER_DELAY:Number = 2000;
-
- // state variables
- private var LOADER_INT:Number;
- private var loadedCount:Number;
- private var _noComponents:Number;
- private var _noCompleted:Number;
+ // components
+ private var lams_logo:MovieClip;
+ private var pBar:MovieClip;
+ private var pBar_lbl:Label;
+
+ // static variables
+ private static var LOGO_X_OFFSET:Number = 43;
+ private static var LABEL_X_OFFSET:Number = 66;
+ private static var LOGO_Y_OFFSET:Number = 25;
+ private static var LABEL_Y_OFFSET:Number = 10;
+ private static var LOADER_DELAY:Number = 2000;
+
+ // state variables
+ private var LOADER_INT:Number;
+ private var loadedCount:Number;
+ private var _noComponents:Number;
+ private var _noCompleted:Number;
+
//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;
@@ -64,8 +64,8 @@
*/
private function LFLoader(){
//Set up this class to use the Flash event delegation model
- EventDispatcher.initialize(this);
- _noCompleted = 0;
+ EventDispatcher.initialize(this);
+ _noCompleted = 0;
//Create a clip that will wait a frame before dispatching init to give components time to setup
this.onEnterFrame = init;
@@ -74,113 +74,113 @@
/**
* Called a frame after movie attached to allow components to initialise
*/
- private function init(initObj):Void{
+ private function init(initObj):Void{
- //Delete the enterframe dispatcher
- delete this.onEnterFrame;
-
- resize();
+ //Delete the enterframe dispatcher
+ delete this.onEnterFrame;
+
+ resize();
}
-
- /**
- * Set log message for progress bar
- *
- * @param message Message to log
- */
- public function setLoadingMessage(message:String){
- //pBar.label = message;
- Debugger.log(message,Debugger.GEN,'setLoadingMessage','org.lamsfoundation.lams.common.LFLoader');
- }
-
- /**
- * Control visibility of progress bar
+ /**
+ * Set log message for progress bar
+ *
+ * @param message Message to log
+ */
+
+ public function setLoadingMessage(message:String){
+ //pBar.label = message;
+ Debugger.log(message,Debugger.GEN,'setLoadingMessage','org.lamsfoundation.lams.common.LFLoader');
+ }
+
+ /**
+ * Control visibility of progress bar
* @param v
- */
-
- public function hideProgress(v:Boolean){
- pBar.visible = v;
- }
-
- /**
- * Adjust view components
- *
- */
-
- private function resize(){
- pBar._x = (Stage.width - pBar._width)/2;
- pBar._y = (Stage.height - pBar._height)/2;
- pBar_lbl._x = pBar._x + LABEL_X_OFFSET;
- pBar_lbl._y = pBar._y + LABEL_Y_OFFSET;
- lams_logo._x = pBar._x + LOGO_X_OFFSET;
- lams_logo._y = pBar._y - (lams_logo._height + LOGO_Y_OFFSET);
- }
-
- /**
- * Set initial progess and application component no to evaluate percentage
- *
- * @param componentNo The number of application components to load
- *
- */
-
- public function start(componentNo:Number){
- _noComponents = componentNo;
- setProgress(_noCompleted, _noComponents);
- }
-
- /**
- * Fill the progress bar when finished loading
- */
-
- public function stop(){
- setProgress(1,1);
- destroy();
- }
-
- public function setProgress(completed:Number, total:Number){
- if(completed != undefined && total != undefined){
- pBar.setProgress(completed, total);
- pBar_lbl.text = Math.round(pBar.percentComplete) + "%";
- } else {
- // TODO: ERROR updating progress
- }
- }
-
- /**
- * Update the progress bar after a component has been completed
- *
- */
- public function complete(){
- _noCompleted++;
- if(_noCompleted <= _noComponents){
- // update progress
- setProgress(_noCompleted, _noComponents);
- } else {
- // loading progress completed
- setProgress(1,1);
- }
- }
-
- /**
- * Set the number of application components to load
- */
- public function set noComponents(a:Number){
- _noComponents = a;
- }
-
- /**
- * Remove the MovieClip
- *
+ */
+
+ public function hideProgress(v:Boolean){
+ pBar.visible = v;
+ }
+
+ /**
+ * Adjust view components
+ *
*/
- private function destroy(){
- if(!LOADER_INT){
- LOADER_INT = setInterval(Proxy.create(this, remove), LOADER_DELAY);
- } else {
- }
- }
-
- private function remove(){
- clearInterval(LOADER_INT);
- this.removeMovieClip();
- }
+
+ private function resize(){
+ pBar._x = (Stage.width - pBar._width)/2;
+ pBar._y = (Stage.height - pBar._height)/2;
+ pBar_lbl._x = pBar._x + LABEL_X_OFFSET;
+ pBar_lbl._y = pBar._y + LABEL_Y_OFFSET;
+ lams_logo._x = pBar._x + LOGO_X_OFFSET;
+ lams_logo._y = pBar._y - (lams_logo._height + LOGO_Y_OFFSET);
+ }
+
+ /**
+ * Set initial progess and application component no to evaluate percentage
+ *
+ * @param componentNo The number of application components to load
+ *
+ */
+
+ public function start(componentNo:Number){
+ _noComponents = componentNo;
+ setProgress(_noCompleted, _noComponents);
+ }
+
+ /**
+ * Fill the progress bar when finished loading
+ */
+
+ public function stop(){
+ setProgress(1,1);
+ destroy();
+ }
+
+ public function setProgress(completed:Number, total:Number){
+ if(completed != undefined && total != undefined){
+ pBar.setProgress(completed, total);
+ pBar_lbl.text = Math.round(pBar.percentComplete) + "%";
+ } else {
+ // TODO: ERROR updating progress
+ }
+ }
+
+ /**
+ * Update the progress bar after a component has been completed
+ *
+ */
+ public function complete(){
+ _noCompleted++;
+ if(_noCompleted <= _noComponents){
+ // update progress
+ setProgress(_noCompleted, _noComponents);
+ } else {
+ // loading progress completed
+ setProgress(1,1);
+ }
+ }
+
+ /**
+ * Set the number of application components to load
+ */
+ public function set noComponents(a:Number){
+ _noComponents = a;
+ }
+
+ /**
+ * Remove the MovieClip
+ *
+ */
+ private function destroy(){
+ if(!LOADER_INT){
+ LOADER_INT = setInterval(Proxy.create(this, remove), LOADER_DELAY);
+ } else {
+ }
+ }
+
+ private function remove(){
+ clearInterval(LOADER_INT);
+ this.removeMovieClip();
+ }
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMenuBar.as
===================================================================
diff -u -r327655a8d92f9ed44f5662c92704ade48ec4c1ed -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMenuBar.as (.../LFMenuBar.as) (revision 327655a8d92f9ed44f5662c92704ade48ec4c1ed)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMenuBar.as (.../LFMenuBar.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,31 +1,31 @@
-/***************************************************************************
- * 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.ApplicationParent;
+/***************************************************************************
+ * 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.ApplicationParent;
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.common.ws.Workspace
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.ws.Workspace
import mx.controls.*
import mx.utils.*
@@ -41,22 +41,22 @@
private var _mb:MenuBar;
// variables in this script
- private var file_menu:Menu;
- private var edit_menu:Menu;
- private var view_menu:Menu;
+ private var file_menu:Menu;
+ private var edit_menu:Menu;
+ private var view_menu:Menu;
private var go_menu:Menu;
private var tools_menu:Menu;
private var help_menu:Menu;
- private var env:String;
- private var isLocked:Boolean;
+ private var env:String;
+ private var isLocked:Boolean;
private var layout:String;
private var view_xml:XML; // to illustrate creating a menu with xml
private var app:ApplicationParent;
private var tm:ThemeManager;
private var _dictionary:Dictionary;
-
- private static var _instance:LFMenuBar = null;
+
+ private static var _instance:LFMenuBar = null;
//These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher
private var dispatchEvent:Function;
@@ -69,189 +69,189 @@
//Set up init for next frame and make invisible this frame
this.onEnterFrame = init;
this._visible = false;
- _instance = this;
+ _instance = this;
//Get a reference to the application, ThemeManager and Dictionary
app = ApplicationParent.getInstance();
- tm = ThemeManager.getInstance();
+ tm = ThemeManager.getInstance();
_dictionary = Dictionary.getInstance();
_dictionary.addEventListener('init',Delegate.create(this,setupMenuItems));
- }
- /**
- * Retrieves an instance of the LFMenuBar singleton
- */
- public static function getInstance():LFMenuBar{
- if(LFMenuBar._instance == null){
- LFMenuBar._instance = new LFMenuBar();
- }
- return LFMenuBar._instance;
}
+ /**
+ * Retrieves an instance of the LFMenuBar singleton
+ */
+ public static function getInstance():LFMenuBar{
+ if(LFMenuBar._instance == null){
+ LFMenuBar._instance = new LFMenuBar();
+ }
+ return LFMenuBar._instance;
+ }
public function init() {
- Debugger.log('init called',Debugger.GEN,'init','LFMenuBar');
+ Debugger.log('init called',Debugger.GEN,'init','LFMenuBar');
//Kill enter frame
delete this.onEnterFrame;
//Register for theme changed events and set Initial style
- tm.addEventListener('themeChanged',this);
+ tm.addEventListener('themeChanged',this);
//Broadcast event
- dispatchEvent({type:'load',target:this});
+ dispatchEvent({type:'load',target:this});
this.tabChildren = true;
}
-
-
-
- private function setTabIndex(selectedTab:String){
-
- //All Buttons Tab Index
- file_menu.tabIndex = 101
- edit_menu.tabIndex = 102
- tools_menu.tabIndex = 103
- help_menu.tabIndex = 104
-
+
+
+
+ private function setTabIndex(selectedTab:String){
+
+ //All Buttons Tab Index
+ file_menu.tabIndex = 101
+ edit_menu.tabIndex = 102
+ tools_menu.tabIndex = 103
+ help_menu.tabIndex = 104
+
}
/**
* Set up the actual menu items
*/
- private function setupMenuItems(){
-
- setVisible(!isLocked);
-
- if (env != "Monitoring"){
-
+ private function setupMenuItems(){
+
+ setVisible(!isLocked);
+
+ if (env != "Monitoring"){
+
/*=================
FILE MENU
=================*/
file_menu = _mb.addMenu(Dictionary.getValue('mnu_file'));
- if(layout != ApplicationParent.EDIT_MODE) {
+ if(layout != ApplicationParent.EDIT_MODE) {
file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_new'), instanceName:"newItem"});
file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_open'), instanceName:"openItem"});
file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_recover'), instanceName:"recoverItem", enabled:false});
-
- file_menu.addMenuItem({type:"separator"});
-
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_save'), instanceName:"saveItem"});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_saveas'), instanceName:"saveItemAs"});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_insertdesign'), instanceName:"insertDesignItem", enabled:false});
-
- file_menu.addMenuItem({type:"separator"});
-
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_import'), instanceName:"importItem"});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_export'), instanceName:"exportItem", enabled:false});
-
- file_menu.addMenuItem({type:"separator"});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_exit'), instanceName:"exitItem"});
-
- } else {
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_apply_changes'), instanceName:"saveItem"});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_insertdesign'), instanceName:"insertDesignItem", enabled:true});
-
- file_menu.addMenuItem({type:"separator"});
-
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_finish'), instanceName:"finishItem"});
- }
-
- /*=================
- EDIT MENU
- =================*/
- edit_menu = _mb.addMenu(Dictionary.getValue("mnu_edit"));
-
- edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_undo'), instanceName:"undoItem"});
- edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_redo'), instanceName:"redoItem"});
- edit_menu.addMenuItem({type:"separator"});
- edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_copy'), instanceName:"copyItem"});
- edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_paste'), instanceName:"pasteItem"});
+
+ file_menu.addMenuItem({type:"separator"});
+
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_save'), instanceName:"saveItem"});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_saveas'), instanceName:"saveItemAs"});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_insertdesign'), instanceName:"insertDesignItem", enabled:false});
+
+ file_menu.addMenuItem({type:"separator"});
+
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_import'), instanceName:"importItem"});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_export'), instanceName:"exportItem", enabled:false});
+
+ file_menu.addMenuItem({type:"separator"});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_exit'), instanceName:"exitItem"});
+
+ } else {
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_apply_changes'), instanceName:"saveItem"});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_insertdesign'), instanceName:"insertDesignItem", enabled:true});
+
+ file_menu.addMenuItem({type:"separator"});
+
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_finish'), instanceName:"finishItem"});
+ }
+
+ /*=================
+ EDIT MENU
+ =================*/
+ edit_menu = _mb.addMenu(Dictionary.getValue("mnu_edit"));
+
+ edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_undo'), instanceName:"undoItem"});
+ edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_redo'), instanceName:"redoItem"});
+ edit_menu.addMenuItem({type:"separator"});
+ edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_copy'), instanceName:"copyItem"});
+ edit_menu.addMenuItem({label:Dictionary.getValue('mnu_edit_paste'), instanceName:"pasteItem"});
/*=================
TOOLS MENU
- =================*/
- //_global.breakpoint();
- tools_menu = _mb.addMenu(Dictionary.getValue('mnu_tools'));
+ =================*/
+ //_global.breakpoint();
+ tools_menu = _mb.addMenu(Dictionary.getValue('mnu_tools'));
tools_menu.addMenuItem({label:Dictionary.getValue('mnu_tools_trans'), instanceName:"drawTransitionalItem"});
tools_menu.addMenuItem({label:Dictionary.getValue('mnu_tools_opt'), instanceName:"drawOptionalItem"});
-
- tools_menu.addMenuItem({type:"separator"});
- tools_menu.addMenuItem({label:Dictionary.getValue('competence_editor_dlg'), instanceName:"competenceEditor"});
-
+
+ tools_menu.addMenuItem({type:"separator"});
+ tools_menu.addMenuItem({label:Dictionary.getValue('competence_editor_dlg'), instanceName:"competenceEditor"});
+
//tools_menu.addMenuItem({type:"separator"});
//tools_menu.addMenuItem({label:Dictionary.getValue('mnu_tools_prefs'), instanceName:"prefsItem", enabled:false});
/*=================
HELP MENU
=================*/
help_menu = _mb.addMenu(Dictionary.getValue('mnu_help'));
- help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_help'), instanceName:"helpGenItem"});
+ help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_help'), instanceName:"helpGenItem"});
help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_abt'), instanceName:"aboutItem"});
-
+
//set up listeners
// register the listeners with the separate menus
file_menu.addEventListener("change", Delegate.create(this,fileMenuClicked));
- edit_menu.addEventListener("change", Delegate.create(this,editMenuClicked));
+ edit_menu.addEventListener("change", Delegate.create(this,editMenuClicked));
tools_menu.addEventListener("change", Delegate.create(this,toolsMenuClicked));
- help_menu.addEventListener("change", Delegate.create(this, helpMenuClicked));
+ help_menu.addEventListener("change", Delegate.create(this, helpMenuClicked));
//Now that menu items have been set up make the menu bar visible
- this._visible = true;
+ this._visible = true;
Debugger.log('Finished setting up set visible to:'+this._visible,Debugger.GEN,'setupMenuItems','LFMenuBar');
-
- } else {
-
-
- /*=================
- FILE MENU
- =================*/
- file_menu = _mb.addMenu(Dictionary.getValue('mnu_file'));
-
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_refresh'), instanceName:"refreshItem", enabled:true});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_editclass'), instanceName:"editClassItem", enabled:false});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_start'), instanceName:"startItem", enabled:false});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_schedule'), instanceName:"scheduleItem", enabled:false});
-
- file_menu.addMenuItem({type:"separator"});
- file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_exit'), instanceName:"exitItem"});
-
- /*=================
- VIEW MENU
- =================*/
- //_global.breakpoint();
- view_menu = _mb.addMenu(Dictionary.getValue('mnu_view'));
-
- view_menu.addMenuItem({label:Dictionary.getValue('mnu_view_learners'), instanceName:"viewLearners", enabled:false});
- view_menu.addMenuItem({label:Dictionary.getValue('view_competences_dlg'), instanceName:"viewCompetences", enabled:true});
-
- /*=================
- GO MENU
- =================*/
- //_global.breakpoint();
- go_menu = _mb.addMenu(Dictionary.getValue('mnu_go'));
-
- go_menu.addMenuItem({label:Dictionary.getValue('mnu_go_lesson'), instanceName:"goLessonTab"});
- go_menu.addMenuItem({label:Dictionary.getValue('mnu_go_sequence'), instanceName:"goSequenceTab"});
- go_menu.addMenuItem({label:Dictionary.getValue('mnu_go_learners'), instanceName:"goLearnerTab"});
-
- /*=================
- HELP MENU
- =================*/
- help_menu = _mb.addMenu(Dictionary.getValue('mnu_help'));
- help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_help'), instanceName:"helpGenItem"});
- help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_abt'), instanceName:"aboutItem"});
-
- //set up listeners
- // register the listeners with the separate menus
- file_menu.addEventListener("change", Delegate.create(this,fileMenuClicked));
- view_menu.addEventListener("change", Delegate.create(this,viewMenuClicked));
- go_menu.addEventListener("change", Delegate.create(this,goMenuClicked));
- help_menu.addEventListener("change", Delegate.create(this, helpMenuClicked));
- //Now that menu items have been set up make the menu bar visible
- this._visible = true;
- Debugger.log('Finished setting up set visible to:'+this._visible,Debugger.GEN,'setupMenuItems','LFMenuBar');
+
+ } else {
+
+
+ /*=================
+ FILE MENU
+ =================*/
+ file_menu = _mb.addMenu(Dictionary.getValue('mnu_file'));
+
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_refresh'), instanceName:"refreshItem", enabled:true});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_editclass'), instanceName:"editClassItem", enabled:false});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_start'), instanceName:"startItem", enabled:false});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_schedule'), instanceName:"scheduleItem", enabled:false});
+
+ file_menu.addMenuItem({type:"separator"});
+ file_menu.addMenuItem({label:Dictionary.getValue('mnu_file_exit'), instanceName:"exitItem"});
+
+ /*=================
+ VIEW MENU
+ =================*/
+ //_global.breakpoint();
+ view_menu = _mb.addMenu(Dictionary.getValue('mnu_view'));
+
+ view_menu.addMenuItem({label:Dictionary.getValue('mnu_view_learners'), instanceName:"viewLearners", enabled:false});
+ view_menu.addMenuItem({label:Dictionary.getValue('view_competences_dlg'), instanceName:"viewCompetences", enabled:true});
+
+ /*=================
+ GO MENU
+ =================*/
+ //_global.breakpoint();
+ go_menu = _mb.addMenu(Dictionary.getValue('mnu_go'));
+
+ go_menu.addMenuItem({label:Dictionary.getValue('mnu_go_lesson'), instanceName:"goLessonTab"});
+ go_menu.addMenuItem({label:Dictionary.getValue('mnu_go_sequence'), instanceName:"goSequenceTab"});
+ go_menu.addMenuItem({label:Dictionary.getValue('mnu_go_learners'), instanceName:"goLearnerTab"});
+
+ /*=================
+ HELP MENU
+ =================*/
+ help_menu = _mb.addMenu(Dictionary.getValue('mnu_help'));
+ help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_help'), instanceName:"helpGenItem"});
+ help_menu.addMenuItem({label:Dictionary.getValue('mnu_help_abt'), instanceName:"aboutItem"});
+
+ //set up listeners
+ // register the listeners with the separate menus
+ file_menu.addEventListener("change", Delegate.create(this,fileMenuClicked));
+ view_menu.addEventListener("change", Delegate.create(this,viewMenuClicked));
+ go_menu.addEventListener("change", Delegate.create(this,goMenuClicked));
+ help_menu.addEventListener("change", Delegate.create(this, helpMenuClicked));
+ //Now that menu items have been set up make the menu bar visible
+ this._visible = true;
+ Debugger.log('Finished setting up set visible to:'+this._visible,Debugger.GEN,'setupMenuItems','LFMenuBar');
}
}
@@ -275,159 +275,159 @@
break;
case eventObj.menu.openItem :
org.lamsfoundation.lams.authoring.Application(app).getCanvas().openDesignBySelection();
- break;
- case eventObj.menu.recoverItem :
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().showRecoverMessage();
- break;
- case eventObj.menu.saveItem:
- Debugger.log('Clicked Flie > Save',Debugger.GEN,'fileMenuClicked','LFMenuBar');
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().saveDesign();
- break;
-
- case eventObj.menu.saveItemAs:
- //TODO: go through workspace to save design in location
- Debugger.log('Clicked File > Save As',Debugger.GEN,'fileMenuClicked','LFMenuBar');
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().saveDesignToServerAs(Workspace.MODE_SAVEAS);
- break;
- case eventObj.menu.insertDesignItem:
- Debugger.log('Clicked File > Insert...',Debugger.GEN,'fileMenuClicked','LFMenuBar');
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().openDesignBySelection(Workspace.MODE_INSERT);
- break;
- case eventObj.menu.importItem:
- Debugger.log('Clicked File > Import',Debugger.GEN,'fileMenuClicked','LFMenuBar');
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().launchImportWindow();
- break;
- case eventObj.menu.exportItem:
- Debugger.log('Clicked File > Export',Debugger.GEN,'fileMenuClicked','LFMenuBar');
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().launchExportWindow();
- break;
- case eventObj.menu.editClassItem:
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().setDialogOpen("LM_DIALOG");
- break;
- case eventObj.menu.refreshItem:
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().refreshAllData();
- break;
- case eventObj.menu.startItem:
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().startLesson(false, _root.lessonID);
- break;
- case eventObj.menu.scheduleItem:
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMV().getLessonTabView().scheduleLessonStart();
- break;
- case eventObj.menu.exitItem:
- ApplicationParent.extCall("closeWindow", null);
- break;
- case eventObj.menu.revertItem :
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().revertCanvas();
- break;
- case eventObj.menu.finishItem :
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().finishEditOnFly();
break;
+ case eventObj.menu.recoverItem :
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().showRecoverMessage();
+ break;
+ case eventObj.menu.saveItem:
+ Debugger.log('Clicked Flie > Save',Debugger.GEN,'fileMenuClicked','LFMenuBar');
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().saveDesign();
+ break;
+
+ case eventObj.menu.saveItemAs:
+ //TODO: go through workspace to save design in location
+ Debugger.log('Clicked File > Save As',Debugger.GEN,'fileMenuClicked','LFMenuBar');
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().saveDesignToServerAs(Workspace.MODE_SAVEAS);
+ break;
+ case eventObj.menu.insertDesignItem:
+ Debugger.log('Clicked File > Insert...',Debugger.GEN,'fileMenuClicked','LFMenuBar');
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().openDesignBySelection(Workspace.MODE_INSERT);
+ break;
+ case eventObj.menu.importItem:
+ Debugger.log('Clicked File > Import',Debugger.GEN,'fileMenuClicked','LFMenuBar');
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().launchImportWindow();
+ break;
+ case eventObj.menu.exportItem:
+ Debugger.log('Clicked File > Export',Debugger.GEN,'fileMenuClicked','LFMenuBar');
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().launchExportWindow();
+ break;
+ case eventObj.menu.editClassItem:
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().setDialogOpen("LM_DIALOG");
+ break;
+ case eventObj.menu.refreshItem:
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().refreshAllData();
+ break;
+ case eventObj.menu.startItem:
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().startLesson(false, _root.lessonID);
+ break;
+ case eventObj.menu.scheduleItem:
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMV().getLessonTabView().scheduleLessonStart();
+ break;
+ case eventObj.menu.exitItem:
+ ApplicationParent.extCall("closeWindow", null);
+ break;
+ case eventObj.menu.revertItem :
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().revertCanvas();
+ break;
+ case eventObj.menu.finishItem :
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().finishEditOnFly();
+ break;
}
}
-
- /**
- * event handler for file menu click
- */
- private function editMenuClicked(eventObj:Object):Void{
- //Which item was clicked ?
- switch (eventObj.menuItem) {
- case eventObj.menu.undoItem :
- trace('new selected');
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().undo();
- break;
- case eventObj.menu.redoItem :
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().redo();
- break;
- case eventObj.menu.cutItem :
- org.lamsfoundation.lams.authoring.Application(app).cut();
- break;
- case eventObj.menu.copyItem :
- org.lamsfoundation.lams.authoring.Application(app).copy();
- break;
- case eventObj.menu.pasteItem :
- org.lamsfoundation.lams.authoring.Application(app).paste();
- break;
- }
- }
-
-
- /**
- * event handler for go menu click
- */
- private function goMenuClicked(eventObj:Object):Void{
- var tab:MovieClip = org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMV().getMonitorTab();
- switch(eventObj.menuItem) {
- case eventObj.menu.goLessonTab :
- tab.selectedIndex = 0;
- break;
- case eventObj.menu.goSequenceTab :
- tab.selectedIndex = 1;
- break;
- case eventObj.menu.goLearnerTab :
- tab.selectedIndex = 2;
- break;
- case eventObj.menu.goTodoTab :
- tab.selectedIndex = 3;
- break;
-
- dispatchEvent({type:'change', target: tab});
- }
- }
-
- /**
- * event handler for view menu click
- */
- private function viewMenuClicked(eventObj:Object):Void{
- switch(eventObj.menuItem) {
- case eventObj.menu.viewLearners :
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().setDialogOpen("VM_DIALOG");
- break;
- case eventObj.menu.viewCompetences :
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().setDialogOpen("VIEW_COMPETENCES_DIALOG");
- break;
- }
- }
+
+ /**
+ * event handler for file menu click
+ */
+ private function editMenuClicked(eventObj:Object):Void{
+ //Which item was clicked ?
+ switch (eventObj.menuItem) {
+ case eventObj.menu.undoItem :
+ trace('new selected');
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().undo();
+ break;
+ case eventObj.menu.redoItem :
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().redo();
+ break;
+ case eventObj.menu.cutItem :
+ org.lamsfoundation.lams.authoring.Application(app).cut();
+ break;
+ case eventObj.menu.copyItem :
+ org.lamsfoundation.lams.authoring.Application(app).copy();
+ break;
+ case eventObj.menu.pasteItem :
+ org.lamsfoundation.lams.authoring.Application(app).paste();
+ break;
+ }
+ }
+
/**
+ * event handler for go menu click
+ */
+ private function goMenuClicked(eventObj:Object):Void{
+ var tab:MovieClip = org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMV().getMonitorTab();
+ switch(eventObj.menuItem) {
+ case eventObj.menu.goLessonTab :
+ tab.selectedIndex = 0;
+ break;
+ case eventObj.menu.goSequenceTab :
+ tab.selectedIndex = 1;
+ break;
+ case eventObj.menu.goLearnerTab :
+ tab.selectedIndex = 2;
+ break;
+ case eventObj.menu.goTodoTab :
+ tab.selectedIndex = 3;
+ break;
+
+ dispatchEvent({type:'change', target: tab});
+ }
+ }
+
+ /**
+ * event handler for view menu click
+ */
+ private function viewMenuClicked(eventObj:Object):Void{
+ switch(eventObj.menuItem) {
+ case eventObj.menu.viewLearners :
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().setDialogOpen("VM_DIALOG");
+ break;
+ case eventObj.menu.viewCompetences :
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().getMM().setDialogOpen("VIEW_COMPETENCES_DIALOG");
+ break;
+ }
+ }
+
+ /**
* event handler for tool menu click
*/
private function toolsMenuClicked(eventObj:Object):Void{
//Which item was clicked ?
- switch (eventObj.menuItem) {
+ switch (eventObj.menuItem) {
case eventObj.menu.prefsItem :
org.lamsfoundation.lams.authoring.Application(app).showPrefsDialog();
break;
case eventObj.menu.drawTransitionalItem :
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().toggleTransitionTool();
- break;
- case eventObj.menu.drawOptionalItem :
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().toggleTransitionTool();
+ break;
+ case eventObj.menu.drawOptionalItem :
org.lamsfoundation.lams.authoring.Application(app).getCanvas().toggleOptionalActivity();
- break;
- case eventObj.menu.competenceEditor :
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().openCompetenceEditorWindow();
break;
+ case eventObj.menu.competenceEditor :
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().openCompetenceEditorWindow();
+ break;
}
- }
-
- /**
- * event handler for help menu click
- */
- private function helpMenuClicked(eventObj:Object):Void{
- switch (eventObj.menuItem) {
- case eventObj.menu.helpItem :
- break;
- case eventObj.menu.helpGenItem :
- app.getHelpURL();
- break;
- case eventObj.menu.aboutItem :
- if (env != "Monitoring"){
- org.lamsfoundation.lams.authoring.Application(app).getCanvas().openAboutLams();
- }else {
- org.lamsfoundation.lams.monitoring.Application(app).getMonitor().openAboutLams();
- }
- //LFMessage.showMessageAlert("Serial No: " + ApplicationParent.SERIAL_NO);
- break;
- }
+ }
+
+ /**
+ * event handler for help menu click
+ */
+ private function helpMenuClicked(eventObj:Object):Void{
+ switch (eventObj.menuItem) {
+ case eventObj.menu.helpItem :
+ break;
+ case eventObj.menu.helpGenItem :
+ app.getHelpURL();
+ break;
+ case eventObj.menu.aboutItem :
+ if (env != "Monitoring"){
+ org.lamsfoundation.lams.authoring.Application(app).getCanvas().openAboutLams();
+ }else {
+ org.lamsfoundation.lams.monitoring.Application(app).getMonitor().openAboutLams();
+ }
+ //LFMessage.showMessageAlert("Serial No: " + ApplicationParent.SERIAL_NO);
+ break;
+ }
}
/**
@@ -443,51 +443,51 @@
Debugger.log('themeChanged event broadcast with an object.type not equal to "themeChanged"',Debugger.CRITICAL,'themeChanged','LFMenuBar');
}
}
-
- public function enableInsertDesign(enable:Boolean){
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(6), enable);
- }
-
- public function enableExport(enable:Boolean){
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(9), enable);
- }
-
- public function enableSave(enable:Boolean){
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(4), enable);
- }
-
- public function enableRecover(enable:Boolean){
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(2), enable);
- }
-
- public function get fileMenu():Menu {
- return file_menu;
- }
-
- public function get viewMenu():Menu {
- return view_menu;
- }
-
- public function setDefaults():Void{
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(1), false);
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(2), false);
- file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(3), false);
-
- view_menu.setMenuItemEnabled(view_menu.getMenuItemAt(0), true);
- }
+
+ public function enableInsertDesign(enable:Boolean){
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(6), enable);
+ }
+ public function enableExport(enable:Boolean){
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(9), enable);
+ }
+
+ public function enableSave(enable:Boolean){
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(4), enable);
+ }
+
+ public function enableRecover(enable:Boolean){
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(2), enable);
+ }
+
+ public function get fileMenu():Menu {
+ return file_menu;
+ }
+
+ public function get viewMenu():Menu {
+ return view_menu;
+ }
+
+ public function setDefaults():Void{
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(1), false);
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(2), false);
+ file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(3), false);
+
+ view_menu.setMenuItemEnabled(view_menu.getMenuItemAt(0), true);
+ }
+
/**
* Set the styles for the menu called from init. and themeChanged event handler
*/
private function setStyles() {
var styleObj = tm.getStyleObject('LFMenuBar');
_mb.setStyle('styleName',styleObj);
- }
-
- public function setVisible(b:Boolean) {
- _mb.visible = b;
- }
+ }
+ public function setVisible(b:Boolean) {
+ _mb.visible = b;
+ }
+
function get className():String {
return 'LFMenuBar';
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMessage.as
===================================================================
diff -u -re2883d54b929369b486573d1c056a8d7d7e44825 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMessage.as (.../LFMessage.as) (revision e2883d54b929369b486573d1c056a8d7d7e44825)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMessage.as (.../LFMessage.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -40,7 +40,7 @@
//Declarations
private var _ref:Object;
private var _fn:String;
- private var title:String;
+ private var title:String;
//Constructor
function LFMessage() {
@@ -49,35 +49,35 @@
title = Dictionary.getValue('al_alert')
}
- public static function showMessageAlert(msg, okHandler){
- var title:String = "" + Dictionary.getValue('al_alert') + "\n";
- var _dialog:MovieClip;
-
- if(okHandler != undefined){
+ public static function showMessageAlert(msg, okHandler){
+ var title:String = "" + Dictionary.getValue('al_alert') + "\n";
+ var _dialog:MovieClip;
+
+ if(okHandler != undefined){
_dialog = Dialog.createAlertDialog(title, msg, Dictionary.getValue('al_ok'), null, okHandler, null, AlertDialog.ALERT);
- }else{
+ }else{
_dialog = Dialog.createAlertDialog(title, msg, Dictionary.getValue('al_ok'), null, null, null, AlertDialog.ALERT);
- }
+ }
}
- public static function showMessageConfirm(msg:String, okHandler:Function, cancelHandler:Function, okLabel:String, cancelLabel:String, msgTitle:String){
- var _dialog:MovieClip;
-
- if(msgTitle == null){
- msgTitle = Dictionary.getValue('al_confirm');
- }
-
- var title:String = "" + msgTitle + "\n";
-
- if(!okLabel){
- okLabel = Dictionary.getValue('al_ok');
- }
-
- if(!cancelLabel){
- cancelLabel = Dictionary.getValue('al_cancel');
- }
-
- _dialog = Dialog.createAlertDialog(title, msg, okLabel, cancelLabel, okHandler, cancelHandler, AlertDialog.CONFIRM);
+ public static function showMessageConfirm(msg:String, okHandler:Function, cancelHandler:Function, okLabel:String, cancelLabel:String, msgTitle:String){
+ var _dialog:MovieClip;
+
+ if(msgTitle == null){
+ msgTitle = Dictionary.getValue('al_confirm');
+ }
+
+ var title:String = "" + msgTitle + "\n";
+
+ if(!okLabel){
+ okLabel = Dictionary.getValue('al_ok');
+ }
+
+ if(!cancelLabel){
+ cancelLabel = Dictionary.getValue('al_cancel');
+ }
+
+ _dialog = Dialog.createAlertDialog(title, msg, okLabel, cancelLabel, okHandler, cancelHandler, AlertDialog.CONFIRM);
}
public function get reference():Object{
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFWindow.as
===================================================================
diff -u -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFWindow.as (.../LFWindow.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFWindow.as (.../LFWindow.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,266 +1,266 @@
-/***************************************************************************
- * 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.containers.*
-import mx.managers.*
-import mx.utils.*
-import org.lamsfoundation.lams.common.util.*
-import org.lamsfoundation.lams.common.ui.*
-
-/**
-* LFWindow - Extends the MM Window class and will be used for all LAMS windows + dialogs
-* @author DI
+/***************************************************************************
+ * 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.containers.*
+import mx.managers.*
+import mx.utils.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+
+/**
+* LFWindow - Extends the MM Window class and will be used for all LAMS windows + dialogs
+* @author DI
*
-* TODO DI-16/05/05 Configure resize/scroll policy logic to stop scrollbars appearing spuriously on resize
+* TODO DI-16/05/05 Configure resize/scroll policy logic to stop scrollbars appearing spuriously on resize
*/
class LFWindow extends Window{
-
- //Declarations
+
+ //Declarations
//Static vars
- public static var symbolOwner:Object = Window;
-
- private static var MIN_WIDTH = 160; //Minimum window dimensions
- private static var MIN_HEIGHT = 120;
-
- private static var RESIZE_WIDTH_OFFSET = 10; //Offset to place resize clip from bottom rhs of window
- private static var RESIZE_HEIGHT_OFFSET = 10;
-
- private static var MARGIN_WIDTH:Number = 6; //Differences between scroll content + window dimensions
- private static var MARGIN_HEIGHT:Number = 35;
-
+ public static var symbolOwner:Object = Window;
+
+ private static var MIN_WIDTH = 160; //Minimum window dimensions
+ private static var MIN_HEIGHT = 120;
+
+ private static var RESIZE_WIDTH_OFFSET = 10; //Offset to place resize clip from bottom rhs of window
+ private static var RESIZE_HEIGHT_OFFSET = 10;
+
+ private static var MARGIN_WIDTH:Number = 6; //Differences between scroll content + window dimensions
+ private static var MARGIN_HEIGHT:Number = 35;
+
//Public vars
- public var className:String = 'LFWindow';
-
- //Private vars
- private var resize_mc:MovieClip; //Clip clicked on for resize
- private var viewResize:Boolean;
- private var _scrollContentPath:String; //Main content of the LFWindow within a scrollpane
- private var _helpButtonHandler:Function; //Called when help button clicked
- private var _help_btn:Button; //Help button reference
-
- public var centred:Boolean=false;
- private var setUpFinished:Boolean = false;
-
- //Constructor
+ public var className:String = 'LFWindow';
+
+ //Private vars
+ private var resize_mc:MovieClip; //Clip clicked on for resize
+ private var viewResize:Boolean;
+ private var _scrollContentPath:String; //Main content of the LFWindow within a scrollpane
+ private var _helpButtonHandler:Function; //Called when help button clicked
+ private var _help_btn:Button; //Help button reference
+
+ public var centred:Boolean=false;
+ private var setUpFinished:Boolean = false;
+
+ //Constructor
function LFWindow() {
- }
-
- public function init():Void {
- super.init();
-
- //LFWindow contains a scroll pane which contains the content.
- contentPath = 'ScrollPane';
-
- //set up skin
- skinCloseOver = 'LFCloseButtonOver';
- skinCloseDown = 'LFCloseButtonDown';
-
- //Add event listener for complete event, fired when scrollpane is loaded
- this.addEventListener('complete',Delegate.create(this,scrollLoaded));
- this._visible=false;
- }
-
- /**
- * Fired by Window when content has loaded i.e. ScrollPane
- */
- public function scrollLoaded(){
- Debugger.log('--',Debugger.GEN,'scrollLoaded','org.lamsfoundation.lams.LFWindow');
-
- //Assign scroll pane content
- content.contentPath = _scrollContentPath;
-
- if (_scrollContentPath == "AboutLams" || _scrollContentPath == "AlertDialog"){
- resize_mc._visible = false
- }
-
- //Assign reference to container (this) acessible in dialog
- content.content.container = this;
-
- //Set the size of the window to be greater than the content by the margin width and height
- setSize(content.content._width+MARGIN_WIDTH,content.content._height+MARGIN_HEIGHT);
-
- centre();
- this._visible = true;
- setUpFinished = true;
-
- this.removeEventListener('complete',scrollLoaded);
- }
-
+ }
+
+ public function init():Void {
+ super.init();
+
+ //LFWindow contains a scroll pane which contains the content.
+ contentPath = 'ScrollPane';
+
+ //set up skin
+ skinCloseOver = 'LFCloseButtonOver';
+ skinCloseDown = 'LFCloseButtonDown';
+
+ //Add event listener for complete event, fired when scrollpane is loaded
+ this.addEventListener('complete',Delegate.create(this,scrollLoaded));
+ this._visible=false;
+ }
+
+ /**
+ * Fired by Window when content has loaded i.e. ScrollPane
+ */
+ public function scrollLoaded(){
+ Debugger.log('--',Debugger.GEN,'scrollLoaded','org.lamsfoundation.lams.LFWindow');
+
+ //Assign scroll pane content
+ content.contentPath = _scrollContentPath;
+
+ if (_scrollContentPath == "AboutLams" || _scrollContentPath == "AlertDialog"){
+ resize_mc._visible = false
+ }
+
+ //Assign reference to container (this) acessible in dialog
+ content.content.container = this;
+
+ //Set the size of the window to be greater than the content by the margin width and height
+ setSize(content.content._width+MARGIN_WIDTH,content.content._height+MARGIN_HEIGHT);
+
+ centre();
+ this._visible = true;
+ setUpFinished = true;
+
+ this.removeEventListener('complete',scrollLoaded);
+ }
+
public function createChildren(Void):Void {
- super.createChildren();
-
- //TODO DI-13/05/05 add the code to handle dynamic button addition
- //Add extra buttons as required
-
- //Attach resize and set up resize handling
- resize_mc = this.createChildAtDepth('resize',DepthManager.kTop);
- resize_mc.resize_btn.useHandCursor = false;
-
- //Resize_mc contains resize_btn so enterFrame references within button are to _parent
- resize_mc.resize_btn.onPress = function(){
- _parent.onEnterFrame=function(){
- //Set the window size to shadow mouse movement
- var pt:Object = {x:_parent._xmouse,y:_parent._ymouse};
- //Validate the result & change the size if ok
- if(pt.x>MIN_WIDTH && pt.y>MIN_HEIGHT) {
- _parent.setSize(pt.x,pt.y);
- } else if(pt.x>MIN_WIDTH){
- _parent.setSize(pt.x,MIN_HEIGHT);
- } else if(pt.y>MIN_HEIGHT){
- _parent.setSize(MIN_WIDTH,pt.y);
- }
- }
- this.startDrag();
- }
-
- //On release / releaseOutside stop the drag and kill onEnterFrame handler
- resize_mc.resize_btn.onRelease = resize_mc.resize_btn.onReleaseOutside = function (){
- this.stopDrag();
- delete _parent.onEnterFrame;
- }
+ super.createChildren();
+
+ //TODO DI-13/05/05 add the code to handle dynamic button addition
+ //Add extra buttons as required
+
+ //Attach resize and set up resize handling
+ resize_mc = this.createChildAtDepth('resize',DepthManager.kTop);
+ resize_mc.resize_btn.useHandCursor = false;
+
+ //Resize_mc contains resize_btn so enterFrame references within button are to _parent
+ resize_mc.resize_btn.onPress = function(){
+ _parent.onEnterFrame=function(){
+ //Set the window size to shadow mouse movement
+ var pt:Object = {x:_parent._xmouse,y:_parent._ymouse};
+ //Validate the result & change the size if ok
+ if(pt.x>MIN_WIDTH && pt.y>MIN_HEIGHT) {
+ _parent.setSize(pt.x,pt.y);
+ } else if(pt.x>MIN_WIDTH){
+ _parent.setSize(pt.x,MIN_HEIGHT);
+ } else if(pt.y>MIN_HEIGHT){
+ _parent.setSize(MIN_WIDTH,pt.y);
+ }
+ }
+ this.startDrag();
+ }
+
+ //On release / releaseOutside stop the drag and kill onEnterFrame handler
+ resize_mc.resize_btn.onRelease = resize_mc.resize_btn.onReleaseOutside = function (){
+ this.stopDrag();
+ delete _parent.onEnterFrame;
+ }
}
- public function draw(Void):Void {
- //Call the super methods and size after a draw.
- super.draw();
- size();
- }
-
- /**
- * called when object is sized, e.g. draw, setSize etc.
+ public function draw(Void):Void {
+ //Call the super methods and size after a draw.
+ super.draw();
+ size();
+ }
+
+ /**
+ * called when object is sized, e.g. draw, setSize etc.
*/
- public function size(Void):Void {
- super.size();
-
- //If the content is too small then put in scroll bars
- if(content.content._width > width-MARGIN_WIDTH){
- content.hScrollPolicy = 'on';
- } else {
- content.hScrollPolicy = 'off';
- }
-
- if(content.content._height > height-MARGIN_HEIGHT){
- content.vScrollPolicy = 'on';
- } else {
- content.vScrollPolicy = 'off';
- }
-
- if(_scrollContentPath = "AlertDialog") {
- content.vScrollPolicy = 'off';
- content.hScrollPolicy = 'off';
- }
-
- if(setUpFinished){
- content.content.setSize(width-MARGIN_WIDTH,height-MARGIN_HEIGHT);
- }
-
- //Align the resize button with the bottom right
- resize_mc._x = width-RESIZE_WIDTH_OFFSET;
- resize_mc._y = height-RESIZE_HEIGHT_OFFSET;
+ public function size(Void):Void {
+ super.size();
+
+ //If the content is too small then put in scroll bars
+ if(content.content._width > width-MARGIN_WIDTH){
+ content.hScrollPolicy = 'on';
+ } else {
+ content.hScrollPolicy = 'off';
+ }
+
+ if(content.content._height > height-MARGIN_HEIGHT){
+ content.vScrollPolicy = 'on';
+ } else {
+ content.vScrollPolicy = 'off';
+ }
+
+ if(_scrollContentPath = "AlertDialog") {
+ content.vScrollPolicy = 'off';
+ content.hScrollPolicy = 'off';
+ }
+
+ if(setUpFinished){
+ content.content.setSize(width-MARGIN_WIDTH,height-MARGIN_HEIGHT);
+ }
+
+ //Align the resize button with the bottom right
+ resize_mc._x = width-RESIZE_WIDTH_OFFSET;
+ resize_mc._y = height-RESIZE_HEIGHT_OFFSET;
}
-
- /**
- * Drag handler
+
+ /**
+ * Drag handler
*/
- public function startDragging(Void):Void {
- super.startDragging();
- }
-
- /**
- * Centres the window on the stage
- */
- public function centre() {
- //Calculate centre
- this._x = Stage.width/2 - this.width/2;
- this._y = Stage.height/2 - this.height/2;
- }
-
- /**
- * overrides UIObject.setStyle to provide custom style setting
- */
- public function setStyle(styleName:String,styleObj:Object){
- //Pass it up the inheritance chain to set any inherited styles or non-custom/LAMS style properties
- super.setStyle(styleName,styleObj);
- //Pass on to the scrollpane as the theme color doesn't seem to inherit correctly from the Window parent
- content.content.setStyle(styleName,styleObj);
-
- //Does help button exist?
- if (_helpButtonHandler) {
- //If style attribute defined for help button use it. Otherwise use themeColor
- if(styleObj.helpButtonColor) {
-
- }else {
-
- }
- }
- }
-
- /**
- * method called by content of scrollpane when it is loaded
- */
- public function contentLoaded() {
- //dispatch an onContentLoaded event to listeners
- dispatchEvent({type:'contentLoaded',target:this});
- }
-
- //Getters+Setters
- /**
- * Sets the content of the scrollpane child. Allows content to be set from outside LFWindow
- */
- [Inspectable(defaultValue='')]
- function set scrollContentPath (path:String){
- _scrollContentPath = path;
- }
-
- /**
- * Sets HelpButton handler function and creates a help button on the window for calling it
- */
- [Inspectable(defaultValue='')]
- function set helpButtonHandler (value:Function){
- if(value){
- _helpButtonHandler = value;
- //Create Help Button
- }
- }
-
- /**
- * override parent property becuase we don't want to be able to set LFWindow content path
- * because LWWindow 'content' is created in createChildren
- */
- /*
- function set contentPath(value:Object){
-
- }
- */
-
- /**
- * Returns content inside the scrollPane
- */
- function get scrollContent():Object{
- return content.content;
- }
-
- function set resize(a:Boolean):Void {
- resize_mc._visible = a;
- }
+ public function startDragging(Void):Void {
+ super.startDragging();
+ }
+
+ /**
+ * Centres the window on the stage
+ */
+ public function centre() {
+ //Calculate centre
+ this._x = Stage.width/2 - this.width/2;
+ this._y = Stage.height/2 - this.height/2;
+ }
+
+ /**
+ * overrides UIObject.setStyle to provide custom style setting
+ */
+ public function setStyle(styleName:String,styleObj:Object){
+ //Pass it up the inheritance chain to set any inherited styles or non-custom/LAMS style properties
+ super.setStyle(styleName,styleObj);
+ //Pass on to the scrollpane as the theme color doesn't seem to inherit correctly from the Window parent
+ content.content.setStyle(styleName,styleObj);
+
+ //Does help button exist?
+ if (_helpButtonHandler) {
+ //If style attribute defined for help button use it. Otherwise use themeColor
+ if(styleObj.helpButtonColor) {
+
+ }else {
+
+ }
+ }
+ }
+
+ /**
+ * method called by content of scrollpane when it is loaded
+ */
+ public function contentLoaded() {
+ //dispatch an onContentLoaded event to listeners
+ dispatchEvent({type:'contentLoaded',target:this});
+ }
+
+ //Getters+Setters
+ /**
+ * Sets the content of the scrollpane child. Allows content to be set from outside LFWindow
+ */
+ [Inspectable(defaultValue='')]
+ function set scrollContentPath (path:String){
+ _scrollContentPath = path;
+ }
+
+ /**
+ * Sets HelpButton handler function and creates a help button on the window for calling it
+ */
+ [Inspectable(defaultValue='')]
+ function set helpButtonHandler (value:Function){
+ if(value){
+ _helpButtonHandler = value;
+ //Create Help Button
+ }
+ }
+
+ /**
+ * override parent property becuase we don't want to be able to set LFWindow content path
+ * because LWWindow 'content' is created in createChildren
+ */
+ /*
+ function set contentPath(value:Object){
+
+ }
+ */
+
+ /**
+ * Returns content inside the scrollPane
+ */
+ function get scrollContent():Object{
+ return content.content;
+ }
+
+ function set resize(a:Boolean):Void {
+ resize_mc._visible = a;
+ }
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/MultiLineCell.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/MultiLineCell.as (.../MultiLineCell.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/MultiLineCell.as (.../MultiLineCell.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,29 +1,29 @@
-/***************************************************************************
- * Copyright (C) 2008 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.ApplicationParent;
-import org.lamsfoundation.lams.common.util.Debugger;
-import org.lamsfoundation.lams.common.util.ObjectUtils;
+/***************************************************************************
+ * Copyright (C) 2008 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.ApplicationParent;
+import org.lamsfoundation.lams.common.util.Debugger;
+import org.lamsfoundation.lams.common.util.ObjectUtils;
import org.lamsfoundation.lams.common.util.StringUtils;
import mx.controls.DataGrid;
import mx.controls.Label;
@@ -33,7 +33,7 @@
var multiLineLabel;
var owner; // row that contains the cell
var listOwner; // List that contains the cell
-
+
function MultiLineCell() {
}
@@ -63,7 +63,7 @@
}
function getPreferredWidth() {
- return owner.__width;
+ return owner.__width;
}
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Panel.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Panel.as (.../Panel.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Panel.as (.../Panel.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,32 +1,32 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * 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.Debugger
-import mx.core.UIComponent
-import mx.styles.StyleManager
-
+import mx.core.UIComponent
+import mx.styles.StyleManager
+
/**
-* Panel is a base UI building block used in LAMS.
+* Panel is a base UI building block used in LAMS.
* It is often a holder or background for other UI components
* It is re-sizable, and supports Macromedia's skinning see setStyle for possible values:
*
@@ -43,22 +43,21 @@
var className : String = "Panel";
//Variables
private var panel : MovieClip;
- private var boundingBox_mc : MovieClip;
+ private var boundingBox_mc : MovieClip;
private var border_mc : MovieClip;
//private var background_mc : MovieClip;
- private var background_ct : Color;
+ private var background_ct : Color;
private var _borderType : String;
- private var _backgroundColour : Number;
- private var _borderColor : Number;
-
-
+ private var _backgroundColour : Number;
+ private var _borderColor : Number;
+
/**
* Constructor (Empty)
*
*/
function Panel ()
- {
+ {
//trace('Panel constructor');
}
/**
@@ -73,123 +72,121 @@
{
//trace ('panel innit, _initialised:'+_initialised);
-
+
super.init ();
useHandCursor = false;
-
- //some default values;
- _borderType = "inset";
- _backgroundColour = 0xCCCCCC;
+ //some default values;
+ _borderType = "inset";
+ _backgroundColour = 0xCCCCCC;
+
//hide the bounding box place holder
boundingBox_mc._visible = false;
boundingBox_mc._width = 0;
boundingBox_mc._height = 0;
}
- /**
- * The draw method is invoked after the component has
- * been invalidated, by someone (USUALLY UI OBJECT) calling invalidate().
- * This is better than redrawing from within the set function
- * for value, because if there are other properties, it's
- * better to batch up the changes into one redraw, rather
- * than doing them all individually. This approach leads
- * to more efficiency and better centralization of code.
- *
- * Here we just call layout children and the super
- *
- */
-
- public function draw () : Void
- {
- super.draw ();
- layoutChildren ();
- }
-
- /**
- * Overrides the function in UIObject.
- * Calls invalidate, which will call draw() one frame
- * later and therefore will call layoutChildren
- * - to hanlde the size...
- */
- public function size (Void) : Void
- {
- invalidate ();
- }
-
- /**
- * The borderStyle (uses rectBorder class) inny our outy etc..
- * @param type The kind of border we use, possible values: 'inset', 'outset', 'solid'
- *
- *
- *
- *
- */
- [Inspectable(enumeration="inset,outset,solid,default,dropDown,none"defaultValue="inset")]
+ /**
+ * The draw method is invoked after the component has
+ * been invalidated, by someone (USUALLY UI OBJECT) calling invalidate().
+ * This is better than redrawing from within the set function
+ * for value, because if there are other properties, it's
+ * better to batch up the changes into one redraw, rather
+ * than doing them all individually. This approach leads
+ * to more efficiency and better centralization of code.
+ *
+ * Here we just call layout children and the super
+ *
+ */
+
+ public function draw () : Void
+ {
+ super.draw ();
+ layoutChildren ();
+ }
+
+ /**
+ * Overrides the function in UIObject.
+ * Calls invalidate, which will call draw() one frame
+ * later and therefore will call layoutChildren
+ * - to hanlde the size...
+ */
+ public function size (Void) : Void
+ {
+ invalidate ();
+ }
+
+ /**
+ * The borderStyle (uses rectBorder class) inny our outy etc..
+ * @param type The kind of border we use, possible values: 'inset', 'outset', 'solid'
+ *
+ *
+ *
+ *
+ */
+ [Inspectable(enumeration="inset,outset,solid,default,dropDown,none"defaultValue="inset")]
function set borderType (bStyle:String):Void{
_borderType = bStyle;
- invalidate();
- }
-
- function get borderType():String{
+ invalidate();
+ }
+
+ function get borderType():String{
return _borderType;
-
+
}
- /**
- * General set style method
- * Can set:
- * backgroundColor - Color in Hex format.
- * borderStyle - the type of border of the rectBorder class used in the panel (see set borderType for details)
- * borderColor - the colour of the border (when solid only, otherwise it looks crap if applied to 3d styles as need to set other set of styles see rectBorder class for details) in Hex format
- * styleName - this is to support the use of CSSStyleDeclaration class, you can pass a StyleObject into the panel and it wil extract the style information and apply it
- *
- * @param styleProp The property to affect
- * @param newValue the value to assign to that styleProp. Colours in hex format, borders as in set borderType
- *
+ /**
+ * General set style method
+ * Can set:
+ * backgroundColor - Color in Hex format.
+ * borderStyle - the type of border of the rectBorder class used in the panel (see set borderType for details)
+ * borderColor - the colour of the border (when solid only, otherwise it looks crap if applied to 3d styles as need to set other set of styles see rectBorder class for details) in Hex format
+ * styleName - this is to support the use of CSSStyleDeclaration class, you can pass a StyleObject into the panel and it wil extract the style information and apply it
+ *
+ * @param styleProp The property to affect
+ * @param newValue the value to assign to that styleProp. Colours in hex format, borders as in set borderType
+ *
*/
public function setStyle(styleProp:String, newValue):Void{
- //only process if we want to set the bkg
- if(styleProp == "backgroundColor"){
- _backgroundColour = newValue;
- }else if(styleProp == "borderStyle"){
+ //only process if we want to set the bkg
+ if(styleProp == "backgroundColor"){
+ _backgroundColour = newValue;
+ }else if(styleProp == "borderStyle"){
//must be going for the border
- _borderType = newValue;
- }else if(styleProp == "borderColour"){
- //must be going for the border colour
- _borderColor = newValue;
- }else if(styleProp == "styleName"){
-
- _backgroundColour = newValue.getStyle('backgroundColor');
- _borderType = newValue.getStyle('borderStyle');
- _borderColor = newValue.getStyle('borderColor');
- }else{
- }
-
- invalidate();
- }
+ _borderType = newValue;
+ }else if(styleProp == "borderColour"){
+ //must be going for the border colour
+ _borderColor = newValue;
+ }else if(styleProp == "styleName"){
+
+ _backgroundColour = newValue.getStyle('backgroundColor');
+ _borderType = newValue.getStyle('borderStyle');
+ _borderColor = newValue.getStyle('borderColor');
+ }else{
+ }
+
+ invalidate();
+ }
+
-
-
/**
- * Attaches the PanelAssets mc which contains all the actual
- * mc's that make up the component
- * NOTE: CALLED BY UI OBJECT so don't call explicitly here
+ * Attaches the PanelAssets mc which contains all the actual
+ * mc's that make up the component
+ * NOTE: CALLED BY UI OBJECT so don't call explicitly here
*
*/
private function createChildren() : Void
{
- panel = this.createObject ("PanelAssets", "panel", getNextHighestDepth());
+ panel = this.createObject ("PanelAssets", "panel", getNextHighestDepth());
background_ct = new Color(panel.background_mc);
- //the border is a MM rect border
- border_mc = createClassObject(mx.skins.RectBorder,"border_mc", getNextHighestDepth()); //make sure this is the last
+ //the border is a MM rect border
+ border_mc = createClassObject(mx.skins.RectBorder,"border_mc", getNextHighestDepth()); //make sure this is the last
layoutChildren();
- }
-
- /**
- * Lays out all the attached mcs. Mainly handles re-sizes
- *
+ }
+ /**
+ * Lays out all the attached mcs. Mainly handles re-sizes
+ *
*/
private function layoutChildren() : Void
{
@@ -199,34 +196,33 @@
panel.background_mc._width = __width;
panel.background_mc._height = __height;
- background_ct.setRGB(_backgroundColour);
-
- border_mc.setSize(__width, __height);
-
- border_mc._x = panel.background_mc._x;
- border_mc._y = panel.background_mc._y;
+ background_ct.setRGB(_backgroundColour);
+
+ border_mc.setSize(__width, __height);
+ border_mc._x = panel.background_mc._x;
+ border_mc._y = panel.background_mc._y;
- if(_borderType == "none"){
- border_mc.visible=false;
- }else{
- if(!border_mc.visible){
- border_mc.visible=true;
- }
- border_mc.setStyle("borderStyle",_borderType);
- }
-
- if(_borderColor != null){
- border_mc.setStyle('borderColor',_borderColor);
- }
+ if(_borderType == "none"){
+ border_mc.visible=false;
+ }else{
+ if(!border_mc.visible){
+ border_mc.visible=true;
+ }
+ border_mc.setStyle("borderStyle",_borderType);
+ }
+
+ if(_borderColor != null){
+ border_mc.setStyle('borderColor',_borderColor);
+ }
}
-
- /*
- * These are not used, but I have left them her so we know how
- * to do inspectable properties, as that bit worked!
- *
+
+ /*
+ * These are not used, but I have left them her so we know how
+ * to do inspectable properties, as that bit worked!
*
+ *
public function getWidth(Void):Number{
return __width;
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/CookieMonster.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/CookieMonster.as (.../CookieMonster.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/CookieMonster.as (.../CookieMonster.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,26 +1,26 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * 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.comms.*
@@ -59,15 +59,15 @@
* NOTE: - This should be called only when ALL local data for lams is to be deleted
*/
public static function purge():Void {
- //Go through all shared objects defined on this machine and delete them
+ //Go through all shared objects defined on this machine and delete them
//Get shared object containing cookie indices
- var so = SharedObject.getLocal(SO_ROOT+'.'+'index','/');
- var index_array:Array = so.data.index;
- //Go through index array and delete shared objects
- for(var i=0;i 4 = general debugging message, 5 = component debug message
* @param fname (Optional) Name of the function calling this log message
* @param currentClass (Optional)Name of the class
- */
- public static function log(msg:Object,level:Number,fname:String,currentClass:Object):Void{
- //Ensure we have an instance
- getInstance();
- var rawMsgStr = String(msg);
-
+ */
+ public static function log(msg:Object,level:Number,fname:String,currentClass:Object):Void{
+ //Ensure we have an instance
+ getInstance();
+ var rawMsgStr = String(msg);
+
if(_allowDebug){
if(arguments.length == 1){
level = 4;
}
-
+
if(_severityLevel >= level){
- var date:Date = new Date();
-
- //Build debug log object for this entry
- var obj = {date:date,msg:msg,level:level,func:fname};
+ var date:Date = new Date();
+ //Build debug log object for this entry
+ var obj = {date:date,msg:msg,level:level,func:fname};
+
//if the class name has changed, then print it out
if(_currentClass != currentClass){
_currentClass = String(currentClass);
- trace("-----------In:"+_currentClass+"-----------");
+ trace("-----------In:"+_currentClass+"-----------");
//Add the scope to the log object
- obj.scope = currentClass;
- }
-
- //Write to trace(NOT USED??)
- msg = "["+fname+"]"+msg
-
- //Write to log
- _msgLog.push(obj);
-
- //Dispatch update event
- _instance.dispatchEvent({type:'update',target:_instance});
+ obj.scope = currentClass;
+ }
+
+ //Write to trace(NOT USED??)
+ msg = "["+fname+"]"+msg
+
+ //Write to log
+ _msgLog.push(obj);
+
+ //Dispatch update event
+ _instance.dispatchEvent({type:'update',target:_instance});
}
}
+ }
+
+ public static function error(e:Object):Void{
+ if(e instanceof LFError){
+ var lfe = LFError(e);
+ log(lfe.message,Debugger.CRITICAL,lfe.fname,"LFError");
+ }else{
+ log("Recieved unsupported error type",Debugger.CRITICAL,"error","Debugger");
+ }
+
}
-
- public static function error(e:Object):Void{
- if(e instanceof LFError){
- var lfe = LFError(e);
- log(lfe.message,Debugger.CRITICAL,lfe.fname,"LFError");
- }else{
- log("Recieved unsupported error type",Debugger.CRITICAL,"error","Debugger");
- }
-
- }
-
- /**
- * Legacy Method to print a message to the output - trace or window...
- * @param msg The actual message to be printed
- * 1=critical error > 4 = general debugging message, 5 = component debug message
- * @param fname (Optional) Name of the function calling this log message
- */
- public static function debug(msg:String,fname:String):Void{
- if(_allowDebug){
- if(arguments.length == 1){
- fname = "";
- }
- log(msg,4,fname,undefined);
- }
- }
-
- /**
- * @param format:Object An object containing various format options for viewing the log
- * @returns the message log formatted
- */
- public function getFormattedMsgLog(format:Object):String {
- var ret:String;
- if(!format){
- format = {};
- format.date = false;
- }
-
- for(var i=0;i<_msgLog.length;i++) {
- ret += buildMessage(format,_msgLog[i]);
- }
-
- return ret;
- }
-
- /**
- * @param format:Object An object containing various format options for viewing the log
- * @returns the message log formatted
- */
- public function getLatestMsg(format:Object):String {
- var ret:String;
- if(!format){
- format = {};
- format.date = false;
- }
- return buildMessage(format,_msgLog[_msgLog.length-1]);
- }
-
- /**
- * Construct a message from the msgObject using the format object
- *
- * @returns String - the formatted string
- */
- private function buildMessage(format:Object,msgObj:Object):String {
- var ret:String;
- var colour:String;
- //Get the color for the level
- switch (msgObj.level) {
- case CRITICAL :
- colour='#ff0000';
- break;
- case GEN :
- colour='#0000ff';
- break;
- case COMP :
- colour='#00ff00';
- break;
- case HIGH :
- colour='#E3D209';
- break;
- case MED :
- colour='#CF1D92';
- break;
- default:
- colour='#555555';
- }
-
- //Build font tags
- var fontOpenTag:String = ''
- var fontCloseTag:String = '';
-
- ret = fontOpenTag;
-
- //Add scope?
- if(msgObj.scope){
- ret += '*--- ' + msgObj.scope + ' ---*' +'
' + ret;
- }
-
- //Include date?
- if(format.date) {
- ret += 'date : ' + msgObj.date.toString() + ' ';
- }
-
- //escape the message incase we asent XML in
- var theMsg = Object(StringUtils.escapeAngleBrackets(String(msgObj.msg)));
-
- //Add function/method + message
- ret += '[' + msgObj.func + ']' + theMsg;
-
- //Add closing font tag and line break
- ret += fontCloseTag + '
'
- return ret;
- }
-
- /**
- */
- function get msgLog(){
- return _msgLog;
- return _crashDumpMsgLog;
- }
+ /**
+ * Legacy Method to print a message to the output - trace or window...
+ * @param msg The actual message to be printed
+ * 1=critical error > 4 = general debugging message, 5 = component debug message
+ * @param fname (Optional) Name of the function calling this log message
+ */
+ public static function debug(msg:String,fname:String):Void{
+ if(_allowDebug){
+ if(arguments.length == 1){
+ fname = "";
+ }
+ log(msg,4,fname,undefined);
+ }
+ }
+ /**
+ * @param format:Object An object containing various format options for viewing the log
+ * @returns the message log formatted
+ */
+ public function getFormattedMsgLog(format:Object):String {
+ var ret:String;
+ if(!format){
+ format = {};
+ format.date = false;
+ }
+
+ for(var i=0;i<_msgLog.length;i++) {
+ ret += buildMessage(format,_msgLog[i]);
+ }
+
+ return ret;
+ }
+
+ /**
+ * @param format:Object An object containing various format options for viewing the log
+ * @returns the message log formatted
+ */
+ public function getLatestMsg(format:Object):String {
+ var ret:String;
+ if(!format){
+ format = {};
+ format.date = false;
+ }
+ return buildMessage(format,_msgLog[_msgLog.length-1]);
+ }
+
+ /**
+ * Construct a message from the msgObject using the format object
+ *
+ * @returns String - the formatted string
+ */
+ private function buildMessage(format:Object,msgObj:Object):String {
+ var ret:String;
+ var colour:String;
+ //Get the color for the level
+ switch (msgObj.level) {
+ case CRITICAL :
+ colour='#ff0000';
+ break;
+ case GEN :
+ colour='#0000ff';
+ break;
+ case COMP :
+ colour='#00ff00';
+ break;
+ case HIGH :
+ colour='#E3D209';
+ break;
+ case MED :
+ colour='#CF1D92';
+ break;
+ default:
+ colour='#555555';
+ }
+
+ //Build font tags
+ var fontOpenTag:String = ''
+ var fontCloseTag:String = '';
+
+ ret = fontOpenTag;
+
+ //Add scope?
+ if(msgObj.scope){
+ ret += '*--- ' + msgObj.scope + ' ---*' +'
' + ret;
+ }
+
+ //Include date?
+ if(format.date) {
+ ret += 'date : ' + msgObj.date.toString() + ' ';
+ }
+
+ //escape the message incase we asent XML in
+ var theMsg = Object(StringUtils.escapeAngleBrackets(String(msgObj.msg)));
+
+ //Add function/method + message
+ ret += '[' + msgObj.func + ']' + theMsg;
+
+ //Add closing font tag and line break
+ ret += fontCloseTag + '
'
+ return ret;
+ }
+
+ /**
+ */
+ function get msgLog(){
+ return _msgLog;
+ return _crashDumpMsgLog;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Hashtable.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Hashtable.as (.../Hashtable.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Hashtable.as (.../Hashtable.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,26 +1,26 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * 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.*
/**
@@ -33,7 +33,7 @@
private var _name:String;
private var _watch:Boolean;
private var _watchFunction:Function;
- private var _watchFunctionLocation:Object;
+ private var _watchFunctionLocation:Object;
private var _isBusy:Boolean;
//Constructor
@@ -43,15 +43,15 @@
clearBusy();
}
- /**
- * Adds element to the hashtable
- * @usage
- * @param key
- * @param val
- * @return r The value that was replaced
- */
+ /**
+ * Adds element to the hashtable
+ * @usage
+ * @param key
+ * @param val
+ * @return r The value that was replaced
+ */
public function put(key, val) {
- setBusy();
+ setBusy();
//Debugger.debug('called','Hashtable.prototype.put');
var i = this._getIndex(key);
var r = this.elements[i].val;
@@ -89,7 +89,7 @@
if (i != this.elements.length) {
clearBusy();
return this.elements[i].val;
- }
+ }
}
@@ -110,25 +110,25 @@
r[i] = this.elements[i].val;
}
clearBusy();
- return r;
+ return r;
}
- /**
- * Removes an element from the hashtable
- * @usage
- * @param o
- * @return the element being removed or null if its not found
- */
+ /**
+ * Removes an element from the hashtable
+ * @usage
+ * @param o
+ * @return the element being removed or null if its not found
+ */
public function remove(o) {
setBusy();
var i = this._getIndex(o);
-
+
//we gotta clear the busy flag as keys needs to be called
clearBusy();
- var l = this.keys().length;
+ var l = this.keys().length;
setBusy();
-
+
if(i < l){
// o found
var r = this.elements[i].val;
@@ -138,7 +138,7 @@
}
this.elements.splice(i, 1);
- clearBusy();
+ clearBusy();
return r;
}else{
@@ -148,12 +148,12 @@
}
public function clear() {
- setBusy();
+ setBusy();
this.elements = new Array();
if(this._watch){
this._watchFunctionLocation[this._watchFunction](this._name, null, null);
}
- clearBusy();
+ clearBusy();
}
@@ -177,7 +177,7 @@
public function containsValue(o) {
setBusy();
var r = this._getIndex(o, "val") != this.elements.length;
- clearBusy();
+ clearBusy();
return r;
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/HashtableElement.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/HashtableElement.as (.../HashtableElement.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/HashtableElement.as (.../HashtableElement.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,49 +1,49 @@
-/***************************************************************************
- * 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.*
-
-/**
-* HashtableElement
-*/
-class org.lamsfoundation.lams.common.util.HashtableElement {
+/***************************************************************************
+ * 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.*
+
+/**
+* HashtableElement
+*/
+class org.lamsfoundation.lams.common.util.HashtableElement {
//Declarations
- private var key;
- private var val;
-
- //Constructor
- function HashtableElement(key, val) {
- this.key = key;
- this.val = val;
- }
-
- public function toString() {
- return "{" + this.key + "=" + this.val + "}";
- }
-
- //Getters+Setters
-}
-
-
-
-
+ private var key;
+ private var val;
+
+ //Constructor
+ function HashtableElement(key, val) {
+ this.key = key;
+ this.val = val;
+ }
+
+ public function toString() {
+ return "{" + this.key + "=" + this.val + "}";
+ }
+
+ //Getters+Setters
+}
+
+
+
+
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/JsPopup.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/JsPopup.as (.../JsPopup.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/JsPopup.as (.../JsPopup.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -29,7 +29,7 @@
import org.lamsfoundation.lams.common.dict.*
import org.lamsfoundation.lams.common.*
import mx.managers.*
-import mx.utils.*
+import mx.utils.*
/**
* Popup method for opening browser popup window using javascript in author.js file.
@@ -79,31 +79,31 @@
public function launchPopupWindow(url:String, windowTitle:String, height:Number, width:Number, resize:Boolean, status:Boolean, scrollbar:Boolean, menubar:Boolean, toolbar:Boolean):Void{
// open popup window using javascript method in hosting jsp
- var isMac:Boolean = (_root.isMac == "true")?true:false;
- var versionNo:Number = _root.getSWFVersion();
-
- if((versionNo <= 8) && (isMac)) {
- getURL("javascript: openPopUp('" + url + "'," +
- "'" + windowTitle + "'," +
- "'" + height + "'," +
- "'" + width + "'," +
- "'" + getValue(resize) + "'," +
- "'" + getValue(status) + "'," +
- "'" + getValue(scrollbar) + "'," +
- "'" + getValue(menubar) + "'," +
- "'" + getValue(toolbar) + "')");
- } else {
- fscommand("openPopUp", [url, windowTitle, height, width,getValue(resize), getValue(status) , getValue(scrollbar) , getValue(menubar) , getValue(toolbar)]);
- }
+ var isMac:Boolean = (_root.isMac == "true")?true:false;
+ var versionNo:Number = _root.getSWFVersion();
+
+ if((versionNo <= 8) && (isMac)) {
+ getURL("javascript: openPopUp('" + url + "'," +
+ "'" + windowTitle + "'," +
+ "'" + height + "'," +
+ "'" + width + "'," +
+ "'" + getValue(resize) + "'," +
+ "'" + getValue(status) + "'," +
+ "'" + getValue(scrollbar) + "'," +
+ "'" + getValue(menubar) + "'," +
+ "'" + getValue(toolbar) + "')");
+ } else {
+ fscommand("openPopUp", [url, windowTitle, height, width,getValue(resize), getValue(status) , getValue(scrollbar) , getValue(menubar) , getValue(toolbar)]);
+ }
}
private function getValue(option:Boolean):String{
if(option){
- return "yes";
+ return "yes";
} else {
- return "no";
- }
+ return "no";
+ }
}
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/LFError.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/LFError.as (.../LFError.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/LFError.as (.../LFError.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,79 +1,79 @@
-/***************************************************************************
- * 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.ui.*
-import org.lamsfoundation.lams.common.util.*
-import org.lamsfoundation.lams.common.dict.*
-
-import mx.controls.Alert;
+/***************************************************************************
+ * 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.ui.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.dict.*
+
+import mx.controls.Alert;
+
+/**
* LFError
*
-*
-*/
-class LFError extends Error{
-
+*
+*/
+class LFError extends Error{
+
//Declarations
private var _ref:Object;
- private var _fn:String;
- private var title:String;
-
- //Constructor
+ private var _fn:String;
+ private var title:String;
+
+ //Constructor
function LFError(msg:String,fn:String,ref:Object,debugInfo:String) {
super(msg);
_fn = fn;
- _ref = ref;
-
- Debugger.log('Creating LFError instance:'+msg,Debugger.CRITICAL,'LFError','LFError');
- Debugger.log('Function:'+fn,Debugger.CRITICAL,'LFError','LFError');
- Debugger.log('Ref:'+ref,Debugger.CRITICAL,'LFError','LFError');
- Debugger.log('debugInfo:'+debugInfo,Debugger.CRITICAL,'LFError','LFError');
- }
-
- public function showErrorAlert(okHandler){
- LFMessage.showMessageAlert(message, okHandler);
- }
-
- /**
- * Shows an alert confirm dialogue. It is centred in the root time line and diplays the standard LAMS alert icon
- * @usage
- * @param msg The message to display
- * @param handler A handler for the click events broadcast when the buttons are clicked. In addition to the standard click event object properties, there is an additional detail property, which contains the flag value of the button that was clicked (Alert.OK, Alert.CANCEL, Alert.YES, Alert.NO). This handler can be a function or an object
- * @return
- */
- public static function showSendErrorRequest(msg:String, msgTitle:String, okHandler:Function, cancelHandler:Function){
- var customTitle = Dictionary.getValue(msgTitle);
- LFMessage.showMessageConfirm(msg, okHandler, cancelHandler, Dictionary.getValue('al_send'), Dictionary.getValue('al_cancel'), customTitle);
-
- }
+ _ref = ref;
+
+ Debugger.log('Creating LFError instance:'+msg,Debugger.CRITICAL,'LFError','LFError');
+ Debugger.log('Function:'+fn,Debugger.CRITICAL,'LFError','LFError');
+ Debugger.log('Ref:'+ref,Debugger.CRITICAL,'LFError','LFError');
+ Debugger.log('debugInfo:'+debugInfo,Debugger.CRITICAL,'LFError','LFError');
+ }
+
+ public function showErrorAlert(okHandler){
+ LFMessage.showMessageAlert(message, okHandler);
+ }
+ /**
+ * Shows an alert confirm dialogue. It is centred in the root time line and diplays the standard LAMS alert icon
+ * @usage
+ * @param msg The message to display
+ * @param handler A handler for the click events broadcast when the buttons are clicked. In addition to the standard click event object properties, there is an additional detail property, which contains the flag value of the button that was clicked (Alert.OK, Alert.CANCEL, Alert.YES, Alert.NO). This handler can be a function or an object
+ * @return
+ */
+ public static function showSendErrorRequest(msg:String, msgTitle:String, okHandler:Function, cancelHandler:Function){
+ var customTitle = Dictionary.getValue(msgTitle);
+ LFMessage.showMessageConfirm(msg, okHandler, cancelHandler, Dictionary.getValue('al_send'), Dictionary.getValue('al_cancel'), customTitle);
+
+ }
+
public function get reference():Object{
return _ref;
}
public function get fname():String{
return _fn;
}
-
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/MovieClipUtils.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/MovieClipUtils.as (.../MovieClipUtils.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/MovieClipUtils.as (.../MovieClipUtils.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,39 +1,39 @@
-/***************************************************************************
- * 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.*
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
-/**
-* MovieclipUtils
-*/
-class MovieClipUtils {
-
- //Declarations
- //Constructor
- function MovieClipUtils() {
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
- }
+/**
+* MovieclipUtils
+*/
+class MovieClipUtils {
+
+ //Declarations
+ //Constructor
+ function MovieClipUtils() {
+
+ }
/**
* Checks if one mc intersects or overlaps another by comparing the x&y co-ords
* @param a_mc target movie clip
@@ -42,36 +42,36 @@
public static function LFHitTest(a_mc:MovieClip,b_mc:MovieClip):Boolean{
trace("Method not implemented");
return false;
- }
-
- public static function getCenterOfMC(mc:MovieClip):Point{
- var x:Number = mc._x + (mc._width / 2);
- var y:Number = mc._y + (mc._height / 2);
- var p:Point = new Point(x,y);
- return p;
-
- }
-
- /**
- * Schedules a function to be executed after one frame
- * @usage
- * import org.lamsfoundation.lams.common.util.*
- * doLater(Proxy.create(,,arg1,arg2.....);
- */
- public static function doLater(fn:Function):Void{
- //Create the clip and attach to root at next available depth
- var doLater_mc:MovieClip = _root.createEmptyMovieClip('LFDoLater_mc',_root.getNextHighestDepth());
- //Assign function to clip and set up onEnterFrame
- doLater_mc.fn = fn;
- doLater_mc.onEnterFrame = function () {
- //Call the fn, kill the enterframe and remove the clip
- fn.apply();
- delete this.onEnterFrame;
- this.removeMovieClip();
- }
- }
-
-
+ }
-
+ public static function getCenterOfMC(mc:MovieClip):Point{
+ var x:Number = mc._x + (mc._width / 2);
+ var y:Number = mc._y + (mc._height / 2);
+ var p:Point = new Point(x,y);
+ return p;
+
+ }
+
+ /**
+ * Schedules a function to be executed after one frame
+ * @usage
+ * import org.lamsfoundation.lams.common.util.*
+ * doLater(Proxy.create(,,arg1,arg2.....);
+ */
+ public static function doLater(fn:Function):Void{
+ //Create the clip and attach to root at next available depth
+ var doLater_mc:MovieClip = _root.createEmptyMovieClip('LFDoLater_mc',_root.getNextHighestDepth());
+ //Assign function to clip and set up onEnterFrame
+ doLater_mc.fn = fn;
+ doLater_mc.onEnterFrame = function () {
+ //Call the fn, kill the enterframe and remove the clip
+ fn.apply();
+ delete this.onEnterFrame;
+ this.removeMovieClip();
+ }
+ }
+
+
+
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/MovieLoader.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/MovieLoader.as (.../MovieLoader.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/MovieLoader.as (.../MovieLoader.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,96 +1,96 @@
-/***************************************************************************
- * 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.*
+/***************************************************************************
+ * 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
+ * ************************************************************************
+ */
-/**
-* MovieclipUtils
-* @usage var ml = new MovieLoader(_activity.libraryActivityUIImage,draw,this,_icon_mc);
-*/
-class MovieLoader {
- private var _mcl:MovieClipLoader;
- private var _fn:Function;
- private var _scope:Object;
- private var _mcUrl:String;
- private var _target_mc:MovieClip;
-
- //TODO: Work out a way around this silly non cachable issue
- public static var movieCache:Array;
-
-
- /**
- * Constructor
- * @usage var ml = new MovieLoader(movieURL,fnToRunOnLoad,scopeObject,theTarget);
- * @param mcUrl URL of MovieCLip or JPEG to load
- * @param fn Funcation to call when onLoadInit
- * @param scope Scope of function
- * @param target_mc MC To replace with loaded mc
- * @return mcl The populated MovieClip Loaded
- */
- function MovieLoader(mcUrl:String,fn:Function, scope:Object, target_mc:MovieClip) {
- _mcUrl = mcUrl;
- _fn = fn;
- _scope = scope;
- _target_mc = target_mc;
- _target_mc.cRef = this;
-
- Debugger.log('MovieLoader loading mcUrl:'+mcUrl,Debugger.COMP,'Constructor','org.lamsfoundation.lams.common.util.MovieLoader');
-
- _mcl = new MovieClipLoader();
- _mcl.addListener(this);
- _mcl.loadClip(_mcUrl,target_mc);
+import org.lamsfoundation.lams.common.util.*
+
+/**
+* MovieclipUtils
+* @usage var ml = new MovieLoader(_activity.libraryActivityUIImage,draw,this,_icon_mc);
+*/
+class MovieLoader {
+ private var _mcl:MovieClipLoader;
+ private var _fn:Function;
+ private var _scope:Object;
+ private var _mcUrl:String;
+ private var _target_mc:MovieClip;
+
+ //TODO: Work out a way around this silly non cachable issue
+ public static var movieCache:Array;
+
+
+ /**
+ * Constructor
+ * @usage var ml = new MovieLoader(movieURL,fnToRunOnLoad,scopeObject,theTarget);
+ * @param mcUrl URL of MovieCLip or JPEG to load
+ * @param fn Funcation to call when onLoadInit
+ * @param scope Scope of function
+ * @param target_mc MC To replace with loaded mc
+ * @return mcl The populated MovieClip Loaded
+ */
+ function MovieLoader(mcUrl:String,fn:Function, scope:Object, target_mc:MovieClip) {
+ _mcUrl = mcUrl;
+ _fn = fn;
+ _scope = scope;
+ _target_mc = target_mc;
+ _target_mc.cRef = this;
- }
-
- public function onLoadInit(loaded_mc):Void{
- Debugger.log('mc:'+loaded_mc,Debugger.COMP,'onLoadInit','org.lamsfoundation.lams.common.util.MovieLoader');
-
- //TODO: Make this actually cache the movie.
- MovieLoader.movieCache[_mcUrl] = loaded_mc;
- var myFn = Proxy.create(_scope,_fn,loaded_mc);
- myFn.call();
- }
-
- public function onLoadError(loaded_mc:MovieClip,errorCode:String):Void{
- switch(errorCode){
-
- case 'URLNotFound' :
- Debugger.log('TemplateActivity icon failed to load - URL is not found:'+loaded_mc._url,Debugger.CRITICAL,'onLoadInit','TemplateActivity');
- break;
- case 'LoadNeverCompleted' :
- Debugger.log('TemplateActivity icon failed to load - Load never completed:'+loaded_mc,Debugger.CRITICAL,'onLoadInit','TemplateActivity');
- break;
- }
-
- //run the handler functions anyway
- var myFn = Proxy.create(_scope,_fn,loaded_mc);
- myFn.call();
- }
-
-
-
- //TODO: Add all the other handlers and methods to set n get them
-
+ Debugger.log('MovieLoader loading mcUrl:'+mcUrl,Debugger.COMP,'Constructor','org.lamsfoundation.lams.common.util.MovieLoader');
+
+ _mcl = new MovieClipLoader();
+ _mcl.addListener(this);
+ _mcl.loadClip(_mcUrl,target_mc);
+
+ }
+
+ public function onLoadInit(loaded_mc):Void{
+ Debugger.log('mc:'+loaded_mc,Debugger.COMP,'onLoadInit','org.lamsfoundation.lams.common.util.MovieLoader');
+
+ //TODO: Make this actually cache the movie.
+ MovieLoader.movieCache[_mcUrl] = loaded_mc;
+ var myFn = Proxy.create(_scope,_fn,loaded_mc);
+ myFn.call();
+ }
+
+ public function onLoadError(loaded_mc:MovieClip,errorCode:String):Void{
+ switch(errorCode){
+
+ case 'URLNotFound' :
+ Debugger.log('TemplateActivity icon failed to load - URL is not found:'+loaded_mc._url,Debugger.CRITICAL,'onLoadInit','TemplateActivity');
+ break;
+ case 'LoadNeverCompleted' :
+ Debugger.log('TemplateActivity icon failed to load - Load never completed:'+loaded_mc,Debugger.CRITICAL,'onLoadInit','TemplateActivity');
+ break;
+ }
+
+ //run the handler functions anyway
+ var myFn = Proxy.create(_scope,_fn,loaded_mc);
+ myFn.call();
+ }
+
+
+
+ //TODO: Add all the other handlers and methods to set n get them
+
-
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Observable.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Observable.as (.../Observable.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Observable.as (.../Observable.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,154 +1,154 @@
-/***************************************************************************
- * 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.Observer;
-
-/**
- * A Java-style Observable class used to represent the "subject"
- * of the Observer design pattern. Observers must implement the Observer
- * interface, and register to observe the subject via addObserver().
- */
-class org.lamsfoundation.lams.common.util.Observable {
- // A flag indicating whether this object has changed.
- private var changed:Boolean = false;
- // A list of observers.
- private var observers:Array;
-
- /**
- * Constructor function.
- */
- public function Observable () {
- observers = new Array();
- }
-
- /**
- * Adds an observer to the list of observers.
- * @param o The observer to be added.
- */
- public function addObserver(o:Observer):Boolean {
- // Can't add a null observer.
- if (o == null) {
- return false;
- }
-
- // Don't add an observer more than once.
- for (var i:Number = 0; i < observers.length; i++) {
- if (observers[i] == o) {
- // The observer is already observing, so quit.
- return false;
- }
- }
-
- // Put the observer into the list.
- observers.push(o);
- return true;
- }
-
- /**
- * Removes an observer from the list of observers.
- *
- * @param o The observer to remove.
- */
- public function removeObserver(o:Observer):Boolean {
- // Find and remove the observer.
- var len:Number = observers.length;
- for (var i:Number = 0; i < len; i++) {
- if (observers[i] == o) {
- observers.splice(i, 1);
- return true;
- }
- }
- return false;
- }
-
- /**
- * Tell all observers that the subject has changed.
- *
- * @param infoObj An object containing arbitrary data
- * to pass to observers.
- */
- public function notifyObservers(infoObj:Object):Void {
- // Use a null infoObject if none is supplied.
- if (infoObj == undefined) {
- infoObj = null;
- }
-
- // If the object hasn't changed, don't bother notifying observers.
- if (!changed) {
- return;
- }
-
- // Make a copy of the observers array. We do this
- // so that we can be sure the list won't change while
- // we're processing it.
- var observersSnapshot:Array = observers.slice(0);
-
- // This change has been processed, so unset the "changed" flag.
- clearChanged();
-
- // Invoke update() on all observers.
- for (var i:Number = observersSnapshot.length-1; i >= 0; i--) {
- observersSnapshot[i].update(this, infoObj);
- }
- }
-
- /**
- * Removes all observers from the observer list.
- */
- public function clearObservers():Void {
- observers = new Array();
- }
-
- /**
- * Indicates that the subject has changed.
- */
- private function setChanged():Void {
- changed = true;
- }
-
- /**
- * Indicates that the subject has either not changed or
- * has notified its observers of the most recent change.
- */
- private function clearChanged():Void {
- changed = false;
- }
-
- /**
- * Checks if the subject has changed.
- *
- * @return true if the subject has changed, as determined by setChanged().
- */
- public function hasChanged():Boolean {
- return changed;
- }
-
- /**
- * Returns the number of observers in the observer list.
- *
- * @return An integer: the number of observers for this subject.
- */
- public function countObservers():Number {
- return observers.length;
- }
+/***************************************************************************
+ * 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.Observer;
+
+/**
+ * A Java-style Observable class used to represent the "subject"
+ * of the Observer design pattern. Observers must implement the Observer
+ * interface, and register to observe the subject via addObserver().
+ */
+class org.lamsfoundation.lams.common.util.Observable {
+ // A flag indicating whether this object has changed.
+ private var changed:Boolean = false;
+ // A list of observers.
+ private var observers:Array;
+
+ /**
+ * Constructor function.
+ */
+ public function Observable () {
+ observers = new Array();
+ }
+
+ /**
+ * Adds an observer to the list of observers.
+ * @param o The observer to be added.
+ */
+ public function addObserver(o:Observer):Boolean {
+ // Can't add a null observer.
+ if (o == null) {
+ return false;
+ }
+
+ // Don't add an observer more than once.
+ for (var i:Number = 0; i < observers.length; i++) {
+ if (observers[i] == o) {
+ // The observer is already observing, so quit.
+ return false;
+ }
+ }
+
+ // Put the observer into the list.
+ observers.push(o);
+ return true;
+ }
+
+ /**
+ * Removes an observer from the list of observers.
+ *
+ * @param o The observer to remove.
+ */
+ public function removeObserver(o:Observer):Boolean {
+ // Find and remove the observer.
+ var len:Number = observers.length;
+ for (var i:Number = 0; i < len; i++) {
+ if (observers[i] == o) {
+ observers.splice(i, 1);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Tell all observers that the subject has changed.
+ *
+ * @param infoObj An object containing arbitrary data
+ * to pass to observers.
+ */
+ public function notifyObservers(infoObj:Object):Void {
+ // Use a null infoObject if none is supplied.
+ if (infoObj == undefined) {
+ infoObj = null;
+ }
+
+ // If the object hasn't changed, don't bother notifying observers.
+ if (!changed) {
+ return;
+ }
+
+ // Make a copy of the observers array. We do this
+ // so that we can be sure the list won't change while
+ // we're processing it.
+ var observersSnapshot:Array = observers.slice(0);
+
+ // This change has been processed, so unset the "changed" flag.
+ clearChanged();
+
+ // Invoke update() on all observers.
+ for (var i:Number = observersSnapshot.length-1; i >= 0; i--) {
+ observersSnapshot[i].update(this, infoObj);
+ }
+ }
+
+ /**
+ * Removes all observers from the observer list.
+ */
+ public function clearObservers():Void {
+ observers = new Array();
+ }
+
+ /**
+ * Indicates that the subject has changed.
+ */
+ private function setChanged():Void {
+ changed = true;
+ }
+
+ /**
+ * Indicates that the subject has either not changed or
+ * has notified its observers of the most recent change.
+ */
+ private function clearChanged():Void {
+ changed = false;
+ }
+
+ /**
+ * Checks if the subject has changed.
+ *
+ * @return true if the subject has changed, as determined by setChanged().
+ */
+ public function hasChanged():Boolean {
+ return changed;
+ }
+
+ /**
+ * Returns the number of observers in the observer list.
+ *
+ * @return An integer: the number of observers for this subject.
+ */
+ public function countObservers():Number {
+ return observers.length;
+ }
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Observer.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Observer.as (.../Observer.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Observer.as (.../Observer.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,39 +1,39 @@
-/***************************************************************************
- * 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;
-
-/**
- * The interface that must be implemented by all observers of an
- * Observable object.
- */
-interface org.lamsfoundation.lams.common.util.Observer {
- /**
- * Invoked automatically by an observed object when it changes.
- *
- * @param o The observed object (an instance of Observable).
- * @param infoObj An arbitrary data object sent by
- * the observed object.
- */
- public function update(o:Observable, infoObj:Object):Void;
+/***************************************************************************
+ * 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;
+
+/**
+ * The interface that must be implemented by all observers of an
+ * Observable object.
+ */
+interface org.lamsfoundation.lams.common.util.Observer {
+ /**
+ * Invoked automatically by an observed object when it changes.
+ *
+ * @param o The observed object (an instance of Observable).
+ * @param infoObj An arbitrary data object sent by
+ * the observed object.
+ */
+ public function update(o:Observable, infoObj:Object):Void;
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Proxy.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Proxy.as (.../Proxy.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/Proxy.as (.../Proxy.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,61 +1,61 @@
-/***************************************************************************
- * 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.*
-
-
-
-
-/**
- * The proxy class, contains 1 static method
- * Dave
- * @version 1.0
- * @since
- */
-class org.lamsfoundation.lams.common.util.Proxy {
-
- /**
- * Creates a function that executes in the scope passed in as target,
- * not the scope it is actually executed in.
- * Like MMs delegate function but can accept parameters and pass them onto
- * the function
- * @usage
- * @param oTarget the scope the function should execute in
- * @param fFunction the function to execute, followed by any other parameters to pass on.
- * @return
- */
- public static function create (oTarget:Object, fFunction:Function):Function {
- var parameters:Array = new Array ();
- var l = arguments.length;
-
- for (var i = 2; i < l; i++) {
- parameters[i - 2] = arguments[i];
- }
-
- var fProxy:Function = function (){
- var totalParameters:Array = arguments.concat (parameters);
- fFunction.apply (oTarget, totalParameters);
- };
- return fProxy;
- }
-}
+/***************************************************************************
+ * 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.*
+
+
+
+
+/**
+ * The proxy class, contains 1 static method
+ * Dave
+ * @version 1.0
+ * @since
+ */
+class org.lamsfoundation.lams.common.util.Proxy {
+
+ /**
+ * Creates a function that executes in the scope passed in as target,
+ * not the scope it is actually executed in.
+ * Like MMs delegate function but can accept parameters and pass them onto
+ * the function
+ * @usage
+ * @param oTarget the scope the function should execute in
+ * @param fFunction the function to execute, followed by any other parameters to pass on.
+ * @return
+ */
+ public static function create (oTarget:Object, fFunction:Function):Function {
+ var parameters:Array = new Array ();
+ var l = arguments.length;
+
+ for (var i = 2; i < l; i++) {
+ parameters[i - 2] = arguments[i];
+ }
+
+ var fProxy:Function = function (){
+ var totalParameters:Array = arguments.concat (parameters);
+ fFunction.apply (oTarget, totalParameters);
+ };
+ return fProxy;
+ }
+}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as
===================================================================
diff -u -rb5f1c6147aeaaec0f5084813209fe0cf59a1c386 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as (.../StringUtils.as) (revision b5f1c6147aeaaec0f5084813209fe0cf59a1c386)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as (.../StringUtils.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,114 +1,114 @@
-/***************************************************************************
- * 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.*
+/***************************************************************************
+ * 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.*
-
-/**
-* Util methods for string manipulation
-* @class StringUtils
-* @author DI
-*/
-class StringUtils {
-
- //Declarations
+
+/**
+* Util methods for string manipulation
+* @class StringUtils
+* @author DI
+*/
+class StringUtils {
+
+ //Declarations
private var _className:String = 'StringUtils';
- private static var _nextID:Number = 0;
-
- //Constructor
- function StringUtils() {
- }
-
- //Getters+Setters
- function get className():String{
- return _className;
- }
-
- /**
- * If the value passed in is any null type value or LAMS NULL VALUE then blank string is returned
- * Used to prevent "undefined" appearing in the UI
- * @usage var myStr = StringUtils.cleanNull(STR)
- * @param str The string to search
- * @return a clean string
- */
- public static function cleanNull(str:String):String{
- if(str == undefined){
- return "";
- }
- if(str == null){
- return "";
- }
- if(str == ""){
- return "";
- }
- if(str == Config.STRING_NULL_VALUE){
- return "";
- }
- if(str == "undefined"){
- return "";
- }
- if(str == "null"){
- return "";
- }
-
- return str;
-
- }
-
- /**
- * Converts < to < and > to >
- * Used good for displaying html looking tags in textfields that expect HTML.
- * @usage var myStr:String = StringUtils.escapeAngleBrackets(str);
- * @param str
- * @return
- */
- public static function escapeAngleBrackets(str:String):String{
- var r:String = new String();
- //str = new String(str);
- r = replace(str, "<","<");
- r = replace(r, ">",">");
- return r;
- }
-
- /**
- * Search replace function, leaves original string untouched
- * @usage var myStr:String = StringUtils.replace(str,search, replace);
- * @param s The string to work on
- * @param p_str The string to find
- * @param p_repl The string to replace
- * @return The result
- */
- public static function replace (s:String,p_str:String,p_repl:String) {
- var position:Number;
-
- while((position = s.indexOf(p_str)) != -1) {
- position= s.indexOf(p_str);
- s = s.substring(0,position)+p_repl+s.substring(position+p_str.length,s.length)
- }
-
- return s;
- }
+ private static var _nextID:Number = 0;
+
+ //Constructor
+ function StringUtils() {
+ }
+
+ //Getters+Setters
+ function get className():String{
+ return _className;
+ }
+ /**
+ * If the value passed in is any null type value or LAMS NULL VALUE then blank string is returned
+ * Used to prevent "undefined" appearing in the UI
+ * @usage var myStr = StringUtils.cleanNull(STR)
+ * @param str The string to search
+ * @return a clean string
+ */
+ public static function cleanNull(str:String):String{
+ if(str == undefined){
+ return "";
+ }
+ if(str == null){
+ return "";
+ }
+ if(str == ""){
+ return "";
+ }
+ if(str == Config.STRING_NULL_VALUE){
+ return "";
+ }
+ if(str == "undefined"){
+ return "";
+ }
+ if(str == "null"){
+ return "";
+ }
+
+ return str;
+
+ }
+
+ /**
+ * Converts < to < and > to >
+ * Used good for displaying html looking tags in textfields that expect HTML.
+ * @usage var myStr:String = StringUtils.escapeAngleBrackets(str);
+ * @param str
+ * @return
+ */
+ public static function escapeAngleBrackets(str:String):String{
+ var r:String = new String();
+ //str = new String(str);
+ r = replace(str, "<","<");
+ r = replace(r, ">",">");
+ return r;
+ }
+
+ /**
+ * Search replace function, leaves original string untouched
+ * @usage var myStr:String = StringUtils.replace(str,search, replace);
+ * @param s The string to work on
+ * @param p_str The string to find
+ * @param p_repl The string to replace
+ * @return The result
+ */
+ public static function replace (s:String,p_str:String,p_repl:String) {
+ var position:Number;
+
+ while((position = s.indexOf(p_str)) != -1) {
+ position= s.indexOf(p_str);
+ s = s.substring(0,position)+p_repl+s.substring(position+p_str.length,s.length)
+ }
+
+ return s;
+ }
+
/**
* Converts a query string to an object with attribute-value properies
@@ -175,21 +175,21 @@
public static function getUID():String {
//Return object
var uid:String;
-
+
//Get the time now in ms and concatenate with random number between 1-10
var date:Date = new Date();
//YEAR
var year_str:String = String(date.getFullYear());
-
+
//MONTH
var month_str:String = String(date.getMonth()+1);
month_str = StringUtils.pad(month_str,2);
-
+
//DAY
var day_str:String = String(date.getDate());
day_str = StringUtils.pad(day_str,2);
-
+
//HOUR
var hour_str:String = String(date.getHours());
hour_str = StringUtils.pad(hour_str,2);
@@ -218,125 +218,125 @@
uid = year_str + month_str + day_str + hour_str + minute_str + second_str + milliSecond_str + '-'+ id;
return uid;
- }
-
-
- /**
- * Enter description here
- *
- * @usage To Convert Month Number into full Month Name
- * @param month number
- * @return Month Name String
- */
- public static function getMonthAsString(month:Number):String {
- var monthNames_array:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
- return monthNames_array[month];
-}
-
-
- /**
- * Checks to see if the value passed in is null, undefined or a blank string
- * @usage
- * @param v
- * @return
- */
- public static function isEmpty(v):Boolean{
- if(v == undefined || v== null || v==""){
- return true;
- }else{
- return false;
- }
- }
-
- /**
- * Returns a new String based on the input String with the leading and trailing spaces removed
- * @usage
- * @param str
- * @return
- */
- public static function trim(str:String):String {
- var startIdx:Number;
- for (var i=0; i0; i--) {
- if (str.charAt(i-1) != " ") {
- endIdx = i;
- break;
- }
- }
-
- // if there are no spaces, return a new instance of the original string, else return the trimmed string
- if (startIdx == undefined || startIdx == null || endIdx == undefined || endIdx == null) {
- if (str.length > 0) return new String(""); // string contains only spaces, return a new empty string
- }
-
- var trimmedStr:String = str.substring(startIdx, endIdx);
- return trimmedStr;
- }
-
- /**
- * Checks to see if the value passed in is any of the null values defined in Config.
- * @usage
- * @param v
- * @return boolean true if null
- */
- public static function isWDDXNull(v):Boolean{
- if(v==Config.STRING_NULL_VALUE){
- return true;
- }
- if(v==Config.NUMERIC_NULL_VALUE){
- return true;
- }
- if(v==Config.STRING_NULL_VALUE){
- return true;
- }
- if(v==Config.DATE_NULL_VALUE){
- return true;
- }
- if(v==Config.BOOLEAN_NULL_VALUE){
- return true;
- }
- return false;
- }
-
- public static function isNull(v):Boolean{
- if(isEmpty(v)){
- return true;
- }else if(isWDDXNull(v)){
- return true;
- }else{
- return false;
- }
-
- }
-
- public static function getButtonWidthForStr(s:String):Number {
- var spacing:Number = 10;
- if(s != null) {
- var container = ApplicationParent.root;
- container.createTextField("str", container.getNextHighestDepth(), -1000, -1000, 0, 0);
- var str:TextField = container["str"];
- str.text = s;
- return str.textWidth + spacing;
- } else {
- return 0;
- }
- }
-
- public static function scanString(s:String, char:String):Array {
- var charArray:Array = new Array();
- for(var i:Number = 0; i < s.length; i++) {
- if(s.charAt(i) == char){
- charArray.push(i);
- }
- }
- return charArray;
+ }
+
+
+ /**
+ * Enter description here
+ *
+ * @usage To Convert Month Number into full Month Name
+ * @param month number
+ * @return Month Name String
+ */
+ public static function getMonthAsString(month:Number):String {
+ var monthNames_array:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
+ return monthNames_array[month];
+}
+
+
+ /**
+ * Checks to see if the value passed in is null, undefined or a blank string
+ * @usage
+ * @param v
+ * @return
+ */
+ public static function isEmpty(v):Boolean{
+ if(v == undefined || v== null || v==""){
+ return true;
+ }else{
+ return false;
+ }
}
-
+
+ /**
+ * Returns a new String based on the input String with the leading and trailing spaces removed
+ * @usage
+ * @param str
+ * @return
+ */
+ public static function trim(str:String):String {
+ var startIdx:Number;
+ for (var i=0; i0; i--) {
+ if (str.charAt(i-1) != " ") {
+ endIdx = i;
+ break;
+ }
+ }
+
+ // if there are no spaces, return a new instance of the original string, else return the trimmed string
+ if (startIdx == undefined || startIdx == null || endIdx == undefined || endIdx == null) {
+ if (str.length > 0) return new String(""); // string contains only spaces, return a new empty string
+ }
+
+ var trimmedStr:String = str.substring(startIdx, endIdx);
+ return trimmedStr;
+ }
+
+ /**
+ * Checks to see if the value passed in is any of the null values defined in Config.
+ * @usage
+ * @param v
+ * @return boolean true if null
+ */
+ public static function isWDDXNull(v):Boolean{
+ if(v==Config.STRING_NULL_VALUE){
+ return true;
+ }
+ if(v==Config.NUMERIC_NULL_VALUE){
+ return true;
+ }
+ if(v==Config.STRING_NULL_VALUE){
+ return true;
+ }
+ if(v==Config.DATE_NULL_VALUE){
+ return true;
+ }
+ if(v==Config.BOOLEAN_NULL_VALUE){
+ return true;
+ }
+ return false;
+ }
+
+ public static function isNull(v):Boolean{
+ if(isEmpty(v)){
+ return true;
+ }else if(isWDDXNull(v)){
+ return true;
+ }else{
+ return false;
+ }
+
+ }
+
+ public static function getButtonWidthForStr(s:String):Number {
+ var spacing:Number = 10;
+ if(s != null) {
+ var container = ApplicationParent.root;
+ container.createTextField("str", container.getNextHighestDepth(), -1000, -1000, 0, 0);
+ var str:TextField = container["str"];
+ str.text = s;
+ return str.textWidth + spacing;
+ } else {
+ return 0;
+ }
+ }
+
+ public static function scanString(s:String, char:String):Array {
+ var charArray:Array = new Array();
+ for(var i:Number = 0; i < s.length; i++) {
+ if(s.charAt(i) == char){
+ charArray.push(i);
+ }
+ }
+ return charArray;
+ }
+
}
\ No newline at end of file
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/Workspace.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/Workspace.as (.../Workspace.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/Workspace.as (.../Workspace.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,358 +1,358 @@
-/***************************************************************************
- * 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.ws.*
-import org.lamsfoundation.lams.common.util.*
-import org.lamsfoundation.lams.common.ui.*
-import org.lamsfoundation.lams.common.dict.*
-import org.lamsfoundation.lams.common.*
-import mx.utils.*
+/***************************************************************************
+ * 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.ws.*
+import org.lamsfoundation.lams.common.util.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.*
+import mx.utils.*
+
+/**
*
-* Workspace provides methods for retrieving a user workspace, necessary for selecting a design
-*
+* Workspace provides methods for retrieving a user workspace, necessary for selecting a design
+*
* @author DI
*/
class org.lamsfoundation.lams.common.ws.Workspace {
-
- // static variables
- public static var MODE_SAVE:String = "SAVE";
- public static var MODE_SAVEAS:String = "SAVEAS";
- public static var MODE_OPEN:String = "OPEN";
- public static var MODE_READONLY:String = "READONLY";
- public static var MODE_INSERT:String = "INSERT";
-
+
+ // static variables
+ public static var MODE_SAVE:String = "SAVE";
+ public static var MODE_SAVEAS:String = "SAVEAS";
+ public static var MODE_OPEN:String = "OPEN";
+ public static var MODE_READONLY:String = "READONLY";
+ public static var MODE_INSERT:String = "INSERT";
+
//Model
private var workspaceModel:WorkspaceModel;
-
+
//View
- private var workspaceView:WorkspaceView;
- private var _onOKCallBack:Function;
-
-
+ private var workspaceView:WorkspaceView;
+ private var _onOKCallBack:Function;
+
+
/**
* workspace Constructor
*
* @param target_mc Target clip for attaching view
*/
- public function Workspace (){
+ public function Workspace (){
//Create the model.
- workspaceModel = new WorkspaceModel(this);
+ workspaceModel = new WorkspaceModel(this);
//Create the authoring view and register with model
workspaceView = new WorkspaceView(workspaceModel, undefined);
- workspaceModel.addObserver(workspaceView);
- init();
- }
-
- private function init():Void{
- //find out the users wsp:
- //requestUserWorkspace();
- workspaceModel.initWorkspaceTree();
- requestAvailableLicenses();
- }
-
- /**
- * Retrieves the workspace details for the current user from the server.
- * DEPRICATED ! - we dontthink we have a use for this anymore
- * @usage
- */
- private function requestUserWorkspace():Void{
- var callback:Function = Proxy.create(this,recievedUserWorkspace);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=getWorkspace&userID='+uid,callback, false);
- }
-
- /**
- * Invoked when getUserWorkspace returns result from server.
- * Sets the data in the model
- * @usage
- */
- public function recievedUserWorkspace(dto):Void{
- Debugger.log('workspaceID:'+dto.workspaceID+',rootFolderID:'+dto.rootFolderID,Debugger.GEN,'recievedUserWorkspace','Workspace');
- workspaceModel.rootFolderID = dto.rootFolderID;
- workspaceModel.workspaceID = dto.workspaceID;
- }
-
- /**
- * Called when the user opens a node and we dont already have the children in the cache.
- * either becasue never opened beofre or becasuse the cache was cleared for that folder
- * @usage
- * @param folderID
- * @param funcToCall
- * @return
- */
- public function requestFolderContents(folderID:Number, funcToCall:Function):Void{
- var callback:Function = Proxy.create(this,recievedFolderContents);
- if(funcToCall != undefined || funcToCall != null){ callback = funcToCall; }
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=getFolderContents&folderID='+folderID+'&mode='+Config.getInstance().mode+'&userID='+uid,callback, false);
- }
-
- /**
- * Response handler for requestFolderContents
- * @usage
- * @param dto The WDDX object containing the children of this folder
- * @return
- */
- public function recievedFolderContents(dto:Object):Void{
- workspaceModel.setFolderContents(dto, true);
-
- }
-
-
- /**
- * Asks the server to copy one resource to another location, if its the same folderID,
- * then we have to change the name - append Copy of
- * @usage
- * @param resourceID //the resource to be copied, e.g. folder, LD or somethign else
- * @param targetFolderID //the fodler to copy the resource too
- * @param resourceType //the resource type string LearningDesign or Folder as of 1.1
- * @return
- */
- public function requestCopyResource(resourceID:Number,targetFolderID:Number,resourceType:String){
- Debugger.log(resourceID+',to folder '+targetFolderID+','+resourceType,Debugger.GEN,'copyResourceResponse','Workspace');
- var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=copyResource&resourceID='+resourceID+'&targetFolderID='+targetFolderID+'&resourceType='+resourceType+'&userID='+uid,callback, false);
- //http://localhost:8080/lams/workspace.do?method=copyResource&resourceID=10&targetFolderID=6&resourceType=FOLDER&userID=4
- }
-
- /**
- * Handler for most of the workspace file operations, it just invalidates the cache from the folderID pending refresh
- * and sends an open event to the dialog
- * @usage
- * @param dto
- * @return
- */
- public function generalWorkspaceOperationResponseHandler(dto:Object){
- if(dto instanceof LFError){
- dto.showErrorAlert();
- }
-
- //make a copy as the function deletes it after its finished.
- var toRefresh = workspaceModel.folderIDPendingRefresh;
- Debugger.log('reponse ID:'+dto,Debugger.GEN,'generalWorkspaceOperationResponseHandler','Workspace');
- //pass the folder that contained this resource
-
- workspaceModel.clearWorkspaceCache(workspaceModel.folderIDPendingRefresh);
- //now open this node in the tree
- workspaceModel.autoOpenFolderInTree(toRefresh);
-
- }
-
- public function requestDeleteResource(resourceID:Number,resourceType:String, noWarn:Boolean){
- Debugger.log('resourceID:'+resourceID+', resourceType'+resourceType,Debugger.GEN,'copyResourceResponse','Workspace');
- var s = false;
- var ref = this;
- Debugger.log('noWarn:'+noWarn,4,'clearCanvas','Canvas');
- if(noWarn){
- var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=deleteResource&resourceID='+resourceID+'&resourceType='+resourceType+'&userID='+uid,callback, false);
- }else {
- var fn:Function = Proxy.create(ref,confirmedDeleteResource, ref, resourceID, resourceType);
- LFMessage.showMessageConfirm(Dictionary.getValue('ws_del_confirm_msg'), fn,null);
- Debugger.log('Set design failed as old design could not be cleared',Debugger.CRITICAL,"setDesign",'Canvas');
- }
-
- }
-
- /**
- * Called when a user confirms its ok to clear the design
- * @usage
- * @param ref
- * @return
- */
- public function confirmedDeleteResource(ref, resourceID, resourceType):Void{
- var fn:Function = Proxy.create(ref,requestDeleteResource,resourceID,resourceType,true);
- fn.apply();
- }
-
- public function requestNewFolder(parentFolderID:Number,folderName:String){
- Debugger.log('parentFolderID:'+parentFolderID+', folderName'+folderName,Debugger.GEN,'requestNewFolder','Workspace');
- var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=createFolderForFlash&parentFolderID='+parentFolderID+'&name='+folderName+'&userID='+uid,callback, false);
-
- }
-
- public function requestRenameResource(resourceID:Number,resourceType:Number,newName:String){
- Debugger.log('resourceID:'+resourceID+', resourceType'+resourceType+', newName:'+newName,Debugger.GEN,'requestRenameResource','Workspace');
- var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=renameResource&resourceID='+resourceID+'&resourceType='+resourceType+'&name='+newName+'&userID='+uid,callback, false);
- }
-
- public function requestMoveResource(resourceID:Number, targetFolderID:Number, resourceType:String){
- Debugger.log('resourceID:'+resourceID+', resourceType'+resourceType+', targetFolderID:'+targetFolderID,Debugger.GEN,'requestMoveResource','Workspace');
- var callback:Function = Proxy.create(this,requestMoveResourceResponse);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=moveResource&resourceID='+resourceID+'&resourceType='+resourceType+'&targetFolderID='+targetFolderID+'&userID='+uid,callback, false);
- }
-
- public function requestMoveResourceResponse(dto){
- if(dto instanceof LFError){
- dto.showErrorAlert();
- }
-
- workspaceModel.clearWorkspaceCacheMultiple();
-
- }
-
- /**
- * Retrieves the available folders:
- * The information returned is categorized under 3 main heads
- PRIVATE The folder which belongs to the given User
- RUN_SEQUENCES The folder in which user stores his lessons
- ORGANISATIONS List of folders (root folder only) which belong to organizations of which user is a member
-
- NB THis dunction is not used in the new folder structure
-
- private function requestWorkspaceFolders():Void{
- var callback:Function = Proxy.create(this,recievedWorkspaceFolders);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=getAccessibleWorkspaceFoldersNew&userID='+uid,callback, false);
-
- }
-
- private function recievedWorkspaceFolders(dto:Object):Void{
- Debugger.log('Got the available folders - PRIVATE.resourceID:'+dto.PRIVATE.resourceID,Debugger.GEN,'recievedWorkspaceFolders','Workspace');
- //_global.breakpoint();
- workspaceModel.parseDataForTree(dto);
-
- }
- */
-
- /**
- * Gets a list of available licenses to apply to the designs. Mostly they are creative commons licenses
- * @usage
- * @return
- */
- public function requestAvailableLicenses(){
- var callback:Function = Proxy.create(this,recievedAvailableLicenses);
- var uid:Number = Config.getInstance().userID;
- ApplicationParent.getInstance().getComms().getRequest('authoring/author.do?method=getAvailableLicenses',callback, false);
- }
-
- /**
- * The handler for requestAvailableLicenses
- * @usage
-` * @param dto An array contaning objects of each of the licenses. Each one has a url, an id, a code and a imageURL, see the model for more description
- * @return
- */
- public function recievedAvailableLicenses(dto:Array){
- workspaceModel.setAvailableLicenses(dto);
- }
-
- /**
- * Shows the workspace browsing dialoge to open a design
- * Usually used by the canvas.
- *
- */
- public function userSelectItem(callback, mode){
- _onOKCallBack = callback;
- workspaceModel.currentMode = (mode != null) ? mode : "OPEN";
- workspaceModel.openDesignBySelection();
- }
-
- /**
- * Shows the workspace browsing dialogue to open a design for use in Monitoring
- * read-only mode
- */
- public function userSelectDesign(callback, mode){
- _onOKCallBack = callback;
- workspaceModel.currentMode = (mode != null) ? mode : "READONLY";
- workspaceModel.openDesignBySelection();
- }
-
- /**
- * Shows the workspace browsing tree to select a design for use in Add Sequence Wizard
- * read-only mode
- */
- public function wizardSelectDesign(callback){
- _onOKCallBack = callback;
- workspaceModel.currentMode = "READONLY";
- workspaceModel.openDesignByWizard();
- }
-
- /**
- * Shows the workspace browsing dialoge to set a design;s properties
- * Usually used for saving a design by the canvas.
- * @usage
- * @param _ddm The design in question
- * @param tabToSelect The tab to show, can be: SAVE_AS, PROPERTIES,
- * @param onOkCallback The function to call when the user clicks OK.
- * @return
- */
- public function setDesignProperties(tabToSelect:String, mode:String, onOKCallback):Void{
- _onOKCallBack = onOKCallback;
- workspaceModel.currentMode = mode;
- workspaceModel.userSetDesignProperties(tabToSelect,onOKCallback);
-
- }
-
- /**
- * Called when design has been selected from within the workspace dialog, inovked via callback method.
- */
- public function itemSelected(designId:Number){
- Debugger.log('!!designID:'+designId,Debugger.GEN,'itemSelected','org.lamsfoundation.lams.Workspace');
- _onOKCallBack(designId);
- }
-
- public function getDefaultWorkspaceID():Number{
- return workspaceModel.workspaceID;
- }
-
- public function getDefaultRootFolderID():Number{
- return workspaceModel.rootFolderID;
- }
-
- /**
- *
- * @usage
- * @param newonOKCallback
- * @return
- */
- public function set onOKCallback (newonOKCallback:Function):Void {
- _onOKCallBack = newonOKCallback;
- }
- /**
- *
- * @usage
- * @return
- */
- public function get onOKCallback ():Function {
- return _onOKCallBack;
- }
-
- public function getWorkspaceModel():WorkspaceModel{
- return workspaceModel;
- }
-
- public function getWV():WorkspaceView{
- return workspaceView;
- }
+ workspaceModel.addObserver(workspaceView);
+ init();
+ }
+ private function init():Void{
+ //find out the users wsp:
+ //requestUserWorkspace();
+ workspaceModel.initWorkspaceTree();
+ requestAvailableLicenses();
+ }
+
+ /**
+ * Retrieves the workspace details for the current user from the server.
+ * DEPRICATED ! - we dontthink we have a use for this anymore
+ * @usage
+ */
+ private function requestUserWorkspace():Void{
+ var callback:Function = Proxy.create(this,recievedUserWorkspace);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=getWorkspace&userID='+uid,callback, false);
+ }
+
+ /**
+ * Invoked when getUserWorkspace returns result from server.
+ * Sets the data in the model
+ * @usage
+ */
+ public function recievedUserWorkspace(dto):Void{
+ Debugger.log('workspaceID:'+dto.workspaceID+',rootFolderID:'+dto.rootFolderID,Debugger.GEN,'recievedUserWorkspace','Workspace');
+ workspaceModel.rootFolderID = dto.rootFolderID;
+ workspaceModel.workspaceID = dto.workspaceID;
+ }
+
+ /**
+ * Called when the user opens a node and we dont already have the children in the cache.
+ * either becasue never opened beofre or becasuse the cache was cleared for that folder
+ * @usage
+ * @param folderID
+ * @param funcToCall
+ * @return
+ */
+ public function requestFolderContents(folderID:Number, funcToCall:Function):Void{
+ var callback:Function = Proxy.create(this,recievedFolderContents);
+ if(funcToCall != undefined || funcToCall != null){ callback = funcToCall; }
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=getFolderContents&folderID='+folderID+'&mode='+Config.getInstance().mode+'&userID='+uid,callback, false);
+ }
+
+ /**
+ * Response handler for requestFolderContents
+ * @usage
+ * @param dto The WDDX object containing the children of this folder
+ * @return
+ */
+ public function recievedFolderContents(dto:Object):Void{
+ workspaceModel.setFolderContents(dto, true);
+
+ }
+
+
+ /**
+ * Asks the server to copy one resource to another location, if its the same folderID,
+ * then we have to change the name - append Copy of
+ * @usage
+ * @param resourceID //the resource to be copied, e.g. folder, LD or somethign else
+ * @param targetFolderID //the fodler to copy the resource too
+ * @param resourceType //the resource type string LearningDesign or Folder as of 1.1
+ * @return
+ */
+ public function requestCopyResource(resourceID:Number,targetFolderID:Number,resourceType:String){
+ Debugger.log(resourceID+',to folder '+targetFolderID+','+resourceType,Debugger.GEN,'copyResourceResponse','Workspace');
+ var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=copyResource&resourceID='+resourceID+'&targetFolderID='+targetFolderID+'&resourceType='+resourceType+'&userID='+uid,callback, false);
+ //http://localhost:8080/lams/workspace.do?method=copyResource&resourceID=10&targetFolderID=6&resourceType=FOLDER&userID=4
+ }
+
+ /**
+ * Handler for most of the workspace file operations, it just invalidates the cache from the folderID pending refresh
+ * and sends an open event to the dialog
+ * @usage
+ * @param dto
+ * @return
+ */
+ public function generalWorkspaceOperationResponseHandler(dto:Object){
+ if(dto instanceof LFError){
+ dto.showErrorAlert();
+ }
+
+ //make a copy as the function deletes it after its finished.
+ var toRefresh = workspaceModel.folderIDPendingRefresh;
+ Debugger.log('reponse ID:'+dto,Debugger.GEN,'generalWorkspaceOperationResponseHandler','Workspace');
+ //pass the folder that contained this resource
+
+ workspaceModel.clearWorkspaceCache(workspaceModel.folderIDPendingRefresh);
+ //now open this node in the tree
+ workspaceModel.autoOpenFolderInTree(toRefresh);
+
+ }
+
+ public function requestDeleteResource(resourceID:Number,resourceType:String, noWarn:Boolean){
+ Debugger.log('resourceID:'+resourceID+', resourceType'+resourceType,Debugger.GEN,'copyResourceResponse','Workspace');
+ var s = false;
+ var ref = this;
+ Debugger.log('noWarn:'+noWarn,4,'clearCanvas','Canvas');
+ if(noWarn){
+ var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=deleteResource&resourceID='+resourceID+'&resourceType='+resourceType+'&userID='+uid,callback, false);
+ }else {
+ var fn:Function = Proxy.create(ref,confirmedDeleteResource, ref, resourceID, resourceType);
+ LFMessage.showMessageConfirm(Dictionary.getValue('ws_del_confirm_msg'), fn,null);
+ Debugger.log('Set design failed as old design could not be cleared',Debugger.CRITICAL,"setDesign",'Canvas');
+ }
+
+ }
+
+ /**
+ * Called when a user confirms its ok to clear the design
+ * @usage
+ * @param ref
+ * @return
+ */
+ public function confirmedDeleteResource(ref, resourceID, resourceType):Void{
+ var fn:Function = Proxy.create(ref,requestDeleteResource,resourceID,resourceType,true);
+ fn.apply();
+ }
+
+ public function requestNewFolder(parentFolderID:Number,folderName:String){
+ Debugger.log('parentFolderID:'+parentFolderID+', folderName'+folderName,Debugger.GEN,'requestNewFolder','Workspace');
+ var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=createFolderForFlash&parentFolderID='+parentFolderID+'&name='+folderName+'&userID='+uid,callback, false);
+
+ }
+
+ public function requestRenameResource(resourceID:Number,resourceType:Number,newName:String){
+ Debugger.log('resourceID:'+resourceID+', resourceType'+resourceType+', newName:'+newName,Debugger.GEN,'requestRenameResource','Workspace');
+ var callback:Function = Proxy.create(this,generalWorkspaceOperationResponseHandler);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=renameResource&resourceID='+resourceID+'&resourceType='+resourceType+'&name='+newName+'&userID='+uid,callback, false);
+ }
+
+ public function requestMoveResource(resourceID:Number, targetFolderID:Number, resourceType:String){
+ Debugger.log('resourceID:'+resourceID+', resourceType'+resourceType+', targetFolderID:'+targetFolderID,Debugger.GEN,'requestMoveResource','Workspace');
+ var callback:Function = Proxy.create(this,requestMoveResourceResponse);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=moveResource&resourceID='+resourceID+'&resourceType='+resourceType+'&targetFolderID='+targetFolderID+'&userID='+uid,callback, false);
+ }
+
+ public function requestMoveResourceResponse(dto){
+ if(dto instanceof LFError){
+ dto.showErrorAlert();
+ }
+
+ workspaceModel.clearWorkspaceCacheMultiple();
+
+ }
+
+ /**
+ * Retrieves the available folders:
+ * The information returned is categorized under 3 main heads
+ PRIVATE The folder which belongs to the given User
+ RUN_SEQUENCES The folder in which user stores his lessons
+ ORGANISATIONS List of folders (root folder only) which belong to organizations of which user is a member
+
+ NB THis dunction is not used in the new folder structure
+
+ private function requestWorkspaceFolders():Void{
+ var callback:Function = Proxy.create(this,recievedWorkspaceFolders);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('workspace.do?method=getAccessibleWorkspaceFoldersNew&userID='+uid,callback, false);
+
+ }
+
+ private function recievedWorkspaceFolders(dto:Object):Void{
+ Debugger.log('Got the available folders - PRIVATE.resourceID:'+dto.PRIVATE.resourceID,Debugger.GEN,'recievedWorkspaceFolders','Workspace');
+ //_global.breakpoint();
+ workspaceModel.parseDataForTree(dto);
+
+ }
+ */
+
+ /**
+ * Gets a list of available licenses to apply to the designs. Mostly they are creative commons licenses
+ * @usage
+ * @return
+ */
+ public function requestAvailableLicenses(){
+ var callback:Function = Proxy.create(this,recievedAvailableLicenses);
+ var uid:Number = Config.getInstance().userID;
+ ApplicationParent.getInstance().getComms().getRequest('authoring/author.do?method=getAvailableLicenses',callback, false);
+ }
+
+ /**
+ * The handler for requestAvailableLicenses
+ * @usage
+` * @param dto An array contaning objects of each of the licenses. Each one has a url, an id, a code and a imageURL, see the model for more description
+ * @return
+ */
+ public function recievedAvailableLicenses(dto:Array){
+ workspaceModel.setAvailableLicenses(dto);
+ }
+
+ /**
+ * Shows the workspace browsing dialoge to open a design
+ * Usually used by the canvas.
+ *
+ */
+ public function userSelectItem(callback, mode){
+ _onOKCallBack = callback;
+ workspaceModel.currentMode = (mode != null) ? mode : "OPEN";
+ workspaceModel.openDesignBySelection();
+ }
+
+ /**
+ * Shows the workspace browsing dialogue to open a design for use in Monitoring
+ * read-only mode
+ */
+ public function userSelectDesign(callback, mode){
+ _onOKCallBack = callback;
+ workspaceModel.currentMode = (mode != null) ? mode : "READONLY";
+ workspaceModel.openDesignBySelection();
+ }
+
+ /**
+ * Shows the workspace browsing tree to select a design for use in Add Sequence Wizard
+ * read-only mode
+ */
+ public function wizardSelectDesign(callback){
+ _onOKCallBack = callback;
+ workspaceModel.currentMode = "READONLY";
+ workspaceModel.openDesignByWizard();
+ }
+
+ /**
+ * Shows the workspace browsing dialoge to set a design;s properties
+ * Usually used for saving a design by the canvas.
+ * @usage
+ * @param _ddm The design in question
+ * @param tabToSelect The tab to show, can be: SAVE_AS, PROPERTIES,
+ * @param onOkCallback The function to call when the user clicks OK.
+ * @return
+ */
+ public function setDesignProperties(tabToSelect:String, mode:String, onOKCallback):Void{
+ _onOKCallBack = onOKCallback;
+ workspaceModel.currentMode = mode;
+ workspaceModel.userSetDesignProperties(tabToSelect,onOKCallback);
+
+ }
+
+ /**
+ * Called when design has been selected from within the workspace dialog, inovked via callback method.
+ */
+ public function itemSelected(designId:Number){
+ Debugger.log('!!designID:'+designId,Debugger.GEN,'itemSelected','org.lamsfoundation.lams.Workspace');
+ _onOKCallBack(designId);
+ }
+
+ public function getDefaultWorkspaceID():Number{
+ return workspaceModel.workspaceID;
+ }
+
+ public function getDefaultRootFolderID():Number{
+ return workspaceModel.rootFolderID;
+ }
+
+ /**
+ *
+ * @usage
+ * @param newonOKCallback
+ * @return
+ */
+ public function set onOKCallback (newonOKCallback:Function):Void {
+ _onOKCallBack = newonOKCallback;
+ }
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get onOKCallback ():Function {
+ return _onOKCallBack;
+ }
+
+ public function getWorkspaceModel():WorkspaceModel{
+ return workspaceModel;
+ }
+
+ public function getWV():WorkspaceView{
+ return workspaceView;
+ }
+
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceController.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceController.as (.../WorkspaceController.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceController.as (.../WorkspaceController.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -20,13 +20,13 @@
* http://www.gnu.org/licenses/gpl.txt
* ************************************************************************
*/
-
+
import org.lamsfoundation.lams.authoring.Application;
import org.lamsfoundation.lams.common.ws.*
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.dict.*
import mx.utils.*
/*
@@ -35,7 +35,7 @@
class org.lamsfoundation.lams.common.ws.WorkspaceController extends AbstractController {
private var _workspaceModel:WorkspaceModel;
- private var _workspaceController:WorkspaceController;
+ private var _workspaceController:WorkspaceController;
private var _isBusy:Boolean;
/**
* Constructor
@@ -45,7 +45,7 @@
public function WorkspaceController (wm:Observable) {
super (wm);
_workspaceController = this;
- _workspaceModel = WorkspaceModel(wm);
+ _workspaceModel = WorkspaceModel(wm);
_isBusy = false;
}
@@ -74,16 +74,16 @@
//note this function registeres the dialog to recieve view updates
evt.target.scrollContent.setUpContent();
//populate the licenses drop down
- _workspaceModel.populateLicenseDetails();
+ _workspaceModel.populateLicenseDetails();
//select the right tab, dont pass anything to show the default tab
- _workspaceModel.showTab(_workspaceModel.currentTab);
-
- // show details of current saved LD - Authoring only
- if(_workspaceModel.currentMode == 'SAVEAS'){
- _workspaceModel.currentOpenNode = Application.getInstance().getCanvas().ddm.getDesignForWorkspace();
- trace('current open node (ltext): ' + _workspaceModel.currentOpenNode);
- _workspaceModel.showCurrentDetails(_workspaceModel.currentOpenNode);
+ _workspaceModel.showTab(_workspaceModel.currentTab);
+
+ // show details of current saved LD - Authoring only
+ if(_workspaceModel.currentMode == 'SAVEAS'){
+ _workspaceModel.currentOpenNode = Application.getInstance().getCanvas().ddm.getDesignForWorkspace();
+ trace('current open node (ltext): ' + _workspaceModel.currentOpenNode);
+ _workspaceModel.showCurrentDetails(_workspaceModel.currentOpenNode);
}
}else {
//TODO DI 25/05/05 raise wrong event type error
@@ -137,16 +137,16 @@
Debugger.log('nodeToOpen resourceID:'+nodeToOpen.attributes.data.resourceID,Debugger.GEN,'onTreeNodeOpen','org.lamsfoundation.lams.WorkspaceController');
//if this ndoe has children then the
//data has already been got, nothing to do
-
- if(!nodeToOpen.hasChildNodes() && !_isBusy){
+
+ if(!nodeToOpen.hasChildNodes() && !_isBusy){
- setBusy();
+ setBusy();
// DC24-01-06 this resource ID must refer to a folder as its been marked as a branch
var resourceToOpen = nodeToOpen.attributes.data.resourceID;
//must be a folder ID, depoends if this event is fired for an "open" reousrce click
- _workspaceModel.openFolderInTree(resourceToOpen, false);
-
+ _workspaceModel.openFolderInTree(resourceToOpen, false);
+
clearBusy();
}else{
Debugger.log('nodeToOpen already has children in cache',Debugger.GEN,'onTreeNodeOpen','org.lamsfoundation.lams.WorkspaceController');
@@ -162,9 +162,9 @@
_workspaceModel.openFolderInTree(resourceToOpen, true);
}else{
Debugger.log('nodeToOpen already has children in cache',Debugger.GEN,'forceNodeOpen','org.lamsfoundation.lams.WorkspaceController');
- _workspaceModel.forced = true;
+ _workspaceModel.forced = true;
_workspaceModel.broadcastViewUpdate('OPEN_FOLDER',nodeToOpen);
- }
+ }
}
/**
@@ -178,10 +178,10 @@
public function onTreeNodeChange (evt:Object){
Debugger.log('type::'+evt.type,Debugger.GEN,'onTreeNodeChange','org.lamsfoundation.lams.WorkspaceController');
var treeview = evt.target;
- _workspaceModel.setSelectedTreeNode(treeview.selectedNode);
- if(treeview.selectedNode.attributes.data.resourceType == _workspaceModel.RT_FOLDER) {
- if(treeview.selectedNode.attributes.isOpen) { _workspaceModel.broadcastViewUpdate('CLOSE_FOLDER', treeview.selectedNode); }
- else { forceNodeOpen(treeview.selectedNode); }
+ _workspaceModel.setSelectedTreeNode(treeview.selectedNode);
+ if(treeview.selectedNode.attributes.data.resourceType == _workspaceModel.RT_FOLDER) {
+ if(treeview.selectedNode.attributes.isOpen) { _workspaceModel.broadcastViewUpdate('CLOSE_FOLDER', treeview.selectedNode); }
+ else { forceNodeOpen(treeview.selectedNode); }
}
}
@@ -243,7 +243,7 @@
_workspaceModel.getWorkspace().requestMoveResource(sourceNodeData.resourceID, targetFolderID, sourceNodeData.resourceType);
}else{
LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null);
-
+
//we still have to refresh the folders as the DnD tree will be showing wrong info
_workspaceModel.clearWorkspaceCacheMultiple();
}
@@ -258,13 +258,13 @@
* @param e
* @return
*/
- public function fileOperationRequest(e:Object){
+ public function fileOperationRequest(e:Object){
setBusy();
var tgt:String = new String(e.target);
var workspaceDialogue = getView().workspaceDialogue;
-
+
Debugger.log('type:'+e.type+',target:'+tgt,Debugger.GEN,'fileOperationRequest','org.lamsfoundation.lams.WorkspaceController');
-
+
//get the selected node:
var snode = workspaceDialogue.treeview.selectedNode;
@@ -303,16 +303,16 @@
}
}else if(tgt.indexOf("delete_btn") != -1){
-
- if(isUserPrivateFolder(snode)) { LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null); clearBusy(); return; }
-
+
+ if(isUserPrivateFolder(snode)) { LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null); clearBusy(); return; }
+
var snodeData = workspaceDialogue.treeview.selectedNode.attributes.data;
-
+
if(snodeData != null){
//TODO Check permission code to make sure we can do this!
//check if we can write to this folder
if(_workspaceModel.isWritableResource(snodeData.resourceType,snodeData.resourceID)){
- _workspaceModel.folderIDPendingRefresh = snodeData.workspaceFolderID;
+ _workspaceModel.folderIDPendingRefresh = snodeData.workspaceFolderID;
_workspaceModel.getWorkspace().requestDeleteResource(snodeData.resourceID,snodeData.resourceType, false);
}else{
LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null);
@@ -324,7 +324,7 @@
}
}else if(tgt.indexOf("new_btn") != -1){
//check we can create a folder here
- var snodeData = workspaceDialogue.treeview.selectedNode.attributes.data;
+ var snodeData = workspaceDialogue.treeview.selectedNode.attributes.data;
if(snodeData != null){
//check if we can write to this folder
@@ -341,8 +341,8 @@
//_workspaceModel.getWorkspace().requestCreateFolder();
}else if(tgt.indexOf("rename_btn") != -1){
- //check we can rename a folder here
- if(isUserPrivateFolder(snode)) { LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null); clearBusy(); return; }
+ //check we can rename a folder here
+ if(isUserPrivateFolder(snode)) { LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null); clearBusy(); return; }
var snodeData = workspaceDialogue.treeview.selectedNode.attributes.data;
if(snodeData != null){
@@ -389,50 +389,50 @@
var workspaceDialogue = getView().workspaceDialogue;
var snodeData = workspaceDialogue.treeview.selectedNode.attributes.data;
var selectedFolderID:Number;
-
+
//if its a folder then the resourceID is the selected folder ID, otherwise its the parent
if(snodeData.resourceType == _workspaceModel.RT_FOLDER){
selectedFolderID = snodeData.resourceID;
}else{
selectedFolderID = snodeData.workspaceFolderID;
}
-
+
_workspaceModel.folderIDPendingRefresh = selectedFolderID;
-
+
//TODO: Validate is allowed name
_workspaceModel.getWorkspace().requestNewFolder(selectedFolderID,newName);
- }
-
- /**
- * Determine if node is representing the user's private folder
- *
- * @param snode Node to check
- * @return
- */
- private function isUserPrivateFolder(snode:XMLNode) {
- if(_workspaceModel.getWorkspaceResource(_workspaceModel.RT_FOLDER + "_" + WorkspaceModel.ROOT_VFOLDER).firstChild == snode) {
- return true;
- } else {
- return false;
- }
}
- public function setBusy(){
- _isBusy = true;
-
- getView().workspaceDialog.showHideBtn(false);
- }
-
- public function clearBusy(){
- _isBusy = false;
-
- getView().workspaceDialog.showHideBtn(true);
- }
-
- public function getWSModel():WorkspaceModel{
- return _workspaceModel;
+ /**
+ * Determine if node is representing the user's private folder
+ *
+ * @param snode Node to check
+ * @return
+ */
+ private function isUserPrivateFolder(snode:XMLNode) {
+ if(_workspaceModel.getWorkspaceResource(_workspaceModel.RT_FOLDER + "_" + WorkspaceModel.ROOT_VFOLDER).firstChild == snode) {
+ return true;
+ } else {
+ return false;
+ }
}
+ public function setBusy(){
+ _isBusy = true;
+
+ getView().workspaceDialog.showHideBtn(false);
+ }
+
+ public function clearBusy(){
+ _isBusy = false;
+
+ getView().workspaceDialog.showHideBtn(true);
+ }
+
+ public function getWSModel():WorkspaceModel{
+ return _workspaceModel;
+ }
+
//override the super version
public function getView(){
var v = super.getView();
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as
===================================================================
diff -u -r6455661a6bf20c1846409aad23339b3d6ddb0f8d -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as (.../WorkspaceDialog.as) (revision 6455661a6bf20c1846409aad23339b3d6ddb0f8d)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as (.../WorkspaceDialog.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,1111 +1,1111 @@
-/***************************************************************************
- * 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.authoring.Application;
-import org.lamsfoundation.lams.authoring.cv.Canvas;
-import org.lamsfoundation.lams.authoring.DesignDataModel;
-import org.lamsfoundation.lams.common.*;
-import org.lamsfoundation.lams.common.ws.*
-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 it.sephiroth.TreeDnd;
-/**
-* @author DI & DC
-*/
-class WorkspaceDialog extends MovieClip{
-
- //private static var OK_OFFSET:Number = 50;
- //private static var CANCEL_OFFSET:Number = 50;
-
- //References to components + clips
- private var _container:MovieClip; //The container window that holds the dialog
- private var ok_btn:Button; //OK+Cancel buttons
- private var cancel_btn:Button;
- private var panel:MovieClip; //The underlaying panel base
-
- private var switchView_tab:MovieClip;
-
- //location tab elements
- private var treeview:Tree; //Treeview for navigation through workspace folder structure
- private var location_dnd:TreeDnd;
- private var input_txt:TextInput;
- private var currentPath_lbl:Label;
- private var name_lbl:Label;
- private var resourceTitle_txi:TextInput;
- private var new_btn:Button;
- //private var cut_btn:Button;
- private var copy_btn:Button;
- private var paste_btn:Button;
- private var delete_btn:Button;
- private var rename_btn:Button;
-
-
- //properties
- private var description_lbl:Label;
- private var license_lbl:Label;
- private var license_comment_lbl:Label;
- private var resourceDesc_txa:TextArea;
- private var license_txa:TextArea;
- private var licenseID_cmb:ComboBox;
- private var licenseImg_pnl:MovieClip;
- private var viewLicense_btn:Button;
-
-
-
- private var fm:FocusManager; //Reference to focus manager
- private var themeManager:ThemeManager; //Theme manager
-
- private var _workspaceView:WorkspaceView;
- private var _workspaceModel:WorkspaceModel;
- private var _workspaceController:WorkspaceController;
-
-
- //Dimensions for resizing
- private var xOkOffset:Number;
- private var yOkOffset:Number;
- private var xCancelOffset:Number;
- private var yCancelOffset:Number;
-
- private var _resultDTO:Object; //This is an object to contain whatever the user has selected / set - will be passed back to the calling function
-
-
- private var _selectedDesignId:Number;
- private var _currentTab:Number;
-
- private static var OTHER_LICENSE_ID:Number = 6;
- private static var LOCATION_TAB:Number = 0;
- private static var PROP_TAB:Number = 1;
-
- //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 WorkspaceDialog(){
- //trace('WorkSpaceDialog.constructor');
- //Set up this class to use the Flash event delegation model
- EventDispatcher.initialize(this);
- _resultDTO = new Object();
- //this.tabEnabled = true
- //Create a clip that will wait a frame before dispatching init to give components time to setup
- this.onEnterFrame = init;
- }
-
- /**
- * Called a frame after movie attached to allow components to initialise
- */
- private function init(){
- //Delete the enterframe dispatcher
- delete this.onEnterFrame;
- //TODO: DC apply the themes here
-
-
- //set the reference to the StyleManager
- themeManager = ThemeManager.getInstance();
-
- //Set the container reference
- Debugger.log('container=' + _container,Debugger.GEN,'init','org.lamsfoundation.lams.WorkspaceDialog');
-
- //set up the tab bar:
-
- switchView_tab.addItem({label:Dictionary.getValue('ws_dlg_location_button'), data:'LOCATION'});
- switchView_tab.addItem({label:Dictionary.getValue('ws_dlg_properties_button'), data:'PROPERTIES'});
-
-
- //Set the text on the labels
- currentPath_lbl.text = ""+Dictionary.getValue('ws_dlg_location_button')+":"
- license_lbl.text = Dictionary.getValue('ws_license_lbl');
- license_comment_lbl.text = Dictionary.getValue('ws_license_comment_lbl');
-
- name_lbl.text = Dictionary.getValue('ws_dlg_filename');
- description_lbl.text = Dictionary.getValue('ws_dlg_description');
-
- //Set the text for buttons
- ok_btn.label = Dictionary.getValue('ws_dlg_ok_button');
- cancel_btn.label = Dictionary.getValue('ws_dlg_cancel_button');
- viewLicense_btn.label = Dictionary.getValue('ws_view_license_button');
-
- new_btn.label = Dictionary.getValue('new_btn');
- copy_btn.label = Dictionary.getValue('copy_btn');
- paste_btn.label = Dictionary.getValue('paste_btn');
- delete_btn.label = Dictionary.getValue('delete_btn');
- rename_btn.label = Dictionary.getValue('rename_btn');
- //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);
-
- treeview = location_dnd.getTree();
- //Fire contentLoaded event, this is required by all dialogs so that creator of LFWindow can know content loaded
- resourceTitle_txi.setFocus();
- _container.contentLoaded();
- this.tabChildren = true;
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- setTabIndex();
- //removeProps(_workspaceView.getModel().
- }
-
- /**
- * 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');
- removeProps(_workspaceController.getWSModel())
-
- //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));
- switchView_tab.addEventListener("change",Delegate.create(this, switchTab));
-
- //think this is failing....
- switchView_tab.setSelectedIndex(0);
-
- new_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
- copy_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
- paste_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
- delete_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
- rename_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
-
- viewLicense_btn.addEventListener('click',Delegate.create(this, openLicenseURL));
- licenseID_cmb.addEventListener('change',Delegate.create(this, onLicenseComboSelect));
-
- //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('Received an Event dispatcher UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','org.lamsfoundation.lams.ws.WorkspaceDialog');
- //Update view from info object
- 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);
- break;
- case 'REFRESH_TREE' :
- refreshTree(wm);
- break;
- case 'UPDATE_CHILD_FOLDER' :
- updateChildFolderBranches(event.data,wm);
- openFolder(event.data, wm);
- break;
- 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, false);
- break;
- case 'CLOSE_FOLDER' :
- closeFolder(event.data, wm);
- break;
- case 'REFRESH_FOLDER' :
- refreshFolder(event.data, wm);
- break;
- case 'SHOW_TAB' :
- showTab(event.data, wm);
- break;
- case 'UPDATED_PROP_DETAILS' :
- populatePropDetails(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');
- }
-
- }
-
-
-
- /**
- * 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:"
+ license_lbl.text = Dictionary.getValue('ws_license_lbl');
+ license_comment_lbl.text = Dictionary.getValue('ws_license_comment_lbl');
+
+ name_lbl.text = Dictionary.getValue('ws_dlg_filename');
+ description_lbl.text = Dictionary.getValue('ws_dlg_description');
+
+ //Set the text for buttons
+ ok_btn.label = Dictionary.getValue('ws_dlg_ok_button');
+ cancel_btn.label = Dictionary.getValue('ws_dlg_cancel_button');
+ viewLicense_btn.label = Dictionary.getValue('ws_view_license_button');
+
+ new_btn.label = Dictionary.getValue('new_btn');
+ copy_btn.label = Dictionary.getValue('copy_btn');
+ paste_btn.label = Dictionary.getValue('paste_btn');
+ delete_btn.label = Dictionary.getValue('delete_btn');
+ rename_btn.label = Dictionary.getValue('rename_btn');
+ //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);
+
+ treeview = location_dnd.getTree();
+ //Fire contentLoaded event, this is required by all dialogs so that creator of LFWindow can know content loaded
+ resourceTitle_txi.setFocus();
+ _container.contentLoaded();
+ this.tabChildren = true;
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ setTabIndex();
+ //removeProps(_workspaceView.getModel().
+ }
+
+ /**
+ * 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');
+ removeProps(_workspaceController.getWSModel())
+
+ //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));
+ switchView_tab.addEventListener("change",Delegate.create(this, switchTab));
+
+ //think this is failing....
+ switchView_tab.setSelectedIndex(0);
+
+ new_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
+ copy_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
+ paste_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
+ delete_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
+ rename_btn.addEventListener('click',Delegate.create(_workspaceController, _workspaceController.fileOperationRequest));
+
+ viewLicense_btn.addEventListener('click',Delegate.create(this, openLicenseURL));
+ licenseID_cmb.addEventListener('change',Delegate.create(this, onLicenseComboSelect));
+
+ //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('Received an Event dispatcher UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','org.lamsfoundation.lams.ws.WorkspaceDialog');
+ //Update view from info object
+ 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);
+ break;
+ case 'REFRESH_TREE' :
+ refreshTree(wm);
+ break;
+ case 'UPDATE_CHILD_FOLDER' :
+ updateChildFolderBranches(event.data,wm);
+ openFolder(event.data, wm);
+ break;
+ 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, false);
+ break;
+ case 'CLOSE_FOLDER' :
+ closeFolder(event.data, wm);
+ break;
+ case 'REFRESH_FOLDER' :
+ refreshFolder(event.data, wm);
+ break;
+ case 'SHOW_TAB' :
+ showTab(event.data, wm);
+ break;
+ case 'UPDATED_PROP_DETAILS' :
+ populatePropDetails(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');
+ }
+
+ }
+
+
+
+ /**
+ * 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 0){
- for(var i=0; i 0){
-
- 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(){
- _global.breakpoint();
- _workspaceController = _workspaceView.getController();
- _workspaceController.setBusy()
-
- //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;
-
- if(isVirtualFolder(snode)){
- _workspaceController.clearBusy();
- return;
- }
-
- Debugger.log('_workspaceModel.currentMode: ' + _workspaceModel.currentMode,Debugger.GEN,'ok','org.lamsfoundation.lams.WorkspaceDialog');
- var tempTitle = StringUtils.replace(resourceTitle_txi.text, " ", "");
- if(_workspaceModel.currentMode==Workspace.MODE_SAVE || _workspaceModel.currentMode==Workspace.MODE_SAVEAS){
- if (tempTitle == "" || tempTitle == undefined){
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
-
- var sendMsg:String = Dictionary.getValue('ws_file_name_empty')+"\n"+Dictionary.getValue('ws_entre_file_name')+"\n\n";
- LFMessage.showMessageAlert(sendMsg,null);
- _workspaceController.clearBusy();
- resourceTitle_txi.setFocus();
- }else{
- Cursor.showCursor(ApplicationParent.C_HOURGLASS);
- saveFile(snode);
- }
- } else {
- openFile(snode);
- }
- }
-
- /**
- * Open file from Workspace
- *
- * @param snode file to open or folder to open from
- */
-
- private function openFile(snode:XMLNode):Void{
- Debugger.log('Opening a file.',Debugger.GEN,'openFile','org.lamsfoundation.lams.WorkspaceDialog');
- _workspaceController = _workspaceView.getController();
-
- if (snode.attributes.data.resourceType==_workspaceModel.RT_FOLDER){
- if(resourceTitle_txi.text == null){
- } else {
- if(!searchForFile(snode, resourceTitle_txi.text)){
- _workspaceController.clearBusy()
- }
- }
- } else {
- doWorkspaceDispatch(true);
- }
- }
-
- /**
- * Save file to Workspace
- *
- * @param snode folder to save to
- */
- private function saveFile(snode:XMLNode):Void{
- Debugger.log('Saving a file.',Debugger.GEN,'saveFile','org.lamsfoundation.lams.WorkspaceDialog');
- var snodeData = treeview.selectedNode.attributes.data;
- var isWritable:Boolean = _workspaceModel.isWritableResource(snodeData.resourceType,snodeData.resourceID);
- Debugger.log("isWritable: "+isWritable, Debugger.CRITICAL, "saveFile", "WorkspaceDialog");
- _workspaceController = _workspaceView.getController();
- if(snode == treeview.dataProvider.firstChild){
- LFMessage.showMessageAlert(Dictionary.getValue('ws_save_folder_invalid'),null);
- } else if(snode.attributes.data.resourceType==_workspaceModel.RT_LD){
- if(snode.parentNode != null) {
- if(searchForFile(snode.parentNode, resourceTitle_txi.text, true)) {
- if(isWritable) {
- //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));
- _workspaceController.clearBusy();
- }
- else // don't have permission, file is read-only
- LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null)
- }
- }
- } else if(snode.attributes.data.resourceType==_workspaceModel.RT_FOLDER){
- if(snode.attributes.data.resourceID < 0){
- LFMessage.showMessageAlert(Dictionary.getValue('ws_save_folder_invalid'),null);
- _workspaceController.clearBusy();
- } else if (!isWritable) {
- LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null);
- } else if(searchForFile(snode, resourceTitle_txi.text)){
- //run a alert dialogue as user is using the same name as an existing design!
- LFMessage.showMessageAlert(Dictionary.getValue('ws_chk_overwrite_existing', [resourceTitle_txi.text]), null);
- _workspaceController.clearBusy();
- }
- } else {
- LFMessage.showMessageAlert(Dictionary.getValue('ws_click_folder_file'),null);
- _workspaceController.clearBusy();
- }
-
- Cursor.showCursor(ApplicationParent.C_DEFAULT);
- }
-
- private function searchForFile(snode:XMLNode, filename:String, isParentNode:Boolean){
-
- var _isParentNode:Boolean = isParentNode;
-
- if(_isParentNode == null) {
- _isParentNode = false;
- }
-
- Debugger.log('Searching for file (' + snode.childNodes.length + '): ' + filename,Debugger.GEN,'openFile','org.lamsfoundation.lams.WorkspaceDialog');
- var cnode:XMLNode;
-
- if(snode.hasChildNodes() || snode.attributes.isEmpty){
-
- cnode = snode.firstChild;
- do {
- Debugger.log('matching file: ' + cnode.attributes.data.name + ' to: ' + filename,Debugger.GEN,'openFile','org.lamsfoundation.lams.WorkspaceDialog');
-
- // look for matching Learning Design file in the folder
- var _filename:String = cnode.attributes.data.name;
- var _filetype:String = cnode.attributes.data.resourceType;
- if(_filename == filename && _filetype == _workspaceModel.RT_LD){
- if(_workspaceModel.currentMode == Workspace.MODE_OPEN){
- treeview.selectedNode = null;
- _resultDTO.file = cnode;
- doWorkspaceDispatch(true);
- }
-
- return true;
- }
-
- cnode = cnode.nextSibling;
-
- } while(cnode != null);
-
- if(_workspaceModel.currentMode == Workspace.MODE_SAVE || _workspaceModel.currentMode == Workspace.MODE_SAVEAS){
- if(!_isParentNode)
- doWorkspaceDispatch(false);
- else
- doWorkspaceDispatch(false, snode)
- }
- return false;
-
- } else {
- // save filename value
- _resultDTO.resourceName = filename;
-
- // get folder contents
- var callback:Function = Proxy.create(this,receivedFolderContents);
- _workspaceModel.getWorkspace().requestFolderContents(snode.attributes.data.resourceID, callback);
-
- if(_workspaceModel.currentMode == Workspace.MODE_SAVE || _workspaceModel.currentMode == Workspace.MODE_SAVEAS){
- return false;
- } else {
- return true;
- }
- }
- }
-
-
- public function receivedFolderContents(dto:Object){
- _workspaceModel.setFolderContents(dto, false);
- _workspaceController = _workspaceView.getController();
- if(_workspaceModel.getWorkspaceResource('Folder_'+dto.workspaceFolderID)!=null){
- if(_workspaceModel.currentMode == Workspace.MODE_SAVE || _workspaceModel.currentMode == Workspace.MODE_SAVEAS){
- if(searchForFile(_workspaceModel.getWorkspaceResource('Folder_'+dto.workspaceFolderID), _resultDTO.resourceName)){
- //run a alert dialogue as user is using the same name as an existing design!
- LFMessage.showMessageAlert(Dictionary.getValue('ws_chk_overwrite_existing', [_resultDTO.resourceName]), null);
- _workspaceController.clearBusy()
- }
- } else {
- if(!searchForFile(_workspaceModel.getWorkspaceResource('Folder_'+dto.workspaceFolderID), _resultDTO.resourceName)){
- _workspaceController.clearBusy()
- }
- }
- }
- }
-
- /**
- * Check if the folder node against a resource ID
- *
- * @usage
- * @param snode
- * @param resourceID
- * @return
- */
- private function isVirtualFolder(folder:XMLNode){
- return folder.attributes.data.resourceID < 0;
- }
-
- /**
- * 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, snode:XMLNode){
- //ObjectUtils.printObject();
- var _snode = snode;
- if(_snode == null) {
- _snode = treeview.selectedNode; // item selected in tree
- }
-
- if(_snode == null){
- // set to file item found in search
- _snode = _resultDTO.file;
- }
-
- 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);
-
- }
-
- Debugger.log("SNode: " + _snode.attributes.data.name + ", Target WorkspceFolder ID: " + _resultDTO.targetWorkspaceFolderID + " , useResourceID: " + useResourceID + " , selectedResourceID: " + _resultDTO.selectedResourceID, Debugger.CRITICAL, "doWorkspaceDispatch", "WorkspaceDialog");
- _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});
- _workspaceController.clearBusy();
- }
-
- public function closeThisDialogue(){
- close();
- }
-
- /**
- * Called when the tabs are clicked
- * @usage
- * @param e
- * @return
- */
- private function switchTab(e){
- Debugger.log('Switch tab called!',Debugger.GEN,'switchTab','org.lamsfoundation.lams.common.ws.WorkspaceDialog');
- if(e.newIndex == 0){
- dispatchEvent({type:'locationTabClick',target:this});
- }else if(e.newIndex ==1){
- dispatchEvent({type:'propertiesTabClick',target:this});
- }
- }
-
- /**
- * Event dispatched by parent container when close button clicked
- */
- private function click(e:Object){
- close(e.target);
- }
-
- private function close(container:Object){
- // restore learningDesignID
- var ddm:DesignDataModel = Application.getInstance().getCanvas().ddm;
-
- if(ddm.prevLearningDesignID != null) {
- ddm.learningDesignID = ddm.prevLearningDesignID;
- ddm.prevLearningDesignID = null;
- }
-
- workspaceView.isOpen = false;
-
- //close parent window
- if(container != null) { container.deletePopUp(); }
- else { _container.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 0){
+ for(var i=0; i 0){
+
+ 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(){
+ _global.breakpoint();
+ _workspaceController = _workspaceView.getController();
+ _workspaceController.setBusy()
+
+ //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;
+
+ if(isVirtualFolder(snode)){
+ _workspaceController.clearBusy();
+ return;
+ }
+
+ Debugger.log('_workspaceModel.currentMode: ' + _workspaceModel.currentMode,Debugger.GEN,'ok','org.lamsfoundation.lams.WorkspaceDialog');
+ var tempTitle = StringUtils.replace(resourceTitle_txi.text, " ", "");
+ if(_workspaceModel.currentMode==Workspace.MODE_SAVE || _workspaceModel.currentMode==Workspace.MODE_SAVEAS){
+ if (tempTitle == "" || tempTitle == undefined){
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+
+ var sendMsg:String = Dictionary.getValue('ws_file_name_empty')+"\n"+Dictionary.getValue('ws_entre_file_name')+"\n\n";
+ LFMessage.showMessageAlert(sendMsg,null);
+ _workspaceController.clearBusy();
+ resourceTitle_txi.setFocus();
+ }else{
+ Cursor.showCursor(ApplicationParent.C_HOURGLASS);
+ saveFile(snode);
+ }
+ } else {
+ openFile(snode);
+ }
+ }
+
+ /**
+ * Open file from Workspace
+ *
+ * @param snode file to open or folder to open from
+ */
+
+ private function openFile(snode:XMLNode):Void{
+ Debugger.log('Opening a file.',Debugger.GEN,'openFile','org.lamsfoundation.lams.WorkspaceDialog');
+ _workspaceController = _workspaceView.getController();
+
+ if (snode.attributes.data.resourceType==_workspaceModel.RT_FOLDER){
+ if(resourceTitle_txi.text == null){
+ } else {
+ if(!searchForFile(snode, resourceTitle_txi.text)){
+ _workspaceController.clearBusy()
+ }
+ }
+ } else {
+ doWorkspaceDispatch(true);
+ }
+ }
+
+ /**
+ * Save file to Workspace
+ *
+ * @param snode folder to save to
+ */
+ private function saveFile(snode:XMLNode):Void{
+ Debugger.log('Saving a file.',Debugger.GEN,'saveFile','org.lamsfoundation.lams.WorkspaceDialog');
+ var snodeData = treeview.selectedNode.attributes.data;
+ var isWritable:Boolean = _workspaceModel.isWritableResource(snodeData.resourceType,snodeData.resourceID);
+ Debugger.log("isWritable: "+isWritable, Debugger.CRITICAL, "saveFile", "WorkspaceDialog");
+ _workspaceController = _workspaceView.getController();
+ if(snode == treeview.dataProvider.firstChild){
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_save_folder_invalid'),null);
+ } else if(snode.attributes.data.resourceType==_workspaceModel.RT_LD){
+ if(snode.parentNode != null) {
+ if(searchForFile(snode.parentNode, resourceTitle_txi.text, true)) {
+ if(isWritable) {
+ //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));
+ _workspaceController.clearBusy();
+ }
+ else // don't have permission, file is read-only
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null)
+ }
+ }
+ } else if(snode.attributes.data.resourceType==_workspaceModel.RT_FOLDER){
+ if(snode.attributes.data.resourceID < 0){
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_save_folder_invalid'),null);
+ _workspaceController.clearBusy();
+ } else if (!isWritable) {
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_no_permission'),null,null);
+ } else if(searchForFile(snode, resourceTitle_txi.text)){
+ //run a alert dialogue as user is using the same name as an existing design!
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_chk_overwrite_existing', [resourceTitle_txi.text]), null);
+ _workspaceController.clearBusy();
+ }
+ } else {
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_click_folder_file'),null);
+ _workspaceController.clearBusy();
+ }
+
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+ }
+
+ private function searchForFile(snode:XMLNode, filename:String, isParentNode:Boolean){
+
+ var _isParentNode:Boolean = isParentNode;
+
+ if(_isParentNode == null) {
+ _isParentNode = false;
+ }
+
+ Debugger.log('Searching for file (' + snode.childNodes.length + '): ' + filename,Debugger.GEN,'openFile','org.lamsfoundation.lams.WorkspaceDialog');
+ var cnode:XMLNode;
+
+ if(snode.hasChildNodes() || snode.attributes.isEmpty){
+
+ cnode = snode.firstChild;
+ do {
+ Debugger.log('matching file: ' + cnode.attributes.data.name + ' to: ' + filename,Debugger.GEN,'openFile','org.lamsfoundation.lams.WorkspaceDialog');
+
+ // look for matching Learning Design file in the folder
+ var _filename:String = cnode.attributes.data.name;
+ var _filetype:String = cnode.attributes.data.resourceType;
+ if(_filename == filename && _filetype == _workspaceModel.RT_LD){
+ if(_workspaceModel.currentMode == Workspace.MODE_OPEN){
+ treeview.selectedNode = null;
+ _resultDTO.file = cnode;
+ doWorkspaceDispatch(true);
+ }
+
+ return true;
+ }
+
+ cnode = cnode.nextSibling;
+
+ } while(cnode != null);
+
+ if(_workspaceModel.currentMode == Workspace.MODE_SAVE || _workspaceModel.currentMode == Workspace.MODE_SAVEAS){
+ if(!_isParentNode)
+ doWorkspaceDispatch(false);
+ else
+ doWorkspaceDispatch(false, snode)
+ }
+ return false;
+
+ } else {
+ // save filename value
+ _resultDTO.resourceName = filename;
+
+ // get folder contents
+ var callback:Function = Proxy.create(this,receivedFolderContents);
+ _workspaceModel.getWorkspace().requestFolderContents(snode.attributes.data.resourceID, callback);
+
+ if(_workspaceModel.currentMode == Workspace.MODE_SAVE || _workspaceModel.currentMode == Workspace.MODE_SAVEAS){
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+
+ public function receivedFolderContents(dto:Object){
+ _workspaceModel.setFolderContents(dto, false);
+ _workspaceController = _workspaceView.getController();
+ if(_workspaceModel.getWorkspaceResource('Folder_'+dto.workspaceFolderID)!=null){
+ if(_workspaceModel.currentMode == Workspace.MODE_SAVE || _workspaceModel.currentMode == Workspace.MODE_SAVEAS){
+ if(searchForFile(_workspaceModel.getWorkspaceResource('Folder_'+dto.workspaceFolderID), _resultDTO.resourceName)){
+ //run a alert dialogue as user is using the same name as an existing design!
+ LFMessage.showMessageAlert(Dictionary.getValue('ws_chk_overwrite_existing', [_resultDTO.resourceName]), null);
+ _workspaceController.clearBusy()
+ }
+ } else {
+ if(!searchForFile(_workspaceModel.getWorkspaceResource('Folder_'+dto.workspaceFolderID), _resultDTO.resourceName)){
+ _workspaceController.clearBusy()
+ }
+ }
+ }
+ }
+
+ /**
+ * Check if the folder node against a resource ID
+ *
+ * @usage
+ * @param snode
+ * @param resourceID
+ * @return
+ */
+ private function isVirtualFolder(folder:XMLNode){
+ return folder.attributes.data.resourceID < 0;
+ }
+
+ /**
+ * 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, snode:XMLNode){
+ //ObjectUtils.printObject();
+ var _snode = snode;
+ if(_snode == null) {
+ _snode = treeview.selectedNode; // item selected in tree
+ }
+
+ if(_snode == null){
+ // set to file item found in search
+ _snode = _resultDTO.file;
+ }
+
+ 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);
+
+ }
+
+ Debugger.log("SNode: " + _snode.attributes.data.name + ", Target WorkspceFolder ID: " + _resultDTO.targetWorkspaceFolderID + " , useResourceID: " + useResourceID + " , selectedResourceID: " + _resultDTO.selectedResourceID, Debugger.CRITICAL, "doWorkspaceDispatch", "WorkspaceDialog");
+ _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});
+ _workspaceController.clearBusy();
+ }
+
+ public function closeThisDialogue(){
+ close();
+ }
+
+ /**
+ * Called when the tabs are clicked
+ * @usage
+ * @param e
+ * @return
+ */
+ private function switchTab(e){
+ Debugger.log('Switch tab called!',Debugger.GEN,'switchTab','org.lamsfoundation.lams.common.ws.WorkspaceDialog');
+ if(e.newIndex == 0){
+ dispatchEvent({type:'locationTabClick',target:this});
+ }else if(e.newIndex ==1){
+ dispatchEvent({type:'propertiesTabClick',target:this});
+ }
+ }
+
+ /**
+ * Event dispatched by parent container when close button clicked
+ */
+ private function click(e:Object){
+ close(e.target);
+ }
+
+ private function close(container:Object){
+ // restore learningDesignID
+ var ddm:DesignDataModel = Application.getInstance().getCanvas().ddm;
+
+ if(ddm.prevLearningDesignID != null) {
+ ddm.learningDesignID = ddm.prevLearningDesignID;
+ ddm.prevLearningDesignID = null;
+ }
+
+ workspaceView.isOpen = false;
+
+ //close parent window
+ if(container != null) { container.deletePopUp(); }
+ else { _container.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
- * - creationDateTime = 2004-12-23T0:0:0+10:0
- description = Folder
- lastModifiedDateTime = 2004-12-23T0:0:0+10:0
- name = Mary Morgan Run Sequences Folder
- permissionCode = 3.0
- resourceID = 7.0
- resourceType = Folder
- or
- creationDateTime = 2006-1-24T9:42:14+10:0
- description = An example description
- lastModifiedDateTime = 2006-1-24T10:42:14+10:0
- name = LD Created:Tue Jan 24 10:42:14 GMT+1100 2006
- permissionCode = 3.0
- resourceID = 6.0
- resourceType = LearningDesign
- versionDetails
-
-
-
- * @usage
- * @param dto
- * @return
- */
- public function setFolderContents(dto:Object, openFolder:Boolean){
- var nodeToUpdate:XMLNode;
- Debugger.log('looking for:Folder_'+dto.workspaceFolderID+', parentWorkspaceFolderID:'+dto.parentWorkspaceFolderID,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
-
- if(getWorkspaceResource('Folder_'+dto.workspaceFolderID)!=null){
- nodeToUpdate = getWorkspaceResource('Folder_'+dto.workspaceFolderID);
- Debugger.log('nodeToUpdate.attributes.data.resourceID:'+nodeToUpdate.attributes.data.resourceID,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
- Debugger.log('nodeToUpdate.attributes.data.workspaceFolderID:'+nodeToUpdate.attributes.data.workspaceFolderID,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
- }else{
- Debugger.log('Did not find:'+dto.resourceType+'_'+dto.workspaceFolderID+' Something bad has happened',Debugger.CRITICAL,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
- }
-
- // do not populate folder if already contains contents
- if(nodeToUpdate.hasChildNodes()) {
- broadcastViewUpdate('UPDATE_CHILD_FOLDER_NOOPEN',nodeToUpdate);
- }
-
- // sort contents for content folders
- if(nodeToUpdate.attributes.data.resourceID >= 0) {
- dto.contents.sortOn("name", Array.CASEINSENSITIVE);
- nodeToUpdate.attributes.isBranch = true;
- }
-
- // set empty flag for folders
- if(dto.contents.length <= 0){
- nodeToUpdate.attributes.isEmpty = true;
- } else {
- nodeToUpdate.attributes.isEmpty = false;
- }
-
- // go through the contents of DTO and add it as children to the node to update.
- for(var i=0; i
+ * - creationDateTime = 2004-12-23T0:0:0+10:0
+ description = Folder
+ lastModifiedDateTime = 2004-12-23T0:0:0+10:0
+ name = Mary Morgan Run Sequences Folder
+ permissionCode = 3.0
+ resourceID = 7.0
+ resourceType = Folder
+ or
+ creationDateTime = 2006-1-24T9:42:14+10:0
+ description = An example description
+ lastModifiedDateTime = 2006-1-24T10:42:14+10:0
+ name = LD Created:Tue Jan 24 10:42:14 GMT+1100 2006
+ permissionCode = 3.0
+ resourceID = 6.0
+ resourceType = LearningDesign
+ versionDetails
+
+
+
+ * @usage
+ * @param dto
+ * @return
+ */
+ public function setFolderContents(dto:Object, openFolder:Boolean){
+ var nodeToUpdate:XMLNode;
+ Debugger.log('looking for:Folder_'+dto.workspaceFolderID+', parentWorkspaceFolderID:'+dto.parentWorkspaceFolderID,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
+
+ if(getWorkspaceResource('Folder_'+dto.workspaceFolderID)!=null){
+ nodeToUpdate = getWorkspaceResource('Folder_'+dto.workspaceFolderID);
+ Debugger.log('nodeToUpdate.attributes.data.resourceID:'+nodeToUpdate.attributes.data.resourceID,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
+ Debugger.log('nodeToUpdate.attributes.data.workspaceFolderID:'+nodeToUpdate.attributes.data.workspaceFolderID,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
+ }else{
+ Debugger.log('Did not find:'+dto.resourceType+'_'+dto.workspaceFolderID+' Something bad has happened',Debugger.CRITICAL,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
+ }
+
+ // do not populate folder if already contains contents
+ if(nodeToUpdate.hasChildNodes()) {
+ broadcastViewUpdate('UPDATE_CHILD_FOLDER_NOOPEN',nodeToUpdate);
+ }
+
+ // sort contents for content folders
+ if(nodeToUpdate.attributes.data.resourceID >= 0) {
+ dto.contents.sortOn("name", Array.CASEINSENSITIVE);
+ nodeToUpdate.attributes.isBranch = true;
+ }
+
+ // set empty flag for folders
+ if(dto.contents.length <= 0){
+ nodeToUpdate.attributes.isEmpty = true;
+ } else {
+ nodeToUpdate.attributes.isEmpty = false;
+ }
+
+ // go through the contents of DTO and add it as children to the node to update.
+ for(var i=0; i
- *
- * getAvailableLicenses
- * 3.0
- *
- * by-nc-sa
- *
- * 1.0
- * Attribution-Noncommercial-ShareAlike 2.5
- * http://localhost:8080/lams//images/license/byncsa.jpg
- * http://creativecommons.org/licenses/by-nc-sa/2.5/
- *
- * * @usage
- * @param newavailableLicenses
- * @return
- */
- public function setAvailableLicenses (newavailableLicenses:Array):Void {
- newavailableLicenses.sortOn('name');
- _availableLicenses = newavailableLicenses;
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function getAvailableLicenses ():Array {
- return _availableLicenses;
- }
-
- /**
- * Setter method for forced
- *
- * @param a
- */
-
- public function set forced(a:Boolean){
- _forced = a;
- }
-
- public function get forced():Boolean{
- return _forced;
- }
-
- /**
- *
- * @return true if folder forced to open
- */
-
- public function isForced():Boolean{
- return _forced;
- }
+ nodeExists = true;
+ }
+ }
+ }
+
+ if (!nodeExists) {
+ var cNode = nodeToUpdate.addTreeNode(dto.contents[i].name,dto.contents[i]);
+ //var cNode = nodeToUpdate.addTreeNode(dto.contents[i].name+':'+key,dto.contents[i]);
+ cNode.attributes.data.parentWorkspaceFolderID = dto.parentWorkspaceFolderID;
+ //workspaceFolderID should always be the ID of the folder this resource is contained in
+ cNode.attributes.data.workspaceFolderID = dto.workspaceFolderID;
+ //check if its a folder
+ if(dto.contents[i].resourceType==RT_FOLDER){
+ cNode.attributes.isBranch=true;
+
+ // **no longer force open Organisation virtual folder
+ // force open the Organisation virtual folder when opening My Workspace (root) virtual folder
+ // if(cNode.attributes.data.resourceID == ORG_VFOLDER && !cNode.hasChildNodes()){ openFolderInTree(cNode.attributes.data.resourceID, forced); }
+
+ }
+
+ Debugger.log('Adding new node to _workspaceResources ID :'+key,Debugger.GEN,'setFolderContents','org.lamsfoundation.lams.WorkspaceModel');
+ setWorkspaceResource(key,cNode);
+ }
+ }
+
+ //dispatch an update to the view
+ if(openFolder) { broadcastViewUpdate('UPDATE_CHILD_FOLDER',nodeToUpdate); }
+ else { broadcastViewUpdate('UPDATE_CHILD_FOLDER_NOOPEN',nodeToUpdate); }
+
+ Cursor.showCursor(ApplicationParent.C_DEFAULT);
+
+ }
+
+ /**
+ * Clears the store of workspace resources -
+ * TODO:prob could make more granular by passing in a folder ID to clear
+ * @usage
+ * @return
+ */
+ public function clearWorkspaceCache(folderIDPendingRefresh){
+
+ Debugger.log('removing children of:'+folderIDPendingRefresh,Debugger.GEN,'clearWorkspaceCache','org.lamsfoundation.lams.WorkspaceModel');
+
+ //get this node and clear its children
+ var nodeToUpdate:XMLNode;
+ var key:String = 'Folder_'+folderIDPendingRefresh;
+ var wspResource:XMLNode = getWorkspaceResource(key);
+ if(wspResource!=null){
+
+ if (wspResource.hasChildNodes()) {
+ var deleteQue:Array = new Array();
+ // mental. but true - you have to add them to an array and then delete them from the array,
+ // as deleting in the loop them will remove the reference from nextSibling
+ // also childNodes:Array not seem to work properly.
+ // use firstChild to iterate through the child nodes of wspResource
+ for (var aNode:XMLNode = wspResource.firstChild; aNode != null; aNode=aNode.nextSibling) {
+ deleteQue.push(aNode);
+ }
+
+ for(var i=0; i
+ *
+ * getAvailableLicenses
+ * 3.0
+ *
+ * by-nc-sa
+ *
+ * 1.0
+ * Attribution-Noncommercial-ShareAlike 2.5
+ * http://localhost:8080/lams//images/license/byncsa.jpg
+ * http://creativecommons.org/licenses/by-nc-sa/2.5/
+ *
+ * * @usage
+ * @param newavailableLicenses
+ * @return
+ */
+ public function setAvailableLicenses (newavailableLicenses:Array):Void {
+ newavailableLicenses.sortOn('name');
+ _availableLicenses = newavailableLicenses;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function getAvailableLicenses ():Array {
+ return _availableLicenses;
+ }
+
+ /**
+ * Setter method for forced
+ *
+ * @param a
+ */
+
+ public function set forced(a:Boolean){
+ _forced = a;
+ }
+
+ public function get forced():Boolean{
+ return _forced;
+ }
+
+ /**
+ *
+ * @return true if folder forced to open
+ */
+
+ public function isForced():Boolean{
+ return _forced;
+ }
}
Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceView.as
===================================================================
diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceView.as (.../WorkspaceView.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431)
+++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceView.as (.../WorkspaceView.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,185 +1,185 @@
-/***************************************************************************
- * 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
- * ************************************************************************
- */
-
+/***************************************************************************
+ * 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.ws.*
-import org.lamsfoundation.lams.common.mvc.*
-import org.lamsfoundation.lams.common.ui.*
-import org.lamsfoundation.lams.common.dict.*
-import org.lamsfoundation.lams.common.*
-import org.lamsfoundation.lams.wizard.*
-import mx.managers.*
-import mx.events.*
-import mx.utils.*
+import org.lamsfoundation.lams.common.mvc.*
+import org.lamsfoundation.lams.common.ui.*
+import org.lamsfoundation.lams.common.dict.*
+import org.lamsfoundation.lams.common.*
+import org.lamsfoundation.lams.wizard.*
+import mx.managers.*
+import mx.events.*
+import mx.utils.*
/**
-* Authoring view for the canvas
+* Authoring view for the canvas
* @author DI
*/
class org.lamsfoundation.lams.common.ws.WorkspaceView extends AbstractView {
//Canvas clip
- private var _workspace_mc:MovieClip;
- private var _workspaceDialog:MovieClip;
- private var _popup:MovieClip;
- private var okClickedCallback:Function;
- private var _workspaceController:WorkspaceController;
- private var dialog:MovieClip;
- private var cursorContainer:MovieClip;
-
- private var _isOpen:Boolean;
-
+ private var _workspace_mc:MovieClip;
+ private var _workspaceDialog:MovieClip;
+ private var _popup:MovieClip;
+ private var okClickedCallback:Function;
+ private var _workspaceController:WorkspaceController;
+ private var dialog:MovieClip;
+ private var cursorContainer:MovieClip;
+
+ private var _isOpen:Boolean;
+
/*
* Constructor
*/
public function WorkspaceView (m:Observable, c:Controller){
// Invoke superconstructor, which sets up MVC relationships.
// This view has no user inputs, so no controller is required.
- super (m, c);
- //register to recive updates form the model
+ super (m, c);
+ //register to recive updates form the model
WorkspaceModel(m).addEventListener('viewUpdate',this);
}
-
- /**
- * 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','WorkspaceView');
- //Update view from info object
- var wm:WorkspaceModel = event.target;
-
- //set a ref to the controller for ease (sorry mvc guru)
- _workspaceController = getController();
- switch (event.updateType){
- case 'CREATE_DIALOG' :
- createWorkspaceDialog(event.data.pos,event.data.tabToSelect);
- break;
- case 'CREATE_TREE' :
- createWorkspaceWizard();
- break;
- default :
- Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.WorkspaceView');
- }
-
- }
-
- /**
- * Create a popup dialog containing workspace
- * @param pos - Position, either 'centre' or an object containing x + y coordinates
- * @param callback - The function to call and pass the selectedID to
- */
- public function createWorkspaceDialog(pos:Object){
-
- var m:WorkspaceModel = WorkspaceModel(getModel());
- var mode:String = m.currentMode
- var classRoot:MovieClip;
-
- if(mode == Workspace.MODE_READONLY){
- classRoot = org.lamsfoundation.lams.monitoring.Application.root;
- } else {
- classRoot = org.lamsfoundation.lams.authoring.Application.root;
- }
-
- //Check to see whether this should be a centered or positioned dialog
- if(typeof(pos)=='string'){
- dialog = PopUpManager.createPopUp(classRoot, LFWindow, true,{title:Dictionary.getValue('ws_dlg_title'),closeButton:true,scrollContentPath:'workspaceDialog'});
- } else {
- dialog = PopUpManager.createPopUp(classRoot, LFWindow, true,{title:Dictionary.getValue('ws_dlg_title'),closeButton:true,scrollContentPath:'workspaceDialog',_x:pos.x,_y:pos.y});
- }
-
- Debugger.log('_workspaceController:'+_workspaceController,4,'createWorkspaceDialogOpen','WorkspaceView');
- cursorContainer = dialog.createEmptyMovieClip('_cursorContainer_mc', dialog.getNextHighestDepth());
-
- //Assign dialog load handler
- dialog.addEventListener('contentLoaded',Delegate.create(_workspaceController,_workspaceController.openDialogLoaded));
- isOpen = true;
- }
-
- /**
- * Create workspace in wizard
- */
- public function createWorkspaceWizard(){
- var m:WorkspaceModel = WorkspaceModel(getModel());
- var wizard:Wizard = org.lamsfoundation.lams.wizard.Application.getInstance().getWizard();
- wizard.getWV().workspaceView = this;
- wizard.initWorkspace();
- }
-
- /**
- *
- * @usage
- * @param newworkspaceDialog
- * @return
- */
- public function set workspaceDialog (newworkspaceDialog:MovieClip):Void {
- dialog = newworkspaceDialog;
- }
-
- /**
- *
- * @usage
- * @return
- */
- public function get workspaceDialog():MovieClip {
- return dialog;
- }
-
- public function get isOpen():Boolean {
- return _isOpen;
- }
-
- public function set isOpen(a:Boolean):Void {
- _isOpen = a;
- }
-
- public function get workspaceCursor():MovieClip {
- return cursorContainer;
- }
-
- public function clearDialog():Void {
- dialog.deletePopUp();
- isOpen = false;
- }
-
- /**
- * Overrides method in abstract view to ensure cortect type of controller is returned
- * @usage
- * @return CanvasController
- */
- public function getController():WorkspaceController{
- trace('getController in wsv');
- var c:Controller = super.getController();
- return WorkspaceController(c);
- }
-
- /**
- * Returns the default controller for this view .
- * Overrides AbstractView.defaultController()
- */
- public function defaultController (model:Observable):Controller {
- trace('default controller in wsv');
- return new WorkspaceController(model);
- }
-
+
+ /**
+ * 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','WorkspaceView');
+ //Update view from info object
+ var wm:WorkspaceModel = event.target;
+
+ //set a ref to the controller for ease (sorry mvc guru)
+ _workspaceController = getController();
+ switch (event.updateType){
+ case 'CREATE_DIALOG' :
+ createWorkspaceDialog(event.data.pos,event.data.tabToSelect);
+ break;
+ case 'CREATE_TREE' :
+ createWorkspaceWizard();
+ break;
+ default :
+ Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.WorkspaceView');
+ }
+
+ }
+
+ /**
+ * Create a popup dialog containing workspace
+ * @param pos - Position, either 'centre' or an object containing x + y coordinates
+ * @param callback - The function to call and pass the selectedID to
+ */
+ public function createWorkspaceDialog(pos:Object){
+
+ var m:WorkspaceModel = WorkspaceModel(getModel());
+ var mode:String = m.currentMode
+ var classRoot:MovieClip;
+
+ if(mode == Workspace.MODE_READONLY){
+ classRoot = org.lamsfoundation.lams.monitoring.Application.root;
+ } else {
+ classRoot = org.lamsfoundation.lams.authoring.Application.root;
+ }
+
+ //Check to see whether this should be a centered or positioned dialog
+ if(typeof(pos)=='string'){
+ dialog = PopUpManager.createPopUp(classRoot, LFWindow, true,{title:Dictionary.getValue('ws_dlg_title'),closeButton:true,scrollContentPath:'workspaceDialog'});
+ } else {
+ dialog = PopUpManager.createPopUp(classRoot, LFWindow, true,{title:Dictionary.getValue('ws_dlg_title'),closeButton:true,scrollContentPath:'workspaceDialog',_x:pos.x,_y:pos.y});
+ }
+
+ Debugger.log('_workspaceController:'+_workspaceController,4,'createWorkspaceDialogOpen','WorkspaceView');
+ cursorContainer = dialog.createEmptyMovieClip('_cursorContainer_mc', dialog.getNextHighestDepth());
+
+ //Assign dialog load handler
+ dialog.addEventListener('contentLoaded',Delegate.create(_workspaceController,_workspaceController.openDialogLoaded));
+ isOpen = true;
+ }
+
+ /**
+ * Create workspace in wizard
+ */
+ public function createWorkspaceWizard(){
+ var m:WorkspaceModel = WorkspaceModel(getModel());
+ var wizard:Wizard = org.lamsfoundation.lams.wizard.Application.getInstance().getWizard();
+ wizard.getWV().workspaceView = this;
+ wizard.initWorkspace();
+ }
+
+ /**
+ *
+ * @usage
+ * @param newworkspaceDialog
+ * @return
+ */
+ public function set workspaceDialog (newworkspaceDialog:MovieClip):Void {
+ dialog = newworkspaceDialog;
+ }
+
+ /**
+ *
+ * @usage
+ * @return
+ */
+ public function get workspaceDialog():MovieClip {
+ return dialog;
+ }
+
+ public function get isOpen():Boolean {
+ return _isOpen;
+ }
+
+ public function set isOpen(a:Boolean):Void {
+ _isOpen = a;
+ }
+
+ public function get workspaceCursor():MovieClip {
+ return cursorContainer;
+ }
+
+ public function clearDialog():Void {
+ dialog.deletePopUp();
+ isOpen = false;
+ }
+
+ /**
+ * Overrides method in abstract view to ensure cortect type of controller is returned
+ * @usage
+ * @return CanvasController
+ */
+ public function getController():WorkspaceController{
+ trace('getController in wsv');
+ var c:Controller = super.getController();
+ return WorkspaceController(c);
+ }
+
+ /**
+ * Returns the default controller for this view .
+ * Overrides AbstractView.defaultController()
+ */
+ public function defaultController (model:Observable):Controller {
+ trace('default controller in wsv');
+ return new WorkspaceController(model);
+ }
+
}
Index: lams_flash/src/common/flash/org/springsoft/aslib/BinaryTree.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/BinaryTree.as (.../BinaryTree.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/BinaryTree.as (.../BinaryTree.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,331 +1,331 @@
-/*
-
-BinaryTree is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Binary Tree
-=====================================================================
-*/
-
-import org.springsoft.aslib.BinaryTreeObject;
-import org.springsoft.aslib.TreeNode;
-import org.springsoft.aslib.ObjectTreeNode;
-
-// BinaryTree Class
-class org.springsoft.aslib.BinaryTree
-{
- // Tree root
- private var treeRoot_:TreeNode;
-
- /**
- * BinaryTree Constructor
- */
- function BinaryTree()
- {
- treeRoot_ = null;
- }
-
- /**
- * Iterative insert
- *
- * @param data The data to insert into the tree
- */
- public function insertIter(data:BinaryTreeObject):Void
- {
- var runner:TreeNode = treeRoot_;
- var node:ObjectTreeNode = new ObjectTreeNode(data);
-
- if(isEmpty()) {
- treeRoot_ = node;
- return;
- }
-
- while(true) {
- if(node.getKey() == runner.getKey()) {
- return;
- }
- else if(node.getKey() < runner.getKey()) {
-
- if(runner.getLeft() == null ) {
- runner.setLeft(node);
- return;
- }
- else
- runner = runner.getLeft();
- }
- else if(node.getKey() > runner.getKey()){
- if(runner.getRight() == null ) {
-
- runner.setRight(node);
- return;
- }
- else
- runner = runner.getRight();
- }
- }
- }
-
- /**
- * Recursive insert
- *
- * @param data The data to insert into the tree
- */
- public function insert(data:BinaryTreeObject):Void
- {
- if(isEmpty()) {
- treeRoot_ = new ObjectTreeNode(data);
- return;
- }
- insertHelper(new ObjectTreeNode(data), treeRoot_);
- }
-
- /**
- * Search the binary tree for a key
- *
- * @param key The key to search for in the tree
- * @returns BinaryTreeObject if key was found. Otherwise returns null.
- */
- public function search(key:Number):BinaryTreeObject
- {
- if(isEmpty()) {
- return null;
- }
-
- return searchHelper(treeRoot_, key);
- }
-
- /**
- * Print tree PreOrder
- *
- * @param tree Any tree node starting at the root
- */
- public function printPreOrder(Void):Void
- {
- printPreOrderHelper(treeRoot_);
- }
-
- /**
- * Print tree PostOrder
- *
- * @param tree Any tree node starting at the root
- */
- public function printPostOrder(Void):Void
- {
- printPostOrderHelper(treeRoot_);
- }
-
- /**
- * Print tree InOrder
- *
- * @param tree Any tree node starting at the root
- */
- public function printInOrder(Void):Void
- {
- printInOrderHelper(treeRoot_);
- }
-
- /**
- * Remove node
- *
- * @param key The key to search for and to remove it from the tree
- */
- public function remove(key:Number):Void
- {
- var tmpNode:TreeNode = null;
-
- // Test if we remove root node
- if(key == treeRoot_.getKey()) {
- if(isEmpty() && treeRoot_.isLeave()) {
- treeRoot_ = null;
- }
- else if(null == treeRoot_.getLeft()) {
- tmpNode = treeRoot_;
- treeRoot_ = treeRoot_.getRight();
- tmpNode = null;
- }
- else if(null == treeRoot_.getRight()) {
- tmpNode = treeRoot_;
- treeRoot_ = treeRoot_.getLeft();
- tmpNode = null;
- }
- else {
- tmpNode = treeRoot_.getLeft();
- while(tmpNode.getRight()) {
- tmpNode = tmpNode.getRight();
- }
- tmpNode.setRight(treeRoot_.getRight());
- tmpNode = treeRoot_;
- treeRoot_ = treeRoot_.getLeft();
- tmpNode.setLeft(null);
- tmpNode.setRight(null);
- tmpNode = null;
- }
- }
- else {
- removeHelper(key, treeRoot_);
- }
- }
-
- /**
- * Test if tree is empty
- *
- * @returns true if tree is empty. Otherwise returns false.
- */
- private function isEmpty(Void):Boolean
- {
- return (null == treeRoot_) ? true : false;
- }
-
- /**
- * Helper Print tree PreOrder
- *
- * @param tree Any tree node starting at the root
- */
- private function printPreOrderHelper(tree:TreeNode):Void
- {
- if(null != tree) {
- trace(tree.toString());
- printPreOrderHelper(tree.getLeft());
- printPreOrderHelper(tree.getRight());
- }
- }
-
- /**
- * Helper Print tree InOrder
- *
- * @param tree Any tree node starting at the root
- */
- private function printInOrderHelper(tree:TreeNode):Void
- {
- if(null != tree) {
- printInOrderHelper(tree.getLeft());
- trace(tree.toString());
- printInOrderHelper(tree.getRight());
- }
- }
-
- /**
- * Helper recursive insert
- *
- * @param node The data to insert into the tree
- * @param tree Any tree node starting at the root
- */
- private function insertHelper(node:TreeNode, tree:TreeNode):Void
- {
- if(node.getKey() < tree.getKey()) {
- if(tree.getLeft() == null) {
- tree.setLeft(node);
- }
- else {
- insertHelper(node, tree.getLeft());
- }
- }
- else if(node.getKey() > tree.getKey()) {
- if(tree.getRight() == null) {
- tree.setRight(node);
- }
- else {
- insertHelper(node, tree.getRight());
- }
- }
- }
-
- /**
- * Helper search binary tree
- *
- * @param tree Any tree node starting at the root
- * @param key The key to search for in the tree
- * @returns BinaryTreeObject if key was found. Otherwise returns null.
- */
- private function searchHelper(tree:TreeNode, key:Number):BinaryTreeObject
- {
- if(key == tree.getKey()) {
- return tree.get();
- }
- else if(key < tree.getKey()) {
- return searchHelper(tree.getLeft(), key);
- }
- else if(key > tree.getKey()) {
- return searchHelper(tree.getRight(), key);
- }
- }
-
- /**
- * Helper Print tree PostOrder
- *
- * @param tree Any tree node starting at the root
- */
- private function printPostOrderHelper(tree:TreeNode):Void
- {
- if(null != tree) {
- printPostOrderHelper(tree.getLeft());
- printPostOrderHelper(tree.getRight());
- trace(tree.toString());
- }
- }
-
- /**
- * Helper remove node
- *
- * @param key The key to search for and to remove in the tree
- * @param tree Any tree node starting at the root
- */
- private function removeHelper(key:Number, tree:TreeNode):TreeNode
- {
- var tmpNode:TreeNode = null;
- var findNode:TreeNode = null;
-
- if(null == tree) {
- return null;
- }
-
- if(key == tree.getKey()) {
- tmpNode = tree.getLeft();
- if(!tree.getLeft()) {
- tmpNode = tree.getRight();
- }
- else if(tree.getRight()) {
- findNode = tree.getLeft();
- while(findNode.getRight()) {
- findNode = findNode.getRight();
- }
- findNode.setRight(tree.getRight());
- }
- return tmpNode;
- }
- else if(key < tree.getKey()) {
- tree.setLeft(removeHelper(key, tree.getLeft()));
- }
- else {
- tree.setRight(removeHelper(key, tree.getRight()));
- }
- return tree;
- }
-}
-
+/*
+
+BinaryTree is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Binary Tree
+=====================================================================
+*/
+
+import org.springsoft.aslib.BinaryTreeObject;
+import org.springsoft.aslib.TreeNode;
+import org.springsoft.aslib.ObjectTreeNode;
+
+// BinaryTree Class
+class org.springsoft.aslib.BinaryTree
+{
+ // Tree root
+ private var treeRoot_:TreeNode;
+
+ /**
+ * BinaryTree Constructor
+ */
+ function BinaryTree()
+ {
+ treeRoot_ = null;
+ }
+
+ /**
+ * Iterative insert
+ *
+ * @param data The data to insert into the tree
+ */
+ public function insertIter(data:BinaryTreeObject):Void
+ {
+ var runner:TreeNode = treeRoot_;
+ var node:ObjectTreeNode = new ObjectTreeNode(data);
+
+ if(isEmpty()) {
+ treeRoot_ = node;
+ return;
+ }
+
+ while(true) {
+ if(node.getKey() == runner.getKey()) {
+ return;
+ }
+ else if(node.getKey() < runner.getKey()) {
+
+ if(runner.getLeft() == null ) {
+ runner.setLeft(node);
+ return;
+ }
+ else
+ runner = runner.getLeft();
+ }
+ else if(node.getKey() > runner.getKey()){
+ if(runner.getRight() == null ) {
+
+ runner.setRight(node);
+ return;
+ }
+ else
+ runner = runner.getRight();
+ }
+ }
+ }
+
+ /**
+ * Recursive insert
+ *
+ * @param data The data to insert into the tree
+ */
+ public function insert(data:BinaryTreeObject):Void
+ {
+ if(isEmpty()) {
+ treeRoot_ = new ObjectTreeNode(data);
+ return;
+ }
+ insertHelper(new ObjectTreeNode(data), treeRoot_);
+ }
+
+ /**
+ * Search the binary tree for a key
+ *
+ * @param key The key to search for in the tree
+ * @returns BinaryTreeObject if key was found. Otherwise returns null.
+ */
+ public function search(key:Number):BinaryTreeObject
+ {
+ if(isEmpty()) {
+ return null;
+ }
+
+ return searchHelper(treeRoot_, key);
+ }
+
+ /**
+ * Print tree PreOrder
+ *
+ * @param tree Any tree node starting at the root
+ */
+ public function printPreOrder(Void):Void
+ {
+ printPreOrderHelper(treeRoot_);
+ }
+
+ /**
+ * Print tree PostOrder
+ *
+ * @param tree Any tree node starting at the root
+ */
+ public function printPostOrder(Void):Void
+ {
+ printPostOrderHelper(treeRoot_);
+ }
+
+ /**
+ * Print tree InOrder
+ *
+ * @param tree Any tree node starting at the root
+ */
+ public function printInOrder(Void):Void
+ {
+ printInOrderHelper(treeRoot_);
+ }
+
+ /**
+ * Remove node
+ *
+ * @param key The key to search for and to remove it from the tree
+ */
+ public function remove(key:Number):Void
+ {
+ var tmpNode:TreeNode = null;
+
+ // Test if we remove root node
+ if(key == treeRoot_.getKey()) {
+ if(isEmpty() && treeRoot_.isLeave()) {
+ treeRoot_ = null;
+ }
+ else if(null == treeRoot_.getLeft()) {
+ tmpNode = treeRoot_;
+ treeRoot_ = treeRoot_.getRight();
+ tmpNode = null;
+ }
+ else if(null == treeRoot_.getRight()) {
+ tmpNode = treeRoot_;
+ treeRoot_ = treeRoot_.getLeft();
+ tmpNode = null;
+ }
+ else {
+ tmpNode = treeRoot_.getLeft();
+ while(tmpNode.getRight()) {
+ tmpNode = tmpNode.getRight();
+ }
+ tmpNode.setRight(treeRoot_.getRight());
+ tmpNode = treeRoot_;
+ treeRoot_ = treeRoot_.getLeft();
+ tmpNode.setLeft(null);
+ tmpNode.setRight(null);
+ tmpNode = null;
+ }
+ }
+ else {
+ removeHelper(key, treeRoot_);
+ }
+ }
+
+ /**
+ * Test if tree is empty
+ *
+ * @returns true if tree is empty. Otherwise returns false.
+ */
+ private function isEmpty(Void):Boolean
+ {
+ return (null == treeRoot_) ? true : false;
+ }
+
+ /**
+ * Helper Print tree PreOrder
+ *
+ * @param tree Any tree node starting at the root
+ */
+ private function printPreOrderHelper(tree:TreeNode):Void
+ {
+ if(null != tree) {
+ trace(tree.toString());
+ printPreOrderHelper(tree.getLeft());
+ printPreOrderHelper(tree.getRight());
+ }
+ }
+
+ /**
+ * Helper Print tree InOrder
+ *
+ * @param tree Any tree node starting at the root
+ */
+ private function printInOrderHelper(tree:TreeNode):Void
+ {
+ if(null != tree) {
+ printInOrderHelper(tree.getLeft());
+ trace(tree.toString());
+ printInOrderHelper(tree.getRight());
+ }
+ }
+
+ /**
+ * Helper recursive insert
+ *
+ * @param node The data to insert into the tree
+ * @param tree Any tree node starting at the root
+ */
+ private function insertHelper(node:TreeNode, tree:TreeNode):Void
+ {
+ if(node.getKey() < tree.getKey()) {
+ if(tree.getLeft() == null) {
+ tree.setLeft(node);
+ }
+ else {
+ insertHelper(node, tree.getLeft());
+ }
+ }
+ else if(node.getKey() > tree.getKey()) {
+ if(tree.getRight() == null) {
+ tree.setRight(node);
+ }
+ else {
+ insertHelper(node, tree.getRight());
+ }
+ }
+ }
+
+ /**
+ * Helper search binary tree
+ *
+ * @param tree Any tree node starting at the root
+ * @param key The key to search for in the tree
+ * @returns BinaryTreeObject if key was found. Otherwise returns null.
+ */
+ private function searchHelper(tree:TreeNode, key:Number):BinaryTreeObject
+ {
+ if(key == tree.getKey()) {
+ return tree.get();
+ }
+ else if(key < tree.getKey()) {
+ return searchHelper(tree.getLeft(), key);
+ }
+ else if(key > tree.getKey()) {
+ return searchHelper(tree.getRight(), key);
+ }
+ }
+
+ /**
+ * Helper Print tree PostOrder
+ *
+ * @param tree Any tree node starting at the root
+ */
+ private function printPostOrderHelper(tree:TreeNode):Void
+ {
+ if(null != tree) {
+ printPostOrderHelper(tree.getLeft());
+ printPostOrderHelper(tree.getRight());
+ trace(tree.toString());
+ }
+ }
+
+ /**
+ * Helper remove node
+ *
+ * @param key The key to search for and to remove in the tree
+ * @param tree Any tree node starting at the root
+ */
+ private function removeHelper(key:Number, tree:TreeNode):TreeNode
+ {
+ var tmpNode:TreeNode = null;
+ var findNode:TreeNode = null;
+
+ if(null == tree) {
+ return null;
+ }
+
+ if(key == tree.getKey()) {
+ tmpNode = tree.getLeft();
+ if(!tree.getLeft()) {
+ tmpNode = tree.getRight();
+ }
+ else if(tree.getRight()) {
+ findNode = tree.getLeft();
+ while(findNode.getRight()) {
+ findNode = findNode.getRight();
+ }
+ findNode.setRight(tree.getRight());
+ }
+ return tmpNode;
+ }
+ else if(key < tree.getKey()) {
+ tree.setLeft(removeHelper(key, tree.getLeft()));
+ }
+ else {
+ tree.setRight(removeHelper(key, tree.getRight()));
+ }
+ return tree;
+ }
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/BinaryTreeObject.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/BinaryTreeObject.as (.../BinaryTreeObject.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/BinaryTreeObject.as (.../BinaryTreeObject.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,52 +1,52 @@
-/*
-
-BinaryTreeObject is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- BinaryTreeObject Interface
-=====================================================================
-*/
-
-interface org.springsoft.aslib.BinaryTreeObject
-{
- /**
- * Get key
- *
- * @returns object key
- */
- public function getKey(Void):Number;
-
- /**
- * Data string representation
- *
- * @returns object string representation
- */
- public function toString(Void):String;
-}
-
+/*
+
+BinaryTreeObject is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ BinaryTreeObject Interface
+=====================================================================
+*/
+
+interface org.springsoft.aslib.BinaryTreeObject
+{
+ /**
+ * Get key
+ *
+ * @returns object key
+ */
+ public function getKey(Void):Number;
+
+ /**
+ * Data string representation
+ *
+ * @returns object string representation
+ */
+ public function toString(Void):String;
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/Debug.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/Debug.as (.../Debug.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/Debug.as (.../Debug.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,69 +1,69 @@
-/*
-
-Debug is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Provides output debugging method
-=====================================================================
-*/
-
-class org.springsoft.aslib.Debug
-{
- // Static member to indicate if debugging features are turned on or off
- private static var isActive_:Boolean = false;
-
- /**
- * Trace method prints a debugging message
- *
- * @param msg String holding the message
- */
- static function trace(msg:String):Void
- {
- if(isActive_) {
- trace("DEBUG: " + msg);
- }
- }
-
- /**
- * Turn on debugging features
- */
- static function turnOn(Void):Void
- {
- isActive_ = true;
- }
-
- /**
- * Turn off debugging features
- */
- static function turnOff(Void):Void
- {
- isActive_ = false;
- }
-}
-
+/*
+
+Debug is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Provides output debugging method
+=====================================================================
+*/
+
+class org.springsoft.aslib.Debug
+{
+ // Static member to indicate if debugging features are turned on or off
+ private static var isActive_:Boolean = false;
+
+ /**
+ * Trace method prints a debugging message
+ *
+ * @param msg String holding the message
+ */
+ static function trace(msg:String):Void
+ {
+ if(isActive_) {
+ trace("DEBUG: " + msg);
+ }
+ }
+
+ /**
+ * Turn on debugging features
+ */
+ static function turnOn(Void):Void
+ {
+ isActive_ = true;
+ }
+
+ /**
+ * Turn off debugging features
+ */
+ static function turnOff(Void):Void
+ {
+ isActive_ = false;
+ }
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/HashTable.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/HashTable.as (.../HashTable.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/HashTable.as (.../HashTable.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,153 +1,153 @@
-/*
-
-HashTable is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- HashTable class
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedList;
-import org.springsoft.aslib.HashTableObject;
-
-class org.springsoft.aslib.HashTable
-{
- // HashTable array default size
- private var size_:Number = 50;
-
- // Array of SingleLinkedLists
- private var hashTable_:Array;
-
- // Keep tarck of HashTable's size
- private var numItems_:Number = 0;
-
- /**
- * HashTable Constructor
- *
- * @param size The HashTable array size
- */
- function HashTable(size:Number)
- {
- size_ = size;
-
- // Create the array of single linked lists
- hashTable_ = new Array(size_);
-
- for(var i = 0; i < size; i++) {
- hashTable_[i] = new SingleLinkedList();
- }
- }
-
- /**
- * Put item in HashTable
- *
- * @param key Hash key
- * @param data Data object
- */
- public function put(key:Number, data:HashTableObject):Void
- {
- var index:Number = key % size_;
- hashTable_[index].insert(data);
- numItems_++;
- }
-
- /**
- * Get an item from the HashTable
- *
- * @param key The hash key
- * @returns data object
- */
- public function get(key:Number):HashTableObject
- {
- var index:Number = key % size_;
- // Access SLL and get the node via the SLL's get method.
- // Then we call get on the node to extract the data object.
- return HashTableObject(hashTable_[index].get(key).get());
- }
-
- /**
- * Remove an item from the HashTable
- *
- * @param key The hash key
- */
- public function remove(key:Number):Void
- {
- var index:Number = key % size_;
- hashTable_[index].remove(key);
- numItems_--;
- }
-
- /**
- * Remove all items from the HashTable
- */
- public function removeAll(Void):Void
- {
- for(var i = 0; i < size_; i++) {
- hashTable_[i].removeAll();
- }
- numItems_ = 0;
- }
-
- /**
- * Get the size of the HashTable
- *
- * @returns size of HashTable
- */
- public function size(Void):Number
- {
- return numItems_;
- }
-
- /**
- * Check if the HashTable is empty
- *
- * @returns true if HashTable is empty. Otherwise returns false.
- */
- public function isEmpty(Void):Boolean
- {
- return (0 < numItems_) ? false : true;
- }
-
- /**
- * Print HashTable
- */
- public function print(Void):Void
- {
- if(isEmpty()) {
- trace("HastTable is empty!");
- }
-
- for(var i:Number = 0; i < hashTable_.length; i++) {
- if(!hashTable_[i].isEmpty()) {
- trace("HashTable[" + i + "]:");
- hashTable_[i].print();
- }
- }
- }
-}
+/*
+
+HashTable is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ HashTable class
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedList;
+import org.springsoft.aslib.HashTableObject;
+
+class org.springsoft.aslib.HashTable
+{
+ // HashTable array default size
+ private var size_:Number = 50;
+
+ // Array of SingleLinkedLists
+ private var hashTable_:Array;
+
+ // Keep tarck of HashTable's size
+ private var numItems_:Number = 0;
+
+ /**
+ * HashTable Constructor
+ *
+ * @param size The HashTable array size
+ */
+ function HashTable(size:Number)
+ {
+ size_ = size;
+
+ // Create the array of single linked lists
+ hashTable_ = new Array(size_);
+
+ for(var i = 0; i < size; i++) {
+ hashTable_[i] = new SingleLinkedList();
+ }
+ }
+
+ /**
+ * Put item in HashTable
+ *
+ * @param key Hash key
+ * @param data Data object
+ */
+ public function put(key:Number, data:HashTableObject):Void
+ {
+ var index:Number = key % size_;
+ hashTable_[index].insert(data);
+ numItems_++;
+ }
+
+ /**
+ * Get an item from the HashTable
+ *
+ * @param key The hash key
+ * @returns data object
+ */
+ public function get(key:Number):HashTableObject
+ {
+ var index:Number = key % size_;
+ // Access SLL and get the node via the SLL's get method.
+ // Then we call get on the node to extract the data object.
+ return HashTableObject(hashTable_[index].get(key).get());
+ }
+
+ /**
+ * Remove an item from the HashTable
+ *
+ * @param key The hash key
+ */
+ public function remove(key:Number):Void
+ {
+ var index:Number = key % size_;
+ hashTable_[index].remove(key);
+ numItems_--;
+ }
+
+ /**
+ * Remove all items from the HashTable
+ */
+ public function removeAll(Void):Void
+ {
+ for(var i = 0; i < size_; i++) {
+ hashTable_[i].removeAll();
+ }
+ numItems_ = 0;
+ }
+
+ /**
+ * Get the size of the HashTable
+ *
+ * @returns size of HashTable
+ */
+ public function size(Void):Number
+ {
+ return numItems_;
+ }
+
+ /**
+ * Check if the HashTable is empty
+ *
+ * @returns true if HashTable is empty. Otherwise returns false.
+ */
+ public function isEmpty(Void):Boolean
+ {
+ return (0 < numItems_) ? false : true;
+ }
+
+ /**
+ * Print HashTable
+ */
+ public function print(Void):Void
+ {
+ if(isEmpty()) {
+ trace("HastTable is empty!");
+ }
+
+ for(var i:Number = 0; i < hashTable_.length; i++) {
+ if(!hashTable_[i].isEmpty()) {
+ trace("HashTable[" + i + "]:");
+ hashTable_[i].print();
+ }
+ }
+ }
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/HashTableObject.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/HashTableObject.as (.../HashTableObject.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/HashTableObject.as (.../HashTableObject.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,40 +1,40 @@
-/*
-
-HashTableObject is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- HashTableObject Interface
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedListObject;
-
-interface org.springsoft.aslib.HashTableObject extends SingleLinkedListObject
-{
-}
+/*
+
+HashTableObject is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ HashTableObject Interface
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedListObject;
+
+interface org.springsoft.aslib.HashTableObject extends SingleLinkedListObject
+{
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/ListNode.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/ListNode.as (.../ListNode.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/ListNode.as (.../ListNode.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,82 +1,82 @@
-/*
-
-ListNode is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- ListNode interface used with single linked list class
-=====================================================================
-*/
-
-
-import org.springsoft.aslib.SingleLinkedListObject;
-
-interface org.springsoft.aslib.ListNode
-{
- /**
- * Set ListNode data
- *
- * @param data Object data
- */
- public function set(data:SingleLinkedListObject):Void;
-
- /**
- * Get ListNode data
- *
- * @returns object data
- */
- public function get(Void):SingleLinkedListObject;
-
- /**
- * Set next ListNode
- *
- * @param node Node to be linked by the next reference
- */
- public function setNext(node:ListNode):Void;
-
- /**
- * Get next ListNode
- *
- * @returns the next list node
- */
- public function getNext(Void):ListNode;
-
- /**
- * ListNode string representation
- *
- * @returns the list node's string representation
- */
- public function toString(Void):String;
-
- /**
- * Return ListNode key
- *
- * @returns the list node's key
- */
- public function getKey(Void):Number;
-}
+/*
+
+ListNode is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ ListNode interface used with single linked list class
+=====================================================================
+*/
+
+
+import org.springsoft.aslib.SingleLinkedListObject;
+
+interface org.springsoft.aslib.ListNode
+{
+ /**
+ * Set ListNode data
+ *
+ * @param data Object data
+ */
+ public function set(data:SingleLinkedListObject):Void;
+
+ /**
+ * Get ListNode data
+ *
+ * @returns object data
+ */
+ public function get(Void):SingleLinkedListObject;
+
+ /**
+ * Set next ListNode
+ *
+ * @param node Node to be linked by the next reference
+ */
+ public function setNext(node:ListNode):Void;
+
+ /**
+ * Get next ListNode
+ *
+ * @returns the next list node
+ */
+ public function getNext(Void):ListNode;
+
+ /**
+ * ListNode string representation
+ *
+ * @returns the list node's string representation
+ */
+ public function toString(Void):String;
+
+ /**
+ * Return ListNode key
+ *
+ * @returns the list node's key
+ */
+ public function getKey(Void):Number;
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/ObjectListNode.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/ObjectListNode.as (.../ObjectListNode.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/ObjectListNode.as (.../ObjectListNode.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,118 +1,118 @@
-/*
-
-ObjectListNode is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Object Node is an implementation of the Node class.
- Used for stack class.
-=====================================================================
-*/
-
-import org.springsoft.aslib.ListNode;
-import org.springsoft.aslib.SingleLinkedListObject;
-
-class org.springsoft.aslib.ObjectListNode implements ListNode
-{
- // Reference to next node
- private var next_:ObjectListNode;
-
- // Node data member
- private var data_:SingleLinkedListObject;
-
- /**
- * ObjectListNode Constructor
- *
- * @param data Object data
- */
- function ObjectListNode(data:SingleLinkedListObject)
- {
- next_ = null;
- data_ = data;
- }
-
- /**
- * Implement get method
- *
- * @returns object data
- */
- public function get(Void):SingleLinkedListObject
- {
- return data_;
- }
-
- /**
- * Implement getNext method
- *
- * @returns the next list node
- */
- public function getNext(Void):ListNode
- {
- return next_;
- }
-
- /**
- * Implement setNext method
- *
- * @param node Node to be linked by the next reference
- */
- public function setNext(node:ListNode):Void
- {
- next_ = ObjectListNode(node);
- }
-
- /**
- * Implement set method
- *
- * @param data Object data
- */
- public function set(data:SingleLinkedListObject):Void
- {
- data_ = data;
- }
-
- /**
- * Implement toString method
- *
- * @returns the list node's string representation
- */
- public function toString(Void):String
- {
- return data_.toString();
- }
-
- /**
- * Implement getKey method
- *
- * @returns the list node's key
- */
- public function getKey(Void):Number
- {
- return data_.getKey();
- }
-}
+/*
+
+ObjectListNode is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Object Node is an implementation of the Node class.
+ Used for stack class.
+=====================================================================
+*/
+
+import org.springsoft.aslib.ListNode;
+import org.springsoft.aslib.SingleLinkedListObject;
+
+class org.springsoft.aslib.ObjectListNode implements ListNode
+{
+ // Reference to next node
+ private var next_:ObjectListNode;
+
+ // Node data member
+ private var data_:SingleLinkedListObject;
+
+ /**
+ * ObjectListNode Constructor
+ *
+ * @param data Object data
+ */
+ function ObjectListNode(data:SingleLinkedListObject)
+ {
+ next_ = null;
+ data_ = data;
+ }
+
+ /**
+ * Implement get method
+ *
+ * @returns object data
+ */
+ public function get(Void):SingleLinkedListObject
+ {
+ return data_;
+ }
+
+ /**
+ * Implement getNext method
+ *
+ * @returns the next list node
+ */
+ public function getNext(Void):ListNode
+ {
+ return next_;
+ }
+
+ /**
+ * Implement setNext method
+ *
+ * @param node Node to be linked by the next reference
+ */
+ public function setNext(node:ListNode):Void
+ {
+ next_ = ObjectListNode(node);
+ }
+
+ /**
+ * Implement set method
+ *
+ * @param data Object data
+ */
+ public function set(data:SingleLinkedListObject):Void
+ {
+ data_ = data;
+ }
+
+ /**
+ * Implement toString method
+ *
+ * @returns the list node's string representation
+ */
+ public function toString(Void):String
+ {
+ return data_.toString();
+ }
+
+ /**
+ * Implement getKey method
+ *
+ * @returns the list node's key
+ */
+ public function getKey(Void):Number
+ {
+ return data_.getKey();
+ }
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/ObjectTreeNode.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/ObjectTreeNode.as (.../ObjectTreeNode.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/ObjectTreeNode.as (.../ObjectTreeNode.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,158 +1,158 @@
-/*
-
-ObjectTreeNode is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Tree Node: Object Tree Node
-=====================================================================
-*/
-
-import org.springsoft.aslib.TreeNode;
-import org.springsoft.aslib.BinaryTreeObject;
-
-class org.springsoft.aslib.ObjectTreeNode implements TreeNode
-{
-
- // Reference to left node
- private var left_:ObjectTreeNode;
-
- // Reference to right node
- private var right_:ObjectTreeNode;
-
- // Node data member
- private var data_:BinaryTreeObject;
-
- /**
- * ObjectTreeNode Constructor
- *
- * @param data The object's data
- */
- function ObjectTreeNode(data:BinaryTreeObject)
- {
- left_ = null;
- right_ = null;
- data_ = data;
- }
-
- /**
- * Implementation set left node
- *
- * @param node The node referenced by the left child
- */
- public function setLeft(node:TreeNode):Void
- {
- left_ = ObjectTreeNode(node);
- }
-
- /**
- * Implementation set right node
- *
- * @param node The node referenced by the right child
- */
- public function setRight(node:TreeNode):Void
- {
- right_ = ObjectTreeNode(node);
- }
-
- /**
- * Implementation set method
- *
- * @param data Object data
- */
- public function set(data:BinaryTreeObject):Void
- {
- data_ = data;
- }
-
- /**
- * Implementation get left node
- *
- * @returns left child node
- */
- public function getLeft(Void):TreeNode
- {
- return left_;
- }
-
- /**
- * Implementation get right node
- *
- * @returns right child node
- */
- public function getRight(Void):TreeNode
- {
- return right_;
- }
-
- /**
- * Implementation get method
- *
- * @returns object data
- */
- public function get(Void):BinaryTreeObject
- {
- return data_;
- }
-
- /**
- * Implementation toString method
- *
- * @returns the tree node's string representation
- */
- public function toString(Void):String
- {
- return data_.toString();
- }
-
- /**
- * Implementation getKey method
- *
- * @returns the tree node's key
- */
- public function getKey(Void):Number
- {
- return data_.getKey();
- }
-
- /**
- * Implementation isLeave method
- *
- * @returns true if node is a leave. Otherwise returns false.
- */
- public function isLeave(Void):Boolean
- {
- if(null == left_ && null == right_) {
- return true;
- }
- else {
- return false;
- }
- }
-}
-
+/*
+
+ObjectTreeNode is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Tree Node: Object Tree Node
+=====================================================================
+*/
+
+import org.springsoft.aslib.TreeNode;
+import org.springsoft.aslib.BinaryTreeObject;
+
+class org.springsoft.aslib.ObjectTreeNode implements TreeNode
+{
+
+ // Reference to left node
+ private var left_:ObjectTreeNode;
+
+ // Reference to right node
+ private var right_:ObjectTreeNode;
+
+ // Node data member
+ private var data_:BinaryTreeObject;
+
+ /**
+ * ObjectTreeNode Constructor
+ *
+ * @param data The object's data
+ */
+ function ObjectTreeNode(data:BinaryTreeObject)
+ {
+ left_ = null;
+ right_ = null;
+ data_ = data;
+ }
+
+ /**
+ * Implementation set left node
+ *
+ * @param node The node referenced by the left child
+ */
+ public function setLeft(node:TreeNode):Void
+ {
+ left_ = ObjectTreeNode(node);
+ }
+
+ /**
+ * Implementation set right node
+ *
+ * @param node The node referenced by the right child
+ */
+ public function setRight(node:TreeNode):Void
+ {
+ right_ = ObjectTreeNode(node);
+ }
+
+ /**
+ * Implementation set method
+ *
+ * @param data Object data
+ */
+ public function set(data:BinaryTreeObject):Void
+ {
+ data_ = data;
+ }
+
+ /**
+ * Implementation get left node
+ *
+ * @returns left child node
+ */
+ public function getLeft(Void):TreeNode
+ {
+ return left_;
+ }
+
+ /**
+ * Implementation get right node
+ *
+ * @returns right child node
+ */
+ public function getRight(Void):TreeNode
+ {
+ return right_;
+ }
+
+ /**
+ * Implementation get method
+ *
+ * @returns object data
+ */
+ public function get(Void):BinaryTreeObject
+ {
+ return data_;
+ }
+
+ /**
+ * Implementation toString method
+ *
+ * @returns the tree node's string representation
+ */
+ public function toString(Void):String
+ {
+ return data_.toString();
+ }
+
+ /**
+ * Implementation getKey method
+ *
+ * @returns the tree node's key
+ */
+ public function getKey(Void):Number
+ {
+ return data_.getKey();
+ }
+
+ /**
+ * Implementation isLeave method
+ *
+ * @returns true if node is a leave. Otherwise returns false.
+ */
+ public function isLeave(Void):Boolean
+ {
+ if(null == left_ && null == right_) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/Queue.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/Queue.as (.../Queue.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/Queue.as (.../Queue.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,90 +1,90 @@
-/*
-
-Queue is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Queue class
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedList;
-import org.springsoft.aslib.QueueObject;
-
-class org.springsoft.aslib.Queue
-{
- // The SingleLinkedList queue representation
- private var list_:SingleLinkedList;
-
- /**
- * Queue Constructor
- */
- function Queue()
- {
- list_ = new SingleLinkedList();
- }
-
- /**
- * Put item into queue
- *
- * @param item Data object
- */
- public function enqueue(item:QueueObject):Void
- {
- list_.insertTail(item);
- }
-
- /**
- * Remove item from queue
- *
- * @returns data object
- */
- public function dequeue(Void):QueueObject
- {
- // Get the ObjectListNode and then the data with get()
- return QueueObject(list_.getFront(true).get());
- }
-
- /**
- * Test if queue is empty
- *
- * @returns true if queue is empty. Otherwise returns false.
- */
- public function isEmpty(Void):Boolean
- {
- return list_.isEmpty();
- }
-
- /**
- * Print the queue
- */
- public function print(Void):Void
- {
- list_.print();
- }
-}
+/*
+
+Queue is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Queue class
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedList;
+import org.springsoft.aslib.QueueObject;
+
+class org.springsoft.aslib.Queue
+{
+ // The SingleLinkedList queue representation
+ private var list_:SingleLinkedList;
+
+ /**
+ * Queue Constructor
+ */
+ function Queue()
+ {
+ list_ = new SingleLinkedList();
+ }
+
+ /**
+ * Put item into queue
+ *
+ * @param item Data object
+ */
+ public function enqueue(item:QueueObject):Void
+ {
+ list_.insertTail(item);
+ }
+
+ /**
+ * Remove item from queue
+ *
+ * @returns data object
+ */
+ public function dequeue(Void):QueueObject
+ {
+ // Get the ObjectListNode and then the data with get()
+ return QueueObject(list_.getFront(true).get());
+ }
+
+ /**
+ * Test if queue is empty
+ *
+ * @returns true if queue is empty. Otherwise returns false.
+ */
+ public function isEmpty(Void):Boolean
+ {
+ return list_.isEmpty();
+ }
+
+ /**
+ * Print the queue
+ */
+ public function print(Void):Void
+ {
+ list_.print();
+ }
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/QueueObject.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/QueueObject.as (.../QueueObject.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/QueueObject.as (.../QueueObject.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,41 +1,41 @@
-/*
-
-QueueObject is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- QueueObject Interface
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedListObject;
-
-interface org.springsoft.aslib.QueueObject extends SingleLinkedListObject
-{
-}
-
+/*
+
+QueueObject is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ QueueObject Interface
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedListObject;
+
+interface org.springsoft.aslib.QueueObject extends SingleLinkedListObject
+{
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/SingleLinkedList.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/SingleLinkedList.as (.../SingleLinkedList.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/SingleLinkedList.as (.../SingleLinkedList.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,448 +1,448 @@
-/*
-
-SingleLinkedList is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Single Linked List class
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedListObject;
-import org.springsoft.aslib.ListNode;
-import org.springsoft.aslib.ObjectListNode;
-
-class org.springsoft.aslib.SingleLinkedList
-{
-
- // Head of list
- private var head_:ListNode;
-
- /**
- * SingleLinkedList Constructor
- */
- function SingleLinkedList()
- {
- head_ = null;
- }
-
- /**
- * Test for empty list
- *
- * @returns true if the linked list is empty. Otherwise returns false.
- */
- public function isEmpty(Void):Boolean
- {
- return (null == head_) ? true : false;
- }
-
- /**
- * Insert a SingleLinkedListObject. By default we insert at front of list
- *
- * @param data The SingleLinkedListObject's data object
- */
- public function insert(data:SingleLinkedListObject):Void
- {
- insertFront(new ObjectListNode(data));
- }
-
- /**
- * Insert a SingleLinkedListObject at tail
- *
- * @param data The SingleLinkedListObject's data object
- */
- public function insertTail(data:SingleLinkedListObject):Void
- {
- if(isEmpty()) {
- insert(data);
- }
- else {
- var tailNode:ListNode = null;
- for(var tempNode:ListNode = head_; tempNode != null; tailNode = tempNode, tempNode = tempNode.getNext()) { }
- insertEnd(new ObjectListNode(data), tailNode);
- }
- }
-
- /**
- * Get a node reference
- *
- * @param key The numeric key for finding node
- * @returns ListNode if we find the key. Otherwise returns null.
- */
- public function get(key:Number):ListNode
- {
- var tempNode:ListNode = head_;
-
- // Loop through the list and if we have a math, stop and return.
- // If there is not a match, returning null since tempNode will point to null
- for(; tempNode != null; tempNode = tempNode.getNext()) {
- if(key == tempNode.getKey()) {
- break;
- }
- }
-
- return tempNode;
- }
-
- /**
- * Get a SingleLinkedListObject data object reference
- *
- * @param key The numeric key to find SingleLinkedListObject
- * @returns SingleLinkedListObject if we find the key. Otherwise returns null.
- */
- public function getData(key:Number):SingleLinkedListObject
- {
- return this.get(key).get();
- }
-
- /**
- * Get a node at index
- *
- * @param index The numeric index to locate node
- * @returns ListNode if we locate the index. Otherwise returns null.
- */
- public function getAt(index:Number):ListNode
- {
- var tempNode:ListNode = head_;
- var position:Number = 0;
-
- // Loop through the list and if we reach the index, stop and return.
- // If we have an invalid index, returning null since tempNode will point to null
- for(; tempNode != null; tempNode = tempNode.getNext()) {
- if(index == position) {
- break;
- }
- position++;
- }
-
- return tempNode;
- }
-
- /**
- * Get a SingleLinkedListObject data object reference
- *
- * @param index The numeric index to locate SingleLinkedListObject
- * @returns SingleLinkedListObject if we locate the index. Otherwise returns null.
- */
- public function getDataAt(index:Number):SingleLinkedListObject
- {
- return this.getAt(index).get();
- }
-
- /**
- * Remove a node
- *
- * @param key The numeric key to find and remove node
- * @returns ListNode if list is not empty. Otherwise returns null.
- */
- public function remove(key:Number):ListNode
- {
- var previousTempNode:ListNode = head_;
-
- for(var tempNode:ListNode = head_; tempNode != null; previousTempNode = tempNode, tempNode = tempNode.getNext()) {
- if(key == tempNode.getKey()) {
- if(isFront(tempNode)) {
- return removeFront();
- }
- else if(isEnd(tempNode)) {
- return removeEnd(previousTempNode);
- }
- else {
- return removeMiddle(previousTempNode);
- }
- }
- }
-
- return null;
- }
-
-
- /**
- * Remove a SingleLinkedListObject
- *
- * @param key The numeric key to find and remove SingleLinkedListObject
- * @returns SingleLinkedListObject if list is not empty. Otherwise returns null.
- */
- public function removeData(key:Number):SingleLinkedListObject
- {
- return this.remove(key).get();
- }
-
- /**
- * Remove a node at index
- *
- * @param index The numeric index to locate and remove node
- * @returns ListNode if list is not empty. Otherwise returns null.
- */
- public function removeAt(index:Number):ListNode
- {
- var previousTempNode:ListNode = head_;
- var position:Number = 0;
-
- for(var tempNode:ListNode = head_; tempNode != null; previousTempNode = tempNode, tempNode = tempNode.getNext()) {
- if(index == position) {
- if(isFront(tempNode)) {
- return removeFront();
- }
- else if(isEnd(tempNode)) {
- return removeEnd(previousTempNode);
- }
- else {
- return removeMiddle(previousTempNode);
- }
- }
-
- position++;
- }
-
- return null;
- }
-
- /**
- * Remove a SingleLinkedListObject at index
- *
- * @param index The numeric index to locate and remove SingleLinkedListObject
- * @returns SingleLinkedListObject if list is not empty. Otherwise returns null.
- */
- public function removeDataAt(index:Number):SingleLinkedListObject
- {
- return this.removeAt(index).get();
- }
-
- /**
- * Remove all nodes
- */
- public function removeAll():Void
- {
- var previousTempNode:ListNode = head_;
-
- for(var tempNode:ListNode = head_; tempNode != null; previousTempNode = tempNode, tempNode = tempNode.getNext()) {
- if(null == tempNode.getNext() && null != previousTempNode.getNext()) {
- tempNode = null;
- }
-
- if(previousTempNode != tempNode) {
- previousTempNode.setNext(null);
- previousTempNode = null;
- }
- }
-
- if(null != head_) {
- head_.setNext(null);
- head_ = null;
- }
- }
-
- /**
- * Return the front node and delete front node if canDelete is set to true
- *
- * @param canDelete Flag that indicates if we can delete the front node
- * @returns ListNode if list is not empty. Otherwise returns null.
- */
- public function getFront(canDelete:Boolean):ListNode
- {
- var node:ListNode = head_;
- if(canDelete) {
- removeFront();
- }
-
- return node;
- }
-
- /**
- * Return the front SingleLinkedListObject and delete front SingleLinkedListObject if canDelete is set to true
- *
- * @param canDelete Flag that indicates if we can delete the front SingleLinkedListObject
- * @returns SingleLinkedListObject if list is not empty. Otherwise returns null.
- */
- public function getFrontData(canDelete:Boolean):SingleLinkedListObject
- {
- return this.getFront(canDelete).get();
- }
-
- /**
- * Print linked list
- */
- public function print(Void):Void
- {
- trace("=======================")
- trace("Single Linked List HEAD");
- for(var tempNode:ListNode = head_; tempNode != null; tempNode = tempNode.getNext()) {
- trace(tempNode.toString());
- }
- trace("Single Linked List TAIL");
- trace("=======================")
- }
-
- /**
- * Gets the size of the list
- *
- * @returns the number of nodes in the list
- */
- public function size(Void):Number
- {
- var tempNode:ListNode = head_;
- var size:Number = 0;
-
- // Loop through the list and count each node
- for(; tempNode != null; tempNode = tempNode.getNext()) {
- size++;
- }
-
- return size;
- }
-
- /**
- * Test for front node
- *
- * @param node Test for front node
- * @returns true if node is front node. Otherwise returns false.
- */
- private function isFront(node:ListNode):Boolean
- {
- return (head_ == node) ? true : false;
- }
-
- /**
- * Test for end node
- *
- * @param node Test for end node
- * @returns true if node is end node. Otherwise returns false.
- */
- private function isEnd(node:ListNode):Boolean
- {
- return(null == node.getNext()) ? true : false;
- }
-
- /**
- * Test if list has only one node
- *
- * @returns true if list has only one node. Otherwise returns false.
- */
- private function hasOneNode(Void):Boolean
- {
- if((null == head_.getNext()) && (isEmpty())) {
- return true;
- }
- else {
- return false;
- }
- }
-
- /**
- * Insert at front
- *
- * @param node Insert node at front of list
- */
- private function insertFront(node:ListNode):Void
- {
- if(isEmpty()) {
- head_ = node;
- node.setNext(null);
- }
- else {
- node.setNext(head_);
- head_ = node;
- }
- }
-
- /**
- * Remove node from front of list
- *
- * @returns ListNode if list is not empty. Otherwise returns false.
- */
- private function removeFront():ListNode
- {
- var listNode:ListNode = null;
-
- if(isEmpty()) {
- // Don't do anything
- }
- else if(hasOneNode()) {
- listNode = head_;
- head_ = null;
- }
- else {
-
- listNode = head_;
- head_ = head_.getNext();
- }
-
- return listNode;
- }
-
- /**
- * Insert at middle
- *
- * @param node Node that needs to be inserted
- * @param targetNode Insert node after targetNode
- */
- private function insertMiddle(node:ListNode, targetNode:ListNode):Void
- {
- node.setNext(targetNode.getNext());
- targetNode.setNext(node);
- }
-
- /**
- * Remove from middle
- *
- * @param previous Node before node that needs to be removed
- * @returns ListNode
- */
- private function removeMiddle(previous:ListNode):ListNode
- {
- var listNode:ListNode = previous.getNext();
- previous.setNext(listNode.getNext());
- return listNode;
- }
-
- /**
- * Insert at end
- *
- * @param node Node that needs to be inserted
- * @param targetNode Insert node after targetNode
- */
- private function insertEnd(node:ListNode, targetNode:ListNode):Void
- {
- targetNode.setNext(node);
- node.setNext(null);
- }
-
- /**
- * Remove from end
- *
- * @param previous Node before node that needs to be removed
- * @returns ListNode
- */
- private function removeEnd(previous:ListNode):ListNode
- {
- var listNode:ListNode = previous.getNext();
- previous.setNext(null);
- return listNode;
- }
-}
+/*
+
+SingleLinkedList is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Single Linked List class
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedListObject;
+import org.springsoft.aslib.ListNode;
+import org.springsoft.aslib.ObjectListNode;
+
+class org.springsoft.aslib.SingleLinkedList
+{
+
+ // Head of list
+ private var head_:ListNode;
+
+ /**
+ * SingleLinkedList Constructor
+ */
+ function SingleLinkedList()
+ {
+ head_ = null;
+ }
+
+ /**
+ * Test for empty list
+ *
+ * @returns true if the linked list is empty. Otherwise returns false.
+ */
+ public function isEmpty(Void):Boolean
+ {
+ return (null == head_) ? true : false;
+ }
+
+ /**
+ * Insert a SingleLinkedListObject. By default we insert at front of list
+ *
+ * @param data The SingleLinkedListObject's data object
+ */
+ public function insert(data:SingleLinkedListObject):Void
+ {
+ insertFront(new ObjectListNode(data));
+ }
+
+ /**
+ * Insert a SingleLinkedListObject at tail
+ *
+ * @param data The SingleLinkedListObject's data object
+ */
+ public function insertTail(data:SingleLinkedListObject):Void
+ {
+ if(isEmpty()) {
+ insert(data);
+ }
+ else {
+ var tailNode:ListNode = null;
+ for(var tempNode:ListNode = head_; tempNode != null; tailNode = tempNode, tempNode = tempNode.getNext()) { }
+ insertEnd(new ObjectListNode(data), tailNode);
+ }
+ }
+
+ /**
+ * Get a node reference
+ *
+ * @param key The numeric key for finding node
+ * @returns ListNode if we find the key. Otherwise returns null.
+ */
+ public function get(key:Number):ListNode
+ {
+ var tempNode:ListNode = head_;
+
+ // Loop through the list and if we have a math, stop and return.
+ // If there is not a match, returning null since tempNode will point to null
+ for(; tempNode != null; tempNode = tempNode.getNext()) {
+ if(key == tempNode.getKey()) {
+ break;
+ }
+ }
+
+ return tempNode;
+ }
+
+ /**
+ * Get a SingleLinkedListObject data object reference
+ *
+ * @param key The numeric key to find SingleLinkedListObject
+ * @returns SingleLinkedListObject if we find the key. Otherwise returns null.
+ */
+ public function getData(key:Number):SingleLinkedListObject
+ {
+ return this.get(key).get();
+ }
+
+ /**
+ * Get a node at index
+ *
+ * @param index The numeric index to locate node
+ * @returns ListNode if we locate the index. Otherwise returns null.
+ */
+ public function getAt(index:Number):ListNode
+ {
+ var tempNode:ListNode = head_;
+ var position:Number = 0;
+
+ // Loop through the list and if we reach the index, stop and return.
+ // If we have an invalid index, returning null since tempNode will point to null
+ for(; tempNode != null; tempNode = tempNode.getNext()) {
+ if(index == position) {
+ break;
+ }
+ position++;
+ }
+
+ return tempNode;
+ }
+
+ /**
+ * Get a SingleLinkedListObject data object reference
+ *
+ * @param index The numeric index to locate SingleLinkedListObject
+ * @returns SingleLinkedListObject if we locate the index. Otherwise returns null.
+ */
+ public function getDataAt(index:Number):SingleLinkedListObject
+ {
+ return this.getAt(index).get();
+ }
+
+ /**
+ * Remove a node
+ *
+ * @param key The numeric key to find and remove node
+ * @returns ListNode if list is not empty. Otherwise returns null.
+ */
+ public function remove(key:Number):ListNode
+ {
+ var previousTempNode:ListNode = head_;
+
+ for(var tempNode:ListNode = head_; tempNode != null; previousTempNode = tempNode, tempNode = tempNode.getNext()) {
+ if(key == tempNode.getKey()) {
+ if(isFront(tempNode)) {
+ return removeFront();
+ }
+ else if(isEnd(tempNode)) {
+ return removeEnd(previousTempNode);
+ }
+ else {
+ return removeMiddle(previousTempNode);
+ }
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Remove a SingleLinkedListObject
+ *
+ * @param key The numeric key to find and remove SingleLinkedListObject
+ * @returns SingleLinkedListObject if list is not empty. Otherwise returns null.
+ */
+ public function removeData(key:Number):SingleLinkedListObject
+ {
+ return this.remove(key).get();
+ }
+
+ /**
+ * Remove a node at index
+ *
+ * @param index The numeric index to locate and remove node
+ * @returns ListNode if list is not empty. Otherwise returns null.
+ */
+ public function removeAt(index:Number):ListNode
+ {
+ var previousTempNode:ListNode = head_;
+ var position:Number = 0;
+
+ for(var tempNode:ListNode = head_; tempNode != null; previousTempNode = tempNode, tempNode = tempNode.getNext()) {
+ if(index == position) {
+ if(isFront(tempNode)) {
+ return removeFront();
+ }
+ else if(isEnd(tempNode)) {
+ return removeEnd(previousTempNode);
+ }
+ else {
+ return removeMiddle(previousTempNode);
+ }
+ }
+
+ position++;
+ }
+
+ return null;
+ }
+
+ /**
+ * Remove a SingleLinkedListObject at index
+ *
+ * @param index The numeric index to locate and remove SingleLinkedListObject
+ * @returns SingleLinkedListObject if list is not empty. Otherwise returns null.
+ */
+ public function removeDataAt(index:Number):SingleLinkedListObject
+ {
+ return this.removeAt(index).get();
+ }
+
+ /**
+ * Remove all nodes
+ */
+ public function removeAll():Void
+ {
+ var previousTempNode:ListNode = head_;
+
+ for(var tempNode:ListNode = head_; tempNode != null; previousTempNode = tempNode, tempNode = tempNode.getNext()) {
+ if(null == tempNode.getNext() && null != previousTempNode.getNext()) {
+ tempNode = null;
+ }
+
+ if(previousTempNode != tempNode) {
+ previousTempNode.setNext(null);
+ previousTempNode = null;
+ }
+ }
+
+ if(null != head_) {
+ head_.setNext(null);
+ head_ = null;
+ }
+ }
+
+ /**
+ * Return the front node and delete front node if canDelete is set to true
+ *
+ * @param canDelete Flag that indicates if we can delete the front node
+ * @returns ListNode if list is not empty. Otherwise returns null.
+ */
+ public function getFront(canDelete:Boolean):ListNode
+ {
+ var node:ListNode = head_;
+ if(canDelete) {
+ removeFront();
+ }
+
+ return node;
+ }
+
+ /**
+ * Return the front SingleLinkedListObject and delete front SingleLinkedListObject if canDelete is set to true
+ *
+ * @param canDelete Flag that indicates if we can delete the front SingleLinkedListObject
+ * @returns SingleLinkedListObject if list is not empty. Otherwise returns null.
+ */
+ public function getFrontData(canDelete:Boolean):SingleLinkedListObject
+ {
+ return this.getFront(canDelete).get();
+ }
+
+ /**
+ * Print linked list
+ */
+ public function print(Void):Void
+ {
+ trace("=======================")
+ trace("Single Linked List HEAD");
+ for(var tempNode:ListNode = head_; tempNode != null; tempNode = tempNode.getNext()) {
+ trace(tempNode.toString());
+ }
+ trace("Single Linked List TAIL");
+ trace("=======================")
+ }
+
+ /**
+ * Gets the size of the list
+ *
+ * @returns the number of nodes in the list
+ */
+ public function size(Void):Number
+ {
+ var tempNode:ListNode = head_;
+ var size:Number = 0;
+
+ // Loop through the list and count each node
+ for(; tempNode != null; tempNode = tempNode.getNext()) {
+ size++;
+ }
+
+ return size;
+ }
+
+ /**
+ * Test for front node
+ *
+ * @param node Test for front node
+ * @returns true if node is front node. Otherwise returns false.
+ */
+ private function isFront(node:ListNode):Boolean
+ {
+ return (head_ == node) ? true : false;
+ }
+
+ /**
+ * Test for end node
+ *
+ * @param node Test for end node
+ * @returns true if node is end node. Otherwise returns false.
+ */
+ private function isEnd(node:ListNode):Boolean
+ {
+ return(null == node.getNext()) ? true : false;
+ }
+
+ /**
+ * Test if list has only one node
+ *
+ * @returns true if list has only one node. Otherwise returns false.
+ */
+ private function hasOneNode(Void):Boolean
+ {
+ if((null == head_.getNext()) && (isEmpty())) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * Insert at front
+ *
+ * @param node Insert node at front of list
+ */
+ private function insertFront(node:ListNode):Void
+ {
+ if(isEmpty()) {
+ head_ = node;
+ node.setNext(null);
+ }
+ else {
+ node.setNext(head_);
+ head_ = node;
+ }
+ }
+
+ /**
+ * Remove node from front of list
+ *
+ * @returns ListNode if list is not empty. Otherwise returns false.
+ */
+ private function removeFront():ListNode
+ {
+ var listNode:ListNode = null;
+
+ if(isEmpty()) {
+ // Don't do anything
+ }
+ else if(hasOneNode()) {
+ listNode = head_;
+ head_ = null;
+ }
+ else {
+
+ listNode = head_;
+ head_ = head_.getNext();
+ }
+
+ return listNode;
+ }
+
+ /**
+ * Insert at middle
+ *
+ * @param node Node that needs to be inserted
+ * @param targetNode Insert node after targetNode
+ */
+ private function insertMiddle(node:ListNode, targetNode:ListNode):Void
+ {
+ node.setNext(targetNode.getNext());
+ targetNode.setNext(node);
+ }
+
+ /**
+ * Remove from middle
+ *
+ * @param previous Node before node that needs to be removed
+ * @returns ListNode
+ */
+ private function removeMiddle(previous:ListNode):ListNode
+ {
+ var listNode:ListNode = previous.getNext();
+ previous.setNext(listNode.getNext());
+ return listNode;
+ }
+
+ /**
+ * Insert at end
+ *
+ * @param node Node that needs to be inserted
+ * @param targetNode Insert node after targetNode
+ */
+ private function insertEnd(node:ListNode, targetNode:ListNode):Void
+ {
+ targetNode.setNext(node);
+ node.setNext(null);
+ }
+
+ /**
+ * Remove from end
+ *
+ * @param previous Node before node that needs to be removed
+ * @returns ListNode
+ */
+ private function removeEnd(previous:ListNode):ListNode
+ {
+ var listNode:ListNode = previous.getNext();
+ previous.setNext(null);
+ return listNode;
+ }
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/SingleLinkedListObject.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/SingleLinkedListObject.as (.../SingleLinkedListObject.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/SingleLinkedListObject.as (.../SingleLinkedListObject.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,52 +1,52 @@
-/*
-
-SingleLinkedListObject is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- SingleLinkedListObject Interface
-=====================================================================
-*/
-
-interface org.springsoft.aslib.SingleLinkedListObject
-{
- /**
- * Get key
- *
- * @returns object key
- */
- public function getKey(Void):Number;
-
- /**
- * Data string representation
- *
- * @returns object string representation
- */
- public function toString(Void):String;
-}
-
+/*
+
+SingleLinkedListObject is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ SingleLinkedListObject Interface
+=====================================================================
+*/
+
+interface org.springsoft.aslib.SingleLinkedListObject
+{
+ /**
+ * Get key
+ *
+ * @returns object key
+ */
+ public function getKey(Void):Number;
+
+ /**
+ * Data string representation
+ *
+ * @returns object string representation
+ */
+ public function toString(Void):String;
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/Stack.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/Stack.as (.../Stack.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/Stack.as (.../Stack.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,93 +1,93 @@
-/*
-
-Stack is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Stack class
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedList;
-import org.springsoft.aslib.StackObject;
-
-class org.springsoft.aslib.Stack
-{
- // The SingleLinkedList stack representation
- private var list_:SingleLinkedList;
-
- /**
- * Stack Constructor
- */
- function Stack()
- {
- list_ = new SingleLinkedList();
- }
-
- /**
- * Push item on stack
- *
- * @param item Object to be pushed on stack
- */
- public function push(item:StackObject):Void
- {
- list_.insert(item);
- }
-
- /**
- * Pop item from stack
- *
- * @returns object
- */
- public function pop(Void):StackObject
- {
- // Get the ObjectListNode and then the data with get().
- // Also making sure to delete the object from the stack by passing true to getFront
- return StackObject(list_.getFront(true).get());
- }
-
- /**
- * Peek, return top of stack without removing it
- *
- * @returns object
- */
- public function peek(Void):StackObject
- {
- // Get the ObjectListNode and then the data with get()
- // Also making sure to not delete the object from the stack by passing false to getFront
- return StackObject(list_.getFront(false).get());
- }
-
- /**
- * Print the stack
- */
- public function print(Void):Void
- {
- list_.print();
- }
-}
+/*
+
+Stack is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Stack class
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedList;
+import org.springsoft.aslib.StackObject;
+
+class org.springsoft.aslib.Stack
+{
+ // The SingleLinkedList stack representation
+ private var list_:SingleLinkedList;
+
+ /**
+ * Stack Constructor
+ */
+ function Stack()
+ {
+ list_ = new SingleLinkedList();
+ }
+
+ /**
+ * Push item on stack
+ *
+ * @param item Object to be pushed on stack
+ */
+ public function push(item:StackObject):Void
+ {
+ list_.insert(item);
+ }
+
+ /**
+ * Pop item from stack
+ *
+ * @returns object
+ */
+ public function pop(Void):StackObject
+ {
+ // Get the ObjectListNode and then the data with get().
+ // Also making sure to delete the object from the stack by passing true to getFront
+ return StackObject(list_.getFront(true).get());
+ }
+
+ /**
+ * Peek, return top of stack without removing it
+ *
+ * @returns object
+ */
+ public function peek(Void):StackObject
+ {
+ // Get the ObjectListNode and then the data with get()
+ // Also making sure to not delete the object from the stack by passing false to getFront
+ return StackObject(list_.getFront(false).get());
+ }
+
+ /**
+ * Print the stack
+ */
+ public function print(Void):Void
+ {
+ list_.print();
+ }
+}
Index: lams_flash/src/common/flash/org/springsoft/aslib/StackObject.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/StackObject.as (.../StackObject.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/StackObject.as (.../StackObject.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,41 +1,41 @@
-/*
-
-StackObject is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- StackObject Interface
-=====================================================================
-*/
-
-import org.springsoft.aslib.SingleLinkedListObject;
-
-interface org.springsoft.aslib.StackObject extends SingleLinkedListObject
-{
-}
-
+/*
+
+StackObject is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ StackObject Interface
+=====================================================================
+*/
+
+import org.springsoft.aslib.SingleLinkedListObject;
+
+interface org.springsoft.aslib.StackObject extends SingleLinkedListObject
+{
+}
+
Index: lams_flash/src/common/flash/org/springsoft/aslib/TreeNode.as
===================================================================
diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r7b65bab3de4ed5068c5631a245c30cb4eaa8f098
--- lams_flash/src/common/flash/org/springsoft/aslib/TreeNode.as (.../TreeNode.as) (revision d7823922f404944822957e6c051bc0f1335a76de)
+++ lams_flash/src/common/flash/org/springsoft/aslib/TreeNode.as (.../TreeNode.as) (revision 7b65bab3de4ed5068c5631a245c30cb4eaa8f098)
@@ -1,103 +1,103 @@
-/*
-
-TreeNode is part of ASLib
-
-Copyright (C) 2004 Thomas P. Amsler
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Thomas Amsler
-tamsler@cal.berkeley.edu
-
-*/
-
-/*
-=====================================================================
- Requires:
- ActionScript 2.0
-
- Description:
- Binary Tree: Tree Node
-=====================================================================
-*/
-
-
-import org.springsoft.aslib.BinaryTreeObject;
-
-interface org.springsoft.aslib.TreeNode
-{
- /**
- * Set left node
- *
- * @param node The node referenced by the left child
- */
- public function setLeft(node:TreeNode):Void;
-
- /**
- * Set right node
- *
- * @param node The node referenced by the right child
- */
- public function setRight(node:TreeNode):Void;
-
- /**
- * Set node data
- *
- * @param data Object data
- */
- public function set(data:BinaryTreeObject):Void;
-
- /**
- * Get left node
- *
- * @returns left child node
- */
- public function getLeft(Void):TreeNode;
-
- /**
- * Get right node
- *
- * @returns right child node
- */
- public function getRight(Void):TreeNode;
-
- /**
- * Get node data
- *
- * @returns object data
- */
- public function get(Void):BinaryTreeObject;
-
- /**
- * TreeNode string representation
- *
- * @returns the tree node's string representation
- */
- public function toString(Void):String;
-
- /**
- * Return node key
- *
- * @returns the tree node's key
- */
- public function getKey(Void):Number;
-
- /**
- * Test if node is a leave
- *
- * @returns true if node is a leave. Otherwise returns false.
- */
- public function isLeave(Void):Boolean;
-}
+/*
+
+TreeNode is part of ASLib
+
+Copyright (C) 2004 Thomas P. Amsler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Thomas Amsler
+tamsler@cal.berkeley.edu
+
+*/
+
+/*
+=====================================================================
+ Requires:
+ ActionScript 2.0
+
+ Description:
+ Binary Tree: Tree Node
+=====================================================================
+*/
+
+
+import org.springsoft.aslib.BinaryTreeObject;
+
+interface org.springsoft.aslib.TreeNode
+{
+ /**
+ * Set left node
+ *
+ * @param node The node referenced by the left child
+ */
+ public function setLeft(node:TreeNode):Void;
+
+ /**
+ * Set right node
+ *
+ * @param node The node referenced by the right child
+ */
+ public function setRight(node:TreeNode):Void;
+
+ /**
+ * Set node data
+ *
+ * @param data Object data
+ */
+ public function set(data:BinaryTreeObject):Void;
+
+ /**
+ * Get left node
+ *
+ * @returns left child node
+ */
+ public function getLeft(Void):TreeNode;
+
+ /**
+ * Get right node
+ *
+ * @returns right child node
+ */
+ public function getRight(Void):TreeNode;
+
+ /**
+ * Get node data
+ *
+ * @returns object data
+ */
+ public function get(Void):BinaryTreeObject;
+
+ /**
+ * TreeNode string representation
+ *
+ * @returns the tree node's string representation
+ */
+ public function toString(Void):String;
+
+ /**
+ * Return node key
+ *
+ * @returns the tree node's key
+ */
+ public function getKey(Void):Number;
+
+ /**
+ * Test if node is a leave
+ *
+ * @returns true if node is a leave. Otherwise returns false.
+ */
+ public function isLeave(Void):Boolean;
+}