diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
index 1efe17c..50d73ef 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -451,17 +451,23 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
console.log($scope.dragableId);
$scope.dragableText = $("#" + $scope.dragableId).text();
-
+
if ($scope.dragableId.split('-')[0] != 'block') {
$scope.draggableAttribute = $("#" + $scope.dragableId).attr("draggedattr");
// $("#" + $scope.dragableId).removeAttr("draggedattr");
}
else
{
-
$scope.draggableAttribute = '';
}
+ if ($("#textblock").css("display") == "block") {
+ $scope.droppableAttribute = $("#blockbox-" + $scope.dragableId.split('-')[1]).attr("dropdattr");
+ console.log(" $scope.droppableAttribute " + $scope.droppableAttribute + "id" + "#blockbox" + $scope.dragableId.split('-')[1]);
+ }
+
+
+
//if user drag already selected answer from one blankbox to another than it gets id of blank box so need to get answer
if ($scope.dragableId.indexOf('T') != -1) {
var optionText = document.getElementById($scope.dragableId).innerHTML;
@@ -516,7 +522,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
else {
var dataText = e.dataTransfer.getData('text/plain');
}
-
+
if (id == "divoptions" || id == "divleft" || id == "divright") {
$scope.item = $('#' + $scope.dragableId).html();
@@ -535,12 +541,15 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
if ($scope.DraggedList != null) {
$.each($scope.DraggedList, function (inx1, value3) {
$scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
- if ($scope.DraggedList[inx1].DraggedAttr == $scope.draggableAttribute) {
- // $scope.b = $scope.DraggedList[inx1].blockID;
- $scope.DraggedList.splice(inx1, 1);
- $('#' + $scope.draggableAttribute).css({ "display": "block", "color": "#000000!important" });
- $('#blockans-' + $scope.a.split('-')[1]).css("background-color", "transparent !important");
+ if ($scope.DraggedList[inx1].DraggedAttr == $scope.draggableAttribute) {
+ // $scope.b = $scope.DraggedList[inx1].blockID;
+ $scope.DraggedList.splice(inx1, 1);
+ $('#' + $scope.draggableAttribute).css({ "display": "block", "color": "#000000!important" });
+ $('#blockans-' + $scope.a.split('-')[1]).css("background-color", "transparent !important");
+ if ($("#textblock").css("display") == "block") {
+ $('#blockbox-' + $scope.dragableId.split('-')[1]).removeAttr("dropdattr");
}
+ }
});
}
@@ -551,7 +560,6 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
}
});
-
},
function (error) {
console.log(error.statusText)
@@ -559,76 +567,162 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
)
}
else {
- $(this).each(function (key, value) {
-
- var droppedID = $(this).attr("id").split("-");
- if (droppedID[0] == 'blockbox') {
- var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json';
- DataService.getAnotherJson(labExerciseModulePath).then(
- function (result) {
- $.each(result.LabExercise, function (index, value) {
- if (result.LabExercise[index].Slug == keywords.labexercise) {
- $.each(result.LabExercise[index].Questions, function (index1, value1) {
- if (result.LabExercise[index].Questions[index1].Number == $scope.quiznumber) {
- var Options = result.LabExercise[index].Questions[index1].OptionBox;
- $.each(Options, function (inx, value2) {
- if (Options[inx].BoxName == id.split('-')[1]) {
- if ($scope.DraggedList != null) {
- for (var i = 0; i <= $scope.DraggedList.length - 1; i++) {
- if ($scope.DraggedList[i].Value == undefined) {
- i = 0;
- continue;
+ if ($("#textblock").css("display") == "block") {
+ if ($("#"+id).attr("dropdattr") == undefined) {
+ $(this).each(function (key, value) {
+ var droppedID = $(this).attr("id").split("-");
+ if (droppedID[0] == 'blockbox') {
+ var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json';
+ DataService.getAnotherJson(labExerciseModulePath).then(
+ function (result) {
+ $.each(result.LabExercise, function (index, value) {
+ if (result.LabExercise[index].Slug == keywords.labexercise) {
+ $.each(result.LabExercise[index].Questions, function (index1, value1) {
+ if (result.LabExercise[index].Questions[index1].Number == $scope.quiznumber) {
+ var Options = result.LabExercise[index].Questions[index1].OptionBox;
+ $.each(Options, function (inx, value2) {
+ if (Options[inx].BoxName == id.split('-')[1]) {
+ if ($scope.DraggedList != null) {
+ for (var i = 0; i <= $scope.DraggedList.length - 1; i++) {
+ if ($scope.DraggedList[i].Value == undefined) {
+ i = 0;
+ continue;
+ }
+ if ($scope.DraggedList[i].DraggedAttr == $scope.draggableAttribute) {
+ $scope.DraggedList.splice(i, 1);
+ }
+ }
}
- if ($scope.DraggedList[i].DraggedAttr == $scope.draggableAttribute)
- {
- $scope.DraggedList.splice(i, 1);
+ // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
+ //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] });
+ $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
+ if ($scope.dragableId.split('-')[0] == 'block') {
+ $scope.DraggedList.push({ "DraggedAttr": $scope.dragableId, "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
}
- }
- }
- // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
- //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] });
- $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
- if ($scope.dragableId.split('-')[0] == 'block') {
- $scope.DraggedList.push({ "DraggedAttr": $scope.dragableId, "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
- }
- else
- {
- $scope.DraggedList.push({ "DraggedAttr": $scope.draggableAttribute, "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
- }
- $('#' + $scope.dragableId).css("display", "none");
- $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important");
- if ($scope.dragableId.split('-')[0] == 'block') {
- $timeout(function () {
- $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.dragableId);
- }, 350);
- }
- else
- {
- $timeout(function () {
- $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.draggableAttribute);
- }, 350);
- }
- console.log($scope.DraggedList);
- $scope.a = $scope.dragableId;
+ else {
+ $scope.DraggedList.push({ "DraggedAttr": $scope.draggableAttribute, "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
+ }
+ $('#' + $scope.dragableId).css("display", "none");
+ $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important");
+ if ($scope.dragableId.split('-')[0] == 'block') {
+ $timeout(function () {
+ $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.dragableId);
+ }, 350);
+ }
+ else {
+ $timeout(function () {
+ $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.draggableAttribute);
+ }, 350);
+ }
+
+
+ $('#blockbox-' + id.split('-')[1]).attr("dropdAttr", 'blockans-' + id.split('-')[1]);
+ // "blockbox" + $scope.droppableAttribute.split('-')[1];
+ // alert($scope.droppableAttribute);
+
+ if ($scope.droppableAttribute != undefined)
+ {
+ $('#blockbox-' + $scope.droppableAttribute.split('-')[1]).removeAttr("dropdattr");
+ }
+
+ console.log($scope.DraggedList);
+ $scope.a = $scope.dragableId;
+ }
+ });
}
});
}
+
});
- }
- });
-
- },
- function (error) {
- console.log(error.statusText)
- }
- )
+ },
+ function (error) {
+ console.log(error.statusText)
+ }
+ )
+ }
+ });
}
- });
+ else
+ {
+
+
+ }
+ }
+ else {
+ $(this).each(function (key, value) {
+
+ var droppedID = $(this).attr("id").split("-");
+ if (droppedID[0] == 'blockbox') {
+ var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json';
+ DataService.getAnotherJson(labExerciseModulePath).then(
+ function (result) {
+ $.each(result.LabExercise, function (index, value) {
+ if (result.LabExercise[index].Slug == keywords.labexercise) {
+ $.each(result.LabExercise[index].Questions, function (index1, value1) {
+ if (result.LabExercise[index].Questions[index1].Number == $scope.quiznumber) {
+ var Options = result.LabExercise[index].Questions[index1].OptionBox;
+ $.each(Options, function (inx, value2) {
+ if (Options[inx].BoxName == id.split('-')[1]) {
+ if ($scope.DraggedList != null) {
+ for (var i = 0; i <= $scope.DraggedList.length - 1; i++) {
+ if ($scope.DraggedList[i].Value == undefined) {
+ i = 0;
+ continue;
+ }
+ if ($scope.DraggedList[i].DraggedAttr == $scope.draggableAttribute) {
+ $scope.DraggedList.splice(i, 1);
+ }
+ }
+ }
+ // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
+ //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] });
+ $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] });
+ if ($scope.dragableId.split('-')[0] == 'block') {
+ $scope.DraggedList.push({ "DraggedAttr": $scope.dragableId, "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
+ }
+ else {
+ $scope.DraggedList.push({ "DraggedAttr": $scope.draggableAttribute, "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord });
+ }
+ $('#' + $scope.dragableId).css("display", "none");
+ $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important");
+ if ($scope.dragableId.split('-')[0] == 'block') {
+ $timeout(function () {
+ $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.dragableId);
+ }, 350);
+ }
+ else {
+ $timeout(function () {
+ $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.draggableAttribute);
+ }, 350);
+ }
+
+
+ $('#blockbox-' + id.split('-')[1]).attr("dropdAttr", 'blockans-' + id.split('-')[1]);
+ console.log($scope.DraggedList);
+ $scope.a = $scope.dragableId;
+
+ }
+ });
+ }
+ });
+ }
+
+ });
+
+
+ },
+ function (error) {
+ console.log(error.statusText)
+ }
+ )
+ }
+ });
+ }
}
$scope.$apply();
@@ -1041,7 +1135,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
}
$scope.ShowSavedLabExercise = function () {
-
+
//from database
var lastQuestion = $scope.quiznumber;
var lastQuestionDetails;
@@ -1162,6 +1256,9 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
$("#" + concatID).css("width", "auto");
}
});
+ for (var i = 0; i <= $scope.DraggedList.length - 1; i++) {
+ $('#blockbox-' + $scope.DraggedList[i].optionName).attr("dropdattr", "blockans-"+$scope.DraggedList[i].optionName+"")
+ }
}
else {
$("#imgdiv").css("position", "relative");