Index: lams_central/web/includes/javascript/dialog5.js =================================================================== diff -u -ra13b927ed895f8e3eeaf559371262665e04ff07a -r3e5f23228af144f86f91a0dd45d342702d22c22d --- lams_central/web/includes/javascript/dialog5.js (.../dialog5.js) (revision a13b927ed895f8e3eeaf559371262665e04ff07a) +++ lams_central/web/includes/javascript/dialog5.js (.../dialog5.js) (revision 3e5f23228af144f86f91a0dd45d342702d22c22d) @@ -1,24 +1,24 @@ var dialogTemplate = $(''); + '' + + ''); - + /** * Checks if the dialog is already opened. * If not, creates a new dialog with the given ID and init parameters. @@ -29,30 +29,30 @@ if (dialog.length > 0) { if (recreate){ dialog.modal('hide'); - - //try to open already existing dialog + + //try to open already existing dialog } else { //restore minimised dialog if (dialog.hasClass('dialogMin')) { restoreMinimisedDialog(dialog); - + } else { // we do not support multiple opened bootstrap dialogs yet // dialog.dialog('moveToTop'); } - + return; } } - // checks whether the dialog should be created inside a current window or in a parent one. The latter is preferred + // checks whether the dialog should be created inside a current window or in a parent one. The latter is preferred //in case we want dialog to be not constrained by the boundaries of a current window var targetWindow = initParams.isCreateInParentWindow ? window.parent : window; - + // create a new dialog by cloning a template dialog = dialogTemplate.clone().appendTo(targetWindow.$('body')); dialog.data('isCreateInParentWindow', initParams.isCreateInParentWindow); - + // use the input attributes or fall back to default ones initParams = $.extend({ 'autoOpen' : true, @@ -67,17 +67,17 @@ $(this).remove(); } }, initParams); - + // update title $('.modal-title', dialog).attr('id', id + 'Label').text(initParams.title); dialog.attr({ 'id' : id, 'aria-labelledby' : id + 'Label' }); - + var modalDialog = $('.modal-dialog', dialog), modalContent = $('.modal-content', dialog); - + if (initParams.width) { modalDialog.width(initParams.width); } @@ -87,7 +87,7 @@ if (initParams.resizable) { modalContent.resizable(); } - + // disable draggable for Android and iPhone as it breaks the close buttons var draggable = initParams.draggable && ! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); if (draggable) { @@ -99,25 +99,25 @@ }); } dialog.data("isDraggable", draggable); - + // store extra attributes for dialog content internal use if (initParams.data) { dialog.data(initParams.data); } - + dialog.on('show.bs.modal', initParams.open); dialog.on('hide.bs.modal', initParams.beforeClose); dialog.on('hidden.bs.modal', initParams.close); - + dialog.modal({ 'keyboard' : false, 'backdrop' : 'static' }); - + if (initParams.autoOpen) { dialog.modal('show'); } - + if (extraButtons) { var maximizeButton = $('.dialogMaximise', dialog).click(function(){ var icon = $('i', this), @@ -132,7 +132,7 @@ internalDialog.width(oldWidth); internalContent.width(oldWidth); internalContent.height(oldHeight); - + // enable resizing $('.ui-resizable-handle', dialog).show(); } else { @@ -147,83 +147,83 @@ }); internalContent.css('width', 'calc(100% - 15px)'); internalContent.height(internalDialog.height() - 20); - + // disable resizing $('.ui-resizable-handle', dialog).hide(); } // center the dialog - internalDialog.position( - dialog.data('isCreateInParentWindow') ? - { - 'my' : 'center center', - 'at' : 'center center', - 'of' : window.parent - } - : - { - 'my' : 'top', - 'at' : 'center top', - 'of' : window - } + internalDialog.position( + dialog.data('isCreateInParentWindow') ? + { + 'my' : 'center center', + 'at' : 'center center', + 'of' : window.parent + } + : + { + 'my' : 'top', + 'at' : 'center top', + 'of' : window + } ); - + internalContent.trigger('resizestop'); }); - + if (initParams.startMaximized) { maximizeButton.click(); } - - $('.dialogMinimise', dialog).click(function() { - if (dialog.hasClass('dialogMin')) { - restoreMinimisedDialog(dialog); - } else { - // swap icon - $('.dialogMinimise i', dialog).toggleClass('fa-minus').toggleClass('fa-clone'); - // store current left position - dialog.data('oldLeft', dialog.css('left')); - dialog.css('left', $('.dialogMin').length * 260 + 5 + 'px'); - dialog.addClass('dialogMin'); - // remove overlay - dialog.siblings('.modal-backdrop').hide(); - // disable maximising - $('.dialogMaximise', dialog).hide(); - // disable rezising - $('.ui-resizable-handle', dialog).hide(); - if (draggable) { - modalDialog.draggable('disable'); - } - //enable scrolling of the parent's content - dialog.parent().removeClass("modal-open"); - }; - }); - - dialog.on('hide.bs.modal', function(){ - shiftMinimisedDialogs($(this)); - }); + + $('.dialogMinimise', dialog).click(function() { + if (dialog.hasClass('dialogMin')) { + restoreMinimisedDialog(dialog); + } else { + // swap icon + $('.dialogMinimise i', dialog).toggleClass('fa-minus').toggleClass('fa-clone'); + // store current left position + dialog.data('oldLeft', dialog.css('left')); + dialog.css('left', $('.dialogMin').length * 260 + 5 + 'px'); + dialog.addClass('dialogMin'); + // remove overlay + dialog.siblings('.modal-backdrop').hide(); + // disable maximising + $('.dialogMaximise', dialog).hide(); + // disable rezising + $('.ui-resizable-handle', dialog).hide(); + if (draggable) { + modalDialog.draggable('disable'); + } + //enable scrolling of the parent's content + dialog.parent().removeClass("modal-open"); + }; + }); + + dialog.on('hide.bs.modal', function(){ + shiftMinimisedDialogs($(this)); + }); } else { $('.dialogMinimise, .dialogMaximise', dialog).remove(); } - + return dialog; } function restoreMinimisedDialog(dialog) { // swap icon - $('.dialogMinimise i', dialog).toggleClass('fa-minus').toggleClass('fa-clone'); + $('.dialogMinimise i', dialog).toggleClass('fa-minus').toggleClass('fa-clone'); shiftMinimisedDialogs(dialog); // restore old left position dialog.css('left', dialog.data('oldLeft')); dialog.removeClass('dialogMin'); - dialog.siblings('.modal-backdrop').show(); - $('.dialogMaximise', dialog).show(); - $('.ui-resizable-handle', dialog).show(); - if (dialog.data("isDraggable")) { - var modalDialog = $('.modal-dialog', dialog); - modalDialog.draggable('enable'); - } - //disable scrolling of the parent's content - dialog.parent().addClass("modal-open"); + dialog.siblings('.modal-backdrop').show(); + $('.dialogMaximise', dialog).show(); + $('.ui-resizable-handle', dialog).show(); + if (dialog.data("isDraggable")) { + var modalDialog = $('.modal-dialog', dialog); + modalDialog.draggable('enable'); + } + //disable scrolling of the parent's content + dialog.parent().addClass("modal-open"); // in case of monitor dialog reload its content. It's required as all monitor dialogs use the same ids for their HTML elements var isMonitorDialog = dialog.data('isMonitorDialog'); @@ -233,10 +233,10 @@ $('iframe', dialog).on('load', function() { $('iframe', dialog).show(); }); - + //reload iframe - $('iframe', dialog)["0"].contentWindow.location.reload(); - } + $('iframe', dialog)["0"].contentWindow.location.reload(); + } } /** @@ -263,14 +263,14 @@ function openAuthoring(learningDesignID, relaunchMonitorLessonID) { var url = LAMS_URL + 'authoring/openAuthoring.do'; - + if (learningDesignID) { url += '?learningDesignID=' + learningDesignID; } if (relaunchMonitorLessonID) { url += '&relaunchMonitorLessonID=' + relaunchMonitorLessonID; } - + window.location.href = url; } @@ -294,20 +294,20 @@ }, 'open' : function() { var url = LAMS_URL + 'authoring/openAuthoring.do'; - + if (learningDesignID) { url += '?learningDesignID=' + learningDesignID; } - + // load contents after opening the dialog $('iframe', this).attr({'src' : url, 'id' : 'authoringModal'}); } }, true); - + if (relaunchMonitorLessonID) { dialog.data('relaunchMonitorLessonID', relaunchMonitorLessonID); } - + // resize the paper when dialog is resized $('.modal-content', dialog).on('resizestop', function() { $('iframe', this)[0].contentWindow.GeneralLib.resizePaper(); @@ -328,7 +328,7 @@ }, 'height': 700, //dialog needs to be added to a top level window to avoid boundary limitations of the interim iframe - "isCreateInParentWindow" : !isTopLevelWindow, + "isCreateInParentWindow" : !isTopLevelWindow, 'title' : LABELS.EMAIL_NOTIFICATIONS_TITLE, 'open' : function() { var dialog = $(this); @@ -351,15 +351,15 @@ var dialog = $(this); // load contents after opening the dialog $('iframe', dialog).attr('src', LAMS_URL + 'index.do?redirect=portrait&isReturnButtonHidden=true'); - + // in case of mobile devices allow iframe scrolling if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { - setTimeout(function() { - dialog.css({ - 'overflow-y' : 'scroll', - '-webkit-overflow-scrolling' : 'touch' - }); - },500); + setTimeout(function() { + dialog.css({ + 'overflow-y' : 'scroll', + '-webkit-overflow-scrolling' : 'touch' + }); + },500); } } }); @@ -373,15 +373,23 @@ }); $('.modal-body', dialog).html(body) - + $("#confirmationDialogConfirmButton").off('click').on("click", function(){ dialog.data('confirmed', true); - dialog.modal('hide'); + dialog.modal('hide'); }); - + $("#confirmationDialogCancelButton").off('click').on("click", function(){ - dialog.modal('hide'); + dialog.modal('hide'); }); dialog.modal('show'); +} + +function showToast(text) { + debugger + let toast = $('#toast-template').clone().attr('id', null).appendTo('#toast-container'); + toast.find('.toast-body', toast).text(text); + toast = new bootstrap.Toast(toast[0]); + toast.show(); } \ No newline at end of file Index: lams_learning/web/includes/javascript/learnerPage.js =================================================================== diff -u -rd1d25ad3d8e023bd467dda99f615f7fd1b70ef91 -r3e5f23228af144f86f91a0dd45d342702d22c22d --- lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision d1d25ad3d8e023bd467dda99f615f7fd1b70ef91) +++ lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision 3e5f23228af144f86f91a0dd45d342702d22c22d) @@ -145,7 +145,7 @@ learnerAutosave(true); } } else { - alert(command.message); + showToast(command.message); } } Index: lams_monitoring/web/includes/javascript/monitorLesson.js =================================================================== diff -u -re7b29886c3fc2a5edef72022a8df8b1833ac6b47 -r3e5f23228af144f86f91a0dd45d342702d22c22d --- lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision e7b29886c3fc2a5edef72022a8df8b1833ac6b47) +++ lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision 3e5f23228af144f86f91a0dd45d342702d22c22d) @@ -1,4 +1,4 @@ -// ********** GLOBAL VARIABLES ********** +// ********** GLOBAL VARIABLES ********** // current tab that should be displayed after a refresh, defaults to Sequence tab var currentTab = sessionStorage.getItem("lamsMonitoringCurrentTab") || 'sequence', @@ -3065,13 +3065,6 @@ } } -function showToast(text) { - let toast = $('#toast-template').clone().attr('id', null).appendTo('#toast-container'); - toast.find('.toast-body', toast).text(text); - toast = new bootstrap.Toast(toast[0]); - toast.show(); -} - /** * Works as dblclick for mobile devices. */ Index: lams_tool_nb/web/WEB-INF/tags/PageLearner.tag =================================================================== diff -u -r129046221bc61bf76b85db3dec56fae24bc18cab -r3e5f23228af144f86f91a0dd45d342702d22c22d --- lams_tool_nb/web/WEB-INF/tags/PageLearner.tag (.../PageLearner.tag) (revision 129046221bc61bf76b85db3dec56fae24bc18cab) +++ lams_tool_nb/web/WEB-INF/tags/PageLearner.tag (.../PageLearner.tag) (revision 3e5f23228af144f86f91a0dd45d342702d22c22d) @@ -121,6 +121,30 @@ + + + +
+
+ + + \ No newline at end of file Index: lams_tool_sbmt/web/WEB-INF/tags/PageLearner.tag =================================================================== diff -u -r129046221bc61bf76b85db3dec56fae24bc18cab -r3e5f23228af144f86f91a0dd45d342702d22c22d --- lams_tool_sbmt/web/WEB-INF/tags/PageLearner.tag (.../PageLearner.tag) (revision 129046221bc61bf76b85db3dec56fae24bc18cab) +++ lams_tool_sbmt/web/WEB-INF/tags/PageLearner.tag (.../PageLearner.tag) (revision 3e5f23228af144f86f91a0dd45d342702d22c22d) @@ -121,6 +121,30 @@ + + + +
+
+ + + \ No newline at end of file Index: lams_tool_sbmt/web/learner/sbmtlearner.jsp =================================================================== diff -u -r129046221bc61bf76b85db3dec56fae24bc18cab -r3e5f23228af144f86f91a0dd45d342702d22c22d --- lams_tool_sbmt/web/learner/sbmtlearner.jsp (.../sbmtlearner.jsp) (revision 129046221bc61bf76b85db3dec56fae24bc18cab) +++ lams_tool_sbmt/web/learner/sbmtlearner.jsp (.../sbmtlearner.jsp) (revision 3e5f23228af144f86f91a0dd45d342702d22c22d) @@ -173,30 +173,31 @@ if (uploadedFilesNumber < ${sessionMap.minLimitUploadNumber}) { if (${sessionMap.mode eq 'author'}) { - alert('' + + showToast('' + '\n'); } else { - alert(''); + showToast(''); return false; } } + let finishFunction = function(){ + disableButtons(); + location.href = tUrl; + }; + //let user confirm zero files upload if (uploadedFilesNumber == 0) { if (${sessionMap.lockOnFinish}) { - if (!confirm("")) { - return false; - } + showConfirm("", finishFunction); } else { - if (!confirm("")) { - return false; - } + showConfirm("", finishFunction); } + } else { + finishFunction(); } - disableButtons(); - location.href = tUrl; } function clearFileError(errDivId) { @@ -217,7 +218,7 @@ errDiv.append(error); errDiv.css( "display", "block" ); } else { - alert(error); + showToast(error); } } @@ -253,20 +254,19 @@ function deleteLearnerFile(detailId, filename) { var msg = ''; msg = msg.replace('{0}', filename); - var answer = confirm(msg); - if (answer) { + showConfirm(msg, function (){ $.ajax({ url: '', data: 'detailId=' + detailId, success: function () { document.location.href = "learning/${sessionMap.mode}.do?toolSessionID=${sessionMap.toolSessionID}"; }, error: function(error){ - alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status); - alert("responseText: "+xhr.responseText); + showToast("readyState: "+xhr.readyState+"\nstatus: "+xhr.status); + showToast("responseText: "+xhr.responseText); } }); - } + }); }