Index: lams_tool_assessment/web/pages/tblmonitoring/assessment.jsp
===================================================================
diff -u -r442b2bdacb7a49af90480f58918774b82b1868a4 -r79db1b495adba49dd54a6250c1221a326f153633
--- lams_tool_assessment/web/pages/tblmonitoring/assessment.jsp (.../assessment.jsp) (revision 442b2bdacb7a49af90480f58918774b82b1868a4)
+++ lams_tool_assessment/web/pages/tblmonitoring/assessment.jsp (.../assessment.jsp) (revision 79db1b495adba49dd54a6250c1221a326f153633)
@@ -28,9 +28,18 @@
//insert total learners number taken from the parent tblmonitor.jsp
$("#total-learners-number").html(TOTAL_LESSON_LEARNERS_NUMBER);
- // go through each AE and set up disclose buttons there
- $('.assessmentPane').each(function(){
- var assessmentPane = $(this),
+ $('.results').each(function(){
+ // load results div for the first time
+ loadResultsPane($(this), false);
+ });
+
+ });
+
+ function loadResultsPane(resultsPane, isRefresh) {
+ // load an embedded results list
+ resultsPane.load("?embedded=true&toolContentID="
+ + resultsPane.data('toolContentId'), function(){
+ var assessmentPane = resultsPane.closest('.assessmentPane'),
// are any correct/groups buttons clickable?
discloseAllCorrectEnabled = false,
discloseAllGroupsEnabled = false;
@@ -53,45 +62,51 @@
return;
}
- discloseAnswers(button);
+ discloseAnswers(button, resultsPane);
});
});
// if disclose all correct/groups answers buttons are clickable, add a click handler
// and disable if not
var allCorrectButton = $('.disclose-all-correct-button', assessmentPane);
if (discloseAllCorrectEnabled) {
- allCorrectButton.click(function(){
- if (!confirm("")) {
- return;
- }
- $('.disclose-correct-button', assessmentPane).not('[disabled]').each(function() {
- discloseAnswers($(this));
+ // do not add a handler twice
+ if (!isRefresh) {
+ allCorrectButton.click(function(){
+ if (!confirm("")) {
+ return;
+ }
+ $('.disclose-correct-button', assessmentPane).not('[disabled]').each(function() {
+ discloseAnswers($(this), resultsPane);
+ });
+ disabledAndCheckButton(allCorrectButton);
});
- disabledAndCheckButton(allCorrectButton);
- });
+ }
} else {
disabledAndCheckButton(allCorrectButton);
}
var allGroupsButton = $('.disclose-all-groups-button', assessmentPane);
if (discloseAllGroupsEnabled) {
- allGroupsButton.click(function(){
- if (!confirm("")) {
- return;
- }
- $('.disclose-groups-button', assessmentPane).not('[disabled]').each(function() {
- discloseAnswers($(this));
+ // do not add a handler twice
+ if (!isRefresh) {
+ allGroupsButton.click(function(){
+ if (!confirm("")) {
+ return;
+ }
+ $('.disclose-groups-button', assessmentPane).not('[disabled]').each(function() {
+ discloseAnswers($(this), resultsPane);
+ });
+ disabledAndCheckButton(allGroupsButton);
});
- disabledAndCheckButton(allGroupsButton);
- });
+ }
} else {
disabledAndCheckButton(allGroupsButton);
}
});
- });
+ }
- function discloseAnswers(button) {
+ function discloseAnswers(button, resultsPane) {
let isCorrectButton = button.hasClass('disclose-correct-button');
$.ajax({
@@ -105,19 +120,14 @@
'' : ''
}
}).done(function(){
- // disable the button after click
- disabledAndCheckButton(button);
+ // reload results after disclosing answers
+ loadResultsPane(resultsPane, true);
});
}
function disabledAndCheckButton(button){
button.attr('disabled', true).html(' ' + button.text());
}
-
-
- function showResultsForTeacher(toolContentId) {
- launchPopup("?toolContentID=" + toolContentId, 'Results');
- }
@@ -192,12 +202,6 @@
<%-- Release correct/groups answers for all questions in this assessment --%>
|