Commit db0190c6b91562f94e40092418e5cb34fb39c7ee

Authored by Mitali Srivastava
1 parent d0198fd5

Bug #8680: CI > List View> State should be maintained if we open and close any of the image

400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js
... ... @@ -40,45 +40,26 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
40 40 //set the local storage
41 41  
42 42 var curtab = localStorage.getItem("currentCATabView");
  43 + //if (curtab == 2) {
  44 + // $scope.setActiveTab(2);
  45 + //}
43 46 if (curtab == 2) {
44 47 $scope.setActiveTab(2);
  48 + var curSelectedRowId = localStorage.getItem("CASelectedRowId");
  49 + if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') {
  50 + $scope.reRunSearchOnLoad();
  51 + $scope.idSelected = curSelectedRowId;
  52 + $scope.ReloadListViewImageDiv($scope.idSelected);
  53 + }
  54 + else {
  55 + $scope.reRunSearchOnLoad()
  56 + $scope.idSelected = '';
  57 + }
45 58 }
46 59 else {
47 60 $scope.setActiveTab(1);
48 61 }
49 62  
50   - //var curBodyRegion = localStorage.getItem("CACurBodyRegion");
51   - //if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') {
52   - // $scope.query.selectedbodyregion = curBodyRegion;
53   - //}
54   - //else {
55   - // $scope.query.selectedbodyregion = "";
56   - //}
57   -
58   - //var curBodySystem = localStorage.getItem("CACurBodySystem");
59   - //if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null && curBodySystem !== '') {
60   - // $scope.query.selectedbodysystem = curBodySystem;
61   - //}
62   - //else {
63   - // $scope.query.selectedbodysystem = "";
64   - //}
65   -
66   - //var curSpeciality = localStorage.getItem("CACurSpeciality");
67   - //if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null && curSpeciality !== '') {
68   - // $scope.query.selectedspecialty = curSpeciality;
69   - //}
70   - //else {
71   - // $scope.query.selectedspecialty = "";
72   - //}
73   -
74   -
75   - //if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedspecialty == "") {
76   - // $scope.loadAllCA();
77   - //}
78   - //else {
79   - // $scope.ApplySearch($scope.query);
80   - //}
81   -
82 63 $scope.reRunSearchOnLoad();
83 64  
84 65 });
... ... @@ -197,6 +178,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
197 178 $scope.showItem = function (id) {
198 179 //console.log(id);
199 180 $scope.idSelected = id;
  181 + localStorage.setItem("CASelectedRowId", id);
  182 +
  183 + //Set the vertical scroll value of the table.
  184 + var y = $('#ListViewDiv').scrollTop();
  185 + localStorage.setItem("CAListViewScroll", y);
  186 +
200 187 $scope.hiderow = true;
201 188 if ($scope.filterstring == false) {
202 189  
... ... @@ -238,15 +225,30 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
238 225 query.selectedspecialty = "";
239 226  
240 227 //set localstorage values
241   - localStorage.setItem("CACurBodyRegion", query.selectedbodyregion);
242   - localStorage.setItem("CACurBodySystem", query.selectedbodysystem);
243   - localStorage.setItem("CACurSpeciality", query.selectedspecialty);
  228 + localStorage.setItem("CACurBodyRegion", '');
  229 + localStorage.setItem("CACurBodySystem", '');
  230 + localStorage.setItem("CACurSpeciality", '');
  231 + localStorage.setItem("CAListViewScroll", '');
  232 + localStorage.setItem("CASelectedRowId", "");
244 233  
245 234 $scope.filterstring = false;
  235 +
  236 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  237 +
  238 + $('#ListViewDiv').scrollTop(0);
  239 +
  240 + $scope.HideListViewDiv();
  241 +
  242 +
246 243 while ($scope.searchCAListViewData.length) {
247 244 $scope.searchCAListViewData.pop();
248 245 }
249 246  
  247 + if (localStorage.getItem("currentCATabView") == 2) {
  248 + localStorage.setItem("CASelectedRowId", "");
  249 + $scope.hiderow = false;
  250 + }
  251 +
250 252 $scope.loadAllCA();
251 253  
252 254 }
... ... @@ -582,6 +584,58 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
582 584 $scope.videoNumber = vidNumber;
583 585 };
584 586  
  587 + $scope.ReloadListViewImageDiv = function (id) {
  588 + //console.log(id);
  589 + $scope.idSelected = id;
  590 + $scope.hiderow = true;
  591 +
  592 + var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
  593 + promise.then(
  594 + function (result) {
  595 + $scope.AnimationData = result;
  596 + //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
  597 +
  598 + var SelectedCAthumbImage = [];
  599 + SelectedCAthumbImage = new jinqJs()
  600 + .from($scope.AnimationData.root.CAData)
  601 + .where('_id = ' + id)
  602 + .select('_ThumbnailImage', '_Summary', '_id', '_Title');
  603 +
  604 + //console.log($scope.selectedCAListViewData);
  605 +
  606 + $scope.SelectedCAthumbImage = "~/../content/images/ca/thumbnails/" + SelectedCAthumbImage[0]._ThumbnailImage;
  607 +
  608 + $scope.SelectedCASummary = SelectedCAthumbImage[0]._Summary;
  609 + $scope.SelectedCAId = SelectedCAthumbImage[0]._id;
  610 + $scope.SelectedCATitle = SelectedCAthumbImage[0]._Title;
  611 +
  612 + //Set the scroll position of the tablebody to show selected row.
  613 +
  614 + var curCAListViewScroll = localStorage.getItem("CAListViewScroll");
  615 + if (typeof (curCAListViewScroll) !== "undefined" && curCAListViewScroll !== null && curCAListViewScroll !== '') {
  616 +
  617 + $('#ListViewDiv').scrollTop(localStorage.getItem("CAListViewScroll"));
  618 + }
  619 + //else {
  620 + // $('#ListViewDiv').scrollTop(0);
  621 + //}
  622 +
  623 + },
  624 + function (error) {
  625 + // handle errors here
  626 + console.log(' $scope.AnimationData = ' + error.statusText);
  627 + }
  628 + );
  629 + };
  630 +
  631 + $scope.hideListViewDiv = function () {
  632 + if (localStorage.getItem("currentCATabView") == 2) {
  633 + localStorage.setItem("CASelectedRowId", "");
  634 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  635 + $scope.hiderow = false;
  636 + }
  637 + }
  638 +
