Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -raead34144651a924f76d7bca8645327e6820d226 -r035853516626933d59e2473b4410b1dc54bb023e Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== diff -u -r8727b63f3edb448cd2cb115d4ed6138685e54403 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 8727b63f3edb448cd2cb115d4ed6138685e54403) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -60,6 +60,7 @@ import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.GroupingActivity; import org.lamsfoundation.lams.learningdesign.LearningDesign; +import org.lamsfoundation.lams.learningdesign.LearningDesignAccess; import org.lamsfoundation.lams.learningdesign.License; import org.lamsfoundation.lams.learningdesign.SequenceActivity; import org.lamsfoundation.lams.learningdesign.ToolActivity; @@ -2022,4 +2023,21 @@ } return authorUrl; } + + public List getLearningDesignAccessByUser(Integer userId) { + List accessList = learningDesignDAO.getAccessByUser(userId); + for (LearningDesignAccess access : accessList) { + LearningDesign learningDesign = learningDesignDAO.getLearningDesignById(access.getLearningDesignId()); + access.setTitle(learningDesign.getTitle()); + } + return accessList; + } + + public void storeLearningDesignAccess(Long learningDesignId, Integer userId) { + LearningDesignAccess access = new LearningDesignAccess(); + access.setLearningDesignId(learningDesignId); + access.setUserId(userId); + access.setAccessDate(new Date()); + learningDesignDAO.insertOrUpdate(access); + } } \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java =================================================================== diff -u -rdded08ea618c437f0f0f6424c6b1bbf54abe5bd7 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision dded08ea618c437f0f0f6424c6b1bbf54abe5bd7) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -35,6 +35,7 @@ import org.lamsfoundation.lams.learningdesign.GateActivity; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.LearningDesign; +import org.lamsfoundation.lams.learningdesign.LearningDesignAccess; import org.lamsfoundation.lams.learningdesign.dto.AuthoringActivityDTO; import org.lamsfoundation.lams.learningdesign.dto.ValidationErrorDTO; import org.lamsfoundation.lams.learningdesign.exception.LearningDesignException; @@ -387,4 +388,8 @@ public Long insertSingleActivityLearningDesign(String learningDesignTitle, Long toolID, Long toolContentID, String contentFolderID, Integer organisationID); + + public List getLearningDesignAccessByUser(Integer userId); + + public void storeLearningDesignAccess(Long learningDesignId, Integer userId); } \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java =================================================================== diff -u -r0144e9d0f7fc574a887933024183a8a9049bc414 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -25,7 +25,6 @@ import java.io.IOException; import java.io.PrintWriter; -import java.io.Writer; import java.text.ParseException; import java.util.LinkedList; import java.util.List; @@ -47,7 +46,6 @@ import org.lamsfoundation.lams.authoring.ObjectExtractorException; import org.lamsfoundation.lams.authoring.service.IAuthoringService; import org.lamsfoundation.lams.learningdesign.LearningDesign; -import org.lamsfoundation.lams.learningdesign.dto.AuthoringActivityDTO; import org.lamsfoundation.lams.learningdesign.dto.LearningDesignDTO; import org.lamsfoundation.lams.learningdesign.dto.LicenseDTO; import org.lamsfoundation.lams.learningdesign.dto.ValidationErrorDTO; @@ -113,6 +111,10 @@ HttpServletResponse response) throws IOException { request.setAttribute("tools", getLearningDesignService().getToolDTOs(true, request.getRemoteUser())); request.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID, FileUtil.generateUniqueContentFolderID()); + + Gson gson = new GsonBuilder().create(); + String access = gson.toJson(getAuthoringService().getLearningDesignAccessByUser(getUserId())); + request.setAttribute("access", access); return mapping.findForward("openAutoring"); } @@ -171,18 +173,21 @@ return outputPacket(mapping, request, response, wddxPacket, "details"); } - public ActionForward getLearningDesignJSON(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - JSONObject responseJSON = new JSONObject(); - + public ActionForward openLearningDesign(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException, JSONException { long learningDesignID = WebUtil.readLongParam(request, AttributeNames.PARAM_LEARNINGDESIGN_ID); LearningDesignDTO learningDesignDTO = getLearningDesignService().getLearningDesignDTO(learningDesignID, getUserLanguage()); + Integer userId = getUserId(); + getAuthoringService().storeLearningDesignAccess(learningDesignID, userId); + response.setContentType("application/json;charset=utf-8"); - Writer responseWriter = response.getWriter(); + JSONObject responseJSON = new JSONObject(); Gson gson = new GsonBuilder().create(); - gson.toJson(learningDesignDTO, responseWriter); + responseJSON.put("ld", new JSONObject(gson.toJson(learningDesignDTO))); + responseJSON.put("access", new JSONArray(gson.toJson(getAuthoringService().getLearningDesignAccessByUser(userId)))); + response.getWriter().write(responseJSON.toString()); return null; } @@ -470,6 +475,10 @@ LearningDesignDTO learningDesignDTO = getLearningDesignService().getLearningDesignDTO(learningDesignID, getUserLanguage()); responseJSON.put("ld", new JSONObject(gson.toJson(learningDesignDTO))); + + Integer userId = getUserId(); + getAuthoringService().storeLearningDesignAccess(learningDesignID, userId); + responseJSON.put("access", new JSONArray(gson.toJson(getAuthoringService().getLearningDesignAccessByUser(userId)))); } } Index: lams_central/web/author2.jsp =================================================================== diff -u -r0c6420bdd69cc98d068e5a8124a599548f68c753 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/web/author2.jsp (.../author2.jsp) (revision 0c6420bdd69cc98d068e5a8124a599548f68c753) +++ lams_central/web/author2.jsp (.../author2.jsp) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -35,7 +35,9 @@ @@ -188,8 +190,8 @@ - - Recently used sequences + +
Recently used sequences
Index: lams_central/web/css/authoring.css =================================================================== diff -u -r1c59101cfa996a1cfdf296191fa297e60b70218f -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/web/css/authoring.css (.../authoring.css) (revision 1c59101cfa996a1cfdf296191fa297e60b70218f) +++ lams_central/web/css/authoring.css (.../authoring.css) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -79,17 +79,26 @@ overflow: auto; } -div#ldStoreDialog #ldStoreDialogRecentlyUsedCell { +div#ldStoreDialog #ldStoreDialogAccessCell { height: 200px; vertical-align: top; border-top: thin dotted #2E6E9E; border-right: thin dotted #2E6E9E; padding: 5px 0px 5px 0px; +} + +div#ldStoreDialog #ldStoreDialogAccessCell > div#ldStoreDialogAccessTitle { font-size: 11px; font-weight: bold; text-align: center; } +div#ldStoreDialog #ldStoreDialogAccessCell > div.access { + padding-top: 5px; + cursor: pointer; +} + + div#ldStoreDialog td#ldStoreDialogCanvasCell { text-align: center; padding: 10px 0px 0px 10px; Index: lams_central/web/includes/javascript/authoring/authoringActivity.js =================================================================== diff -u -r0c6420bdd69cc98d068e5a8124a599548f68c753 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 0c6420bdd69cc98d068e5a8124a599548f68c753) +++ lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -283,25 +283,26 @@ } // create activity SVG elements - paper.setStart(); + this.items = paper.set(); var shape = paper.path(Raphael.format('M {0} {1}' + layout.defs.activity, x, y)) .attr({ 'fill' : layout.colors.activity[layout.toolMetadata[this.learningLibraryID].activityCategoryID] }); - // check for icon in the library - paper.image(layout.toolMetadata[this.learningLibraryID].iconPath, x + 47, y + 2, 30, 30); - paper.text(x + 62, y + 40, ActivityLib.shortenActivityTitle(this.title)) - .attr({ - 'fill' : layout.colors.activityText - }); - - this.items = paper.setFinish(); + this.items.shape = shape; + this.items.push(shape); if (this.grouping) { ActivityLib.addGroupingEffect(this); } + // check for icon in the library + this.items.push(paper.image(layout.toolMetadata[this.learningLibraryID].iconPath, x + 47, y + 2, 30, 30)); + this.items.push(paper.text(x + 62, y + 40, ActivityLib.shortenActivityTitle(this.title)) + .attr({ + 'fill' : layout.colors.activityText + })); + ActivityLib.activityHandlersInit(this); }, @@ -883,8 +884,9 @@ activityBox.height) .attr({ 'fill' : shape.attr('fill') - }) - .toBack(); + }); + + shape.toFront(); activity.items.push(activity.items.groupingEffect); // this is needed, for some reason, otherwise the activity can not be selected Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js =================================================================== diff -u -r0c6420bdd69cc98d068e5a8124a599548f68c753 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 0c6420bdd69cc98d068e5a8124a599548f68c753) +++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -74,6 +74,7 @@ 'B0C4DE', 'FFE4E1', 'FF4500', 'EE82EE'], 'optionalActivity' : 'rgb(194,213,254)' }, + maxAccessEntries : 7 }; @@ -257,6 +258,7 @@ 'height' : 785, 'draggable' : false, 'buttonsLoad' : [ + closeLdStoreDialogButton, { 'text' : 'Open', 'click' : function() { @@ -272,11 +274,11 @@ dialog.dialog('close'); openLearningDesign(ldNode.data.learningDesignId); } - }, - closeLdStoreDialogButton + } ], 'buttonsSave' : [ + closeLdStoreDialogButton, { 'text' : 'Save', 'click' : function() { @@ -321,8 +323,7 @@ dialog.dialog('close'); } } - }, - closeLdStoreDialogButton + } ], 'open' : function(){ var nameContainer = $('#ldStoreDialogNameContainer'); @@ -391,6 +392,8 @@ } }); tree.subscribe('clickEvent', tree.onEventToggleHighlight); + + updateAccess(initAccess); // initialise a small info dialog layout.items.infoDialog = $('
').attr('id', 'infoDialog').dialog({ @@ -423,15 +426,17 @@ url : LAMS_URL + "authoring/author.do", dataType : 'json', data : { - 'method' : 'getLearningDesignJSON', + 'method' : 'openLearningDesign', 'learningDesignID': learningDesignID }, - success : function(ld) { - if (!ld) { + success : function(response) { + if (!response) { alert('Error while loading sequence'); return; } + var ld = response.ld; + // remove existing activities MenuLib.newLearningDesign(true, true); layout.ld = { @@ -839,6 +844,7 @@ } setModified(false); + updateAccess(response.access); } }); } @@ -1247,6 +1253,8 @@ result = true; } } + + updateAccess(response.access); }, error : function(){ alert('Error while saving the sequence'); @@ -1338,4 +1346,19 @@ .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); +} + + +function updateAccess(access){ + var accessCell = $('#ldStoreDialogAccessCell'); + accessCell.children('div.access').remove(); + $.each(access, function(index){ + if (index >= layout.maxAccessEntries) { + return false; + } + $('
').addClass('access') + .attr('learningDesignId', this.learningDesignId) + .text(this.title) + .appendTo(accessCell); + }); } \ No newline at end of file Index: lams_central/web/includes/javascript/authoring/authoringProperty.js =================================================================== diff -u -r0c6420bdd69cc98d068e5a8124a599548f68c753 -r035853516626933d59e2473b4410b1dc54bb023e --- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 0c6420bdd69cc98d068e5a8124a599548f68c753) +++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 035853516626933d59e2473b4410b1dc54bb023e) @@ -230,7 +230,9 @@ content = activity.propertiesContent = $('#propertiesContentTool').clone().attr('id', null) .show().data('parentObject', activity); $('.propertiesContentFieldTitle', content).val(activity.title); - $('.propertiesContentFieldGrouping', content).closest('tr').remove(); + if (!allowsGrouping) { + $('.propertiesContentFieldGrouping', content).closest('tr').remove(); + } $('input, select', content).change(function(){ // extract changed properties and redraw the activity @@ -266,7 +268,7 @@ } if (allowsGrouping){ - PropertyLib.fillGroupingDropdown(content, activity.grouping); + PropertyLib.fillGroupingDropdown(activity, activity.grouping); } }, @@ -458,7 +460,7 @@ fillWidgetsFunction = function(){ $('.propertiesContentFieldTitle', content).val(activity.branchingActivity.title); $('.propertiesContentFieldBranchingType', content).val(activity.branchingActivity.branchingType); - PropertyLib.fillGroupingDropdown(content, activity.branchingActivity.grouping); + PropertyLib.fillGroupingDropdown(activity, activity.branchingActivity.grouping); PropertyLib.fillToolInputDropdown(content, activity.branchingActivity.input); $('.propertiesContentFieldOptionalSequenceMin', content).spinner('value', @@ -609,7 +611,7 @@ }); } - PropertyLib.fillGroupingDropdown(content, activity.grouping); + PropertyLib.fillGroupingDropdown(activity, activity.grouping); }, @@ -773,25 +775,48 @@ /** * Find all groupings on canvas and fill dropdown menu with their titles */ - fillGroupingDropdown : function(content, grouping) { + fillGroupingDropdown : function(activity, grouping) { // find all groupings on canvas and fill dropdown menu with their titles - var emptyOption = $('