diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
index ed7ee48..1e6a487 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -1,6 +1,6 @@
///
-AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", "$location", "LabExerciseService","AIAConstants",
-function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile, $location, LabExerciseService,AIAConstants) {
+AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http','$timeout', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", "$location", "LabExerciseService","AIAConstants",
+function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, $location, $document, $sce, $compile, $location, LabExerciseService,AIAConstants) {
$scope.$sce = $sce;
$scope.LabExerciseName;
$scope.LabExerciseQuiz = null;
@@ -98,61 +98,88 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
$scope.LabExerciseName = keywords.labexercise;
$scope.LabExerciseModules = null;
$scope.LabExerciseBoxes = null;
-
+
//alert($scope.LabExerciseName)
var labExerciseModulePath = '~/../content/data/json/le/' + $scope.LabExerciseName + '.json';
DataService.getAnotherJson(labExerciseModulePath).then(
function (result) {
$scope.LabExData = result;
- // alert(JSON.stringify(result.LabExercise));
- $.each(result.LabExercise, function (index, value) {
- $scope.LabExerciseName = result.LabExercise[index].Topic;
- if (result.LabExercise[index].Slug == keywords.labexercise) {
- $scope.TotalNumberofQuiz = result.LabExercise[index].NumberofQuestions;
- $.each(result.LabExercise[index].Questions, function (index1, value1) {
- if (result.LabExercise[index].Questions[index1].Number == $scope.quiznumber) {
- $scope.MaxScore = result.LabExercise[index].Questions[index1].Options.length;
- if (result.LabExercise[index].Questions[index1].ImagePath == "") {
- $("#imgblock").css("display", "none");
- //$("#imgblock").remove();
- $scope.IsVisible = false;
- $("#textblock").css("display", "block");
- $scope.LabExerciseModules = result.LabExercise[index].Questions[index1];
- $scope.deliberatelyTrustDangerousSnippet = function (html) {
- //var htmltag= $compile(html)($scope);
- return $sce.trustAsHtml(html);
- };
- $scope.activityTitle = result.LabExercise[index].Questions[index1].activityTitle;
- $scope.Title = result.LabExercise[index].Questions[index1].Title;
- }
- else {
- $("#imgblock").css("display", "block");
- $scope.IsVisible = true;
- $("#textblock").css("display", "none");
- // $("#textblock").remove();
- $scope.LabExerciseModules = result.LabExercise[index].Questions[index1];
- $scope.activityTitle = result.LabExercise[index].Questions[index1].activityTitle;
- $scope.Title = result.LabExercise[index].Questions[index1].Title;
- $scope.Imagepath = keywords.labexercise + "/" + result.LabExercise[index].Questions[index1].ImagePath;
- }
- $scope.ShowHideDiv(result.LabExercise[index].Questions[index1].Options[0].textalign);
+ //get saved labExercis
+ var keywords = $location.search();
+ $scope.labExercideIdentifier = (keywords.labexercise.replace('.json', '')).split('dat_')[1];
+ var labExerciseInfo = {
+ userId: JSON.parse(localStorage.getItem('loggedInUserDetails')).Id,
+ identifier: $scope.labExercideIdentifier,
+ };
- $scope.GetSavedLabExerciseFromDatabase();
- }
- });
- //$scope.quiznumber++;
-
- }
+ LabExerciseService.GetLabExercise(labExerciseInfo)
+ .then(
- });
- //$scope.ShowHideDiv();
- },
+ function (labResult) {
+ if (labResult != undefined && labResult != AIAConstants.SAVED_LAB_EXERCISE_NOT_FOUND) {
+ $scope.SavedLabExercise = labResult;
+ $scope.quiznumber = $scope.SavedLabExercise.lastQuestion;
+
+ //layout the original question data
+
+ $.each(result.LabExercise, function (index, value) {
+ $scope.LabExerciseName = result.LabExercise[index].Topic;
+ if (result.LabExercise[index].Slug == keywords.labexercise) {
+
+ $scope.TotalNumberofQuiz = result.LabExercise[index].NumberofQuestions;
+ $.each(result.LabExercise[index].Questions, function (index1, value1) {
+ if (result.LabExercise[index].Questions[index1].Number == $scope.quiznumber) {
+ $scope.MaxScore = result.LabExercise[index].Questions[index1].Options.length;
+ if (result.LabExercise[index].Questions[index1].ImagePath == "") {
+ $("#imgblock").css("display", "none");
+ //$("#imgblock").remove();
+ $scope.IsVisible = false;
+ $("#textblock").css("display", "block");
+ $scope.LabExerciseModules = result.LabExercise[index].Questions[index1];
+ $scope.deliberatelyTrustDangerousSnippet = function (html) {
+ //var htmltag= $compile(html)($scope);
+ return $sce.trustAsHtml(html);
+ };
+ $scope.activityTitle = result.LabExercise[index].Questions[index1].activityTitle;
+ $scope.Title = result.LabExercise[index].Questions[index1].Title;
+ }
+ else {
+ $("#imgblock").css("display", "block");
+ $scope.IsVisible = true;
+ $("#textblock").css("display", "none");
+ // $("#textblock").remove();
+ $scope.LabExerciseModules = result.LabExercise[index].Questions[index1];
+ $scope.activityTitle = result.LabExercise[index].Questions[index1].activityTitle;
+ $scope.Title = result.LabExercise[index].Questions[index1].Title;
+ $scope.Imagepath = keywords.labexercise + "/" + result.LabExercise[index].Questions[index1].ImagePath;
+ }
+ $scope.ShowHideDiv(result.LabExercise[index].Questions[index1].Options[0].textalign);
+
+ //show saved data
+
+ }
+ });
+ $timeout(function ()
+ {
+ $scope.ShowSavedLabExercise();
+ },100);
+
+ // $scope.ShowSavedLabExercise();
+ //$scope.quiznumber++;
+
+ }
+
+ });
+ }
+ //$scope.ShowHideDiv();
+ },
function (error) {
console.log(error.statusText)
}
)
+ })
}
$scope.nextQuiz = function () {
@@ -230,8 +257,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
var dataText = e.dataTransfer.getData('text/plain');
if (id == "divoptions" || id == "divleft" || id == "divright") {
- alert('if')
-
+
var item = $('#' + $scope.dragableId).html();
var rindex = $scope.DraggedList.indexOf(item);
var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json';
@@ -274,7 +300,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
)
}
else {
- alert('else')
+
var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json';
DataService.getAnotherJson(labExerciseModulePath).then(
function (result) {
@@ -293,14 +319,11 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
}
});
}
- //var balnkBox = id.split('-')[1];
- //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] });
$scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
$scope.DraggedList.push({ "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
- //$('#' + $scope.dragableId).remove();
$('#' + $scope.dragableId).css("display", "none");
$('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important");
- //$('#' + id).remove();
+
}
});
}
@@ -316,12 +339,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
)
}
$scope.$apply();
- //alert($("#divoptions").css("display") + "," + $("#divoptions").html());
- //if ($("#divoptions").css("display") == "block" && $("#divoptions").html()=="")
- //{
- // $("#divoptions").html("
")
- //}
- //alert(JSON.stringify($scope.UserAttempt));
+
};
$scope.handleDragOver = function (e) {
@@ -586,7 +604,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
$scope.ShowSavedLabExercise = function () {
- var lastQuestion = 1;//$scope.SavedLabExercise.lastQuestion;
+ var lastQuestion = $scope.SavedLabExercise.lastQuestion;
var lastQuestionDetails = new jinqJs()
.from($scope.SavedLabExercise.labExercise)
.where('QuestionNo == ' + lastQuestion)
@@ -605,7 +623,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) {
$('#' + blocks[j].id).css("display", "none");
};
- // userAnswers[id.replace('T', '')] = blockAnswers[i].innerHTML;
+
}
}