diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index 583e05b..ff13ed2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -13,7 +13,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.idSelected; $scope.srollListView; $scope.query = { - selectedbodyregion: '', + SearchText: '', + SearchTextByAlphabet: '', }; $scope.setActiveTab = function (tabToSet) { @@ -70,25 +71,36 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.reRunSearchOnLoad = function () { - var curBodyRegion = $rootScope.getLocalStorageValue("AIImageId"); - if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') { - $scope.query.selectedbodyregion = curBodyRegion; + var searchByText = $rootScope.getLocalStorageValue("SearchText"); + var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); + + if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { + $scope.query.SearchText = searchByText; + } + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') + { + $scope.query.SearchTextByAlphabet = searchTextByAlphabet; } else { - $scope.query.selectedbodyregion = ""; + $scope.query.SearchTextByAlphabet = ""; } - if ($scope.query.selectedbodyregion == "") { + if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { + $scope.loadAllAI(); } + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") + { + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); + } else { - $scope.ApplySearch($scope.SearchText); + $scope.ApplySearch($scope.query); } } $scope.LoadAIJsonData = function () { - + $('ul li a').removeAttr("style"); var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') promise.then( function (result) { @@ -110,6 +122,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.loadAllAI = function () { $rootScope.isLoading = true; + localStorage.setItem("SearchText", ''); + localStorage.setItem("SearchByAlphabet", ''); + $('ul li a').removeAttr("style"); $('#aiSpinner').css('visibility', 'visible'); $('#aiSpinner').css('zIndex', '20000'); var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') @@ -197,13 +212,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }; $scope.Reset = function (query) { - - query.selectedbodyregion = ""; + $('ul li a').removeAttr("style"); + query.SearchText = ""; //set localstorage values - localStorage.setItem("AIImageId", ''); + localStorage.setItem("SearchText", ''); + localStorage.setItem("SearchByAlphabet", ''); localStorage.setItem("AIListViewScroll", ''); if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } @@ -216,17 +232,16 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout while ($scope.searchAIListViewData.length) { $scope.searchAIListViewData.pop(); } - $scope.loadAllAI(); - } - $scope.ApplySearch = function (SearchText) { - var currentSearchtext = $rootScope.getLocalStorageValue("AIImageId"); - localStorage.setItem("AIImageId", ''); + $scope.ApplySearch = function (query) { + $('ul li a').removeAttr("style"); + var currentSearchtext = $rootScope.getLocalStorageValue("SearchText"); + localStorage.setItem("SearchText", ''); if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == "")) { - if (SearchText == "undefined" || (SearchText == null || SearchText == "")) + if (query.SearchText == "undefined" || (query.SearchText == null || query.SearchText == "")) { $rootScope.errorMessage = AIAConstants.PLEASE_ENTER_SEARCH_TEXT; $("#messageModal").modal('show'); @@ -248,13 +263,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { + if (typeof (query.SearchText) !== "undefined" && (query.SearchText !== null && query.SearchText !== "")) { - localStorage.setItem("AIImageId", SearchText); + localStorage.setItem("SearchText", query.SearchText); } else { - localStorage.setItem("AIImageId", ''); + localStorage.setItem("SearchText", ''); } @@ -274,7 +289,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var selectimg = true; //var count = 0; - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { + if (typeof (query.SearchText) !== "undefined" && (query.SearchText !== null && query.SearchText !== "")) { + var SearchText = query.SearchText var posbodyregion = value._Title.toLowerCase().indexOf(SearchText.toLowerCase()); if (posbodyregion > -1) { selectimg = true; @@ -339,30 +355,27 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout - $scope.ApplySearchByAlphabet = function (SearchText) { + $scope.ApplySearchByAlphabet = function (SearchTextByAlphabet) { + + $rootScope.SearchTextByAlphabet = SearchTextByAlphabet $rootScope.isLoading = true; $('ul li a').removeAttr("style"); $('#spinner').css('visibility', 'visible'); - $('#' + SearchText).css({"color": "white", "background-color" : "#1B92D0"}); + $('#' + $rootScope.SearchTextByAlphabet ).css({ "color": "white", "background-color": "#1B92D0" }); + + //color: #0095da; + //background-color: #ffffff; $scope.filterstring = true; while ($scope.searchAIListViewData.length) { $scope.searchAIListViewData.pop(); } - - - - - - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { - - localStorage.setItem("AIImageId", SearchText); - + if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { + localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet); } else { - localStorage.setItem("AIImageId", ''); - + localStorage.setItem("SearchByAlphabet", ''); } var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') @@ -381,22 +394,15 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var selectimg = true; //var count = 0; - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { - + if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { var firstChar = value._Title[0]; - - if (firstChar == SearchText) { - selectimg = true; - //count = count + 1; - + if (firstChar == SearchTextByAlphabet) { + selectimg = true; } else { selectimg = false; - //count = count - 1; } - } - if (selectimg === true) { $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; @@ -440,7 +446,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }, function (error) { - // handle errors here console.log(' $scope.IllustrationData = ' + error.statusText); } ); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/ai/adam-images-detail.html b/400-SOURCECODE/AIAHTML5.Web/app/views/ai/adam-images-detail.html index ca54cd4..8be4dae 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/ai/adam-images-detail.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/ai/adam-images-detail.html @@ -1,10 +1,18 @@