Index: lams_central/web/lams_authoring.swf =================================================================== diff -u -ra9608549c199d2aae45ee7729e4536f6545afe94 -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 Binary files differ Index: lams_central/web/lams_authoring_library.swf =================================================================== diff -u -ra9608549c199d2aae45ee7729e4536f6545afe94 -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 Binary files differ Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/ConditionMatchingDialog.as =================================================================== diff -u -rd7386d2fcb02d7c398f5b9ec0909cbdad305383c -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/ConditionMatchingDialog.as (.../ConditionMatchingDialog.as) (revision d7386d2fcb02d7c398f5b9ec0909cbdad305383c) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/ConditionMatchingDialog.as (.../ConditionMatchingDialog.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -106,10 +106,10 @@ if(branchesLoaded) { branches_lst.dataProvider = branches; - branches_lst.labelField = "sequenceName"; + branches_lst.labelFunction = formatBranchLabel; } else { branches_lst.dataProvider = sequences; - branches_lst.labelField = "title"; + branches_lst.labelFunction = formatBranchLabel; } branches_lst.hScrollPolicy = "on"; @@ -140,6 +140,12 @@ } + private function formatBranchLabel(data:Object):String { + var branchingActivity:BranchingActivity = ConditionMatchingDialog(this._parent).branchingActivity; + if(data instanceof SequenceActivity) return (data.activityUIID == branchingActivity.firstActivityUIID) ? Dictionary.getValue("branch_mapping_dlg_branch_item_default", [data.title]) : data.title; + else return (data.sequenceActivity.activityUIID == branchingActivity.firstActivityUIID) ? Dictionary.getValue("branch_mapping_dlg_branch_item_default", [data.sequenceName]) : data.sequenceName; + } + private function removeCondition(c:ToolOutputCondition) { var indexList:Array = new Array(); @@ -312,5 +318,9 @@ public function set branchingActivity(a:BranchingActivity) { _branchingActivity = a; } + + public function get branchingActivity():BranchingActivity { + return _branchingActivity; + } } \ No newline at end of file Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Canvas.as =================================================================== diff -u -r9725ee226daea1498ca7b06896baa4416966f678 -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Canvas.as (.../Canvas.as) (revision 9725ee226daea1498ca7b06896baa4416966f678) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/Canvas.as (.../Canvas.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -206,20 +206,21 @@ } 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'); + _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 callback:Function = Proxy.create(this,onStoreDesignResponse); - + Application.getInstance().getComms().sendAndReceive(dto,"servlet/authoring/storeLearningDesignDetails",callback,false); - } + } return true; } @@ -267,6 +268,8 @@ ApplicationParent.extCall("setSaved", "true"); LFMenuBar.getInstance().enableExport(true); + LFMenuBar.getInstance().enableInsertDesign(true); + Debugger.log('_ddm.learningDesignID:'+_ddm.learningDesignID,Debugger.GEN,'onStoreDesignResponse','Canvas'); @@ -464,19 +467,19 @@ * Opens a design using workspace and user to select design ID * passes the callback function to recieve selected ID */ - public function openDesignBySelection(){ + public function openDesignBySelection(mode:String){ //Work space opens dialog and user will select view - if(_ddm.modified){ - LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doOpenDesignBySelection), null); + if(_ddm.modified || (mode == Workspace.MODE_INSERT && _ddm.modified && (_ddm.learningDesignID != null))) { + LFMessage.showMessageConfirm(Dictionary.getValue('cv_design_unsaved'), Proxy.create(this,doOpenDesignBySelection, mode), null); } else { - doOpenDesignBySelection(); + doOpenDesignBySelection(mode); } } - public function doOpenDesignBySelection():Void{ + public function doOpenDesignBySelection(mode:String):Void{ var callback:Function = Proxy.create(this, openDesignById); var ws = Application.getInstance().getWorkspace(); - ws.userSelectItem(callback); + ws.userSelectItem(callback, mode); } /** @@ -488,13 +491,45 @@ public function openDesignById(workspaceResultDTO:Object){ Application.getInstance().getWorkspace().getWV().clearDialog(); ObjectUtils.toString(workspaceResultDTO); + var designId:Number = workspaceResultDTO.selectedResourceID; - - var callback:Function = Proxy.create(this,setDesign); - Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+designId,callback, false); - + 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); + + 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 * @@ -504,7 +539,7 @@ */ public function openDesignByImport(learningDesignID:Number){ - var callback:Function = Proxy.create(this,setDesign, true); + var callback:Function = Proxy.create(this, setDesign, true); canvasModel.importing = true; Application.getInstance().getComms().getRequest('authoring/author.do?method=getLearningDesignDetails&learningDesignID='+learningDesignID,callback, false); Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasHelper.as =================================================================== diff -u -ra9608549c199d2aae45ee7729e4536f6545afe94 -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasHelper.as (.../CanvasHelper.as) (revision a9608549c199d2aae45ee7729e4536f6545afe94) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasHelper.as (.../CanvasHelper.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -156,8 +156,10 @@ checkReadOnlyDesign(); canvasModel.setDesignTitle(); canvasModel.lastBranchActionType = CanvasModel.OPEN_FROM_FILE; - canvasModel.setDirty(); - LFMenuBar.getInstance().enableExport(!canvasModel.autoSaveWait); + canvasModel.setDirty(); + + 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'); @@ -684,8 +686,8 @@ } private function setNewContentFolderID(o:Object) { - app.toolkit.model.broadcastLibraryUpdate(); - + app.toolkit.model.broadcastLibraryUpdate(); + if(o instanceof LFError){ o.showMessageConfirm(); }else{ Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasSuperModel.as =================================================================== diff -u -r29e9fbba3cd3b61650ccec4fd7601b72d5bc747b -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasSuperModel.as (.../CanvasSuperModel.as) (revision 29e9fbba3cd3b61650ccec4fd7601b72d5bc747b) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasSuperModel.as (.../CanvasSuperModel.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -621,8 +621,10 @@ if(getCanvas().ddm.learningDesignID == undefined){ LFMenuBar.getInstance().enableExport(false); + LFMenuBar.getInstance().enableInsertDesign(false); } else { LFMenuBar.getInstance().enableExport(true); + LFMenuBar.getInstance().enableInsertDesign(true); } if(_doRefresh) refreshDesign(); Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMenuBar.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMenuBar.as (.../LFMenuBar.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMenuBar.as (.../LFMenuBar.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -140,11 +140,14 @@ 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 { @@ -299,6 +302,10 @@ 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(); @@ -444,8 +451,12 @@ } } + public function enableInsertDesign(enable:Boolean){ + file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(6), enable); + } + public function enableExport(enable:Boolean){ - file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(7), enable); + file_menu.setMenuItemEnabled(file_menu.getMenuItemAt(9), enable); } public function enableSave(enable:Boolean){ Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/Workspace.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/Workspace.as (.../Workspace.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/Workspace.as (.../Workspace.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -41,6 +41,7 @@ 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; @@ -277,20 +278,20 @@ * Usually used by the canvas. * */ - public function userSelectItem(callback){ + public function userSelectItem(callback, mode){ _onOKCallBack = callback; //var fn:Function = Delegate.create(this,itemSelected); - workspaceModel.currentMode = "OPEN"; + 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){ + public function userSelectDesign(callback, mode){ _onOKCallBack = callback; - workspaceModel.currentMode = "READONLY"; + workspaceModel.currentMode = (mode != null) ? mode : "READONLY"; workspaceModel.openDesignBySelection(); } Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as =================================================================== diff -u -r60e8ee7490502e0d9338ed1958ec14a57dfc043c -rb3d9e6021b71dcb7f55a13a2508e80a21141baf9 --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as (.../WorkspaceDialog.as) (revision 60e8ee7490502e0d9338ed1958ec14a57dfc043c) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as (.../WorkspaceDialog.as) (revision b3d9e6021b71dcb7f55a13a2508e80a21141baf9) @@ -283,7 +283,7 @@ refreshFolder(event.data, wm); break; case 'SHOW_TAB' : - showTab(event.data,wm); + showTab(event.data, wm); break; case 'UPDATED_PROP_DETAILS' : populatePropDetails(event.data, wm); @@ -395,7 +395,7 @@ } private function removeProps(wm:WorkspaceModel):Void{ - if (wm.currentMode == Workspace.MODE_OPEN){ + if (wm.currentMode == Workspace.MODE_OPEN || wm.currentMode == Workspace.MODE_INSERT){ switchView_tab.removeItemAt(1) } @@ -605,7 +605,7 @@ setLocationContentVisible(true); setPropertiesContentVisible(false); //setTabIndex("LOCATION"); - if(wm.currentMode=="OPEN"){ + if(wm.currentMode==Workspace.MODE_OPEN){ licenseID_cmb.enabled = true; } _currentTab = LOCATION_TAB; @@ -615,20 +615,22 @@ }else if(tabToSelect == "PROPERTIES"){ setLocationContentVisible(false); setPropertiesContentVisible(true); - if(wm.currentMode=="OPEN"){ + if(wm.currentMode==Workspace.MODE_OPEN){ licenseID_cmb.enabled = false; } //setTabIndex("PROPERTIES"); _currentTab = PROP_TAB; } //set the right label on the 'doit' button - if(wm.currentMode=="OPEN"){ + if(wm.currentMode==Workspace.MODE_OPEN){ ok_btn.label = Dictionary.getValue('ws_dlg_open_btn'); //licenseID_cmb.enabled = false; - }else if(wm.currentMode=="SAVE" || wm.currentMode=="SAVEAS"){ + }else if(wm.currentMode == Workspace.MODE_INSERT){ + ok_btn.label = Dictionary.getValue("ws_dlg_insert_btn"); + }else if(wm.currentMode==Workspace.MODE_SAVE || wm.currentMode==Workspace.MODE_SAVEAS){ ok_btn.label = Dictionary.getValue('ws_dlg_save_btn'); - }else if(wm.currentMode=="READONLY"){ + }else if(wm.currentMode==Workspace.MODE_READONLY){ ok_btn.label = "Create" //Dictionary.getValue('ws_dlg_create_btn'); }else{ Debugger.log('Dont know what mode the Workspace is in!',Debugger.CRITICAL,'showTab','org.lamsfoundation.lams.ws.WorkspaceDialog'); @@ -760,7 +762,7 @@ Debugger.log('_workspaceModel.currentMode: ' + _workspaceModel.currentMode,Debugger.GEN,'ok','org.lamsfoundation.lams.WorkspaceDialog'); var tempTitle = StringUtils.replace(resourceTitle_txi.text, " ", ""); - if(_workspaceModel.currentMode=="SAVE" || _workspaceModel.currentMode=="SAVEAS"){ + if(_workspaceModel.currentMode==Workspace.MODE_SAVE || _workspaceModel.currentMode==Workspace.MODE_SAVEAS){ if (tempTitle == "" || tempTitle == undefined){ Cursor.showCursor(ApplicationParent.C_DEFAULT);