Index: lams_flash/src/central/flash/lam_addseq_wiz.fla =================================================================== diff -u -r454f3bf280f1ecf3fece8deed5091c50de660fd1 -r16e30edc80bd013831a642b732f9d2cbf70395a0 Binary files differ Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as =================================================================== diff -u -r68bbc79083b58b758aec18edd901d86c3f41120d -r16e30edc80bd013831a642b732f9d2cbf70395a0 --- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as (.../WizardController.as) (revision 68bbc79083b58b758aec18edd901d86c3f41120d) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardController.as (.../WizardController.as) (revision 16e30edc80bd013831a642b732f9d2cbf70395a0) @@ -23,9 +23,12 @@ 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.wizard.*; + import mx.utils.* /** @@ -52,7 +55,20 @@ // 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); + } + 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); @@ -81,7 +97,6 @@ var wizView:WizardView = getView(); if(wizView.validateStep(_wizardModel)){ _wizardModel.stepID++; - trace('new step ID: ' + _wizardModel.stepID); } } @@ -216,12 +231,12 @@ public function setBusy(){ _isBusy = true; - getView().disableButtons(); + WizardView(getView()).disableButtons(); } public function clearBusy(){ _isBusy = false; - getView().enableButtons(); + WizardView(getView()).enableButtons(_wizardModel); } } \ No newline at end of file Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as =================================================================== diff -u -rc519cdd55a51de98ac7e09348f1eac36f5369263 -r16e30edc80bd013831a642b732f9d2cbf70395a0 --- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as (.../WizardModel.as) (revision c519cdd55a51de98ac7e09348f1eac36f5369263) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardModel.as (.../WizardModel.as) (revision 16e30edc80bd013831a642b732f9d2cbf70395a0) @@ -58,11 +58,12 @@ // 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; @@ -211,14 +212,12 @@ var user:User = User(organisation.getUser(u.userID)); if(user != null){ - trace('adding role to existing user: ' + user.getFirstName() + ' ' + user.getLastName()); user.addRole(role); } else { user = new User(); user.populateFromDTO(u); user.addRole(role); - trace('adding user: ' + user.getFirstName() + ' ' + user.getLastName() + ' ' + user.getUserId()); organisation.addUser(user); } } @@ -326,41 +325,52 @@ */ public function setSelectedTreeNode (newselectedTreeNode:XMLNode):Void { _selectedOrgTreeNode = newselectedTreeNode; - trace('branch: ' + _selectedOrgTreeNode.attributes.isBranch); - //if(!_selectedOrgTreeNode.attributes.isBranch){ - // get the organisations (node) users by role - //var roles:Array = new Array(LEARNER_ROLE, MONITOR_ROLE, COURSE_MANAGER_ROLE); - setOrganisation(new Organisation(_selectedOrgTreeNode.attributes.data)); - resetUserFlags(); - // polling method - waiting for all users to load before displaying users in UI - checkUsersLoaded(); + setOrganisation(new Organisation(_selectedOrgTreeNode.attributes.data)); + resetUserFlags(); + + // polling method - waiting for all users to load before displaying users in UI + checkUsersLoaded(); - // load users - requestLearners(_selectedOrgTreeNode.attributes.data); - requestStaff(_selectedOrgTreeNode.attributes.data); - - trace(staffLoaded); - trace(learnersLoaded); - //} - + // 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){ - trace('getting lesson class data...'); - trace('org resource id: ' + r.organisationID); if(lessonID){classData.lessonID = lessonID;} if(r.organisationID){classData.organisationID = r.organisationID;} + classData.staff = staff; classData.learners = learners; + if(r.staffGroupName){classData.staff.groupName = r.staffGroupName;} if(r.selectedStaff){staff.users = r.selectedStaff;} if(r.learnersGroupName){classData.learners.groupName = r.learnersGroupName;} if(r.selectedLearners){classData.learners.users = r.selectedLearners;} + return classData; } else { return null; Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r16e30edc80bd013831a642b732f9d2cbf70395a0 --- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as (.../WizardView.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/WizardView.as (.../WizardView.as) (revision 16e30edc80bd013831a642b732f9d2cbf70395a0) @@ -1,4 +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 + * ************************************************************************ + */ + import mx.controls.* import mx.utils.* import mx.managers.* @@ -8,6 +30,7 @@ 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.* @@ -28,16 +51,15 @@ private var _className = "WizardView"; //constants - public var RT_ORG:String = "Organisation"; - public var STRING_NULL:String = "string_null_value" - public static var USERS_X:Number = 10; - public static var USER_OFFSET:Number = 20; - public static var SUMMERY_X:Number = 11; - public static var SUMMERY_Y:Number = 140; - public static var SUMMERY_W:Number = 500; - public static var SUMMERY_H:Number = 20; - public static var SUMMERY_OFFSET:Number = 2; + 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; @@ -49,54 +71,19 @@ 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 _workspace:Workspace; private var _wizardView_mc:MovieClip; private var logo:MovieClip; - private var org_treeview:Tree; //Treeview for navigation through workspace folder structure - - // step 1 UI elements - private var location_treeview:Tree; - - // step 2 UI elements - private var title_lbl:Label; - private var resourceTitle_txi:TextInput; - private var desc_lbl:Label; - private var resourceDesc_txa:TextArea; - - // step 3 UI elements - private var _staffList:Array; - private var _learnerList:Array; - private var _learner_mc:MovieClip; - private var _staff_mc:MovieClip; - private var staff_scp:MovieClip; // staff/teachers container - private var staff_lbl:Label; - private var learner_scp:MovieClip; // learners container - private var learner_lbl:Label; - private var staff_selAll_cb:CheckBox; - private var learner_selAll_cb:CheckBox; - - // step 4 UI elements - private var schedule_cb:CheckBox; - private var learner_expp_cb:CheckBox; - private var start_btn:Button; - private var schedule_btn:Button; - private var schedule_time:MovieClip; - private var summery_lbl:Label; - private var date_lbl:Label; - private var time_lbl:Label; - private var summery_scp:MovieClip; - private var _summery_mc:MovieClip; - private var _summeryList:Array; - private var scheduleDate_dt:DateField; - private var summery_lbl_arr:Array; - - // conclusion UI elements - private var confirmMsg_txt:TextField; - //Dimensions for resizing private var xNextOffset:Number; private var yNextOffset:Number; @@ -110,16 +97,19 @@ private var header_pnl:MovieClip; // top panel base private var footer_pnl:MovieClip; - private var panel:MovieClip; //The underlaying panel base + 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 desc_txa:TextArea; private var desc_scr:MovieClip; @@ -136,17 +126,16 @@ private var dispatchEvent:Function; public var addEventListener:Function; public var removeEventListener:Function; - //public var menu:ContextMenu; - /** * Constructor */ function WizardView(){ _wizardView = this; _wizardView_mc = this; - mx.events.EventDispatcher.initialize(this); + mx.events.EventDispatcher.initialize(this); + _tm = ThemeManager.getInstance(); _dictionary = Dictionary.getInstance(); _dictionary.addEventListener('init',Proxy.create(this,setUpLabels)); @@ -160,6 +149,16 @@ 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; @@ -183,10 +182,10 @@ /** - * Recieved update events from the WizardModel. Dispatches to relevent handler depending on update.Type - * @usage - * @param event - */ + * 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); @@ -197,24 +196,29 @@ 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' : - loadLearners(wm.organisation.getLearners(), true); - loadStaff(wm.organisation.getMonitors(), true); + _wizardOrgView.loadLearners(wm.organisation.getLearners(), true); + _wizardOrgView.loadStaff(wm.organisation.getMonitors(), true); + _wizardOrgView.enableUsers((resultDTO.selectedJointLessonID == null)); _wizardController.clearBusy(); + Debugger.log("controller: " + _wizardController, Debugger.CRITICAL, "update", "WizardView"); break; case 'STAFF_RELOAD' : - loadStaff(wm.organisation.getMonitors(), true); + _wizardOrgView.loadStaff(wm.organisation.getMonitors(), true); break; case 'LEARNER_RELOAD' : - loadLearners(wm.organisation.getLearners(), true); + _wizardOrgView.loadLearners(wm.organisation.getLearners(), true); break; - case 'SAVED_LC' : - conclusionStep(infoObj.data, wm); - break; - case 'LESSON_STARTED' : - conclusionStep(infoObj.data, wm); - break; - case 'POSITION' : + case 'TABCHANGE' : + _wizardSeqView.showTab(infoObj.tabID); + break; + case 'POSITION' : setPosition(wm); break; case 'SIZE' : @@ -227,83 +231,52 @@ } /** - * Recieved update events from the WorkspaceModel. Dispatches to relevent handler depending on update.Type - * @usage - * @param event - */ - public function viewUpdate(event:Object):Void{ - trace('receiving view update event...'); - var wm:WorkspaceModel = event.target; - //set a permenent ref to the model for ease (sorry mvc guru) - - - switch (event.updateType){ - case 'REFRESH_TREE' : - refreshTree(wm); - break; - case 'UPDATE_CHILD_FOLDER' : - updateChildFolderBranches(event.data,wm); - openFolder(event.data, wm); - case 'UPDATE_CHILD_FOLDER_NOOPEN' : - updateChildFolderBranches(event.data,wm); - break; - case 'ITEM_SELECTED' : - itemSelected(event.data,wm); - break; - case 'OPEN_FOLDER' : - openFolder(event.data, wm); - break; - case 'CLOSE_FOLDER' : - closeFolder(event.data, wm); - break; - case 'REFRESH_FOLDER' : - refreshFolder(event.data, wm); - break; - case 'SET_UP_BRANCHES_INIT' : - setUpBranchesInit(); - break; - default : - Debugger.log('unknown update type :' + event.updateType,Debugger.GEN,'viewUpdate','org.lamsfoundation.lams.ws.WorkspaceDialog'); - - } - } - - /** * layout visual elements on the canvas on initialisation */ private function draw(){ + 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(); - setScheduleDateRange(); + _wizardLessonView.setScheduleDateRange(); + showStep1(); - dispatchEvent({type:'load',target:this}); + + dispatchEvent({type:'load',target:this}); } /** * Called by the wizardController after the workspace has loaded */ public function setUpContent():Void{ - trace('setting up content'); //register to recive updates form the model - WorkspaceModel(workspaceView.getModel()).addEventListener('viewUpdate',this); + WorkspaceModel(workspaceView.getModel()).addEventListener('viewUpdate', this); + var controller = getController(); - this.addEventListener('okClicked',Delegate.create(controller,controller.okClicked)); + + this.addEventListener('okClicked',Delegate.create(controller, controller.okClicked)); + next_btn.addEventListener("click",controller); prev_btn.addEventListener("click",controller); finish_btn.addEventListener("click",controller); cancel_btn.addEventListener("click",controller); close_btn.addEventListener("click",controller); start_btn.addEventListener("click",controller); - schedule_btn.addEventListener('click', Delegate.create(this, scheduleNow)); - schedule_cb.addEventListener("click", Delegate.create(this, scheduleChange)); - staff_selAll_cb.addEventListener("click", Delegate.create(this, toogleStaffSelection)); - learner_expp_cb.addEventListener("click", Delegate.create(this, toogleExpPortfolio)); - learner_selAll_cb.addEventListener("click", Delegate.create(this, toogleLearnerSelection)); + _wizardOrgView.setupContent(); + _wizardLessonView.setupContent(); + //Set up the treeview - setUpTreeview(); - //itemSelected(location_treeview.selectedNode, WorkspaceModel(workspaceView.getModel())); - + _wizardSeqView.setUpTreeview(); + } /** @@ -318,29 +291,68 @@ finish_btn.label = Dictionary.getValue('finish_btn'); close_btn.label = Dictionary.getValue('close_btn'); start_btn.label = Dictionary.getValue('start_btn'); - schedule_btn.label = Dictionary.getValue('schedule_cb_lbl'); //labels setTitle(Dictionary.getValue('wizardTitle_1_lbl')); setDescription(Dictionary.getValue('wizardDesc_1_lbl')); - title_lbl.text = Dictionary.getValue('title_lbl'); - desc_lbl.text = Dictionary.getValue('desc_lbl'); - staff_lbl.text = Dictionary.getValue('staff_lbl'); - learner_lbl.text = Dictionary.getValue('learner_lbl'); - summery_lbl.text = Dictionary.getValue('summery_lbl'); - schedule_cb.label = Dictionary.getValue('schedule_cb_lbl'); - date_lbl.text = Dictionary.getValue('date_lbl'); - time_lbl.text = Dictionary.getValue('time_lbl'); + _wizardLessonView.setupLabels(); + _wizardOrgView.setupLabels(); - // checkboxes - staff_selAll_cb.label = Dictionary.getValue('wizard_selAll_cb_lbl'); - learner_selAll_cb.label = Dictionary.getValue('wizard_selAll_cb_lbl'); - learner_expp_cb.label = Dictionary.getValue('wizard_learner_expp_cb_lbl'); - resizeButtons([cancel_btn, prev_btn, next_btn, close_btn, finish_btn, start_btn, schedule_btn]); + resizeButtons([cancel_btn, prev_btn, next_btn, close_btn, finish_btn, start_btn, _wizardLessonView.getScheduleBtn()]); 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 0) { - for(var i=0; i 0) { - for(var i=0; i (Number(selectedHours+checkHours))){ - return false; - }else if (hours == Number(selectedHours+checkHours)){ - if (minutes > selectedMinutes){ - return false; - }else { - return true; - } - }else { - return true; - } - } - /** * Sets the size of the canvas on stage, called from update */ private function setSize(wm:WizardModel):Void{ @@ -1332,53 +682,37 @@ // calculate height change var dHeight:Number = Stage.height - lastStageHeight; - trace('last stage height' + lastStageHeight); - lastStageHeight = Stage.height; - trace('new height change: ' + dHeight); - - org_treeview.setSize(org_treeview.width, Number(org_treeview.height + dHeight)); - location_treeview.setSize(location_treeview.width, Number(location_treeview.height + dHeight)); - resourceDesc_txa.setSize(resourceDesc_txa.width, Number(resourceDesc_txa.height + dHeight)); + _wizardOrgView.setSize(dHeight); + _wizardSeqView.setSize(dHeight); + _wizardLessonView.setSize(dHeight); - //staff_scp.setSize(staff_scp._width, staff_scp._height + dHeight); - learner_scp.setSize(learner_scp._width, learner_scp._height + dHeight); - - } - /** + /** * Sets the position of the canvas on stage, called from update * @param cm Canvas model object */ private function setPosition(wm:WizardModel):Void{ var p:Object = wm.getPosition(); - trace("X pos set in Model is: "+p.x+" and Y pos set in Model is "+p.y) - this._x = p.x; + + this._x = p.x; this._y = p.y; } public function get workspaceView():WorkspaceView{ - return _workspaceView; + return _wizardSeqView.workspaceView; } public function set workspaceView(a:WorkspaceView){ - _workspaceView = a; + _wizardSeqView.workspaceView = a; } public function get resultDTO():Object{ return _resultDTO; } - public function get learnerList():Array{ - return _learnerList; - } - - public function get staffList():Array{ - return _staffList; - } - public function setTitle(title:String){ wizTitle_lbl.text = "" + title + ""; } @@ -1387,54 +721,6 @@ wizDesc_txt.text = desc; } - public function showConfirmMessage(mode:Number){ - var msg:String = ""; - var lessonName:String = "" + resultDTO.resourceTitle +""; - switch(mode){ - case FINISH_MODE : - msg = Dictionary.getValue('confirmMsg_3_txt', [lessonName]); - break; - case START_MODE : - msg = Dictionary.getValue('confirmMsg_1_txt', [lessonName]); - break; - case START_SCH_MODE : - msg = Dictionary.getValue('confirmMsg_2_txt', [lessonName, unescape(resultDTO.scheduleDateTime)]); - break; - default: - trace('unknown mode'); - } - confirmMsg_txt.html = true; - confirmMsg_txt.htmlText = msg; - confirmMsg_txt._width = confirmMsg_txt.textWidth + 5; - confirmMsg_txt._x = panel._x + (panel._width/2) - (confirmMsg_txt._width/2); - confirmMsg_txt._y = panel._y + (panel._height/4); - - confirmMsg_txt.visible = true; - - } - - private function toogleStaffSelection(evt:Object) { - Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView"); - var target:CheckBox = CheckBox(evt.target); - var wm:WizardModel = WizardModel(getModel()); - loadStaff(wm.organisation.getMonitors(), target.selected); - } - - private function toogleExpPortfolio(evt:Object) { - Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView"); - var target:CheckBox = CheckBox(evt.target); - //var wm:WizardModel = WizardModel(getModel()); - resultDTO.learnerExpPortfolio = target.selected; - } - - private function toogleLearnerSelection(evt:Object) { - Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardView"); - var target:CheckBox = CheckBox(evt.target); - var wm:WizardModel = WizardModel(getModel()); - - loadLearners(wm.organisation.getLearners(), target.selected); - } - /** * Overrides method in abstract view to ensure cortect type of controller is returned * @usage @@ -1445,7 +731,7 @@ return WizardController(c); } - /* + /* * Returns the default controller for this view. */ public function defaultController (model:Observable):Controller { Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardLessonDetailsView.as =================================================================== diff -u --- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardLessonDetailsView.as (revision 0) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardLessonDetailsView.as (revision 16e30edc80bd013831a642b732f9d2cbf70395a0) @@ -0,0 +1,425 @@ +/*************************************************************************** + * 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.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 mx.controls.* +import mx.utils.* +import mx.managers.* +import mx.events.* + +/** + * + * @author Mitchell Seaton + * @version 2.0.3 + **/ +class org.lamsfoundation.lams.wizard.steps.WizardLessonDetailsView extends AbstractView { + + private var title_lbl:Label; + private var resourceTitle_txi:TextInput; + private var desc_lbl:Label; + private var resourceDesc_txa:TextArea; + + public static var SUMMERY_X:Number = 11; + public static var SUMMERY_Y:Number = 140; + public static var SUMMERY_W:Number = 500; + public static var SUMMERY_H:Number = 20; + public static var SUMMERY_OFFSET:Number = 2; + + private var schedule_cb:CheckBox; + private var learner_expp_cb:CheckBox; + private var start_btn:Button; + private var schedule_time:MovieClip; + private var summery_lbl:Label; + private var date_lbl:Label; + private var time_lbl:Label; + private var summery_scp:MovieClip; + private var _summery_mc:MovieClip; + private var _summeryList:Array; + private var scheduleDate_dt:DateField; + private var summery_lbl_arr:Array; + + private var schedule_btn:Button; + + //Defined so compiler can 'see' events added at runtime by EventDispatcher + private var dispatchEvent:Function; + public var addEventListener:Function; + public var removeEventListener:Function; + + function WizardLessonDetailsView(){ + mx.events.EventDispatcher.initialize(this); + + } + + public function init(m:Observable,c:Controller) { + super(m, c) + } + + 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_expp_cb.selected = true; + } + + public function setupLabels():Void { + title_lbl.text = Dictionary.getValue('title_lbl'); + desc_lbl.text = Dictionary.getValue('desc_lbl'); + summery_lbl.text = Dictionary.getValue('summery_lbl'); + date_lbl.text = Dictionary.getValue('date_lbl'); + time_lbl.text = Dictionary.getValue('time_lbl'); + + 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'); + } + + public function setStyles(_tm:ThemeManager):Void { + var styleObj = _tm.getStyleObject('button'); + schedule_btn.setStyle('styleName',styleObj); + + styleObj = _tm.getStyleObject('label'); + title_lbl.setStyle('styleName',styleObj); + desc_lbl.setStyle('styleName',styleObj); + schedule_cb.setStyle('styleName', styleObj); + learner_expp_cb.setStyle('styleName', styleObj); + date_lbl.setStyle('styleName', styleObj); + time_lbl.setStyle('styleName', styleObj); + summery_lbl.setStyle('styleName',styleObj); + + styleObj = _tm.getStyleObject('textarea'); + resourceDesc_txa.setStyle('styleName',styleObj); + resourceTitle_txi.setStyle('styleName',styleObj); + + styleObj = _tm.getStyleObject('scrollpane'); + summery_scp.setStyle('styleName',styleObj); + } + + public function show():Void { + title_lbl.visible = true; + resourceTitle_txi.visible = true; + desc_lbl.visible = true; + resourceDesc_txa.visible = true; + + date_lbl.visible = true; + time_lbl.visible = true; + start_btn.visible = true; + summery_scp.visible = true; + summery_lbl.visible = true; + learner_expp_cb.visible = true; + schedule_cb.visible = true; + schedule_time._visible = true; + scheduleDate_dt.visible = true; + + // check for NULL value + if(resourceDesc_txa.text == WizardView.STRING_NULL){ + resourceDesc_txa.text = ""; + } + + writeSummery(ThemeManager.getInstance()); + + if(schedule_cb.selected){ + schedule_time.f_enableTimeSelect(true); + scheduleDate_dt.enabled = true; + setScheduleDateRange(); + schedule_btn.visible = true; + + _parent.showButtons([false, true, true, false, false]); + + } else { + schedule_time.f_enableTimeSelect(false); + scheduleDate_dt.enabled = false; + schedule_btn.visible = false; + + _parent.showButtons([false, true, true, true, 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; i (Number(selectedHours+checkHours))){ + return false; + }else if (hours == Number(selectedHours+checkHours)){ + if (minutes > selectedMinutes){ + return false; + }else { + return true; + } + }else { + return true; + } + } + + private function scheduleNow(evt:Object){ + var wm:WizardModel = WizardModel(getModel()); + if(_parent.validateStep(wm)){ + var schDT = getScheduleDateTime(scheduleDate_dt.selectedDate, schedule_time.f_returnTime()); + _parent.resultDTO.scheduleDateTime = schDT.dateTime + + if(_parent.resultDTO.scheduleDateTime == null || _parent.resultDTO.scheduleDateTime == undefined){ + LFMessage.showMessageAlert(Dictionary.getValue('al_validation_schstart'), null, null); + return; + + } else { + if (!schDT.validTime){ + LFMessage.showMessageAlert(Dictionary.getValue('al_validation_schtime'), null, null); + return; + }else { + _parent.resultDTO.mode = WizardView.START_SCH_MODE; + } + } + + _parent.disableButtons(); + getController().initializeLesson(_parent.resultDTO); + } + } + + private function scheduleChange(evt:Object){ + var isSelected:Boolean = schedule_cb.selected; + + if(isSelected){ + schedule_time.f_enableTimeSelect(true); + schedule_btn.enabled = true; + schedule_btn.visible = true; + scheduleDate_dt.enabled = true; + + _parent.showButtons([false, true, true, false, false]); + _parent.positionButtons(true); + + } else { + schedule_time.f_enableTimeSelect(false); + scheduleDate_dt.enabled = false; + + schedule_btn.visible = false; + + _parent.showButtons([false, true, true, true, true]); + _parent.positionButtons(true); + } + } + + private function toogleExpPortfolio(evt:Object) { + Debugger.log("Toogle Staff Selection", Debugger.GEN, "toogleStaffSelection", "WizardLessonDetailsView"); + var target:CheckBox = CheckBox(evt.target); + _parent.resultDTO.learnerExpPortfolio = target.selected; + } + + public function itemSelected(newSelectedNode:XMLNode, wm:WorkspaceModel){ + //update the UI with the new info + var nodeData = newSelectedNode.attributes.data; + if(nodeData.resourceType == wm.RT_FOLDER){ + resourceTitle_txi.text = ""; + resourceDesc_txa.text = ""; + }else{ + if(nodeData.name == null){ + resourceTitle_txi.text = ""; + } else { + resourceTitle_txi.text = nodeData.name; + } + + if(nodeData.description == null){ + resourceDesc_txa.text = ""; + } else { + resourceDesc_txa.text = nodeData.description; + } + } + + } + + /** + * Overrides method in abstract view to ensure cortect type of controller is returned + * @usage + * @return CanvasController + */ + public function getController():WizardController{ + var c:Controller = _parent.getController(); + return WizardController(c); + } + + /* + * Returns the default controller for this view. + */ + public function defaultController (model:Observable):Controller { + return new WizardController(model); + } + + public function getScheduleBtn():Button { + return schedule_btn; + } + +} \ No newline at end of file Index: lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardOrganisationView.as =================================================================== diff -u --- lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardOrganisationView.as (revision 0) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/wizard/steps/WizardOrganisationView.as (revision 16e30edc80bd013831a642b732f9d2cbf70395a0) @@ -0,0 +1,335 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ************************************************************************ + */ + +import org.lamsfoundation.lams.common.util.* +import org.lamsfoundation.lams.common.ui.* +import org.lamsfoundation.lams.common.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 mx.controls.* +import mx.utils.* +import mx.managers.* +import mx.events.* + +/** + * + * @author Mitchell Seaton + * @version 2.0.3 + **/ +class org.lamsfoundation.lams.wizard.steps.WizardOrganisationView extends AbstractView { + + public static var USERS_X:Number = 10; + public static var USER_OFFSET:Number = 20; + + private var _className = "WizardOrganisationView"; + + private var org_treeview:Tree; + + private var _staffList:Array; + private var _learnerList:Array; + private var _learner_mc:MovieClip; + private var _staff_mc:MovieClip; + private var staff_scp:MovieClip; // staff/teachers container + private var staff_lbl:Label; + private var learner_scp:MovieClip; // learners container + private var learner_lbl:Label; + private var staff_selAll_cb:CheckBox; + private var learner_selAll_cb:CheckBox; + + private var _wizardController:WizardController; + + //Defined so compiler can 'see' events added at runtime by EventDispatcher + private var dispatchEvent:Function; + public var addEventListener:Function; + public var removeEventListener:Function; + + function WizardOrganisationView(){ + mx.events.EventDispatcher.initialize(this); + + } + + public function init(m:Observable,c:Controller) { + super(m, c) + } + + public function setupContent():Void { + staff_selAll_cb.addEventListener("click", Delegate.create(this, toogleStaffSelection)); + learner_selAll_cb.addEventListener("click", Delegate.create(this, toogleLearnerSelection)); + } + + public function setupLabels():Void { + staff_lbl.text = Dictionary.getValue('staff_lbl'); + learner_lbl.text = Dictionary.getValue('learner_lbl'); + staff_selAll_cb.label = Dictionary.getValue('wizard_selAll_cb_lbl'); + learner_selAll_cb.label = Dictionary.getValue('wizard_selAll_cb_lbl'); + } + + public function setStyles(_tm:ThemeManager) { + var styleObj = _tm.getStyleObject('label'); + + staff_lbl.setStyle('styleName',styleObj); + learner_lbl.setStyle('styleName',styleObj); + + styleObj = _tm.getStyleObject('scrollpane'); + staff_scp.setStyle('styleName',styleObj); + learner_scp.setStyle('styleName',styleObj); + + } + + public function show(v:Boolean):Void { + org_treeview.visible = v; + + staff_lbl.visible = v; + learner_lbl.visible = v; + + staff_scp.visible = v; + learner_scp.visible = v; + staff_selAll_cb.visible = v; + learner_selAll_cb.visible = v; + + if(_parent.resultDTO.selectedJointLessonID != null) { + staff_selAll_cb.enabled = false; + learner_selAll_cb.enabled = false; + + enableUsers(false); + + } else { + staff_selAll_cb.enabled = true; + learner_selAll_cb.enabled = true; + + enableUsers(true); + } + + } + + public function validate(wm:WizardModel):Boolean{ + var valid:Boolean = true; + var snode = org_treeview.selectedNode; + var pnode = snode.parentNode; + var selectedLearners:Array = new Array(); + var selectedStaff:Array = new Array(); + + if(snode == null){ + LFMessage.showMessageAlert(Dictionary.getValue('al_validation_msg3_1'), null, null); + return false; + } else { + // add selected users to dto + + for(var i=0; i"; + switch(mode){ + case WizardView.FINISH_MODE : + msg = Dictionary.getValue('confirmMsg_3_txt', [lessonName]); + break; + case WizardView.START_MODE : + msg = Dictionary.getValue('confirmMsg_1_txt', [lessonName]); + break; + case WizardView.START_SCH_MODE : + msg = Dictionary.getValue('confirmMsg_2_txt', [lessonName, unescape(_parent.resultDTO.scheduleDateTime)]); + break; + default: + trace('unknown mode'); + } + + confirmMsg_txt.html = true; + confirmMsg_txt.htmlText = msg; + confirmMsg_txt._width = confirmMsg_txt.textWidth + 5; + + confirmMsg_txt._x = _parent.panel._x + (_parent.panel._width/2) - (confirmMsg_txt._width/2); + confirmMsg_txt._y = _parent.panel._y + (_parent.panel._height/4); + + confirmMsg_txt.visible = true; + + } + + /** + * Overrides method in abstract view to ensure cortect type of controller is returned + * @usage + * @return CanvasController + */ + public function getController():WizardController{ + var c:Controller = _parent.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_monitoring/web/lams_wizard.swf =================================================================== diff -u -rd2cdb25d011c7b0fb5a6fc6e1713559aa410e7cd -r16e30edc80bd013831a642b732f9d2cbf70395a0 Binary files differ Index: lams_monitoring/web/lams_wizard_library.swf =================================================================== diff -u -rd2cdb25d011c7b0fb5a6fc6e1713559aa410e7cd -r16e30edc80bd013831a642b732f9d2cbf70395a0 Binary files differ