Commit 04d0c2c23fb0b461cd667c8f56e62d2527cfd6a2

Authored by Sandeep Kumar
1 parent fd371db7

Fixed bugs of ADAM Images

400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js
@@ -23,99 +23,154 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -23,99 +23,154 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
23 var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); 23 var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet");
24 var SelectCurrTab = $rootScope.getLocalStorageValue("currentAITabView"); 24 var SelectCurrTab = $rootScope.getLocalStorageValue("currentAITabView");
25 25
26 - $timeout(function () {  
27 - $("#ListViewDiv").on('scroll', function () {  
28 - if ($scope.query.SelectedDiv == 2) {  
29 -  
30 - if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 10) {  
31 - Count += 100;  
32 - //$(window).scrollTop(0);  
33 - var ImageCount = $rootScope.getLocalStorageValue("ImageCount");  
34 - if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') {  
35 - $scope.query.SearchText = searchByText;  
36 - }  
37 - else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') {  
38 - $scope.query.SearchTextByAlphabet = searchTextByAlphabet;  
39 - }  
40 - else {  
41 - $scope.query.SearchTextByAlphabet = "";  
42 - }  
43 -  
44 - if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { 26 + //Commented by sandeep for fixed bugs related to ADAM Images
  27 + //$timeout(function () {
  28 + // $("#ListViewDiv").on('scroll', function () {
  29 +
  30 + // var searchByText = $rootScope.getLocalStorageValue("SearchText");
  31 + // var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet");
  32 + // var SelectCurrTab = $rootScope.getLocalStorageValue("currentAITabView");
  33 + // if ($scope.query.SelectedDiv == 2) {
  34 +
  35 + // if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 10) {
  36 + // Count += 100;
  37 + // //$(window).scrollTop(0);
  38 + // var ImageCount = $rootScope.getLocalStorageValue("ImageCount");
  39 + // if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') {
  40 + // $scope.query.SearchText = searchByText;
  41 + // }
  42 + // else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') {
  43 + // $scope.query.SearchTextByAlphabet = searchTextByAlphabet;
  44 + // }
  45 + // else {
  46 + // $scope.query.SearchTextByAlphabet = "";
  47 + // }
  48 +
  49 + // if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") {
  50 +
  51 + // $scope.LoadAIJsonData(Count);
  52 + // $scope.loadAllAI(Count);
  53 + // }
  54 + // else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {
  55 + // $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);
  56 + // }
  57 + // else {
  58 + // $scope.ApplySearch($scope.query);
  59 + // }
  60 + // }
  61 + // }
  62 + // });
  63 +
  64 + //}, 10);
  65 +
  66 + //$(window).scroll(function () {
  67 + // var searchByText = $rootScope.getLocalStorageValue("SearchText");
  68 + // var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet");
  69 + // var SelectCurrTab = $rootScope.getLocalStorageValue("currentAITabView");
  70 + // if ($scope.query.SelectedDiv == 1) {
  71 +
  72 + // if ($(window).scrollTop() == $(document).height() - $(window).height()) {
  73 + // Count += 100;
  74 + // var ImageCount = $rootScope.getLocalStorageValue("ImageCount");
  75 + // if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') {
  76 + // $scope.query.SearchText = searchByText;
  77 + // }
  78 + // else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') {
  79 + // $scope.query.SearchTextByAlphabet = searchTextByAlphabet;
  80 + // }
  81 + // else {
  82 + // $scope.query.SearchTextByAlphabet = "";
  83 + // }
  84 +
  85 + // if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") {
  86 +
  87 + // $scope.LoadAIJsonData(Count);
  88 + // $scope.loadAllAI(Count);
  89 + // }
  90 + // else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {
  91 + // $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);
  92 + // }
  93 + // else {
  94 + // $scope.ApplySearch($scope.query);
  95 + // }
  96 + // }
  97 + // }
  98 + //});
45 99
46 - $scope.LoadAIJsonData(Count);  
47 - $scope.loadAllAI(Count);  
48 - }  
49 - else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {  
50 - $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);  
51 - }  
52 - else {  
53 - $scope.ApplySearch($scope.query);  
54 - }  
55 - }  
56 - }  
57 - });  
58 -  
59 - }, 10);  
60 -  
61 - $(window).scroll(function () {  
62 - if ($scope.query.SelectedDiv == 1) {  
63 - if ($(window).scrollTop() == $(document).height() - $(window).height()) {  
64 - Count += 100;  
65 - var ImageCount = $rootScope.getLocalStorageValue("ImageCount");  
66 - if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') {  
67 - $scope.query.SearchText = searchByText;  
68 - }  
69 - else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') {  
70 - $scope.query.SearchTextByAlphabet = searchTextByAlphabet;  
71 - }  
72 - else {  
73 - $scope.query.SearchTextByAlphabet = "";  
74 - }  
75 -  
76 - if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") {  
77 -  
78 - $scope.LoadAIJsonData(Count);  
79 - $scope.loadAllAI(Count);  
80 - }  
81 - else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {  
82 - $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);  
83 - }  
84 - else {  
85 - $scope.ApplySearch($scope.query);  
86 - }  
87 - }  
88 - }  
89 - });  
90 -  
91 -  
92 - $scope.setActiveTab = function (tabToSet) { 100 +
  101 + $scope.setActiveTab = function (tabToSet, inderectCall) {
  102 + //Modified code by sandeep for fixed Bugs of ADAM Images
93 $scope.activeTab = tabToSet; 103 $scope.activeTab = tabToSet;
  104 + localStorage.setItem("currentAITabView", "");
94 localStorage.setItem("currentAITabView", $scope.activeTab); 105 localStorage.setItem("currentAITabView", $scope.activeTab);
95 var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); 106 var ImageCount = $rootScope.getLocalStorageValue("ImageCount");
96 var searchText = $rootScope.getLocalStorageValue("SearchText"); 107 var searchText = $rootScope.getLocalStorageValue("SearchText");
  108 + var SearchByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet");
  109 +
97 if (tabToSet == 2) { 110 if (tabToSet == 2) {
98 var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); 111 var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId");
99 - $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).addClass("selected"); 112 + $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).addClass("selected");
  113 +
