Index: lams_central/web/includes/javascript/groups.js =================================================================== diff -u -rfe19797ec82718905555353176ed719bec11043e -r7637b352c01f94b65f3f0eabc258ab4bd759bcd9 --- lams_central/web/includes/javascript/groups.js (.../groups.js) (revision fe19797ec82718905555353176ed719bec11043e) +++ lams_central/web/includes/javascript/groups.js (.../groups.js) (revision 7637b352c01f94b65f3f0eabc258ab4bd759bcd9) @@ -18,22 +18,22 @@ }); // after initial group creation, all new groups will be created on server skipAssigningWhenCreatingGroup = false; - + // initialisation based on mode if (!lessonMode) { $('#groupingName').val(grouping.name); - + // ability to save a grouping on pressing the Enter key in the name input field $('#groupingName').on('keyup', function (e) { //remove alert class if it was applied $("#grouping-name-blank-error,#grouping-name-non-unique-error").addClass('d-none'); - - if (e.keyCode == 13) { + + if (e.keyCode == 13) { saveGroups(); - } + } }); } - + // allow adding new groups $('#newGroupPlaceholder').click(function(){ // the label is "Group X" where X is the top group number @@ -47,13 +47,13 @@ */ function addGroup(groupId, name, users) { var group = $('#groupTemplate').clone() - .attr({ - // remove template's HTML ID - 'id' : null, - 'groupId' : groupId - }) - .removeClass('d-none'); - + .attr({ + // remove template's HTML ID + 'id' : null, + 'groupId' : groupId + }) + .removeClass('d-none'); + var groupNameFields = $('#groupsCell .groupContainer input'); var groupTopIndex = groupNameFields.length; // names can be blank in course groups, @@ -75,23 +75,25 @@ name = LABELS.GROUP_PREFIX_LABEL + ' ' + groupTopIndex; } } while (!nameIsUnique); - + group.find('input').val(name); - + var newGroupPlaceholder = $('#newGroupPlaceholder'); if (newGroupPlaceholder.length > 0) { group.insertBefore(newGroupPlaceholder); } else { // there is no placeholder in read-only mode $('#groupsCell').append(group); } - + fillGroup(users, group); - + // if any users are allocated, warn before doing spreadsheet reload if ( users && users.length > 0 ) warnBeforeUpload = true; + $('#unassignedUserCell .userContainer').css('max-height', Math.max(845, $('#groupsCell').height() - 50) + 'px'); + return group; } @@ -102,83 +104,86 @@ function fillGroup(users, container) { // make calls to server or just create users in HTML var createOnServer = lessonMode && !skipAssigningWhenCreatingGroup - && container.attr('id') != 'unassignedUserCell'; + && container.attr('id') != 'unassignedUserCell'; if (users) { var userDivs = [], userIds = []; // create user DIVs + users = users.concat(users); + users = users.concat(users); + users = users.concat(users); $.each(users, function(index, userJSON) { var userDiv = $('
') .attr('userId', userJSON.id) .addClass('draggableItem'); - + new bootstrap.Tooltip(userDiv, { 'title' : userJSON.login, 'placement' : 'left' }); - + var portraitDiv = $('').attr({ 'id': 'portrait-'+userJSON.id, - }) + }) .addClass('mb-2') .appendTo(userDiv); addPortrait(portraitDiv, userJSON.portraitId, userJSON.id, 'small', true, LAMS_URL ); $('').text(userJSON.firstName + ' ' + userJSON.lastName) .addClass('portrait-sm-lineheight ms-1') .appendTo(userDiv); - + // for later use userDivs.push(userDiv); userIds.push(userJSON.id); - - userDiv.draggable({ - 'appendTo' : 'body', - 'containment' : '#groupsTable', - 'revert' : 'invalid', - 'distance' : 20, - 'scroll' : true, - 'scrollSensitivity' : 120, - 'scrollSpeed' : 100, - 'cursor' : 'move', - 'helper' : function(event){ - // include the user from which dragging started - $(this).addClass('draggableSelected'); - - // copy selected users - var helperContainer = $(''); - $(this).siblings('.draggableSelected').addBack().each(function(){ - $(this).clone().appendTo(helperContainer); - }); - return helperContainer; - } - }) - + + userDiv.draggable({ + 'appendTo' : 'body', + 'containment' : '#groupsTable', + 'revert' : 'invalid', + 'distance' : 20, + 'scroll' : true, + 'scrollSensitivity' : 120, + 'scrollSpeed' : 100, + 'cursor' : 'move', + 'helper' : function(event){ + // include the user from which dragging started + $(this).addClass('draggableSelected'); + + // copy selected users + var helperContainer = $(''); + $(this).siblings('.draggableSelected').addBack().each(function(){ + $(this).clone().appendTo(helperContainer); + }); + return helperContainer; + } + }) + .click(function(event){ var wasSelected = $(this).hasClass('draggableSelected'); var parentId = $(this).parent().parent().attr('id'); // this is needed for shift+click var lastSelectedUser = lastSelectedUsers[parentId]; - + if (event.shiftKey && lastSelectedUser && lastSelectedUser != this) { // clear current selection $(this).siblings().addBack().removeClass('draggableSelected'); - + // find range of users to select var lastSelectedIndex = $(lastSelectedUser).index(); var index = $(this).index(); - + var startingElem = lastSelectedIndex > index ? this : lastSelectedUser; var endingElem = lastSelectedIndex > index ? lastSelectedUser : this; - + $(startingElem).nextUntil(endingElem).addBack().add(endingElem) .addClass('draggableSelected'); } else { if (!event.ctrlKey) { // clear current sleection $(this).siblings().addBack().removeClass('draggableSelected'); } - + if (wasSelected && !event.shiftKey){ $(this).removeClass('draggableSelected'); lastSelectedUsers[parentId] = null; @@ -188,12 +193,12 @@ } } }); - + if (!createOnServer) { $('.userContainer', container).append(userDiv); } }); - + if (createOnServer) { // copy course groups as lesson groups, creating new instances if (assignUsersToGroup(userIds, container)) { @@ -203,53 +208,53 @@ $('#unassignedUserCell .userContainer').append(userDivs); } } - + sortUsers(container); } else if (createOnServer) { // just createa an empty group assignUsersToGroup(null, container); } - + $('.sortUsersButton', container).click(function(){ sortUsers(container); }); - + $(container).droppable({ - 'activeClass' : 'droppableHighlight', - 'tolerance' : 'pointer', - 'drop' : function (event, ui) { - var draggableUserContainer = $(ui.draggable).parent(); - var thisUserContainer = $('.userContainer', this); - // do not do anything if it is the same container - // using "accept" feature breaks the layout - if (draggableUserContainer[0] != thisUserContainer[0]) { - var executeDrop = !lessonMode; - if (!executeDrop) { - var transferToLocked = $(this).hasClass('locked'); - // make sure user wants to transfer learners to a group which is already in use - executeDrop = !transferToLocked || confirm(LABELS.TRANSFER_LOCKED_LABEL); - if (executeDrop) { - var userIds = []; - $('div.draggableSelected', draggableUserContainer).each(function(){ - userIds.push($(this).attr('userId')); - }); - // execute transfer on server side - executeDrop = assignUsersToGroup(userIds, $(this)); - } - } - - if (executeDrop) { - transferUsers(draggableUserContainer, thisUserContainer); - } - } - } + 'activeClass' : 'droppableHighlight', + 'tolerance' : 'pointer', + 'drop' : function (event, ui) { + var draggableUserContainer = $(ui.draggable).parent(); + var thisUserContainer = $('.userContainer', this); + // do not do anything if it is the same container + // using "accept" feature breaks the layout + if (draggableUserContainer[0] != thisUserContainer[0]) { + var executeDrop = !lessonMode; + if (!executeDrop) { + var transferToLocked = $(this).hasClass('locked'); + // make sure user wants to transfer learners to a group which is already in use + executeDrop = !transferToLocked || confirm(LABELS.TRANSFER_LOCKED_LABEL); + if (executeDrop) { + var userIds = []; + $('div.draggableSelected', draggableUserContainer).each(function(){ + userIds.push($(this).attr('userId')); + }); + // execute transfer on server side + executeDrop = assignUsersToGroup(userIds, $(this)); + } + } + + if (executeDrop) { + transferUsers(draggableUserContainer, thisUserContainer); + } + } + } }); - + $('.removeGroupButton', container).click(function(){ removeGroup(container); }); - + if (lessonMode) { $('input', container).blur(function(){ renameGroup(container); @@ -263,18 +268,18 @@ function transferUsers(fromContainer, toContainer) { var selectedUsers = $('.draggableSelected', fromContainer); var locked = toContainer.parent().hasClass('locked'); - if (selectedUsers.length > 0){ - // move the selected users - selectedUsers.each(function(){ - $(this).css({'top' : '0px', - 'left' : '0px', - }).removeClass('draggableSelected') - .appendTo(toContainer); - - if (locked) { - $(this).draggable('disable'); - } - }); + if (selectedUsers.length > 0){ + // move the selected users + selectedUsers.each(function(){ + $(this).css({'top' : '0px', + 'left' : '0px', + }).removeClass('draggableSelected') + .appendTo(toContainer); + + if (locked) { + $(this).draggable('disable'); + } + }); } } @@ -286,7 +291,7 @@ var users = $('div.draggableItem', container); if (users.length > 1) { var sortOrderAsc = sortOrderAscending[containerId]; - + users.each(function(){ $(this).detach(); }).sort(function(a, b){ @@ -297,7 +302,7 @@ }).each(function(){ $(this).appendTo($('.userContainer', container)); }); - + var button = container.find('.sortUsersButton'); if (sortOrderAsc) { button.html('▼'); @@ -318,14 +323,14 @@ var executeDelete = true, deleteFunction = function(){ executeDelete = !lessonMode; - + if (lessonMode) { var data = { 'activityID' : groupingActivityId, 'groupID' : groupId }; data[csrfTokenName] = csrfTokenValue; - + $.ajax({ async : false, cache : false, @@ -338,13 +343,13 @@ } }); } - + if (executeDelete) { $('#unassignedUserCell .userContainer').append($('.userContainer div.draggableItem', container)); container.remove(); } }; - + if (groupId) { executeDelete = showConfirm(LABELS.GROUP_REMOVE_LABEL, deleteFunction); } else { @@ -366,7 +371,7 @@ 'name' : nameInput.val()//groupName }; data[csrfTokenName] = csrfTokenValue; - + $.ajax({ cache : false, url : LAMS_URL + 'monitoring/grouping/changeGroupName.do', @@ -384,15 +389,15 @@ return false; } $('.errorMessage').hide(); - + var groupingName = $('#groupingName').val(); // course grouping name can not be blank if (!groupingName) { $('#grouping-name-blank-error').removeClass('d-none'); $('#groupingName').focus(); return false; } - + // course grouping name should be unique var isGroupingNameUnique = false; $.ajax({ @@ -403,24 +408,24 @@ data : { 'organisationID' : grouping.organisationId, 'name' : groupingName - }, + }, success : function(response) { isGroupingNameUnique = response.isGroupingNameUnique; } }); if ((grouping.name != groupingName) && !isGroupingNameUnique) { $('#grouping-name-non-unique-error').removeClass('d-none'); $('#groupingName').focus(); - return false; + return false; } - + // ask if removing new, empty groups is OK var acceptEmptyGroups = true; var groupContainers = $('#groupsTable .groupContainer').not('#newGroupPlaceholder'); $.each(groupContainers.not('[groupId]'), function(){ if ($('div.draggableItem', this).length == 0) { - acceptEmptyGroups = false; - return false; + acceptEmptyGroups = false; + return false; } }); if (!acceptEmptyGroups) { @@ -429,32 +434,32 @@ if (!acceptEmptyGroups) { return false; } - + var newGrouping = { - 'groupingId' : grouping.groupingId, - 'name' : groupingName, - 'groups' : [] + 'groupingId' : grouping.groupingId, + 'name' : groupingName, + 'groups' : [] }; groupContainers.each(function(){ var groupId = $(this).attr('groupId'), users = $('div.draggableItem', this); if (!groupId && users.length == 0) { return true; } - + var userIds = []; $.each(users, function(){ userIds.push($(this).attr('userId')); }); - + // add the group JSON to grouping JSON newGrouping.groups.push({ 'groupId' : groupId, 'name' : $('input', this).val(), 'users' : userIds }); }); - + $.ajax({ async : false, cache : false, @@ -487,7 +492,7 @@ 'members' : userIds ? userIds.join() : null }; data[csrfTokenName] = csrfTokenValue; - + $.ajax({ async : false, cache : false, @@ -507,7 +512,7 @@ } } }); - + return result; } @@ -545,173 +550,173 @@ width = Math.max(1093, $(window).width()); window.open(url,LABELS.GROUP_PREFIX_LABEL,'height='+height+',width='+width+',resizable,scrollbars').focus(); } -/** +/** * *************** Import groups from a spreadsheet *************** */ - function enableButtons() { - // do not disable the file button or the file will be missing on the upload. - $('.btn-disable-on-downupload').prop('disabled', false); - $('a.btn-disable-on-downupload').show(); // links must be hidden, cannot be disabled - } - function disableButtons() { - // do not disable the file button or the file will be missing on the upload. - $('.btn-disable-on-downupload').prop('disabled', true); - $('a.btn-disable-on-downupload').hide(); // links must be hidden, cannot be disabled - } - - function importGroupsFromSpreadsheet() { - disableButtons(); - var file = getValidateSpreadsheetFile(); - if ( file != null && ( !warnBeforeUpload || confirm(LABELS.WARNING_REPLACE_GROUPS_LABEL) ) ) { - var form = $("#uploadForm")[0]; - var formDataUpload = new FormData(form); - formDataUpload.append("organisationID", organisationId); - formDataUpload.append("lessonMode", lessonMode); - if ( lessonMode ) { - callImportURL(form, formDataUpload); +function enableButtons() { + // do not disable the file button or the file will be missing on the upload. + $('.btn-disable-on-downupload').prop('disabled', false); + $('a.btn-disable-on-downupload').show(); // links must be hidden, cannot be disabled +} +function disableButtons() { + // do not disable the file button or the file will be missing on the upload. + $('.btn-disable-on-downupload').prop('disabled', true); + $('a.btn-disable-on-downupload').hide(); // links must be hidden, cannot be disabled +} - } else if ( grouping && grouping.groupingId ) { - // course grouping - grouping already exists so just upload users - formDataUpload.append("groupingId", grouping.groupingId); - callImportURL(form, formDataUpload); - } else { - // New course grouping. Need to check name okay first. +function importGroupsFromSpreadsheet() { + disableButtons(); + var file = getValidateSpreadsheetFile(); + if ( file != null && ( !warnBeforeUpload || confirm(LABELS.WARNING_REPLACE_GROUPS_LABEL) ) ) { + var form = $("#uploadForm")[0]; + var formDataUpload = new FormData(form); + formDataUpload.append("organisationID", organisationId); + formDataUpload.append("lessonMode", lessonMode); + if ( lessonMode ) { + callImportURL(form, formDataUpload); - $('.errorMessage').hide(); - var groupingName = $('#groupingName').val(); - // course grouping name can not be blank - if (!groupingName) { - $('#grouping-name-blank-error').removeClass('d-none'); - $('#groupingName').focus(); - enableButtons(); - return false; - } - - // course grouping name should be unique - var isGroupingNameUnique = false; - $.ajax({ - dataType : 'json', - url : LAMS_URL + 'monitoring/grouping/checkGroupingNameUnique.do', - cache : false, - async : false, - data : { - 'organisationID' : grouping.organisationId, - 'name' : groupingName - }, - success : function(response) { - if ( response.isGroupingNameUnique ) { - formDataUpload.append("name", groupingName) - callImportURL(form, formDataUpload); - } else { - $('#grouping-name-non-unique-error').removeClass('d-none'); - $('#groupingName').focus(); - enableButtons(); - return false; - } - } - }); + } else if ( grouping && grouping.groupingId ) { + // course grouping - grouping already exists so just upload users + formDataUpload.append("groupingId", grouping.groupingId); + callImportURL(form, formDataUpload); + } else { + // New course grouping. Need to check name okay first. + + $('.errorMessage').hide(); + var groupingName = $('#groupingName').val(); + // course grouping name can not be blank + if (!groupingName) { + $('#grouping-name-blank-error').removeClass('d-none'); + $('#groupingName').focus(); + enableButtons(); + return false; } - } else { - enableButtons(); + // course grouping name should be unique + var isGroupingNameUnique = false; + $.ajax({ + dataType : 'json', + url : LAMS_URL + 'monitoring/grouping/checkGroupingNameUnique.do', + cache : false, + async : false, + data : { + 'organisationID' : grouping.organisationId, + 'name' : groupingName + }, + success : function(response) { + if ( response.isGroupingNameUnique ) { + formDataUpload.append("name", groupingName) + callImportURL(form, formDataUpload); + } else { + $('#grouping-name-non-unique-error').removeClass('d-none'); + $('#groupingName').focus(); + enableButtons(); + return false; + } + } + }); } + + } else { + enableButtons(); } - - function reloadIframe(returnedGroupingId) { - if ( !lessonMode && returnedGroupingId ) { - var locationUrl = window.location.href; - if ( locationUrl.indexOf('groupingId') == -1 ) { - // if course grouping we need to add the new grouping id if this was a new grouping. - locationUrl += '&groupingId=' + returnedGroupingId; - window.location.assign(locationUrl); - return; - } - } - window.location.reload(); - } - function callImportURL(form, formDataUpload) { - $.ajax({ - data: formDataUpload, - processData: false, // tell jQuery not to process the data - contentType: false, // tell jQuery not to set contentType - type: 'POST', - url: form.action, - enctype: "multipart/form-data", - dataType : 'json', - success: function (response) { - var returnedGroupingId = response.groupingId; - if ( response.result != 'OK') { - if ( response.error ) { - alert(response.error); - if ( response.reload ) { - // do not have another go, look at new data - reloadIframe(returnedGroupingId); - } else { - enableButtons(); // let them have another go - } - } - else { - // unknown failure on back end. - alert(LABELS.GENERAL_ERROR_LABEL); - } - } else { - var msg = LABELS.LABEL_IMPORT_SUCCESSFUL_LABEL.replace("%1", response.added).replace("%2", response.skipped); - alert(msg); - reloadIframe(returnedGroupingId); - } - }, - error: function() { - // unknown failure on back end. - alert(LABELS.GENERAL_ERROR_LABEL); - } - }); - } - - function getValidateSpreadsheetFile() { - var file = null; - // check file - var fileSelect = document.getElementById('groupUploadFile'); - var files = fileSelect.files; - if (files.length == 0) { - clearFileError(); - var requiredMsg = LABELS.ERROR_FILE_REQUIRED_LABEL; - showFileError(requiredMsg); - } else if ( validateShowErrorSpreadsheetType(files[0], LABELS.ERROR_FILE_WRONG_FORMAT_LABEL, false) ) { - file = files[0]; +} + +function reloadIframe(returnedGroupingId) { + if ( !lessonMode && returnedGroupingId ) { + var locationUrl = window.location.href; + if ( locationUrl.indexOf('groupingId') == -1 ) { + // if course grouping we need to add the new grouping id if this was a new grouping. + locationUrl += '&groupingId=' + returnedGroupingId; + window.location.assign(locationUrl); + return; } - return file; } - - var fileDownloadCheckTimer; - - function downloadTemplate() { - disableButtons(); - var token = new Date().getTime(); //use the current timestamp as the token value - - fileDownloadCheckTimer = window.setInterval(function () { - var cookieValue = $.cookie('fileDownloadToken'); - if (cookieValue == token) { - enableButtons(); + window.location.reload(); +} +function callImportURL(form, formDataUpload) { + $.ajax({ + data: formDataUpload, + processData: false, // tell jQuery not to process the data + contentType: false, // tell jQuery not to set contentType + type: 'POST', + url: form.action, + enctype: "multipart/form-data", + dataType : 'json', + success: function (response) { + var returnedGroupingId = response.groupingId; + if ( response.result != 'OK') { + if ( response.error ) { + alert(response.error); + if ( response.reload ) { + // do not have another go, look at new data + reloadIframe(returnedGroupingId); + } else { + enableButtons(); // let them have another go + } + } + else { + // unknown failure on back end. + alert(LABELS.GENERAL_ERROR_LABEL); + } + } else { + var msg = LABELS.LABEL_IMPORT_SUCCESSFUL_LABEL.replace("%1", response.added).replace("%2", response.skipped); + alert(msg); + reloadIframe(returnedGroupingId); } - }, 1000); - - var url = LAMS_URL + "monitoring/groupingUpload/getGroupTemplateFile.do?activityID="+groupingActivityId - +"&organisationID="+organisationId+"&lessonID="+lessonId+"&downloadTokenValue=" + token; - if ( grouping && grouping.groupingId) { - url += "&groupingId=" + grouping.groupingId; + }, + error: function() { + // unknown failure on back end. + alert(LABELS.GENERAL_ERROR_LABEL); } - document.location.href = url; - return false; + }); +} + +function getValidateSpreadsheetFile() { + var file = null; + // check file + var fileSelect = document.getElementById('groupUploadFile'); + var files = fileSelect.files; + if (files.length == 0) { + clearFileError(); + var requiredMsg = LABELS.ERROR_FILE_REQUIRED_LABEL; + showFileError(requiredMsg); + } else if ( validateShowErrorSpreadsheetType(files[0], LABELS.ERROR_FILE_WRONG_FORMAT_LABEL, false) ) { + file = files[0]; } + return file; +} - $(document).ready(function(){ - - //scroll to the bottom of the page on opening Advanced settings - $('#accordionUploadGroupFile').on('shown.bs.collapse', function () { - $("html, body").animate({ scrollTop: 170 }, 1000); - }); +var fileDownloadCheckTimer; + +function downloadTemplate() { + disableButtons(); + var token = new Date().getTime(); //use the current timestamp as the token value + + fileDownloadCheckTimer = window.setInterval(function () { + var cookieValue = $.cookie('fileDownloadToken'); + if (cookieValue == token) { + enableButtons(); + } + }, 1000); + + var url = LAMS_URL + "monitoring/groupingUpload/getGroupTemplateFile.do?activityID="+groupingActivityId + +"&organisationID="+organisationId+"&lessonID="+lessonId+"&downloadTokenValue=" + token; + if ( grouping && grouping.groupingId) { + url += "&groupingId=" + grouping.groupingId; + } + document.location.href = url; + return false; +} + +$(document).ready(function(){ + + //scroll to the bottom of the page on opening Advanced settings + $('#accordionUploadGroupFile').on('shown.bs.collapse', function () { + $("html, body").animate({ scrollTop: 170 }, 1000); }); - +}); + /** * *************** Save as a course grouping dialog *************** */ @@ -732,9 +737,9 @@ 'open' : function(){ //focus name text field setTimeout( - function() { - $('#dialog-course-grouping-name').focus(); - }, + function() { + $('#dialog-course-grouping-name').focus(); + }, 700 ); }, @@ -744,21 +749,21 @@ $('#dialog-course-grouping-name', this).val(""); } }, false); - + $('.modal-body', saveAsCourseGroupingDialog).empty().append($('#save-course-grouping-dialog-contents').show()); //save button handler $('#dialog-save-button', saveAsCourseGroupingDialog).click(function() { var dialog = $('#saveAsCourseGroupingDialog'), name = $('#dialog-course-grouping-name', dialog).val(); - + //name can't be blank if (!name || /^\s*$/.test(name)) { $('#dialog-course-grouping-name', dialog).addClass("alert-danger"); $("#span-tooltip", dialog).addClass("alert-danger").text(LABELS.NAME_BLANK_LABEL); return; } - + //name should be unique $.ajax({ dataType : 'json', @@ -768,7 +773,7 @@ data : { 'organisationID' : organisationId, 'name' : name - }, + }, success : function(response) { if (response.isGroupingNameUnique) { var data = { @@ -777,7 +782,7 @@ 'name' : name }; data[csrfTokenName] = csrfTokenValue; - + $.ajax({ dataType : 'json', url : LAMS_URL + 'monitoring/grouping/saveAsCourseGrouping.do', @@ -790,38 +795,38 @@ alert(LABELS.SAVED_SUCCESSFULLY_LABEL); } }); - + } else { $('#dialog-course-grouping-name', dialog).addClass("alert-danger"); $("#span-tooltip", dialog).addClass("alert-danger").text(LABELS.NAME_NOT_UNIQUE_LABEL); } } }); }); - + //close button handler $('#dialog-close-button', saveAsCourseGroupingDialog).click(function(){ $('#saveAsCourseGroupingDialog').modal('hide'); }); - + // ability to save a grouping on pressing the Enter key in the name input field $('#dialog-course-grouping-name', saveAsCourseGroupingDialog).on('keyup', function (e) { //remove alert class if it was applied if ($("#span-tooltip", saveAsCourseGroupingDialog).hasClass("alert-danger")) { resetSaveGroupingDialog(); } - - if (e.keyCode == 13) { + + if (e.keyCode == 13) { $('#dialog-save-button', saveAsCourseGroupingDialog).trigger( "click" ); - } + } }); //reset dialog to its initial state function resetSaveGroupingDialog() { $("#span-tooltip", saveAsCourseGroupingDialog).removeClass("alert-danger").text(LABELS.ENTER_COURSE_GROUPING_NAME_LABEL); $('#dialog-course-grouping-name', saveAsCourseGroupingDialog).removeClass("alert alert-danger"); } - + //scroll to the botom of the page on opening Advanced settings $('#accordionAdvanced').on('shown.bs.collapse', function () { $("html, body").animate({ scrollTop: 170 }, 1000);