Commit 6f4247107949966505b692edc0473b8c53251583
1 parent
2c9d1f04
Commit Changes
Showing
2 changed files
with
81 additions
and
23 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... | ... | @@ -450,11 +450,20 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
450 | 450 | |
451 | 451 | $scope.dragableId = $(this).attr("Id"); |
452 | 452 | $scope.a = $scope.dragableId; |
453 | - | |
453 | + | |
454 | 454 | console.log($scope.dragableId); |
455 | 455 | $scope.dragableText = $("#" + $scope.dragableId).text(); |
456 | - // alert($("#" + $scope.dragableId).text()); | |
457 | - | |
456 | + | |
457 | + if ($scope.dragableId.split('-')[0] != 'block') { | |
458 | + $scope.draggableAttribute = $("#" + $scope.dragableId).attr("draggedattr"); | |
459 | + $("#" + $scope.dragableId).removeAttr("draggedattr"); | |
460 | + } | |
461 | + else | |
462 | + { | |
463 | + | |
464 | + $scope.draggableAttribute = ''; | |
465 | + } | |
466 | + | |
458 | 467 | //if user drag already selected answer from one blankbox to another than it gets id of blank box so need to get answer |
459 | 468 | if ($scope.dragableId.indexOf('T') != -1) { |
460 | 469 | var optionText = document.getElementById($scope.dragableId).innerHTML; |
... | ... | @@ -498,8 +507,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
498 | 507 | var x = $("#droppable").offset(); |
499 | 508 | |
500 | 509 | var id = $(this).attr("id"); |
501 | - | |
502 | - | |
510 | + | |
511 | + | |
503 | 512 | var keywords = $location.search(); |
504 | 513 | |
505 | 514 | if ($.browser.msie) { |
... | ... | @@ -528,13 +537,38 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
528 | 537 | if ($scope.DraggedList != null) { |
529 | 538 | $.each($scope.DraggedList, function (inx1, value3) { |
530 | 539 | $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 | - } | |
540 | + debugger; | |
541 | + | |
542 | + if ($scope.DraggedList[inx1].DraggedAttr == $scope.draggableAttribute) { | |
543 | + // $scope.b = $scope.DraggedList[inx1].blockID; | |
544 | + $scope.DraggedList.splice(inx1, 1); | |
545 | + $('#' + $scope.draggableAttribute).css({ "display": "block", "color": "#000000!important" }); | |
546 | + $('#blockans-' + $scope.a.split('-')[1]).css("background-color", "transparent !important"); | |
547 | + // alert('removed from dropbox= '+'blockans-' + $scope.b.split('-')[1]); | |
548 | + | |
549 | + } | |
550 | + | |
551 | + | |
552 | + | |
553 | + | |
554 | + //if ($scope.DraggedList[inx1].id == $scope.a.split('-')[1]) { | |
555 | + // $scope.b = $scope.DraggedList[inx1].blockID; | |
556 | + // $scope.DraggedList.splice(inx1, 1); | |
557 | + // $('#' + $scope.b).css({ "display": "block", "color": "#000000!important" }); | |
558 | + // $('#blockans-' + $scope.a.split('-')[1]).css("background-color", "transparent !important"); | |
559 | + | |
560 | + //} | |
561 | + | |
562 | + //else | |
563 | + //{ | |
564 | + // if ($scope.DraggedList[inx1].DraggedAttr == $scope.draggableAttribute) { | |
565 | + // $scope.b = $scope.DraggedList[inx1].blockID; | |
566 | + // $scope.DraggedList.splice(inx1, 1); | |
567 | + // $('#' + $scope.draggableAttribute).css({ "display": "block", "color": "#000000!important" }); | |
568 | + // $('#blockans-' + $scope.b.split('-')[1]).css("background-color", "transparent !important"); | |
569 | + // // alert('removed from dropbox= '+'blockans-' + $scope.b.split('-')[1]); | |
570 | + // } | |
571 | + //} | |
538 | 572 | }); |
539 | 573 | } |
540 | 574 | } |
... | ... | @@ -579,9 +613,13 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
579 | 613 | continue; |
580 | 614 | } |
581 | 615 | |
582 | - | |
616 | + debugger; | |
617 | + | |
583 | 618 | //if ($scope.DraggedList[i].Value == dataText) { |
584 | - if ($scope.DraggedList[i].id == id.split('-')[1]) { | |
619 | + // if ($scope.DraggedList[i].id == id.split('-')[1]) | |
620 | + | |
621 | + if ($scope.DraggedList[i].DraggedAttr == $scope.draggableAttribute) | |
622 | + { | |
585 | 623 | $scope.DraggedList.splice(i, 1); |
586 | 624 | } |
587 | 625 | } |
... | ... | @@ -589,10 +627,29 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
589 | 627 | // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); |
590 | 628 | //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] }); |
591 | 629 | $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 }); | |
630 | + if ($scope.dragableId.split('-')[0] == 'block') { | |
631 | + $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 }); | |
632 | + } | |
633 | + else | |
634 | + { | |
635 | + $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 }); | |
636 | + } | |
593 | 637 | $('#' + $scope.dragableId).css("display", "none"); |
594 | 638 | $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important"); |
639 | + if ($scope.dragableId.split('-')[0] == 'block') { | |
640 | + $timeout(function () { | |
641 | + $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.dragableId); | |
642 | + }, 350); | |
643 | + } | |
644 | + else | |
645 | + { | |
646 | + $timeout(function () { | |
647 | + $('#blockans-' + id.split('-')[1]).attr("draggedAttr", $scope.draggableAttribute); | |
648 | + }, 350); | |
649 | + } | |
650 | + console.log($scope.DraggedList); | |
595 | 651 | $scope.a = $scope.dragableId; |
652 | + | |
596 | 653 | } |
597 | 654 | }); |
598 | 655 | } |
... | ... | @@ -759,6 +816,8 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
759 | 816 | $("#messageModal").modal('show'); |
760 | 817 | } |
761 | 818 | ) |
819 | + | |
820 | + | |
762 | 821 | }; |
763 | 822 | |
764 | 823 | $scope.usersCorrectQuestData = []; |
... | ... | @@ -1059,20 +1118,18 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1059 | 1118 | for (var i = 0; i < lastQuestionAnswers.length; i++) { |
1060 | 1119 | var num = i + 1; |
1061 | 1120 | $scope.QustionAnsKeyValue.push({ blockbox: 'T' + num, text: lastQuestionAnswers[i] }); |
1062 | - | |
1063 | 1121 | if (isFromDB) { |
1064 | - | |
1122 | + | |
1065 | 1123 | if (lastQuestionAnswers[i] != "") { |
1066 | 1124 | var blocks = $("div[id*='block-']"); |
1067 | 1125 | for (var j = 0; j < blocks.length; j++) { |
1068 | - | |
1069 | 1126 | if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) { |
1127 | + debugger; | |
1128 | + alert((blocks[j].innerHTML).toString()); | |
1070 | 1129 | $('#' + blocks[j].id).css("display", "none"); |
1071 | 1130 | break; |
1072 | 1131 | }; |
1073 | - | |
1074 | 1132 | } |
1075 | - | |
1076 | 1133 | } |
1077 | 1134 | } |
1078 | 1135 | |
... | ... | @@ -1101,13 +1158,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1101 | 1158 | .where('OptionTitle == ' + value.text) |
1102 | 1159 | .select(); |
1103 | 1160 | |
1104 | - | |
1161 | + debugger; | |
1105 | 1162 | var blockId = 'block-' + OptionList[0].OptionNumber; |
1106 | 1163 | if (OptionList != undefined && OptionList.length > 1 && blockIds.indexOf(blockId) != -1) { |
1107 | 1164 | blockId = 'block-' + OptionList[1].OptionNumber; |
1108 | 1165 | } |
1109 | 1166 | blockIds.push(blockId); |
1110 | - $scope.DraggedList.push({ "blockID": blockId, "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | |
1167 | + console.log($scope.draggedIDArray); | |
1168 | + $scope.DraggedList.push({ "DraggedAttr": blockId, "blockID": blockId, "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | |
1111 | 1169 | |
1112 | 1170 | |
1113 | 1171 | // $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 | 52 | </div> |
53 | 53 | |
54 | 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 | 56 | </div> |
57 | 57 | |
58 | 58 | <div class="col-sm-12" style=" margin-top: 20px; min-height:100px;" id="divoptions" droppable="true"> | ... | ... |