100 $scope.idSelected = $rootScope.getLocalStorageValue("currentAIImageId"); 114 $scope.idSelected = $rootScope.getLocalStorageValue("currentAIImageId");
101 var selectedImageId = $rootScope.getLocalStorageValue("currentAIImageId"); 115 var selectedImageId = $rootScope.getLocalStorageValue("currentAIImageId");
102 - if (searchText != '') { 116 + if (searchText != '' && searchText != null && searchText != undefined) {
103 $scope.ApplySearch(searchText); 117 $scope.ApplySearch(searchText);
  118 + if (inderectCall == true) {
  119 + if (curSelectedRowId != "") {
  120 + $scope.showItem(curSelectedRowId);
  121 + }
  122 + } else {
  123 + if (selectedImageId != "") {
  124 + $scope.filterstring = false;
  125 + $scope.showItem(selectedImageId);
  126 + $scope.filterstring = true;
  127 + }
  128 + }
104 } 129 }
105 - else {  
106 - $scope.ReloadListViewImageDiv(selectedImageId, ImageCount); 130 + else if (SearchByAlphabet != "" && SearchByAlphabet != null && SearchByAlphabet != undefined) {
  131 + $scope.ApplySearchByAlphabet(SearchByAlphabet);
  132 + if (inderectCall == true) {
  133 + if (curSelectedRowId != "") {
  134 + $scope.showItem(curSelectedRowId);
  135 + }
  136 + } else {
  137 + if (selectedImageId != "") {
  138 + $scope.filterstring = false;
  139 + $scope.showItem(selectedImageId);
  140 + $scope.filterstring = true;
  141 + }
  142 + }
107 } 143 }
108 - 144 + else {
  145 + //ReloadListViewImageDiv(curSelectedRowId, ImageCount);
  146 + $scope.loadAllAI(ImageCount);
  147 + if (inderectCall == true) {
  148 + if (curSelectedRowId != "") {
  149 + $scope.filterstring = true;
  150 + $scope.showItem(curSelectedRowId);
  151 + $scope.filterstring = false;
  152 + }
  153 + } else {
  154 + if (selectedImageId != "") {
  155 + $scope.filterstring = false;
  156 + $scope.showItem(selectedImageId);
  157 + }
  158 + }
  159 + }