585 639  
586 640 }]
587 641  
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js
... ... @@ -17,6 +17,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
17 17 $scope.selectedCIListViewData = [];
18 18 $scope.filterstring = false;
19 19 $scope.idSelected;
  20 + $scope.srollListView;
20 21 $scope.query = {
21 22 selectedbodyregion: '',
22 23 selectedbodysystem: '',
... ... @@ -50,59 +51,22 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
50 51 var curtab = localStorage.getItem("currentCITabView");
51 52 if (curtab == 2) {
52 53 $scope.setActiveTab(2);
  54 + var curSelectedRowId = localStorage.getItem("CISelectedRowId");
  55 + if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') {
  56 + $scope.reRunSearchOnLoad();
  57 + $scope.idSelected = curSelectedRowId;
  58 + $scope.ReloadListViewImageDiv($scope.idSelected);
  59 + }
  60 + else {
  61 + $scope.reRunSearchOnLoad()
  62 + $scope.idSelected = '';
  63 + }
53 64 }
54 65 else {
55 66 $scope.setActiveTab(1);
56 67 }
57 68  
58 69 $scope.reRunSearchOnLoad();
59   - //var curBodyRegion = localStorage.getItem("CICurBodyRegion");
60   - //if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !=='') {
61   - // $scope.query.selectedbodyregion = curBodyRegion;
62   - //}
63   - //else {
64   - // $scope.query.selectedbodyregion = "";
65   - //}
66   -
67   - //var curBodySystem = localStorage.getItem("CICurBodySystem");
68   - //if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null && curBodySystem !=='') {
69   - // $scope.query.selectedbodysystem = curBodySystem;
70   - //}
71   - //else {
72   - // $scope.query.selectedbodysystem = "";
73   - //}
74   -
75   - //var curOrientation = localStorage.getItem("CICurOrientation");
76   - //if (typeof (curOrientation) !== "undefined" && curOrientation !== null && curOrientation !=='') {
77   - // $scope.query.selectedorientation = curOrientation;
78   - //}
79   - //else {
80   - // $scope.query.selectedorientation = "";
81   - //}
82   -
83   - //var curImageType = localStorage.getItem("CICurImageType");
84   - //if (typeof (curImageType) !== "undefined" && curImageType !== null && curImageType !=='') {
85   - // $scope.query.selectedimagetype = curImageType;
86   - //}
87   - //else {
88   - // $scope.query.selectedimagetype = "";
89   - //}
90   -
91   - //var curSpeciality = localStorage.getItem("CICurSpeciality");
92   - //if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null && curSpeciality !=='') {
93   - // $scope.query.selectedspecialty = curSpeciality;
94   - //}
95   - //else {
96   - // $scope.query.selectedspecialty = "";
97   - //}
98   -
99   -
100   - //if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedorientation == "" && $scope.query.selectedimagetype == "" && $scope.query.selectedspecialty == "") {
101   - // $scope.loadAllCI();
102   - //}
103   - //else {
104   - // $scope.ApplySearch($scope.query);
105   - //}
106 70  
107 71 });
108 72  
... ... @@ -164,8 +128,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
164 128 promise.then(
165 129 function (result) {
166 130 $scope.IllustrationData = result;
167   - //$scope.selectedCIListViewData = $scope.IllustrationData.root.CIData;
168   -
169 131 $scope.selectedCIListViewData = new jinqJs()
170 132 .from($scope.IllustrationData.root.CIData)
171 133 .orderBy([{ field: '_Title', sort: 'asc' }])
... ... @@ -187,7 +149,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
187 149 promise.then(
188 150 function (result) {
189 151 $scope.IllustrationData = result;
190   - //$scope.selectedCIListViewData = $scope.IllustrationData.root.CIData;
191 152  
192 153 $scope.selectedCIListViewData = new jinqJs()
193 154 .from($scope.IllustrationData.root.CIData)
... ... @@ -229,8 +190,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
229 190 }
230 191  
231 192 $scope.showItem = function (id) {
232   - // console.log(id);
233 193 $scope.idSelected = id;
  194 + localStorage.setItem("CISelectedRowId", id);
  195 +
  196 + //Set the vertical scroll value of the table.
  197 + var y = $('#ListViewDiv').scrollTop();
  198 + localStorage.setItem("CIListViewScroll", y);
  199 +
234 200 $scope.hiderow = true;
235 201 if ($scope.filterstring == false) {
236 202  
... ... @@ -274,11 +240,19 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
274 240  
275 241  
276 242 //set localstorage values
277   - localStorage.setItem("CICurBodyRegion", query.selectedbodyregion);
278   - localStorage.setItem("CICurBodySystem", query.selectedbodysystem);
279   - localStorage.setItem("CICurOrientation", query.selectedorientation);
280   - localStorage.setItem("CICurImageType", query.selectedimagetype);
281   - localStorage.setItem("CICurSpeciality", query.selectedspecialty);
  243 + localStorage.setItem("CICurBodyRegion", '');
  244 + localStorage.setItem("CICurBodySystem", '');
  245 + localStorage.setItem("CICurOrientation", '');
  246 + localStorage.setItem("CICurImageType", '');
  247 + localStorage.setItem("CICurSpeciality", '');
  248 + localStorage.setItem("CISelectedRowId", "");
  249 + localStorage.setItem("CIListViewScroll", '');
  250 +
  251 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  252 +
  253 + $('#ListViewDiv').scrollTop(0);
  254 +
  255 + $scope.HideListViewDiv();
282 256  
283 257 $scope.filterstring = false;
284 258 while ($scope.searchCIListViewData.length) {
... ... @@ -345,7 +319,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
345 319 promise.then(
346 320 function (result) {
347 321 $scope.IllustrationData = result;
348   - //$scope.selectedCIListViewData = $scope.IllustrationData.root.CIData;
349 322  
350 323 $scope.selectedCIListViewData = new jinqJs()
351 324 .from($scope.IllustrationData.root.CIData)
... ... @@ -649,6 +622,54 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
649 622 // $rootScope.FreeStylePaint();
650 623 });
651 624  
  625 + $scope.ReloadListViewImageDiv = function (id) {
  626 + //console.log(id);
  627 + $scope.idSelected = id;
  628 + $scope.hiderow = true;
  629 +
  630 + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')
  631 + promise.then(
  632 + function (result) {
  633 + $scope.IllustrationData = result;
  634 +
  635 + var SelectedCIthumbImage = [];
  636 + SelectedCIthumbImage = new jinqJs()
  637 + .from($scope.IllustrationData.root.CIData)
  638 + .where('_id = ' + id)
  639 + .select('_ThumbnailImage', '_Summary', '_id', '_Title');
  640 +
  641 + $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;
  642 + $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;
  643 + $scope.SelectedCIId = SelectedCIthumbImage[0]._id;
  644 + $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;
  645 +
  646 + //Set the scroll position of the tablebody to show selected row.
  647 +
  648 + var curCIListViewScroll = localStorage.getItem("CIListViewScroll");
  649 + if (typeof (curCIListViewScroll) !== "undefined" && curCIListViewScroll !== null && curCIListViewScroll !== '') {
  650 +
  651 + $('#ListViewDiv').scrollTop(localStorage.getItem("CIListViewScroll"));
  652 + }
  653 + //else {
  654 + // $('#ListViewDiv').scrollTop(0);
  655 + //}
  656 +
  657 + },
  658 + function (error) {
  659 + // handle errors here
  660 + console.log(' $scope.AnimationData = ' + error.statusText);
  661 + }
  662 + );
  663 + };
  664 +
  665 + $scope.hideListViewDiv = function () {
  666 + if (localStorage.getItem("currentCITabView") == 2) {
  667 + localStorage.setItem("CISelectedRowId", "");
  668 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  669 + $scope.hiderow = false;
  670 + }
  671 + }
  672 +
652 673 }]
653 674  
654 675  
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/ca/ca-view.html
... ... @@ -12,7 +12,7 @@
12 12 <div class="col-md-2 col-sm-4 pad-lftrgt3">
13 13 <div class="form-group">
14 14 <h6 class="text-center text-primary txt-white f11">Body Region</h6>
15   - <select class="form-control input-sm" ng-model="query.selectedbodyregion" ng-options="item for item in CAAllBodyRegion track by item">
  15 + <select class="form-control input-sm" ng-change="hideListViewDiv()" ng-model="query.selectedbodyregion" ng-options="item for item in CAAllBodyRegion track by item">
16 16 <option value="">All</option>
17 17 </select>
18 18 </div>
... ... @@ -20,7 +20,7 @@
20 20 <div class="col-md-2 col-sm-4 pad-lftrgt3">
21 21 <div class="form-group">
22 22 <h6 class="text-center text-primary txt-white f11">Body System</h6>
23   - <select class="form-control input-sm" ng-model="query.selectedbodysystem" ng-options="item for item in CAAllBodySystem track by item">
  23 + <select class="form-control input-sm" ng-change="hideListViewDiv()" ng-model="query.selectedbodysystem" ng-options="item for item in CAAllBodySystem track by item">
24 24 <option value="">All</option>
25 25 </select>
26 26 </div>
... ... @@ -28,7 +28,7 @@
28 28 <div class="col-md-2 col-sm-4 pad-lftrgt3">
29 29 <div class="form-group">
30 30 <h6 class="text-center text-primary txt-white f11">Medical Speciality</h6>
31   - <select class="form-control input-sm" ng-model="query.selectedspecialty" ng-options="item for item in CAAllSpeciality track by item">
  31 + <select class="form-control input-sm" ng-change="hideListViewDiv()" ng-model="query.selectedspecialty" ng-options="item for item in CAAllSpeciality track by item">
32 32 <option value="">All</option>
33 33 </select>
34 34 </div>
... ... @@ -68,7 +68,7 @@
68 68 <th style="min-width: 280px;">Specialty</th>
69 69 </tr>
70 70 </thead>
71   - <tbody ng-if="!filterstring" class="clstbodyca">
  71 + <tbody id="ListViewDiv" ng-if="!filterstring" class="clstbodyca">
72 72 <tr id="{{item._id}}" ng-class="{selected: item._id === idSelected}" ng-click="showItem(item._id)" ng-dblclick="openView($event)" ng-repeat="item in selectedCAListViewData">
73 73 <td style="max-width: 250px;">
74 74 {{item._Title}}
... ... @@ -84,7 +84,7 @@
84 84 </td>
85 85 </tr>
86 86 </tbody>
87   - <tbody ng-if="filterstring" class="clstbodyca">
  87 + <tbody id="ListViewDiv" ng-if="filterstring" class="clstbodyca">
88 88 <tr ng-click="showItem(item._id)" ng-class="{selected: item._id === idSelected}" ng-dblclick="openView($event)" ng-repeat="item in searchCAListViewData">
89 89 <td style="max-width: 250px;">
90 90 {{item._Title}}
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/ci/ci-view.html
... ... @@ -9,7 +9,7 @@
9 9 <div class="col-md-2 col-sm-4 pad-lftrgt3">
10 10 <div class="form-group">
11 11 <h6 class="text-center text-primary txt-white f11">Body Region</h6>
12   - <select class="form-control input-sm" ng-model="query.selectedbodyregion" ng-options="item for item in CIAllBodyRegion track by item">
  12 + <select ng-change="hideListViewDiv()" class="form-control input-sm" ng-model="query.selectedbodyregion" ng-options="item for item in CIAllBodyRegion track by item">
13 13 <option value="">All</option>
14 14 </select>
15 15 </div>
... ... @@ -17,7 +17,7 @@
17 17 <div class="col-md-2 col-sm-4 pad-lftrgt3">
18 18 <div class="form-group">
19 19 <h6 class="text-center text-primary txt-white f11">Body System</h6>
20   - <select class="form-control input-sm" ng-model="query.selectedbodysystem" ng-options="item for item in CIAllBodySystem track by item">
  20 + <select ng-change="hideListViewDiv()" class="form-control input-sm" ng-model="query.selectedbodysystem" ng-options="item for item in CIAllBodySystem track by item">
21 21 <option value="">All</option>
22 22 </select>
23 23 </div>
... ... @@ -26,7 +26,7 @@
26 26 <div class="col-md-2 col-sm-4 pad-lftrgt3">
27 27 <div class="form-group">
28 28 <h6 class="text-center text-primary txt-white f11">View Orientation</h6>
29   - <select class="form-control input-sm" ng-model="query.selectedorientation" ng-options="item for item in CIAllOrientation track by item">
  29 + <select ng-change="hideListViewDiv()" class="form-control input-sm" ng-model="query.selectedorientation" ng-options="item for item in CIAllOrientation track by item">
30 30 <option value="">All</option>
31 31 </select>
32 32 </div>
... ... @@ -34,7 +34,7 @@
34 34 <div class="col-md-2 col-sm-4 pad-lftrgt3">
35 35 <div class="form-group">
36 36 <h6 class="text-center text-primary txt-white f11">Image Type</h6>
37   - <select class="form-control input-sm" ng-model="query.selectedimagetype" ng-options="item for item in CIAllImageType track by item">
  37 + <select ng-change="hideListViewDiv()" class="form-control input-sm" ng-model="query.selectedimagetype" ng-options="item for item in CIAllImageType track by item">
38 38 <option value="">All</option>
39 39 </select>
40 40 </div>
... ... @@ -42,7 +42,7 @@
42 42 <div class="col-md-2 col-sm-4 pad-lftrgt3">
43 43 <div class="form-group">
44 44 <h6 class="text-center text-primary txt-white f11">Medical Speciality</h6>
45   - <select class="form-control input-sm" ng-model="query.selectedspecialty" ng-options="item for item in CIAllSpeciality track by item">
  45 + <select ng-change="hideListViewDiv()"class="form-control input-sm" ng-model="query.selectedspecialty" ng-options="item for item in CIAllSpeciality track by item">
46 46 <option value="">All</option>
47 47 </select>
48 48 </div>
... ... @@ -112,7 +112,7 @@
112 112 <th width="25%">Specialty</th>
113 113 </tr>
114 114 </thead>
115   - <tbody ng-if="!filterstring" class="clstbody">
  115 + <tbody id="ListViewDiv" ng-if="!filterstring" class="clstbody">
116 116 <tr id="{{item._id}}" ng-class="{selected: item._id === idSelected}" ng-click="showItem(item._id)" ng-dblclick="openView($event)" ng-repeat="item in selectedCIListViewData">
117 117 <td width="15%">
118 118 {{item._Title}}
... ... @@ -134,7 +134,7 @@
134 134 </td>
135 135 </tr>
136 136 </tbody>
137   - <tbody ng-if="filterstring" class="clstbody">
  137 + <tbody id="ListViewDiv" ng-if="filterstring" class="clstbody">
138 138 <tr ng-click="showItem(item._id)" ng-class="{selected: item._id === idSelected}" ng-dblclick="openView($event)" ng-repeat="item in searchCIListViewData">
139 139 <td width="15%">
140 140 {{item._Title}}
... ... @@ -182,3 +182,4 @@
182 182 </div>
183 183 </div>
184 184  
  185 +
... ...