Commit 972989e7cfd9560a45a45759d71bff1d2b251bf8

Authored by Amrita Vishnoi
2 parents c5c2d1e3 d6c9b9d1

Merge branch 'AAViewMode' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
@@ -33,13 +33,57 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -33,13 +33,57 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
33 selectedorientation: '', 33 selectedorientation: '',
34 selectedimagetype: '', 34 selectedimagetype: '',
35 }; 35 };
36 - $scope.loadForModuleById = function (moduleId) {  
37 36
  37 + $scope.showTabButton = true;
  38 + $scope.isListViewDataLoaded = true;
  39 + $scope.setActiveTab = function (tabToSet) {
  40 +
  41 + $scope.activeTab = tabToSet;
  42 + localStorage.setItem("activeTab", $scope.activeTab);
  43 + if ($scope.activeTab == 1) {
  44 + $('#grid-view').css("display","block");
  45 + $('#list-view').css("display", "none");
  46 + $("#demoView").remove();
  47 + }
  48 + else
  49 + {
  50 + $('#grid-view').css("display", "none");
  51 + if ($scope.isListViewDataLoaded == true) {
  52 + var htm = '';
  53 + htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  54 + $.ajax({
  55 + url: '~/../content/data/json/aa/aa_dat_contentlist.json',
  56 + dataType: "json",
  57 + success: function (result) {
  58 + $(result.root.Item).each(function (key, value) {
  59 + console.log(key + " " + value);
  60 + htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  61 + htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  62 + htm += "</tr>"
  63 + });
  64 + htm += "</tbody></table>";
  65 + $("#list-view").append(htm);
  66 + $compile(htm)($scope);
  67 + }
  68 + });
  69 + $('#list-view').css("display", "block");
  70 + $scope.isListViewDataLoaded = false;
  71 + }
  72 + else
  73 + {
  74 + $('#list-view').css("display", "block");
  75 + }
  76 + }
  77 +
  78 + };
  79 +
  80 + $scope.loadForModuleById = function (moduleId) {
  81 +
38 $scope.moduleId = moduleId; 82 $scope.moduleId = moduleId;
39 - 83 + $scope.activeTab = 1;
40 console.log('loadForModuleById is called') 84 console.log('loadForModuleById is called')
41 $rootScope.moduleName = Modules[moduleId].Name; 85 $rootScope.moduleName = Modules[moduleId].Name;
42 - 86 + $rootScope.currentActiveModuleTitle = $rootScope.moduleName;
43 $scope.AllBodyRegion = BodyRegions; 87 $scope.AllBodyRegion = BodyRegions;
44 $scope.AllBodySystem = BodySystems; 88 $scope.AllBodySystem = BodySystems;
45 $scope.AllOrientation = ViewOrientations; 89 $scope.AllOrientation = ViewOrientations;
@@ -57,17 +101,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -57,17 +101,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
57 console.log(' error: ' + error.statusText); 101 console.log(' error: ' + error.statusText);
58 } 102 }
59 ) 103 )
  104 + }
60 105
  106 + //$scope.$on('$viewContentLoaded', function (event) {
61 107
  108 + // $scope.loadForModuleById();
62 109
63 -  
64 - }  
65 - 110 + //});
  111 + $scope.isOpenBtnClicked = false;
66 $scope.openModuleItemView = function (event) { 112 $scope.openModuleItemView = function (event) {
67 - 113 +
68 //0. Get selected Image Id 114 //0. Get selected Image Id
69 - var moduleItemDataToBeSaved = event.target.id;  
70 - 115 + if ($scope.isListViewButtonClicked == true) {
  116 + if ($scope.isOpenBtnClicked == true) {
  117 + // alert($("#demoText").html());
  118 + var moduleItemDataToBeSaved = $("#demoText").html();
  119 + $scope.isOpenBtnClicked = false;
  120 + }
  121 + else {
  122 + var moduleItemDataToBeSavedID = event.currentTarget.id;
  123 + var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
  124 + }
  125 + }
  126 + else
  127 + {
  128 + var moduleItemDataToBeSaved = event.target.id;
  129 + $scope.isListViewButtonClicked = false;
  130 + }
  131 +
71 //1.Filter selected module ietem data and get the pushed opened moduile array object 132 //1.Filter selected module ietem data and get the pushed opened moduile array object
72 $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData); 133 $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
73 134
@@ -86,6 +147,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -86,6 +147,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
86 $location.url('/module-item-view'); 147 $location.url('/module-item-view');
87 } 148 }
88 149
  150 +
  151 + $scope.openListViewModuleItem = function (event) {
  152 + $("#demoView").remove();
  153 + var moduleItemDataToBeSavedID = event.currentTarget.id;
  154 + var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
  155 + $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
  156 + $rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
  157 + $("#viewList").append("<div class='col-xs-12 text-center' style='padding-top:15px;padding-bottom:15px;' id='demoView'><div class='col-xs-12' style='padding:15px;background-color:#fff;'><div class='col-xs-2' style='border:1px solid #000;padding:5px;color:#000;font-size:12px;'><div class='thumbnail' style='margin-bottom:10px;'><img style='width:auto;height:95px!important;' src=" + $rootScope.OpenItemImagePath + "></div><div class='col-xs-12' id='demoText' style='padding:0;'>" + moduleItemDataToBeSaved + "</div></div></div><a style='position:absolute;right:30px;bottom:34px;' onclick='openCurrentView(event)' href='javascript:void(0)' class='pull-right btn btn-primary'>Open</a></div>");
  158 + }
  159 +
  160 +