109 $scope.query.SelectedDiv = tabToSet; 160 $scope.query.SelectedDiv = tabToSet;
110 } 161 }
111 else { 162 else {
112 $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); 163 $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail');
113 $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).removeClass('selected'); 164 $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).removeClass('selected');
114 $scope.query.SelectedDiv = tabToSet; 165 $scope.query.SelectedDiv = tabToSet;
115 - //Add Condition for fixed bug-45300  
116 - if (searchText != '' && searchText != null) { 166 +
  167 + //Modified Code by sandeep for fixed bug-45300
  168 + if (searchText != '' && searchText != null && searchText != undefined) {
117 $scope.ApplySearch(searchText); 169 $scope.ApplySearch(searchText);
118 } 170 }
  171 + else if (SearchByAlphabet != "" && SearchByAlphabet != null && SearchByAlphabet != undefined) {
  172 + $scope.ApplySearchByAlphabet(SearchByAlphabet);
  173 + }
119 else { 174 else {
120 $scope.loadAllAI(ImageCount); 175 $scope.loadAllAI(ImageCount);
121 } 176 }
@@ -124,8 +179,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -124,8 +179,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
124 }; 179 };
125 180
126 181
127 - $scope.loadAIModuleById = function (moduleId) {  
128 - debugger; 182 + $scope.loadAIModuleById = function (moduleId) {
129 183
130 var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); 184 var ImageCount = $rootScope.getLocalStorageValue("ImageCount");
131 185
@@ -153,10 +207,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -153,10 +207,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
153 $rootScope.openModules.push({ "ModuleId": 13 }); 207 $rootScope.openModules.push({ "ModuleId": 13 });
154 208
155 //set the local storage 209 //set the local storage
156 -  
157 - var curtab = $rootScope.getLocalStorageValue("currentAITabView"); 210 + var curtab = $rootScope.getLocalStorageValue("currentAITabView");
  211 + var inderectCall = true;
158 if (curtab == 2) { 212 if (curtab == 2) {
159 - $scope.setActiveTab(2); 213 + $scope.setActiveTab(2, inderectCall);
160 var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); 214 var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId");
161 if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { 215 if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') {
162 $scope.reRunSearchOnLoad(); 216 $scope.reRunSearchOnLoad();
@@ -169,7 +223,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -169,7 +223,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
169 } 223 }
170 } 224 }
171 else { 225 else {
172 - $scope.setActiveTab(1); 226 + $scope.setActiveTab(1, inderectCall);
173 $scope.reRunSearchOnLoad(); 227 $scope.reRunSearchOnLoad();
174 228
175 } 229 }
@@ -194,13 +248,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -194,13 +248,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
194 if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { 248 if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") {
195 249
196 $scope.loadAllAI(ImageCount); 250 $scope.loadAllAI(ImageCount);
197 - }  
198 - else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {  
199 - $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);  
200 - }  
201 - else {  
202 - $scope.ApplySearch($scope.query);  
203 - } 251 + }
204 252
205 } 253 }
206 254
@@ -284,10 +332,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -284,10 +332,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
284 332
285 } 333 }
286 334
287 - $scope.showItem = function (id) { 335 + $scope.showItem = function (id) {
  336 + //Modified code by sandeep for fixed issue of ADAM Images
288 $scope.idSelected = id; 337 $scope.idSelected = id;
289 - localStorage.setItem("AISelectedRowId", id);  
290 - 338 + localStorage.setItem("AISelectedRowId", id);
291 //Set the vertical scroll value of the table. 339 //Set the vertical scroll value of the table.
292 var y = $('#ListViewDiv').scrollTop(); 340 var y = $('#ListViewDiv').scrollTop();
293 localStorage.setItem("AIListViewScroll", y); 341 localStorage.setItem("AIListViewScroll", y);
@@ -302,10 +350,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -302,10 +350,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
302 .where('_id = ' + id) 350 .where('_id = ' + id)
303 .select('_ThumbnailImage', '_id', '_Title'); 351 .select('_ThumbnailImage', '_id', '_Title');
304 352
305 - $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage;  
306 - $scope.SelectedAIId = SelectedAIthumbImage[0]._id;  
307 - $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title;  
308 - 353 + if (SelectedAIthumbImage.length > 0) {
  354 + $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage;
  355 + $scope.SelectedAIId = SelectedAIthumbImage[0]._id;
  356 + $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title;
  357 + } else { $scope.hiderow = false; }
309 } 358 }
310 else { 359 else {
311 if ($scope.searchAIListViewData.length > 0) { 360 if ($scope.searchAIListViewData.length > 0) {
@@ -316,10 +365,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -316,10 +365,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
316 .where('_id = ' + id) 365 .where('_id = ' + id)
317 .select('_ThumbnailImage', '_id', '_Title'); 366 .select('_ThumbnailImage', '_id', '_Title');
318 367
319 - $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage;  
320 - $scope.SelectedAIId = SelectedAIthumbImage[0]._id;  
321 - $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title;  
322 - 368 + if (SelectedAIthumbImage.length > 0) {
  369 + $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage;
  370 + $scope.SelectedAIId = SelectedAIthumbImage[0]._id;
  371 + $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title;
  372 + } else { $scope.hiderow = false; }
323 } 373 }
324 374
325 } 375 }
@@ -350,11 +400,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -350,11 +400,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
350 } 400 }
351 401
352 $scope.ApplySearch = function (query) { 402 $scope.ApplySearch = function (query) {
  403 + //Modified code by sandeep for fixed issue of ADAM Images
353 $('ul li span').removeAttr("style"); 404 $('ul li span').removeAttr("style");
  405 +
354 $scope.idSelected = ''; 406 $scope.idSelected = '';
355 - $scope.hiderow = false; 407 + //$scope.hiderow = false;
  408 + $scope.hiderow = true;
356 var currentSearchtext = $rootScope.getLocalStorageValue("SearchText"); 409 var currentSearchtext = $rootScope.getLocalStorageValue("SearchText");
357 - localStorage.setItem("SearchText", ''); 410 + //localStorage.setItem("SearchText", '');
  411 + localStorage.setItem("SearchByAlphabet", '');
  412 + if (typeof (query) !== "undefined" && (query !== null && query !== "")) {
  413 + currentSearchtext = query.SearchText;
  414 + $scope.query.SearchText = query.SearchText;
  415 + if (currentSearchtext == undefined || $scope.query.SearchText == undefined) {
  416 + currentSearchtext = query;
  417 + $scope.query.SearchText = query;
  418 + }
  419 + }
  420 +
  421 + localStorage.setItem("SearchText", currentSearchtext);
358 if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == "")) { 422 if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == "")) {
359 if ($scope.query.SearchText == "undefined" || ($scope.query.SearchText == null || $scope.query.SearchText == "")) { 423 if ($scope.query.SearchText == "undefined" || ($scope.query.SearchText == null || $scope.query.SearchText == "")) {
360 $rootScope.errorMessage = AIAConstants.PLEASE_ENTER_SEARCH_TEXT; 424 $rootScope.errorMessage = AIAConstants.PLEASE_ENTER_SEARCH_TEXT;
@@ -371,11 +435,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -371,11 +435,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
371 435
372 $rootScope.isLoading = true; 436 $rootScope.isLoading = true;
373 $('#aiSpinner').css('visibility', 'visible'); 437 $('#aiSpinner').css('visibility', 'visible');
374 - $scope.DisableUI(); 438 + $('#aiSpinner').css('zIndex', '20000');
  439 + //$scope.DisableUI();
375 $scope.filterstring = true; 440 $scope.filterstring = true;
376 if (typeof ($scope.query.SearchText) !== "undefined" && ($scope.query.SearchText !== null && $scope.query.SearchText !== "")) { 441 if (typeof ($scope.query.SearchText) !== "undefined" && ($scope.query.SearchText !== null && $scope.query.SearchText !== "")) {
377 - localStorage.setItem("SearchText", query.SearchText);  
378 - } 442 + //localStorage.setItem("SearchText", query.SearchText);
  443 + localStorage.setItem("SearchText", $scope.query.SearchText);
  444 + }
379 else { 445 else {
380 localStorage.setItem("SearchText", ''); 446 localStorage.setItem("SearchText", '');
381 } 447 }
@@ -392,7 +458,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -392,7 +458,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
392 458
393 $('#grid-view').empty(); 459 $('#grid-view').empty();
394 angular.forEach($scope.selectedAIListViewData, function (value, key) { 460 angular.forEach($scope.selectedAIListViewData, function (value, key) {
395 - 461 +
396 var selectimg = true; 462 var selectimg = true;
397 //var count = 0; 463 //var count = 0;
398 if (typeof ($scope.query.SearchText) !== "undefined" && ($scope.query.SearchText !== null && $scope.query.SearchText !== "")) { 464 if (typeof ($scope.query.SearchText) !== "undefined" && ($scope.query.SearchText !== null && $scope.query.SearchText !== "")) {
@@ -416,7 +482,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -416,7 +482,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
416 + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >' 482 + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
417 + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view'); 483 + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
418 484
419 - $compile($el)($scope); 485 + $compile($el)($scope);
420 486
421 $scope.searchAIListViewData.push( 487 $scope.searchAIListViewData.push(
422 { 488 {
@@ -428,7 +494,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -428,7 +494,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
428 }); 494 });
429 } 495 }
430 }); 496 });
431 - $('table > #ListViewDiv > #searchItem').remove(); 497 + $('table > #ListViewDiv > #searchItem').remove();
  498 +
432 //Show Error Message in case of gridview if no data is found 499 //Show Error Message in case of gridview if no data is found
433 if ($scope.searchAIListViewData.length == 0) { 500 if ($scope.searchAIListViewData.length == 0) {
434 var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view'); 501 var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view');
@@ -438,14 +505,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -438,14 +505,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
438 $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>'); 505 $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>');
439 localStorage.setItem("SearchText", ''); 506 localStorage.setItem("SearchText", '');
440 } 507 }
441 - $rootScope.isLoading = false;  
442 - $('#aiSpinner').css('visibility', 'hidden'); 508 +
443 setTimeout(function () { 509 setTimeout(function () {
444 $scope.EnableUI(); 510 $scope.EnableUI();
445 511
446 }, 10); 512 }, 10);
447 513
  514 + $rootScope.isLoading = false;
  515 + $('#aiSpinner').css('visibility', 'hidden');
  516 +
  517 + //Added code by sandeep for fixed bug-40273
  518 + var _currentImgId = $rootScope.getLocalStorageValue("currentAIImageId");
  519 + $rootScope.getLocalStorageValue("currentAIImageId")
  520 + if (_currentImgId != "null" && _currentImgId != null) {
  521 + $('#' + _currentImgId).find('.thumbnail').addClass('HightLightThumbnail');
  522 + $('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100);
  523 + $scope.hiderow = true;
  524 + }
448 }, 525 },
  526 +
