diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index 5ee798a..c2badce 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -1,5 +1,4 @@ -/// -AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http', '$timeout', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", "$location", "LabExerciseService", "AIAConstants","LoginConstants","$parse", +AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http', '$timeout', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", "$location", "LabExerciseService", "AIAConstants","LoginConstants","$parse", function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $location, $document, $sce, $compile, $location, LabExerciseService, AIAConstants, LoginConstants, $parse) { $scope.$sce = $sce; // $scope.LabExerciseName; @@ -11,15 +10,15 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, // $scope.Imagepath = ""; // $scope.UserAnswersForAllQuestions = []; // $scope.LabExerciseUserData = []; - $scope.LabExercise = []; + // $scope.LabExercise = []; // $scope.dragableId = ""; - $scope.blReviewAttempt = false; - $scope.isResetClicked = false; + // $scope.blReviewAttempt = false; + // $scope.isResetClicked = false; // $scope.labExerciseModuleData = []; - $scope.isResultVisible = false; - $scope.reportCopyStatus = false; - $scope.usersCorrectQuestData = []; + // $scope.isResultVisible = false; + // $scope.reportCopyStatus = false; + // $scope.usersCorrectQuestData = []; $scope.initializeLEWindowData = function (windowviewid, isOpenWithExistsModule, openPanelNo) { if (isOpenWithExistsModule || openPanelNo == 0) { @@ -53,7 +52,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, 'labExeIdentifier': '', 'activityTitle': '', 'TotalNumberofQuiz': 0, - 'LabExerciseUserData':[] + 'LabExerciseUserData': [], + 'isResetClicked': false, + 'isResultVisible': false, + 'usersCorrectQuestData': [], }); } @@ -90,7 +92,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, 'labExeIdentifier': '', 'activityTitle': '', 'TotalNumberofQuiz': 0, - 'LabExerciseUserData': [] + 'LabExerciseUserData': [], + 'isResetClicked': false, + 'isResultVisible': false, + 'usersCorrectQuestData': [], }); @@ -582,14 +587,15 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $timeout(function () { var LabExerciseUserData = $scope.GetLEwindowStoreData(windowviewid, 'LabExerciseUserData'); if (($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.lastQuestion > 0) || (LabExerciseUserData != undefined && LabExerciseUserData.length > 0)) { - if ($scope.isResetClicked != true) { + var isResetClicked = $scope.GetLEwindowStoreData(windowviewid, 'isResetClicked'); + if (isResetClicked != true) { $scope.ShowSavedLabExercise(windowviewid); } else { $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); - $scope.isResetClicked = false; + $scope.SetLEwindowStoreData(windowviewid, 'isResetClicked', false); } } else { @@ -720,16 +726,18 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, var TotalNumberofQuiz = $scope.GetLEwindowStoreData(windowviewid, 'TotalNumberofQuiz'); $('#tdTotalQuiz_' + windowviewid).text(TotalNumberofQuiz); - console.log($scope.usersCorrectQuestData); $("#resultLabData_" + windowviewid).empty(); var sortedQuestionHtml = ''; + var usersCorrectQuestData = []; + usersCorrectQuestData = $scope.GetLEwindowStoreData(windowviewid, 'usersCorrectQuestData'); + if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.labExercise.length > 0) { for (var j = 0; j <= $scope.SavedLabExercise.labExercise.length - 1; j++) { var boolValueEx = false; - for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { + for (var i = 0; i <= usersCorrectQuestData.length - 1; i++) { - if ($scope.SavedLabExercise.labExercise[j].QuestionNo == $scope.usersCorrectQuestData[i].QuestionNo) { + if ($scope.SavedLabExercise.labExercise[j].QuestionNo == usersCorrectQuestData[i].QuestionNo) { boolValueEx = true; break; } @@ -737,7 +745,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, if (boolValueEx == false) { if ($scope.SavedLabExercise.labExercise[j].MaxScore == $scope.SavedLabExercise.labExercise[j].Score) { - $scope.usersCorrectQuestData.push({ + usersCorrectQuestData.push({ CorrectAnswers: $scope.SavedLabExercise.labExercise[j].CorrectAnswers, DragItems: $scope.SavedLabExercise.labExercise[j].DragItems, CorrectStatus: "Correct", @@ -748,7 +756,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, }) } else { - $scope.usersCorrectQuestData.push({ + usersCorrectQuestData.push({ CorrectAnswers: $scope.SavedLabExercise.labExercise[j].CorrectAnswers, DragItems: $scope.SavedLabExercise.labExercise[j].DragItems, CorrectStatus: "Incorrect", @@ -763,18 +771,15 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } - console.log($scope.usersCorrectQuestData); - - for (var j = TotalNumberofQuiz; j >= 1; j--) { - for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { - if (j == $scope.usersCorrectQuestData[i].QuestionNo) { - if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { - var labExerciseHtml = $("#resultLabData_" + windowviewid).append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); + for (var i = 0; i <= usersCorrectQuestData.length - 1; i++) { + if (j == usersCorrectQuestData[i].QuestionNo) { + if (usersCorrectQuestData[i].CorrectStatus == "Correct") { + var labExerciseHtml = $("#resultLabData_" + windowviewid).append("" + usersCorrectQuestData[i].QuestionNo + "" + usersCorrectQuestData[i].title + "" + usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } else { - var labExerciseHtml = $("#resultLabData_" + windowviewid).append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); + var labExerciseHtml = $("#resultLabData_" + windowviewid).append("" + usersCorrectQuestData[i].QuestionNo + "" + usersCorrectQuestData[i].title + "" + usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } $scope.isValueExist = true; @@ -805,6 +810,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, }); } + + $scope.SetLEwindowStoreData(windowviewid, 'usersCorrectQuestData', usersCorrectQuestData); $("#resultLabData_" + windowviewid).empty(); var sortedCompileHtml = $("#resultLabData_" + windowviewid).append(sortedQuestionHtml); $compile(sortedCompileHtml)($scope); @@ -1199,11 +1206,11 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, if ($('#questionHtml_' + windowviewid).css('display') === 'block') { $("#questionHtml_" + windowviewid).css("display", "none"); - $scope.isResultVisible = false; + $scope.SetLEwindowStoreData(windowviewid, 'isResultVisible', false); } else { $("#submitResultHtml_" + windowviewid).css("display", "none"); - $scope.isResultVisible = true; + $scope.SetLEwindowStoreData(windowviewid, 'isResultVisible', true); } $("#LabExPageHeading_" + windowviewid).css("display", "none"); @@ -1215,7 +1222,9 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, var len = ($event.target.id).split("_").length; var windowviewid = ($event.target.id).split("_")[len - 1]; - if ($scope.isResultVisible == true) { + var isResultVisible= $scope.GetLEwindowStoreData(windowviewid, 'isResultVisible'); + + if (isResultVisible == true) { $("#submitResultHtml_" + windowviewid).css("display", "block"); } else { @@ -1236,7 +1245,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, var len = ($event.target.id).split("_").length; var windowviewid = ($event.target.id).split("_")[len - 1]; - $scope.isResetClicked = true; + $scope.SetLEwindowStoreData(windowviewid, 'isResetClicked', true); $scope.resetQuiz(); } @@ -1444,16 +1453,16 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, else LabExerciseUserData.push($scope.LabExerciseAttemptedData); - // $scope.SetLEwindowStoreData(windowviewid, 'LabExerciseUserData', LabExerciseUserData); + $scope.SetLEwindowStoreData(windowviewid, 'usersCorrectQuestData',[]); - $scope.usersCorrectQuestData = []; + var usersCorrectQuestData = []; if (LabExerciseUserData.length > 0) { for (var i = 0; i <= LabExerciseUserData.length - 1; i++) { if ($scope.LabExerciseUserData[i].MaxScore == LabExerciseUserData[i].Score) { - $scope.usersCorrectQuestData.push({ + usersCorrectQuestData.push({ MaxScore: LabExerciseUserData[i].MaxScore, UserAnswer: LabExerciseUserData[i].UserAnswer, QuestionNo: LabExerciseUserData[i].QuestionNo, @@ -1465,7 +1474,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, }); } else { - $scope.usersCorrectQuestData.push({ + usersCorrectQuestData.push({ MaxScore: LabExerciseUserData[i].MaxScore, UserAnswer: LabExerciseUserData[i].UserAnswer, QuestionNo: LabExerciseUserData[i].QuestionNo, @@ -1481,7 +1490,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } else { if ($scope.MaxScore == $scope.Score) { - $scope.usersCorrectQuestData.push({ + usersCorrectQuestData.push({ MaxScore: $scope.MaxScore, UserAnswer: $scope.commaSeperatedUserAnswers, QuestionNo: quiznumber, @@ -1493,7 +1502,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, }); } else { - $scope.usersCorrectQuestData.push({ + usersCorrectQuestData.push({ MaxScore: $scope.MaxScore, UserAnswer: $scope.commaSeperatedUserAnswers, QuestionNo: quiznumber, @@ -1506,6 +1515,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } } + $scope.SetLEwindowStoreData(windowviewid, 'usersCorrectQuestData', usersCorrectQuestData); } $scope.reviewAttemptAnswer = function ($event) { @@ -1831,8 +1841,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, var len = ($event.target.id).split("_").length; var windowviewid = ($event.target.id).split("_")[len - 1]; - var senderEmails = $("#emailTo_" + windowviewid).val().split(","); - $scope.isSenderEmailValid = false; + var reportCopyStatus = $("#chkCopy_" + windowviewid).val(); + var receiverEmails = $("#emailTo_" + windowviewid).val(); + var senderEmails = receiverEmails.split(","); + var isSenderEmailValid = false; for (var i = 0; i <= senderEmails.length - 1; i++) { var sEmail = $.trim(senderEmails[i]); @@ -1878,8 +1890,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } // } $scope.isReceiverEmailValid = false; - var receiverEmail = $("#userEmailID_" + windowviewid).val(); - var rEmail = receiverEmail; + var yourEmail = $("#userEmailID_" + windowviewid).val(); + var rEmail = yourEmail; if ($.trim(rEmail).length == 0) { $scope.isReceiverEmailValid = false; $("#alertPopUp_" + windowviewid).css("display", "block"); @@ -1918,21 +1930,27 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, }); reportHtml += ''; - if ($("#emailComment_" + windowviewid).val() == undefined || $("#emailComment_" + windowviewid).val() == "") { - $scope.reportImage = "