89 $scope.openModuleItem = function () { 161 $scope.openModuleItem = function () {
90 var jsContentURL; 162 var jsContentURL;
91 var moduleItemViewDivId; 163 var moduleItemViewDivId;
@@ -158,8 +230,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -158,8 +230,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
158 230
159 $scope.relativeDimesion = 0; 231 $scope.relativeDimesion = 0;
160 $("#modItemImage").css("width", $rootScope.ViewImageWidth + "px"); 232 $("#modItemImage").css("width", $rootScope.ViewImageWidth + "px");
161 -  
162 -  
163 //0.5 create canvas on the top of image so that I can draw a line over the canvas. 233 //0.5 create canvas on the top of image so that I can draw a line over the canvas.
164 var canvas = document.createElement('canvas'); 234 var canvas = document.createElement('canvas');
165 canvas.id = 'aaDetailViewCanvas'; 235 canvas.id = 'aaDetailViewCanvas';
@@ -169,14 +239,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -169,14 +239,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
169 canvas.style.left = '0px'; 239 canvas.style.left = '0px';
170 canvas.style.top = '0px'; 240 canvas.style.top = '0px';
171 canvas.style.position = "absolute"; 241 canvas.style.position = "absolute";
172 - //canvas.addEventListener('click', function () {  
173 - // alert('canvas clicked');  
174 - // var clickedPint = $scope.getMousePos(event);  
175 - // alert('x: ' + clickedPint.x + ', y:' + clickedPint.y);  
176 - //})  
177 $("#canvasDiv").append(canvas); 242 $("#canvasDiv").append(canvas);
178 $scope.context = canvas.getContext("2d") 243 $scope.context = canvas.getContext("2d")
179 -  
180 //6. Show all pins on AA opened item 244 //6. Show all pins on AA opened item
181 $scope.showAllPins(); 245 $scope.showAllPins();
182 //7. Highlight all system body list in left side 246 //7. Highlight all system body list in left side
@@ -380,12 +444,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -380,12 +444,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
380 444
381 $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName; 445 $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName;
382 446
383 - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-3" title = "' + value._Title + '" data-ng-click="openModuleItemView($event)">'  
384 - + '<div class="thumbnail" >'  
385 - + '<img class="tinyImg" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'  
386 - + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');  
387 - 447 +
  448 + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-3" title = "' + value._Title + '" data-ng-click="openModuleItemView($event)">'
  449 + + '<div class="thumbnail" >'
  450 + + '<img class="tinyImg" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
  451 + + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
388 452
  453 +
389 $compile($el)($scope); 454 $compile($el)($scope);
390 455
391 $(".sidebar").mCustomScrollbar({ 456 $(".sidebar").mCustomScrollbar({
@@ -1471,6 +1536,32 @@ function showSelectedPins(event) { @@ -1471,6 +1536,32 @@ function showSelectedPins(event) {
1471 }); 1536 });
1472 } 1537 }
1473 1538
  1539 +
  1540 +function openModuleItemView(event) {
  1541 + var scope = angular.element(document.getElementById("list-view")).scope();
  1542 + scope.isListViewButtonClicked = true;
  1543 + scope.$apply(function () {
  1544 + scope.openModuleItemView(event);
  1545 + });
  1546 +}
  1547 +
  1548 +function openListViewModuleItem(event) {
  1549 + var scope = angular.element(document.getElementById("list-view")).scope();
  1550 + scope.isListViewButtonClicked = true;
  1551 + scope.$apply(function () {
  1552 + scope.openListViewModuleItem(event);
  1553 + });
  1554 +}
  1555 +
  1556 +function openCurrentView(event) {
  1557 + var scope = angular.element(document.getElementById("list-view")).scope();
  1558 + scope.isOpenBtnClicked = true;
  1559 + scope.$apply(function () {
  1560 + scope.openModuleItemView(event);
  1561 + });
  1562 +
  1563 +}
  1564 +
1474 function onZoom(scope) { 1565 function onZoom(scope) {
1475 1566
1476 //$(".common-drag").remove(); 1567 //$(".common-drag").remove();
400-SOURCECODE/AIAHTML5.Web/app/views/tile-view.html
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 <li role="presentation" id="Female" ng-click="getDAViewList($event)"><a><i class="fa fa-venus"></i> Female</a></li> 82 <li role="presentation" id="Female" ng-click="getDAViewList($event)"><a><i class="fa fa-venus"></i> Female</a></li>
83 </ul>--> 83 </ul>-->
84 <!-- Tab panes --> 84 <!-- Tab panes -->
85 - <div class="row tab-content"> 85 + <div class="row tab-content" id="viewList">
86 <!--<div role="tabpanel" class="tab-pane active" id="grid-view">--> 86 <!--<div role="tabpanel" class="tab-pane active" id="grid-view">-->
87 <div role="tabpanel" class="tab-pane active" id="grid-view"> 87 <div role="tabpanel" class="tab-pane active" id="grid-view">
88 <div ng-repeat="(key,val) in moduleLandingData.data.root.Item | orderBy:'_Title' "> 88 <div ng-repeat="(key,val) in moduleLandingData.data.root.Item | orderBy:'_Title' ">
@@ -96,7 +96,8 @@ @@ -96,7 +96,8 @@
96 </div> 96 </div>
97 </div> 97 </div>
98 </div> 98 </div>
99 - </div> 99 + <div class="col-xs-12" id="list-view"></div>
  100 + </div>
100 </div> 101 </div>
101 102
102 <script> 103 <script>