Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java =================================================================== diff -u -r51fb2a37254f24bb2a805d4ffd54482c779f43fa -r6b31542dce245021851c959056022b32a7f9033d --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 51fb2a37254f24bb2a805d4ffd54482c779f43fa) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 6b31542dce245021851c959056022b32a7f9033d) @@ -324,24 +324,13 @@ if (learningDesign != null) { Long learningDesignID = learningDesign.getLearningDesignId(); if (learningDesignID != null) { + responseJSON.put("learningDesignID", learningDesignID); + Gson gson = new GsonBuilder().create(); Vector validationDTOs = getAuthoringService() .validateLearningDesign(learningDesignID); String validationJSON = gson.toJson(validationDTOs); responseJSON.put("validation", new JSONArray(validationJSON)); - - // get DTO with updated IDs - LearningDesignDTO learningDesignDTO = getLearningDesignService().getLearningDesignDTO(learningDesignID, - getUserLanguage()); - responseJSON.put("ld", new JSONObject(gson.toJson(learningDesignDTO))); - - Integer userId = getUserId(); - getAuthoringService().storeLearningDesignAccess(learningDesignID, userId); - - List accessList = getAuthoringService().updateLearningDesignAccessByUser(userId); - accessList = accessList.subList(0, - Math.min(accessList.size(), AuthoringAction.LEARNING_DESIGN_ACCESS_ENTRIES_LIMIT - 1)); - responseJSON.put("access", new JSONArray(gson.toJson(accessList))); } } Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js =================================================================== diff -u -r4d3af828efc07b319233005dd114a0342a421773 -r6b31542dce245021851c959056022b32a7f9033d --- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 4d3af828efc07b319233005dd114a0342a421773) +++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 6b31542dce245021851c959056022b32a7f9033d) @@ -654,6 +654,7 @@ var result = GeneralLib.saveLearningDesign(folderID, learningDesignID, title); if (result) { + GeneralLib.openLearningDesign(); dialog.dialog('close'); } } @@ -1430,10 +1431,13 @@ * Replace current canvas contents with the loaded sequence. */ openLearningDesign : function(learningDesignID) { + if (!learningDesignID){ + // do just a re-load + learningDesignID = layout.ld.learningDesignID; + } // get LD details $.ajax({ cache : false, - async : false, url : LAMS_URL + "authoring/author.do", dataType : 'json', data : { @@ -1453,7 +1457,7 @@ // remove existing activities GeneralLib.newLearningDesign(true, true); layout.ld = { - 'learningDesignID' : learningDesignID, + 'learningDesignID' : ld.learningDesignID, 'folderID' : ld.workspaceFolderID, 'contentFolderID' : ld.contentFolderID, 'title' : ld.title, @@ -2506,71 +2510,10 @@ } // if save (even partially) was successful - if (response.ld) { + if (response.learningDesignID) { // assing the database-generated values - layout.ld.learningDesignID = response.ld.learningDesignID; - if (!layout.ld.contentFolderID) { - layout.ld.contentFolderID = response.ld.contentFolderID; - } - $('#ldDescriptionFieldTitle').html(GeneralLib.escapeHtml(title)); + layout.ld.learningDesignID = response.learningDesignID; - // assign database-generated properties to activities - $.each(response.ld.activities, function() { - var updatedActivity = this; - $.each(layout.activities, function(){ - var isBranching = this instanceof ActivityDefs.BranchingEdgeActivity, - found = false; - if (isBranching && !this.isStart) { - return true; - } - - if (isBranching) { - if (updatedActivity.activityUIID == this.branchingActivity.uiid){ - this.branchingActivity.id = updatedActivity.activityID; - found = true; - } else { - $.each(this.branchingActivity.branches, function(){ - if (updatedActivity.activityUIID == this.branchingActivity.uiid){ - this.id = updatedActivity.activityID; - } - }); - } - } else if (updatedActivity.activityUIID == this.uiid) { - this.id = updatedActivity.activityID; - this.toolContentID = updatedActivity.toolContentID; - found = true; - } - - // update transition IDs - $.each(this.transitions.from, function(){ - var existingTransition = this; - $.each(response.ld.transitions, function(){ - if (existingTransition.uiid == +this.transitionUIID) { - existingTransition.id = +this.transitionID || null; - return false; - } - }); - }); - - return !found; - }); - }); - - if (layout.floatingActivity) { - layout.floatingActivity.id = response.floatingActivityID; - } - - // update annotation IDs - $.each(response.ld.annotations, function(){ - var updatedAnnotation = this; - $.each(layout.labels.concat(layout.regions), function(){ - if (this.uiid == updatedAnnotation.annotationUIID) { - this.id = updatedAnnotation.uid; - return false; - } - }); - }); - if (layout.liveEdit) { // let backend know that system gate needs to be removed $.ajax({ @@ -2630,24 +2573,20 @@ var svgSaveSuccessful = GeneralLib.saveLearningDesignImage(); if (!svgSaveSuccessful) { alert(LABELS.SVG_SAVE_ERROR); - return; } if (response.validation.length == 0) { alert(LABELS.SAVE_SUCCESSFUL); } - result = true; GeneralLib.setModified(false); + result = true; } - - GeneralLib.updateAccess(response.access); }, error : function(){ alert(LABELS.SEQUENCE_SAVE_ERROR); } }); - return result; },