Name: " + User.Name + "


" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(1)").text() + "Performance Report" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(3)").text() + "
Total QuestionCorrect AnswersIncorrect Answers
" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(1)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(2)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(3)").text() + "


" + reportHtml + ""; + var reportImage = "

Name: " + userName + "


" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(1)").text() + "Performance Report" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(3)").text() + "
Total QuestionCorrect AnswersIncorrect Answers
" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(1)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(2)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(3)").text() + "


" + reportHtml + ""; } else { - $scope.reportImage = "

Name: " + User.Name + "


" + $("#emailComment_" + windowviewid).val() + "

" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(1)").text() + "Performance Report" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(3)").text() + "
Total QuestionCorrect AnswersIncorrect Answers
" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(1)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(2)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(3)").text() + "


" + reportHtml + ""; + var reportImage = "

Name: " + userName + "


" + $("#emailComment_" + windowviewid).val() + "

" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(1)").text() + "Performance Report" + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(3)").text() + "
Total QuestionCorrect AnswersIncorrect Answers
" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(1)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(2)").text() + "" + $("#questionStatus_" + windowviewid + " tbody tr td:nth-child(3)").text() + "


" + reportHtml + ""; } - $scope.reportTitle = "Lab Exercise Report for " + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(1)").text(); - $scope.receiverEmails = $("#emailTo_" + windowviewid).val(); + var reportTitleName = "Lab Exercise Report for " + $("#submitResultHtml_" + windowviewid + " .panel-heading .row div:nth-child(1)").text(); - - LabExerciseService.LabExerciseReport(User, $scope.reportImage, $scope.reportTitle, $scope.reportCopyStatus, $scope.receiverEmails).then( + var User = { + "Name": userName, + "EmailAdd": yourEmail, + "reportImage": reportImage, + "reportTitle": reportTitleName, + "ReportCheck": reportCopyStatus, + "EmailTo": receiverEmails, + }; + + LabExerciseService.LabExerciseReport(User).then( function(result){ if (result == "True") { $rootScope.closeLabExEmailModel("", windowviewid); @@ -1993,7 +2011,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, document.body.style.overflow = "scroll"; document.getElementById('labExModalbackground_' + windowviewid).style.display = "none"; document.getElementById('labExModalID_' + windowviewid).style.display = "none"; - $scope.reportCopyStatus = false; + // $scope.reportCopyStatus = false; + $("#chkCopy_" + windowviewid).prop('checked', false); } $rootScope.sendMail = function ($event) { @@ -2001,6 +2020,9 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, var windowviewid = ($event.target.id).split("_")[len - 1]; window.scrollTo(0, 0); document.body.style.overflow = "hidden"; + + $("#chkCopy_" + windowviewid).prop('checked', false); + document.getElementById('labExModalbackground_' + windowviewid).style.display = "block"; document.getElementById('labExModalID_' + windowviewid).style.display = "block"; } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js index ef36e9a..7b624d8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js @@ -51,11 +51,7 @@ }, // code of email report - LabExerciseReport: function (User, reportImage, reportTitle, reportCopyStatus, receiverEmail) { - User.reportImage = reportImage; - User.reportTitle = reportTitle; - User.ReportCheck = reportCopyStatus; - User.EmailTo = receiverEmail; + LabExerciseReport: function (User) { var deferred = $q.defer(); // var jsonData = { 'EmailTo': User.EmailTo, 'EmailAdd': User.EmailAdd }; $http.post('/API/api/LabExercise/SendEmail', JSON.stringify(User), { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html b/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html index 215f00f..e2ac481 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html @@ -43,7 +43,7 @@
- +
@@ -52,8 +52,7 @@
- - +
@@ -63,7 +62,7 @@
- +