Index: lams_central/web/addLesson.jsp =================================================================== diff -u -re6dc4db4137cfd6b07a4aa79711b9d12b39fb78e -r23096623cbfaccffc0b32c9090ab463539a173c8 --- lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision e6dc4db4137cfd6b07a4aa79711b9d12b39fb78e) +++ lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision 23096623cbfaccffc0b32c9090ab463539a173c8) @@ -74,6 +74,9 @@
+
+
+
Index: lams_central/web/css/addLesson.scss =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r23096623cbfaccffc0b32c9090ab463539a173c8 --- lams_central/web/css/addLesson.scss (.../addLesson.scss) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_central/web/css/addLesson.scss (.../addLesson.scss) (revision 23096623cbfaccffc0b32c9090ab463539a173c8) @@ -56,12 +56,36 @@ div#learningDesignTree { overflow: auto; - height: 510px; + height: 360px; width: 250px; padding: 2px 2px 0px 5px; vertical-align: top; } +div#accessDiv { + border-top: $border-thin-dotted; + overflow: auto; + height: 150px; + vertical-align: top; + padding: 5px 0px 5px 0px; +} + +div#accessDiv > div#accessTitle { + font-size: 13px; + font-weight: bold; + text-align: center; +} + +div#accessDiv .access { + cursor: pointer; + padding: 10px 15px; +} + +div#accessDiv .access-selected { + background-color: #428bca; + color: #FFFFFF; +} + td#canvasControlCell { padding: 2px 0px 0px 10px; height: 15px; Index: lams_central/web/includes/javascript/addLesson.js =================================================================== diff -u -ra65568cc36db07abf19550359c0db03a9561c964 -r23096623cbfaccffc0b32c9090ab463539a173c8 --- lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision a65568cc36db07abf19550359c0db03a9561c964) +++ lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 23096623cbfaccffc0b32c9090ab463539a173c8) @@ -25,6 +25,9 @@ ldTreeview.init('#learningDesignTree', function(event, node) { + // deselect LD if highlighted in "recently used sequences" section + $('div#accessDiv .access-selected').removeClass('access-selected'); + // hide existing LD image $('.ldChoiceDependentCanvasElement').css('display', 'none'); @@ -61,6 +64,8 @@ addLesson(); } }); + + loadRecentlyAccessedLearningDesigns(); } //checks whether element is visible in the current viewport @@ -293,7 +298,11 @@ if (!learningDesignId) { var ldNode = tree.treeview('getSelected')[0]; - learningDesignId = ldNode.learningDesignId; + if (ldNode == null) { + learningDesignId = +$('div#accessDiv .access-selected').data('learningDesignId'); + } else { + learningDesignId = ldNode.learningDesignId; + } } if (!learningDesignId) { @@ -548,6 +557,61 @@ } } +function loadRecentlyAccessedLearningDesigns(){ + var access = null; + $.ajax({ + cache : false, + async : false, + url : LAMS_URL + "authoring/getLearningDesignAccess.do", + dataType : 'json', + data : { + }, + success : function(response) { + access = response; + } + }); + + + if (access) { + var accessCell = $('#accessDiv'); + accessCell.children('div.access').remove(); + $.each(access, function(){ + $('
').addClass('access') + .data({ + 'title' : this.title, + 'learningDesignId' : this.learningDesignId, + 'folderID' : this.workspaceFolderId + }) + .text(this.title) + .appendTo(accessCell) + .click(function(){ + // deselect LD in main tree + var selectedNode = tree.treeview('getSelected')[0]; + if (selectedNode != null) { + tree.treeview('unselectNode', selectedNode); + } + // deselect node in access list + $('.access-selected', accessCell).removeClass('access-selected'); + + // select clicked node + var accessEntry = $(this).addClass('access-selected'), + learningDesignID = +accessEntry.data('learningDesignId'); + + // hide existing LD image + $('.ldChoiceDependentCanvasElement').css('display', 'none'); + + $('#lessonNameInput').val(accessEntry.data('title')); + //focus element only if it's visible in the current viewport (to avoid unwanted scrolling) + if (isElementInViewport($('#lessonNameInput'))) { + $('#lessonNameInput').focus(); + } + // display "loading" animation and finally LD thumbnail + loadLearningDesignSVG(learningDesignID); + }); + }); + } +} + // ********** CLASS TAB FUNCTIONS ********** function fillUserContainer(users, containerId) {