diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index 9732691..38990b7 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -1,4 +1,4 @@ -AIA.controller("AIController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "pages", "DataService","AIAConstants", +AIA.controller("AIController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "pages", "DataService", "AIAConstants", function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout, pages, DataService, AIAConstants) { // $rootScope.currentActiveModuleTitle = pages[3].name; $scope.showTabButton = true; @@ -77,8 +77,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { $scope.query.SearchText = searchByText; } - else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') - { + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') { $scope.query.SearchTextByAlphabet = searchTextByAlphabet; } else { @@ -86,11 +85,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { - + $scope.loadAllAI(); } - else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") - { + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); } else { @@ -157,7 +155,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.isLoading = false; $('#aiSpinner').css('visibility', 'hidden'); - + }, function (error) { // handle errors here @@ -239,15 +237,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('ul li a').removeAttr("style"); var currentSearchtext = $rootScope.getLocalStorageValue("SearchText"); localStorage.setItem("SearchText", ''); - if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == "")) - { - if (query.SearchText == "undefined" || (query.SearchText == null || query.SearchText == "")) - { - $rootScope.errorMessage = AIAConstants.PLEASE_ENTER_SEARCH_TEXT; - $("#messageModal").modal('show'); - // alert("Please enter the text !") - return false; - } + if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == "")) { + if (query.SearchText == "undefined" || (query.SearchText == null || query.SearchText == "")) { + $rootScope.errorMessage = AIAConstants.PLEASE_ENTER_SEARCH_TEXT; + $("#messageModal").modal('show'); + // alert("Please enter the text !") + return false; + } } $rootScope.isLoading = true; @@ -316,7 +312,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout + '

' + value._Title + '

').appendTo('#grid-view'); $compile($el)($scope); - + $(".sidebar").mCustomScrollbar({ autoHideScrollbar: true, @@ -358,208 +354,208 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout - $scope.ApplySearchByAlphabet = function (SearchText) { + $scope.ApplySearchByAlphabet = function (SearchText) { - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - - $scope.filterstring = true; + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); - while ($scope.searchAIListViewData.length) { - $scope.searchAIListViewData.pop(); - } + $scope.filterstring = true; + while ($scope.searchAIListViewData.length) { + $scope.searchAIListViewData.pop(); + } - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { - localStorage.setItem("AIImageId", SearchText); + if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { - } - else { - localStorage.setItem("AIImageId", ''); + localStorage.setItem("AIImageId", SearchText); - } + } + else { + localStorage.setItem("AIImageId", ''); - var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') - promise.then( - function (result) { - $scope.IllustrationData = result; + } - $scope.selectedAIListViewData = new jinqJs() - .from($scope.IllustrationData.root.AIData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); + var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') + promise.then( + function (result) { + $scope.IllustrationData = result; - $('#grid-view').empty(); + $scope.selectedAIListViewData = new jinqJs() + .from($scope.IllustrationData.root.AIData) + .orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); - angular.forEach($scope.selectedAIListViewData, function (value, key) { + $('#grid-view').empty(); - var selectimg = true; - //var count = 0; - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { + angular.forEach($scope.selectedAIListViewData, function (value, key) { - var firstChar = value._Title[0]; + var selectimg = true; + //var count = 0; + if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { - if (firstChar == SearchText) { - selectimg = true; - //count = count + 1; + var firstChar = value._Title[0]; - } - else { - selectimg = false; - //count = count - 1; - } + if (firstChar == SearchText) { + selectimg = true; + //count = count + 1; } + else { + selectimg = false; + //count = count - 1; + } - if (selectimg === true) { - $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; + } - var $el = $('
' - + '
' - + '' - + '

' + value._Title + '

').appendTo('#grid-view'); + if (selectimg === true) { + $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; - $compile($el)($scope); - + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); + $compile($el)($scope); - $scope.searchAIListViewData.push( - { - "_id": value._id, - //"_ImageId": value._ImageId, - "_Title": value._Title, - "_contentImage": value._contentImage, - "_ThumbnailImage": value._ThumbnailImage, + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); - }); - } - }); - $('table > #ListViewDiv > #searchItem').remove(); - //Show Error Message in case of gridview if no data is found - if ($scope.searchAIListViewData.length == 0) { - var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); - $compile($el)($scope); - $('table > #ListViewDiv > #searchItem').remove(); + $scope.searchAIListViewData.push( + { + "_id": value._id, + //"_ImageId": value._ImageId, + "_Title": value._Title, + "_contentImage": value._contentImage, + "_ThumbnailImage": value._ThumbnailImage, + - $('#ListViewDiv').append('No illustration found for the selected search criteria!'); + }); } + }); + $('table > #ListViewDiv > #searchItem').remove(); + //Show Error Message in case of gridview if no data is found + if ($scope.searchAIListViewData.length == 0) { + var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); + $compile($el)($scope); + $('table > #ListViewDiv > #searchItem').remove(); + + $('#ListViewDiv').append('No illustration found for the selected search criteria!'); + } $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); }, - function (error) { - // handle errors here - console.log(' $scope.IllustrationData = ' + error.statusText); - } - ); + function (error) { + // handle errors here + console.log(' $scope.IllustrationData = ' + error.statusText); + } + ); } $scope.ApplySearchByAlphabet = function (SearchTextByAlphabet) { - $rootScope.SearchTextByAlphabet = SearchTextByAlphabet - $rootScope.isLoading = true; - $('ul li a').removeAttr("style"); - $('#spinner').css('visibility', 'visible'); - $('#' + $rootScope.SearchTextByAlphabet ).css({ "color": "white", "background-color": "#1B92D0" }); + $rootScope.SearchTextByAlphabet = SearchTextByAlphabet + $rootScope.isLoading = true; + $('ul li a').removeAttr("style"); + $('#spinner').css('visibility', 'visible'); + $('#' + $rootScope.SearchTextByAlphabet).css({ "color": "white", "background-color": "#1B92D0" }); //color: #0095da; //background-color: #ffffff; - $scope.filterstring = true; + $scope.filterstring = true; - while ($scope.searchAIListViewData.length) { - $scope.searchAIListViewData.pop(); - } - if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { - localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet); - } - else { - localStorage.setItem("SearchByAlphabet", ''); - } + while ($scope.searchAIListViewData.length) { + $scope.searchAIListViewData.pop(); + } + if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { + localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet); + } + else { + localStorage.setItem("SearchByAlphabet", ''); + } - var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') - promise.then( - function (result) { - $scope.IllustrationData = result; - - $scope.selectedAIListViewData = new jinqJs() - .from($scope.IllustrationData.root.AIData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); - - $('#grid-view').empty(); - - angular.forEach($scope.selectedAIListViewData, function (value, key) { - - var selectimg = true; - //var count = 0; - if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { - var firstChar = value._Title[0]; - if (firstChar == SearchTextByAlphabet) { - selectimg = true; - } - else { - selectimg = false; - } - } - if (selectimg === true) { - $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; + var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') + promise.then( + function (result) { + $scope.IllustrationData = result; - var $el = $('
' - + '
' - + '' - + '

' + value._Title + '

').appendTo('#grid-view'); + $scope.selectedAIListViewData = new jinqJs() + .from($scope.IllustrationData.root.AIData) + .orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); - $compile($el)($scope); + $('#grid-view').empty(); + angular.forEach($scope.selectedAIListViewData, function (value, key) { - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); + var selectimg = true; + //var count = 0; + if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { + var firstChar = value._Title[0]; + if (firstChar == SearchTextByAlphabet) { + selectimg = true; + } + else { + selectimg = false; + } + } + if (selectimg === true) { + $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); - $scope.searchAIListViewData.push( - { - "_id": value._id, - //"_ImageId": value._ImageId, - "_Title": value._Title, - "_contentImage": value._contentImage, - "_ThumbnailImage": value._ThumbnailImage, + $compile($el)($scope); - }); - } - }); - $('table > #ListViewDiv > #searchItem').remove(); - //Show Error Message in case of gridview if no data is found - if ($scope.searchAIListViewData.length == 0) { - var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); - $compile($el)($scope); - $('table > #ListViewDiv > #searchItem').remove(); + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); - $('#ListViewDiv').append('No illustration found for the selected search criteria!'); + + $scope.searchAIListViewData.push( + { + "_id": value._id, + //"_ImageId": value._ImageId, + "_Title": value._Title, + "_contentImage": value._contentImage, + "_ThumbnailImage": value._ThumbnailImage, + + + }); } - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + }); + $('table > #ListViewDiv > #searchItem').remove(); + //Show Error Message in case of gridview if no data is found + if ($scope.searchAIListViewData.length == 0) { + var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); + $compile($el)($scope); + $('table > #ListViewDiv > #searchItem').remove(); - }, - function (error) { - console.log(' $scope.IllustrationData = ' + error.statusText); + $('#ListViewDiv').append('No illustration found for the selected search criteria!'); } - ); - } + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + }, + function (error) { + console.log(' $scope.IllustrationData = ' + error.statusText); + } + ); + } $scope.scroll = function () { @@ -596,7 +592,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $location.url('/adam-images-detail'); } - $scope.OpenAdamImageView= function () { + $scope.OpenAdamImageView = function () { if ($rootScope.refreshcheck == null) { $location.path('/'); @@ -758,4 +754,3 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout -