Index: lams_tool_doku/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rb812eb010aa5c6d01ef10b19d6325900b7ae5963 -r4c8a81c2d65a0fd8be399d6e7e13935b7e796401 --- lams_tool_doku/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b812eb010aa5c6d01ef10b19d6325900b7ae5963) +++ lams_tool_doku/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4c8a81c2d65a0fd8be399d6e7e13935b7e796401) @@ -179,3 +179,6 @@ label.cancel = Cancel label.rating.textarea.tip = Leave a comment... label.minimum.number.words = Minimum number of words in a comment {0} +label.monitoring.ai.review = AI review +label.monitoring.ai.review.all = AI review all +label.monitoring.ai.review.tooltip = Have AI compare the given task and students' submissions. \ No newline at end of file Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/MonitoringController.java =================================================================== diff -u -r52a6369ce66a2ea70d38bfa2e627dfcde6354b10 -r4c8a81c2d65a0fd8be399d6e7e13935b7e796401 --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/MonitoringController.java (.../MonitoringController.java) (revision 52a6369ce66a2ea70d38bfa2e627dfcde6354b10) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/controller/MonitoringController.java (.../MonitoringController.java) (revision 4c8a81c2d65a0fd8be399d6e7e13935b7e796401) @@ -187,6 +187,9 @@ dokumaranService.createEtherpadCookieForMonitor(user, contentId, response); } + boolean isAiEnabled = Configuration.isLamsModuleAvailable(Configuration.AI_MODULE_CLASS); + request.setAttribute("isAiEnabled", isAiEnabled); + return "pages/monitoring/monitoring"; } Index: lams_tool_doku/web/pages/monitoring/summary.jsp =================================================================== diff -u -r52a6369ce66a2ea70d38bfa2e627dfcde6354b10 -r4c8a81c2d65a0fd8be399d6e7e13935b7e796401 --- lams_tool_doku/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 52a6369ce66a2ea70d38bfa2e627dfcde6354b10) +++ lams_tool_doku/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 4c8a81c2d65a0fd8be399d6e7e13935b7e796401) @@ -152,9 +152,9 @@ COUNT_RATED_ITEMS = true, ALLOW_RERATE = false; - $(document).ready(function(){ + $(document).ready(function () { // show etherpads only on Group expand - $('#doku-monitoring-summary-${sessionMap.toolContentID} .etherpad-collapse').on('show.bs.collapse', function(){ + $('#doku-monitoring-summary-${sessionMap.toolContentID} .etherpad-collapse').on('show.bs.collapse', function () { var etherpad = $('.etherpad-container', this); if (!etherpad.hasClass('initialised')) { var id = etherpad.attr('id'), @@ -163,7 +163,7 @@ } }); - $("#doku-monitoring-summary-${sessionMap.toolContentID} .fix-faulty-pad").click(function() { + $("#doku-monitoring-summary-${sessionMap.toolContentID} .fix-faulty-pad").click(function () { var toolSessionId = $(this).data("session-id"); var button = $(this); @@ -178,7 +178,7 @@ backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', - opacity: .98 , + opacity: .98, left: "0px", width: "360px" }, @@ -190,7 +190,7 @@ $.ajax({ async: true, url: '', - data : 'toolSessionID=' + toolSessionId, + data: 'toolSessionID=' + toolSessionId, type: 'post', success: function (response) { button.parent().html(''); @@ -209,42 +209,42 @@ // intialise tablesorter tables tablesorters.tablesorter({ theme: 'bootstrap', - headerTemplate : '{content} {icon}', + headerTemplate: '{content} {icon}', sortInitialOrder: 'asc', sortList: [[0]], - widgets: [ "uitheme", "resizable", "editable" ], - headers: { 0: { sorter: true}, 1: { sorter: true} }, - sortList : [[0,1]], + widgets: ["uitheme", "resizable", "editable"], + headers: {0: {sorter: true}, 1: {sorter: true}}, + sortList: [[0, 1]], showProcessing: false, widgetOptions: { resizable: true, // only marks is editable - editable_columns : [1], - editable_enterToAccept : true, // press enter to accept content, or click outside if false - editable_autoAccept : false, // accepts any changes made to the table cell automatically - editable_autoResort : false, // auto resort after the content has changed. - editable_validate : function (text, original, columnIndex) { + editable_columns: [1], + editable_enterToAccept: true, // press enter to accept content, or click outside if false + editable_autoAccept: false, // accepts any changes made to the table cell automatically + editable_autoResort: false, // auto resort after the content has changed. + editable_validate: function (text, original, columnIndex) { // removing all text produces " ", so get rid of it text = text ? text.replace(/ /g, '').trim() : null; // acceptable values are empty text or a number return !text || !isNaN(text) ? text : original; }, - editable_selectAll : function(txt, columnIndex, $element) { + editable_selectAll: function (txt, columnIndex, $element) { // note $element is the div inside of the table cell, so use $element.closest('td') to get the cell // only select everthing within the element when the content starts with the letter "B" return true; }, - editable_wrapContent : '
', // wrap all editable cell content... makes this widget work in IE, and with autocomplete - editable_trimContent : true, // trim content ( removes outer tabs & carriage returns ) - editable_editComplete : 'editComplete' // event fired after the table content has been edited + editable_wrapContent: '
', // wrap all editable cell content... makes this widget work in IE, and with autocomplete + editable_trimContent: true, // trim content ( removes outer tabs & carriage returns ) + editable_editComplete: 'editComplete' // event fired after the table content has been edited } }); // update mark on edit - tablesorters.each(function(){ + tablesorters.each(function () { // config event variable new in v2.17.6 - $(this).children('tbody').on('editComplete', 'td', function(event, config) { + $(this).children('tbody').on('editComplete', 'td', function (event, config) { var $this = $(this), mark = $this.text() ? +$this.text() : null, toolSessionId = +$this.closest('.tablesorter').attr('toolSessionId'), @@ -258,14 +258,14 @@ $.ajax({ async: true, url: '', - data : { - 'toolSessionId' : toolSessionId, - 'userId' : userId, - 'mark' : mark, - '' : '' + data: { + 'toolSessionId': toolSessionId, + 'userId': userId, + 'mark': mark, + '': '' }, type: 'post', - success : function (){ + success: function () { $this.closest('.marks-container').find('.copy-mark-button') .data('mark', mark).show() .find('.copy-mark-value').text(mark); @@ -279,7 +279,7 @@ }); // pager processing - tablesorters.each(function() { + tablesorters.each(function () { var toolSessionId = $(this).attr('toolSessionId'); $(this).tablesorterPager({ @@ -293,28 +293,28 @@ cssPageDisplay: '.pagedisplay', cssPageSize: '.pagesize', cssDisabled: 'disabled', - ajaxUrl : "" + toolSessionId, + ajaxUrl: "" + toolSessionId, ajaxProcessing: function (data, table) { if (data && data.hasOwnProperty('rows')) { var rows = [], json = {}; - for (i = 0; i < data.rows.length; i++){ + for (i = 0; i < data.rows.length; i++) { var userData = data.rows[i], isLeader = userData['isLeader']; rows += ''; rows += ''; - rows += userData['firstName'] + ' ' +userData['lastName']; + rows += userData['firstName'] + ' ' + userData['lastName']; if (isLeader) { rows += ' " class="text-primary fa fa-star">'; } rows += ''; rows += ''; - rows += (userData['mark'] == '' ? '0.0' : userData['mark']); + rows += (userData['mark'] == '' ? '0.0' : userData['mark']); rows += ''; rows += ''; @@ -326,8 +326,8 @@ } } }) - .bind('pagerInitialized pagerComplete', function(event, options){ - if ( options.totalRows == 0 ) { + .bind('pagerInitialized pagerComplete', function (event, options) { + if (options.totalRows == 0) { $.tablesorter.showError($(this), ''); } }); @@ -347,22 +347,22 @@ button = table.closest('.marks-container').find('.copy-mark-button'), mark = button.data('mark'); - $('tbody > tr[userid] > td:nth-child(2) > div[contenteditable]', table).each(function(){ + $('tbody > tr[userid] > td:nth-child(2) > div[contenteditable]', table).each(function () { $(this).text(mark).trigger('editComplete'); }); } - function startGalleryWalk(){ + function startGalleryWalk() { if (!confirm('')) { return; } $.ajax({ - 'url' : '', + 'url': '', 'data': { - toolContentID : ${dokumaran.contentId} + toolContentID: ${dokumaran.contentId} }, - 'success' : function(){ + 'success': function () { // reload current tab with Doku summary @@ -376,17 +376,17 @@ }); } - function skipGalleryWalk(){ + function skipGalleryWalk() { if (!confirm('')) { return; } $.ajax({ - 'url' : '', + 'url': '', 'data': { - toolContentID : ${dokumaran.contentId} + toolContentID: ${dokumaran.contentId} }, - 'success' : function(){ + 'success': function () { // reload current tab with Doku summary @@ -400,17 +400,17 @@ }); } - function finishGalleryWalk(){ + function finishGalleryWalk() { if (!confirm('')) { return; } $.ajax({ - 'url' : '', + 'url': '', 'data': { - toolContentID : ${dokumaran.contentId} + toolContentID: ${dokumaran.contentId} }, - 'success' : function(){ + 'success': function () { // reload current tab with Doku summary @@ -424,21 +424,21 @@ }); } - function openGalleryWalkClusters(){ + function openGalleryWalkClusters() { window.open('monitoring/showGalleryWalkClusters.do?toolContentID=${dokumaran.contentId}', '_blank'); } - function enableGalleryWalkLearnerEdit(){ + function enableGalleryWalkLearnerEdit() { if (!confirm('')) { return; } $.ajax({ - 'url' : '', + 'url': '', 'data': { - toolContentID : ${dokumaran.contentId} + toolContentID: ${dokumaran.contentId} }, - 'success' : function(){ + 'success': function () { // reload current tab with Doku summary @@ -455,26 +455,26 @@ function showChangeLeaderModal(toolSessionId) { $('#doku-monitoring-summary-${sessionMap.toolContentID} #change-leader-modals').empty() - .load('',{ - toolSessionID : toolSessionId + .load('', { + toolSessionID: toolSessionId }); } - function onChangeLeaderCallback(response, leaderUserId, toolSessionId){ + function onChangeLeaderCallback(response, leaderUserId, toolSessionId) { if (response.isSuccessful) { $.ajax({ - 'url' : '', + 'url': '', 'type': 'post', - 'cache' : 'false', + 'cache': 'false', 'data': { - 'toolSessionID' : toolSessionId, - 'leaderUserId' : leaderUserId, - '' : '' + 'toolSessionID': toolSessionId, + 'leaderUserId': leaderUserId, + '': '' }, - success : function(){ + success: function () { alert(""); }, - error : function(){ + error: function () { alert(""); } }); @@ -484,8 +484,35 @@ } } + + function aiReview(toolSessionId) { + let container = $('#ai-review-container-' + toolSessionId), + header = $('.ai-review-header', container) + .removeClass('hidden') + .append(''), + content = $('.ai-review-content', container).removeClass('hidden').empty(); + container.children('button').prop('disabled', true); + container.children('.clearfix').remove(); + + <%--.load(, {--%> + <%-- toolSessionId: toolSessionId--%> + <%--});--%> + } + + function aiReviewAll() { + let button = $('#ai-review-all-button').prop('disabled', true); + // re-enable review all button after 10 seconds + setTimeout(function () { + button.prop('disabled', false); + }, 10000); + + $('.ai-review-container').each(function () { + aiReview($(this).data('session-id')); + }); + } + - + @@ -617,6 +644,14 @@
+ + +
+
+
@@ -687,6 +722,22 @@ + + +
+ +
+ + +
+