Commit d0e38872f589034383ada603f19a4cbb936c257e
Merge branch 'labEx' into Develop
Showing
2 changed files
with
70 additions
and
37 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -65,14 +65,12 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -65,14 +65,12 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
65 | 65 | ||
66 | //to get all lab exercise modules from json files | 66 | //to get all lab exercise modules from json files |
67 | $scope.getLabExerciseModules = function () { | 67 | $scope.getLabExerciseModules = function () { |
68 | - //debugger; | 68 | + |
69 | $scope.LabExerciseModules1 = null; | 69 | $scope.LabExerciseModules1 = null; |
70 | var labExerciseModulePath = '~/../content/data/json/le/labexercise.json'; | 70 | var labExerciseModulePath = '~/../content/data/json/le/labexercise.json'; |
71 | 71 | ||
72 | DataService.getAnotherJson(labExerciseModulePath).then( | 72 | DataService.getAnotherJson(labExerciseModulePath).then( |
73 | function (result) { | 73 | function (result) { |
74 | - //debugger; | ||
75 | - //alert(JSON.stringify(result)); | ||
76 | $scope.LabExerciseModules1 = result; | 74 | $scope.LabExerciseModules1 = result; |
77 | }, | 75 | }, |
78 | function (error) { | 76 | function (error) { |
@@ -450,11 +448,20 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -450,11 +448,20 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
450 | 448 | ||
451 | $scope.dragableId = $(this).attr("Id"); | 449 | $scope.dragableId = $(this).attr("Id"); |
452 | $scope.a = $scope.dragableId; | 450 | $scope.a = $scope.dragableId; |
453 | - | 451 | + |
454 | console.log($scope.dragableId); | 452 | console.log($scope.dragableId); |
455 | $scope.dragableText = $("#" + $scope.dragableId).text(); | 453 | $scope.dragableText = $("#" + $scope.dragableId).text(); |
456 | - // alert($("#" + $scope.dragableId).text()); | ||
457 | - | 454 | + |
455 | + if ($scope.dragableId.split('-')[0] != 'block') { | ||
456 | + $scope.draggableAttribute = $("#" + $scope.dragableId).attr("draggedattr"); | ||
457 | + $("#" + $scope.dragableId).removeAttr("draggedattr"); | ||
458 | + } | ||
459 | + else | ||
460 | + { | ||
461 | + | ||
462 | + $scope.draggableAttribute = ''; | ||
463 | + } | ||
464 | + | ||
458 | //if user drag already selected answer from one blankbox to another than it gets id of blank box so need to get answer | 465 | //if user drag already selected answer from one blankbox to another than it gets id of blank box so need to get answer |
459 | if ($scope.dragableId.indexOf('T') != -1) { | 466 | if ($scope.dragableId.indexOf('T') != -1) { |
460 | var optionText = document.getElementById($scope.dragableId).innerHTML; | 467 | var optionText = document.getElementById($scope.dragableId).innerHTML; |
@@ -498,8 +505,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -498,8 +505,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
498 | var x = $("#droppable").offset(); | 505 | var x = $("#droppable").offset(); |
499 | 506 | ||
500 | var id = $(this).attr("id"); | 507 | var id = $(this).attr("id"); |
501 | - | ||
502 | - | 508 | + |
509 | + | ||
503 | var keywords = $location.search(); | 510 | var keywords = $location.search(); |
504 | 511 | ||
505 | if ($.browser.msie) { | 512 | if ($.browser.msie) { |
@@ -528,13 +535,13 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -528,13 +535,13 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
528 | if ($scope.DraggedList != null) { | 535 | if ($scope.DraggedList != null) { |
529 | $.each($scope.DraggedList, function (inx1, value3) { | 536 | $.each($scope.DraggedList, function (inx1, value3) { |
530 | $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); | 537 | $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); |
531 | - if ($scope.DraggedList[inx1].id == $scope.a.split('-')[1]) { | ||
532 | - $scope.b = $scope.DraggedList[inx1].blockID; | ||
533 | - $scope.DraggedList.splice(inx1, 1); | ||
534 | - $('#' + $scope.b).css({ "display": "block", "color": "#000000!important" }); | ||
535 | - $('#blockans-' + $scope.b.split('-')[1]).css("background-color", "transparent !important"); | ||
536 | - // alert('removed from dropbox= '+'blockans-' + $scope.b.split('-')[1]); | ||
537 | - } | 538 | + if ($scope.DraggedList[inx1].DraggedAttr == $scope.draggableAttribute) { |
539 | + // $scope.b = $scope.DraggedList[inx1].blockID; | ||
540 | + $scope.DraggedList.splice(inx1, 1); | ||
541 | + $('#' + $scope.draggableAttribute).css({ "display": "block", "color": "#000000!important" }); | ||
542 | + $('#blockans-' + $scope.a.split('-')[1]).css("background-color", "transparent !important"); | ||
543 | + } | ||
544 | + | ||
538 | }); | 545 | }); |
539 | } | 546 | } |
540 | } | 547 | } |
@@ -567,21 +574,13 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -567,21 +574,13 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
567 | $.each(Options, function (inx, value2) { | 574 | $.each(Options, function (inx, value2) { |
568 | if (Options[inx].BoxName == id.split('-')[1]) { | 575 | if (Options[inx].BoxName == id.split('-')[1]) { |
569 | if ($scope.DraggedList != null) { | 576 | if ($scope.DraggedList != null) { |
570 | - //$.each($scope.DraggedList, function (inx1, value3) { | ||
571 | - // if ($scope.DraggedList[inx1].Value == dataText) { | ||
572 | - // $scope.DraggedList.splice(inx1, 1); | ||
573 | - // } | ||
574 | - //}); | ||
575 | for (var i = 0; i <= $scope.DraggedList.length - 1; i++) { | 577 | for (var i = 0; i <= $scope.DraggedList.length - 1; i++) { |
576 | - | ||
577 | if ($scope.DraggedList[i].Value == undefined) { | 578 | if ($scope.DraggedList[i].Value == undefined) { |
578 | i = 0; | 579 | i = 0; |
579 | continue; | 580 | continue; |
580 | } | 581 | } |
581 | - | ||
582 | - | ||
583 | - //if ($scope.DraggedList[i].Value == dataText) { | ||
584 | - if ($scope.DraggedList[i].id == id.split('-')[1]) { | 582 | + if ($scope.DraggedList[i].DraggedAttr == $scope.draggableAttribute) |
583 | + { | ||
585 | $scope.DraggedList.splice(i, 1); | 584 | $scope.DraggedList.splice(i, 1); |
586 | } | 585 | } |
587 | } | 586 | } |
@@ -589,10 +588,29 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -589,10 +588,29 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
589 | // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); | 588 | // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); |
590 | //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] }); | 589 | //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] }); |
591 | $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); | 590 | $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); |
592 | - $scope.DraggedList.push({ "blockID": $scope.dragableId, "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord }); | 591 | + if ($scope.dragableId.split('-')[0] == 'block') { |
592 | + $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 }); | ||
593 | + } | ||
594 | + else | ||
595 | + { | ||
596 | + $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 }); | ||
597 | + } | ||
593 | $('#' + $scope.dragableId).css("display", "none"); | 598 | $('#' + $scope.dragableId).css("display", "none"); |
594 | $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important"); | 599 | $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important"); |
600 | + if ($scope.dragableId.split('-')[0] == 'block') { | ||
601 | + $timeout(function () { | ||
602 | + $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.dragableId); | ||
603 | + }, 350); | ||
604 | + } | ||
605 | + else | ||
606 | + { | ||
607 | + $timeout(function () { | ||
608 | + $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.draggableAttribute); | ||
609 | + }, 350); | ||
610 | + } | ||
611 | + console.log($scope.DraggedList); | ||
595 | $scope.a = $scope.dragableId; | 612 | $scope.a = $scope.dragableId; |
613 | + | ||
596 | } | 614 | } |
597 | }); | 615 | }); |
598 | } | 616 | } |
@@ -759,6 +777,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -759,6 +777,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
759 | $("#messageModal").modal('show'); | 777 | $("#messageModal").modal('show'); |
760 | } | 778 | } |
761 | ) | 779 | ) |
780 | + | ||
781 | + | ||
762 | }; | 782 | }; |
763 | 783 | ||
764 | $scope.usersCorrectQuestData = []; | 784 | $scope.usersCorrectQuestData = []; |
@@ -1071,21 +1091,33 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -1071,21 +1091,33 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
1071 | $('#' + blocks[j].id).css("display", "none"); | 1091 | $('#' + blocks[j].id).css("display", "none"); |
1072 | break; | 1092 | break; |
1073 | } | 1093 | } |
1074 | - | 1094 | + |
1075 | }; | 1095 | }; |
1076 | - | 1096 | + |
1077 | } | 1097 | } |
1078 | 1098 | ||
1079 | } | 1099 | } |
1080 | } | 1100 | } |
1081 | 1101 | ||
1082 | - else { | ||
1083 | - var dragList = lastQuestionDetails[0].DragList; | ||
1084 | - angular.forEach(dragList, function (v, k) { | ||
1085 | - $('#' + v.blockID).css("display", "none"); | ||
1086 | - }) | ||
1087 | - } | 1102 | + } |
1103 | + if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0 && !isFromDB) { | ||
1104 | + var dragList = lastQuestionDetails[0].DragList; | ||
1105 | + var blocks = $("div[id*='block-']"); | ||
1106 | + angular.forEach(dragList, function (v, k) { | ||
1107 | + | ||
1108 | + for (var j = 0; j < blocks.length; j++) { | ||
1109 | + | ||
1110 | + if ((blocks[j].innerHTML).toString() == v.Value) { | ||
1111 | + if ($('#' + blocks[j].id).css('display').toLowerCase() == 'block') { | ||
1112 | + $('#' + blocks[j].id).css("display", "none"); | ||
1113 | + break; | ||
1114 | + } | ||
1115 | + | ||
1116 | + }; | ||
1088 | 1117 | ||
1118 | + } | ||
1119 | + //$('#' + v.blockID).css("display", "none"); | ||
1120 | + }) | ||
1089 | } | 1121 | } |
1090 | var labQuestionData = new jinqJs() | 1122 | var labQuestionData = new jinqJs() |
1091 | .from($scope.LabExData.LabExercise[0].Questions) | 1123 | .from($scope.LabExData.LabExercise[0].Questions) |
@@ -1104,13 +1136,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -1104,13 +1136,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
1104 | .where('OptionTitle == ' + value.text) | 1136 | .where('OptionTitle == ' + value.text) |
1105 | .select(); | 1137 | .select(); |
1106 | 1138 | ||
1107 | - | 1139 | + |
1108 | var blockId = 'block-' + OptionList[0].OptionNumber; | 1140 | var blockId = 'block-' + OptionList[0].OptionNumber; |
1109 | if (OptionList != undefined && OptionList.length > 1 && blockIds.indexOf(blockId) != -1) { | 1141 | if (OptionList != undefined && OptionList.length > 1 && blockIds.indexOf(blockId) != -1) { |
1110 | blockId = 'block-' + OptionList[1].OptionNumber; | 1142 | blockId = 'block-' + OptionList[1].OptionNumber; |
1111 | } | 1143 | } |
1112 | blockIds.push(blockId); | 1144 | blockIds.push(blockId); |
1113 | - $scope.DraggedList.push({ "blockID": blockId, "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | 1145 | + console.log($scope.draggedIDArray); |
1146 | + $scope.DraggedList.push({ "DraggedAttr": blockId, "blockID": blockId, "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | ||
1114 | 1147 | ||
1115 | 1148 | ||
1116 | // $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | 1149 | // $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); |
400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | </div> | 52 | </div> |
53 | 53 | ||
54 | <div ng-show="IsVisible" ng-repeat="optionbox in LabExerciseModules.OptionBox" droppable="true" class="droppable ui-droppable options" id="blockbox-{{optionbox.BoxName}}" ng-style="{'top':{{optionbox.topcoord}}, 'left':{{optionbox.leftcoord}},'position': 'absolute', 'width': '155px', 'height':'30px', 'border':'0px solid #333', 'background': '#E8E8E8' }">{{optionbox.Answervalue}}</div> | 54 | <div ng-show="IsVisible" ng-repeat="optionbox in LabExerciseModules.OptionBox" droppable="true" class="droppable ui-droppable options" id="blockbox-{{optionbox.BoxName}}" ng-style="{'top':{{optionbox.topcoord}}, 'left':{{optionbox.leftcoord}},'position': 'absolute', 'width': '155px', 'height':'30px', 'border':'0px solid #333', 'background': '#E8E8E8' }">{{optionbox.Answervalue}}</div> |
55 | - <div draggable="true" ng-repeat="ans in DraggedList" droppable="true" class="droppable ui-droppable answerdroppable" id="blockans-{{ans.id}}" ng-style="{'top':{{ans.topcoord}}, 'left':{{ans.leftcoord}},'position': 'absolute', 'width': '158px', 'height':'30px', 'border':'0px solid #333', 'background': 'transparent','font-size': '12px','border-color':'#FF0000','padding-top':'4px','line-height':'1'}">{{ans.Value}}</div> | 55 | + <div draggable="true" ng-repeat="ans in DraggedList" droppable="true" class="droppable ui-droppable answerdroppable" id="blockans-{{ans.id}}" draggedattr="{{ans.DraggedAttr}}" ng-style="{'top':{{ans.topcoord}}, 'left':{{ans.leftcoord}},'position': 'absolute', 'width': '158px', 'height':'30px', 'border':'0px solid #333', 'background': 'transparent','font-size': '12px','border-color':'#FF0000','padding-top':'4px','line-height':'1'}">{{ans.Value}}</div> |
56 | </div> | 56 | </div> |
57 | 57 | ||
58 | <div class="col-sm-12" style=" margin-top: 20px; min-height:100px;" id="divoptions" droppable="true"> | 58 | <div class="col-sm-12" style=" margin-top: 20px; min-height:100px;" id="divoptions" droppable="true"> |