449 function (error) { 527 function (error) {
450 // handle errors here 528 // handle errors here
451 console.log(' $scope.IllustrationData = ' + error.statusText); 529 console.log(' $scope.IllustrationData = ' + error.statusText);
@@ -465,12 +543,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -465,12 +543,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
465 } 543 }
466 $scope.counter = 1; 544 $scope.counter = 1;
467 $scope.ApplySearchByAlphabet = function (SearchTextByAlphabet) { 545 $scope.ApplySearchByAlphabet = function (SearchTextByAlphabet) {
468 - $rootScope.SearchTextByAlphabet = SearchTextByAlphabet;  
469 - localStorage.setItem("SearchByAlphabet", '');  
470 - $rootScope.isLoading = true; 546 + //Modified code by sandeep for fixed issue of ADAM Images
  547 + $rootScope.SearchTextByAlphabet = SearchTextByAlphabet;
  548 + localStorage.setItem("SearchText", '');
  549 + $('#txtSerachInput').val("");
  550 + //$rootScope.isLoading = true;
471 $scope.idSelected = ''; 551 $scope.idSelected = '';
472 - $scope.hiderow = false;  
473 - $('#aiSpinner').css('visibility', 'visible'); 552 + //$scope.hiderow = false;//Comment by Sandeep
  553 + $scope.hiderow = true;
474 $scope.DisableUI(); 554 $scope.DisableUI();
475 $('ul li span').removeAttr("style"); 555 $('ul li span').removeAttr("style");
476 $('#' + $rootScope.SearchTextByAlphabet).css({ "color": "white", "background-color": "#1B92D0" }); 556 $('#' + $rootScope.SearchTextByAlphabet).css({ "color": "white", "background-color": "#1B92D0" });
@@ -478,6 +558,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -478,6 +558,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
478 while ($scope.searchAIListViewData.length) { 558 while ($scope.searchAIListViewData.length) {
479 $scope.searchAIListViewData.pop(); 559 $scope.searchAIListViewData.pop();
480 } 560 }
  561 + $rootScope.isLoading = true;
  562 + $('#aiSpinner').css('visibility', 'visible');
  563 + $('#aiSpinner').css('zIndex', '20000');
481 564
482 if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { 565 if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) {
483 localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet); 566 localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet);
@@ -496,9 +579,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -496,9 +579,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
496 579
497 $('#grid-view').empty(); 580 $('#grid-view').empty();
498 581
499 -  
500 - angular.forEach($scope.selectedAIListViewData, function (value, key) {  
501 - 582 + angular.forEach($scope.selectedAIListViewData, function (value, key) {
502 var selectimg = true; 583 var selectimg = true;
503 //var count = 0; 584 //var count = 0;
504 if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { 585 if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) {
@@ -518,7 +599,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -518,7 +599,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
518 + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >' 599 + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
519 + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view'); 600 + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
520 601
521 - $compile($el)($scope); 602 + $compile($el)($scope);
  603 +
522 $scope.searchAIListViewData.push( 604 $scope.searchAIListViewData.push(
523 { 605 {
524 "_id": value._id, 606 "_id": value._id,
@@ -531,7 +613,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -531,7 +613,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
531 } 613 }
532 614
533 }); 615 });
534 - $('table > #ListViewDiv > #searchItem').remove(); 616 + $('table > #ListViewDiv > #searchItem').remove();
535 //Show Error Message in case of gridview if no data is found 617 //Show Error Message in case of gridview if no data is found
536 if ($scope.searchAIListViewData.length == 0) { 618 if ($scope.searchAIListViewData.length == 0) {
537 var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view'); 619 var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view');
@@ -539,12 +621,21 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -539,12 +621,21 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
539 $('table > #ListViewDiv > #searchItem').remove(); 621 $('table > #ListViewDiv > #searchItem').remove();
540 622
541 $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>'); 623 $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>');
542 - }  
543 - $rootScope.isLoading = false;  
544 - 624 + }
  625 +
545 setTimeout(function () { 626 setTimeout(function () {
546 $scope.EnableUI(); 627 $scope.EnableUI();
547 }, 10); 628 }, 10);
  629 +
  630 + $rootScope.isLoading = false;
  631 + $('#aiSpinner').css('visibility', 'hidden');
  632 + //Added code by sandeep for fixed bug-40273
  633 + var _currentImgId = $rootScope.getLocalStorageValue("currentAIImageId");
  634 + if (_currentImgId != "null" && _currentImgId != null) {
  635 + $('#' + _currentImgId).find('.thumbnail').addClass('HightLightThumbnail');
  636 + $('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100);
  637 + hiderow = true;
  638 + }
548 }, 639 },
549 function (error) { 640 function (error) {
550 console.log(' $scope.IllustrationData = ' + error.statusText); 641 console.log(' $scope.IllustrationData = ' + error.statusText);
@@ -589,7 +680,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -589,7 +680,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
589 680
590 $scope.OpenAdamImageView = function () { 681 $scope.OpenAdamImageView = function () {
591 682
592 - // $rootScope.currentActiveModuleTitle = "A.D.A.M. Images"; 683 + // $rootScope.currentActiveModuleTitle = "A.D.A.M. Images";
593 684
594 if ($rootScope.refreshcheck == null) { 685 if ($rootScope.refreshcheck == null) {
595 $location.path('/'); 686 $location.path('/');
@@ -630,11 +721,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -630,11 +721,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
630 theme: 'success', 721 theme: 'success',
631 currentController: 'AIController', 722 currentController: 'AIController',
632 parentSlug: 'ADAM-images', 723 parentSlug: 'ADAM-images',
633 - content: '<div class="row" id="canvasDiv"><div style="align:left;"><canvas id="canvas" ng-click="onDrawingCanvasClick($event)" width="1369" class="canvas-annotationStyle" style="position: absolute; background-color: transparent;z-index:1 "></canvas> <canvas id="canvasPaint" ng-click="FreeStylePaint($event)" width="1369" class="canvas-annotationStyle1" style="position: absolute;z-index:0;"></canvas></div>' +  
634 - '<div class="col-sm-12 img-thumbnail" align="center">' + 724 + content: '<div class="col-sm-12"><div class="container-fluid"><div class="row"><div class=" col-sm-12 img-thumbnail canvasDivClass" id="canvasDiv" style="overflow: scroll;" align="center"><canvas id="canvas" ng-click="onDrawingCanvasClick($event)" width="1195" height="460" class="canvas-annotationStyle" style="position: absolute; background-color: transparent;z-index:1; left: 0px;"></canvas> <canvas id="canvasPaint" ng-click="FreeStylePaint($event)" width="1195" height="460" class="canvas-annotationStyle1" style="position: absolute;z-index:0; left: 0px;"></canvas>' +
  725 +
635 '<img src="' + $scope.clickedAIImage + '" alt="" title="" class="img-responsive ">' + 726 '<img src="' + $scope.clickedAIImage + '" alt="" title="" class="img-responsive ">' +
636 - '<script>$(document).ready(function(){ var $ua = navigator.userAgent;if(($ua.match(/(iPod|iPhone|iPad|android)/i))) { var jspanelContainerWidth = $(".jsPanel-content").css("width"); $(".jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth });$("#aiImagePanel").css("width", "100%"); }$("#btnTxtOnOff").click(function(){if($.trim($(this).text()) === "Text Off"){$(this).text("Text On");$("#sid").css("visibility","hidden");}else{$(this).text("Text Off");$("#sid").css("visibility","visible");}});});</script></div>' +  
637 - '</div>', 727 + '</div>' +
  728 + '</div></div></div></div>',
638 //ajax: { 729 //ajax: {
639 // url: 'app/views/ci/ci-view-detail.html' 730 // url: 'app/views/ci/ci-view-detail.html'
640 //}, 731 //},
@@ -654,8 +745,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -654,8 +745,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
654 $('#aiSpinner').css('visibility', 'hidden'); 745 $('#aiSpinner').css('visibility', 'hidden');
655 var canvas = document.getElementById("canvas"); 746 var canvas = document.getElementById("canvas");
656 var canvasPaint = document.getElementById("canvasPaint"); 747 var canvasPaint = document.getElementById("canvasPaint");
657 - canvas.height = $(".img-thumbnail").height();  
658 - canvasPaint.height = $(".img-thumbnail").height(); 748 + //canvas.height = $(".img-thumbnail").height();
  749 + //canvasPaint.height = $(".img-thumbnail").height();
659 }); 750 });
660 $rootScope.currentSlug = 'adam-images-detail'; 751 $rootScope.currentSlug = 'adam-images-detail';
661 $rootScope.openViews.push( 752 $rootScope.openViews.push(
@@ -667,7 +758,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -667,7 +758,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
667 $("#aiImagePanel .img-thumbnail").css("min-height", $("#aiImagePanel .jsPanel-content").height()); 758 $("#aiImagePanel .img-thumbnail").css("min-height", $("#aiImagePanel .jsPanel-content").height());
668 $('.jsPanel-content .jsPanel-theme-success').css('overflow-y', 'auto !important') 759 $('.jsPanel-content .jsPanel-theme-success').css('overflow-y', 'auto !important')
669 var jspContentHeight = $('.jsPanel-content').height(); 760 var jspContentHeight = $('.jsPanel-content').height();
670 - 761 +
671 // console.log($rootScope.OpenAdamImages); 762 // console.log($rootScope.OpenAdamImages);
672 $('#AIView').css("height", $(window).outerHeight() - 65); 763 $('#AIView').css("height", $(window).outerHeight() - 65);
673 764
@@ -683,7 +774,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -683,7 +774,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
683 console.log(' $scope.AIllustrationData = ' + error.statusText); 774 console.log(' $scope.AIllustrationData = ' + error.statusText);
684 } 775 }
685 ); 776 );
686 - 777 +
687 } 778 }
688 779
689 $scope.$on('annotationToolEvent', function (event, data) { 780 $scope.$on('annotationToolEvent', function (event, data) {
@@ -697,10 +788,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -697,10 +788,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
697 $("#canvasPaint").css("display", "block"); 788 $("#canvasPaint").css("display", "block");
698 789
699 $rootScope.onDrawingCanvasClick(); 790 $rootScope.onDrawingCanvasClick();
700 - $rootScope.FreeStylePaint(); 791 + //Commented by Sandeep
  792 + //$rootScope.FreeStylePaint();
701 }); 793 });
702 794
703 $scope.ReloadListViewImageDiv = function (id, imgCount) { 795 $scope.ReloadListViewImageDiv = function (id, imgCount) {
  796 +
704 //console.log(id); 797 //console.log(id);
705 $scope.idSelected = id; 798 $scope.idSelected = id;
706 $scope.hiderow = true; 799 $scope.hiderow = true;
@@ -718,9 +811,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -718,9 +811,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
718 .where('_id = ' + id) 811 .where('_id = ' + id)
719 .select('_ThumbnailImage', '_id', '_Title').slice(0, imgCount); 812 .select('_ThumbnailImage', '_id', '_Title').slice(0, imgCount);
720 813
721 - $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage;  
722 - $scope.SelectedAIId = SelectedAIthumbImage[0]._id;  
723 - $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title; 814 + if (SelectedAIthumbImage.length > 0) {
  815 + $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage;
  816 + $scope.SelectedAIId = SelectedAIthumbImage[0]._id;
  817 + $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title;
  818 + } else { $scope.hiderow = false; }
724 819
725 //Set the scroll position of the tablebody to show selected row. 820 //Set the scroll position of the tablebody to show selected row.
726 821
@@ -732,7 +827,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -732,7 +827,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
732 else { 827 else {
733 $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("AIListViewScroll")); 828 $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("AIListViewScroll"));
734 } 829 }
735 -  
736 } 830 }
737 $rootScope.isLoading = false; 831 $rootScope.isLoading = false;
738 $('#aiSpinner').css('visibility', 'hidden'); 832 $('#aiSpinner').css('visibility', 'hidden');
@@ -751,7 +845,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -751,7 +845,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
751 if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } 845 if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
752 $scope.hiderow = false; 846 $scope.hiderow = false;
753 } 847 }
754 - } 848 + }
  849 +
755 }] 850 }]
756 ); 851 );
757 852
400-SOURCECODE/AIAHTML5.Web/app/views/ai/ai-view.html
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <label for="exampleInputName2" class="text-primary">Search</label> 10 <label for="exampleInputName2" class="text-primary">Search</label>
11 <input type="text" ng-model="query.SearchText" class="form-control input-sm col-sm" id="txtSerachInput" placeholder=""> 11 <input type="text" ng-model="query.SearchText" class="form-control input-sm col-sm" id="txtSerachInput" placeholder="">
12 </div> 12 </div>
13 - <button type="button" class="btn btn-primary btn-sm" ng-click="ApplySearch(query)" style="margin-right:2px;"> 13 + <button type="button" class="btn btn-primary btn-sm" ng-click="ApplySearch(query)" style="margin-right:2px; width: 65px" >
14 <i class="fa fa-search"></i> 14 <i class="fa fa-search"></i>
15 </button> 15 </button>
16 </form> 16 </form>